Esempio n. 1
0
 function do_iCMS($appid = 0)
 {
     iPHP::import(iPHP_APP_CORE . '/iAPP.class.php');
     $this->categoryApp = iACP::app('category', 'all');
     $this->category = $this->categoryApp->category;
     $sql = "WHERE 1=1";
     if ($appid || $_GET['appid']) {
         $_GET['appid'] && ($appid = (int) $_GET['appid']);
         $sql .= " AND `appid`='{$appid}'";
     }
     $_GET['iid'] && ($sql .= " AND `iid`='" . (int) $_GET['iid'] . "'");
     isset($_GET['status']) && ($sql .= " AND `status`='" . $_GET['status'] . "'");
     if ($_GET['cid']) {
         $cid = (int) $_GET['cid'];
         if (isset($_GET['sub'])) {
             $cids = $this->categoryApp->get_ids($cid, true);
             array_push($cids, $cid);
             $sql .= " AND cid IN(" . implode(',', $cids) . ")";
         } else {
             $sql .= " AND cid ='{$cid}'";
         }
     }
     $_GET['userid'] && ($sql .= " AND `userid`='" . (int) $_GET['userid'] . "'");
     $_GET['ip'] && ($sql .= " AND `ip`='" . $_GET['ip'] . "'");
     if ($_GET['keywords']) {
         $sql .= "  AND CONCAT(username,title) REGEXP '{$_GET['keywords']}'";
     }
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__comment` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "条评论");
     $rs = iDB::all("SELECT * FROM `#iCMS@__comment` {$sql} order by id DESC LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("comment.manage");
 }
Esempio n. 2
0
 function do_iCMS()
 {
     if ($_GET['keywords']) {
         $sql = " WHERE `keyword` REGEXP '{$_GET['keywords']}'";
     }
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__keywords` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个关键词");
     $rs = iDB::all("SELECT * FROM `#iCMS@__keywords` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("keywords.manage");
 }
Esempio n. 3
0
 function do_manage()
 {
     $sql = " where 1=1";
     $cid = (int) $_GET['cid'];
     $tcid = (int) $_GET['tcid'];
     $pid = (int) $_GET['pid'];
     $rootid = (int) $_GET['rootid'];
     $_GET['keywords'] && ($sql .= " AND CONCAT(name,seotitle,subtitle,keywords,description) REGEXP '{$_GET['keywords']}'");
     $sql .= $this->categoryApp->search_sql($cid);
     $sql .= $this->tagcategory->search_sql($tcid, 'tcid');
     $_GET['starttime'] && ($sql .= " AND `pubdate`>='" . iPHP::str2time($_GET['starttime'] . " 00:00:00") . "'");
     $_GET['endtime'] && ($sql .= " AND `pubdate`<='" . iPHP::str2time($_GET['endtime'] . " 23:59:59") . "'");
     $_GET['post_starttime'] && ($sql .= " AND `postime`>='" . iPHP::str2time($_GET['post_starttime'] . " 00:00:00") . "'");
     $_GET['post_endtime'] && ($sql .= " AND `postime`<='" . iPHP::str2time($_GET['post_endtime'] . " 23:59:59") . "'");
     isset($_GET['pic']) && ($sql .= " AND `haspic` ='" . ($_GET['pic'] ? 1 : 0) . "'");
     if (isset($_GET['pid']) && $pid != '-1') {
         $uri_array['pid'] = $pid;
         if ($_GET['pid'] == 0) {
             $sql .= " AND `pid`=''";
         } else {
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $map_where = map::where($pid);
         }
     }
     if ($map_where) {
         $map_sql = iCMS::map_sql($map_where);
         $sql = ",({$map_sql}) map {$sql} AND `id` = map.`iid`";
     }
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__tags` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个标签");
     $limit = 'LIMIT ' . iPHP::$offset . ',' . $maxperpage;
     if ($map_sql || iPHP::$offset) {
         $ids_array = iDB::all("\n                SELECT `id` FROM `#iCMS@__tags` {$sql}\n                ORDER BY {$orderby} {$limit}\n            ");
         //iDB::debug(1);
         $ids = iCMS::get_ids($ids_array);
         $ids = $ids ? $ids : '0';
         $sql = "WHERE `id` IN({$ids})";
         $limit = '';
     }
     $rs = iDB::all("SELECT * FROM `#iCMS@__tags` {$sql} ORDER BY {$orderby} {$limit}");
     $_count = count($rs);
     include iACP::view("tags.manage");
 }
