function tagThreads($tagname, $size = 1000) { $sql = "SELECT *\n FROM `cocoabbs_threadtags`\n LEFT JOIN `cocoabbs_threads`\n ON `cocoabbs_threadtags`.`tid` = `cocoabbs_threads`.`tid`\n WHERE `tagname` = '{$tagname}' \n ORDER BY `lastpost` DESC\n LIMIT 0,{$size};"; $result = $this->fetchArray($sql); $ret = array(); if (count($result) == 0) { return $ret; } foreach ($result as $item) { $item["id"] = $item["tid"]; $item["createtime"] = ToolModel::countTime($item["dateline"]); $item["updatetime"] = ToolModel::countTime($item["lastpost"]); $item["image"] = DiscuzModel::get_avatar($item["authorid"], "small"); $item["title"] = stripslashes($item["subject"]); $item["createby"] = $item["author"]; $item["createbyid"] = $item["authorid"]; $item["lastreply"] = $item["lastposter"]; $item["replys"] = $item["replies"]; $ret[] = $item; } return $ret; }
public function avatarAction() { if ($this->userid == 0) { header("location: /"); die; } if (isset($_FILES['ImageFile'])) { $this->uploadFile(); die; } if ($_POST) { $this->saveAvatar(); die; } $avatar = DiscuzModel::get_avatar($this->userid, "small"); $this->_mainContent->assign("avatar", $avatar); $this->display(); }
public function banuserAction() { $userModel = new UserModel(); $threadModel = new ThreadModel(); if ($_POST) { $userid = $_POST["userid"]; if ($userid <= 0 || $userid == 2) { header('HTTP/1.1 301 Moved Permanently'); header("location:/home/"); die; } $userModel->banUser($userid); if ($_POST["delallthread"]) { $threadModel->delUserAllThread($userid); } if ($_POST["delallreply"]) { $threadModel->delUserAllReply($userid); } header('HTTP/1.1 301 Moved Permanently'); header("location:/user/show/{$userid}/"); die; } $id = $this->intVal(3); if ($id == 0 || $id == 2 || $this->userid != 2) { header('HTTP/1.1 301 Moved Permanently'); header("location:/home/"); } $userinfo = $userModel->userInfo($id); $userinfo["image"] = DiscuzModel::get_avatar($id, "middle"); $userinfo["threadscreate"] = $threadModel->threadsByUserid($id, 5); $this->_mainContent->assign("user", $userinfo); $this->display(); }
public function users($page, $size, $order = "reputation") { $start = ($page - 1) * $size; $users = $this->select("cocoabbs_uc_members"); if ($order == "date") { $this->orderby("regdate DESC"); } else { if ($order == "money") { $this->orderby("money DESC"); } else { if ($order == "shui") { $this->fields("*,(posts*5+replys) as shui")->orderby("shui DESC"); } else { $this->orderby("reputation DESC"); } } } $this->where("`validated` = 1")->limit("{$start},{$size}"); $users = $this->fetchAll(); $ret = array(); if (count($users) == 0) { return $ret; } foreach ($users as $item) { $item["regdate"] = ToolModel::countTime($item["regdate"]); if ($item["lastlogintime"] != 0) { $item["lastlogintime"] = ToolModel::countTime($item["lastlogintime"]); } else { $item["lastlogintime"] = "没有记录"; } $item["image"] = DiscuzModel::get_avatar($item["uid"], "small"); $ret[] = $item; } return $ret; }
public function threadsByTag($tag, $page, $pageSize) { $start = ($page - 1) * $pageSize; $countSql = "SELECT count(*) FROM `threads`\n LEFT JOIN `threadtags` ON `threads`.`id` = `threadtags`.`tid` \n WHERE `del` = 0 AND `tagname`='{$tag}'"; $sql = "SELECT * FROM `threads`\n LEFT JOIN `threadtags` ON `threads`.`id` = `threadtags`.`tid` \n WHERE `del` = 0 AND `tagname`='{$tag}'\n ORDER BY `id` DESC \n limit {$start},{$pageSize};"; $result = $this->fetchArray($sql); $ret = array(); if (count($result) == 0) { return $ret; } foreach ($result as $item) { $item["createtime"] = ToolModel::countTime($item["createdate"]); $item["updatetime"] = ToolModel::countTime($item["updatedate"]); $item["image"] = DiscuzModel::get_avatar($item["createbyid"], "small"); $item["title"] = stripslashes($item["title"]); $item["tagArray"] = explode(",", $item["tags"]); $ret[] = $item; } return $ret; }