コード例 #1
0
ファイル: search.php プロジェクト: laiello/mystep-cms
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
0
ファイル: func_attach.php プロジェクト: laiello/mystep-cms
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
0
ファイル: mymessages.php プロジェクト: noikiy/meilala
 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>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>分类:</label>&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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
0
ファイル: art_tag.php プロジェクト: laiello/mystep-cms
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
0
ファイル: feedback_ajax.php プロジェクト: klr2003/sourceread
    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
0
ファイル: ad_show.php プロジェクト: laiello/mystep-cms
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
0
ファイル: visit_analysis.php プロジェクト: laiello/mystep-cms
    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
0
ファイル: art_content.php プロジェクト: laiello/mystep-cms
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") {
                $check_b = "checked";
            } else {
                $check_c = $theStyle[$i];
            }
        }
        $content = array();
        $db->select($setting['db']['pre_sub'] . "news_detail", "*", array("news_id", "n=", $news_id), array("order" => "page"));
        while ($record = $db->GetRS()) {
            $record['content'] = str_replace("&", "&#38;", $record['content']);
            HtmlTrans(&$record);
            $record['content'] = "<span class=\"mceSubtitle\">" . $record['sub_title'] . "</span>\n" . $record['content'];
            $content[] = $record['content'];
        }
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $tpl_tmp->Set_Variable('record_content', implode("\n<p><img src=\"../script/tinymce/plugins/pagebreak/img/trans.gif\" class=\"mcePageBreak mceItemNoResize\" /></p>\n", $content));
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_edit']);
    } else {
        $checked = "checked";
        foreach ($top_mode_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop_mode', array("key" => $key, "value" => $value, "checked" => $checked));
            $checked = "";
        }
        foreach ($top_list as $key => $value) {
            $key = (int) $key;
            $tpl_tmp->Set_Loop('setop', array("key" => $key, "value" => $value, "checked" => ""));
        }
        $record = array();
        $record['news_id'] = 0;
        $record['cat_id'] = $cat_id;
        $record['web_id'] = $web_id;
        $record['subject'] = "";
        $record['style'] = "";
        $record['describe'] = "";
        $record['original'] = "";
        $record['link'] = "";
        $record['tag'] = "";
        $record['image'] = "";
        $record['content'] = "";
        $record['pages'] = 1;
        $record['order'] = 0;
        if (!empty($cat_id) && ($cat_info = getParaInfo("news_cat", "cat_id", $cat_id))) {
            $record['view_lvl'] = $cat_info['view_lvl'];
            $record['notice'] = $cat_info['notice'];
        } else {
            $record['view_lvl'] = 0;
            $record['notice'] = "";
        }
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $tpl_tmp->Set_Variables($record, "record");
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_content_add']);
    }
    //news image
    $condition = array();
    if (!empty($web_id)) {
        $condition = array("web_id", "n=", $web_id);
    }
    $db->select($setting['db']['pre'] . "news_image", "*", $condition, array("order" => "id asc"));
    while ($record = $db->GetRS()) {
        HtmlTrans(&$record);
        $tpl_tmp->Set_Loop('news_image', $record);
    }
    //catalog select
    if (empty($web_id)) {
        $web_id = 1;
    }
    $max_count = count($news_cat);
    for ($i = 0; $i < $max_count; $i++) {
        if (($method != "add" || $setting['info']['web']['web_id'] != 1) && $news_cat[$i]['web_id'] != $web_id) {
            continue;
        }
        //if(!empty($news_cat[$i]['cat_link'])) continue;
        $news_cat[$i]['cat_name'] = (isset($news_cat[$i + 1]) && $news_cat[$i + 1]['cat_layer'] == $news_cat[$i]['cat_layer'] ? "©À " : "©¸ ") . $news_cat[$i]['cat_name'];
        for ($j = 1; $j < $news_cat[$i]['cat_layer']; $j++) {
            $news_cat[$i]['cat_name'] = "&nbsp;" . $news_cat[$i]['cat_name'];
        }
        $news_cat[$i] = preg_replace("/^©À /", "", preg_replace("/^©¸ /", "", $news_cat[$i]));
        $tpl_tmp->Set_Loop('catalog', array('cat_id' => $news_cat[$i]['cat_id'], 'web_id' => $news_cat[$i]['web_id'], 'cat_name' => $news_cat[$i]['cat_name'], 'view_lvl' => $news_cat[$i]['view_lvl'], 'selected' => $cat_id == $news_cat[$i]['cat_id'] ? "selected" : ""));
        $tpl_tmp->Set_Loop('cat_sub', array('cat_id' => $news_cat[$i]['cat_id'], 'cat_sub' => $news_cat[$i]['cat_sub']));
    }
    $tpl_tmp->Set_Variable('check_b', $check_b);
    $tpl_tmp->Set_Variable('check_i', $check_i);
    $tpl_tmp->Set_Variable('check_c', $check_c);
    $tpl_tmp->Set_Variable('get_remote_file', $setting['content']['get_remote_img'] ? "checked" : "");
    $tpl_tmp->Set_Variable('method', $method);
    $tpl_tmp->Set_Variable('web_id', $web_id);
    $tpl_tmp->Set_Variable('cat_id', $cat_id);
    $tpl_tmp->Set_Variable('news_id', $news_id);
    $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    $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;
}
コード例 #9
0
ファイル: sdk.php プロジェクト: BackupTheBerlios/chuwiki-svn
function GetLatestChangePageList()
{
    $astrList = GetPageList();
    arsort($astrList);
    return $astrList;
}
コード例 #10
0
ファイル: custom_sql.php プロジェクト: laiello/mystep-cms
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
0
ファイル: ticket.php プロジェクト: laiello/mystep-cms
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
0
ファイル: news_snatch.php プロジェクト: laiello/mystep-cms
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();
        for ($i = 0, $m = count($rules); $i < $m; $i++) {
            if ($rules[$i]['idx'] == $idx) {
                $para = $rules[$i]['para'];
                break;
            }
        }
        $refresh = 600;
        if (isset($para['refresh'])) {
            $refresh = $para['refresh'];
        }
        if (false && file_exists($info_import) && time() - filemtime($info_import) < $refresh && $req->getReq("f") == "") {
            $show = $setting['language']['plugin_news_import_interrupt'];
        } else {
            $show = "";
            if (file_exists($info_import)) {
                unlink($info_import);
            }
        }
        $tpl_tmp->Set_Variable('id', $id);
        $tpl_tmp->Set_Variable('idx', $idx);
        $tpl_tmp->Set_Variable('refresh', $refresh);
        $tpl_tmp->Set_Variable('info_file', $info_import);
        $tpl_tmp->Set_Variable('show', addslashes($show));
    } elseif ($method == "upload") {
        global $script;
        $tpl_tmp->Set_Variable('script', $script);
        $tpl_tmp->Set_Variable('self', $setting['info']['self']);
        $Max_size = ini_get('upload_max_filesize');
        $tpl_tmp->Set_Variable('Max_size', $Max_size);
        $tpl_tmp->Set_Variable('MaxSize', GetFileSize($Max_size));
    }
    $tpl_tmp->Set_Variable('title', $setting['language']['plugin_news_snatch_title_' . $method]);
    $tpl_tmp->Set_Variable('id', $id);
    $tpl_tmp->Set_Variable('method', $method);
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
コード例 #13
0
ファイル: func.php プロジェクト: beyondye/ENPHP
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
0
ファイル: ex_tags_main.php プロジェクト: pf5512/phpstudy
		."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