Esempio n. 4
0
 function do_iCMS()
 {
     if ($_GET['job']) {
         require_once iPHP_APP_CORE . '/iJob.class.php';
         $job = new JOB();
     }
     $sql = "WHERE 1=1";
     //isset($this->type)	&& $sql.=" AND `type`='$this->type'";
     $_GET['gid'] && ($sql .= " AND `gid`='{$_GET['gid']}'");
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "uid DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__members` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个用户");
     $rs = iDB::all("SELECT * FROM `#iCMS@__members` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("account.manage");
 }
Esempio n. 5
0
 function do_iCMS()
 {
     //iPHP::app('user.class','static');
     $sql = "WHERE 1=1";
     $pid = $_GET['pid'];
     if ($_GET['keywords']) {
         $sql .= " AND CONCAT(username,nickname) REGEXP '{$_GET['keywords']}'";
     }
     $_GET['gid'] && ($sql .= " AND `gid`='{$_GET['gid']}'");
     if (isset($_GET['status']) && $_GET['status'] !== '') {
         $sql .= " AND `status`='{$_GET['status']}'";
     }
     $_GET['regip'] && ($sql .= " AND `regip`='{$_GET['regip']}'");
     $_GET['loginip'] && ($sql .= " AND `lastloginip`='{$_GET['loginip']}'");
     if (isset($_GET['pid']) && $pid != '-1') {
         $uri_array['pid'] = $pid;
         if ($_GET['pid'] == 0) {
             $sql .= " AND `pid`=''";
         } else {
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $map_where = map::where($pid);
         }
     }
     if ($map_where) {
         $map_sql = iCMS::map_sql($map_where);
         $sql = ",({$map_sql}) map {$sql} AND `uid` = map.`iid`";
     }
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "uid DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__user` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个用户");
     $limit = 'LIMIT ' . iPHP::$offset . ',' . $maxperpage;
     if ($map_sql || iPHP::$offset) {
         $ids_array = iDB::all("\n                SELECT `uid` FROM `#iCMS@__user` {$sql}\n                ORDER BY {$orderby} {$limit}\n            ");
         //iDB::debug(1);
         $ids = iCMS::get_ids($ids_array, 'uid');
         $ids = $ids ? $ids : '0';
         $sql = "WHERE `uid` IN({$ids})";
         $limit = '';
     }
     $rs = iDB::all("SELECT * FROM `#iCMS@__user` {$sql} ORDER BY {$orderby} {$limit}");
     $_count = count($rs);
     include iACP::view("user.manage");
 }
Esempio n. 6
0
 function do_iCMS()
 {
     iACP::MP('FILE.MANAGE', 'page');
     $sql = 'WHERE 1=1 ';
     if ($_GET['keywords']) {
         if ($_GET['st'] == "filename") {
             $sql .= " AND `filename` REGEXP '{$_GET['keywords']}'";
         } else {
             if ($_GET['st'] == "indexid") {
                 $sql .= " AND `indexid`='{$_GET['keywords']}'";
             } else {
                 if ($_GET['st'] == "userid") {
                     $sql .= " AND `userid` = '{$_GET['keywords']}'";
                 } else {
                     if ($_GET['st'] == "ofilename") {
                         $sql .= " AND `ofilename` REGEXP '{$_GET['keywords']}'";
                     } else {
                         if ($_GET['st'] == "size") {
                             $sql .= " AND `size` REGEXP '{$_GET['keywords']}'";
                         }
                     }
                 }
             }
         }
     }
     $_GET['indexid'] && ($sql .= " AND `indexid`='{$_GET['indexid']}'");
     $_GET['starttime'] && ($sql .= " and `time`>=UNIX_TIMESTAMP('" . $_GET['starttime'] . " 00:00:00')");
     $_GET['endtime'] && ($sql .= " and `time`<=UNIX_TIMESTAMP('" . $_GET['endtime'] . " 23:59:59')");
     isset($_GET['userid']) && ($uri .= '&userid=' . (int) $_GET['userid']);
     $orderby = $_GET['orderby'] ? iS::escapeStr($_GET['orderby']) : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 50;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__filedata` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个文件");
     $rs = iDB::all("SELECT * FROM `#iCMS@__filedata` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("files.manage");
 }
