コード例 #1
0
ファイル: ListGallery.php プロジェクト: ttym7993/Linger
 private function parseList(&$list)
 {
     if (count($list) > 0) {
         lib()->load('Picture', 'Gallery');
         $pic = new Picture();
         $g = new Gallery();
         $pic->parsePic($list, false);
         $g->listAddTags($list);
     }
 }
コード例 #2
0
ファイル: Show.php プロジェクト: ttym7993/Linger
 /**
  * @param int $id  图片ID
  * @param int $c_p 页数,默认使用0,根据其进行排序
  */
 public function picture($id = 0, $c_p = 0)
 {
     $id = intval($id);
     $c_p = intval($c_p);
     $n = func_num_args();
     if ($n < 1 || $n > 2 || $c_p < 0 || $id < 1) {
         $this->__load_404();
         return;
     }
     $this->__lib('Picture', 'PictureComment');
     $pic = new Picture();
     $info = $pic->get_pic($id);
     if (!is_array($info)) {
         $this->__load_404();
     } else {
         $this->theme->setTitle("第 {$info['pic_id']} 号图片");
         $this->__view("Home/header.php");
         $this->__view("Show/picture.php", ['info' => $info, 'CommentData' => new PictureComment($info['pic_id'], $c_p, $info)]);
         $this->__view("Home/footer.php");
     }
 }
コード例 #3
0
ファイル: NoticeApply.php プロジェクト: ttym7993/Linger
 public function message_like_pic($rt, $pid, $uid)
 {
     try {
         if (!is_array($rt)) {
             lib()->load('Picture');
             $pic = new Picture();
             $rt = $pic->get_simple_pic($pid);
         }
         if (!isset($rt['pic_id']) || $rt['user_id'] == $uid || !$this->notice($rt['user_id'], 'message', 'like_pic')) {
             return $rt;
         }
         $user = User::getUser($rt['user_id']);
         $like_user = User::getUser($uid);
         $mt = new MailTemplate("message_notice/like_picture.md");
         $mt->setUserInfo($user->getInfo());
         $mt->setValues(['like_user_name' => $like_user->getAliases(), 'picture_name' => $rt['pic_name'] ?: "Number " . $pid, 'like_user_url' => user_link($like_user->getName()), 'picture_display_url' => $rt['pic_display_url'], 'picture_page' => picture_link($pid), 'like_count' => $rt['pic_like_count']]);
         $this->message->addNoticeMsg($mt->getTitle(), $mt->getContent(), $user->getId());
     } catch (\Exception $ex) {
         Log::write(_("NoticeApply message_like_pic create a Exception.") . "EX:[" . $ex->getCode() . "]:" . $ex->getMessage(), Log::NOTICE);
     }
     return $rt;
 }
コード例 #4
0
ファイル: Photo.php プロジェクト: ttym7993/Linger
 public function list_pic()
 {
     $this->theme->setBreadcrumb("图片列表");
     $this->theme->setTitle("管理你的图片");
     lib()->load('Picture');
     $pic = new Picture();
     $req = req()->_plain();
     $info = ['error' => true];
     try {
         $info = $pic->select(login_user()->getId(), $req->get('page'), $req->get('number'));
     } catch (\Exception $ex) {
         $info['error'] = $ex->getMessage();
     }
     $this->__view("User/header.php");
     $this->__view("Photo/list_pic.php", $info);
     $this->__view("User/footer.php");
 }
コード例 #5
0
ファイル: Gallery.php プロジェクト: ttym7993/Linger
 /**
  * 获取图集的图片
  * @param $gallery_id
  * @return array|bool
  */
 public function getPictures($gallery_id)
 {
     $rt = $this->db->select("pictures", ['[><]gallery_has_pictures' => ['id' => 'pictures_id'], '[><]server' => ['server_name' => 'name']], ['gallery_has_pictures.gallery_id' => 'gallery_id', 'pictures.id' => 'pic_id', 'server.url' => 'server_url', 'pictures.pic_path' => 'pic_path', 'pictures.pic_name' => 'pic_name', 'pictures.pic_create_time' => 'pic_create_time', 'pictures.pic_width' => 'pic_width', 'pictures.pic_height' => 'pic_height', 'pictures.pic_description' => 'pic_description', 'pictures.pic_thumbnails_path' => 'pic_thumbnails_path', 'pictures.pic_thumbnails_width' => 'pic_thumbnails_width', 'pictures.pic_thumbnails_height' => 'pic_thumbnails_height', 'pictures.pic_hd_path' => 'pic_hd_path', 'pictures.pic_hd_width' => 'pic_hd_width', 'pictures.pic_hd_height' => 'pic_hd_height', 'pictures.pic_status' => 'pic_status', 'pictures.pic_comment_count' => 'pic_comment_count', 'pictures.pic_display_path' => 'pic_display_path', 'pictures.pic_display_width' => 'pic_display_width', 'pictures.pic_display_height' => 'pic_display_height'], ['AND' => ['gallery_has_pictures.gallery_id' => $gallery_id]]);
     //		for($i = 0, $l = count($rt); $i < $l; $i++){
     //			if($rt[$i]['pic_thumbnails_path'] === 'thumbnail'){
     //				$rt[$i]['url'] = $rt[$i]['server_url'] . $rt[$i]['pic_path'] . "/thumbnail";
     //			} else{
     //				$rt[$i]['url'] = $rt[$i]['server_url'] . $rt[$i]['pic_thumbnails_path'];
     //			}
     //		}
     lib()->load('Picture');
     $pic = new Picture();
     $pic->parsePic($rt, false);
     $pic->list_add_tags($rt);
     return $rt;
 }
コード例 #6
0
ファイル: UserApi.php プロジェクト: ttym7993/Linger
 public function picture_like()
 {
     try {
         $this->throwMsgCheck('is_post', 'is_login', 'is_active');
         lib()->load('Picture');
         $pic = new Picture();
         $pic->like(req()->post('id'), login_user()->getId());
         $this->rt_msg['status'] = true;
     } catch (\Exception $ex) {
         $this->rt_msg['msg'] = $ex->getMessage();
         $this->rt_msg['code'] = $ex->getCode();
     }
 }