0
ファイル: comments.php プロジェクト: noikiy/meilala
    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>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>状态:</label>&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的已读留言</option><option value="180">&nbsp;6 个月前的已读留言</option><option value="90">&nbsp;3 个月前的已读留言</option><option value="30">&nbsp;1 个月前的已读留言</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<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>';
    }
コード例 #16
0
function ConvertData()
{
    global $C, $DB, $from_shell;
    $errors = array();
    if (!is_dir($_REQUEST['directory'])) {
        $errors[] = "The directory " . htmlspecialchars($_REQUEST['directory']) . " does not exist on your server";
        return DisplayMain($errors);
    }
    if (!is_file("{$_REQUEST['directory']}/agp.pl")) {
        $errors[] = "The agp.pl file could not be found in the " . htmlspecialchars($_REQUEST['directory']) . " directory; make sure you have version 3.0.0 or newer installed";
        return DisplayMain($errors);
    }
    if (!is_readable("{$_REQUEST['directory']}/agp.pl")) {
        $errors[] = "The agp.pl file in the " . htmlspecialchars($_REQUEST['directory']) . " directory could not be opened for reading";
        return DisplayMain($errors);
    }
    // Check version
    $version_file_contents = file_get_contents("{$_REQUEST['directory']}/agp.pl");
    if (preg_match('~\\$VERSION\\s+=\\s+\'(.*?)\'~', $version_file_contents, $matches)) {
        list($a, $b, $c) = explode('.', $matches[1]);
        $c = str_replace('-SS', '', $c);
        if ($a < 3) {
            $errors[] = "Your AutoGallery Pro installation is outdated ({$matches[1]}); please upgrade to version 3.0.0+";
            return DisplayMain($errors);
        }
    } else {
        $errors[] = "Unable to extract version information from agp.pl; your version of AutoGallery Pro is likely too old";
        return DisplayMain($errors);
    }
    // Extract variables
    $var_file_contents = file_get_contents("{$_REQUEST['directory']}/data/variables");
    if ($var_file_contents === FALSE) {
        $errors[] = "Unable to read contents of the variables file";
        return DisplayMain($errors);
    }
    $vars = array();
    if (preg_match_all('~^\\$([a-z0-9_]+)\\s+=\\s+\'(.*?)\';$~msi', $var_file_contents, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            $vars[$match[1]] = $match[2];
        }
    }
    if (!isset($vars['ADMIN_EMAIL'])) {
        $errors[] = "Unable to extract variable data from the AutoGallery Pro variables file";
        return DisplayMain($errors);
    }
    if (!is_writable($C['font_dir'])) {
        $errors[] = "Change the permissions on the TGPX fonts directory to 777";
        return DisplayMain($errors);
    }
    if ($C['preview_dir'] == $vars['THUMB_DIR']) {
        $errors[] = "The TGPX Thumbnail URL cannot be the same as the AutoGallery Pro Thumbnail URL";
        return DisplayMain($errors);
    }
    if (!$from_shell) {
        echo "<pre>";
    }
    // Copy fonts for validation codes
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Copying font files for verification codes...\n");
    echo "Copying font files for verification codes...\n";
    flush();
    $fonts =& DirRead($vars['FONT_DIR'], '^[^.]');
    foreach ($fonts as $font) {
        @copy("{$vars['FONT_DIR']}/{$font}", "{$C['font_dir']}/{$font}");
    }
    // Copy thumbnail previews
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Copying thumbnail preview images...\n");
    echo "Copying thumbnail preview images...\n";
    flush();
    $thumbs =& DirRead($vars['THUMB_DIR'], '\\.jpg$');
    foreach ($thumbs as $thumb) {
        @copy("{$vars['THUMB_DIR']}/{$thumb}", "{$C['preview_dir']}/t_{$thumb}");
        @chmod("{$C['preview_dir']}/t_{$thumb}", 0666);
    }
    //
    // Dump e-mail log
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting e-mail log...\n");
    echo "Converting e-mail log...\n";
    flush();
    $emails = file("{$_REQUEST['directory']}/data/emails");
    $DB->Update('DELETE FROM `tx_email_log`');
    foreach ($emails as $email) {
        $email = trim($email);
        if (empty($email)) {
            continue;
        }
        $DB->Update('REPLACE INTO `tx_email_log` VALUES (?)', array($email));
    }
    //
    // Dump blacklist
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting blacklist...\n");
    echo "Converting blacklist...\n";
    flush();
    $DB->Update('DELETE FROM `tx_blacklist`');
    $types = array('submit_ip' => 'submitip', 'email' => 'email', 'url' => 'domain', 'domain_ip' => 'domainip', 'word' => 'word', 'html' => 'html', 'dns' => 'dns');
    foreach ($types as $new_type => $old_type) {
        $blist_items = file("{$_REQUEST['directory']}/data/blacklist/{$old_type}");
        foreach ($blist_items as $html) {
            $html = trim($html);
            if (empty($html)) {
                continue;
            }
            $regex = 0;
            if (strpos($html, '*') !== FALSE) {
                $regex = 1;
                $html = preg_quote($html);
                $html = str_replace('\\*', '.*?', $html);
            }
            $DB->Update('INSERT INTO `tx_blacklist` VALUES (?,?,?,?,?)', array(null, $new_type, $regex, $html, ''));
        }
    }
    //
    // Dump whitelist
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting whitelist...\n");
    echo "Converting whitelist...\n";
    flush();
    $DB->Update('DELETE FROM `tx_whitelist`');
    $wlist_items = file("{$_REQUEST['directory']}/data/blacklist/whitelist");
    foreach ($wlist_items as $html) {
        $html = trim($html);
        if (empty($html)) {
            continue;
        }
        $regex = 0;
        if (strpos($html, '*') !== FALSE) {
            $regex = 1;
            $html = preg_quote($html);
            $html = str_replace('\\*', '.*?', $html);
        }
        $DB->Update('INSERT INTO `tx_whitelist` VALUES (?,?,?,?,?,?,?,?,?,?)', array(null, 'url', $regex, $html, '', 1, 0, 0, 0, 0));
    }
    //
    // Dump reciprocal links
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting reciprocal link settings...\n");
    echo "Converting reciprocal link settings...\n";
    flush();
    $DB->Update('DELETE FROM `tx_reciprocals`');
    IniParse("{$_REQUEST['directory']}/data/generalrecips", TRUE, $recips);
    IniParse("{$_REQUEST['directory']}/data/trustedrecips", TRUE, $recips);
    foreach ($recips as $identifier => $html) {
        $regex = 0;
        if (strpos($html, '*') !== FALSE) {
            $regex = 1;
            $html = preg_quote($html);
            $html = str_replace('\\*', '.*?', $html);
        }
        $DB->Update('INSERT INTO `tx_reciprocals` VALUES (?,?,?,?)', array(null, $identifier, trim($html), $regex));
    }
    //
    // Dump icons
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting icons...\n");
    echo "Converting icons...\n";
    flush();
    $icons = array();
    $DB->Update('DELETE FROM `tx_icons`');
    IniParse("{$_REQUEST['directory']}/data/icons", TRUE, $icons_ini);
    foreach ($icons_ini as $identifier => $html) {
        $identifier = trim($identifier);
        $html = trim($html);
        if (empty($identifier) || empty($html)) {
            continue;
        }
        $DB->Update('INSERT INTO `tx_icons` VALUES (?,?,?)', array(null, $identifier, trim($html)));
        $icons[$identifier] = $DB->InsertID();
    }
    //
    // Dump categories
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting categories...\n");
    echo "Converting categories...\n";
    flush();
    $cat_format = array('Name', 'Type', 'Ext_Pictures', 'Ext_Movies', 'Min_Pictures', 'Min_Movies', 'Max_Pictures', 'Max_Movies', 'Size_Pictures', 'Size_Movies');
    $categories = array();
    $category_ids = array();
    $DB->Update('DELETE FROM `tx_categories`');
    $lines = file("{$_REQUEST['directory']}/data/dbs/categories");
    foreach ($lines as $line) {
        $line = trim($line);
        if (empty($line)) {
            continue;
        }
        $category = explode('|', $line);
        foreach ($cat_format as $index => $key) {
            $category[$key] = $category[$index];
        }
        $tag = CreateCategoryTag($category['Name']);
        $categories[$category['Name']] = $tag;
        $DB->Update('INSERT INTO `tx_categories` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', array(null, $category['Name'], $tag, $category['Type'] != 'Movies' ? 1 : 0, $category['Ext_Pictures'], $category['Min_Pictures'], $category['Max_Pictures'], $category['Size_Pictures'], "{$vars['THUMB_WIDTH']}x{$vars['THUMB_HEIGHT']}", 1, null, $category['Type'] != 'Pictures' ? 1 : 0, $category['Ext_Movies'], $category['Min_Movies'], $category['Max_Movies'], $category['Size_Movies'], "{$vars['THUMB_WIDTH']}x{$vars['THUMB_HEIGHT']}", 1, null, -1, 0, null, null, null));
        $category_ids[$category['Name']] = $DB->InsertID();
    }
    //
    // Dump gallery data
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting gallery data...\n");
    echo "Converting gallery data...\n";
    flush();
    $DB->Update('DELETE FROM `tx_galleries`');
    $DB->Update('DELETE FROM `tx_gallery_fields`');
    $DB->Update('DELETE FROM `tx_gallery_icons`');
    $DB->Update('DELETE FROM `tx_gallery_previews`');
    $DB->Update('ALTER TABLE `tx_galleries` AUTO_INCREMENT=0');
    $DB->Update('ALTER TABLE `tx_gallery_previews` AUTO_INCREMENT=0');
    $gal_format = array('Gallery_ID', 'Email', 'Gallery_URL', 'Description', 'Thumbnails', 'Category', 'Nickname', 'Submit_Date', 'Approve_Date', 'Display_Date', 'Display_Stamp', 'Confirm_ID', 'Account_ID', 'CPanel_ID', 'Submit_IP', 'Gallery_IP', 'Scanned', 'Links', 'Has_Recip', 'Page_Bytes', 'Icons');
    $gal_dbs = array('unconfirmed' => 'unconfirmed', 'pending' => 'pending', 'approved' => 'used', 'archived' => 'used');
    foreach (array_keys($categories) as $cat_name) {
        $gal_dbs[preg_replace('~[^a-z0-9]~i', '', strtolower($cat_name))] = 'used';
    }
    foreach ($gal_dbs as $db => $status) {
        $db_file = "{$_REQUEST['directory']}/data/dbs/{$db}";
        if (is_file($db_file)) {
            $lines = file($db_file);
            foreach ($lines as $line) {
                $line = trim($line);
                if (empty($line)) {
                    continue;
                }
                $gallery = explode('|', $line);
                foreach ($gal_format as $index => $key) {
                    $gallery[$key] = $gallery[$index];
                }
                if (!preg_match('!^http(s)?://[\\w-]+\\.[\\w-]+(\\S+)?$!i', $gallery['Gallery_URL'])) {
                    continue;
                }
                $has_thumb = is_file("{$vars['THUMB_DIR']}/{$gallery['Gallery_ID']}.jpg");
                $DB->Update("INSERT INTO `tx_galleries` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array(null, $gallery['Gallery_URL'], $gallery['Description'], null, $gallery['Thumbnails'], $gallery['Email'], $gallery['Nickname'], $C['gallery_weight'], 0, $gallery['Submit_IP'], $gallery['Gallery_IP'], null, 'submitted', FMT_PICTURES, $status, null, "{$gallery['Submit_Date']} 12:00:00", "{$gallery['Submit_Date']} 12:00:00", empty($gallery['Approve_Date']) ? null : "{$gallery['Approve_Date']} 12:00:00", null, empty($gallery['Display_Date']) ? null : "{$gallery['Display_Date']} 12:00:00", null, $gallery['Account_ID'], $gallery['CPanel_ID'], null, null, $gallery['Has_Recip'], $has_thumb ? 1 : 0, 1, 1, 0, 0, 0, null, MIXED_CATEGORY . " " . $categories[$gallery['Category']]));
                $gallery_id = $DB->InsertID();
                $gallery_info = array('gallery_id' => $gallery_id);
                $insert = CreateUserInsert('tx_gallery_fields', $gallery_info);
                $DB->Update('INSERT INTO `tx_gallery_fields` VALUES (' . $insert['bind_list'] . ')', $insert['binds']);
                foreach (explode(',', $gallery['Icons']) as $icon_id) {
                    if (isset($icons[$icon_id])) {
                        $DB->Update('INSERT INTO `tx_gallery_icons` VALUES (?,?)', array($gallery_id, $icons[$icon_id]));
                    }
                }
                if (!empty($has_thumb)) {
                    $dimensions = $vars['THUMB_WIDTH'] . 'x' . $vars['THUMB_HEIGHT'];
                    $DB->Update('INSERT INTO `tx_gallery_previews` VALUES (?,?,?,?)', array(null, $gallery_id, '', $dimensions));
                    $preview_id = $DB->InsertID();
                    $gallery['Thumbnail_URL'] = "{$C['preview_url']}/{$preview_id}.jpg";
                    $DB->Update('UPDATE `tx_gallery_previews` SET `preview_url`=? WHERE `preview_id`=?', array($gallery['Thumbnail_URL'], $preview_id));
                    @rename("{$C['preview_dir']}/t_{$gallery['Gallery_ID']}.jpg", "{$C['preview_dir']}/{$preview_id}.jpg");
                }
            }
        }
    }
    //
    // Convert permanent gallery data
    $perm_format = array('Permanent_ID', 'Gallery_URL', 'Category', 'Thumbnails', 'Description', 'Nickname', 'Location', 'Thumbnail_URL', 'Start_Date', 'Expire_Date');
    $lines = file("{$_REQUEST['directory']}/data/dbs/permanent");
    foreach ($lines as $line) {
        $line = trim($line);
        if (empty($line)) {
            continue;
        }
        $gallery = explode('|', $line);
        foreach ($perm_format as $index => $key) {
            $gallery[$key] = $gallery[$index];
        }
        if (!preg_match('!^http(s)?://[\\w-]+\\.[\\w-]+(\\S+)?$!i', $gallery['Gallery_URL'])) {
            continue;
        }
        $has_thumb = is_file("{$vars['THUMB_DIR']}/p{$gallery['Permanent_ID']}.jpg");
        $DB->Update("INSERT INTO `tx_galleries` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array(null, $gallery['Gallery_URL'], $gallery['Description'], null, $gallery['Thumbnails'], $C['from_email'], $gallery['Nickname'], $C['gallery_weight'], 0, $_SERVER['REMOTE_ADDR'], null, null, 'permanent', FMT_PICTURES, 'approved', null, MYSQL_NOW, MYSQL_NOW, MYSQL_NOW, null, null, null, null, 'AGP Import', null, null, 0, $has_thumb ? 1 : 0, 1, 1, 0, 0, 0, null, MIXED_CATEGORY . " " . $categories[$gallery['Category']]));
        $gallery_id = $DB->InsertID();
        $gallery_info = array('gallery_id' => $gallery_id);
        $insert = CreateUserInsert('tx_gallery_fields', $gallery_info);
        $DB->Update('INSERT INTO `tx_gallery_fields` VALUES (' . $insert['bind_list'] . ')', $insert['binds']);
        foreach (explode(',', $gallery['Icons']) as $icon_id) {
            if (isset($icons[$icon_id])) {
                $DB->Update('INSERT INTO `tx_gallery_icons` VALUES (?,?)', array($gallery_id, $icons[$icon_id]));
            }
        }
        if (!empty($has_thumb)) {
            $DB->Update('INSERT INTO `tx_gallery_previews` VALUES (?,?,?,?)', array(null, $gallery_id, '', $vars['THUMB_WIDTH'] . 'x' . $vars['THUMB_HEIGHT']));
            $preview_id = $DB->InsertID();
            $gallery['Thumbnail_URL'] = "{$C['preview_url']}/{$preview_id}.jpg";
            $DB->Update('UPDATE `tx_gallery_previews` SET `preview_url`=? WHERE `preview_id`=?', array($gallery['Thumbnail_URL'], $preview_id));
            @rename("{$C['preview_dir']}/t_p{$gallery['Permanent_ID']}.jpg", "{$C['preview_dir']}/{$preview_id}.jpg");
        }
    }
    //
    // Dump partner data
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting partner accounts...\n");
    echo "Converting partner accounts...\n";
    flush();
    $DB->Update('DELETE FROM `tx_partners`');
    $DB->Update('DELETE FROM `tx_partner_fields`');
    $DB->Update('DELETE FROM `tx_partner_icons`');
    $DB->Update('DELETE FROM `tx_partner_confirms`');
    $acct_format = array('Account_ID', 'Password', 'Email', 'Allowed', 'Auto_Approve', 'Recip', 'Blacklist', 'HTML', 'Icons');
    $lines = file("{$_REQUEST['directory']}/data/dbs/accounts");
    foreach ($lines as $line) {
        $line = trim($line);
        if (empty($line)) {
            continue;
        }
        $partner = explode('|', $line);
        foreach ($acct_format as $index => $key) {
            $partner[$key] = $partner[$index];
        }
        $DB->Update('INSERT INTO `tx_partners` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', array($partner['Account_ID'], sha1($partner['Password']), '', $partner['Email'], null, MYSQL_NOW, null, null, null, $partner['Allowed'], $C['gallery_weight'], null, 0, null, 0, 0, 0, 'active', null, null, 0, $partner['Recip'] ? 0 : 1, $partner['Auto_Approve'], 1, $partner['Blacklist'] ? 0 : 1));
        $partner_info = array('username' => $partner['Account_ID']);
        $insert = CreateUserInsert('tx_partner_fields', $partner_info);
        $DB->Update('INSERT INTO `tx_partner_fields` VALUES (' . $insert['bind_list'] . ')', $insert['binds']);
        foreach (explode(',', $partner['Icons']) as $icon_id) {
            if (isset($icons[$icon_id])) {
                $DB->Update('INSERT INTO `tx_partner_icons` VALUES (?,?)', array($partner['Account_ID'], $icons[$icon_id]));
            }
        }
    }
    // Update the stored thumbnail preview sizes
    UpdateThumbSizes($vars['THUMB_WIDTH'] . 'x' . $vars['THUMB_HEIGHT']);
    //
    // Dump TGP page data
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "Converting TGP pages...\n");
    echo "Converting TGP pages...\n";
    flush();
    $build_order = 1;
    $DB->Update('DELETE FROM `tx_pages`');
    $DB->Update('ALTER TABLE `tx_pages` AUTO_INCREMENT=0');
    $pages = GetPageList($vars, $categories);
    foreach ($pages as $page) {
        $template = file_get_contents($page['template']);
        $template = trim(ConvertTemplate($template, $page['arch']));
        $compiled = '';
        $DB->Update('INSERT INTO `tx_pages` VALUES (?,?,?,?,?,?,?,?,?)', array(null, $page['file'], $page['url'], $page['category'] == 'Mixed' ? null : $category_ids[$page['category']], $build_order++, 0, null, $template, $compiled));
    }
    FileAppend("{$GLOBALS['BASE_DIR']}/data/convert.log", "\nData conversion complete!");
    echo "\nData conversion complete!\n";
    if (!$from_shell) {
        echo "</pre>";
    }
}
コード例 #17
0
ファイル: survey.php プロジェクト: laiello/mystep-cms
function build_page($method)
{
    global $mystep, $req, $db, $mydb, $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);
    if ($method == "add" || $method == "edit") {
        $tpl_info['idx'] = "input";
    } else {
        $tpl_info['idx'] = "list";
    }
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $page = $req->getGet("page");
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $counter = $db->result($setting['db']['pre'] . "survey", "count(*)");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?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'] . "survey", "*", "", array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
            while ($record = $db->GetRS()) {
                HtmlTrans(&$record);
                switch ($record['max_select']) {
                    case 0:
                        $record['max_select'] = $setting['language']['plugin_survey_select_0'];
                        break;
                    case 1:
                        $record['max_select'] = $setting['language']['plugin_survey_select_1'];
                        break;
                    default:
                        $record['max_select'] = sprintf($setting['language']['plugin_survey_select_2'], $record['max_select']);
                }
                $record['link'] = getUrl("survey", $record['id']);
                $record['add_date'] = date("Y-m-d", $record['add_date']);
                $record['expire'] = ceil((int) $record['expire'] / (60 * 60 * 24));
                $record['expire'] = $record['expire'] == 0 ? $setting['language']['plugin_survey_expire_1'] : $record['expire'] . $setting['language']['plugin_survey_expire_2'];
                $tpl_tmp->Set_Loop('record', $record);
            }
        }
        $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('title', $setting['language']['plugin_survey_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "survey", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_survey_error'], 0));
                $mystep->show($tpl);
                return;
            }
            HtmlTrans(&$record);
            $record['expire'] = ceil((int) $record['expire'] / (60 * 60 * 24));
            $record['expire'] = $record['expire'] == 0 ? "<option value=\"0\">" . $setting['language']['plugin_survey_expire_1'] . "</option>" : "<option value=\"{$record['expire']}\">" . $record['expire'] . $setting['language']['plugin_survey_expire_2'] . "</option>";
            $mydb->resetDB("survey_{$id}");
            $item_list = $mydb->queryAll();
            if ($item_list !== false) {
                for ($i = 0, $m = count($item_list); $i < $m; $i++) {
                    $item_list[$i]['no'] = $i + 1;
                }
            } else {
                $item_list = array();
            }
            $tpl_tmp->Set_Loop('item_list', $item_list, true);
            $mydb->closeTBL();
        } else {
            $record['user_lvl'] = 0;
            $record['max_select'] = 1;
        }
        $tpl_tmp->Set_Variables($record, "record");
        $tpl_tmp->judge_list['edit'] = $method == "edit";
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['plugin_survey_add'] : $setting['language']['plugin_survey_edit']);
        $tpl_tmp->Set_Variable('show_item', $method == "add" ? "none" : "block");
        $tpl_tmp->Set_Variable('method', $method);
    }
    $tpl_tmp->Set_Variable('max_size', ini_get('upload_max_filesize'));
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
コード例 #18
0
ファイル: se_detect.php プロジェクト: laiello/mystep-cms
function build_page($method)
{
    global $mystep, $req, $db, $setting, $idx, $agent;
    $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 == "add" || $method == "edit" ? "input" : $method;
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        foreach ($agent as $key => $value) {
            $record = array();
            $record['idx'] = $key;
            $record['counter'] = $db->result($setting['db']['pre'] . "se_detect", "count(*)", array("idx", "=", $key));
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_se_detect_title']);
    } elseif ($method == "view") {
        $counter = $db->result($setting['db']['pre'] . "se_count", "count(*)");
        $tpl_tmp->Set_If('empty', $counter == 0);
        $page = $req->getGet("page");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?method=view", $page);
        $tpl_tmp->Set_Variables($page_arr);
        $fields = $db->GetTabFields($setting['db']['name'], $setting['db']['pre'] . "se_count");
        for ($i = 1, $m = count($fields); $i < $m; $i++) {
            $tpl_tmp->Set_Loop('se', array('idx' => $fields[$i]));
        }
        $tpl_tmp->Set_Variable("field_count", $m);
        $db->select($setting['db']['pre'] . "se_count", "*", "", array("order" => "date desc", "limit" => "{$page_start}, {$page_size}"));
        while ($record = $db->GetRS()) {
            $detail = "";
            foreach ($record as $key => $value) {
                if ($key == "date") {
                    continue;
                }
                $detail .= "<td class=\"row\">" . $record[$key] . "</td>\n";
            }
            $record['detail'] = $detail;
            $tpl_tmp->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_se_detect_title']);
    } else {
        $record = array();
        $record['idx'] = '';
        $record['idx_org'] = '';
        $record['keyword'] = "";
        $record['ip'] = "";
        if ($method == "edit") {
            $record['idx'] = $idx;
            $record['idx_org'] = $idx;
            $record['keyword'] = $agent[$idx];
            $db->select($setting['db']['pre'] . "se_detect", "ip", array("idx", "=", $idx));
            while ($tmp = $db->GetRS()) {
                $record['ip'] .= $tmp['ip'] . "\n";
            }
            $db->Free();
            HtmlTrans(&$record);
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_se_detect_add'] : $setting['language']['plugin_se_detect_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;
}
コード例 #19
0
ファイル: phrases.php プロジェクト: tecshuttle/51qsk
    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);
        $admins = array();
        $getadmins = APP::$DB->query("SELECT aid, fullname FROM " . TABLE_PREFIX . "admin");
        while ($a = APP::$DB->fetch($getadmins)) {
            $admins[$a['aid']] = $a['fullname'];
        }
        SubMenu('常用短语列表', array(array('常用短语列表', 'phrases', 1), array('添加常用短语', 'phrases/add')));
        TableHeader('搜索常用短语');
        TableRow('<center><form method="post" action="' . BURL('phrases') . '" name="searchphrases" style="display:inline-block;"><label>客服ID、关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>状态:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . '>可用</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . ' class=red>已禁用</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索常用短语" class="cancel"></form></center>');
        TableFooter();
        if ($search) {
            if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                $s = ForceInt($search);
                $searchsql = " WHERE aid = '{$s}' ";
                //按ID搜索
                $title = "搜索ID号为: <span class=note>{$s}</span> 的常用短语";
            } else {
                $searchsql = " WHERE (msg LIKE '%{$search}%' OR msg_en LIKE '%{$search}%') ";
                $title = "搜索: <span class=note>{$search}</span> 的常用短语列表";
            }
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " AND activated = " . Iif($groupid == 1, 1, 0) . " ";
                    $title = "在 <span class=note>" . Iif($groupid == 1, '可用的常用短语', '已禁用的常用短语') . "</span> 中, " . $title;
                }
            }
        } else {
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " WHERE activated = " . Iif($groupid == 1, 1, 0) . " ";
                    $title = "全部 <span class=note>" . Iif($groupid == 1, '可用的常用短语', '已禁用的常用短语') . "</span> 列表";
                }
            } else {
                $searchsql = '';
                $title = '全部常用短语列表';
            }
        }
        $getphrases = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "phrase " . $searchsql . " ORDER BY aid DESC, sort DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(pid) AS value FROM " . TABLE_PREFIX . "phrase " . $searchsql);
        echo '<form method="post" action="' . BURL('phrases/updatephrases') . '" name="phrasesform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('所属客服', '排序', '状态', '短语 (中)', '短语 (英)', '<input type="checkbox" id="checkAll" for="deletepids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何常用短语!</font><BR><BR></center>');
        } else {
            while ($phrase = APP::$DB->fetch($getphrases)) {
                TableRow(array('<input type="hidden" name="pids[]" value="' . $phrase['pid'] . '"><a title="编辑" href="' . BURL('users/edit?aid=' . $phrase['aid']) . '">' . $admins[$phrase['aid']] . ' (ID: ' . $phrase['aid'] . ')</a>', '<input type="text" name="sorts[]" value="' . $phrase['sort'] . '" size="4">', '<select name="activateds[]"' . Iif(!$phrase['activated'], ' class=red') . '><option value="1">可用</option><option class="red" value="0" ' . Iif(!$phrase['activated'], 'SELECTED') . '>禁用</option></select>', '<input type="text" name="msgs[]" value="' . $phrase['msg'] . '" size="60">', '<input type="text" name="msg_ens[]" value="' . $phrase['msg_en'] . '" size="60">', '<input type="checkbox" name="deletepids[]" value="' . $phrase['pid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('phrases'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        echo '<div class="submit"><input type="submit" name="updatephrases" value="保存更新" class="cancel" style="margin-right:28px"><input type="submit" name="deletephrases" value="删除常用短语" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选常用短语吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></div></form>';
    }
コード例 #20
0
ファイル: users.php プロジェクト: tecshuttle/51qsk
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $start = $NumPerPage * ($page - 1);
        SubMenu('客服列表', array(array('客服列表', 'users', 1), array('添加客服', 'users/add')));
        $getusers = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "admin ORDER BY activated ASC, aid DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(aid) AS value FROM " . TABLE_PREFIX . "admin");
        echo '<form method="post" action="' . BURL('users/updateusers') . '" name="usersform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader('共有 ' . $maxrows['value'] . ' 位客服人员');
        TableRow(array('ID', '用户名', '类型', '状态', 'Email', '登录', '昵称 (中)', '职位 (中)', '昵称 (EN)', '职位 (EN)', '注册日期', '最后登陆 (IP)', '<input type="checkbox" id="checkAll" for="deleteaids[]"> <label for="checkAll">删除</label>'), 'tr0');
        while ($user = APP::$DB->fetch($getusers)) {
            TableRow(array($user['aid'], '<a title="编辑" href="' . BURL('users/edit?aid=' . $user['aid']) . '"><img src="' . GetAvatar($user['aid']) . '" class="avatar wh30">' . Iif($user['activated'] == 1, $user['username'], "<font class=red><s>{$user['username']}</s></font>") . '</a>', Iif($user['type'], '<font class=red>管理员</font>', '客服人员'), Iif($user['activated'], '正常', '<font class=red>已禁止</font>'), Iif($user['aid'] == $this->admin['aid'], $user['email'], '<a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a>'), $user['logins'], $user['fullname'], $user['post'], $user['fullname_en'], $user['post_en'], DisplayDate($user['first']), Iif($user['last'] == 0, '<span class="red">从未登陆</span>', DisplayDate($user['last'], '', 1) . " ({$user['lastip']})"), Iif($user['aid'] != $this->admin['aid'], '<input type="checkbox" name="deleteaids[]" value="' . $user['aid'] . '">')));
        }
        $totalpages = ceil($maxrows['value'] / $NumPerPage);
        if ($totalpages > 1) {
            TableRow(GetPageList(BURL('users'), $totalpages, $page));
        }
        TableFooter();
        PrintSubmit('删除客服', '', 1, '确定删除所选客服吗?');
    }
コード例 #21
0
ファイル: index.php プロジェクト: atnanasi/staylog
<?php

//"<h2>{$title}<span>{$date} {$time}</span></h2>\n";
$Pagetext = "";
$Data = GetPageList();
for ($i = 0; $i < count($Data); $i++) {
    $InData = GetPage($Data[$i]);
    if ($InData["priority"] !== "system") {
        $Sort[$i] = $Data[$i];
    }
}
rsort($Sort);
for ($i = 0; $i < count($Sort); $i++) {
    $InData = GetPage($Sort[$i]);
    if ($InData["priority"] == "high") {
        $Sorted[] = $Sort[$i];
    }
}
for ($i = 0; $i < count($Sort); $i++) {
    $InData = GetPage($Sort[$i]);
    if ($InData["priority"] == "standard") {
        $Sorted[] = $Sort[$i];
    }
}
for ($i = 0; $i < count($Sorted); $i++) {
    $InData = GetPage($Sorted[$i]);
    $Pagetext .= "<h2>{$InData["title"]}<span>{$InData["date"]} {$InData["time"]}</span></h2>\n";
    $Line = explode("\n", rtrim(file_get_contents("page/{$Sorted[$i]}/{$InData["filename"]}"), "\n"));
    if (count($Line) < 5) {
        $cnt = count($Line);
    } else {
コード例 #22
0
ファイル: guests.php プロジェクト: tecshuttle/51qsk
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $letter = ForceStringFrom('key');
        $search = ForceStringFrom('s');
        $groupid = ForceStringFrom('g');
        if (IsGet('s')) {
            $search = urldecode($search);
        }
        $start = $NumPerPage * ($page - 1);
        $admins = array();
        $getadmins = APP::$DB->query("SELECT aid, fullname FROM " . TABLE_PREFIX . "admin");
        while ($a = APP::$DB->fetch($getadmins)) {
            $admins[$a['aid']] = $a['fullname'];
        }
        SubMenu('客人列表', array(array('客人列表', 'guests', 1)));
        TableHeader('快速查找客人');
        for ($alphabet = 'a'; $alphabet != 'aa'; $alphabet++) {
            $alphabetlinks .= '<a href="' . BURL('guests?key=' . $alphabet) . '" title="' . strtoupper($alphabet) . '开头的客人">' . strtoupper($alphabet) . '</a> &nbsp;';
        }
        TableRow('<center><b><a href="' . BURL('guests') . '">[全部客人]</a>&nbsp;&nbsp;&nbsp;<a href="' . BURL('guests?key=Other') . '">[中文名]</a>&nbsp;&nbsp;&nbsp;' . $alphabetlinks . '</b></center>');
        TableFooter();
        TableHeader('搜索及快速删除');
        TableRow('<center><form method="post" action="' . BURL('guests') . '" name="searchguests" style="display:inline-block;*display:inline;"><label>关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>语言或意向:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="cn" ' . Iif($groupid == 'cn', 'SELECTED') . ' class=blue>中文 (语言)</option><option value="en" ' . Iif($groupid == 'en', 'SELECTED') . ' class=red>EN (语言)</option><option value="5" ' . Iif($groupid == '5', 'SELECTED') . '>5分 (意向)</option><option value="4" ' . Iif($groupid == '4', 'SELECTED') . '>4分 (意向)</option><option value="3" ' . Iif($groupid == '3', 'SELECTED') . '>3分 (意向)</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>2分 (意向)</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . '>1分 (意向)</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索客人" class="cancel"></form>

		<form method="post" action="' . BURL('guests/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除客人:</label>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前登录的客人</option><option value="180">&nbsp;6 个月前登录的客人</option><option value="90">&nbsp;3 个月前登录的客人</option><option value="30">&nbsp;1 个月前登录的客人</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>');
        TableFooter();
        if ($letter) {
            if ($letter == 'Other') {
                $searchsql = " WHERE fullname <> '' AND fullname NOT REGEXP(\"^[a-zA-Z]\") ";
                $title = '<span class=note>中文姓名</span> 的客人列表';
            } else {
                $searchsql = " WHERE fullname LIKE '{$letter}%' ";
                $title = '<span class=note>' . strtoupper($letter) . '</span> 字母开头的客人列表';
            }
        } else {
            if ($search) {
                if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                    $s = ForceInt($search);
                    $searchsql = " WHERE gid = '{$s}' OR aid = '{$s}' OR phone LIKE '{$s}' ";
                    //按ID搜索
                    $title = "搜索数字为: <span class=note>{$s}</span> 的客人";
                } else {
                    $searchsql = " WHERE (fullname LIKE '%{$search}%' OR address LIKE '%{$search}%' OR browser LIKE '%{$search}%' OR email LIKE '%{$search}%' OR ipzone LIKE '%{$search}%' OR remark LIKE '%{$search}%') ";
                    $title = "搜索: <span class=note>{$search}</span> 的客人列表";
                }
                if ($groupid) {
                    if ($groupid == 'cn' or $groupid == 'en') {
                        $searchsql .= " AND lang = " . Iif($groupid == 'cn', 1, 0) . " ";
                        $title = "在 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 中, " . $title;
                    } else {
                        $searchsql .= " AND grade = '{$groupid}' ";
                        $title = "在 <span class=note>意向为: " . $groupid . "分</span> 中, " . $title;
                    }
                }
            } else {
                if ($groupid) {
                    if ($groupid == 'cn' or $groupid == 'en') {
                        $searchsql .= " WHERE lang = " . Iif($groupid == 'cn', 1, 0) . " ";
                        $title = "全部 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 列表";
                    } else {
                        $searchsql .= " WHERE grade = '{$groupid}' ";
                        $title = "<span class=note>意向为: " . $groupid . " 分</span> 的客人列表";
                    }
                } else {
                    $searchsql = '';
                    $title = '全部客人列表';
                }
            }
        }
        $getguests = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "guest " . $searchsql . " ORDER BY last DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(gid) AS value FROM " . TABLE_PREFIX . "guest " . $searchsql);
        echo '<form method="post" action="' . BURL('guests/updateguests') . '" name="guestsform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('ID', '姓名', '意向分', '语言', '登录', '踢出 (次)', '最后服务', '浏览器', '来自页面', 'Email', '电话', '地址', '备注', '归属地 (IP)', '最后登陆', '<input type="checkbox" id="checkAll" for="deletegids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何客人!</font><BR><BR></center>');
        } else {
            while ($user = APP::$DB->fetch($getguests)) {
                TableRow(array($user['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $user['gid']) . '">' . Iif($user['fullname'], $user['fullname'], '<font class=grey>' . Iif($user['lang'], '无名', 'None') . '</font>') . '</a>', $user['grade'], Iif($user['lang'], '中文', 'EN'), $user['logins'], $user['banned'], $admins[$user['aid']], $user['browser'], "<a href=\"{$user['fromurl']}\" target=\"_blank\">" . ShortTitle($user['fromurl'], 36) . "</a>", Iif($user['email'], '<a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a>'), $user['phone'], $user['address'], ShortTitle($user['remark'], 48), $user['ipzone'] . " ({$user['lastip']})", DisplayDate($user['last'], '', 1), '<input type="checkbox" name="deletegids[]" value="' . $user['gid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('guests'), $totalpages, $page, 10, 'key', $letter, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        PrintSubmit('删除客人', '', 1, '确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.');
    }
コード例 #23
0
ファイル: user_online.php プロジェクト: laiello/mystep-cms
$tpl_info['idx'] = "user_online";
$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("username", "like", $keyword);
}
$counter = $db->result($setting['db']['pre'] . "user_online", "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 = "reflash";
}
$db->select($setting['db']['pre'] . "user_online", "*", $condition, array("order" => "{$order} {$order_type}", "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()) {
    $record['userinfo'] = unserialize($record['userinfo']);
コード例 #24
0
ファイル: cto-view.php プロジェクト: shourya07/zperfmon
    $markup = "";
    foreach ($tracked_functions as $fn) {
        if ($check_count) {
            $check_string = "checked";
            $check_count--;
        } else {
            $check_string = "";
        }
        $markup .= "<div>";
        $markup .= "<input type=checkbox id={$fn} {$check_string}/>";
        $markup .= "<label for={$fn}>{$fn}</label>";
        $markup .= "</div>";
    }
    echo $markup;
}
GetPageList($server_cfg, $game_cfg);
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>zPerfmon: CTO Dashboard</title>
</head>

<body>
	<div class="container" id="tab-cto">
		<div class="menu-wrapper">
			<ul class="menu">
				<li class="button"><a class="menu-item-0 current" href=#>Page Delivery Time</a></li>
				<li class="button"><a class="menu-item-1" href=#>Tracked Functions</a></li>
				<!--<li class="button"><a id="select-period-btn" href="#">Jul 1, 2011 - Jul 31, 2011</a></li>-->
コード例 #25
0
ファイル: topic.php プロジェクト: laiello/mystep-cms
function build_page($method)
{
    global $mystep, $req, $db, $mydb, $setting, $topic_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);
    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";
        }
        $keyword = $req->getGet("keyword");
        $page = $req->getGet("page");
        $condition = array();
        if (!empty($keyword)) {
            $condition[] = array("topic_name", "like", $keyword);
        }
        $counter = $db->result($setting['db']['pre'] . "topic", "count(*)", $condition);
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        $the_order = array();
        if (empty($order)) {
            $order = "topic_id";
        }
        $the_order[] = "{$order} {$order_type}";
        if ($order != "topic_id") {
            $the_order[] = "topic_id {$order_type}";
        }
        $db->select($setting['db']['pre'] . "topic", "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        while ($record = $db->GetRS()) {
            if (empty($record['topic_link'])) {
                $record['topic_link'] = getUrl("topic", $record['topic_idx']);
            }
            $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('keyword', $keyword);
        $tpl_tmp->Set_Variable('order', $order);
        $tpl_tmp->Set_Variable('order_type', $order_type);
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_topic_title']);
    } else {
        $record = array();
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "topic", "*", array("topic_id", "n=", $topic_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_topic_error'], 0));
                $mystep->show($tpl);
                return;
            }
            $record['topic_tpl'] = GetFile("topic/" . $topic_id . ".tpl");
            HtmlTrans(&$record);
            $style_list = explode(",", $record['topic_cat']);
            $max_count = count($style_list);
            for ($i = 0; $i < $max_count; $i++) {
                $tpl_tmp->Set_Loop('style_list', array("index" => $i, "style" => $style_list[$i]));
            }
            $n = 1;
            $db->select($setting['db']['pre'] . "topic_link", "*", array("topic_id", "n=", $topic_id), array("order" => "link_order desc,id desc"));
            while ($links = $db->GetRS()) {
                HtmlTrans(&$links);
                $links['idx'] = $n++;
                $links['link_cat'] = $style_list[$links['link_cat']];
                if (empty($links['link_url'])) {
                    $links['link_url'] = "/read.php?id=" . $links['news_id'];
                }
                $tpl_tmp->Set_Loop('link_list', $links);
            }
        } else {
            $record = array();
            $record['topic_id'] = 0;
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('show_link', $method == "edit" ? "" : "none");
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_topic_' . $method]);
        $tpl_tmp->Set_Variable('method', $method);
    }
    $tpl_tmp->Set_Variable('max_size', ini_get('upload_max_filesize'));
    $tpl_tmp->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
コード例 #26
0
ファイル: func_link.php プロジェクト: laiello/mystep-cms
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $idx, $web_id;
    $tpl_info['idx'] = "func_link_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $condition = array();
        if (!empty($idx)) {
            $condition[] = array("idx", "=", $idx);
        }
        if (!empty($web_id)) {
            $condition[] = array("web_id", "n=", $web_id);
        }
        $counter = $db->result($setting['db']['pre'] . "links", "count(*)", $condition);
        $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);
        $order = $req->getGet("order");
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        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'] . "links", "*", $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);
            if (!empty($record['image'])) {
                $record['image'] = "<img width='88' height='31' src='" . $record['image'] . "' />";
            } else {
                $record['image'] = "&nbsp;";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_func_link_title']);
        $tpl_tmp->Set_Variable('idx', $idx);
        $tpl_tmp->Set_Variable('web_id', $web_id);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "links", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_func_link_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            $idx = $record['idx'];
            HtmlTrans(&$record);
        } else {
            $record['id'] = "0";
            $record['web_id'] = $web_id;
            $record['idx'] = "";
            $record['link_name'] = "";
            $record['link_url'] = "http://";
            $record['level'] = "1";
            $record['image'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->judge_list['edit'] = $method == "edit";
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_func_link_add'] : $setting['language']['admin_func_link_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    for ($i = 0, $m = count($GLOBALS['website']); $i < $m; $i++) {
        $GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $web_id ? "selected" : "";
        $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
    }
    $db->select($setting['db']['pre'] . "links", "distinct idx");
    while ($record = $db->GetRS()) {
        $record['selected'] = $record['idx'] == $idx ? "selected" : "";
        $tpl_tmp->Set_Loop('idx', $record);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
コード例 #27
0
ファイル: admin.messages.php プロジェクト: alucard263096/KJ
        echo '<tr><td colspan="6"><center><span class=red>暂无任何记录!</span></center></td></tr></tbody></table></form>';
    } else {
        while ($comment = $DB->fetch($getcomments)) {
            if ($comment['type']) {
                $from = $users[$comment['fromid']];
                $to = $guests[$comment['toid']];
            } else {
                $from = $guests[$comment['fromid']];
                $to = $users[$comment['toid']];
            }
            echo '<tr>
			<td>' . $from . '</td>
			<td>' . $to . '</td>
			<td>' . nl2br($comment['msg']) . '</a></td>
			<td>' . DisplayDate($comment['created'], 0, 1) . '</td>
			<td><input type="checkbox" name="deletecommentids[]" value="' . $comment['msgid'] . '" checkme="group"></td>
			</tr>';
        }
        $totalpages = ceil($maxrows['value'] / $NumPerPage);
        if ($totalpages > 1) {
            echo '<tr><th colspan="6" class="last">' . GetPageList('admin.comments.php', $totalpages, $page, 10, 'u', $uid) . '</th></tr>';
        }
        echo '</tbody>
		</table>
		<div style="margin-top:20px;text-align:center;">
		<input type="submit" onclick="return confirm(\'确定删除所选记录吗?\');" value=" 删除记录 " />
		</div>
		</form>';
    }
}
PrintFooter();
コード例 #28
0
ファイル: admin.automsg.php プロジェクト: alucard263096/KJ
	</thead>
	<tbody>';
    if ($maxrows['value'] < 1) {
        echo '<tr><td colspan="5"><center><span class=red>暂无任何短语!</span></center></td></tr></tbody></table></form>';
    } else {
        while ($message = $DB->fetch($getmessages)) {
            echo '<tr>
			<td><input type="hidden" name="msgids[]" value="' . $message['msgid'] . '" /><input type="text" name="ordernums[]" value="' . $message['ordernum'] . '" size="4" /></td>
			<td><select name="activateds[]"><option value="1">显示</option><option style="color:red;" value="0" ' . Iif(!$message['activated'], 'SELECTED', '') . '>隐藏</option></select></td>
			<td><textarea name="msgs[]" style="height:32px;width:360px;">' . $message['msg'] . '</textarea></td>
			<td><a href="admin.automsg.php?action=editmsg&msgid=' . $message['msgid'] . '">' . Iif($message['activated'], '编辑', '<span class=red>编辑</span>') . '</a></td>
			<td><input type="checkbox" name="deletemsgids[]" value="' . $message['msgid'] . '" checkme="group"></td>
			</tr>';
        }
        $totalpages = ceil($maxrows['value'] / $NumPerPage);
        if ($totalpages > 1) {
            echo '<tr><th colspan="5" class="last">' . GetPageList('admin.automsg.php', $totalpages, $page, 10, 's', urlencode($search)) . '</th></tr>';
        }
        echo '</tbody>
		</table>
		<div style="margin-top:20px;text-align:center;">
		<input type="submit" name="updatemsgs" value=" 保存更新 " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" name="deletemsgs" onclick="return confirm(\'确定删除所选短语吗?\');" value=" 删除短语 " />
		</div>
		</form>';
    }
}
PrintFooter();
?>

コード例 #29
0
ファイル: messages.php プロジェクト: noikiy/meilala
    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('记录列表', 'messages', 1)));
        TableHeader('搜索及快速删除');
        TableRow('<center><form method="post" action="' . BURL('messages') . '" name="searchmessages" style="display:inline-block;*display:inline;"><label>关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>分类:</label>&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索记录" class="cancel"></form>

		<form method="post" action="' . BURL('messages/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除记录:</label>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的对话记录</option><option value="180">&nbsp;6 个月前的对话记录</option><option value="90">&nbsp;3 个月前的对话记录</option><option value="30">&nbsp;1 个月前的对话记录</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<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 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 type = " . 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 type = " . Iif($groupid == 1, 0, 1) . " ";
                    $title = "全部 <span class=note>" . Iif($groupid == 1, '客人的发言', '客服的发言') . "</span> 列表";
                }
            } else {
                $searchsql = '';
                $title = '全部记录列表';
            }
        }
        $getmessages = 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);
        echo '<form method="post" action="' . BURL('messages/updatemessages') . '" name="messagesform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('ID', '发送人', '对话内容', '接收人', '记录时间', '<input type="checkbox" id="checkAll" for="deletemids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何记录!</font><BR><BR></center>');
        } else {
            while ($msg = APP::$DB->fetch($getmessages)) {
                TableRow(array($msg['mid'], "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('users/edit?aid=' . $msg['fromid']), BURL('guests/edit?gid=' . $msg['fromid'])) . "\">{$msg['fromname']}</a>", getSmile($msg['msg']), "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('guests/edit?gid=' . $msg['toid']), BURL('users/edit?aid=' . $msg['toid'])) . "\">{$msg['toname']}</a>", DisplayDate($msg['time'], '', 1), '<input type="checkbox" name="deletemids[]" value="' . $msg['mid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('messages'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        PrintSubmit('删除记录', '', 1, '确定删除所选记录吗?');
    }
コード例 #30
0
ファイル: user_detail.php プロジェクト: laiello/mystep-cms
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $user_id, $user_group, $user_type, $tpl_info, $setting;
    $tpl_info['idx'] = "user_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        //navigation
        $order = $req->getGet("order");
        $tpl_tmp->Set_Variable('order', $order);
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        $keyword = $req->getGet("keyword");
        $group_id = $req->getGet("group_id");
        $type_id = $req->getGet("type_id");
        $condition = array();
        if (!empty($keyword)) {
            $condition[] = array("username", "like", $keyword);
        }
        if (!empty($group_id)) {
            $condition[] = array("group_id", "n=", $group_id);
        }
        if (!empty($type_id)) {
            $condition[] = array("type_id", "n=", $type_id);
        }
        $counter = $db->result($setting['db']['pre'] . "users", "count(*)", $condition);
        $page = $req->getGet("page");
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&group_id={$group_id}&type_id={$type_id}&order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        if (empty($order)) {
            $order = "user_id";
        }
        $the_order = array();
        $the_order[] = "{$order} {$order_type}";
        if ($order != "user_id") {
            $the_order[] = "user_id desc";
        }
        $db->select($setting['db']['pre'] . "users", "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        $tpl_tmp->para_list['record'] = array();
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['regdate'] = date("Y-m-d H:i:s", $record['regdate']);
            $type_info = getParaInfo("user_type", "type_id", $record['type_id']);
            $record['group_name'] = $type_info['type_name'];
            if ($group_info = getParaInfo("user_group", "group_id", $record['group_id'])) {
                $record['group_name'] .= " ги" . $group_info['group_name'] . "гй";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_detail_title']);
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        if ($order_type == "asc") {
            $order_type = "desc";
        } else {
            $order_type = "asc";
        }
        $tpl_tmp->Set_Variable('order_type', $order_type);
        $tpl_tmp->Set_Variable('group_id', $group_id);
        $tpl_tmp->Set_Variable('type_id', $type_id);
        $tpl_tmp->Set_Variable('keyword', $keyword);
    } elseif ($method == "edit") {
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_detail_edit']);
        $record = $db->record($setting['db']['pre'] . "users", "*", array("user_id", "n=", $user_id));
        if ($record !== false) {
            $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_detail_error'], 0));
            $mystep->show($tpl);
            $mystep->pageEnd(false);
        }
        $group_id = $record['group_id'];
        $type_id = $record['type_id'];
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    } else {
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_detail_add']);
        $group_id = 0;
        $type_id = 1;
        $record['user_id'] = 0;
        $record['username'] = "";
        $record['email'] = "";
        $tpl_tmp->Set_Variables($record);
    }
    $max_count = count($user_group);
    for ($i = 0; $i < $max_count; $i++) {
        $user_group[$i]["selected"] = $user_group[$i]['group_id'] == $group_id ? "selected" : "";
        $tpl_tmp->Set_Loop('user_group', $user_group[$i]);
    }
    $max_count = count($user_type);
    for ($i = 0; $i < $max_count; $i++) {
        $user_type[$i]["selected"] = $user_type[$i]['type_id'] == $type_id ? "selected" : "";
        $tpl_tmp->Set_Loop('user_type', $user_type[$i]);
    }
    $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    $tpl_tmp->Set_Variable('method', $method);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $db->Free();
    $mystep->show($tpl);
    return;
}