Esempio n. 7
0
 public static function pagenav($total, $displaypg = 20, $unit = "条记录", $url = '', $target = '')
 {
     $displaypg = intval($displaypg);
     $page = $GLOBALS["page"] ? intval($GLOBALS["page"]) : 1;
     $lastpg = ceil($total / $displaypg);
     //最后页,也是总页数
     $page = min($lastpg, $page);
     $prepg = $page - 1 < 0 ? "0" : $page - 1;
     //上一页
     $nextpg = $page == $lastpg ? 0 : $page + 1;
     //下一页
     $url = buildurl($url, array('total_num' => $total, 'page' => ''));
     self::$offset = ($page - 1) * $displaypg;
     self::$offset < 0 && (self::$offset = 0);
     self::$pagenav = "<ul><li><a href='{$url}1' target='_self'>首页</a></li>";
     self::$pagenav .= $prepg ? "<li><a href='{$url}{$prepg}' target='_self'>上一页</a></li>" : '<li class="disabled"><a href="javascript:;">上一页</a></li>';
     $flag = 0;
     for ($i = $page - 2; $i <= $page - 1; $i++) {
         if ($i < 1) {
             continue;
         }
         self::$pagenav .= "<li><a href='{$url}{$i}' target='_self'>{$i}</a></li>";
     }
     self::$pagenav .= '<li class="active"><a href="javascript:;">' . $page . '</a></li>';
     for ($i = $page + 1; $i <= $lastpg; $i++) {
         self::$pagenav .= "<li><a href='{$url}{$i}' target='_self'>{$i}</a></li>";
         $flag++;
         if ($flag == 4) {
             break;
         }
     }
     self::$pagenav .= $nextpg ? "<li><a href='{$url}{$nextpg}' target='_self'>下一页</a></li>" : '<li class="disabled"><a href="javascript:;">下一页</a></li>';
     self::$pagenav .= "<li><a href='{$url}{$lastpg}' target='_self'>末页</a></li>";
     self::$pagenav .= "<li> <span class=\"muted\">共{$total}{$unit},{$displaypg}{$unit}/页 共{$lastpg}页</span></li>";
     for ($i = 1; $i <= $lastpg; $i = $i + 5) {
         $s = $i == $page ? ' selected="selected"' : '';
         $select .= "<option value=\"{$i}\"{$s}>{$i}</option>";
     }
     if ($lastpg > 200) {
         self::$pagenav .= "<li> <span class=\"muted\">跳到 <input type=\"text\" id=\"pageselect\" style=\"width:24px;height:12px;margin-bottom: 0px;line-height: 12px;\" /> 页 <input class=\"btn btn-small\" type=\"button\" onClick=\"window.location='{$url}'+\$('#pageselect').val();\" value=\"跳转\" style=\"height: 22px;line-height: 18px;\"/></span></li>";
     } else {
         self::$pagenav .= "<li> <span class=\"muted\">跳到 <select id=\"pageselect\" style=\"width:48px;height:20px;margin-bottom: 3px;line-height: 16px;padding: 0px\" onchange=\"window.location='{$url}'+this.value\">{$select}</select> 页</span></li>";
     }
     self::$pagenav .= '</ul>';
     //(int)$lastpg<2 &&UCP::$pagenav='';
 }
