本文整理汇总了PHP中GetPageList函数的典型用法代码示例。如果您正苦于以下问题:PHP GetPageList函数的具体用法?PHP GetPageList怎么用?PHP GetPageList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPageList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
function build_page($method)
{
global $mystep, $req, $db, $setting, $idx, $se;
$tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
$tpl_info['idx'] = $method;
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "engine") {
$n = 1;
foreach ($se as $key => $value) {
$record = array();
$record['idx'] = $n++;
$record['key'] = $key;
$record['value'] = $value;
$tpl_tmp->Set_Loop('record', $record);
}
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_search_title']);
} elseif ($method == "keyword") {
$order = $req->getGet("order");
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$counter = $db->result($setting['db']['pre'] . "search_keyword", "count(*)");
$page = $req->getGet("page");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=keyword&order=" . $order . "&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "chg_date";
}
$db->select($setting['db']['pre'] . "search_keyword", "*", "", array("order" => "{$order} {$order}", "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
$record['add_date'] = date("Y-m-d H:i:s", $record['add_date']);
$record['chg_date'] = date("Y-m-d H:i:s", $record['chg_date']);
$record['encode'] = urlencode($record['keyword']);
$tpl_tmp->Set_Loop('record', $record);
}
$db->Free();
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_search_title_kw']);
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
$order_type = "asc";
} else {
$order_type = "desc";
}
$tpl_tmp->Set_Variable('order', $order);
$tpl_tmp->Set_Variable('order_type', $order_type);
}
$tpl->Set_Variable('path_admin', $setting['path']['admin']);
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
unset($tpl_tmp);
$mystep->show($tpl);
return;
}
示例2: build_page
function build_page()
{
global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id;
$tpl_info['idx'] = "func_attach";
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
$order = $req->getGet("order");
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$keyword = $req->getGet("keyword");
$tpl_tmp->Set_Variable('keyword', $keyword);
$condition = array();
if (!empty($keyword)) {
$condition[] = array("file_name", "like", $keyword);
}
$counter = $db->result($setting['db']['pre'] . "attachment", "count(*)", $condition);
$page = $req->getGet("page");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "id";
}
$the_order = array();
$the_order[] = "{$order} {$order_type}";
if ($order != "id") {
$the_order[] = "id desc";
}
$db->select($setting['db']['pre'] . "attachment", "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
$order_type = "asc";
} else {
$order_type = "desc";
}
$tpl_tmp->Set_Variable('order', $order);
$tpl_tmp->Set_Variable('order_type', $order_type);
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
$record['web_url'] = $setting['web']['url'];
$record['file_time'] = date("Y-m-d H:m:s", substr($record['file_time'], 0, 10));
$tpl_tmp->Set_Loop('record', $record);
}
$tpl_tmp->Set_Variable('title', $setting['language']['admin_func_attach_title']);
$db->Free();
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
unset($tpl_tmp);
$mystep->show($tpl);
return;
}
示例3: index
public function index()
{
$myid = $this->admin['aid'];
$NumPerPage = 10;
$page = ForceIntFrom('p', 1);
$search = ForceStringFrom('s');
$groupid = ForceStringFrom('g');
if (IsGet('s')) {
$search = urldecode($search);
}
$start = $NumPerPage * ($page - 1);
SubMenu('我的对话记录', array(array('记录列表', 'mymessages', 1)));
TableHeader('搜索对话记录');
TableRow('<center><form method="post" action="' . BURL('mymessages') . '" name="search" style="display:inline-block;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>分类:</label> <select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>客人的发言</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>我的发言</option></select> <input type="submit" value="搜索记录" class="cancel"></form></center>');
TableFooter();
if ($search) {
if (preg_match("/^[1-9][0-9]*\$/", $search)) {
$s = ForceInt($search);
$searchsql = " WHERE (mid = '{$s}' OR fromid = '{$s}' OR toid = '{$s}') ";
//按ID搜索
$title = "搜索ID号为: <span class=note>{$s}</span> 的记录";
} else {
$searchsql = " WHERE (fromname LIKE '%{$search}%' OR toname LIKE '%{$search}%' OR msg LIKE '%{$search}%') ";
$title = "搜索: <span class=note>{$search}</span> 的记录列表";
}
if ($groupid) {
if ($groupid == 1 or $groupid == 2) {
$searchsql .= " AND (" . Iif($groupid == 1, "type = 0 AND toid = '{$myid}'", "type = 1 AND fromid = '{$myid}'") . ") ";
$title = "在 <span class=note>" . Iif($groupid == 1, '客人的发言', '我的发言') . "</span> 中, " . $title;
}
} else {
$searchsql .= " AND ((type = 1 AND fromid = '{$myid}') OR (type = 0 AND toid = '{$myid}')) ";
}
} else {
if ($groupid) {
if ($groupid == 1 or $groupid == 2) {
$searchsql .= " WHERE " . Iif($groupid == 1, "type = 0 AND toid = '{$myid}' ", "type = 1 AND fromid = '{$myid}' ");
$title = "全部 <span class=note>" . Iif($groupid == 1, '客人的发言', '我的发言') . "</span> 列表";
}
} else {
$searchsql = " WHERE (type = 1 AND fromid = '{$myid}') OR (type = 0 AND toid = '{$myid}') ";
$title = '全部记录列表';
}
}
$getmy = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "msg " . $searchsql . " ORDER BY mid DESC LIMIT {$start},{$NumPerPage}");
$maxrows = APP::$DB->getOne("SELECT COUNT(mid) AS value FROM " . TABLE_PREFIX . "msg " . $searchsql);
TableHeader($title . '(' . $maxrows['value'] . '个)');
TableRow(array('ID', '发送人', '对话内容', '接收人', '记录时间'), 'tr0');
if ($maxrows['value'] < 1) {
TableRow('<center><BR><font class=redb>未搜索到任何记录!</font><BR><BR></center>');
} else {
while ($msg = APP::$DB->fetch($getmy)) {
TableRow(array($msg['mid'], $msg['fromname'], getSmile($msg['msg']), $msg['toname'], DisplayDate($msg['time'], '', 1)));
}
$totalpages = ceil($maxrows['value'] / $NumPerPage);
if ($totalpages > 1) {
TableRow(GetPageList(BURL('mymessages'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
}
}
TableFooter();
}
示例4: build_page
function build_page($method)
{
global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $web_id, $setting_sub;
$tpl_info['idx'] = "art_tag";
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
$order = $req->getGet("order");
if (empty($order)) {
$order = "id";
}
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$keyword = $req->getGet("keyword");
$tpl_tmp->Set_Variable('keyword', $keyword);
$page = $req->getGet("page");
$condition = array();
if (!empty($keyword)) {
$condition = array("tag", "like", $keyword);
}
$counter = $db->result($setting['db']['pre_sub'] . "news_tag", "count(*)", $condition);
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&order={$order}&order_type={$order_type}&web_id={$web_id}", $page);
$tpl_tmp->Set_Variables($page_arr);
$db->select($setting['db']['pre_sub'] . "news_tag", "*", $condition, array("order" => "{$order} {$order_type}", "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
$record['link'] = getUrl("tag", urlencode($record['tag']), 1, $web_id);
$record['add_date'] = date("Y-m-d", $record['add_date']);
$record['update_date'] = date("Y-m-d", $record['update_date']);
$tpl_tmp->Set_Loop('record', $record);
}
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
$order_type = "asc";
} else {
$order_type = "desc";
}
$tpl_tmp->Set_Variable('order', $order);
$tpl_tmp->Set_Variable('order_type', $order_type);
$tpl_tmp->Set_Variable('title', $setting['language']['admin_art_tag_title']);
$tpl_tmp->Set_Variable('web_id', $web_id);
$max_count = count($GLOBALS['website']);
for ($i = 0; $i < $max_count; $i++) {
$GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $web_id ? "selected" : "";
$tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
}
$db->Free();
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
unset($tpl_tmp);
$mystep->show($tpl);
return;
}
示例5: exit
exit('没指定评论文档的ID,不能进行操作!');
}
include_once DEDEINC . '/memberlogin.class.php';
$cfg_ml = new MemberLogin();
if (empty($dopost)) {
$dopost = '';
}
$page = empty($page) ? 1 : intval($page);
$pagesize = 10;
/*----------------------
获得指定页的评论内容
function getlist(){ }
----------------------*/
if ($dopost == 'getlist') {
$totalcount = GetList($page);
GetPageList($pagesize, $totalcount);
exit;
} else {
if ($dopost == 'send') {
require_once DEDEINC . '/charset.func.php';
//检查验证码
if ($cfg_feedback_ck == 'Y') {
$svali = strtolower(trim(GetCkVdValue()));
if (strtolower($validate) != $svali || $svali == '') {
ResetVdValue();
echo '<font color="red">验证码错误,请点击验证码图片更新验证码!</font>';
exit;
}
}
$arcRow = GetOneArchive($aid);
if (empty($arcRow['aid'])) {
示例6: build_page
function build_page($method)
{
global $mystep, $req, $db, $setting, $id;
$tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
$tpl_info['idx'] = $method == "list" ? "list" : "input";
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
$ad_mode = explode(",", $setting['language']['plugin_ad_show_mode']);
if ($method == "list") {
$order = $req->getGet("order");
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$counter = $db->result($setting['db']['pre'] . "ad_show", "count(*)");
$page = $req->getGet("page");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "id";
}
$the_order = array();
$the_order[] = "{$order} {$order_type}";
if ($order != "id") {
$the_order[] = "id desc";
}
$db->select($setting['db']['pre'] . "ad_show", "*", "", array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
$order_type = "asc";
} else {
$order_type = "desc";
}
$tpl_tmp->Set_Variable('order', $order);
$tpl_tmp->Set_Variable('order_type', $order_type);
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
$record['ad_mode'] = $ad_mode[$record['ad_mode']];
$tpl_tmp->Set_Loop('record', $record);
}
$db->Free();
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_ad_show_title']);
} else {
if ($method == "edit") {
$record = $db->record($setting['db']['pre'] . "ad_show", "*", array("id", "n=", $id));
if ($record === false) {
$tpl_tmp->Set_Variable('main', showInfo($setting['language']['plugin_ad_show_error'], 0));
$mystep->show($tpl);
$mystep->pageEnd(false);
}
HtmlTrans(&$record);
$db->Free();
} else {
$record = array();
$record['id'] = 0;
$record['idx'] = "";
$record['ad_client'] = "";
$record['ad_url'] = "";
$record['ad_mode'] = 1;
$record['ad_file'] = "";
$record['ad_text'] = "";
$record['ad_level'] = 1;
$record['exp_date'] = "";
$record['comment'] = "";
}
$tpl_tmp->Set_Variables($record);
for ($i = 0, $m = count($ad_mode); $i < $m; $i++) {
$tpl_tmp->Set_Loop('ad_mode', array("idx" => $i, "mode" => $ad_mode[$i], "selected" => $i == $record['ad_mode'] ? "selected" : ""));
}
$db->select($setting['db']['pre'] . "ad_show", "distinct idx");
while ($record = $db->GetRS()) {
$record['selected'] = $record['idx'] == $idx ? "selected" : "";
$tpl_tmp->Set_Loop('idx', $record);
}
$db->Free();
$tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_ad_show_add'] : $setting['language']['plugin_ad_show_edit']);
$tpl_tmp->Set_Variable('method', $method);
$tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
}
$tpl->Set_Variable('path_admin', $setting['path']['admin']);
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
unset($tpl_tmp);
$mystep->show($tpl);
return;
}
示例7: list
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=referer&order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "id";
}
$db->select($setting['db']['pre'] . "visit_analysis", "*", "", array("order" => "{$order} {$order_type}", "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
$record['add_date'] = date("Y-m-d H:i:s", $record['add_date']);
$record['chg_date'] = date("Y-m-d H:i:s", $record['chg_date']);
$tpl_tmp->Set_Loop('record', $record);
}
$db->Free();
} elseif ($method == "keyword") {
$counter = $db->result($setting['db']['pre'] . "visit_keyword", "count(*)");
$page = $req->getGet("page");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=keyword&order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "id";
}
$db->select($setting['db']['pre'] . "visit_keyword", "*", "", array("order" => "{$order} {$order_type}", "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
$record['keyword'] = stripcslashes($record['keyword']);
$record['add_date'] = date("Y-m-d H:i:s", $record['add_date']);
$record['chg_date'] = date("Y-m-d H:i:s", $record['chg_date']);
$tpl_tmp->Set_Loop('record', $record);
}
$db->Free();
}
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
示例8: build_page
function build_page($method)
{
global $mystep, $req, $db, $tpl, $tpl_info, $setting, $news_cat, $news_id, $cat_id, $group, $web_id, $setting_sub;
$top_mode_list = array("0" => $setting['language']['admin_art_content_top_mode_1'], "1" => $setting['language']['admin_art_content_top_mode_2'], "2" => $setting['language']['admin_art_content_top_mode_3']);
$top_list = array("1" => $setting['language']['admin_art_content_top_1'], "2" => $setting['language']['admin_art_content_top_2'], "4" => $setting['language']['admin_art_content_top_3']);
$tpl_info['idx'] = "art_content_" . ($method == "list" ? "list" : "input");
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
if ($cat_info = getParaInfo("news_cat", "cat_id", $cat_id)) {
$web_id = $cat_info['web_id'];
}
$check_i = "";
$check_b = "";
$check_c = "";
if (empty($group['power_cat'])) {
$group['power_cat'] = 0;
}
if ($method == "list") {
$page = $req->getGet("page");
$keyword = $req->getGet("keyword");
$order = $req->getGet("order");
$tpl_tmp->Set_Variable('order', $order);
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$condition = array();
if (!empty($web_id)) {
$condition[] = array("web_id", "n=", $web_id, "and");
}
if (!empty($cat_id)) {
$condition[] = array("cat_id", "n=", $cat_id, "and");
}
if (!empty($keyword)) {
$condition[] = array(array(array("subject", "like", $keyword), array("tag", "like", $keyword)), "and");
}
if ($group['power_cat'] != "all") {
$condition[] = array("cat_id", "nin", $group['power_cat'], "and");
}
//navigation
$counter = $db->result($setting['db']['pre_sub'] . "news_show", "count(*)", $condition);
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&cat_id={$cat_id}&web_id={$web_id}&order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
//main list
$the_order = array();
if (!empty($cat_id) && $order != "setop") {
$the_order[] = "order desc";
}
if ($order == "setop") {
$order_type = "desc";
}
if (!empty($order)) {
$the_order[] = "{$order} {$order_type}";
}
$the_order[] = "news_id {$order_type}";
$sql = $db->buildSel_join(array(array("name" => $setting['db']['pre_sub'] . "news_show", "idx" => "a", "col" => "*", "condition" => $condition, "order" => $the_order), array("name" => $setting['db']['pre'] . "news_cat", "idx" => "b", "col" => "cat_idx, cat_name", "join" => "cat_id")), "", array("limit" => "{$page_start}, {$page_size}"));
$db->Query($sql);
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
if (empty($record['link'])) {
$record['link'] = getUrl("read", array($record['news_id'], $record['cat_id']), 1, $record['web_id']);
}
$tpl_tmp->Set_Loop('record', $record);
}
$title = empty($cat_id) ? $setting['language']['admin_art_content_list_all'] : $db->result($setting['db']['pre'] . "news_cat", "cat_name", array("cat_id", "n=", $cat_id));
$tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_list_article'] . " - " . $setting_sub['web']['title'] . " - " . $title);
$tpl_tmp->Set_Variable('keyword', $keyword);
$tpl_tmp->Set_Variable('cat_id', $cat_id);
$tpl_tmp->Set_Variable('order_type_org', $order_type);
$order_type = $order_type == "asc" ? "desc" : "asc";
$tpl_tmp->Set_Variable('order_type', $order_type);
$tpl_tmp->Set_Variable('keyword', $keyword);
} elseif ($method == "edit") {
$record = $db->record($setting['db']['pre_sub'] . "news_show", "*", array("news_id", "n=", $news_id));
if (!$record) {
$tpl->Set_Variable('main', showInfo($setting['language']['admin_art_content_error'], 0));
$mystep->show($tpl);
$mystep->pageEnd(false);
}
HtmlTrans(&$record);
$tpl_tmp->Set_Variables($record, "record");
$cat_id = $record['cat_id'];
$setop = (int) $record['setop'];
foreach ($top_list as $key => $value) {
$key = (int) $key;
$tpl_tmp->Set_Loop('setop', array("key" => $key, "value" => $value, "checked" => ($setop & $key) == $key ? "checked" : ""));
if (($setop & $key) == $key) {
$setop -= $key;
}
}
$setop /= 1024;
foreach ($top_mode_list as $key => $value) {
$key = (int) $key;
$tpl_tmp->Set_Loop('setop_mode', array("key" => $key, "value" => $value, "checked" => $setop == $key ? "checked" : ""));
}
$theStyle = explode(",", $record['style']);
$max_count = count($theStyle);
for ($i = 0; $i < $max_count; $i++) {
if ($theStyle[$i] == "i") {
$check_i = "checked";
} elseif ($theStyle[$i] == "b") {
//.........这里部分代码省略.........
示例9: GetLatestChangePageList
function GetLatestChangePageList()
{
$astrList = GetPageList();
arsort($astrList);
return $astrList;
}
示例10: build_page
function build_page($method)
{
global $mystep, $req, $db, $setting, $id, $sql_list;
$tpl_info = array("idx" => $method != "list" && $method != "view" ? "input" : $method, "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "view") {
$the_sql = $sql_list[$id];
$fields = explode(",", $the_sql['fields']);
$max_count = count($fields);
for ($i = 0; $i < $max_count; $i++) {
$tpl->Set_Loop('fields', array("name" => $fields[$i]));
}
$page = $req->getGet("page");
if (empty($page)) {
$page = 1;
}
$counter = $db->GetSingleResult("select count(*) from (" . $the_sql['sql'] . ") a");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=view&id=" . $id, $page);
$tpl->Set_Variables($page_arr);
$the_sql['sql'] .= " limit {$page_start}, {$page_size}";
$db->Query($the_sql['sql']);
$max_count = count($fields);
$n = 1 + ($page - 1) * $page_size;
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
$record = array_values($record);
$record['no'] = $n++;
$record['data'] = "";
for ($i = 0; $i < $max_count; $i++) {
$record['data'] .= "<td class=\"row\">" . $record[$i] . "</td>\n";
}
$tpl->Set_Loop('record', $record);
}
$setting['web']['title'] = $the_sql['name'] . " - " . $setting['language']['plugin_custom_sql_title'];
$tpl->Set_Variable('title', $setting['language']['plugin_custom_sql_title']);
$tpl->Set_Variable('title_2', $the_sql['name']);
$tpl->Set_Variable('id', $id);
} elseif ($method == "list") {
$max_count = count($sql_list);
for ($i = 0; $i < $max_count; $i++) {
$sql_list[$i]['id'] = $i;
$sql_list[$i]['idx'] = $i + 1;
$tpl->Set_Loop('record', $sql_list[$i]);
}
$tpl->Set_Variable('title', $setting['language']['plugin_custom_sql_title']);
} else {
if ($method == "edit") {
$record = $sql_list[$id];
$record['id'] = $id;
HtmlTrans(&$record);
} else {
$record = array();
$record['id'] = 0;
$record['name'] = "";
$record['sql'] = "";
}
$tpl->Set_Variables($record);
$tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_custom_sql_add'] : $setting['language']['plugin_custom_sql_edit']);
$tpl->Set_Variable('method', $method);
$tpl->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
}
$tpl->Set_Variable('path_admin', $setting['path']['admin']);
$db->Free();
$mystep->show($tpl);
return;
}
示例11: build_page
function build_page($method)
{
global $mystep, $req, $db, $setting, $id, $idx, $ticket_list;
$tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "add" || $method == "edit") {
$tpl_info['idx'] = "input";
} else {
$tpl_info['idx'] = $method;
}
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "list") {
$order = $req->getGet("order");
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$condition = array();
if (!empty($idx)) {
$condition[] = array("idx", "=", $idx);
}
$counter = $db->result($setting['db']['pre'] . "ticket", "count(*)", $condition);
$page = $req->getGet("page");
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=list&order=" . $order . "&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if (empty($order)) {
$order = "id";
}
$db->select($setting['db']['pre'] . "ticket", "*", $condition, array("order" => "{$order} {$order_type}", "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
$record['add_date'] = date("Y-m-d H:i:s", $record['add_date']);
$tpl_tmp->Set_Loop('record', $record);
}
$db->Free();
$tpl_tmp->Set_Variable('order_type_org', $order_type);
if ($order_type == "desc") {
$order_type = "asc";
} else {
$order_type = "desc";
}
for ($i = 0, $m = count($ticket_list); $i < $m; $i++) {
if ($idx == $ticket_list[$i]['idx']) {
$ticket_list[$i]['selected'] = "selected";
}
$tpl_tmp->Set_Loop('topic', $ticket_list[$i]);
}
$tpl_tmp->Set_Variable('order', $order);
$tpl_tmp->Set_Variable('order_type', $order_type);
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_ticket_title']);
} elseif ($method == "topic") {
for ($i = 0, $m = count($ticket_list); $i < $m; $i++) {
if ($ticket_list[$i]['lastpost'] == 0) {
$ticket_list[$i]['lastpost'] = "";
} else {
$ticket_list[$i]['lastpost'] = date("Y-m-d", $ticket_list[$i]['lastpost']);
}
$tpl_tmp->Set_Loop('record', $ticket_list[$i]);
}
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_ticket_title']);
} elseif ($method == "check") {
$record = $db->record($setting['db']['pre'] . "ticket", "*", array("id", "n=", $id));
if ($record === false) {
$tpl->Set_Variable('main', showInfo($setting['language']['admin_art_content_error'], 0));
$mystep->show($tpl);
$mystep->pageEnd(false);
}
HtmlTrans(&$record);
for ($i = 0, $m = count($ticket_list); $i < $m; $i++) {
if ($ticket_list[$i]['idx'] == $record['idx']) {
$record['topic'] = $ticket_list[$i]['topic'];
break;
}
}
$tpl_tmp->Set_Variables($record);
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_ticket_title']);
} else {
$record = array();
if ($method == "edit") {
for ($i = 0, $m = count($ticket_list); $i < $m; $i++) {
if ($ticket_list[$i]['idx'] == $idx) {
$record = $ticket_list[$i];
$record['type'] = implode("\n", $record['type']);
$record['disabled'] = "readonly";
break;
}
}
}
$tpl_tmp->Set_Variables($record);
$tpl_tmp->Set_Variable('method', $method);
$tpl_tmp->Set_Variable('title', $setting['language']['plugin_ticket_title']);
}
$tpl->Set_Variable('path_admin', $setting['path']['admin']);
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
unset($tpl_tmp);
$mystep->show($tpl);
return;
}
示例12: build_page
function build_page($method)
{
global $mystep, $req, $db, $setting, $id, $rules, $info_snatch, $info_import;
$tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
$tpl = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "rule_add" || $method == "rule_edit") {
$tpl_info['idx'] = "rule_input";
} else {
$tpl_info['idx'] = $method;
}
$tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
if ($method == "rule") {
$i = 1;
foreach ($rules as $key => $value) {
$value['no'] = $i++;
$value['id'] = $key;
$value['counter'] = $db->result($setting['db']['pre'] . "news_snatch", "count(*)", array("idx", "=", $value['idx']));
$tpl_tmp->Set_Loop('record', $value);
}
} elseif ($method == "rule_add") {
//no script
} elseif ($method == "rule_edit") {
$rule = array();
$rule['id'] = $id;
$rule['name'] = $rules[$id]['name'];
$rule['url'] = $rules[$id]['url'];
$rule['notes'] = $rules[$id]['notes'];
if (empty($rules[$id]['para'])) {
$rule['para'] = "";
} else {
$rule['para'] = var_export($rules[$id]['para'], true);
}
$rule['rule_snatch'] = htmlspecialchars(GetFile("rule/" . $rules[$id]['idx'] . "_snatch.php"));
$rule['rule_import'] = htmlspecialchars(GetFile("rule/" . $rules[$id]['idx'] . "_import.php"));
$tpl_tmp->Set_Variables($rule);
} elseif ($method == "news") {
$page = $req->getGet("page");
$keyword = $req->getGet("keyword");
$order = $req->getGet("order");
$tpl_tmp->Set_Variable('order', $order);
$order_type = $req->getGet("order_type");
if (empty($order_type)) {
$order_type = "desc";
}
$condition = array();
if (!empty($keyword)) {
$condition[] = array("subject", "like", $keyword);
}
$counter = $db->result($setting['db']['pre'] . "news_snatch", "count(*)", $condition);
list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=news&keyword={$keyword}&order={$order}&order_type={$order_type}", $page);
$tpl_tmp->Set_Variables($page_arr);
if ($counter > 0) {
if (empty($order)) {
$order = "id";
}
$the_order = array();
$the_order[] = "{$order} {$order_type}";
if ($order != "id") {
$the_order[] = "id desc";
}
$db->select($setting['db']['pre'] . "news_snatch", "id, idx, url, original, subject", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
while ($record = $db->GetRS()) {
HtmlTrans(&$record);
$tpl_tmp->Set_Loop('record', $record);
}
}
$tpl_tmp->Set_Variable('keyword', $keyword);
$tpl_tmp->Set_Variable('order_type_org', $order_type);
$order_type = $order_type == "asc" ? "desc" : "asc";
$tpl_tmp->Set_Variable('order_type', $order_type);
$tpl_tmp->Set_Variable('keyword', $keyword);
} elseif ($method == "news_edit") {
$record = $db->record($setting['db']['pre'] . "news_snatch", "*", array("id", "n=", $id));
if ($record === false) {
$tpl->Set_Variable('main', showInfo($setting['language']['admin_art_content_error'], 0));
echo $tpl->Read_Cache();
return;
}
HtmlTrans(&$record);
$tpl_tmp->Set_Variables($record, "record");
} elseif ($method == "snatch") {
$refresh = 600;
if (isset($rules[$id]['para']['refresh'])) {
$refresh = $rules[$id]['para']['refresh'];
}
if (false && file_exists($info_snatch) && time() - filemtime($info_snatch) < $refresh && $req->getReq("f") == "") {
$show = $setting['language']['plugin_news_snatch_interrupt'];
} else {
$show = "";
if (file_exists($info_snatch)) {
unlink($info_snatch);
}
}
$tpl_tmp->Set_Variable('id', $id);
$tpl_tmp->Set_Variable('refresh', $refresh);
$tpl_tmp->Set_Variable('info_file', $info_snatch);
$tpl_tmp->Set_Variable('show', addslashes($show));
} elseif ($method == "import") {
$idx = $req->getReq("idx");
$para = array();
//.........这里部分代码省略.........
示例13: GetList
function GetList($aid, $page = 1, $re = false)
{
global $gDB, $pagesize, $n, $x, $G;
$pagesize = 10;
$totalcount = $gDB->getCount(' select count(*) as count from cmt where aid = ' . $aid . ' and status = 1 ');
$lou = empty($row['dd']) ? 0 : $totalcount;
$startNum = $pagesize * ($page - 1);
if ($startNum > $totalcount) {
//echo "参数错误!";
//return $totalcount;
if ($page == 1) {
return '';
}
return;
}
$aList = $gDB->select(' select * from cmt where aid = ' . $aid . ' and status = 1 order by ctime desc limit ' . $startNum . ', ' . $pagesize);
$sStr = '';
foreach ($aList as $n => $a) {
$a['cont'] = preg_replace('/\\[em(\\d{2})\\]/i', '<img src="/i/e/e1$1.gif" />', $a['cont']);
$a['cont'] = preg_replace('/\\[em(\\d+)\\]/i', '<img src="/i/e/e$1.gif" />', $a['cont']);
$n = $lou--;
$curpage = empty($page) ? 1 : intval($page);
$x = $n - ($curpage - 1) * $pagesize;
$sStr .= '<p class="ps"><i' . ($a['good'] > 0 ? ' class="g"' : '') . '>' . date('m-d H:i', $a['ctime']) . '</i>' . (abs($x) + 1) . ' 楼 <em>' . (preg_match('/360/', $a['name']) || empty($a['name']) ? '游客' : $a['name']) . '</em><s>' . $a['cont'] . '</s></p>';
}
$sStr .= GetPageList($page, $pagesize, $totalcount);
return $sStr;
if (!file_exists(DROOT . $G['xyx_cmt'])) {
mkdir(DROOT . $G['xyx_cmt'], '0777');
}
file_put_contents(DROOT . $G['xyx_cmt'] . $aid . '_' . $page . '.htm', $sStr);
if (!file_exists(DROOT . $G['xyx_cmt'] . $aid . '_' . $page . '.htm')) {
echo DROOT . $G['xyx_cmt'] . $aid . '_' . $page . '.htm' . ' - nofile<br />';
}
if ($page == 1 && $re) {
return $sStr;
}
$allpage = ceil($totalcount / $pagesize);
if ($page < $allpage) {
$page++;
GetList($aid, $page);
}
}
示例14: count
."where tid='{$v['tid']}' order by a.aid desc limit {$eachArc}";
$dsql->SetQuery($query);
$dsql->Execute();
while($row = $dsql->getArray()) $v['arc'][] = $row;
}
// 获取标签总数
$query = "select count(distinct a.tid) as `count` from `#@__taglist` a "
."left join `#@__tagindex` b on b.id = a.tid "
."left join `#@__tagindex_ex` c on c.id = a.tid "
."where c.arctype_id='{$arctype_id}'";
$tags_count = $dsql->GetOne($query);
$tags_count = isset($tags_count['count']) ? (int)$tags_count['count'] : 0;
$page_html = GetPageList('list_'.$arctype_id.'_{page}.html', $page, $tags_count, $each, 5);
// 创建栏目目录
$true_typedir = str_replace("{cmspath}",$cfg_cmspath,$arctype['typedir']);
$true_typedir = ereg_replace("/{1,}","/",$true_typedir);
if(!CreateDir($true_typedir))
{
ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1");
exit();
}
// 生成静态页面文件
$output = $cfg_basedir.str_replace('{cmspath}', $cfg_cmspath, $arctype['typedir']).'/list_'.$arctype_id.'_'.$page.'.html'; // 写死了
$tpl_file = $cfg_basedir.$cfg_templets_dir.'/tmcms/tag.htm';
$pv = new PartView();
$pv->SetTemplet($tpl_file);
示例15: index
public function index()
{
$NumPerPage = 10;
$page = ForceIntFrom('p', 1);
$search = ForceStringFrom('s');
$groupid = ForceStringFrom('g');
if (IsGet('s')) {
$search = urldecode($search);
}
$start = $NumPerPage * ($page - 1);
SubMenu('留言列表', array(array('留言列表', 'comments', 1)));
TableHeader('搜索及快速删除');
TableRow('<center><form method="post" action="' . BURL('comments') . '" name="searchcomments" style="display:inline-block;*display:inline;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>状态:</label> <select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>未读</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>已读</option></select> <input type="submit" value="搜索留言" class="cancel"></form>
<form method="post" action="' . BURL('comments/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除留言:</label> <select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的已读留言</option><option value="180"> 6 个月前的已读留言</option><option value="90"> 3 个月前的已读留言</option><option value="30"> 1 个月前的已读留言</option></select> <input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>');
TableFooter();
if ($search) {
if (preg_match("/^[1-9][0-9]*\$/", $search)) {
$s = ForceInt($search);
$searchsql = " WHERE cid = '{$s}' OR gid = '{$s}' OR phone LIKE '%{$s}%' ";
//按ID搜索
$title = "搜索数字为: <span class=note>{$s}</span> 的留言";
} else {
$searchsql = " WHERE (fullname LIKE '%{$search}%' OR email LIKE '%{$search}%' OR content LIKE '%{$search}%') ";
$title = "搜索: <span class=note>{$search}</span> 的留言列表";
}
if ($groupid) {
if ($groupid == 1 or $groupid == 2) {
$searchsql .= " AND readed = " . Iif($groupid == 1, 0, 1) . " ";
$title = "在 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 中, " . $title;
}
}
} else {
if ($groupid) {
if ($groupid == 1 or $groupid == 2) {
$searchsql .= " WHERE readed = " . Iif($groupid == 1, 0, 1) . " ";
$title = "全部 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 列表";
}
} else {
$searchsql = '';
$title = '全部留言列表';
}
}
$getcomments = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "comment " . $searchsql . " ORDER BY readed ASC, cid DESC LIMIT {$start},{$NumPerPage}");
$maxrows = APP::$DB->getOne("SELECT COUNT(cid) AS value FROM " . TABLE_PREFIX . "comment " . $searchsql);
echo '<form method="post" action="' . BURL('comments/updatecomments') . '" name="commentsform">
<input type="hidden" name="p" value="' . $page . '">';
TableHeader($title . '(' . $maxrows['value'] . '个)');
TableRow(array('ID', '状态', '姓名', 'Email', '电话', '留言内容', '<input type="checkbox" id="checkAll2" for="updatecids[]"> <label for="checkAll2">标记已读</label>', 'IP', '留言时间', '<input type="checkbox" id="checkAll" for="deletecids[]"> <label for="checkAll">删除</label>'), 'tr0');
if ($maxrows['value'] < 1) {
TableRow('<center><BR><font class=redb>未搜索到任何留言!</font><BR><BR></center>');
} else {
while ($comm = APP::$DB->fetch($getcomments)) {
TableRow(array($comm['cid'], Iif($comm['readed'], '<font class=grey>已读</font>', '<font class=red>未读</font>'), Iif($comm['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $comm['gid']) . '">' . "{$comm['fullname']}</a>", $comm['fullname']), Iif($comm['email'], '<a href="mailto:' . $comm['email'] . '">' . $comm['email'] . '</a>'), $comm['phone'], nl2br($comm['content']), Iif(!$comm['readed'], '<input type="checkbox" name="updatecids[]" value="' . $comm['cid'] . '">'), $comm['ip'], DisplayDate($comm['time'], '', 1), '<input type="checkbox" name="deletecids[]" value="' . $comm['cid'] . '">'));
}
$totalpages = ceil($maxrows['value'] / $NumPerPage);
if ($totalpages > 1) {
TableRow(GetPageList(BURL('comments'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
}
}
TableFooter();
echo '<div class="submit"><input type="submit" name="updatecomms" value="标记已读" class="cancel" style="margin-right:28px"><input type="submit" name="deletecomms" value="删除留言" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></div></form>';
}