当前位置: 首页>>代码示例>>PHP>>正文


PHP iPHP::total方法代码示例

本文整理汇总了PHP中iPHP::total方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::total方法的具体用法?PHP iPHP::total怎么用?PHP iPHP::total使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iPHP的用法示例。


在下文中一共展示了iPHP::total方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: favorite_data

function favorite_data($vars = null)
{
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10";
    $where_sql = "WHERE 1=1 ";
    isset($vars['userid']) && ($where_sql .= " AND `uid`='" . (int) $vars['userid'] . "' ");
    $vars['fid'] && ($where_sql .= " AND `fid`='" . (int) $vars['fid'] . "' ");
    isset($vars['appid']) && ($where_sql .= " AND `appid`='" . (int) $vars['appid'] . "' ");
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        default:
            $order_sql = " ORDER BY `id` {$by}";
    }
    $md5 = md5($where_sql . $order_sql);
    $offset = 0;
    if ($vars['page']) {
        $total = iPHP::total($md5, "SELECT count(*) FROM `#iCMS@__favorite_data` {$where_sql} ");
        iPHP::assign("fav_data_total", $total);
        $multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
        $offset = $multi->offset;
    }
    if ($vars['cache']) {
        $cache_name = 'favorite_data/' . $md5 . "/" . (int) $GLOBALS['page'];
        $resource = iCache::get($cache_name);
    }
    if (empty($resource)) {
        $resource = iDB::all("SELECT * FROM `#iCMS@__favorite_data` {$where_sql} {$order_sql} LIMIT {$offset},{$maxperpage}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        // $resource = array();
        // if($rs)foreach ($rs as $key => $value) {
        // }
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    return $resource;
}
开发者ID:sunhk25,项目名称:iCMS,代码行数:35,代码来源:favorite.func.php

示例2: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:34,代码来源:comment.app.php

示例3: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:13,代码来源:keywords.app.php

示例4: do_manage

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:46,代码来源:tags.app.php

示例5: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:17,代码来源:account.app.php

示例6: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:45,代码来源:user.app.php

示例7: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:37,代码来源:files.app.php

示例8: do_iCMS

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:23,代码来源:prop.app.php

示例9: do_createArticle

 function do_createArticle($aid = null)
 {
     $category = $this->PG['cid'];
     $startime = $this->PG['startime'];
     $endtime = $this->PG['endtime'];
     $startid = $this->PG['startid'];
     $endid = $this->PG['endid'];
     $perpage = (int) $this->PG['perpage'];
     $offset = (int) $this->PG['offset'];
     $orderby = $this->PG['orderby'];
     $whereSQL = "WHERE `status` ='1'";
     $aid === null && ($aid = $this->PG['aid']);
     if ($aid) {
         $title = self::Article($aid);
         iPHP::success($title . '<hr />生成静态完成!');
     }
     $category[0] == 'all' && ($category = $this->get_category(iCMS_APP_ARTICLE));
     if ($category) {
         $cids = implode(',', (array) $category);
         $whereSQL .= " AND `cid` IN({$cids})";
     }
     $startime && ($whereSQL .= " AND `pubdate`>=UNIX_TIMESTAMP('{$startime} 00:00:00')");
     $endtime && ($whereSQL .= " AND `pubdate`<=UNIX_TIMESTAMP('{$endtime} 23:59:59')");
     $startid && ($whereSQL .= " AND `id`>='{$startid}'");
     $endid && ($whereSQL .= " AND `id`<='{$endid}'");
     $perpage or $perpage = $this->CP;
     $orderby or $orderby = "id DESC";
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__article` {$whereSQL}", "G");
     $looptimes = ceil($total / $perpage);
     $offset = $this->page * $perpage;
     $rs = iDB::all("SELECT `id` FROM `#iCMS@__article` {$whereSQL} order by {$orderby} LIMIT {$offset},{$perpage}");
     $_count = count($rs);
     $msg = "共<span class='label label-info'>{$total}</span>篇文章,将分成<span class='label label-info'>{$looptimes}</span>次完成<hr />开始执行第<span class='label label-info'>" . ($this->page + 1) . "</span>次生成,共<span class='label label-info'>{$_count}</span>篇<hr />";
     for ($i = 0; $i < $_count; $i++) {
         self::Article($rs[$i]['id']);
         $msg .= '<span class="label label-success">' . $rs[$i]['id'] . ' <i class="fa fa-check"></i></span> ';
     }
     $GLOBALS['page']++;
     $use_time = iPHP::timer_stop();
     $msg .= "<hr />用时<span class='label label-info'>{$use_time}</span>秒";
     $query["total_num"] = $total;
     $query["alltime"] = $this->alltime + $use_time;
     $loopurl = $this->loopurl($looptimes, $query);
     if ($loopurl) {
         $moreBtn = array(array("id" => "btn_stop", "text" => "停止", "url" => APP_URI . "&do=article"), array("id" => "btn_next", "text" => "继续", "src" => $loopurl, "next" => true));
         $dtime = 1;
         $all_time = $looptimes * $use_time + $looptimes + 1;
         $msg .= "<hr />预计全部生成还需要<span class='label label-info'>{$all_time}</span>秒";
     } else {
         $moreBtn = array(array("id" => "btn_next", "text" => "完成", "url" => APP_URI . "&do=article"));
         $dtime = 5;
         $msg .= "<hr />已全部生成完成<hr />总共用时<span class='label label-info'>" . $query["alltime"] . "</span>秒";
     }
     $updateMsg = $this->page ? true : false;
     iPHP::dialog($msg, $loopurl ? "src:" . $loopurl : '', $dtime, $moreBtn, $updateMsg);
 }
开发者ID:World3D,项目名称:iCMS,代码行数:56,代码来源:html.app.php

示例10: article_list


//.........这里部分代码省略.........
    isset($vars['pic']) && ($where_sql .= " AND `haspic`='1'");
    isset($vars['nopic']) && ($where_sql .= " AND `haspic`='0'");
    switch ($vars['orderby']) {
        case "id":
            $order_sql = " ORDER BY `id` {$by}";
            break;
        case "hot":
            $order_sql = " ORDER BY `hits` {$by}";
            break;
        case "week":
            $order_sql = " ORDER BY `hits_week` {$by}";
            break;
        case "month":
            $order_sql = " ORDER BY `hits_month` {$by}";
            break;
        case "comment":
            $order_sql = " ORDER BY `comments` {$by}";
            break;
        case "pubdate":
            $order_sql = " ORDER BY `pubdate` {$by}";
            break;
        case "disorder":
            $order_sql = " ORDER BY `ordernum` {$by}";
            break;
        case "rand":
            $order_sql = " ORDER BY rand() {$by}";
            break;
        case "weight":
            $order_sql = " ORDER BY `weight`,`ordernum` ASC";
            break;
        default:
            $order_sql = " ORDER BY `id` {$by}";
    }
    isset($vars['startdate']) && ($where_sql .= " AND `pubdate`>='" . strtotime($vars['startdate']) . "'");
    isset($vars['enddate']) && ($where_sql .= " AND `pubdate`<='" . strtotime($vars['enddate']) . "'");
    isset($vars['where']) && ($where_sql .= $vars['where']);
    if ($map_where) {
        $map_sql = iCMS::map_sql($map_where, 'join');
        //join
        //empty($vars['cid']) && $map_order_sql = " ORDER BY map.`iid` $by";
        $map_table = 'map';
        $vars['map_order_table'] && ($map_table = $vars['map_order_table']);
        $map_order_sql = " ORDER BY {$map_table}.`iid` {$by}";
        //$map_order_sql = " ORDER BY `icms_article`.`id` $by";
        //
        $where_sql .= ' AND ' . $map_sql['where'];
        $where_sql = ",{$map_sql['from']} {$where_sql} AND `#iCMS@__article`.`id` = {$map_table}.`iid`";
        //derived
        // $where_sql = ",({$map_sql}) map {$where_sql} AND `id` = map.`iid`";
    }
    $offset = 0;
    $limit = "LIMIT {$maxperpage}";
    if ($vars['page']) {
        $total_type = $vars['total_cache'] ? $vars['total_cache'] : null;
        $total = iPHP::total('sql.md5', "SELECT count(*) FROM `#iCMS@__article` {$where_sql}", $total_type);
        $pagenav = isset($vars['pagenav']) ? $vars['pagenav'] : "pagenav";
        $pnstyle = isset($vars['pnstyle']) ? $vars['pnstyle'] : 0;
        $multi = iCMS::page(array('total_type' => $total_type, 'total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
        $offset = $multi->offset;
        $limit = "LIMIT {$offset},{$maxperpage}";
        iPHP::assign("article_list_total", $total);
    }
    $hash = md5($where_sql . $order_sql . $limit);
    if ($offset) {
        if ($vars['cache']) {
            $map_cache_name = iPHP_DEVICE . '/article_page/' . $hash;
            $ids_array = iCache::get($map_cache_name);
        }
        if (empty($ids_array)) {
            $ids_order_sql = $map_order_sql ? $map_order_sql : $order_sql;
            $ids_array = iDB::all("SELECT `#iCMS@__article`.`id` FROM `#iCMS@__article` {$where_sql} {$ids_order_sql} {$limit}");
            iPHP_SQL_DEBUG && iDB::debug(1);
            $vars['cache'] && iCache::set($map_cache_name, $ids_array, $cache_time);
        }
        $ids = iCMS::get_ids($ids_array);
        $ids = $ids ? $ids : '0';
        $where_sql = "WHERE `id` IN({$ids})";
        $limit = '';
    } else {
        if ($map_order_sql) {
            $order_sql = $map_order_sql;
        }
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/article/' . $hash;
        $resource = iCache::get($cache_name);
    }
    // $func = '__article_array';
    // if($vars['func']=="user_home"){ //暂时只有一个选项
    //     $func = '__article_user_home_array';
    // }
    if (empty($resource)) {
        $resource = iDB::all("SELECT `#iCMS@__article`.* FROM `#iCMS@__article` {$where_sql} {$order_sql} {$limit}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        $resource = __article_array($vars, $resource);
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    //print_r($resource);
    return $resource;
}
开发者ID:World3D,项目名称:iCMS,代码行数:101,代码来源:article.func.php

示例11: do_list

 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");
 }
开发者ID:World3D,项目名称:iCMS,代码行数:30,代码来源:category.app.php

示例12: do_project

 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");
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:28,代码来源:spider.app.php

示例13: user_inbox

function user_inbox($vars = null)
{
    $maxperpage = 30;
    $where_sql = "WHERE `status` ='1'";
    if ($_GET['user']) {
        if ($_GET['user'] == "10000") {
            $where_sql .= " AND `userid`='10000' AND `friend` IN ('" . user::$userid . "','0')";
        } else {
            $friend = (int) $_GET['user'];
            $where_sql .= " AND `userid`='" . user::$userid . "' AND `friend`='" . $friend . "'";
        }
        $group_sql = '';
        $p_fields = 'COUNT(*)';
        $s_fields = '*';
        iPHP::assign("msg_count", false);
    } else {
        //	 	$where_sql.= " AND (`userid`='".user::$userid."' OR (`userid`='10000' AND `friend`='0'))";
        $where_sql .= " AND `userid`='" . user::$userid . "'";
        $group_sql = ' GROUP BY `friend` DESC';
        $p_fields = 'COUNT(DISTINCT id)';
        $s_fields = 'max(id) AS id ,COUNT(id) AS msg_count,`userid`, `friend`, `send_uid`, `send_name`, `receiv_uid`, `receiv_name`, `content`, `type`, `sendtime`, `readtime`';
        iPHP::assign("msg_count", true);
    }
    $offset = 0;
    $total = iPHP::total($md5, "SELECT {$p_fields} FROM `#iCMS@__message` {$where_sql} {$group_sql}", 'nocache');
    iPHP::assign("msgs_total", $total);
    $multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page']));
    $offset = $multi->offset;
    $resource = iDB::all("SELECT {$s_fields} FROM `#iCMS@__message` {$where_sql} {$group_sql} ORDER BY `id` DESC LIMIT {$offset},{$maxperpage}");
    iPHP_SQL_DEBUG && iDB::debug(1);
    $msg_type_map = array('0' => '系统信息', '1' => '私信', '2' => '提醒', '3' => '留言');
    if ($resource) {
        foreach ($resource as $key => $value) {
            $value['sender'] = user::info($value['send_uid'], $value['send_name']);
            $value['receiver'] = user::info($value['receiv_uid'], $value['receiv_name']);
            $value['label'] = $msg_type_map[$value['type']];
            if ($value['userid'] == $value['send_uid']) {
                $value['is_sender'] = true;
                $value['user'] = $value['receiver'];
            }
            if ($value['userid'] == $value['receiv_uid']) {
                $value['is_sender'] = false;
                $value['user'] = $value['sender'];
            }
            $value['url'] = iPHP::router(array('/user/inbox/{uid}', $value['user']['uid']), iPHP_ROUTER_REWRITE);
            $resource[$key] = $value;
        }
    }
    return $resource;
}
开发者ID:sunhk25,项目名称:iCMS,代码行数:50,代码来源:user.func.php

示例14: do_manage

 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");
 }
开发者ID:World3D,项目名称:iCMS,代码行数:53,代码来源:push.app.php

示例15: tag_list

/**
 * @package iCMS
 * @copyright 2007-2016, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <idreamsoft@qq.com>
 * @$Id: tag.tpl.php 159 2013-03-23 04:11:53Z coolmoo $
 */
function tag_list($vars)
{
    $where_sql = "WHERE status='1' ";
    $map_where = array();
    if (isset($vars['rootid'])) {
        $where_sql .= " AND `rootid`='" . (int) $vars['rootid'] . "'";
    }
    if (!isset($vars['tcids']) && isset($vars['tcid'])) {
        $where_sql .= iPHP::where($vars['tcid'], 'tcid');
    }
    if (isset($vars['tcids']) && !isset($vars['tcid'])) {
        iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
        map::init('category', iCMS_APP_TAG);
        //$where_sql.= map::exists($vars['tcid'],'`#iCMS@__tags`.id'); //map 表大的用exists
        $map_where += map::where($vars['tcid']);
    }
    if (isset($vars['tcid!'])) {
        $where_sql .= iPHP::where($vars['tcid!'], 'tcid', 'not');
    }
    if (!isset($vars['pids']) && isset($vars['pid'])) {
        $where_sql .= iPHP::where($vars['pid'], 'pid');
    }
    if (isset($vars['pids']) && !isset($vars['pid'])) {
        iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
        map::init('prop', iCMS_APP_TAG);
        //$where_sql.= map::exists($vars['pids'],'`#iCMS@__tags`.id'); //map 表大的用exists
        $map_where += map::where($vars['pids']);
    }
    if (isset($vars['pid!'])) {
        $where_sql .= iPHP::where($vars['pid!'], 'pid', 'not');
    }
    if (!isset($vars['cids']) && isset($vars['cid'])) {
        $cid = explode(',', $vars['cid']);
        $vars['sub'] && ($cid += iCMS::get_category_ids($cid, true));
        $where_sql .= iPHP::where($cid, 'cid');
    }
    if (isset($vars['cids']) && !isset($vars['cid'])) {
        $cids = explode(',', $vars['cids']);
        $vars['sub'] && ($cids += iCMS::get_category_ids($vars['cids'], true));
        if ($cids) {
            iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
            map::init('category', iCMS_APP_TAG);
            $map_where += map::where($cids);
        }
    }
    if (isset($vars['cid!'])) {
        $ncids = explode(',', $vars['cid!']);
        $vars['sub'] && ($ncids += iCMS::get_category_ids($ncids, true));
        $where_sql .= iPHP::where($ncids, 'cid', 'not');
    }
    if (isset($vars['keywords'])) {
        //最好使用 iCMS:tag:search
        if (empty($vars['keywords'])) {
            return;
        }
        if (strpos($vars['keywords'], ',') === false) {
            $vars['keywords'] = str_replace(array('%', '_'), array('\\%', '\\_'), $vars['keywords']);
            $where_sql .= " AND CONCAT(tkey,name,seotitle,keywords) like '%" . addslashes($vars['keywords']) . "%'";
        } else {
            $kws = explode(',', $vars['keywords']);
            foreach ($kws as $kwv) {
                $keywords .= addslashes($kwv) . "|";
            }
            $keywords = substr($keywords, 0, -1);
            $where_sql .= " AND CONCAT(tkey,name,seotitle,keywords) REGEXP '{$keywords}' ";
        }
    }
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10";
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
    $by = $vars['by'] == 'ASC' ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        case "hot":
            $order_sql = " ORDER BY `count` {$by}";
            break;
        case "new":
            $order_sql = " ORDER BY `id` {$by}";
            break;
        case "order":
            $order_sql = " ORDER BY `ordernum` {$by}";
            break;
            //		case "rand":	$order_sql=" ORDER BY rand() $by";		break;
        //		case "rand":	$order_sql=" ORDER BY rand() $by";		break;
        default:
            $order_sql = " ORDER BY `id` {$by}";
    }
    if ($map_where) {
        $map_sql = iCMS::map_sql($map_where);
        $where_sql = ",({$map_sql}) map {$where_sql} AND `id` = map.`iid`";
    }
    $offset = 0;
    $limit = "LIMIT {$maxperpage}";
    if ($vars['page']) {
        $total = iPHP::total('sql.md5', "SELECT count(*) FROM `#iCMS@__tags` {$where_sql} ");
//.........这里部分代码省略.........
开发者ID:Junred,项目名称:iCMS,代码行数:101,代码来源:tag.func.php


注:本文中的iPHP::total方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。