function __construct(cs_phpDB $db, $user, $location = null)
 {
     if (strlen($user) > 2) {
         parent::__construct($db);
         $criteria = array('isActive' => "t");
         if (is_string($location) && strlen($location)) {
             $criteria['location'] = $location;
         }
         $uid = $this->get_uid($user);
         if (is_numeric($uid)) {
             $this->validBlogs = $this->get_blogs($criteria, 'last_post_timestamp DESC');
             $permObj = new csb_permission($db);
             foreach ($this->validBlogs as $blogId => $data) {
                 $obj = new csb_blog($this->db, $data['blog_name']);
                 $canAccess = $permObj->can_access_blog($blogId, $uid);
                 if (!$canAccess) {
                     unset($this->validBlogs[$blogId]);
                 }
             }
         } else {
             throw new exception(__METHOD__ . ": unable to retrieve uid for (" . $user . ")");
         }
     } else {
         throw new exception(__METHOD__ . ": no username set (" . $user . ")");
     }
 }
 function __construct(cs_phpDB $db, $location)
 {
     parent::__construct($db);
     $loc = new csb_location($db);
     $location = $loc->fix_location($location);
     $criteria = array('isActive' => "t", 'location' => $location);
     try {
         $this->validBlogs = $this->get_blogs($criteria, 'blog_display_name DESC');
     } catch (exception $e) {
         throw new exception(__METHOD__ . ": failed to retrieve any valid blogs for location=(" . $location . ")... " . "MORE INFO::: " . $e->getMessage());
     }
 }
Esempio n. 3
0
 /**
  * The constructor.
  * 
  * @param $blogName		(str) name of blog (NOT the display name)
  * @param $dbType		(str) Type of database (pgsql/mysql/sqlite)
  * 
  * @return exception	throws an exception on error.
  */
 public function __construct(cs_phpDB $db, $blogName)
 {
     //TODO: put these in the constructor args, or require CONSTANTS.
     parent::__construct($db);
     if (!isset($blogName) || !strlen($blogName)) {
         throw new exception(__METHOD__ . ": invalid blog name (" . $blogName . ")");
     }
     $this->blogName = $blogName;
     if (!defined('CSBLOG_SETUP_PENDING')) {
         //proceed normally...
         $this->initialize_locals($blogName);
     }
 }
 /**
  * The constructor.
  * 
  * @param $db				(cs_phpDB) database object
  * @param $fullPermalink	(str) FULL Permalink.
  * 
  * @return exception	throws an exception on error.
  */
 public function __construct(cs_phpDB $db, $fullPermalink)
 {
     //TODO: put these in the constructor args, or require CONSTANTS.
     parent::__construct($db);
     if (isset($fullPermalink) && strlen($fullPermalink)) {
         $bits = $this->parse_full_permalink($fullPermalink);
         $this->blogLocation = $bits['location'];
         $this->blogName = $bits['blogName'];
         $this->permalink = $bits['permalink'];
         $data = $this->get_blog_entry($fullPermalink);
         $this->blogEntryId = $data['entry_id'];
     } else {
         throw new exception(__METHOD__ . ": invalid permalink (" . $fullPermalink . ")");
     }
 }
 public function __construct(cs_phpDB $db)
 {
     parent::__construct($db);
     $this->gfObj = new cs_globalFunctions();
 }