blog
[ class tree: blog ] [ index: blog ] [ all elements ]

Source for file blog.inc.php

Documentation is available at blog.inc.php

  1. <?php
  2.     /**
  3.      * @author            Matthias Reuter ($LastChangedBy: matthias $)
  4.      * @version            $LastChangedDate: 2009-01-18 03:52:31 +0000 (So, 18 Jan 2009) $
  5.      * @package            blog
  6.      * @copyright        2007-2010 IPBWI development team
  7.      * @link            http://ipbwi.com/examples/topic.php
  8.      * @since            2.0
  9.      * @license            http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
  10.      */
  11.     class ipbwi_blog extends ipbwi {
  12.         private $ipbwi            null;
  13.         public $installed        = false;
  14.         public $online            = false;
  15.  
  16.         /**
  17.          * @desc            Loads and checks different vars when class is initiating
  18.          * @author            Matthias Reuter
  19.          * @since            2.0
  20.          * @ignore
  21.          */
  22.         public function __construct($ipbwi){
  23.             // loads common classes
  24.             $this->ipbwi $ipbwi;
  25.  
  26.             // check if IP.gallery is installed
  27.             $query $this->ipbwi->ips_wrapper->DB->query('SELECT conf_value,conf_default FROM '.$this->ipbwi->board['sql_tbl_prefix'].'core_sys_conf_settings WHERE conf_key="blog_online"');
  28.             if($this->ipbwi->ips_wrapper->DB->getTotalRows($query!= 0){
  29.                 $data $this->ipbwi->ips_wrapper->DB->fetch($query);
  30.                 // retrieve Gallery URL
  31.                 $this->online = (($data['conf_value'!= ''$data['conf_value'$data['conf_default']);
  32.                 $this->installed = true;
  33.             }
  34.         }
  35.         /**
  36.          * @desc            lists latest Blog Entries from IP.blog
  37.          * @param    mixed    $blogIDs The blog IDs where the entries should be retrieved from (array-list or int) Use '*', leave empty or set to false for entries from all blogs)
  38.          * @param    array    $settings optional query settings. Settings allowed: limit and start
  39.          *  + int start = Default: 0
  40.          *  + int limit = Default: 15
  41.          * @return    array    Blog-Entry-Informations as multidimensional array
  42.          * @author            Matthias Reuter
  43.          * @since            2.04
  44.          */
  45.         public function getLatestList($blogIDs=false,$settings=array()){
  46.             if($this->installed === true){
  47.                 if(is_array($blogIDs)){
  48.                     // todo
  49.                 }elseif($blogIDs == '*'){
  50.                     $viewable $this->getViewable();
  51.                     if(isset($viewable[1])){
  52.                         $viewable[0'0';
  53.                     }
  54.                     $blogQuery ' AND (e.blog_id="'.implode('" OR e.blog_id="',$viewable).'")';
  55.                 }elseif(intval($blogIDs!= 0){
  56.                     $blogQuery ' AND e.blog_id="'.$blogIDs.'"';
  57.                 }else{
  58.                     $blogQuery false;
  59.                 }
  60.                 if(empty($settings['start'])){
  61.                     $settings['start'0;
  62.                 }
  63.                 if(empty($settings['limit'])){
  64.                     $settings['limit'15;
  65.                 }
  66.  
  67.                 // get latest blog entries
  68.                 $query $this->ipbwi->ips_wrapper->DB->query('SELECT e.*,b.* FROM '.$this->ipbwi->board['sql_tbl_prefix'].'blog_entries e LEFT JOIN '.$this->ipbwi->board['sql_tbl_prefix'].'blog_blogs b ON (b.blog_id=e.blog_id) WHERE e.entry_status="published"'.$blogQuery.' ORDER BY e.entry_id DESC LIMIT '.intval($settings['start']).','.intval($settings['limit']));
  69.                 if($this->ipbwi->ips_wrapper->DB->getTotalRows($query== 0){
  70.                     return false;
  71.                 }
  72.                 $data array();
  73.                 while($row $this->ipbwi->ips_wrapper->DB->fetch($query)){
  74.                     $row['entry_author_name']    $this->ipbwi->properXHTML($row['entry_author_name']);
  75.                     $row['entry_name']            $this->ipbwi->properXHTML($row['entry_name']);
  76.                     $row['entry']                $this->ipbwi->properXHTML($row['entry']);
  77.                     $row['entry_edit_name']        $this->ipbwi->properXHTML($row['entry_edit_name']);
  78.                     $row['blog_name']            $this->ipbwi->properXHTML($row['blog_name']);
  79.                     $row['blog_desc']            $this->ipbwi->properXHTML($row['blog_desc']);
  80.                     $data[$row;
  81.                 }
  82.                 return $data;
  83.             }else{
  84.                 return false;
  85.             }
  86.         }
  87.     }
  88. ?>

Documentation generated on Sat, 23 Oct 2010 23:35:47 +0200 by phpDocumentor 1.4.3