/** * toJson() converts a PHP array to JSON, incldues support for older versions of PHP * @param Array $arr - Array that is to be converted to JSON * @return JSON string */ function toJson($arr) { if (function_exists('json_encode')) { return json_encode($arr); } $parts = array(); $is_list = false; //Find out if the given array is a numerical array $keys = array_keys($arr); $max_length = count($arr) - 1; if ($keys[0] == 0 and $keys[$max_length] == $max_length) { //See if the first key is 0 and last key is length - 1 $is_list = true; for ($i = 0; $i < count($keys); $i++) { //See if each key correspondes to its position if ($i != $keys[$i]) { //A key fails at position check. $is_list = false; //It is an associative array. break; } } } foreach ($arr as $key => $value) { if (is_array($value)) { //Custom handling for arrays if ($is_list) { $parts[] = toJson($value); } else { $parts[] = '"' . $key . '":' . toJson($value); } /* :RECURSION: */ } else { $str = ''; if (!$is_list) { $str = '"' . $key . '":'; } //Custom handling for multiple data types if (is_numeric($value)) { $str .= $value; } elseif ($value === false) { $str .= 'false'; } elseif ($value === true) { $str .= 'true'; } else { $str .= '"' . addslashes($value) . '"'; } //All other things // :TODO: Is there any more datatype we should be in the lookout for? (Object?) $parts[] = $str; } } $json = implode(',', $parts); if ($is_list) { return '[' . $json . ']'; } //Return numerical JSON return '{' . $json . '}'; //Return associative JSON }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->delete($setting['db']['pre'] . "survey"); $db->exec("drop", "table", $setting['db']['pre'] . "survey"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "like", "survey.php%")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\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; MultiDel(ROOT_PATH . "/" . $setting['path']['cache'] . "/plugin/survey/"); MultiDel(dirname(__FILE__) . "/data/"); MakeDir(dirname(__FILE__) . "/data/"); buildParaList("plugin"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
public static function uninstall() { global $db, $setting, $admin_cat, $mystep; $info = self::info(); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "xcode.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\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 { $mydb = $mystep->getInstance("MyDB", "code", dirname(__FILE__)); $record = $mydb->queryAll(); for ($i = 0; $i < count($record); $i++) { unlink(dirname(__FILE__) . "/code/" . $record[$i]['idx'] . ".php"); } $mydb->emptyTBL(); unset($mydb); 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_uninstall_done'], false); } }
public function run($method, $para = array(), $return = "", $charset = "utf-8") { $result = ""; if (isset($this->methods[$method])) { $result = call_user_func_array($this->methods[$method], $para); } if (empty($charset)) { $charset = "utf-8"; } switch ($return) { case "j": case "json": $result = toJson($result, $charset); break; case "x": case "xml": $result = '<?xml version="1.0" encoding="' . $charset . '"?>' . "\n<mystep>\n" . toXML($result) . "</mystep>"; header('Content-Type: application/xml; charset=' . $charset); break; case "s": case "string": $result = toString($result); break; default: break; } return $result; }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->delete($setting['db']['pre'] . "news_mark"); $db->exec("drop", "table", $setting['db']['pre'] . "news_mark"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "news_mark.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\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_uninstall_done'], false); } }
public function addAnnotation() { if ($this->authModel->checkPermissions('add_notes')) { $vehicleId = $_POST['vehicle_id']; $text = $_POST['text']; echo toJson($this->vehicleModel->addVehicleAnnotation($this->authModel->getUserData('id'), $vehicleId, $text)); } }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->select($setting['db']['pre'] . "custom_form", "mid"); $sql_list = array(); while ($record = $db->GetRS()) { $sql_list[] = "truncate table " . $setting['db']['pre'] . "custom_form_" . $record['mid']; $sql_list[] = "drop table " . $setting['db']['pre'] . "custom_form_" . $record['mid']; unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_submit_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_submit_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_list_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_list_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_block_cf_list_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_block_cf_list_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_mail_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_mail_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_edit_data.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_list_data.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_ext_script.php"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}.php"); } $db->Free(); $db->BatchExec($sql_list); include "config.php"; if (isset($catid) && $catid != 0) { $db->delete($setting['db']['pre'] . "admin_cat", array("pid", "n=", $catid)); } $db->delete($setting['db']['pre'] . "custom_form"); $db->exec("drop", "table", $setting['db']['pre'] . "custom_form"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "like", "custom_form.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\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"); WriteFile(dirname(__FILE__) . "/config.php", '<?php $catid = 0; ?>', "wb"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
function toJson($content) { //不支持单个文字 if (is_string($content)) { return urlencode($content); } elseif (is_array($content)) { foreach ($content as $key => $val) { $content[$key] = toJson($val); } return urldecode(json_encode($content)); } elseif (is_object($content)) { $vars = get_object_vars($content); foreach ($vars as $key => $val) { $content->{$key} = toJson($val); } return urldecode(json_encode($content)); } else { return urldecode(json_encode($content)); } }
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; }
function build_page($method = "") { global $mystep, $req, $tpl, $tpl_info, $setting, $idx, $tpl_path, $method; $fso = $mystep->getInstance("MyFSO"); $tpl_info['idx'] = "web_template"; if ($method != "show") { $tpl_info['idx'] .= $method == "list" ? "_list" : "_input"; } $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info); if ($method == "show") { $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_template_title']); $tpl_tmp->Set_Variable('tpl_idx', $idx); $tpl_list = $fso->Get_List($tpl_path); $max_count = count($tpl_list['dir']); $the_list = array(); for ($i = 0; $i < $max_count; $i++) { $tpl_list['dir'][$i] = basename($tpl_list['dir'][$i]); if ($tpl_list['dir'][$i] == "cache" || strpos($tpl_list['dir'][$i], "admin") !== false) { continue; } $tpl_tmp->Set_Loop("tpl_list", array("idx" => $tpl_list['dir'][$i], "img" => is_file($tpl_path . $tpl_list['dir'][$i] . "/sample.jpg") ? "/" . $setting['path']['template'] . "/" . $tpl_list['dir'][$i] . "/sample.jpg" : "/images/noimage.gif")); $the_list[] = $tpl_list['dir'][$i]; } $tpl_tmp->Set_Variable('tpl_list', toJson($the_list, $setting['gen']['charset'])); $max_count = count($GLOBALS['website']); for ($i = 0; $i < $max_count; $i++) { $setting_sub = getSubSetting($GLOBALS['website'][$i]['web_id']); $GLOBALS['website'][$i]['tpl'] = $setting_sub['gen']['template']; $tpl_tmp->Set_Loop("website", $GLOBALS['website'][$i]); } } elseif ($method == "list") { $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_template_title']); $tpl_tmp->Set_Variable('tpl_idx', $idx); $tpl_list = $fso->Get_List($tpl_path); $max_count = count($tpl_list['dir']); for ($i = 0; $i < $max_count; $i++) { $tpl_list['dir'][$i] = basename($tpl_list['dir'][$i]); if ($tpl_list['dir'][$i] == "cache") { continue; } $tpl_tmp->Set_Loop("tpl_list", array("idx" => $tpl_list['dir'][$i], "selected" => $tpl_list['dir'][$i] == $idx ? "selected" : "")); } $css_file = ROOT_PATH . "/images/" . $idx . "/style.css"; if (is_file($css_file)) { $tpl_tmp->Set_Loop("file", array("name" => "style.css", "size" => GetFileSize(filesize($css_file)), "attr" => $fso->Get_Attrib(substr(DecOct(fileperms($css_file)), -3)), "time" => date("Y/m/d H:i:s", filemtime($css_file)))); } $file_list = $fso->Get_Tree($tpl_path . $idx, false, ".tpl"); foreach ($file_list as $key => $value) { $curFile = $value; $curFile['name'] = $key; $tpl_tmp->Set_Loop("file", $curFile); } } else { $file = array(); $file['idx'] = $idx; $file['content'] = ""; if ($method == "edit") { $file['name'] = $req->getGet("file"); if ($file['name'] == "style.css") { $the_file = ROOT_PATH . "/images/" . $idx . "/style.css"; $file['type'] = "css"; } else { $the_file = $tpl_path . $idx . "/" . $file['name']; $file['type'] = "htmlmixed"; } if (is_file($the_file)) { $file['content'] = file_get_contents($the_file); $file['content'] = htmlspecialchars($file['content']); $file['content'] = str_replace("\t", " ", $file['content']); } $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_template_edit']); } else { $file['name'] = ""; $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_template_add']); } $tpl_tmp->Set_Variable('readonly', $method == "edit" ? "readonly" : ""); $tpl_tmp->Set_Variables($file, "file"); } $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); $mystep->show($tpl); return; }
if (!empty($check_info)) { $check_info = json_decode($check_info); $the_file = ROOT_PATH . "/cache/checkfile.php"; if (file_exists($the_file)) { rename($the_file, $the_file . ".bak"); } $file_list = $check_info->file_list; $file_list_md5 = $check_info->file_list_md5; unset($check_info); $content = "<?php\n"; $content .= '$file_list = ' . var_export($file_list, true) . ";\n"; $content .= '$file_list_md5 = ' . var_export($file_list_md5, true) . ";\n"; $content .= "?>"; WriteFile($the_file, $content, "wb"); $result = checkFile(); echo toJson($result, $setting['gen']['charset']); @unlink($the_file); if (file_exists($the_file . ".bak")) { rename($the_file . ".bak", $the_file); } } else { echo "error"; } break; case "u_update": $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST"); $header['ms_sign'] = $setting['web']['sign']; $update_info = GetRemoteContent($setting['gen']['update'] . "?m=u_update&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header); if (!empty($update_info)) { $update_info = preg_replace("/(^|[\r\n]+)([\\w]{0,6})[\r\n]+/", "", $update_info); $update_info = base64_decode($update_info);
$tpl_tmp->Set_Variable('sub_page', 'new Array()'); } else { $sql = $db->buildSel($setting['db']['pre_sub'] . "news_detail", "sub_title, page", array("news_id", "n=", $news_id), array("order" => "page")); $result = getData($sql, "all", 1200); $max_count = count($result); for ($i = 0; $i < $max_count; $i++) { $result[$i]['url'] = getUrl("read", array($news_id, $cat_idx), $result[$i]['page'], $setting['info']['web']['web_id']); if ($result[$i]['page'] == $page) { $result[$i]['selected'] = "selected"; } $result[$i]['txt'] = sprintf($setting['language']['page_no'], $result[$i]['page']); if (!empty($result[$i]['sub_title'])) { $result[$i]['txt'] .= " - " . $result[$i]['sub_title']; } } $tpl_tmp->Set_Variable('sub_page', toJson($result, $setting['gen']['charset'])); $tpl_tmp->Set_Variable('link_all', getUrl("read", array($news_id, $cat_idx), "all", $setting['info']['web']['web_id'])); unset($result); } //Prev. 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 desc", "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_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', "###");
$aid = $_GET["aid"]; $result = mysql_query("SELECT r.ActivityId, r.Title, r.price, m.Name, m.ImgSrc AS UserImg, r.Status, r.StartDay, DATEDIFF( r.EndDay, r.StartDay ) AS DiffDate, r.ApplyStop, r.Content, rank.rank,o.Join, pk.Watch, pl.place,r.ImgSrc AS TripImg FROM `activityrecord` AS r INNER JOIN activityplan AS p LEFT OUTER JOIN ( SELECT r.ActivityId, COUNT( o.UserId ) AS 'Join' FROM activityrecord AS r LEFT OUTER JOIN orderform AS o ON o.ActivityId = r.ActivityId GROUP BY r.ActivityId ) AS o ON o.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT r.ActivityId, COUNT( p.UserId ) AS 'Watch' FROM activityrecord AS r LEFT OUTER JOIN pocket AS p ON p.ActivityId = r.ActivityId GROUP BY r.ActivityId ) AS pk ON pk.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT ActivityId, GROUP_CONCAT( place ORDER BY PlanStep ) AS Place FROM `activityplan` GROUP BY ActivityId ) AS pl ON pl.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT `UserId` , `Name` , `ImgSrc` FROM `member` ) AS m ON m.UserId= r.UserId LEFT OUTER JOIN (SELECT a.userid, COUNT( c.rank ) AS Rank FROM activityrecord AS a LEFT OUTER JOIN orderform AS b ON b.ActivityId = a.ActivityId LEFT OUTER JOIN rank AS c ON c.OrderId = b.OrderId GROUP BY a.userid) AS rank ON rank.UserId= r.UserId WHERE r.ActivityId = " . $aid . " GROUP BY r.ActivityId"); $record_count = mysql_num_rows($result); if ($record_count < 1) { break; } $view = view('activity', toJson($result)); echo $view; $result = mysql_query("SELECT `Title`,`PlanStep`,`place`,`Content`,`ImgSrc` FROM `activityplan` WHERE `ActivityId` = '" . $aid . "' ORDER BY PlanStep"); $record_count = mysql_num_rows($result); if ($record_count < 1) { break; } $view = view('activity-plan', toJson($result)); echo $view; $result = mysql_query("SELECT q.UserId, u.Name, u.Imgsrc,q.Question,q.Answer,q.ActivityId,q.CreateDate FROM activityissue AS q INNER JOIN( SELECT UserId,Name,ImgSrc FROM member ) AS u ON u.UserId = q.UserId WHERE `ActivityId` = '" . $aid . "' ORDER BY q.CreateDate DESC"); $record_count = mysql_num_rows($result); if ($record_count < 1) { break; } $view = view('activity-review', toJson($result)); echo $view; break; } function toJson($result) { while ($r = mysql_fetch_assoc($result)) { $rows[] = $r; } return $jsonString = json_encode($rows); }
$ext = strrchr($upload->upload_result[$i]['name'], "."); $name = str_replace($ext, "", $upload->upload_result[$i]['name']); rename($path_upload . $upload->upload_result[$i]['new_name'], $path_upload . str_replace(".upload", "", str_replace($ext, "", $upload->upload_result[$i]['new_name']))); $upload->upload_result[$i]['name'] = substrPro($name, 0, 80) . $ext; $upload->upload_result[$i]['new_name'] = str_replace(".upload", "", $upload->upload_result[$i]['new_name']); $files[] = array(str_replace($ext, "", $upload->upload_result[$i]['new_name']), $upload->upload_result[$i]['name'], $upload->upload_result[$i]['type'], $_POST['embed'][$i]); $message[] = $upload->upload_result[$i]['name'] . " - " . $setting['language']['plugin_email_upload_done']; } else { $message[] = $upload->upload_result[$i]['name'] . " - " . $setting['language']['plugin_email_upload_failed'] . " - " . $upload->upload_result[$i]['message']; } } $message = implode("\\n", $message); if (!empty($message)) { $script = ' alert("' . $message . '"); setAttachment(' . toJson($files, $setting['gen']['charset']) . '); '; } } break; default: break; } build_page(); $mystep->pageEnd(false); function build_page() { global $mystep, $setting, $script; $tpl_info = array("idx" => "attachment", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']); $tpl = $mystep->getInstance("MyTpl", $tpl_info); $Max_size = ini_get('upload_max_filesize');
public function PostContactsTransactionalDataUpdate($collectionName, $importId, ApiJsonData $apiJsonData) { $url = sprintf("contacts/transactional-data/%s/%s", $collectionName, $importId); return new ApiTransactionalData($this->execute($url, 'POST', $apiJsonData > toJson())); }
$new_id = $db->GetInsertId(); if ($new_id != 0) { $upload->upload_result[0]['att_id'] = $new_id; if (strpos($upload->upload_result[0]['type'], "image") === 0) { $upload->MakeDir("{$path_upload}/preview/"); $img_info = GetImageSize("{$path_upload}/" . $upload->upload_result[0]['new_name']); $the_width = $img_info[0]; $the_height = $img_info[1]; $zoom = 400; if ($the_width > $zoom) { $the_height *= $zoom / $the_width; $the_width = (int) $zoom; img_thumb($path_upload . "/" . $upload->upload_result[0]['new_name'], $the_width, $the_height, $path_upload . "/preview/" . $upload->upload_result[0]['new_name']); } else { copy($path_upload . "/" . $upload->upload_result[0]['new_name'], $path_upload . "/preview/" . $upload->upload_result[0]['new_name']); } } $script .= "parent.document.forms[0].attach_list.value += '{$new_id}|';\n"; $err_msg[] = $upload->upload_result[0]['name'] . " - " . $setting['language']['admin_attachment_upload_done']; } else { unlink("{$path_upload}/" . $upload->upload_result[0]['new_name']); $upload->upload_result[0]['att_id'] = 0; $upload->upload_result[0]['error'] = 10; $upload->upload_result[0]['message'] = $setting['language']['admin_attachment_upload_dberr']; } } else { $upload->upload_result[0]['att_id'] = 0; } echo toJson($upload->upload_result[0], $setting['gen']['charset']); /*att_id, name, new_name, type, tmp_name, error, size, message*/ $mystep->pageEnd(false);
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; }
<?php $ms_sign = 1; $etag_expires = 604800; define('ROOT_PATH', str_replace("\\", "/", realpath(dirname(__FILE__) . "/../"))); require ROOT_PATH . "/include/config.php"; require ROOT_PATH . "/include/parameter.php"; require ROOT_PATH . "/source/function/etag.php"; require ROOT_PATH . "/source/function/global.php"; require ROOT_PATH . "/source/function/web.php"; require ROOT_PATH . "/source/class/abstract.class.php"; require ROOT_PATH . "/source/class/mystep.class.php"; $mystep = new MyStep(); $mystep->pageStart(true); header('Content-Type: application/x-javascript'); $cache_file = ROOT_PATH . "/" . $setting['path']['cache'] . "script/" . $setting['info']['web']['idx'] . "_setting.js"; if (file_exists($cache_file) && filemtime($cache_file) + $etag_expires > $setting['info']['time_start'] / 1000) { $result = GetFile($cache_file); } else { $result = ""; $result .= "var ms_setting = " . toJson($setting['js'], $setting['gen']['charset']) . ";\n"; $result .= "ms_setting.lang = \"" . $setting['gen']['language'] . "\";"; WriteFile($cache_file, $result, "wb"); } header("Accept-Ranges: bytes"); header("Accept-Length: " . strlen($result)); echo $result; $mystep->pageEnd(false); ?> D:/Website/mystep/aa.txtD:/Website/mystep/aa.txt
import_log('<div class="page">' . sprintf($setting['language']['plugin_news_import_done'], $i) . '</div>'); } import_log('<div class="split">-------------------------------</div>'); import_log('<div class="page">' . date("Y-m-d H:i:s") . '</div>'); $goto_url = $setting['info']['self']; break; case "rule_import": $script = ""; if (count($_POST) > 0) { $path_upload = $setting['path']['upload'] . "/tmp/" . date("Ym") . "/"; $upload = new MyUploader(); $upload->init(ROOT_PATH . "/" . $path_upload, true); $upload->DoIt(false); if ($upload->upload_result[0]['error'] == 0) { $theFile = ROOT_PATH . "/" . $path_upload . "/" . $upload->upload_result[0]['new_name']; $code = toJson(unserialize(base64_decode(file_get_contents($theFile))), $setting['gen']['charset']); $script = "\r\n\t\t\t\t\tvar theOLE = null;\r\n\t\t\t\t\ttheOLE = parent.parent || parent.dialogArguments || parent.opener;\r\n\t\t\t\t\ttheOLE.newRule = {$code};\r\n\t\t\t\t\ttheOLE.importRule();\r\n\t\t\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\t\t\t\r\n\t\t\t\t"; $script = str_replace("<!-- pagebreak -->", "<pagebreak>", $script); unlink($theFile); } else { $script = "\r\n\t\t\t\t\talert('" . $upload->upload_result[0]['message'] . "');\r\n\t\t\t\t\tif(parent.parent==null){parent.close();}else{parent.parent.\$.closePopupLayer();}\r\n\t\t\t\t"; } unset($upload); } build_page("upload"); break; case "rule_export": $log_info = $setting['language']['plugin_news_snatch_export']; $cur_rule = $rules[$id]; $cur_rule['para'] = var_export($cur_rule['para'], true); $cur_rule['rule_snatch'] = GetFile("rule/" . $cur_rule['idx'] . "_snatch.php");
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; }
function getEvent() { $sql = "SELECT r.ActivityId, r.Title, r.price, m.Name, m.ImgSrc AS UserImg, r.Status, r.StartDay, DATEDIFF( r.EndDay, r.StartDay ) AS DiffDate, r.ApplyStop, r.Content, rank.rank,o.Join, pk.Watch, pl.place,r.ImgSrc AS TripImg FROM `activityrecord` AS r INNER JOIN activityplan AS p LEFT OUTER JOIN ( SELECT r.ActivityId, COUNT( o.UserId ) AS 'Join' FROM activityrecord AS r LEFT OUTER JOIN orderform AS o ON o.ActivityId = r.ActivityId GROUP BY r.ActivityId ) AS o ON o.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT r.ActivityId, COUNT( p.UserId ) AS 'Watch' FROM activityrecord AS r LEFT OUTER JOIN pocket AS p ON p.ActivityId = r.ActivityId GROUP BY r.ActivityId ) AS pk ON pk.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT ActivityId, GROUP_CONCAT( place ORDER BY PlanStep ) AS Place FROM `activityplan` GROUP BY ActivityId ) AS pl ON pl.ActivityId = r.ActivityId LEFT OUTER JOIN (SELECT `UserId` , `Name` , `ImgSrc` FROM `member` ) AS m ON m.UserId= r.UserId LEFT OUTER JOIN (SELECT a.userid, COUNT( c.rank ) AS Rank FROM activityrecord AS a LEFT OUTER JOIN orderform AS b ON b.ActivityId = a.ActivityId LEFT OUTER JOIN rank AS c ON c.OrderId = b.OrderId GROUP BY a.userid) AS rank ON rank.UserId= r.UserId GROUP BY r.ActivityId"; return toJson(mysql_query($sql)); }
case 'changeTaskState': if ($myUser != false) { $task = get_task($_['i']); $task['s'] = $_['s']; update_task($task); } else { $return['error'] = 'Vous devez étre connecté pour effectuer cette action'; } break; case 'login': if ($_['login'] == USER_LOGIN && $_['password'] == USER_PASSWORD) { $myUser = new stdClass(); $myUser->login = USER_LOGIN; $myUser->password = USER_PASSWORD; $_SESSION['currentUser'] = serialize($myUser); } header('location: ./index.php'); break; case 'logout': $_SESSION = array(); session_unset(); session_destroy(); header('location: ./index.php'); break; default: $return['error'] = 'Aucune action définie'; break; } $return['state'] = !isset($return['error']) ? 1 : 0; echo '(' . toJson($return) . ')';
$update_info['content'][$i] = GetFile($the_file); $path_parts = pathinfo($update_info['file'][$i]); if (!empty($cs) && strpos(".php,.tpl,.html,.htm,.sql", $path_parts["extension"]) !== false) { $update_info['content'][$i] = str_ireplace(strtolower($setting['gen']['charset']), strtolower($cs), $update_info['content'][$i]); $update_info['content'][$i] = str_ireplace(strtoupper($setting['gen']['charset']), strtoupper($cs), $update_info['content'][$i]); $update_info['content'][$i] = chg_charset($update_info['content'][$i], $setting['gen']['charset'], $cs); } } } else { $update_info['content'][$i] = ""; } } $update = base64_encode(serialize($update_info)); WriteFile($cache_file, $update, "wb"); } echo $update; } else { $fso = new MyFSO(); $dir_list = $fso->Get_List($plugin_path); $plugin_list = array(); for ($i = 0, $m = count($dir_list['dir']); $i < $m; $i++) { if (file_exists($dir_list['dir'][$i] . "/ignore")) { continue; } if (is_file($dir_list['dir'][$i] . "/info.php")) { include $dir_list['dir'][$i] . "/info.php"; $plugin_list[$info['idx']] = array('name' => $info['name'], 'ver' => $info['ver'], 'intro' => $info['intro']); } } echo toJson($plugin_list, $setting['gen']['charset']); }
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; }
/** * */ public static function array_2_other_charset_json($content, $incharset = 'utf-8', $outcharset = "gbk") { return toJson($content, $incharset, $outcharset); }
case "u_update": if ($version_u > $v) { $u_info = array_shift($version); $u_info['content'] = array(); for ($i = 0, $m = count($u_info['file']); $i < $m; $i++) { if (file_exists(ROOT_PATH . "/" . $u_info['file'][$i])) { if (is_dir(ROOT_PATH . "/" . $u_info['file'][$i])) { $u_info['content'][$i] = "."; } else { $u_info['content'][$i] = GetFile(ROOT_PATH . "/" . $u_info['file'][$i]); $path_parts = pathinfo($u_info['file'][$i]); if (!empty($cs) && strpos(".php,.tpl,.html,.htm,.sql", $path_parts["extension"]) !== false) { $u_info['content'][$i] = str_ireplace(strtolower($setting['gen']['charset']), strtolower($cs), $u_info['content'][$i]); $u_info['content'][$i] = str_ireplace(strtoupper($setting['gen']['charset']), strtoupper($cs), $u_info['content'][$i]); $u_info['content'][$i] = chg_charset($u_info['content'][$i], $setting['gen']['charset'], $cs); } } } else { $u_info['content'][$i] = ""; } } } echo base64_encode(serialize($u_info)); break; default: $last_update = array_pop($version); $ms_version['update'] = preg_replace("/[\r\n]+\\s+/", "\n", $last_update['info']); echo toJson($ms_version, $setting['gen']['charset']); break; } $db->close();
$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')); $tpl->Set_Variables($ms_version, "ms_version"); $mystep->show($tpl); $mystep->pageEnd(false);