function DoList() { $qid = intval($this->Get['qid']); if (!$qid) { widget_error('Id is empty', 102); } $page = intval($this->Get['page']); $page_size = intval($this->Get['page_size']); $page_size = $page_size == 0 ? 10 : $page_size; if (!$this->QunLogic->is_exists($qid)) { widget_error('Id is invalid', 103); } $where_sql = " tq.item_id='{$qid}' "; $order_sql = " t.dateline DESC "; $total_record = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t \t\t FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t \t\t LEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t \t\t USING(tid)\r\n\t\t\t\t\t\t\t\t \t\t WHERE {$where_sql}"); if ($total_record > 0) { $page_arr = $this->_page($total_record, $page_size); $query = DB::query("SELECT t.*\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\tUSING(tid)\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\t\t\t\tLIMIT {$page_arr['offset']},{$page_arr['limit']}"); $topic_list = array(); while ($value = DB::fetch($query)) { $topic_list[] = $value; } $topic_list = $this->TopicLogic->MakeAll($topic_list); $data = array('total_record' => $total_record, 'topic_list' => $topic_list, 'page_arr' => $page_arr); widget_output($data); } else { widget_error('List is empty', 104); } }
function MasterObject(&$config) { if (!$config['widget_enable']) { $msg = 'Widget功能没有启用'; if (get_param('in_ajax')) { widget_error($msg); } else { exit($msg); } } $this->Config = $config; $this->Get =& $_GET; $this->Post =& $_POST; $this->Module = get_param('mod'); $this->Code = get_param('code'); $this->DatabaseHandler =& Obj::registry('DatabaseHandler'); $this->MemberHandler = jclass('member'); $this->MemberHandler->init(); if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { widget_error($this->MemberHandler->GetError(), 203); } Obj::register("MemberHandler", $this->MemberHandler); define("FORMHASH", substr(md5(substr(time(), 0, -4) . $this->Config['auth_key']), 0, 16)); if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($this->Post["FORMHASH"] != FORMHASH) { } } }