本文整理汇总了PHP中toJson函数的典型用法代码示例。如果您正苦于以下问题:PHP toJson函数的具体用法?PHP toJson怎么用?PHP toJson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toJson函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: toJson
/**
* 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
}
开发者ID:swarajsaaj,项目名称:pnr,代码行数:65,代码来源:Pnr.php
示例2: uninstall
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);
}
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:29,代码来源:class.php
示例3: run
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;
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:28,代码来源:myapi.class.php
示例4: addAnnotation
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));
}
}
开发者ID:asalov,项目名称:vehicles_network,代码行数:8,代码来源:AnalystController.php
示例5: toJson
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));
}
}
开发者ID:bajian,项目名称:js-web-skills,代码行数:20,代码来源:test_json_gbk.php
示例6: build_page
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;
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:43,代码来源:web_subweb.php
示例7: build_page
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;
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:85,代码来源:web_template.php
示例8: json_decode
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);
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:update.php
示例9: Array
$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', "###");
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:read.php
示例10: mysql_query
$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);
}
开发者ID:s12113122,项目名称:Trip,代码行数:31,代码来源:action.php
示例11: strrchr
$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');
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:attachment.php
示例12: PostContactsTransactionalDataUpdate
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()));
}
开发者ID:RobertPlant,项目名称:dotMailer-API-v2-PHP-client,代码行数:5,代码来源:Resources.php
示例13: GetImageSize
$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);
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:upload.php
示例14: build_list
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;
}
开发者ID:laiello,项目名称:mystep-cms,代码行数:30,代码来源:class.php
示例15: define
<?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
开发者ID:laiello,项目名称:mystep-cms,代码行数:30,代码来源:setting.js.php
示例16: import_log
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");
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:news_snatch.php
示例17: build_page
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;
}
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:mystep-cms,代码行数:101,代码来源:art_catalog.php
示例18: getEvent
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));
}
开发者ID:s12113122,项目名称:Trip,代码行数:5,代码来源:function.php
示例19: get_task
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) . ')';
开发者ID:Kristuff,项目名称:twidoo,代码行数:30,代码来源:action.php
示例20: GetFile
$update_info['content'][$i] = GetFile($the_file);
$p
|
请发表评论