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; }
public static function install() { global $setting; $info = self::info(); if ($plugin_info = getParaInfo("plugin", "idx", $info['idx'])) { showInfo(sprintf($setting['language']['plugin_err_dup'], $info['name'])); } if ($plugin_info = getParaInfo("plugin", "class", $info['class'])) { showInfo(sprintf($setting['language']['plugin_err_classname'], $info['name'])); } global $db, $admin_cat; $strFind = array("{pre}", "{charset}"); $strReplace = array($setting['db']['pre'], $setting['db']['charset']); $result = $db->ExeSqlFile(dirname(__FILE__) . "/install.sql", $strFind, $strReplace); $db->insert($setting['db']['pre'] . 'plugin', array(0, $info['name'], $info['idx'], $info['ver'], "plugin_news_mark", 1, $info['intro'], $info['copyright'], 1, ",")); $db->insert($setting['db']['pre'] . 'admin_cat', array(0, 7, $info['cat_name'], 'news_mark.php', '../plugin/news_mark/', 0, 0, $info['cat_desc'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_install'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { includeCache("admin_cat"); $admin_cat = toJson($admin_cat, $setting['gen']['charset']); echo <<<mystep <script language="javascript"> parent.admin_cat = {$admin_cat}; parent.setNav(); </script> mystep; buildParaList("plugin"); echo showInfo($setting['language']['plugin_install_done'], false); } }
public static function install() { global $setting; $info = self::info(); if ($plugin_info = getParaInfo("plugin", "idx", $info['idx'])) { showInfo(sprintf($setting['language']['plugin_err_dup'], $info['name'])); } if ($plugin_info = getParaInfo("plugin", "class", $info['class'])) { showInfo(sprintf($setting['language']['plugin_err_classname'], $info['name'])); } global $db, $admin_cat; $db->insert($setting['db']['pre'] . 'plugin', array(0, $info['name'], $info['idx'], $info['ver'], "plugin_source", 1, $info['intro'], $info['copyright'], 1, "")); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_install'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { buildParaList("plugin"); echo showInfo($setting['language']['plugin_install_done'], false); } }
public static function getMenuContent($cat_id, $web_id, $deep, $class = "", $all = "") { global $news_cat, $cache; if ($cat_id == 0) { $cat_id = ""; } $key = md5("Menu_" . $cat_id . "_" . $web_id . "_" . $deep); $result = $cache->get($key); if (!$result) { $result = ""; $last_idx = -1; $deep_start = 0; $deep_max = 0; $deep_cur = 0; $catInfo = getParaInfo("news_cat", "cat_id", $cat_id); if (!$catInfo) { $catInfo = array("cat_layer" => 1); } for ($i = 0, $m = count($news_cat); $i < $m; $i++) { if (!empty($web_id) && $web_id != $news_cat[$i]['web_id']) { continue; } if (empty($all)) { if ($deep_start == 0 && $news_cat[$i]['cat_layer'] != $catInfo['cat_layer']) { continue; } if (($news_cat[$i]['cat_show'] & 2) != 2) { if ($last_idx == -1 || $last_idx == $i - 1) { $last_idx = $i; } continue; } if ($deep_start > 0 && ($news_cat[$i]['cat_show'] & 2) == 2 && $last_idx != -1 && $news_cat[$last_idx]['cat_layer'] < $news_cat[$i]['cat_layer']) { continue; } } $last_idx = -1; //if(empty($all) && (($news_cat[$i]['cat_show'] & 2)!=2 || ($deep_start==0 && $news_cat[$i]['cat_layer']>$catInfo['cat_layer']))) continue; if ($deep_start > 0) { $theLink = $news_cat[$i]['cat_link']; if (empty($theLink)) { $theLink = getUrl("list", $news_cat[$i]['cat_idx'], 1, $news_cat[$i]['web_id']); } if ($deep_cur == $news_cat[$i]['cat_layer']) { if ($cat_id != "" && $cat_id != $news_cat[$i]['cat_id'] && $deep_start == $news_cat[$i]['cat_layer']) { break; } $result .= "</li>\n"; $result .= str_repeat("\t", $news_cat[$i]['cat_layer']) . "<li><a href=\"" . $theLink . "\">" . $news_cat[$i]['cat_name'] . "</a>"; } elseif ($deep_cur < $news_cat[$i]['cat_layer']) { if ($news_cat[$i]['cat_layer'] < $deep_max) { $result .= "<ul>\n"; $result .= str_repeat("\t", $news_cat[$i]['cat_layer']) . "<li><a href=\"" . $theLink . "\">" . $news_cat[$i]['cat_name'] . "</a>"; $deep_cur = $news_cat[$i]['cat_layer']; } } else { if ($news_cat[$i]['cat_layer'] > $deep_start || $cat_id == "") { $result .= "</li>\n" . str_repeat("\t", $deep_cur) . "</ul></li>\n"; for ($j = $deep_cur - $news_cat[$i]['cat_layer'] - 1; $j > 0; $j--) { $result .= str_repeat("\t", $j) . "</ul></li>\n"; } $result .= str_repeat("\t", $news_cat[$i]['cat_layer']) . "<li><a href=\"" . $theLink . "\">" . $news_cat[$i]['cat_name'] . "</a>"; $deep_cur = $news_cat[$i]['cat_layer']; } else { if ($cat_id != "") { break; } } } } else { if ($cat_id == $news_cat[$i]['cat_id'] || $cat_id == "") { $theLink = $news_cat[$i]['cat_link']; if (empty($theLink)) { $theLink = getUrl("list", $news_cat[$i]['cat_idx'], 1, $news_cat[$i]['web_id']); } $deep_cur = $news_cat[$i]['cat_layer']; $deep_start = $news_cat[$i]['cat_layer']; $deep_max = $deep_start + $deep; $result .= "<ul class=\"{$class}\">\n"; $result .= str_repeat("\t", $news_cat[$i]['cat_layer']) . "<li><a href=\"" . $theLink . "\">" . $news_cat[$i]['cat_name'] . "</a>"; } } } if (!empty($result)) { $result .= "</li>\n"; for ($i = $deep_cur - $deep_start; $i > 0; $i--) { $result .= str_repeat("\t", $i + 1) . "</ul></li>\n"; } $result .= "</ul>\n"; $cache->set($key, $result, 3600); } } return $result; }
} } $log_info = ""; switch ($method) { case "add": case "edit": case "list": build_page($method); break; case "delete": if (!$op_mode) { $goto_url = $setting['info']['self']; } else { $log_info = $setting['language']['admin_web_subweb_delete']; $web_id = $req->getGet("web_id"); if ($web_info = getParaInfo("website", "web_id", $web_id)) { $cfg_file = ROOT_PATH . "/include/config_" . $web_info['idx'] . ".php"; include $cfg_file; if ($setting['db']['name'] != $setting_sub['db']['name']) { $db->exec("drop", "database", $setting_sub['db']['name']); } elseif ($setting['db']['pre'] != $setting_sub['db']['pre']) { $db->exec("drop", "table", $setting_sub['db']['pre'] . "news_show"); $db->exec("drop", "table", $setting_sub['db']['pre'] . "news_detail"); $db->exec("drop", "table", $setting_sub['db']['pre'] . "news_tag"); } else { $db->update($setting['db']['pre'] . "news_cat", array("web_id" => 1), array("web_id", "n=", $web_id)); $db->update($setting['db']['pre'] . "news_show", array("web_id" => 1), array("web_id", "n=", $web_id)); } unlink($cfg_file); $db->delete($setting['db']['pre'] . "website", array("web_id", "n=", $web_id)); deleteCache("website");
<?php require "inc.php"; includeCache("link"); $method = $req->getGet("method"); if (empty($method)) { $method = "list"; } $id = $req->getReq("id"); $idx = $req->getReq("idx"); $log_info = ""; if (!empty($id)) { $cur_link = getParaInfo("link_txt", "id", $id); if ($cur_link == false) { $cur_link = getParaInfo("link_img", "id", $id); } if ($cur_link == false || !$op_mode && $web_id != $cur_link['web_id']) { echo showInfo($setting['language']['admin_func_link_error']); $mystep->pageEnd(false); } } switch ($method) { case "add": case "edit": case "list": build_page($method); break; case "delete": $log_info = $setting['language']['admin_func_link_delete']; $db->delete($setting['db']['pre'] . "links", array("id", "n=", $id)); deleteCache("link");
if ($article = getData($sql, "record")) { if ($cat_info = getParaInfo("news_cat", "cat_id", $article['cat_id'])) { $cat_idx = $cat_info['cat_idx']; } else { $cat_idx = ""; } $tpl_tmp->Set_Variable('article_prev_link', getUrl("read", array($article['news_id'], $cat_idx), 1, $setting['info']['web']['web_id'])); $tpl_tmp->Set_Variable('article_prev_text', $article['subject']); } else { $tpl_tmp->Set_Variable('article_prev_link', "###"); $tpl_tmp->Set_Variable('article_prev_text', ""); } //Next Article $sql = $db->buildSel($setting['db']['pre_sub'] . "news_show", "news_id, cat_id, subject, add_date", array("news_id", "n>", $news_id), array("order" => "news_id asc", "limit" => "1")); if ($article = getData($sql, "record")) { if ($cat_info = getParaInfo("news_cat", "cat_id", $article['cat_id'])) { $cat_idx = $cat_info['cat_idx']; } else { $cat_idx = ""; } $tpl_tmp->Set_Variable('article_next_link', getUrl("read", array($article['news_id'], $cat_idx), 1, $setting['info']['web']['web_id'])); $tpl_tmp->Set_Variable('article_next_text', $article['subject']); } else { $tpl_tmp->Set_Variable('article_next_link', "###"); $tpl_tmp->Set_Variable('article_next_text', ""); } //News Tag $tag = explode(",", $detail['tag']); $max_count = count($tag); for ($i = 0; $i < $max_count; $i++) { if ($setting['rewrite']['enable']) {
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'] = ' <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; }
$setting['gen']['minify'] = false; $usergroup = $req->getSession("usergroup"); if ($usergroup === 0) { $goto_url = $setting['web']['url']; //debug("usergroup",$goto_url); $mystep->pageEnd(false); } $group = getParaInfo("user_group", "group_id", $usergroup); if (empty($group['power_func'])) { $goto_url = "/" . $setting['path']['admin'] . "login.php"; //debug("power_func",$goto_url); $req->setCookie("referer", $req->getServer("REQUEST_URI"), 1000); $mystep->pageEnd(false); } $op_mode = $setting['info']['web']['web_id'] == 1 && ($group['power_func'] == "all" || strpos("," . $group['power_func'] . ",", ",1,") !== false); includeCache("admin_cat"); $cat_info = getParaInfo("admin_cat_plat", "file", $setting['info']['self'], true); $plugin_info = getParaInfo("plugin", "idx", basename($cat_info["path"])); if ($plugin_info['active'] == 0) { $cat_info = false; } if (!$op_mode) { $admin_cat = $admin_cat_plat; } if ($cat_info === false && !checkSign(8) || $group['power_func'] != "all" && strpos("," . $group['power_func'] . ",", "," . $cat_info['id'] . ",") === false) { echo showInfo($setting['language']['login_nopower'], false); $mystep->pageEnd(false); } if (!$op_mode) { $web_id = $setting['info']['web']['web_id']; }
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'] = " " . $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; }
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; }
$news_detail = array(); $news_detail['id'] = 0; $news_detail['news_id'] = 0; $news_detail['cat_id'] = 0; $news_detail['page'] = 1; $news_detail['sub_title'] = ""; $news_detail['content'] = ""; $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; } } if (isset($para['web_id']) && ($web_info = getParaInfo("website", "web_id", $para['web_id']))) { include ROOT_PATH . "/include/config_" . $web_info['idx'] . ".php"; } else { include ROOT_PATH . "/include/config_main.php"; } $setting_sub['db']['pre'] = $setting_sub['db']['name'] . "." . $setting_sub['db']['pre']; require "rule/" . $idx . "_import.php"; if (!empty($id)) { if ($record = $db->record($setting['db']['pre'] . "news_snatch", "*", array("id", "n=", $id))) { importData($record, $para); $db->delete($setting['db']['pre'] . "news_snatch", array("id", "n=", $id)); } $goto_url = $setting['info']['self'] . "?method=news"; } else { $id_list = array(); $db->select($setting['db']['pre'] . "news_snatch", "id", array("idx", "=", $idx), array("order" => "add_date asc, id asc"));
$condition[] = array("web_id", "n=", $web_id); if (!empty($keyword)) { $condition[] = array("subject", "like", $keyword, "and"); } $counter = $db->result($setting['db']['pre'] . "news_visit", "count(*)", $condition); list($page_arr, $page_start, $page_size) = GetPageList($counter, "?keyword={$keyword}&order={$order}&order_type={$order_type}", $page); $tpl->Set_Variables($page_arr); if (empty($order)) { $order = "news_id"; } $db->select($setting['db']['pre'] . "news_visit", "*", $condition, array("order" => "{$order} {$order_type}", "limit" => "{$page_start}, {$page_size}")); while ($record = $db->GetRS()) { HtmlTrans(&$record); $record['day_start'] = date("Y-m-d", $record['day_start']); $record['link'] = getUrl("read", array($record['news_id'], $record['cat_id']), 1, $record['web_id']); $catInfo = getParaInfo("news_cat", "cat_id", $record['cat_id']); $record['cat_id'] = $catInfo['cat_name']; $tpl->Set_Loop('record', $record); } $db->Free(); $tpl->Set_Variable('order_type_org', $order_type); if ($order_type == "desc") { $order_type = "asc"; } else { $order_type = "desc"; } $tpl->Set_Variable('order', $order); $tpl->Set_Variable('order_type', $order_type); $tpl->Set_Variable('path_admin', $setting['path']['admin']); $tpl->Set_Variable('title', $info['name']); $tpl->Set_Variable('web_id', $web_id);
<?php $ms_sign = 1; require "inc.php"; $cat_idx = strtolower($req->getGet("cat")); if ($cat_info = getParaInfo("news_cat", "cat_idx", $cat_idx)) { $web_info = getSubSetting($cat_info['web_id']); } else { $cat_idx = ""; $web_info = getSubSetting($setting['info']['web']['web_id']); } $tpl_info['idx'] = "rss"; if ($setting['gen']['cache']) { $cache_info = array('idx' => "rss_" . $web_info["info"]["web_id"] . (empty($cat_idx) ? "" : "_{$cat_info[cat_id]}"), 'path' => $cache_path . "/rss/", 'expire' => getCacheExpire()); } else { $cache_info = false; } $tpl = $mystep->getInstance("MyTpl", $tpl_info, $cache_info); if ($tpl->Is_Cached()) { echo $tpl->Get_Content(); $mystep->pageEnd(false); } if (empty($cat_idx)) { $cat_txt = $setting['language']['page_all_news']; } else { $cat_txt = $cat_info['cat_name']; $setting['web']['description'] .= ", " . $cat_info['cat_comment']; } $cat_txt .= sprintf($setting['language']['page_update_lastest'], $setting['list']['rss']); $charset_tag = '<?xml version="1.0" encoding="' . $setting['gen']['charset'] . '"?>' . "\n"; $tpl->Set_Variable('charset_tag', $charset_tag);
$sub_list = $cat_info['cat_sub']; } $menu_cat_id = $cat_id; if (isset($cat_info['cat_type'])) { if ($cat_info['cat_type'] == 3) { $tpl_info['idx'] = "list_cat_" . $cat_id; } else { $tpl_info['idx'] = "list_" . $cat_info['cat_type']; } } else { $tpl_info['idx'] = "list"; } $cat_main_link = ""; if ($cat_main > 0) { $menu_cat_id = $cat_main; if ($cat_info = getParaInfo("news_cat_sub", "cat_id", $cat_main)) { $cat_main_link = '<a href="' . getUrl("list", $cat_info['cat_idx'], 1, $cat_info['web_id']) . '">' . $cat_info['cat_name'] . '</a>'; } } $condition = array(); if ($cat_id == 0) { $condition[] = array("b.cat_main", "n=", 0); } else { $condition[] = array(array("a.cat_id", "n=", $cat_id), array("b.cat_main", "n=", $cat_id, "or")); } $condition_ext = ""; if (!empty($prefix)) { $prefix = htmlspecialchars($prefix); $condition[] = array("subject", "like", "[" . $prefix . "]%", "and"); $condition_ext = $db->buildCondition(array("subject", "like", "[" . $prefix . "]%")); }
function build_page($method) { global $mystep, $req, $tpl, $tpl_info, $plugin, $setting, $idx, $plugin_path, $website; $tpl_info['idx'] = "web_plugin_" . $method; $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info); $tpl_tmp->allow_script = true; if ($method == "list") { if ($plugin_info = json_decode(GetRemoteContent($setting['gen']['update'] . "/plugin.php?l=" . $setting['gen']['language']))) { foreach ($plugin_info as $key => $value) { $update_info[$key] = array(); $update_info[$key]['idx'] = $key; $update_info[$key]['name'] = getString($value->name); $update_info[$key]['ver'] = $value->ver; $update_info[$key]['intro'] = getString($value->intro); } unset($plugin_info); } else { $update_info = array(); } $fso = $mystep->getInstance("MyFSO"); $plugin_list = $fso->Get_List($plugin_path); $max_count = count($plugin_list['dir']); $n = 0; for ($i = 0; $i < $max_count; $i++) { if (is_file($plugin_list['dir'][$i] . "/info.php")) { $info = array(); include $plugin_list['dir'][$i] . "/info.php"; $update_info_hash = array(); if (isset($info['update_url'])) { if (isset($update_info_hash[md5($info['update_url'])])) { $plugin_info_remote = $update_info_hash[md5($info['update_url'])]; } else { if ($plugin_info_remote = json_decode(GetRemoteContent($info['update_url'] . "/plugin.php?l=" . $setting['gen']['language']))) { $update_info_hash[md5($info['update_url'])] = $plugin_info_remote; } else { $plugin_info_remote = new stdClass(); } } if (isset($plugin_info_remote->{$info}['idx'])) { $update_info[$info['idx']] = array(); $update_info[$info['idx']]['idx'] = $info['idx']; $update_info[$info['idx']]['name'] = getString($plugin_info_remote->{$info}['idx']->name); $update_info[$info['idx']]['ver'] = $plugin_info_remote->{$info}['idx']->ver; $update_info[$info['idx']]['intro'] = getString($plugin_info_remote->{$info}['idx']->intro); } } if (isset($update_info[$info['idx']]) && $info['ver'] < $update_info[$info['idx']]['ver']) { $info['ver_new'] = $update_info[$info['idx']]['ver']; $info['update'] = ""; } else { $info['ver_new'] = ""; $info['update'] = "none"; } if ($plugin_info = getParaInfo("plugin", "idx", $info['idx'])) { $info['order'] = $plugin_info['order']; $info['active'] = $plugin_info['active'] ? $setting['language']['close'] : $setting['language']['open']; $tpl_tmp->Set_Loop("plugin_list_1", $info); } else { $n++; $tpl_tmp->Set_Loop("plugin_list_2", $info); } unset($update_info[$info['idx']]); } } foreach ($update_info as $key => $value) { $tpl_tmp->Set_Loop("plugin_list_3", $value); } $tpl_tmp->Set_If('empty_2', $n == 0); $tpl_tmp->Set_If('empty_3', count($update_info) == 0); $tpl_tmp->Set_Variable('self', $setting['info']['self']); $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_plugin_title']); global $db; $db->select($setting['db']['pre'] . "admin_cat", "file, count(*) as counter", array("file", "!=", "###"), array("group" => "file", "having" => array("counter", "n>", 1))); $dp_list = ""; while ($cur = $db->getRS()) { $dp_list .= $cur['file'] . " (" . $cur['counter'] . ")\\n"; } $tpl_tmp->Set_Variable('dp_list', $dp_list); } elseif ($method == "setting") { $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_plugin_setup']); $plugin_info = getParaInfo("plugin", "idx", $idx); include $plugin_path . $idx . "/info.php"; if ($plugin_info === false) { $tpl->Set_Variable('main', showInfo($setting['language']['admin_web_plugin_err'], 0)); $mystep->show($tpl); $mystep->pageEnd(false); } $max_count = count($website); for ($i = 0; $i < $max_count; $i++) { $tpl_tmp->Set_Loop('subweb', array("web_id" => $website[$i]['web_id'], "name" => $website[$i]['name'], "checked" => strpos($plugin_info['subweb'], "," . $website[$i]['web_id'] . ",") !== false ? "checked" : "")); } $info['description'] = nl2br($info['description']); $tpl_tmp->Set_Variable('idx', $plugin_info['idx']); $tpl_tmp->Set_Variable('name', $plugin_info['name']); $tpl_tmp->Set_Variable('subweb', $plugin_info['subweb']); $tpl_tmp->Set_Variable('description', $info['description']); $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER")); } 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)); } else { $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_plugin_install']); include $plugin_path . $idx . "/info.php"; $info['description'] = nl2br($info['description']); $tpl_tmp->Set_Variables($info); $tpl_tmp->Set_Variable('back_url', $req->getServer("HTTP_REFERER")); $max_count = count($website); for ($i = 0; $i < $max_count; $i++) { $tpl_tmp->Set_Loop('subweb', array("web_id" => $website[$i]['web_id'], "name" => $website[$i]['name'], "checked" => "")); } include $plugin_path . $idx . "/class.php"; $check_info = call_user_func(array($info['class'], "check")); $color = "black"; $info = $check_info; if (empty($check_info)) { $color = "green"; $info = $setting['language']['admin_web_plugin_check_ok']; } $check_info = '<span style="color:' . $color . '">' . $info . '</span>'; $tpl_tmp->Set_Variable('check', $check_info); $tpl_tmp->Set_Variable('subweb', ""); } $tpl->Set_Variable('main', $tpl_tmp->Get_Content('$db, $setting, $idx')); unset($tpl_tmp); $mystep->show($tpl); return; }
public function pageStart($setPlugin = false) { global $setting, $db, $req, $cache; ob_start(); ob_implicit_flush(false); $setting['cookie']['prefix'] .= substr(md5($_SERVER["USERNAME"] . $_SERVER["COMPUTERNAME"] . $_SERVER["OS"]), 0, 4) . "_"; if ($setting['session']['mode'] == "sess_file") { $setting['session']['path'] = ROOT_PATH . "/" . $setting['path']['cache'] . "/session/" . date("Ymd") . "/"; } $req = $this->getInstance("MyReq", $setting['cookie'], $setting['session']); $db = $this->getInstance("MySQL", $setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']); $cache = $this->getInstance("MyCache", $setting['web']['cache_mode']); includeCache("website"); includeCache("user_group"); includeCache("user_type"); $setting['info'] = array(); $setting['info']['time'] = $_SERVER['REQUEST_TIME']; $setting['info']['time_start'] = GetMicrotime(); $setting['info']['self'] = strtolower(basename($req->getServer("PHP_SELF"))); $setting['info']['web'] = null; $host = $req->getServer("HTTP_HOST"); for ($i = 0, $m = count($GLOBALS['website']); $i < $m; $i++) { if (strpos("," . $GLOBALS['website'][$i]['host'] . ",", "," . $host . ",") !== false) { $GLOBALS['website'][$i]['host'] = $host; $setting['web']['url'] = "http://" . $host; $setting['info']['web'] = $GLOBALS['website'][$i]; break; } } if (is_null($setting['info']['web'])) { $setting['info']['web'] = $GLOBALS['website'][0]; } if ($setting['info']['web'] === false) { $setting['info']['web'] = getParaInfo("website", "web_id", 1); } $setting_sub = getSubSetting($setting['info']['web']['web_id']); $setting_sub['web']['url'] = $setting['web']['url']; $setting['db_sub'] = $setting_sub['db']; if ($setting['db']['name'] == $setting_sub['db']['name']) { $setting['db']['pre_sub'] = $setting_sub['db']['pre']; } else { $setting['db']['pre_sub'] = $setting_sub['db']['name'] . "." . $setting_sub['db']['pre']; } unset($setting_sub['db']); $setting = arrayMerge($setting, $setting_sub); $req->init($setting['cookie'], $setting['session']); if ($setPlugin) { $this->setPlugin(); } $this->getLanguage(ROOT_PATH . "/source/language/"); $setting['language'] = $this->language; $req->SessionStart($GLOBALS['sess_handle']); $max_count = count($this->func_start); for ($i = 0; $i < $max_count; $i++) { call_user_func($this->func_start[$i]); } if (checkSign(1)) { return; } $username = $req->getSession("username"); if (empty($username) || $username == "Guest") { $this->logcheck(); } $req->setSession("url", "http://" . $req->getServer("HTTP_HOST") . $req->getServer("URL")); $req->setSession("ip", GetIp()); $setting['info']['user'] = array(); $setting['info']['user']['name'] = $req->getSession("username"); $setting['info']['user']['group'] = getParaInfo("user_group", "group_id", $req->getSession('usergroup')); $setting['info']['user']['type'] = getParaInfo("user_type", "type_id", $req->getSession('usertype')); if ($setting['info']['user']['type'] === false) { $setting['info']['user']['type'] = array('type_id' => '1', 'type_name' => 'Guest', 'view_lvl' => '0'); } $this->regAjax("reset_psw", "MyStep::ajax_reset_psw"); }
if (empty($method)) { $method = "list"; } $power_id = $req->getReq("power_id"); $log_info = ""; includeCache("user_power"); switch ($method) { case "add": case "edit": case "list": build_page($method); break; case "delete": $log_info = $setting['language']['admin_user_power_delete']; $db->delete($setting['db']['pre'] . "user_power", array("power_id", "n=", $power_id)); $powerInfo = getParaInfo("user_power", "power_id", $power_id); $db->delete($setting['db']['pre'] . "user_power", array("power_id", "n=", $power_id)); $db->exec("alter", "table", $setting['db']['pre'] . "user_type", "drop", $powerInfo['idx']); deleteCache("user_type"); deleteCache("user_power"); break; case "add_ok": case "edit_ok": if (count($_POST) == 0) { $goto_url = $setting['info']['self']; } else { $formatList = array('string' => " Char(100) NOT NULL DEFAULT ''", 'digital' => " INT NOT NULL DEFAULT 0", 'date' => " Date NOT NULL DEFAULT '0000-00-00'", 'time' => " Time NOT NULL DEFAULT '00:00:00'"); if (empty($_POST['format']) || !isset($formatList[$_POST['format']])) { $_POST['format'] = "string"; } $theFormat = $formatList[$_POST['format']];
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("&", "&", $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'] = " " . $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; }
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'] = " " . $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'] = " " . $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; }
$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); $mystep->show($tpl); $mystep->pageEnd(false);
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'] = " " . $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; }
if (!empty($group['power_func']) && $method != "logout") { $goto_url = "./index.php"; $mystep->pageEnd(false); } } else { if (empty($group['power_func'])) { $goto_url = "./login.php"; $req->setCookie("referer", $req->getServer("REQUEST_URI"), 1000); $mystep->pageEnd(false); } if ($group['power_web'] != "all" && strpos("," . $group['power_web'] . ",", "," . $setting['info']['web']['web_id'] . ",") === false) { echo showInfo($setting['language']['admin_nopower'], false); $mystep->pageEnd(false); } includeCache("admin_cat"); if ($group['power_func'] != "all" && ($cat_info = getParaInfo("admin_cat_plat", "file", $setting['info']['self']))) { if (strpos("," . $group['power_func'] . ",", "," . $cat_info['id'] . ",") === false) { echo showInfo($setting['language']['admin_nopower'], false); $mystep->pageEnd(false); } } } $op_mode = $setting['info']['web']['web_id'] == 1 && ($group['power_func'] == "all" || strpos("," . $group['power_func'] . ",", ",1,") !== false); $tpl_info = array("idx" => "main", "style" => $op_mode ? "admin" : "admin_simple", "path" => ROOT_PATH . "/" . $setting['path']['template']); $tpl = $mystep->getInstance("MyTpl", $tpl_info); if (!$op_mode) { $web_id = $setting['info']['web']['web_id']; } if ($op_mode && $req->getReq("web_id") != "") { $web_id = $req->getReq("web_id"); }
includeCache("website"); includeCache("news_cat", false); $tpl->Set_Variable("username", $req->getSession('username')); $tpl->Set_Variable("usergroup", $group['group_name']); $tpl->Set_Variable("web_id", $web_id); $tpl->Set_Variable("group", toJson($group, $setting['gen']['charset'])); if ($op_mode) { $tpl->Set_Variable("admin_cat", toJson($admin_cat, $setting['gen']['charset'])); } else { $tpl->Set_Variable("admin_cat", toJson($admin_cat_plat, $setting['gen']['charset'])); if ($group['power_func'] == "all") { $first_page = "art_content.php"; } else { $power_list = explode(",", $group['power_func']); for ($i = 0, $m = count($power_list); $i < $m; $i++) { $first_page = getParaInfo("admin_cat_plat", "id", array_shift($power_list)); if ($first_page !== false && strpos($first_page['file'], "#") === false) { break; } } if ($first_page == false) { $goto_url = "/"; $mystep->pageEnd(false); } $first_page = $first_page['url']; } $tpl->Set_Variable("first_page", $first_page); } $tpl->Set_Variable("website", toJson($website, $setting['gen']['charset'])); $tpl->Set_Variable("news_cat", toJson($news_cat, $setting['gen']['charset'])); $tpl->Set_Variable("year", date('Y'));