Example #1
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $web_id;
    $tpl_info['idx'] = "art_info_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $condition = array();
        if (!empty($web_id)) {
            $condition = array("web_id", "n=", $web_id);
        }
        $db->select($setting['db']['pre'] . "info_show", "*", $condition, array("order" => "id asc"));
        $n = 0;
        while ($record = $db->GetRS()) {
            $n++;
            if ($webInfo = getParaInfo("website", "web_id", $record['web_id'])) {
                $record['web_id'] = $webInfo['name'];
            } else {
                $record['web_id'] = "ALL";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_If('empty', $n == 0);
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_info_title']);
        $tpl_tmp->Set_Variable('web_id', $web_id);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "info_show", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_art_info_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['web_id'] = $web_id;
            $record['subject'] = "";
            $record['content'] = "";
            $record['attach_list'] = "|";
        }
        $tpl_tmp->Set_Variables($record);
        $Max_size = round(GetFileSize(ini_get('upload_max_filesize')) / 1024 / 1024, 2);
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['admin_art_info_add'] : $setting['language']['admin_art_info_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('MaxSize', $Max_size);
        $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;
}
Example #2
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "email", "*", "", array("order" => "id desc"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl->Set_Variable('title', $setting['language']['plugin_email_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "email", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_email_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['subject'] = "";
            $record['from'] = "";
            $record['reply'] = "";
            $record['notification'] = "";
            $record['priority'] = 3;
            $record['to'] = "";
            $record['cc'] = "";
            $record['bcc'] = "";
            $record['header'] = "";
            $record['content'] = "";
            $record['attachment'] = "";
        }
        $record['send_date'] = date("Y-m-d H:i:s");
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_email_add'] : $setting['language']['plugin_email_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;
}
Example #3
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $type_id, $tpl_info, $setting, $user_power;
    $tpl_info['idx'] = "user_type_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $max_count = count($user_power);
        $db->select($setting['db']['pre'] . "user_type", "*", "", array("order" => "type_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['user_power'] = "";
            for ($i = 0; $i < $max_count; $i++) {
                $record['user_power'] .= "<td class=\"row\">" . $record[$user_power[$i]['idx']] . "</td>\n";
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_type_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_type_add'] : $setting['language']['admin_user_type_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_type", "*", array("type_id", "n=", $type_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_type_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['type_id'] = 0;
            $record['type_name'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $max_count = count($user_power);
    for ($i = 0; $i < $max_count; $i++) {
        if (isset($record[$user_power[$i]['idx']])) {
            $user_power[$i]['value'] = $record[$user_power[$i]['idx']];
        }
        $tpl_tmp->Set_Loop('user_power', $user_power[$i]);
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #4
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $power_id, $tpl_info, $setting;
    $tpl_info['idx'] = "user_power_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $formatList = array('digital' => $setting['language']['checkform_item_digital'], 'date' => $setting['language']['checkform_item_date'], 'time' => $setting['language']['checkform_item_time']);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "user_power", "*", "", array("order" => "power_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $record['format'] = $formatList[$record['format']];
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_power_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_power_add'] : $setting['language']['admin_user_power_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_power", "*", array("power_id", "n=", $power_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_power_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $record['idx_org'] = $record['idx'];
        } else {
            $record['power_id'] = 0;
            $record['idx'] = "";
            $record['idx_org'] = "";
            $record['name'] = "";
            $record['value'] = "";
            $record['format'] = "";
            $record['format_org'] = "";
            $record['comment'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        foreach ($formatList as $key => $value) {
            $tpl_tmp->Set_Loop('format', array("key" => $key, "value" => $value, "select" => $record['format'] == $key ? "selected" : ""));
        }
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #5
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $idx, $mydb;
    $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);
    if ($method == "list") {
        $record = $mydb->queryAll();
        if (!$record) {
            $record = array();
        }
        $tpl_tmp->Set_Loop('record', $record, true);
        $tpl_tmp->Set_Variable('title', $setting['language']['plugin_xcode_title']);
    } else {
        if ($method == "edit") {
            $record = $mydb->queryDate("idx=" . $idx, true, &$fp_pos, &$row_pos);
            if (!$record) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_xcode_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $record['content'] = GetFile(dirname(__FILE__) . "/code/" . $idx . ".php");
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['idx'] = $_SERVER['REQUEST_TIME'];
            $record['page'] = "";
            $record['position'] = "0";
            $record['description'] = "";
            $record['content'] = "<?php\n\n?>";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_xcode_add'] : $setting['language']['plugin_xcode_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;
}
Example #6
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $web_id, $tpl_info, $website, $setting;
    $tpl_info['idx'] = "web_subweb_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_tmp->allow_script = true;
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "website", "*", "", array("order" => "web_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_subweb_title']);
        global $admin_cat;
        $tpl_tmp->Set_Variable("admin_cat", toJson($admin_cat, $setting['gen']['charset']));
        $tpl_tmp->Set_Variable("website", toJson($website, $setting['gen']['charset']));
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_web_subweb_add'] : $setting['language']['admin_web_subweb_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "website", "*", array("web_id", "n=", $web_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_web_subweb_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['web_id'] = 0;
            $record['name'] = "";
            $record['idx'] = "";
            $record['host'] = "";
        }
        $GLOBALS['subweb_idx'] = $record['idx'];
        $tpl_tmp->Set_Variables($record);
        $setting['watermark']['mode'] = array($setting['watermark']['mode'] & 1 == 1, $setting['watermark']['mode'] & 2 == 2);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #7
0
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;
}
Example #8
0
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;
}
Example #9
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $status = file_get_contents("status.txt");
        if ($status == "run") {
            $tpl->Set_Variable('status_info', $setting['language']['plugin_crontab_status_run']);
            $tpl->Set_Variable('status_link', "?method=stop");
            $tpl->Set_Variable('status_txt', $setting['language']['plugin_crontab_status_stop']);
        } else {
            $tpl->Set_Variable('status_info', $setting['language']['plugin_crontab_status_stop']);
            //$tpl->Set_Variable('status_link', "?method=start");
            $tpl->Set_Variable('status_link', 'javascript:crontab_start()');
            $tpl->Set_Variable('status_txt', $setting['language']['plugin_crontab_status_run']);
        }
        $db->select($setting['db']['pre'] . "crontab", "*", "", array("order" => "id desc"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            $tpl->Set_Loop('record', $record);
        }
        $db->Free();
        $tpl->Set_Variable('title', $setting['language']['plugin_crontab_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "crontab", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_crontab_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['name'] = "";
            $record['mode'] = 1;
            $record['expire'] = "";
            $record['schedule'] = "0,0,1,0,0";
            $record['url'] = "";
            $record['code'] = "";
        }
        $record['send_date'] = date("Y-m-d H:i:s");
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_crontab_add'] : $setting['language']['plugin_crontab_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;
}
Example #10
0
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;
}
Example #11
0
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;
}
Example #12
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id;
    $tpl_info = array("idx" => $method == "list" ? "list" : "input", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $max_count = count($GLOBALS['admin_cat']);
        for ($i = 0; $i < $max_count; $i++) {
            switch ($GLOBALS['admin_cat'][$i]['web_id']) {
                case "0":
                    $GLOBALS['admin_cat'][$i]['web_id'] = $setting['language']['plugin_admin_cat_panle'];
                    break;
                case "255":
                    $GLOBALS['admin_cat'][$i]['web_id'] = $setting['language']['plugin_admin_cat_allsub'];
                    break;
                default:
                    $webInfo = getParaInfo("website", "web_id", $GLOBALS['admin_cat'][$i]['web_id']);
                    $GLOBALS['admin_cat'][$i]['web_id'] = $webInfo['name'];
                    break;
            }
            $tpl->Set_Loop('record', $GLOBALS['admin_cat'][$i]);
            $max_count2 = count($GLOBALS['admin_cat'][$i]['sub']);
            for ($j = 0; $j < $max_count2; $j++) {
                switch ($GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']) {
                    case "0":
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $setting['language']['plugin_admin_cat_panle'];
                        break;
                    case "255":
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $setting['language']['plugin_admin_cat_allsub'];
                        break;
                    default:
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = getParaInfo("website", "web_id", $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']);
                        $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id'] = $GLOBALS['admin_cat'][$i]['sub'][$j]['web_id']['name'];
                        break;
                }
                $GLOBALS['admin_cat'][$i]['sub'][$j]['name'] = "&nbsp; &nbsp; " . $GLOBALS['admin_cat'][$i]['sub'][$j]['name'];
                $tpl->Set_Loop('record', $GLOBALS['admin_cat'][$i]['sub'][$j]);
            }
        }
        $tpl->Set_Variable('title', $setting['language']['plugin_admin_cat_title']);
    } else {
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "admin_cat", "*", array("id", "n=", $id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['plugin_admin_cat_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            $web_id = $record['web_id'];
            HtmlTrans(&$record);
        } else {
            $record = array();
            $record['id'] = 0;
            $record['pid'] = 0;
            $record['name'] = "";
            $record['file'] = "";
            $record['path'] = "";
            $record['web_id'] = "0";
            $record['order'] = "0";
            $record['comment'] = "";
        }
        $tpl->Set_Variables($record);
        $tpl->Set_Variable('title', $method == 'add' ? $setting['language']['plugin_admin_cat_add'] : $setting['language']['plugin_admin_cat_edit']);
        $tpl->Set_Variable('method', $method);
        $tpl->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
        $max_count = count($GLOBALS['website']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl->Set_Loop("website", $GLOBALS['website'][$i]);
        }
        $max_count = count($GLOBALS['admin_cat']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl->Set_Loop("cat", array("id" => $GLOBALS['admin_cat'][$i]['id'], "name" => $GLOBALS['admin_cat'][$i]['name'], "selected" => $GLOBALS['admin_cat'][$i]['id'] == $record['pid'] ? "selected" : ""));
        }
    }
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $db->Free();
    $mystep->show($tpl);
    return;
}
Example #13
0
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;
}
Example #14
0
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;
}
Example #15
0
    public static function build_list($news_id, $web_id)
    {
        global $db, $setting;
        $comment_list = array();
        $db->select($setting['db']['pre'] . "comment", "*", array(array("news_id", "n=", $news_id), array("web_id", "n=", $web_id, "and")), array("order" => "id asc"));
        while ($comment = $db->GetRS($query)) {
            HtmlTrans($comment);
            $comment['quote_txt'] = "";
            if ($comment['quote'] > 0) {
                if (isset($comment_list[$comment['quote'] - 1])) {
                    $quote_comment = $comment_list[$comment['quote'] - 1];
                    $quote_text = sprintf($setting['language']['plugin_comment_quote'], $comment['quote'], $quote_comment['user_name']);
                    $comment['quote_txt'] = <<<windy2000
<fieldset>
\t<legend>{$quote_text}</legend>
\t<div>{$quote_comment['quote_txt']}</div>
\t<div><pre>{$quote_comment['comment']}</pre></div>
</fieldset>
windy2000;
                }
            }
            $comment_list[] = $comment;
        }
        $content = toJson($comment_list, $setting['gen']['charset']);
        if (is_null($content)) {
            $content = "";
        }
        WriteFile(ROOT_PATH . "/plugin/comment/cache/" . $web_id . "/" . ceil($news_id / 1000) * 1000 . "/" . $news_id . ".txt", $content, "wb");
        return;
    }
Example #16
0
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;
}
Example #17
0
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;
}
Example #18
0
            }
        } else {
            echo '
			<script>
				alert("' . $setting['language']['plugin_custom_form_error_2'] . '");
				history.go(-1);
			</script>
			';
        }
    }
    $tpl = $mystep->getInstance("MyTpl", $tpl_info, $cache_info);
    $tpl_info['idx'] = $mid . "_" . $module . "_" . ($setting['gen']['language'] == "en" ? "en" : "cn");
    $tpl_info['style'] = "../plugin/" . basename(realpath(dirname(__FILE__))) . "/setting/";
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $the_name = $db->result($setting['db']['pre'] . "custom_form", "name" . ($setting['gen']['language'] == "en" ? "_en" : ""), array("mid", "n=", $mid));
    HtmlTrans($the_name);
    $setting['web']['title'] = $the_name . "_" . $setting['web']['title'];
    if ($module == "cf_submit") {
        $tpl_tmp->allow_script = true;
        global $para;
        include "setting/{$mid}.php";
    } elseif ($module == "cf_list") {
        global $limit;
        $page = $req->getGet("page");
        if (!is_numeric($page) || $page < 1) {
            $page = 1;
        }
        $page_size = $setting['list']['txt'];
        $count = $db->result($setting['db']['pre'] . "custom_form_" . $mid, "count(*)");
        $tpl_tmp->Set_Variable('custom_form_count', $count);
        $tpl_tmp->Set_Variable('page_list', PageList($page, ceil($count / $page_size)));
Example #19
0
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;
}
Example #20
0
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;
}
Example #21
0
$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']);
    HtmlTrans(&$record);
    $record['reflash'] = date("Y-m-d H:i:s", $record['reflash']);
    $type_info = getParaInfo("user_type", "type_id", $record['usertype']);
    $record['usertype'] = $type_info['type_name'];
    if ($group_info = getParaInfo("user_group", "group_id", $record['usergroup'])) {
        $record['usertype'] .= " ги" . $group_info['group_name'] . "гй";
    }
    if (isset($record['userinfo']['name'])) {
        $record['username'] = $record['userinfo']['name'];
    }
    $tpl_tmp->Set_Loop('record', $record);
}
$tpl_tmp->Set_Variable('title', $setting['language']['admin_user_online_title']);
$db->Free();
$tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
unset($tpl_tmp);
Example #22
0
function build_page($method)
{
    global $mystep, $req, $db, $setting, $id, $mid, $record, $tpl_tmp;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))), "path" => ROOT_PATH . "/" . $setting['path']['template']);
    if ($method == "list" || $method == "add" || $method == "edit") {
        $tpl_info['style'] .= "/tpl/";
    } else {
        $tpl_info['style'] .= "/setting/";
    }
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "edit_data") {
        $tpl_info['idx'] = $mid . "_edit_data";
    } elseif ($method == "list_data") {
        $tpl_info['idx'] = $mid . "_list_data";
    } else {
        $tpl_info['idx'] = $method;
    }
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "confirm") {
        global $para;
        $record = $db->record($setting['db']['pre'] . "custom_form_" . $mid, "*", array("id", "n=", $id));
        if ($record === false || !file_exists("setting/{$mid}.php")) {
            $tpl->Set_Variable('main', showInfo("指定的记录不存在或配置文件缺失!", 0));
            $mystep->show($tpl);
            $mystep->pageEnd(false);
        }
        if (function_exists("ext_func")) {
            ext_func();
        }
        $db->update($setting['db']['pre'] . "custom_form_" . $mid, array("mailed" => 1), array("id", "n=", $record['id']));
        include "setting/" . $mid . ".php";
        $tpl_info['idx'] = "{$mid}_mail_" . (empty($record['name']) && !empty($record['name_en']) ? "en" : "cn");
        $tpl_tmp->ClearError();
        $tpl_tmp->init($tpl_info);
        if (empty($record['name'])) {
            $record['name'] = $record['name_en'];
        }
        $tpl_tmp->Set_Variables($record, 'record');
        $custom_form = $db->record($setting['db']['pre'] . "custom_form", "*", array("mid", "n=", $mid));
        $tpl_tmp->Set_Variables($custom_form);
        $tpl_tmp->allow_script = true;
    } elseif ($method == "list_data") {
        $page = $req->getGet("page");
        $order = $req->getGet("order");
        $tpl_tmp->Set_Variable('order', $order);
        $order_type = $req->getGet("order_type");
        if (empty($order_type)) {
            $order_type = "desc";
        }
        include_once "setting/{$mid}.php";
        $condition = array();
        if (!empty($keyword)) {
            if (is_numeric($keyword)) {
                $condition[] = array("id", "n=", $keyword, "or");
            }
            foreach ($para as $key => $value) {
                if ($para[$key]['search'] == 'true') {
                    switch ($para[$key]['type']) {
                        case "file":
                        case "textarea":
                            $condition[] = array($key, "like", $keyword, "or");
                            break;
                        case "radio":
                        case "select":
                            $condition[] = array($key, "=", $keyword, "or");
                            break;
                        case "text":
                            if ($para[$key]['format'] == "digital" || $para[$key]['format'] == "number") {
                                $condition[] = array($key, "=", $keyword, "or");
                            } else {
                                $condition[] = array($key, "like", $keyword, "or");
                            }
                            break;
                        case "checkbox":
                            break;
                        default:
                            $condition[] = array($key, "=", $keyword, "or");
                            break;
                    }
                }
            }
        }
        $key_file = array();
        foreach ($para as $key => $value) {
            if ($para[$key]['type'] == 'file') {
                $key_file[] = $key;
            }
        }
        //navigation
        $counter = $db->result($setting['db']['pre'] . "custom_form_" . $mid, "count(*)", $condition);
        list($page_arr, $page_start, $page_size) = GetPageList($counter, "?mid={$mid}&keyword={$keyword}&order={$order}&order_type={$order_type}", $page);
        $tpl_tmp->Set_Variables($page_arr);
        //main list
        if (empty($order)) {
            $order = "id";
        }
        $the_order = array();
        $the_order[] = "{$order} {$order_type}";
        if ($order != "id") {
            $the_order[] = "id " . $order_type;
        }
        $db->select($setting['db']['pre'] . "custom_form_" . $mid, "*", $condition, array("order" => $the_order, "limit" => "{$page_start}, {$page_size}"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if (function_exists("ext_func")) {
                ext_func();
            }
            if (empty($record['name']) && !empty($record['name_en'])) {
                $record['name'] = $record['name_en'];
            }
            if (empty($record['company']) && !empty($record['company_en'])) {
                $record['company'] = $record['company_en'];
            }
            foreach ($key_file as $key) {
                if (empty($record[$key])) {
                    continue;
                }
                $cur_file = explode("::", $record[$key]);
                if (strpos($cur_file[1], "image") !== false) {
                    $record[$key] = '<a href="file.php?mid=' . $mid . '&id=' . $record['id'] . '&f=' . $key . '" target="_blank"><img src="file.php?mid=' . $mid . '&id=' . $record['id'] . '&f=' . $key . '" width="120" alt="' . $cur_file[0] . '" /></a>';
                } else {
                    $record[$key] = '<a href="file.php?mid=' . $mid . '&id=' . $record['id'] . '&f=' . $key . '" target="_blank">' . $cur_file[0] . '</a>';
                }
            }
            $record['confirm'] = "";
            if ($record['mailed'] != "已发") {
                $record['confirm'] = ' &nbsp;<a href="?method=confirm&mid=' . $mid . '&id=' . $record['id'] . '">确认</a>';
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('custom_form_name', $db->result($setting['db']['pre'] . "custom_form", "name", array("mid", "n=", $mid)));
        $tpl_tmp->Set_Variable('title', '表单信息浏览');
        $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 == "edit_data") {
        global $para, $record;
        $keyword = mysql_real_escape_string($req->getGet("keyword"));
        $record = $db->record($setting['db']['pre'] . "custom_form_" . $mid, "*", array("id", "n=", $id));
        if ($record === false || !file_exists("setting/{$mid}.php")) {
            $tpl->Set_Variable('main', showInfo("指定的记录不存在或配置文件缺失!", 0));
            $mystep->show($tpl);
            $mystep->pageEnd(false);
        }
        HtmlTrans(&$record);
        if (function_exists("ext_func")) {
            ext_func();
        }
        $tpl_tmp->Set_Variables($record, "record");
        $tpl_tmp->Set_Variable('custom_form_name', $db->result($setting['db']['pre'] . "custom_form", "name", array("mid", "n=", $mid)));
        $tpl_tmp->Set_Variable('title', '表单信息更新');
        $tpl_tmp->Set_Variable('method', 'edit_data');
        $tpl_tmp->Set_Variable('keyword', $keyword);
        include "setting/{$mid}.php";
        $tpl_tmp->allow_script = true;
    } elseif ($method == "list") {
        $db->select($setting['db']['pre'] . "custom_form", "*", "", array("order" => "mid desc"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if ($record['web_id'] == 0) {
                $record['web_id'] = "仅管理面板";
            } elseif ($record['web_id'] == 255) {
                $record['web_id'] = "全部子站";
            } else {
                $webinfo = getParaInfo("website", "web_id", $record['web_id']);
                $record['web_id'] = $webinfo['name'];
            }
            $record['link_submit'] = getUrl("cf_submit", $record['mid']);
            $record['link_list'] = getUrl("cf_list", $record['mid']);
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', '表单浏览');
        $tpl_tmp->Set_Variable('order_type_org', $order_type);
        $order_type = $order_type == "asc" ? "desc" : "asc";
        $tpl_tmp->Set_Variable('order_type', $order_type);
        global $admin_cat;
        $tpl_tmp->Set_Variable('admin_cat', toJson($admin_cat, $setting['gen']['charset']));
    } elseif ($method == "edit") {
        $record = $db->record($setting['db']['pre'] . "custom_form", "*", array("mid", "n=", $mid));
        if ($record === false) {
            $tpl->Set_Variable('main', showInfo("指定的记录不存在!", 0));
            $mystep->show($tpl);
            $mystep->pageEnd(false);
        }
        if (function_exists("ext_func")) {
            ext_func();
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('title', '修改表单项目');
        $tpl_tmp->Set_Variable('method', 'edit');
        $max_count = count($GLOBALS['website']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
        }
        include "setting/{$mid}.php";
        $tpl_tmp->Set_Variable('cf_item', toJson($para, $setting['gen']['charset']));
        $tpl_tmp->Set_Variable('tpl_cf_submit_cn', htmlspecialchars(GetFile("setting/{$mid}_cf_submit_cn.tpl")));
        $tpl_tmp->Set_Variable('tpl_cf_submit_en', htmlspecialchars(GetFile("setting/{$mid}_cf_submit_en.tpl")));
        $tpl_tmp->Set_Variable('tpl_cf_print_cn', htmlspecialchars(GetFile("setting/{$mid}_cf_print_cn.tpl")));
        $tpl_tmp->Set_Variable('tpl_cf_print_en', htmlspecialchars(GetFile("setting/{$mid}_cf_print_en.tpl")));
        $tpl_tmp->Set_Variable('tpl_cf_list_cn', htmlspecialchars(GetFile("setting/{$mid}_cf_list_cn.tpl")));
        $tpl_tmp->Set_Variable('tpl_cf_list_en', htmlspecialchars(GetFile("setting/{$mid}_cf_list_en.tpl")));
        $tpl_tmp->Set_Variable('tpl_block_cf_list_cn', htmlspecialchars(GetFile("setting/{$mid}_block_cf_list_cn.tpl")));
        $tpl_tmp->Set_Variable('tpl_block_cf_list_en', htmlspecialchars(GetFile("setting/{$mid}_block_cf_list_en.tpl")));
        $tpl_tmp->Set_Variable('tpl_mail_cn', htmlspecialchars(GetFile("setting/{$mid}_mail_cn.tpl")));
        $tpl_tmp->Set_Variable('tpl_mail_en', htmlspecialchars(GetFile("setting/{$mid}_mail_en.tpl")));
        $tpl_tmp->Set_Variable('tpl_edit_data', htmlspecialchars(GetFile("setting/{$mid}_edit_data.tpl")));
        $tpl_tmp->Set_Variable('tpl_list_data', htmlspecialchars(GetFile("setting/{$mid}_list_data.tpl")));
        $tpl_tmp->Set_Variable('ext_script', htmlspecialchars(GetFile("setting/{$mid}_ext_script.php")));
    } elseif ($method == "add") {
        $tpl_tmp->Set_Variable('title', '添加表单');
        $tpl_tmp->Set_Variable('method', 'add');
        $max_count = count($GLOBALS['website']);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
        }
        if (file_exists("setting/" . $mid . ".php")) {
            include "setting/" . $mid . ".php";
            $tpl_tmp->Set_Variable('tpl_cf_submit_cn', htmlspecialchars(GetFile("setting/" . $mid . "_cf_submit_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_submit_en', htmlspecialchars(GetFile("setting/" . $mid . "_cf_submit_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_print_cn', htmlspecialchars(GetFile("setting/" . $mid . "_cf_print_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_print_en', htmlspecialchars(GetFile("setting/" . $mid . "_cf_print_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_list_cn', htmlspecialchars(GetFile("setting/" . $mid . "_cf_list_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_list_en', htmlspecialchars(GetFile("setting/" . $mid . "_cf_list_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_block_cf_list_cn', htmlspecialchars(GetFile("setting/" . $mid . "_block_cf_list_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_block_cf_list_en', htmlspecialchars(GetFile("setting/" . $mid . "_block_cf_list_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_mail_cn', htmlspecialchars(GetFile("setting/" . $mid . "_mail_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_mail_en', htmlspecialchars(GetFile("setting/" . $mid . "_mail_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_edit_data', htmlspecialchars(GetFile("setting/" . $mid . "_edit_data.tpl")));
            $tpl_tmp->Set_Variable('tpl_list_data', htmlspecialchars(GetFile("setting/" . $mid . "_list_data.tpl")));
            $tpl_tmp->Set_Variable('ext_script', htmlspecialchars(GetFile("setting/" . $mid . "_ext_script.php")));
        } else {
            include "setting/default.php";
            $tpl_tmp->Set_Variable('tpl_cf_submit_cn', htmlspecialchars(GetFile("tpl/default_cf_submit_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_submit_en', htmlspecialchars(GetFile("tpl/default_cf_submit_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_print_cn', htmlspecialchars(GetFile("tpl/default_cf_print_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_print_en', htmlspecialchars(GetFile("tpl/default_cf_print_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_list_cn', htmlspecialchars(GetFile("tpl/default_cf_list_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_cf_list_en', htmlspecialchars(GetFile("tpl/default_cf_list_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_block_cf_list_cn', htmlspecialchars(GetFile("tpl/block_cf_list_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_block_cf_list_en', htmlspecialchars(GetFile("tpl/block_cf_list_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_mail_cn', htmlspecialchars(GetFile("tpl/default_mail_cn.tpl")));
            $tpl_tmp->Set_Variable('tpl_mail_en', htmlspecialchars(GetFile("tpl/default_mail_en.tpl")));
            $tpl_tmp->Set_Variable('tpl_edit_data', htmlspecialchars(GetFile("tpl/edit_data.tpl")));
            $tpl_tmp->Set_Variable('tpl_list_data', htmlspecialchars(GetFile("tpl/list_data.tpl")));
            $tpl_tmp->Set_Variable('ext_script', htmlspecialchars(GetFile("setting/ext_script.php")));
        }
        $tpl_tmp->Set_Variable('cf_item', toJson($para, $setting['gen']['charset']));
        if (function_exists("ext_func")) {
            ext_func();
        }
    }
    $tpl_tmp->Set_Variable('mid', $mid);
    $tpl->Set_Variable('path_admin', $setting['path']['admin']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$setting, $para'));
    $db->Free();
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #23
0
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;
}
Example #24
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $tpl_info, $setting, $news_cat, $cat_id, $group;
    $tpl_info['idx'] = "art_catalog_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $tpl_tmp->Set_Variable("group", toJson($group, $setting['gen']['charset']));
        $tpl_tmp->Set_Variable("news_cat", toJson($news_cat, $setting['gen']['charset']));
        $max_count = count($news_cat);
        for ($i = 0; $i < $max_count; $i++) {
            if (!$GLOBALS['op_mode'] && $news_cat[$i]['web_id'] != $setting['info']['web']['web_id']) {
                continue;
            }
            if ($group['power_cat'] != "all" && strpos(',' . $group['power_cat'] . ',', ',' . $news_cat[$i]['cat_id'] . ',') === false) {
                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]['cat_name'] = preg_replace("/^©À /", "", preg_replace("/^©¸ /", "", $news_cat[$i]['cat_name']));
            $web = getParaInfo("website", "web_id", $news_cat[$i]['web_id']);
            $news_cat[$i]['web_name'] = $web['name'];
            if (empty($news_cat[$i]['web_name'])) {
                $news_cat[$i]['web_name'] = $setting['language']['admin_art_catalog_public'];
            }
            $news_cat[$i]['web_url'] = $web['host'];
            if (strpos($news_cat[$i]['web_url'], ",") !== false) {
                $news_cat[$i]['web_url'] = substr($news_cat[$i]['web_url'], 0, strpos($news_cat[$i]['web_url'], ","));
            }
            $news_cat[$i]['web_url'] = "http://" . $news_cat[$i]['web_url'];
            $tpl_tmp->Set_Loop('record', $news_cat[$i]);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_art_catalog_catalog']);
    } else {
        if ($method == "edit") {
            $show_merge = "inline";
            $record = $db->record($setting['db']['pre'] . "news_cat", "*", array("cat_id", "n=", $cat_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_art_catalog_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
            HtmlTrans(&$record);
            $record['cat_show_1'] = $record['cat_show'] & 1 ? "checked" : "";
            $record['cat_show_2'] = $record['cat_show'] & 2 ? "checked" : "";
            $record['cat_show_4'] = $record['cat_show'] & 4 ? "checked" : "";
            $record['cat_type_0'] = $record['cat_type'] == 0 ? "selected" : "";
            $record['cat_type_1'] = $record['cat_type'] == 1 ? "selected" : "";
            $record['cat_type_2'] = $record['cat_type'] == 2 ? "selected" : "";
            $record['cat_type_3'] = $record['cat_type'] == 3 ? "selected" : "";
            $record['template'] = "";
            $web_disabled = "disabled";
            $the_file = ROOT_PATH . "/" . $setting['path']['template'] . "/default/list_cat_" . $cat_id . ".tpl";
            if (file_exists($the_file)) {
                $record['template'] = GetFile($the_file);
            }
        } else {
            $show_merge = "none";
            $record = array();
            $record['cat_id'] = 0;
            $record['web_id'] = 0;
            $record['cat_main'] = 0;
            $record['cat_name'] = "";
            $record['cat_idx'] = "";
            $record['cat_sub'] = "";
            $record['cat_keyword'] = "";
            $record['cat_comment'] = "";
            $record['cat_image'] = "";
            $record['cat_link'] = "";
            $record['view_lvl'] = 0;
            $record['view_lvl_org'] = 0;
            $record['notice'] = "";
            $record['notice_org'] = "";
            $record['cat_type'] = 0;
            $web_disabled = "";
            $record['cat_show_1'] = "checked";
            $record['cat_show_2'] = "checked";
            $record['cat_show_4'] = "checked";
            $record['cat_type_0'] = "selected";
            $record['cat_type_1'] = "";
            $record['cat_type_2'] = "";
            $record['cat_type_3'] = "";
            $record['template'] = "";
            if (!$GLOBALS['op_mode']) {
                $record['web_id'] = $setting['info']['web']['web_id'];
            }
        }
        $max_count = count($GLOBALS['website']);
        for ($i = 0; $i < $max_count; $i++) {
            $GLOBALS['website'][$i]['selected'] = $GLOBALS['website'][$i]['web_id'] == $record['web_id'] ? "selected" : "";
            $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]);
        }
        $tpl_tmp->Set_Variables($record);
        $cur_layer = 99;
        $max_count = count($news_cat);
        for ($i = 0; $i < $max_count; $i++) {
            if (($method == "edit" || !$GLOBALS['op_mode']) && $news_cat[$i]['web_id'] != $record['web_id']) {
                continue;
            }
            if ($group['power_cat'] != "all" && strpos(',' . $group['power_cat'] . ',', ',' . $news_cat[$i]['cat_id'] . ',') === false) {
                continue;
            }
            if ($news_cat[$i]['cat_id'] == $record['cat_id']) {
                $cur_layer = $news_cat[$i]['cat_layer'];
                continue;
            }
            //if(!empty($news_cat[$i]['cat_link'])) continue;
            if ($news_cat[$i]['cat_layer'] > $cur_layer) {
                continue;
            } else {
                $cur_layer = 99;
            }
            $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'], 'cat_name' => $news_cat[$i]['cat_name'], 'web_id' => $news_cat[$i]['web_id'], 'selected' => $record['cat_main'] == $news_cat[$i]['cat_id'] ? "selected" : ""));
        }
        $tpl_tmp->Set_Variable('title', $method == 'add' ? $setting['language']['admin_art_catalog_add'] : $setting['language']['admin_art_catalog_edit']);
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('show_merge', $show_merge);
        $tpl_tmp->Set_Variable('web_disabled', $web_disabled);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $tpl_tmp->Set_Variable('web_id', $setting['info']['web']['web_id']);
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}
Example #25
0
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;
}
Example #26
0
function build_page($method)
{
    global $mystep, $req, $db, $tpl, $group_id, $tpl_info, $admin_cat, $admin_cat_plat, $news_cat, $website, $setting;
    $tpl_info['idx'] = "user_group_" . ($method == "list" ? "list" : "input");
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    if ($method == "list") {
        $db->select($setting['db']['pre'] . "user_group", "*", "", array("order" => "group_id"));
        while ($record = $db->GetRS()) {
            HtmlTrans(&$record);
            if ($record['power_func'] == "all") {
                $record['power_func'] = $setting['language']['admin_user_group_power_all'];
            } elseif ($record['power_func'] == "") {
                $record['power_func'] = $setting['language']['admin_user_group_power_none'];
            } else {
                $thePowerFunc = explode(",", $record['power_func']);
                $record['power_func'] = "";
                $max_count = count($thePowerFunc);
                for ($i = 0; $i < $max_count; $i++) {
                    $theFunc = getParaInfo("admin_cat_plat", "id", $thePowerFunc[$i]);
                    $record['power_func'] .= $theFunc['name'] . ", ";
                }
                $record['power_func'] = substr($record['power_func'], 0, -2);
            }
            if ($record['power_cat'] == "all") {
                $record['power_cat'] = $setting['language']['admin_user_group_cat_all'];
            } elseif ($record['power_cat'] == "") {
                $record['power_cat'] = $setting['language']['admin_user_group_cat_none'];
            } else {
                $thePowerCata = explode(",", $record['power_cat']);
                $record['power_cat'] = "";
                $max_count = count($thePowerCata);
                for ($i = 0; $i < $max_count; $i++) {
                    $theCata = getParaInfo("news_cat", "cat_id", $thePowerCata[$i]);
                    $record['power_cat'] .= $theCata['cat_name'] . ", ";
                }
                $record['power_cat'] = substr($record['power_cat'], 0, -2);
            }
            if ($record['power_web'] == "all") {
                $record['power_web'] = $setting['language']['admin_user_group_web_all'];
            } elseif ($record['power_web'] == "") {
                $record['power_web'] = $setting['language']['admin_user_group_web_none'];
            } else {
                $thePowerWeb = explode(",", $record['power_web']);
                $record['power_web'] = "";
                $max_count = count($thePowerWeb);
                for ($i = 0; $i < $max_count; $i++) {
                    $theWeb = getParaInfo("website", "web_id", $thePowerWeb[$i]);
                    $record['power_web'] .= $theWeb['name'] . ", ";
                }
                $record['power_web'] = substr($record['power_web'], 0, -2);
            }
            $tpl_tmp->Set_Loop('record', $record);
        }
        $tpl_tmp->Set_Variable('title', $setting['language']['admin_user_group_title']);
    } else {
        $tpl_tmp->Set_Variable('title', $method == "add" ? $setting['language']['admin_user_group_add'] : $setting['language']['admin_user_group_edit']);
        if ($method == "edit") {
            $record = $db->record($setting['db']['pre'] . "user_group", "*", array("group_id", "n=", $group_id));
            if ($record === false) {
                $tpl->Set_Variable('main', showInfo($setting['language']['admin_user_group_error'], 0));
                $mystep->show($tpl);
                $mystep->pageEnd(false);
            }
        } else {
            $record['group_id'] = 0;
            $record['group_name'] = "";
            $record['power_func'] = "";
            $record['power_cat'] = "";
            $record['power_web'] = "";
        }
        $tpl_tmp->Set_Variables($record);
        $tpl_tmp->Set_Variable('power_web_all_checked', $record['power_web'] == "all" ? "checked" : "");
        $max_count = count($website);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop('power_web', array("web_id" => $website[$i]['web_id'], "name" => $website[$i]['name'], "checked" => strpos("," . $record['power_web'] . ",", "," . $website[$i]['web_id'] . ",") !== false ? "checked" : ""));
        }
        $tpl_tmp->Set_Variable('power_func_all_checked', $record['power_func'] == "all" ? "checked" : "");
        $max_count = count($admin_cat);
        for ($i = 0; $i < $max_count; $i++) {
            $tpl_tmp->Set_Loop('power_func', array("key" => $admin_cat[$i]['id'], "value" => $admin_cat[$i]['name'], "pid" => $admin_cat[$i]['pid'], "checked" => strpos("," . $record['power_func'] . ",", "," . $admin_cat[$i]['id'] . ",") !== false ? "checked" : ""));
            if (isset($admin_cat[$i]['sub'])) {
                $max_count1 = count($admin_cat[$i]['sub']);
                for ($j = 0; $j < $max_count1; $j++) {
                    $tpl_tmp->Set_Loop('power_func', array("key" => $admin_cat[$i]['sub'][$j]['id'], "value" => ($j + 1 == count($admin_cat[$i]['sub']) ? "©¸ " : "©À ") . $admin_cat[$i]['sub'][$j]['name'], "pid" => $admin_cat[$i]['sub'][$j]['pid'], "checked" => strpos("," . $record['power_func'] . ",", "," . $admin_cat[$i]['sub'][$j]['id'] . ",") !== false ? "checked" : ""));
                }
            }
        }
        $tpl_tmp->Set_Variable('power_cat_all_checked', $record['power_cat'] == "all" ? "checked" : "");
        $max_count = count($news_cat);
        for ($i = 0; $i < $max_count; $i++) {
            $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]['cat_name'] = preg_replace("/^©À /", "", preg_replace("/^©¸ /", "", $news_cat[$i]['cat_name']));
            $news_cat[$i]['checked'] = strpos("," . $record['power_cat'] . ",", "," . $news_cat[$i]['cat_id'] . ",") !== false ? "checked" : "";
            $tpl_tmp->Set_Loop('power_cat', $news_cat[$i]);
        }
        $tpl_tmp->Set_Variable('method', $method);
        $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER"));
    }
    $db->Free();
    $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting'));
    unset($tpl_tmp);
    $mystep->show($tpl);
    return;
}