• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getCount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getCount函数的典型用法代码示例。如果您正苦于以下问题:PHP getCount函数的具体用法?PHP getCount怎么用?PHP getCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: stepCounter

function stepCounter($file)
{
    if (file_exists($file)) {
        $value = getCount($file);
        file_put_contents($file, ++$value);
    }
}
开发者ID:dreifachstein,项目名称:chromium-src,代码行数:7,代码来源:modified-manifest.php


示例2: _initialize

 protected function _initialize()
 {
     parent::_initialize();
     $this->openuid = I('get.openuid');
     if (getUidByOpenuid($this->openuid)) {
         $this->uid = getUidByOpenuid($this->openuid);
     } else {
         $this->error('您无权访问当前页面!');
     }
     $this->assign('openuid', $this->openuid);
     //会员信息
     $this->memberDetail = D('Home/User')->find($this->uid);
     //烘焙作品数
     $this->hbworksnum = getCount('Works', array('userid' => $this->uid, 'type' => 1));
     //随拍作品
     $this->spworksnum = getCount('Copy', array('userid' => $this->uid));
     //关注数
     $this->attentionnum = getCount('UserFans', array('myid' => $this->uid));
     //被关注数
     $this->fansnum = getCount('UserFans', array('userid' => $this->uid));
     //是否关注
     $this->isfans = getCount('UserFans', array('myid' => $this->userid, 'userid' => $this->uid, 'status' => true));
     //中间广告
     $this->midad = parent::getAdvert(9, 1, 0, 1);
 }
开发者ID:gzwyufei,项目名称:hp,代码行数:25,代码来源:UcenterController.class.php


示例3: discuss

