function processRequest() { $token = getRequestParameter("token"); $page = getRequestParameter("page"); $action = getRequestParameter("action"); if (empty($token)) { die("please provide a token"); } if (empty($page)) { $page = "start"; } if (empty($action)) { $action = "read"; } if ($action == "read") { echo getPageFromDatabase($token, $page); } else { if ($action == "edit") { displayEditor($token, $page); } else { if ($action == "save") { // overwrite existing page $options = getRequestParameter("options"); $content = getRequestParameter("content"); @header('Content-type: application/json'); echo json_encode(savePageToDatabase($token, $page, $content, $options)); } else { if ($action == "upload") { $url = getRequestParameter("url"); $raw_options = getRequestParameter("uploadOptions"); $options = array(); if (!empty($raw_options)) { $options = json_decode($raw_options); } uploadWebsiteToDatabase($token, $page, $url, $options); } } } } }
} } } } //выводит текстовое поле для написания коммента function displayEditor() { // форма для написания коммента echo '<form action="7.php" method="GET">'; echo '<textarea name="comment" rows="10" cols="55">' . '</textarea>'; echo '</br>'; echo '<input type="submit" value="отправить комментарий">'; echo '</form>'; } //считываем все комментраии из файла $commentsStack = file('7.txt'); $seporator = '[endOfComment]'; //проверяем, был ли введен коментарий if ($_GET) { $formatedComment = $_GET['comment'] . $seporator; array_push($commentsStack, $formatedComment); //после того как поместили комент - очищаем GET в адресной строке header('Location: http://localhost:8080/homeworks/functions_forms_tasks/7.php'); $f = fopen('7.txt', 'a+'); fwrite($f, $formatedComment); displayComment($commentsStack); displayEditor(); } else { displayComment($commentsStack); displayEditor(); }
function handleAction($content) { $startStr = ''; $endStr = ''; $ActionList = ''; $splStr = ''; $action = ''; $s = ''; $HandYes = ''; $startStr = '{$'; $endStr = '$}'; $ActionList = GetArray($content, $startStr, $endStr, true, true); //Call echo("ActionList ", ActionList) $splStr = aspSplit($ActionList, '$Array$'); foreach ($splStr as $key => $s) { $action = aspTrim($s); $action = HandleInModule($action, 'start'); //处理\'替换掉 if ($action != '') { $action = aspTrim(mid($action, 3, len($action) - 4)) . ' '; //call echo("s",s) $HandYes = true; //处理为真 //{VB #} 这种是放在图片路径里,目的是为了在VB里不处理这个路径 if (CheckFunValue($action, '# ') == true) { $action = ''; //测试 } else { if (CheckFunValue($action, 'GetLableValue ') == true) { $action = XY_getLableValue($action); //标题在搜索引擎里列表 } else { if (CheckFunValue($action, 'TitleInSearchEngineList ') == true) { $action = XY_TitleInSearchEngineList($action); //加载文件 } else { if (CheckFunValue($action, 'Include ') == true) { $action = XY_Include($action); //栏目列表 } else { if (CheckFunValue($action, 'ColumnList ') == true) { $action = XY_AP_ColumnList($action); //文章列表 } else { if (CheckFunValue($action, 'ArticleList ') == true || CheckFunValue($action, 'CustomInfoList ') == true) { $action = XY_AP_ArticleList($action); //评论列表 } else { if (CheckFunValue($action, 'CommentList ') == true) { $action = XY_AP_CommentList($action); //搜索统计列表 } else { if (CheckFunValue($action, 'SearchStatList ') == true) { $action = XY_AP_SearchStatList($action); //友情链接列表 } else { if (CheckFunValue($action, 'Links ') == true) { $action = XY_AP_Links($action); //显示单页内容 } else { if (CheckFunValue($action, 'GetOnePageBody ') == true || CheckFunValue($action, 'MainInfo ') == true) { $action = XY_AP_GetOnePageBody($action); //显示文章内容 } else { if (CheckFunValue($action, 'GetArticleBody ') == true) { $action = XY_AP_GetArticleBody($action); //显示栏目内容 } else { if (CheckFunValue($action, 'GetColumnBody ') == true) { $action = XY_AP_GetColumnBody($action); //获得栏目URL } else { if (CheckFunValue($action, 'GetColumnUrl ') == true) { $action = XY_GetColumnUrl($action); //获得文章URL } else { if (CheckFunValue($action, 'GetArticleUrl ') == true) { $action = XY_GetArticleUrl($action); //获得单页URL } else { if (CheckFunValue($action, 'GetOnePageUrl ') == true) { $action = XY_GetOnePageUrl($action); //------------------- 模板模块区 ----------------------- //显示包裹块 作用不大 } else { if (CheckFunValue($action, 'DisplayWrap ') == true) { $action = XY_DisplayWrap($action); //显示布局 } else { if (CheckFunValue($action, 'Layout ') == true) { $action = XY_Layout($action); //显示模块 } else { if (CheckFunValue($action, 'Module ') == true) { $action = XY_Module($action); //读模块内容 } else { if (CheckFunValue($action, 'ReadTemplateModule ') == true) { $action = XY_ReadTemplateModule($action); //获得内容模块 20150108 } else { if (CheckFunValue($action, 'GetContentModule ') == true) { $action = XY_ReadTemplateModule($action); //读模板样式并设置标题与内容 软件里有个栏目Style进行设置 } else { if (CheckFunValue($action, 'ReadColumeSetTitle ') == true) { $action = XY_ReadColumeSetTitle($action); //------------------- 其它区 ----------------------- //显示JS渲染ASP/PHP/VB等程序的编辑器 } else { if (CheckFunValue($action, 'displayEditor ') == true) { $action = displayEditor($action); //Js版网站统计 } else { if (CheckFunValue($action, 'JsWebStat ') == true) { $action = XY_JsWebStat($action); //------------------- 链接区 ----------------------- //普通链接A } else { if (CheckFunValue($action, 'HrefA ') == true) { $action = XY_HrefA($action); //栏目菜单(引用后台栏目程序) } else { if (CheckFunValue($action, 'ColumnMenu ') == true) { $action = XY_AP_ColumnMenu($action); //------------------- 循环处理 ----------------------- //For循环处理 } else { if (CheckFunValue($action, 'ForArray ') == true) { $action = XY_ForArray($action); //------------------- 待分区 ----------------------- //网站底部 } else { if (CheckFunValue($action, 'WebSiteBottom ') == true || CheckFunValue($action, 'WebBottom ') == true) { $action = XY_AP_WebSiteBottom($action); //显示网站栏目 20160331 } else { if (CheckFunValue($action, 'DisplayWebColumn ') == true) { $action = XY_DisplayWebColumn($action); //URL加密 } else { if (CheckFunValue($action, 'escape ') == true) { $action = XY_escape($action); //URL解密 } else { if (CheckFunValue($action, 'unescape ') == true) { $action = XY_unescape($action); //asp与php版本 } else { if (CheckFunValue($action, 'EDITORTYPE ') == true) { $action = XY_EDITORTYPE($action); //获得网址 } else { if (CheckFunValue($action, 'getUrl ') == true) { $action = XY_getUrl($action); //暂时不屏蔽 } else { if (CheckFunValue($action, 'copyTemplateMaterial ') == true) { $action = ''; } else { if (CheckFunValue($action, 'clearCache ') == true) { $action = ''; } else { $HandYes = false; //处理为假 } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } //注意这样,有的则不显示 晕 And IsNul(action)=False if (isNul($action) == true) { $action = ''; } if ($HandYes == true) { $content = replace($content, $s, $action); } } } $handleAction = $content; return @$handleAction; }