Example #1
0
 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;
 }
Example #2
0
 public function feedbackAction()
 {
     $db = new PlaygroundModel();
     $sql = "SELECT * FROM `playground_feedback` order by `id` DESC;";
     $ret = $db->fetchArray($sql);
     $feedbacks = array();
     foreach ($ret as $line) {
         $line["feedback"] = urldecode($line["feedback"]);
         $line["feedback"] = ToolModel::toHtml($line["feedback"]);
         if ($line["createtime"] != 0) {
             $line["createtime"] = ToolModel::countTime($line["createtime"]);
         } else {
             $line["createtime"] = "";
         }
         $feedbacks[] = $line;
     }
     $this->_mainContent->assign("feedbacks", $feedbacks);
     $this->display();
 }
Example #3
0
 public function money_records($userid)
 {
     $records = $this->select("money")->where("userid = {$userid}")->orderby("`updatetime` DESC")->fetchAll();
     if (!$records) {
         return array();
     }
     $newRecords = array();
     foreach ($records as $money) {
         $money["time"] = ToolModel::countTime($money["updatetime"]);
         $newRecords[] = $money;
     }
     return $newRecords;
 }
Example #4
0
 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;
 }