function discuss($ID)
{
    global $comments_disabled_after;
    $preview = ps('preview');
    extract(safe_row("Annotate,AnnotateInvite,unix_timestamp(Posted) as uPosted", "textpattern", "ID='{$ID}'"));
    $darr = !$preview ? fetchComments($ID) : array(psas(array('name', 'email', 'web', 'message', 'parentid', 'remember')));
    $out = n . '<h3 style="margin-top:2em" id="comment">' . $AnnotateInvite . '</h3>' . n;
    if ($darr) {
        $out .= '<ol>' . n;
        $out .= formatComments($darr);
        $out .= n . '</ol>';
    }
    $wasAnnotated = !$Annotate ? getCount('txp_discuss', "parentid={$ID}") : '';
    if (!$Annotate) {
        $out .= graf(gTxt("comments_closed"));
    } else {
        if ($comments_disabled_after) {
            $lifespan = $comments_disabled_after * 86400;
            $timesince = time() - $uPosted;
            if ($lifespan > $timesince) {
                $out .= commentForm($ID);
            } else {
                $out .= graf(gTxt("comments_closed"));
            }
        } else {
            $out .= commentForm($ID);
        }
    }
    return $out;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:30,代码来源:comment.php


示例4: createTables

function createTables()
{
    $division = $_SESSION['division'];
    $date = $_SESSION['date'];
    $count = getCount();
    global $conn;
    //check if import.csv is a new carrier or existing, create tableset if new
    $getDivisionAll = mysqli_query($conn, "SELECT division from Division_All");
    $getDivisionCount = mysqli_query($conn, "SELECT division, countImported, importDate from Division_Metadata");
    $results = array();
    while ($row = mysqli_fetch_array($getDivisionAll)) {
        $results[] = $row[0];
    }
    if (!in_array($division, $results)) {
        createTableSet($division, $conn);
        mysqli_query($conn, "INSERT INTO Division_All VALUES (id, '{$division}')");
        mysqli_query($conn, "INSERT INTO Division_Metadata VALUES (id, '{$division}', '{$date}', {$count})");
        return $count;
    } else {
        $exists = mysqli_query($conn, "SELECT * from  Division_Metadata where division = '{$division}'\n    and countImported = {$count} and importDate = '{$date}'");
        $row_cnt = $exists->num_rows;
        if ($row_cnt < 1) {
            mysqli_query($conn, "INSERT INTO Division_Metadata VALUES (id, '{$division}', '{$date}', {$count})");
            return $count;
        } else {
            header("location:index.php?status=duplicate&division={$division}&count={$count}");
        }
    }
}
开发者ID:carobiscuit,项目名称:PFA,代码行数:29,代码来源:functions.php


示例5: list_list

function list_list($message = "", $post = '')
{
    extract(get_prefs());
    $lvars = array("page", "sort", "dir", "crit", 'method');
    extract(gpsa($lvars));
    global $statuses, $step;
    pagetop("Textpattern", $message);
    $total = getCount('textpattern', "1");
    $limit = $article_list_pageby ? $article_list_pageby : 25;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    if (!$sort) {
        $sort = "Posted";
    }
    if (!$dir) {
        $dir = "desc";
    }
    if ($dir == "desc") {
        $linkdir = "asc";
    } else {
        $linkdir = "desc";
    }
    if ($crit) {
        $critsql = array('title_body' => "Title rlike '{$crit}' or Body rlike '{$crit}'", 'author' => "AuthorID rlike '{$crit}'", 'categories' => "Category1 rlike '{$crit}' or Category2 rlike '{$crit}'", 'section' => "Section rlike '{$crit}'", 'status' => "Status rlike '{$crit}'");
        $criteria = $critsql[$method];
        $limit = 500;
    } else {
        $criteria = 1;
    }
    $rs = safe_rows("*, unix_timestamp(Posted) as uPosted", "textpattern", "{$criteria} order by {$sort} {$dir} limit {$offset},{$limit}");
    echo !$crit ? list_nav_form($page, $numPages, $sort, $dir) : '', list_searching_form($crit, $method);
    if ($rs) {
        echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), '<tr>', column_head('posted', 'Posted', 'list', 1, $linkdir), column_head('title', 'Title', 'list', 1, $linkdir), $use_sections ? column_head('section', 'Section', 'list', 1, $linkdir) : '', $use_categories ? column_head('category1', 'Category1', 'list', 1, $linkdir) . column_head('category2', 'Category2', 'list', 1, $linkdir) : '', hCell(gTxt('Author')), column_head(gTxt('status'), 'Status', 'list', 1, $linkdir), td(), '</tr>';
        foreach ($rs as $a) {
            extract($a);
            if ($use_categories == 1) {
                $cat1 = $Category1;
                $cat2 = $Category2;
            }
            $stat = !empty($Status) ? $statuses[$Status] : '';
            if ($use_sections == 1) {
                $sect = $Section;
            }
            $adate = date("d M y", $uPosted + $timeoffset);
            $alink = eLink('article', 'edit', 'ID', $ID, $adate);
            $tlink = eLink('article', 'edit', 'ID', $ID, $Title);
            $modbox = fInput('checkbox', 'selected[]', $ID);
            echo "<tr>" . n, td($alink), td($tlink, 200), $use_sections ? td($sect, 75) : '', $use_categories ? td($cat1, 75) . td($cat2, 75) : '', td($AuthorID), td($stat, 45), td($modbox), '</tr>' . n;
        }
        echo tr(tda(list_multiedit_form(), ' colspan="8" style="text-align:right;border:0px"'));
        echo "</table></form>";
        echo pageby_form('list', $article_list_pageby);
        unset($sort);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:56,代码来源:txp_list.php


示例6: lib_getarcattr

/**
 * 文章属性调用标签
 *
 * @version        $Id: getarcattr.lib.php netman
 * @package        Stourweb.Taglib
 * @copyright      Copyright (c) 2007 - 2011, Stourweb, Inc.
 * @link           http://www.stourweb.com
 */
function lib_getarcattr(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|8,limit|0,flag|";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnertext());
    $revalue = '';
    $kindid = $refObj->Fields['kindid'];
    $sql = "select * from #@__article_attr where isopen=1 and pid!=0 order by displayorder asc limit {$limit},{$row}";
    if ($flag == 'mdd') {
        $sql = "select a.*,count(b.id) as num from #@__article_attr as a inner join #@__article as b on find_in_set(a.id,b.attrid) where find_in_set({$kindid},b.kindlist) group by a.id limit {$limit},{$row}";
    }
    $dsql->SetQuery($sql);
    $dsql->Execute();
    $ctp = new STTagParse();
    $ctp->SetNameSpace("field", "[", "]");
    $ctp->LoadSource($innertext);
    $GLOBALS['autoindex'] = 0;
    while ($row = $dsql->GetArray()) {
        if (checkExist($row['id'])) {
            $destid = isset($GLOBALS['destid']) ? $GLOBALS['destid'] : 0;
            $py = Helper_Archive::getDestPinyin($destid);
            $py = !empty($py) ? $py : 'all';
            //$row['url'] = $GLOBALS['cfg_cmsurl']."/raiders/search.php?attrid={$row['id']}&destid={$destid}";
            $row['url'] = $GLOBALS['cfg_cmsurl'] . "/raiders/" . $py . '-' . $row['id'];
            $row['title'] = $row['attrname'];
            $row['number'] = getCount($row['id']);
            if ($flag == 'mdd') {
                $row['number'] = $row['num'];
            }
            foreach ($ctp->CTags as $tagid => $ctag) {
                if ($ctag->GetName() == 'array') {
                    $ctp->Assign($tagid, $row);
                } else {
                    if (!empty($row[$ctag->GetName()])) {
                        $ctp->Assign($tagid, $row[$ctag->GetName()]);
                    }
                }
            }
            $revalue .= $ctp->GetResult();
            $GLOBALS['autoindex']++;
        } else {
            continue;
        }
    }
    return $revalue;
}
开发者ID:lz1988,项目名称:stourwebcms,代码行数:56,代码来源:getarcattr.lib.php


示例7: action

function action()
{
    if ($_SERVER["REQUEST_METHOD"] != "POST") {
        die("You can only reach this page by posting from the web page.");
    }
    $where = isset($_GET["where"]) ? $_GET["where"] : "home";
    if (isset($_GET["mode"])) {
        if ($_GET["mode"] == "add") {
            addNew($where);
        }
        if ($_GET["mode"] == "getCount") {
            echo json_encode(array("count" => getCount($where)));
        }
    }
    exit;
}
开发者ID:joyblanks,项目名称:CineDaniProductions,代码行数:16,代码来源:counter.php


示例8: getBestSeller

function getBestSeller($count = 4)
{
    $getOrder = DB::query("SELECT order_content FROM `" . PREFIX . 'order' . "`");
    if (DB::numRows($getOrder) != 0) {
        $product = new Models_Product();
        while ($row = DB::fetchArray($getOrder)) {
            $orderData[] = unserialize(stripslashes($row['order_content']));
        }
        $res = array();
        foreach ($orderData as $k => $v) {
            foreach ($v as $key => $val) {
                $res[] = $product->getProduct($val['id']);
            }
        }
        $goodsSale = getCount($res);
        return array_slice($goodsSale, 0, $count);
    }
}
开发者ID:WinGood,项目名称:24karcher,代码行数:18,代码来源:functions.php


示例9: log_list

function log_list()
{
    pagetop(gTxt('visitor_logs'));
    extract(get_prefs());
    safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
    safe_optimize("txp_log");
    safe_repair("txp_log");
    $page = gps('page');
    $total = getCount('txp_log', "1");
    $limit = 50;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
    if ($rs) {
        echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
        $stamp = '';
        while ($a = nextRow($rs)) {
            extract($a);
            if ($refer) {
                $referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
                $referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
            } else {
                $referprint = '&#160;';
            }
            $pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
            $pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
            if ($method == 'POST') {
                $pageprint = '<b>' . $pageprint . '</b>';
            }
            $fstamp = date("n/j g:i a", $stamp + tz_offset());
            $hostprint = chunk($host, 40);
            echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
            unset($refer, $referprint, $page, $pageprint);
        }
        echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
    } else {
        echo graf(gTxt('no_refers_recorded'), ' align="center"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:43,代码来源:txp_log.php


示例10: index

 public function index()
 {
     //测试用,清空缓存
     cache('', null);
     //幻灯片推荐作品
     $workModel = D('Home/Works');
     $this->assign('indextjwork', $workModel->indextjwork());
     //新闻模块
     //单条新闻
     $firstnews = M('News')->field('title,id')->where(array('iftj' => true, 'status' => true))->order('sort DESC')->limit(1)->find();
     $this->assign('firstnews', $firstnews);
     $this->assign('indextjnews', D('Home/News')->indextjnews());
     //每日新秀
     $this->assign('indexxinxiu', $workModel->worksxinxiu());
     //中间广告位
     $this->assign('indexmidad', parent::getAdvert(1, 1, 0, 5));
     //左侧广告位
     $this->assign('indexleftad', parent::getAdvert(1, 2, 0, 1));
     //类别每日一荐
     $this->assign('indexcatetj', $workModel->cateonework());
     //焙友动态
     $this->userDynamicData = D('Home/User')->userDynamic(5);
     //热门活动
     $this->assign('activitytj', D('Home/Activity')->activitytj(2));
     //右边上侧
     $this->assign('rightopad', parent::getAdvert(1, 3, 0, 1));
     //右边广告
     $this->assign('indexrightad', parent::getAdvert(1, 3, 1, 3));
     //分享达人
     $this->assign('sharedaren', D('Home/User')->sharedaren(5, $this->userid));
     //判断是否签到
     $stime = strtotime(date('Y-m-d 00:00:00'));
     $etime = strtotime(date('Y-m-d 23:59:59'));
     $where['userid'] = array('EQ', $this->userid);
     $where['create_time'] = array(array('GT', $stime), array('LT', $etime), 'and');
     $where['action'] = array('EQ', 'sign');
     $map['create_time'] = array(array('GT', $stime), array('LT', $etime), 'and');
     $map['action'] = array('EQ', 'sign');
     $this->mysign = getCount('UserDynamic', $where);
     $this->signcount = getCount('UserDynamic', $map);
     $this->display();
 }
开发者ID:gzwyufei,项目名称:hp,代码行数:42,代码来源:IndexController.class.php


示例11: lookSee

/**
 *根据初始字符串来获得下面的字符串
 *@param string $str 初始字符串
 *@param integer $n   输出多少行
 *@return void
 */
function lookSee($str, $n)
{
    $result[0] = $str;
    for ($m = 0; $m < $n; $m++) {
        $str3 = '';
        for ($k = 0; $k < strlen($result[$m]); $k++) {
            var_dump($str[$k]);
            $str1 = $str[$k];
            var_dump($str1);
            if (!($str2 = getCount($str1, $str))) {
                break;
            }
            var_dump($str2);
            $str3 .= $str2 . $str1;
            //var_dump($str3);
        }
        $result[$m] = $str3;
    }
    return $result;
}
开发者ID:notatree,项目名称:PHPClassFunctions,代码行数:26,代码来源:lookSee.php


示例12: index

 /**
  * 会员登录页显示
  */
 public function index()
 {
     if (IS_POST) {
         //更新用户资料
         $post = I('post.');
         if (empty($post)) {
             $this->error('信息更新失败!');
         }
         $result = M('User')->where(array('userid' => $this->userid))->save($post);
         if ($result !== false) {
             $this->success('您的资料更新成功!');
         } else {
             $this->error('您的资料更新失败');
         }
     } else {
         //省份
         $this->province = M('Province')->field('province_id,province_name')->select();
         if (!empty($this->userinfo['ucity']) && !empty($this->userinfo['uprovince'])) {
             $this->ucity = M('City')->where(array('province_id' => $this->userinfo['uprovince']))->select();
         }
         if (!empty($this->userinfo['ucity']) && !empty($this->userinfo['uarea'])) {
             $this->uarea = M('Area')->where(array('city_id' => $this->userinfo['ucity']))->select();
         }
         //数量统计
         //烘焙作品数
         $this->hbworksnum = getCount('Works', array('userid' => $this->userid, 'status' => true));
         //随拍作品
         $this->spworksnum = getCount('Suipai', array('userid' => $this->userid, 'status' => true));
         //留言数
         $this->msgnum = getCount('UserMessage', array('userid' => $this->userid, 'status' => true));
         //试用报告数
         $this->reportnum = getCount('TryReport', array('userid' => $this->userid, 'status' => true));
         //收藏作品数
         $this->favoritenum = getCount('UserFavorite', array('userid' => $this->userid, 'status' => true));
         //修改头像密钥
         $this->auth_key = urlencode(\Libs\Util\Encrypt::authcode($this->userid, ''));
     }
     $this->display();
 }
开发者ID:gzwyufei,项目名称:hp,代码行数:42,代码来源:IndexController1008.class.php


示例13: image_list

function image_list($message = '')
{
    global $txpcfg, $extensions, $path_from_root, $img_dir;
    $pfr = $path_from_root;
    extract($txpcfg);
    extract(get_prefs());
    pagetop(gTxt('image'), $message);
    echo pageby_form('image', $article_list_pageby);
    echo startTable('list'), tr(tda(upload_form(gTxt('upload_file'), gTxt('upload'), 'image_insert'), ' colspan="4" style="border:0"')), tr(hCell(ucfirst(gTxt('name'))) . hCell(gTxt('image_category')) . hCell(gTxt('tags')) . hCell(gTxt('author')) . hCell(gTxt('thumbnail')) . hCell());
    $page = gps('page');
    $total = getCount('txp_image', "1");
    $limit = 15;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("image", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("image", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows("*", "txp_image", "1 order by category,name limit {$offset},{$limit}");
    if ($rs) {
        foreach ($rs as $a) {
            extract($a);
            $thumbnail = $thumbnail ? '<img src="' . $pfr . $img_dir . '/' . $id . 't' . $ext . '" />' : gTxt('no');
            $elink = eLink('image', 'image_edit', 'id', $id, $name);
            $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'alt=' . $alt . a . 'h=' . $h . a . 'w=' . $w . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>';
            $txplink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>';
            $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'h=' . $h . a . 'w=' . $w . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>';
            $dlink = dLink('image', 'image_delete', 'id', $id);
            echo tr(td($elink) . td($category) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($author) . td($thumbnail) . td($dlink, 10));
        }
        echo tr(tdcs(graf(join('', $nav)), 4));
    }
    echo endTable();
    $imgdir = $doc_root . $path_from_root . $img_dir;
    if (!is_dir($imgdir) or !is_writeable($imgdir)) {
        echo graf(str_replace("{imgdir}", $imgdir, gTxt('img_dir_not_writeable')), ' style="text-align:center;color:red"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:38,代码来源:txp_image.php


示例14: link_list

function link_list($message = "")
{
    global $step, $link_list_pageby;
    extract(get_prefs());
    $page = gps('page');
    $total = getCount('txp_link', "1");
    $limit = $link_list_pageby;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $sort = gps('sort');
    $dir = gps('dir');
    $sort = $sort ? $sort : 'linksort';
    $dir = $dir ? $dir : 'asc';
    if ($dir == "desc") {
        $dir = "asc";
    } else {
        $dir = "desc";
    }
    $nav[] = $page > 1 ? PrevNextLink("link", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("link", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows("*", "txp_link", "1 order by {$sort} {$dir} limit {$offset},{$limit}");
    if ($rs) {
        echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), tr(column_head('link_name', 'linksort', 'link', 1, $dir) . column_head('description', 'description', 'link', 1, $dir) . column_head('link_category', 'category', 'link', 1, $dir) . td());
        foreach ($rs as $a) {
            extract($a);
            $elink = eLink('link', 'link_edit', 'id', $id, $linkname);
            $cbox = fInput('checkbox', 'selected[]', $id);
            echo tr(td($elink) . td($description) . td($category) . td($cbox));
        }
        echo tr(tda(link_multiedit_form(), ' colspan="4" style="border:0px;text-align:right"'));
        echo endTable(), '</form>';
        echo pageby_form('link', $link_list_pageby);
        echo graf(join('', $nav), ' align="center"');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:37,代码来源:txp_link.php


示例15: author_list

/**
 * The main author list.
 *
 * @param string|array $message The activity message
 */
function author_list($message = '')
{
    global $txp_user, $author_list_pageby;
    pagetop(gTxt('tab_site_admin'), $message);
    if (is_disabled('mail')) {
        echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . gTxt('warn_mail_unavailable'), array('class' => 'alert-block warning'));
    }
    echo hed(gTxt('tab_site_admin'), 1, array('class' => 'txp-heading'));
    echo n . '<div id="users_control" class="txp-control-panel">';
    $buttons = array();
    // Change password button.
    $buttons[] = sLink('admin', 'new_pass_form', gTxt('change_password'));
    if (!has_privs('admin.edit')) {
        // Change email address button.
        $buttons[] = sLink('admin', 'change_email_form', gTxt('change_email_address'));
    } else {
        // New author button.
        $buttons[] = sLink('admin', 'author_edit', gTxt('add_new_author'));
    }
    echo graf(join(n, $buttons), array('class' => 'txp-buttons'));
    // User list.
    if (has_privs('admin.list')) {
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($sort === '') {
            $sort = get_pref('admin_sort_column', 'name');
        }
        if ($dir === '') {
            $dir = get_pref('admin_sort_dir', 'asc');
        }
        $dir = $dir == 'desc' ? 'desc' : 'asc';
        if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
            $sort = 'name';
        }
        $sort_sql = $sort . ' ' . $dir;
        set_pref('admin_sort_column', $sort, 'admin', 2, '', 0, PREF_PRIVATE);
        set_pref('admin_sort_dir', $dir, 'admin', 2, '', 0, PREF_PRIVATE);
        $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
        $criteria = 1;
        if ($search_method and $crit != '') {
            $verbatim = preg_match('/^"(.*)"$/', $crit, $m);
            $crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
            $critsql = $verbatim ? array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name = '{$crit_escaped}'", 'real_name' => "RealName = '{$crit_escaped}'", 'email' => "email = '{$crit_escaped}'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')") : array('id' => "user_id in ('" . join("','", do_list($crit_escaped)) . "')", 'login' => "name like '%{$crit_escaped}%'", 'real_name' => "RealName like '%{$crit_escaped}%'", 'email' => "email like '%{$crit_escaped}%'", 'privs' => "convert(privs, char) in ('" . join("','", do_list($crit_escaped)) . "')");
            if (array_key_exists($search_method, $critsql)) {
                $criteria = $critsql[$search_method];
            } else {
                $search_method = '';
                $crit = '';
            }
        } else {
            $search_method = '';
            $crit = '';
        }
        $criteria .= callback_event('admin_criteria', 'author_list', 0, $criteria);
        $total = getCount('txp_users', $criteria);
        if ($total < 1) {
            if ($criteria != 1) {
                echo n . author_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
            }
            return;
        }
        $limit = max($author_list_pageby, 15);
        list($page, $offset, $numPages) = pager($total, $limit, $page);
        $use_multi_edit = has_privs('admin.edit') && safe_count('txp_users', '1=1') > 1;
        echo author_search_form($crit, $search_method) . '</div>';
        $rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
        if ($rs) {
            echo n . tag_start('div', array('id' => 'users_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'users_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(($use_multi_edit ? hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') : hCell('', '', ' scope="col" class="txp-list-col-multi-edit"')) . column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-login-name name') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', ('RealName' == $sort ? "{$dir} " : '') . 'txp-list-col-real-name name') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', ('email' == $sort ? "{$dir} " : '') . 'txp-list-col-email') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', ('privs' == $sort ? "{$dir} " : '') . 'txp-list-col-privs') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', ('last_login' == $sort ? "{$dir} " : '') . 'txp-list-col-last-login date')) . n . tag_end('thead') . n . tag_start('tbody');
            while ($a = nextRow($rs)) {
                extract(doSpecial($a));
                echo tr(td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name'], 'checkbox') : '', '', 'txp-list-col-multi-edit') . hCell(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, $name) : $name, '', ' scope="row" class="txp-list-col-login-name name"') . td($RealName, '', 'txp-list-col-real-name name') . td(href($email, 'mailto:' . $email), '', 'txp-list-col-email') . td(get_priv_level($privs), '', 'txp-list-col-privs') . td($last_login ? safe_strftime('%b&#160;%Y', $last_login) : '', '', 'txp-list-col-last-login date'));
            }
            echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . ($use_multi_edit ? author_multiedit_form($page, $sort, $dir, $crit, $search_method) : '') . tInput() . n . tag_end('form') . n . tag_start('div', array('id' => 'users_navigation', 'class' => 'txp-navigation')) . pageby_form('admin', $author_list_pageby) . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . n . tag_end('div') . n . tag_end('div');
        }
    } else {
        echo n . tag_end('div');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:82,代码来源:txp_admin.php


示例16: rss

function rss()
{
    global $prefs, $thisarticle;
    extract($prefs);
    ob_start();
    extract(doSlash(gpsa(array('category', 'section', 'limit', 'area'))));
    $area = gps('area');
    $sitename .= $section ? ' - ' . $section : '';
    $sitename .= $category ? ' - ' . $category : '';
    $out[] = tag(doSpecial($sitename), 'title');
    $out[] = tag(hu, 'link');
    $out[] = tag(doSpecial($site_slogan), 'description');
    $articles = array();
    if (!$area or $area == 'article') {
        $sfilter = $section ? "and Section = '" . $section . "'" : '';
        $cfilter = $category ? "and (Category1='" . $category . "' or Category2='" . $category . "')" : '';
        $limit = $limit ? $limit : '5';
        $frs = safe_column("name", "txp_section", "in_rss != '1'");
        if ($frs) {
            foreach ($frs as $f) {
                $query[] = "and Section != '" . $f . "'";
            }
        }
        $query[] = $sfilter;
        $query[] = $cfilter;
        $rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, ID as thisid", "textpattern", "Status = 4 " . join(' ', $query) . "and Posted < now() order by Posted desc limit {$limit}");
        if ($rs) {
            while ($a = nextRow($rs)) {
                extract($a);
                populateArticleData($a);
                $a['posted'] = $uPosted;
                $Body = !$syndicate_body_or_excerpt ? $thisarticle['body'] : $thisarticle['excerpt'];
                $Body = !trim($Body) ? $thisarticle['body'] : $Body;
                $Body = str_replace('href="/', 'href="' . hu, $Body);
                $Body = preg_replace("/href=\\\"#(.*)\"/", "href=\"" . permlinkurl($a) . "#\\1\"", $Body);
                $Body = safe_hed($Body);
                $Body = preg_replace(array('/</', '/>/', "/'/", '/"/'), array('&lt;', '&gt;', '&#039;', '&quot;'), $Body);
                // encode bare ampersands
                $Body = preg_replace("/&(?![#0-9]+;|\\w+;)/i", '&amp;', $Body);
                $uTitle = $url_title ? $url_title : stripSpace($Title);
                $uTitle = htmlspecialchars($uTitle, ENT_NOQUOTES);
                if ($show_comment_count_in_feed) {
                    $dc = getCount('txp_discuss', "parentid={$ID} and visible=1");
                    $count = $dc > 0 ? ' [' . $dc . ']' : '';
                } else {
                    $count = '';
                }
                $Title = doSpecial($Title) . $count;
                $permlink = permlinkurl($a);
                $item = tag(strip_tags($Title), 'title') . n . tag($Body, 'description') . n . tag($permlink, 'link');
                $articles[$ID] = tag($item, 'item');
                $etags[$ID] = strtoupper(dechex(crc32($articles[$ID])));
                $dates[$ID] = $uPosted;
            }
        }
    } elseif ($area == 'link') {
        $cfilter = $category ? "category='{$category}'" : '1';
        $limit = $limit ? $limit : 15;
        $rs = safe_rows_start("*", "txp_link", "{$cfilter} order by date desc limit {$limit}");
        if ($rs) {
            while ($a = nextRow($rs)) {
                extract($a);
                $item = tag(doSpecial($linkname), 'title') . n . tag(doSpecial($description), 'description') . n . tag(doSpecial($url), 'link');
                $articles[$id] = tag($item, 'item');
                $etags[$id] = strtoupper(dechex(crc32($articles[$id])));
                $dates[$id] = $date;
            }
        }
    }
    //turn on compression if we aren't using it already
    if (extension_loaded('zlib') && ini_get("zlib.output_compression") == 0 && ini_get('output_handler') != 'ob_gzhandler' && !headers_sent()) {
        ob_start("ob_gzhandler");
    }
    $last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
    $last = gmdate("D, d M Y H:i:s \\G\\M\\T", $last);
    header("Last-Modified: {$last}");
    $expires = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 3600 * 1);
    header("Expires: {$expires}");
    $hims = serverset('HTTP_IF_MODIFIED_SINCE');
    if ($hims == $last) {
        header("HTTP/1.1 304 Not Modified");
        exit;
    }
    $imsd = @strtotime($hims);
    if (is_callable('apache_request_headers')) {
        $headers = apache_request_headers();
        if (isset($headers["A-IM"])) {
            $canaim = strpos($headers["A-IM"], "feed");
        } else {
            $canaim = false;
        }
    } else {
        $canaim = false;
    }
    $hinm = stripslashes(serverset('HTTP_IF_NONE_MATCH'));
    $cutarticles = false;
    if ($canaim !== false) {
        foreach ($articles as $id => $thing) {
            if (strpos($hinm, $etags[$id]) !== false) {
                unset($articles[$id]);
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:rss.php


示例17: author_list

function author_list()
{
    global $txp_user, $author_list_pageby;
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
        $sort = 'name';
    }
    $dir = $dir == 'desc' ? 'desc' : 'asc';
    $sort_sql = $sort . ' ' . $dir;
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $total = getCount('txp_users', '1=1');
    $limit = max($author_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    $rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', '1 = 1 order by ' . $sort_sql . ' limit ' . $offset . ', ' . $limit);
    if ($rs) {
        echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list') . tr(column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', 'name' == $sort ? $dir : '') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', 'RealName' == $sort ? $dir : '') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', 'email' == $sort ? $dir : '') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', 'privs' == $sort ? $dir : '') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', 'last_login' == $sort ? $dir : '') . hCell() . hCell());
        while ($a = nextRow($rs)) {
            extract(doSpecial($a));
            echo tr(td($name) . td($RealName) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs)) . td($last_login ? safe_strftime('%b&#160;%Y', $last_login) : '') . td(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, gTxt('edit')) : '') . td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name']) : ''));
        }
        echo n . n . tr(tda(select_buttons() . author_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="6" style="text-align: right; border: none;"')) . endTable() . '</form>' . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . pageby_form('admin', $author_list_pageby);
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:23,代码来源:txp_admin.php


示例18: link_list

function link_list($message = '')
{
    global $step, $link_list_pageby;
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $dir = $dir == 'desc' ? 'desc' : 'asc';
    switch ($sort) {
        case 'id':
            $sort_sql = 'id ' . $dir;
            break;
        case 'description':
            $sort_sql = 'description ' . $dir . ', id asc';
            break;
        case 'category':
            $sort_sql = 'category ' . $dir . ', id asc';
            break;
        case 'date':
            $sort_sql = 'date ' . $dir . ', id asc';
            break;
        default:
            $sort = 'name';
            $sort_sql = 'linksort ' . $dir . ', id asc';
            break;
    }
    $switch_dir = $dir == 'desc' ? 'asc' : 'desc';
    $criteria = 1;
    if ($search_method and $crit) {
        $crit_escaped = doSlash($crit);
        $critsql = array('id' => "ID in ('" . join("','", do_list($crit_escaped)) . "')", 'name' => "linkname like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'", 'category' => "category like '%{$crit_escaped}%'");
        if (array_key_exists($search_method, $critsql)) {
            $criteria = $critsql[$search_method];
        } else {
            $search_method = '';
            $crit = '';
        }
    } else {
        $search_method = '';
        $crit = '';
    }
    $total = getCount('txp_link', $criteria);
    if ($total < 1) {
        if ($criteria != 1) {
            echo n . link_search_form($crit, $search_method) . n . graf(gTxt('no_results_found'), ' class="indicator"');
        } else {
            echo n . graf(gTxt('no_links_recorded'), ' class="indicator"');
        }
        return;
    }
    $limit = max($link_list_pageby, 15);
    list($page, $offset, $numPages) = pager($total, $limit, $page);
    echo link_search_form($crit, $search_method);
    $rs = safe_rows_start('*, unix_timestamp(date) as uDate', 'txp_link', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
    if ($rs) {
        echo n . n . '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list') . n . tr(column_head('ID', 'id', 'link', true, $switch_dir, $crit, $search_method, 'id' == $sort ? $dir : '') . hCell() . column_head('link_name', 'name', 'link', true, $switch_dir, $crit, $search_method, 'name' == $sort ? $dir : '') . column_head('description', 'description', 'link', true, $switch_dir, $crit, $search_method, 'description' == $sort ? $dir : '') . column_head('link_category', 'category', 'link', true, $switch_dir,  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getCountries函数代码示例发布时间:2022-05-15
下一篇:
PHP getCorrectUserSalutation函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap