Example #1
0
 protected function _user()
 {
     $cid = Utils::pg("cid", 0);
     $uid = Utils::pg("uid", 0);
     $cat = new Category($cid);
     $user = new User($uid);
     $this->_smarty->assign('category_tree', $cat->getSubTree(true));
     $this->_smarty->assign('page_title', $user->_dbo->user_login);
     $this->_smarty->assign('user_login', $user->_dbo->user_login);
     $this->_smarty->assign('user_name', $user->_dbo->user_name);
     $pids = $cat->getPhotos();
     if (!empty($pids)) {
         $in_s = implode(", ", $pids);
         $q = $this->_db->prepare("SELECT photo_id FROM phph_photos WHERE photo_id IN ({$in_s}) AND photo_approved IS NOT NULL AND user_id = ? ORDER BY photo_added DESC LIMIT ?, ?");
         $res = $this->_db->execute($q, array($uid, intval($this->_page) * $this->_count, intval($this->_count)));
         $photos = array();
         while ($row = $res->fetchRow()) {
             $photos[] = get_photo($row['photo_id'], $cid);
         }
         $this->_smarty->assign('photos', $photos);
         $this->_pages = pager(url('user', array('cid' => $cid, 'uid' => $uid)), count(array_unique($pids)));
         $this->_smarty->assign('pager', $this->_pages);
     }
 }