Esempio n. 8
0
 function do_list()
 {
     iACP::$app_do = 'list';
     $sql = " where `appid`='{$this->appid}'";
     $cids = iACP::CP('__CID__');
     $sql .= iPHP::where($cids, 'cid');
     if ($_GET['keywords']) {
         if ($_GET['st'] == "name") {
             $sql .= " AND `name` REGEXP '{$_GET['keywords']}'";
         } else {
             if ($_GET['st'] == "cid") {
                 $sql .= " AND `cid` REGEXP '{$_GET['keywords']}'";
             } else {
                 if ($_GET['st'] == "tkd") {
                     $sql .= " AND CONCAT(name,title,keywords,description) REGEXP '{$_GET['keywords']}'";
                 }
             }
         }
     }
     if (isset($_GET['rootid']) && $_GET['rootid'] != '-1') {
         $sql .= " AND `rootid`='{$_GET['rootid']}'";
     }
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "cid DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__category` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage);
     $rs = iDB::all("SELECT * FROM `#iCMS@__category` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("category.manage");
 }
Esempio n. 9
0
 function do_project()
 {
     $categoryApp = iACP::app('category', iCMS_APP_ARTICLE);
     $category = $categoryApp->category;
     $sql = "where 1=1";
     if ($_GET['keywords']) {
         $sql .= " and `name` REGEXP '{$_GET['keywords']}'";
     }
     $sql .= $categoryApp->search_sql($this->cid);
     if ($_GET['rid']) {
         $sql .= " AND `rid` ='" . (int) $_GET['rid'] . "'";
     }
     if ($_GET['auto']) {
         $sql .= " AND `auto` ='1'";
     }
     if ($_GET['poid']) {
         $sql .= " AND `poid` ='" . (int) $_GET['poid'] . "'";
     }
     $ruleArray = $this->rule_opt(0, 'array');
     $postArray = $this->post_opt(0, 'array');
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__spider_project` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个方案");
     $rs = iDB::all("SELECT * FROM `#iCMS@__spider_project` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("spider.project");
 }
Esempio n. 10
0
 function do_manage($doType = null)
 {
     $cid = (int) $_GET['cid'];
     $sql = " where ";
     switch ($doType) {
         //status:[0:草稿][1:正常][2:回收][3:审核][4:不合格]
         case 'inbox':
             //草稿
             $sql .= "`status` ='0'";
             // if(iMember::$data->gid!=1){
             // 	$sql.=" AND `userid`='".iMember::$userid."'";
             // }
             $position = "草稿";
             break;
         case 'trash':
             //回收站
             $sql .= "`status` ='2'";
             $position = "回收站";
             break;
         case 'examine':
             //审核
             $sql .= "`status` ='3'";
             $position = "已审核";
             break;
         case 'off':
             //未通过
             $sql .= "`status` ='4'";
             $position = "未通过";
             break;
         default:
             $sql .= " `status` ='1'";
             $cid && ($position = $this->category[$cid]['name']);
     }
     if ($_GET['keywords']) {
         $sql .= " AND CONCAT(title,title2,title3) REGEXP '{$_GET['keywords']}'";
     }
     $sql .= $this->categoryApp->search_sql($cid);
     isset($_GET['nopic']) && ($sql .= " AND `haspic` ='0'");
     $_GET['starttime'] && ($sql .= " and `addtime`>=UNIX_TIMESTAMP('" . $_GET['starttime'] . " 00:00:00')");
     $_GET['endtime'] && ($sql .= " and `addtime`<=UNIX_TIMESTAMP('" . $_GET['endtime'] . " 23:59:59')");
     isset($_GET['userid']) && ($uri .= '&userid=' . (int) $_GET['userid']);
     isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']);
     isset($_GET['pid']) && ($uri .= '&pid=' . $_GET['pid']);
     isset($_GET['cid']) && ($uri .= '&cid=' . $_GET['cid']);
     isset($_GET['pid']) && $_GET['pid'] != '-1' && ($uri .= '&pid=' . $_GET['at']);
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__push` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "条记录");
     $rs = iDB::all("SELECT * FROM `#iCMS@__push` {$sql} order by {$orderby} LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("push.manage");
 }
Esempio n. 11
0
 function do_iCMS()
 {
     $sql = " where 1=1";
     //        $cid			= (int)$_GET['cid'];
     //
     //        if($cid) {
     //	        $cids	= $_GET['sub']?iCMS::get_category_ids($cid,true):$cid;
     //	        $cids OR $cids	= $vars['cid'];
     //	        $sql.= iPHP::where($cids,'cid');
     //        }
     $_GET['field'] && ($sql .= " AND `field`='" . $_GET['field'] . "'");
     $_GET['field'] && ($uri .= '&field=' . $_GET['field']);
     $_GET['type'] && ($sql .= " AND `type`='" . $_GET['type'] . "'");
     $_GET['type'] && ($uri .= '&type=' . $_GET['type']);
     $_GET['cid'] && ($sql .= " AND `cid`='" . $_GET['cid'] . "'");
     $_GET['cid'] && ($uri .= '&cid=' . $_GET['cid']);
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__prop` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个属性");
     $rs = iDB::all("SELECT * FROM `#iCMS@__prop` {$sql} order by pid DESC LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("prop.manage");
 }
Esempio n. 12
0
 function do_iCMS()
 {
     $sql = " where 1=1";
     $_GET['pid'] && ($sql .= " AND `pid`='" . $_GET['pid'] . "'");
     $_GET['pid'] && ($uri .= '&pid=' . $_GET['pid']);
     $_GET['cid'] && ($sql .= " AND `cid`='" . $_GET['cid'] . "'");
     $_GET['cid'] && ($uri .= '&cid=' . $_GET['cid']);
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__marker` {$sql}", "G");
     iPHP::pagenav($total, $maxperpage, "个标记");
     $rs = iDB::all("SELECT * FROM `#iCMS@__marker` {$sql} order by id DESC LIMIT " . iPHP::$offset . " , {$maxperpage}");
     $_count = count($rs);
     include iACP::view("marker.manage");
 }
Esempio n. 13
0
 function do_manage($stype = 'normal')
 {
     $cid = (int) $_GET['cid'];
     $pid = $_GET['pid'];
     //$stype OR $stype = iACP::$app_do;
     $stype_map = array('inbox' => '0', 'normal' => '1', 'trash' => '2', 'examine' => '3', 'off' => '4');
     $map_where = array();
     //status:[0:草稿][1:正常][2:回收][3:待审核][4:不合格]
     //postype: [0:用户][1:管理员]
     $stype && ($this->_status = $stype_map[$stype]);
     if (isset($_GET['pt']) && $_GET['pt'] != '') {
         $this->_postype = (int) $_GET['pt'];
     }
     $sql = "WHERE `status`='{$this->_status}'";
     $this->_postype === 'all' or $sql .= " AND `postype`='{$this->_postype}'";
     if (iACP::MP("ARTICLE.VIEW")) {
         $_GET['userid'] && ($sql .= iPHP::where($_GET['userid'], 'userid'));
     } else {
         $sql .= iPHP::where(iMember::$userid, 'userid');
     }
     if (isset($_GET['pid']) && $pid != '-1') {
         $uri_array['pid'] = $pid;
         if (empty($_GET['pid'])) {
             $sql .= " AND `pid`=''";
         } else {
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $map_where += map::where($pid);
         }
     }
     $cp_cids = iACP::CP('__CID__', 'cs');
     //取得所有有权限的栏目ID
     if ($cp_cids) {
         if (is_array($cp_cids)) {
             if ($cid) {
                 array_search($cid, $cp_cids) === false && iACP::permission_msg('栏目[cid:' . $cid . ']', $ret);
             } else {
                 $cids = $cp_cids;
             }
         } else {
             $cids = $cid;
         }
         if ($_GET['sub'] && $cid) {
             $cids = $this->categoryApp->get_ids($cid, true);
             array_push($cids, $cid);
         }
         if ($_GET['scid'] && $cid) {
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $map_where += map::where($cids);
         } else {
             $sql .= iPHP::where($cids, 'cid');
         }
     } else {
         $sql .= iPHP::where('-1', 'cid');
     }
     if ($_GET['keywords']) {
         $kws = $_GET['keywords'];
         switch ($_GET['st']) {
             case "title":
                 $sql .= " AND `title` REGEXP '{$kws}'";
                 break;
             case "tag":
                 $sql .= " AND `tags` REGEXP '{$kws}'";
                 break;
             case "source":
                 $sql .= " AND `source` REGEXP '{$kws}'";
                 break;
             case "weight":
                 $sql .= " AND `weight`='{$kws}'";
                 break;
             case "id":
                 $sql .= " AND `id` REGEXP '{$kws}'";
                 break;
             case "tkd":
                 $sql .= " AND CONCAT(title,keywords,description) REGEXP '{$kws}'";
                 break;
         }
     }
     $_GET['title'] && ($sql .= " AND `title` like '%{$_GET['title']}%'");
     $_GET['tag'] && ($sql .= " AND `tags` REGEXP '[[:<:]]" . preg_quote(rawurldecode($_GET['tag']), '/') . "[[:>:]]'");
     $_GET['starttime'] && ($sql .= " AND `pubdate`>='" . iPHP::str2time($_GET['starttime'] . " 00:00:00") . "'");
     $_GET['endtime'] && ($sql .= " AND `pubdate`<='" . iPHP::str2time($_GET['endtime'] . " 23:59:59") . "'");
     isset($_GET['pic']) && ($sql .= " AND `haspic` ='" . ($_GET['pic'] ? 1 : 0) . "'");
     isset($_GET['userid']) && ($uri_array['userid'] = (int) $_GET['userid']);
     isset($_GET['keyword']) && ($uri_array['keyword'] = $_GET['keyword']);
     isset($_GET['tag']) && ($uri_array['tag'] = $_GET['tag']);
     isset($_GET['pt']) && ($uri_array['pt'] = $_GET['pt']);
     isset($_GET['cid']) && ($uri_array['cid'] = $_GET['cid']);
     $uri_array && ($uri = http_build_query($uri_array));
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = $_GET['perpage'] > 0 ? (int) $_GET['perpage'] : 20;
     if ($map_where) {
         $map_sql = iCMS::map_sql($map_where);
         $sql = ",({$map_sql}) map {$sql} AND `id` = map.`iid`";
     }
     $total = iPHP::total(false, articleTable::count_sql($sql), "G");
     iPHP::pagenav($total, $maxperpage, "篇文章");
     $limit = 'LIMIT ' . iPHP::$offset . ',' . $maxperpage;
     if ($map_sql || iPHP::$offset) {
         // if($map_sql){
         $ids_array = iDB::all("\n                    SELECT `id` FROM `#iCMS@__article` {$sql}\n                    ORDER BY {$orderby} {$limit}\n                ");
         //iDB::debug(1);
         $ids = iCMS::get_ids($ids_array);
         $ids = $ids ? $ids : '0';
         $sql = "WHERE `id` IN({$ids})";
         // }else{
         // $sql = ",(
         // SELECT `id` AS aid FROM `#iCMS@__article` {$sql}
         // ORDER BY {$orderby} {$limit}
         // ) AS art WHERE `id` = art.aid ";
         // }
         $limit = '';
     }
     $rs = iDB::all("SELECT * FROM `#iCMS@__article` {$sql} ORDER BY {$orderby} {$limit}");
     //iDB::debug(1);
     $_count = count($rs);
     include iACP::view("article.manage");
 }
Esempio n. 14
0
 public static function pagenav($total, $displaypg = 20, $unit = "条记录", $url = '', $target = '')
 {
     iPHP::loadClass("Pages");
     $pageconf = array('url' => $url, 'target' => $target, 'total' => $total, 'perpage' => $displaypg, 'total_type' => 'G', 'lang' => iPHP::lang(iPHP_APP . ':page'));
     $pageconf['lang']['format_left'] = '<li>';
     $pageconf['lang']['format_right'] = '</li>';
     $iPages = new iPages($pageconf);
     self::$offset = $iPages->offset;
     self::$pagenav = '<ul>' . (self::$pagenav .= $iPages->show(3));
     self::$pagenav .= "<li> <span class=\"muted\">{$total}{$unit} {$displaypg}{$unit}/页 共{$iPages->totalpage}页</span></li>";
     if ($iPages->totalpage > 200) {
         $url = $iPages->get_url(1);
         self::$pagenav .= "<li> <span class=\"muted\">跳到 <input type=\"text\" id=\"pageselect\" style=\"width:24px;height:12px;margin-bottom: 0px;line-height: 12px;\" /> 页 <input class=\"btn btn-small\" type=\"button\" onClick=\"window.location='{$url}&page='+\$('#pageselect').val();\" value=\"跳转\" style=\"height: 22px;line-height: 18px;\"/></span></li>";
     } else {
         self::$pagenav .= "<li> <span class=\"muted\">跳到" . $iPages->select() . "页</span></li>";
     }
     self::$pagenav .= '</ul>';
 }