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); } }
/** * @param int $id 图集ID * @param int $c_p 页数,默认使用0,根据其进行排序 */ public function gallery($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("Gallery", 'GalleryComment'); $g = new Gallery($id); $info = $g->getInfo(true); if (!is_array($info) || !isset($info['gallery_status']) || $info['gallery_status'] != 1 && !(is_login() && $info['user_id'] == login_user()->getId() && strtolower(req()->get('preview')) == 'true')) { $this->__load_404(); } else { $this->theme->setTitle($info['gallery_title'] . " [图集]"); $this->__view("Home/header.php"); $this->__view("Show/gallery.php", ['gallery' => $g, 'info' => $info, 'CommentData' => new GalleryComment($id, $c_p, $info)]); $this->__view("Home/footer.php"); } }
public function message_like_gallery($rt, $gid, $uid) { try { if (!is_array($rt)) { lib()->load('Gallery'); $rt = Gallery::getSimpleInfo($gid); } if (!isset($rt['gallery_id']) || $rt['users_id'] == $uid || !$this->notice($rt['users_id'], 'message', 'like_gallery')) { return $rt; } $user = User::getUser($rt['users_id']); $like_user = User::getUser($uid); $mt = new MailTemplate("message_notice/like_gallery.md"); $mt->setUserInfo($user->getInfo()); $mt->setValues(['like_user_name' => $like_user->getAliases(), 'gallery_title' => $rt['gallery_title'], 'like_user_url' => user_link($like_user->getName()), 'gallery_page' => gallery_link($gid), 'like_count' => $rt['gallery_like_count']]); $this->message->addNoticeMsg($mt->getTitle(), $mt->getContent(), $user->getId()); } catch (\Exception $ex) { Log::write(_("NoticeApply message_like_gallery create a Exception.") . "EX:[" . $ex->getCode() . "]:" . $ex->getMessage(), Log::NOTICE); } return $rt; }
public function list_gallery() { lib()->load('Gallery'); $g = new Gallery(0, login_user()->getId()); $this->theme->setBreadcrumb("图集列表"); $this->theme->setTitle("管理你的图册"); $this->__view("User/header.php"); $req = req()->_plain(); $this->__view("Photo/list_gallery.php", ['list' => $g->getList($req->get('page'), $req->get('number'))]); $this->__view("User/footer.php"); }
public function gallery_set_front_cover() { try { $this->throwMsgCheck('is_post', 'is_login', 'is_active'); lib()->load('Gallery'); $g = new Gallery(); $this->rt_msg['content'] = $g->set_front_cover(req()->_plain()->post('gallery_id'), req()->_plain()->post('pic_id'), login_user()->getId()); $this->rt_msg['status'] = true; } catch (\Exception $ex) { $this->rt_msg['msg'] = $ex->getMessage(); $this->rt_msg['code'] = $ex->getCode(); } }