示例#1
0
 static function count($force = false)
 {
     global $db;
     $count = get_count('posts');
     if ($count === false || $force) {
         $count = $db->get_var("select count(*) from posts");
         set_count('posts', $count);
     }
     return $count;
 }
示例#2
0
 function index($page = NULL)
 {
     check_admin();
     $data = array();
     $limit = 10;
     $page = intval($page) > 0 ? $page : 1;
     $start = ($page - 1) * $limit;
     $data['froms'] = $this->form->get_forms($start, $limit);
     $page_all = ceil(get_count() / $limit);
     $data['pager'] = get_pager($page, $page_all, '/design');
     $this->view('index', $data);
 }
示例#3
0
文件: plugs.php 项目: yunsite/easysns
 function index()
 {
     //$data = array();
     $data['ci_top_title'] = '微件列表';
     $args = func_get_args();
     if (isset($args[2])) {
         $search = strip_tags(trim($args[2]));
         $search = urldecode($search);
     } else {
         $search = strip_tags(trim(v('search')));
     }
     $data['search'] = $search;
     $type = intval(v('type'));
     if ($args) {
         $mid = intval($args[0]);
     }
     if (!isset($mid) || $mid == '') {
         $mid = $type;
     }
     //
     if ($mid == '0') {
         $where = " AND `name` LIKE '%" . $search . "%' ";
         //$data['name'] = '全部范围';
     } elseif ($mid > '0') {
         $where = " AND `mid` = '" . intval($mid) . "' AND `name` LIKE '%" . $search . "%'";
         $name = lazy_get_var("SELECT `name` FROM `u2_plugs` WHERE 1 AND `id` = '" . intval($mid) . "'");
         if (!$name) {
             info_page('错误的组件ID');
         }
     } else {
         info_page('错误的组件ID');
     }
     $data['mid'] = $mid;
     $data['plugs_name'] = lazy_get_data("SELECT * FROM `u2_plugs`");
     $data['page'] = $page = !isset($args[1]) || intval($args[1]) < 1 ? 1 : intval($args[1]);
     $limit = 5;
     $start = ($page - 1) * $limit;
     $item = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs_widget` WHERE 1 {$where} ORDER BY `id` DESC  LIMIT {$start},{$limit}");
     $all = get_count();
     $data['item'] = $item;
     //$type = urlencode( $type );
     $base = '/plugs/index/' . $mid;
     $page_all = ceil($all / $limit);
     $text = urlencode($search);
     $data['pager'] = get_pager($page, $page_all, $base, $text);
     $data['is_admin'] = is_admin() ? true : false;
     $domain = _sess('domain');
     if ($domain != '') {
         $data['domain'] = $domain;
     }
     $this->view('list', $data);
 }
示例#4
0
 static function count($status = '', $force = false)
 {
     global $db, $globals;
     $my_id = SitesMgr::my_id();
     if (!$status) {
         return Link::count('published', $force) + Link::count('queued', $force) + Link::count('discard', $force) + Link::count('abuse', $force) + Link::count('autodiscard', $force);
     }
     $count = get_count("{$my_id}.{$status}");
     if ($count === false || $force) {
         $count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}'");
         set_count("{$my_id}.{$status}", $count);
     }
     return $count;
 }
示例#5
0
文件: parser.php 项目: arhipos/Arbel
function add($mas)
{
    global $mysqli;
    $query = $mysqli->query("Select id_group from tb_group WHERE name_doup='" . $mas[2] . "';");
    $id = '';
    while ($row = $query->fetch_assoc()) {
        $id = $row["id_group"];
    }
    if ($id == '') {
        $mysqli->query("insert into tb_group set name_doup='" . $mas[2] . "';");
        $id = $mysqli->insert_id;
    }
    echo get_count($query) . ' ' . $id . '<br>';
    $query = $mysqli->query("INSERT into tb_items set id_items='" . $mas[0] . "', id_cat='" . $id . "', price='" . $mas[8] . "', name='" . $mas[4] . "', disrc='" . $mas[9] . "',full_disr='" . $mas[9] . "';");
}
示例#6
0
 static function count($status = '', $cat = '', $force = false)
 {
     global $db;
     if (!$status) {
         return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
     }
     $count = get_count("{$status}.{$cat}");
     if ($count === false || $force) {
         if ($cat) {
             $cond = " and link_category in ({$cat}) ";
         }
         $count = $db->get_var("select count(*) from links where link_status = '{$status}' {$cond}");
         set_count("{$status}.{$cat}", $count);
     }
     return $count;
 }
示例#7
0
文件: link.php 项目: rasomu/chuza
	static function count($status='', $cat='', $force = false) {
		global $db;

		if (!$status) return Link::count('published', $cat, $force) +
							Link::count('queued', $cat, $force) +
							Link::count('discard', $cat, $force) +
							Link::count('abuse', $cat, $force) +
							Link::count('autodiscard', $cat, $force);


		$count = get_count("$status.$cat");
		if ($count === false || $force) {
			if ($cat) $cond = " and link_category in ($cat) ";
			$count = $db->get_var("select count(*) from links where link_status = '$status' $cond");
			set_count("$status.$cat", $count);
		}
		return $count;
	}
示例#8
0
 static function count($status = '', $cat = '', $force = false)
 {
     global $db, $globals;
     $my_id = SitesMgr::my_id();
     if (!$status) {
         return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
     }
     $count = get_count("{$my_id}.{$status}.{$cat}");
     if ($count === false || $force) {
         if (!empty($cat)) {
             $extra = "and category in ({$cat})";
         } else {
             $extra = '';
         }
         $count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}' {$extra}");
         set_count("{$my_id}.{$status}.{$cat}", $count);
     }
     return $count;
 }
示例#9
0
文件: function.php 项目: noikiy/zays
/**
 * 获取一道测试题目和题目选项
 *
 * @param integer $offset;
 * return array;
 */
function get_test_one($offset)
{
    $tc_id = get_tcid($offset);
    $count = get_count($tc_id);
    $num = get_total($tc_id);
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question WHERE `tc_id`='{$tc_id}' \n\t\tLIMIT {$num},1";
    echo $sql, '<br>';
    $question = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question_option WHERE `qid`='{$question['qid']}'";
    //echo $sql,'<br>';
    $option = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    $temp = array();
    $temp['tc_id'] = $tc_id;
    $temp['count'] = $count;
    $temp['num'] = $num;
    $temp['question'] = $question;
    $temp['option'] = $option;
    return $temp;
}
示例#10
0
文件: code.php 项目: yunsite/easysns
function get_system_plugs_data($para = NULL)
{
    $para = unserialize($para);
    $page = 1;
    if (isset($para['args'])) {
        $page = intval(array_shift($para['args']));
    }
    $page = $page < 1 ? 1 : $page;
    $data['title'] = isset($para['title']) && strip_tags($para['title']) != '' ? strip_tags($para['title']) : '组件';
    $limit = isset($para['limit']) && intval($para['limit']) > 0 ? intval($para['limit']) : 5;
    $start = ($page - 1) * $limit;
    $data['lines'] = 4;
    $apps = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs` WHERE `is_active` = 1 ORDER BY `has_widget` DESC LIMIT {$start},{$limit} ");
    $all = get_count();
    $wid = intval($GLOBALS['widget_id']);
    $page_all = ceil($all / $limit);
    $data['pager'] = get_widget_pager($wid, $page, $page_all);
    if ($apps) {
        foreach ($apps as $k => $v) {
            $aids[$v['aid']] = $v['aid'];
            $uids[$v['uid']] = $v['uid'];
        }
        if ($uids) {
            $data['names'] = get_name_by_uids($uids);
        }
        $data['aids'] = $aids;
        $data['apps'] = $apps;
    }
    $wids = lazy_get_data("SELECT * FROM `u2_plugs_widget`");
    if ($wids) {
        $data['wids'] = $wids;
    }
    $domain = _sess('domain');
    if ($domain != '') {
        $data['domain'] = $domain;
    }
    if (is_login()) {
        $data['is_login'] = true;
    }
    return $data;
}
示例#11
0
 $flow_cnt = sizeof($flow_arr);
 if ($flow_cnt > 0) {
     for ($c = 0; $c < $flow_cnt; $c++) {
         if ($flow_arr[$c] == $login_id) {
             $flow_no = $c + 1;
             break;
         }
     }
 }
 $view = false;
 $recognize_sign = get_first("workflow_ret", "recognize_sign", "refno=" . $row["seqno"] . " AND seqno=" . $flow_no, "");
 if ($recognize_sign == "") {
     if ($flow_no == 1) {
         $view = true;
     } else {
         $before_res_cnt = get_count("workflow_ret", "refno=" . $row["seqno"] . " AND seqno=" . ($flow_no - 1));
         if ($before_res_cnt > 0) {
             $view = true;
         }
     }
 }
 if ($view) {
     $v++;
     print "<TR>";
     // メモ内容
     print "<TD VALIGN=TOP>";
     print "・<A HREF=\"./workflow/result/?p=top&no=" . $row["seqno"] . "\">";
     $subject = mb_strcut($row["subject"], 0, 60, "EUC-JP");
     if (trim($subject) == "") {
         $subject = "(no subject)";
     }
示例#12
0
文件: items.php 项目: yunsite/easysns
if (!is_login()) {
    info_page('请登录后查看');
}
include_once dirname(__FILE__) . '/function.php';
$data = array();
$tab_type = 'items';
$data['ci_top_title'] = '物品';
$data['tab_type'] = $tab_type;
$data['tab_array'] = $tab_array;
$page = array_shift($args);
$page = intval($page) < 1 ? 1 : intval($page);
$limit = '48';
$start = ($page - 1) * $limit;
$uid = format_uid();
$items = lazy_get_data("select sql_calc_found_rows * from `global_user_items` where `uid` = '{$uid}' and `count` > 0 LIMIT {$start} , {$limit} ");
$all = get_count();
$base = '/app/native/ihome/items';
$page_all = ceil($all / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
$data['list'] = array();
if ($items) {
    foreach ($items as $v) {
        $iid[] = $v['iid'];
        $count[$v['iid']] = $v['count'];
    }
    $items_info = lazy_get_data("select * from `global_items` where `id` IN(" . join(',', $iid) . ") ");
    if ($items_info) {
        foreach ($items_info as $v) {
            $v['count'] = $count[$v['id']];
            $data['list'][] = $v;
        }
    echo "clients_disabled.draw LINE2\n";
    exit(0);
}
$db = Db::GetDatabaseHandle($baseParams, 'ykval-munin-yubikeystats');
if (!$db->connect()) {
    logdie($myLog, 'ERROR Database connect error (1)');
}
function get_count($db, $table, $conditions)
{
    $res = $db->customQuery("SELECT count(1) as count FROM {$table} WHERE {$conditions}");
    if ($res) {
        $r = $res->fetch(PDO::FETCH_ASSOC);
        return $r['count'];
    }
    return Null;
}
if ($count = get_count($db, 'yubikeys', 'active=true')) {
    echo "yubikeys_enabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'active=false')) {
    echo "yubikeys_disabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - 31 * 86400))) {
    echo "yubikeys_1month.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=true')) {
    echo "clients_enabled.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=false')) {
    echo "clients_disabled.value {$count}\n";
}
示例#14
0
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    render('main', array('title' => 'Posts tagged: ' . tag_i18n($tag) . ' - ' . blog_title(), 'description' => 'All posts tagged: ' . tag_i18n($tag) . ' on ' . blog_title() . '.', 'canonical' => site_url() . 'tag/' . strtolower($tag), 'page' => $page, 'posts' => $posts, 'tag' => $ttag, 'bodyclass' => 'intag', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Posts tagged: ' . tag_i18n($tag), 'pagination' => has_pagination($total, $perpage, $page), 'is_tag' => true));
});
// Show the archive page
get('/archive/:req', function ($req) {
    if (!login()) {
        file_cache($_SERVER['REQUEST_URI']);
    }
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('archive.perpage');
    $posts = get_archive($req, $page, $perpage);
    $total = get_count($req, 'basename');
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    $time = explode('-', $req);
    $date = strtotime($req);
    if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
        $timestamp = date('d F Y', $date);
    } elseif (isset($time[0]) && isset($time[1])) {
        $timestamp = date('F Y', $date);
    } else {
        $timestamp = $req;
    }
    $tarchive = new stdClass();
    $tarchive->title = $timestamp;
示例#15
0
        $word = stripslashes($word);
    }
    $word = trim(strip_tags($word));
    if (strlen($word) < 2) {
        $warn_str = "请输入正确的词汇";
    } else {
        if (strlen($word) > 30) {
            $warn_str = "输入的词语太长了";
        } else {
            if (strpos($word, ' ') !== false) {
                $warn_str = "词汇不要包含空格";
            } else {
                if (preg_match('/[\\x81-\\xfe]/', $word) && preg_match('/[\\x20-\\x7f]{3}/', $word)) {
                    $warn_str = "中英混合时字母最多只能出3个以下的连续字母";
                } else {
                    $count = get_count($word);
                    if ($count < 0) {
                        $warn_str = "内部原因,计算失败!";
                    } else {
                        $res = get_tfidf($word, $count);
                    }
                }
            }
        }
    }
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新词生词的TF/IDF计算器 - for scws</title>
示例#16
0
    _e('Mass Spam Nuke');
    ?>
</h2>
		<?php 
    _e('<p>Mass Spam Nuke allows you to delete every comment in your database that is flagged as spam with one click. Be warned this is undoable, if you are sure you don\'t have some legitimate comments flagged as spam then go for it.</p>');
    function get_count()
    {
        global $wpdb, $comments;
        $comments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam'");
        echo $comments;
    }
    ?>
<form method="post" action="admin.php?page=cjd_delete.php&action=nuked" name="form1">
<input type="hidden" name="action" value="nuked" />
There are currently <?php 
    get_count();
    ?>
 comments identified as spam.&nbsp; &nbsp; <input type="submit" name="Submit" value="Nuke em, nuke em all!">
</form>
</div>
<div class="wrap">
<h2><?php 
    _e('Selective Spam Nuke');
    ?>
</h2>
		<?php 
    _e('<p>Selective Spam Nuke allows you to choose the spam you are nuking by clicking the checkbox at the beginning of each row.  When you have checked all the spam you want for deletion simply click the Nuke em! button at the bottom of the screen and that\'s it.</p>');
    $comments = $wpdb->get_results("SELECT *, COUNT(*) AS count FROM {$wpdb->comments} WHERE comment_approved = 'spam' GROUP BY comment_author_IP");
    if ($comments) {
        ?>
<table width="100%" cellpadding="3" cellspacing="3">
示例#17
0
            $menutext .= "<IMG SRC=\"{$toppath}/image/tri.gif\" WIDTH=12 HEIGHT=13>";
        }
        $menutext .= "</TD><TD>";
        if ($adr_kind != $kind_key) {
            $menutext .= "<A HREF=\"{$toppath}/address/?new_kind={$kind_key}\">";
        }
        $menutext .= $kind_name;
        $menutext .= "</A>";
        if ($count > 0) {
            $menutext .= " (" . number_format($count) . ")";
        }
        $menutext .= "</TD></TR>\n";
    }
}
$menutext .= "<TR><TD HEIGHT=1 COLSPAN=2 BGCOLOR=#999999></TD></TR>";
$menutext .= "<TR><TD WIDTH=16>";
if ($adr_kind == "kindisnone") {
    $menutext .= "<IMG SRC=\"{$toppath}/image/tri.gif\" WIDTH=12 HEIGHT=13>";
} else {
    $menutext .= "&nbsp;";
}
$menutext .= "</TD><TD>";
if ($adr_kind == "kindisnone") {
    $menutext .= "分類未設定";
} else {
    $menutext .= "<A HREF=\"{$toppath}/address/?new_kind=kindisnone\">分類未設定";
}
$menutext .= " (" . number_format(get_count("address", "kind_list='' or kind_list is null")) . ")";
$menutext .= "</TD></TR>";
$menutext .= "</TABLE>\n";
$menutext .= "</TD></TR>\n</TABLE>\n</TD></TR></TABLE>\n\n<BR>\n";
示例#18
0
/**
 * Obtiene los posts de cada Blog, si el $id_users
 * es cero, entonces son de la pagina principal.
 *
 * @param int $id_posts
 * @param int $id_users
 * @param int $start
 * @return array
 */
function get_posts($id_posts = 0, $id_users = 0, $start = 0, $active = 'yes')
{
    global $db;
    global $preferences;
    global $_GET;
    $where = '';
    $where .= $active != 'all' ? ' posts.active = \'' . $active . '\'' : ' 1';
    $where .= $id_posts > 0 ? ' AND posts.id_posts = ' . $id_posts : '';
    $where .= $id_users > 0 ? ' AND posts.id_users = ' . $id_users : '';
    $q = new Query($db);
    $q->exec('SELECT posts.id_posts
                   , posts.id_users
                   , posts.title
                   , posts.content
                   , posts.date
                   , posts.modified
                   , posts.active
                   , users.name AS user
                   , users.username
              FROM posts
              LEFT JOIN users ON ( users.id_users = posts.id_users )
              WHERE
              ' . $where . '
              ORDER BY posts.date DESC
              LIMIT ' . $start . ', ' . $preferences['per_page']);
    $data = array();
    $posts = '';
    $pagination = '';
    $comments = '';
    for ($i = 0; $i < $q->numrows; $i++) {
        $data[$q->data['id_posts']] = $q->data;
        $posts .= '
<h1><a href="?id_posts=' . $q->data['id_posts'] . '">' . $q->data['title'] . '</a></h1>
' . ($q->data['id_users'] > 0 ? '<a href="?id_users=' . $q->data['id_users'] . '">' . $q->data['user'] . '</a>' : 'Anonymous') . ' writes ' . $q->data['content'] . '
<div class="article_menu">
    <b>Posted on ' . date($preferences['date_format'], strtotime($q->data['date'])) . '</b> <a href="?id_posts=' . $q->data['id_posts'] . '">' . get_count('comments', 'id_posts = ' . $q->data['id_posts']) . ' Comments</a>
</div>';
        $q->nxt();
    }
    $q->free();
    if ($id_posts < 1) {
        foreach ($_GET as $key => $value) {
            if ($key != 'start') {
                $php_self .= (strpos($php_self, '?') !== false ? '&amp;' : '?') . $key . '=' . $value;
            }
        }
        $pagination = generate_pagination($php_self, get_count('posts', $id_users > 0 ? 'id_users = ' . $id_users : ''), $preferences['per_page'], $start);
    }
    if ($id_posts > 0) {
        list($comments_data, $comments) = get_comments($id_posts);
    }
    return array($data, $posts, $pagination, $comments);
}
示例#19
0
if ($action == NULL) {
    $action = strtolower(filter_input(INPUT_GET, 'action'));
    if ($action == NULL) {
        $action = 'list_selected_tests';
    }
}
verify_logged_in();
if (isset($action) and $action == "logout") {
    if (isset($_SESSION['prev_usr_id'])) {
        $_SESSION['user'] = User::getUserByUsrId($_SESSION['prev_usr_id']);
        unset($_SESSION['prev_usr_id']);
        header("Location: ../admin/index.php");
    } else {
        session_destroy();
        header("Location: ../index.php");
    }
}
switch ($action) {
    case 'list_selected_tests':
        $count = get_count($user->usr_id);
        $testSelectedList = get_selected_test_list($user->usr_id);
        include './view.php';
        break;
    case 'show_itinerary':
        header("Location: ../itinerary");
        break;
    default:
        echo 'Unknown account action: ' . $action;
        break;
}
exit;
示例#20
0
function is_empty($sq)
{
    return get_count($sq) === 0;
}
示例#21
0
function show_forums($forid, $subforums = false, $sfa = "", $show_mods = false)
{
    global $CURUSER, $pic_base_url, $READPOST_EXPIRY, $DEFAULTBASEURL, $ss_uri, $forummods;
    $forums_res = sql_query("SELECT f.id, f.name, f.description, f.postcount, f.topiccount, f.minclassread, p.added, p.topicid, p.userid, p.id AS pid, u.username, t.subject, t.lastpost, r.lastpostread " . "FROM forums AS f " . "LEFT JOIN posts AS p ON p.id = (SELECT MAX(lastpost) FROM topics WHERE forumid = f.id) " . "LEFT JOIN users AS u ON u.id = p.userid " . "LEFT JOIN topics AS t ON t.id = p.topicid " . "LEFT JOIN readposts AS r ON r.userid = " . sqlesc($CURUSER['id']) . " AND r.topicid = p.topicid " . "WHERE " . ($subforums == false ? "f.forid = {$forid} AND f.place =-1 ORDER BY f.forid ASC" : "f.place={$forid} ORDER BY f.id ASC") . "") or sqlerr(__FILE__, __LINE__);
    while ($forums_arr = mysql_fetch_assoc($forums_res)) {
        if ($CURUSER['class'] < $forums_arr["minclassread"]) {
            continue;
        }
        $forumid = (int) $forums_arr["id"];
        $lastpostid = (int) $forums_arr['lastpost'];
        if ($subforums == false && !empty($sfa[$forumid])) {
            if ($sfa[$forumid]['lastpost']['postid'] > $forums_arr['pid']) {
                $lastpost = "" . $sfa[$forumid]['lastpost']['added'] . "<br />" . "by <a href='{$DEFAULTBASEURL}/userdetails.php?id=" . (int) $sfa[$forumid]['lastpost']['userid'] . "'><b>" . safeChar($sfa[$forumid]['lastpost']['user']) . "</b></a><br />" . "in <a href='" . $_SERVER['PHP_SELF'] . "?action=viewtopic&amp;topicid=" . (int) $sfa[$forumid]['lastpost']['topic'] . "&amp;page=p" . $sfa[$forumid]['lastpost']['postid'] . "#p" . $sfa[$forumid]['lastpost']['postid'] . "'><b>" . safeChar($sfa[$forumid]['lastpost']['tname']) . "</b></a>";
            } elseif ($sfa[$forumid]['lastpost']['postid'] < $forums_arr['pid']) {
                $lastpost = "" . $forums_arr["added"] . "<br />" . "by <a href='{$DEFAULTBASEURL}/userdetails.php?id=" . (int) $forums_arr["userid"] . "'><b>" . safeChar($forums_arr['username']) . "</b></a><br />" . "in <a href='" . $_SERVER['PHP_SELF'] . "?action=viewtopic&amp;topicid=" . (int) $forums_arr["topicid"] . "&amp;page=p{$lastpostid}#p{$lastpostid}'><b>" . safeChar($forums_arr['subject']) . "</b></a>";
            } else {
                $lastpost = "N/A";
            }
        } else {
            if (is_valid_id($forums_arr['pid'])) {
                $lastpost = "" . $forums_arr["added"] . "<br />" . "by <a href='{$DEFAULTBASEURL}/userdetails.php?id=" . (int) $forums_arr["userid"] . "'><b>" . safeChar($forums_arr['username']) . "</b></a><br />" . "in <a href='" . $_SERVER['PHP_SELF'] . "?action=viewtopic&amp;topicid=" . (int) $forums_arr["topicid"] . "&amp;page=p{$lastpostid}#p{$lastpostid}'><b>" . safeChar($forums_arr['subject']) . "</b></a>";
            } else {
                $lastpost = "N/A";
            }
        }
        if (is_valid_id($forums_arr['pid'])) {
            $img = 'unlocked' . ($forums_arr['added'] > get_date_time(gmtime() - $READPOST_EXPIRY) ? (int) $forums_arr['pid'] > $forums_arr['lastpostread'] : 0 ? 'new' : '');
        } else {
            $img = "unlocked";
        }
        if ($subforums == false && !empty($sfa[$forumid])) {
            list($subposts, $subtopics) = get_count($sfa[$forumid]["count"]);
            $topics = $forums_arr["topiccount"] + $subtopics;
            $posts = $forums_arr["postcount"] + $subposts;
        } else {
            $topics = $forums_arr["topiccount"];
            $posts = $forums_arr["postcount"];
        }
        ?>
<tr>
			<td align='left' style="border:none;">
				<table border=0 cellspacing=0 cellpadding=0 style="border:none;">
					<tr>
						<td class=embedded style='padding-right: 5px'><img src="themes/<?php 
        echo $ss_uri . "/forum/" . $img;
        ?>
.png" /></td>
						<td class=embedded>
							<a href='<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?action=viewforum&amp;forumid=<?php 
        echo $forumid;
        ?>
'><b><?php 
        echo safeChar($forums_arr["name"]);
        ?>
</b></a><?php 
        if ($CURUSER['class'] >= UC_ADMINISTRATOR || isMod($forumid)) {
            ?>
&nbsp;<font class='small'>[<a class='altlink' href='<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?action=editforum&amp;forumid=<?php 
            echo $forumid;
            ?>
'>Edit</a>][<a class='altlink' href='<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?action=deleteforum&amp;forumid=<?php 
            echo $forumid;
            ?>
'>Delete</a>]</font><?php 
        }
        if (!empty($forums_arr["description"])) {
            ?>
<br /><?php 
            echo safeChar($forums_arr["description"]);
        }
        if ($subforums == false && !empty($sfa[$forumid])) {
            echo "<br/>" . subforums($sfa[$forumid]["topics"]);
        }
        if ($show_mods == true && isset($forummods[$forumid])) {
            print "<br/>" . showMods($forummods[$forumid]);
        }
        ?>
</td>
					</tr>
				</table>
			</td>
			<td align='center'><?php 
        echo number_format($topics);
        ?>
</td>
			<td align='center'><?php 
        echo number_format($posts);
        ?>
</td>
			<td align='left' nowrap="nowrap"><?php 
        echo $lastpost;
        ?>
</td>
		</tr><?php 
    }
}
示例#22
0
unset($test);
echo $abc;
?>

4. 写出如下程序的输出结果
<?php 
$count = 5;
function get_count()
{
    static $count = 0;
    return $count++;
}
echo $count;
++$count;
echo get_count();
echo get_count();
?>

5. 写出如下程序的输出结果
<?php 
$GLOBALS['var1'] = 5;
$var2 = 1;
function get_value()
{
    global $var2;
    $var1 = 0;
    return $var2++;
}
get_value();
echo $var1;
echo $var2;
示例#23
0
echo '<tr><td class="tablecat">Inactive since</td><td class="tablecat">Number (percentage of total users)</td></tr>', "\n";
$curtime = time();
$uarr = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt FROM users"));
$usercount = $uarr["cnt"];
// 24h, stdl. --> 24x
for ($I = 0; $I < 24; $I++) {
    stat_row($I . "h", get_count($curtime - $I * 3600));
}
// 48 Hours (2d), 3 stdl. --> 8x
for ($I = 24; $I < 48; $I += 3) {
    stat_row($I . "h", get_count($curtime - $I * 3600));
}
// 72 Hours (3d), 6 stdl. --> 4x
for ($I = 48; $I < 72; $I += 6) {
    stat_row($I . "h", get_count($curtime - $I * 3600));
}
// 96 Hours (4d), 12 stdl. --> 2x
for ($I = 72; $I < 96; $I += 12) {
    stat_row($I . "h", get_count($curtime - $I * 3600));
}
// 5-7d, 24stdl. --> 3x
for ($I = 4; $I < 7; $I++) {
    stat_row($I . "d", get_count($curtime - $I * 3600 * 24));
}
// 1-6 weeks, wtl.
for ($I = 1; $I < 7; $I++) {
    stat_row($I . "w", get_count($curtime - $I * 3600 * 24 * 7));
}
end_table();
end_frame();
stdfoot();
示例#24
0
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    render('main', array('head_contents' => head_contents('Posts tagged: ' . $tag . ' - ' . blog_title(), 'All posts tagged: ' . $tag . ' on ' . blog_title() . '.', site_url() . 'tag/' . $tag), 'page' => $page, 'posts' => $posts, 'bodyclass' => 'intag', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Posts tagged: ' . $tag, 'pagination' => has_pagination($total, $perpage, $page)));
});
// The archive page
get('/archive/:req', function ($req) {
    if (!login()) {
        file_cache($_SERVER['REQUEST_URI']);
    }
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('archive.perpage');
    $posts = get_archive($req, $page, $perpage);
    $total = get_count($req, 'filename');
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    $time = explode('-', $req);
    $date = strtotime($req);
    if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
        $timestamp = date('d F Y', $date);
    } elseif (isset($time[0]) && isset($time[1])) {
        $timestamp = date('F Y', $date);
    } else {
        $timestamp = $req;
    }
    if (!$date) {
        // a non-existing page
示例#25
0
    $r = get_count($hitsid);
    if (!$r) {
        exit;
    }
    extract($r);
    hits($hitsid);
    echo "\$('#todaydowns').html('{$dayviews}');";
    echo "\$('#weekdowns').html('{$weekviews}');";
    echo "\$('#monthdowns').html('{$monthviews}');";
} elseif ($_GET['module'] && $_GET['id']) {
    $module = $_GET['module'];
    if (preg_match('/([^a-z0-9_\\-]+)/i', $module)) {
        exit('1');
    }
    $hitsid = $module . '-' . intval($_GET['id']);
    $r = get_count($hitsid);
    if (!$r) {
        exit;
    }
    extract($r);
    hits($hitsid);
}
/**
 * 获取点击数量
 * @param $hitsid
 */
function get_count($hitsid)
{
    global $db;
    $r = $db->get_one(array('hitsid' => $hitsid));
    if (!$r) {
示例#26
0
文件: index.php 项目: yunsite/easysns
if ($day) {
    if ($day == '7') {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -7 day")) . "'";
    } elseif ($day == '365') {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -365 day")) . "'";
    } else {
        $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -1 day")) . "'";
    }
} else {
    $time = "AND `time` > '" . date('Y-m-d H:i:s', strtotime("{$date} -1 day")) . "'";
    $day = '1';
}
$data['day'] = $day;
$data['inum'] = lazy_get_var("SELECT COUNT(*) FROM `app_feed_item` WHERE 1 AND `state` = '2'");
$item = lazy_get_data("SELECT sql_calc_found_rows * FROM `app_feed_item` WHERE 1 AND `state` = '2'  {$where} {$time} {$hi} LIMIT {$start} , {$limit} ");
$data['all'] = $all = get_count();
$snap = array();
if (file_exists(dirname(__FILE__) . '/snap.info.txt')) {
    $snap = unserialize(file_get_contents(dirname(__FILE__) . '/snap.info.txt'));
}
foreach ($item as $ik => $iv) {
    $snap_content = isset($snap[$iv['fid']]) ? true : false;
    $item[$ik]['desp'] = format_contents($iv['desp'], $snap_content);
}
$data['item'] = $item;
$times = array();
$diged = array();
if ($item) {
    foreach ($item as $k => $v) {
        $times[$v['id']] = time2Units($v['time']);
        $iids[] = $v['id'];
示例#27
0
     /* Change ENV values to that of root
        -------------------------------------------*/
     $query = "SELECT * from riot4.settings WHERE User_ID = ?";
     $params = array($_SESSION['userid']);
     $statement = sqlsrv_query($conn, $query, $params);
     if (sqlsrv_has_rows($statement)) {
         while ($row = sqlsrv_fetch_array($statement)) {
             $query_env_update = "UPDATE riot4.ENV_settings SET Value  = ? WHERE id = ? AND Device = ?";
             $params = array($row['Value'], $Envir_ID, $row['Device']);
             $statement_env_update = sqlsrv_query($conn, $query_env_update, $params);
         }
     }
     $msg = "You are admin for the environment";
     header("Location: /env_settings.php?Message=" . urlencode($msg));
 } else {
     if (get_count($_SESSION['MID']) == 0) {
         /* Change ENV values to that of first user
            -------------------------------------------*/
         $query = "SELECT * from riot4.settings WHERE User_ID = ?";
         $params = array($_SESSION['userid']);
         $statement = sqlsrv_query($conn, $query, $params);
         if (sqlsrv_has_rows($statement)) {
             while ($row = sqlsrv_fetch_array($statement)) {
                 $query_env_update = "UPDATE riot4.ENV_settings SET Value  = ? WHERE id = ? AND Device = ? AND LOCK=0";
                 $params = array($row['Value'], $Envir_ID, $row['Device']);
                 $statement_env_update = sqlsrv_query($conn, $query_env_update, $params);
             }
         }
         $msg = "You are 1st user in the environment";
         header("Location: /env_settings.php?Message=" . urlencode($msg));
     }
示例#28
0
        if ($row_count2["status"] == "1") {
            // 未承認のカウント
            $to_not += $row_count2["count"];
        } elseif ($row_count2["status"] == "2") {
            // 承認済みのカウント
            $to_has += $row_count2["count"];
        } elseif ($row_count2["status"] == "3") {
            // 否認済みのカウント
            $to_has2 += $row_count2["count"];
        }
    }
}
// ワークフロー名書き出し
$menutext .= "<TABLE CELLPADDING=1 CELLSPACING=0 BORDER=0 WIDTH=150>\n";
// 受け系
$cnt_master = get_count("flows", "user_ids ~* '(^|,)" . $login_id . "(,|\$)'");
if ($cnt_master > 0) {
    $menutext .= "<TR><TD WIDTH=16>";
    if ($viewtype == "notread" && $viewrange == "to") {
        $menutext .= "<IMG SRC=\"{$topath}/image/tri.gif\" WIDTH=12 HEIGHT=13>";
    } else {
        $menutext .= "&nbsp;";
    }
    $menutext .= "</TD><TD>";
    if ($to_not == 0) {
        $menutext .= "<A HREF=\"{$toppath}/workflow/?viewtype=notread&viewrange=to\"><FONT STYLE=\"font-weight:normal;text-decoration:none\">未承認</FONT></A><BR>\n";
    } else {
        $menutext .= "<A HREF=\"{$toppath}/workflow/?viewtype=notread&viewrange=to\">未承認</A> (" . number_format($to_not) . ")<BR>\n";
    }
    $menutext .= "</TD></TR>\n";
    $menutext .= "<TR><TD WIDTH=16>";
示例#29
0
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
    info_page('请登录后查看');
}
$uid = format_uid();
$folder = z(array_shift($args));
$cid = intval(array_shift($args));
$mid = app_config('mid', $folder);
$bind = app_config('bind', $folder);
if (!isset($mid)) {
    info_page('没有此表!');
}
if ($bind['price'] == '' || $bind['price'] <= '0') {
    info_page('价格错误!');
}
foreach ($bind as $k => $v) {
    $selected[] = " `{$v}` as {$k} ";
}
$com = lazy_get_line("SELECT  " . join(',', $selected) . " FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "'");
$cnum = get_count();
if ($cnum == '0') {
    info_page('没有此件物品!');
}
$num = lazy_get_var("SELECT COUNT(*) FROM `app_shopcart` WHERE `cid` = '" . intval($cid) . "' AND `uid` = '" . intval($uid) . "'");
if ($num != '0') {
    lazy_run_sql("UPDATE `app_shopcart` SET `num` = `num`+1 WHERE `cid` = '" . intval($cid) . "' AND `uid` = '" . intval($uid) . "'");
} else {
    lazy_run_sql("INSERT INTO `app_shopcart` ( `uid`, `cid`, `name`, `desp`, `num`, `money`, `date`, `folder` ) VALUES ( '" . intval($uid) . "' , '" . intval($cid) . "' , " . s($com['title']) . " , " . s($com['desp']) . " , '1' , " . s($com['price']) . " , '" . date('Y-m-d H:i:s') . "' , " . s($folder) . " )");
}
header('Location: /app/native/' . $GLOBALS['app']);
示例#30
0
      <div class="statnum"><?php 
    get_count('article');
    ?>
</div>
      <div class="statlabel">文章数</div>
    </td>
    <td class="stat">
          <div class="statnum"><?php 
    get_count('comments');
    ?>
</div>
          <div class="statlabel">评论数</div>
    </td>
    <td class="stat stat-last">
          <div class="statnum"><?php 
    get_count('tags');
    ?>
</div>
          <div class="statlabel">标签数</div>
    </td>
  </tr>
</table>
      </div>
      <div class="timeline">
        <table class="titlebar">
          <td>文章</td>    
        </table>
          
<?php 
    $this->need('widget-mo-list.php');
    ?>