function treatCreatorErrors(&$data, $creatorError) { if (is_string($creatorError)) { returnErrors($data, $creatorError); } else { if (strcmp($creatorError->typeError, EPCreatorErrors::$SYSTEM_ERROR) == 0) { returnErrors($data, $creatorError->textError); } else { if (strcmp($creatorError->typeError, EPCreatorErrors::$RULE_ERROR) == 0) { returnMessage($data, $creatorError->getTextOnly()); } else { returnErrors($data, "Unknown error ? : " . $creatorError->textError); } } } }
<?php session_start(); header("Content-Type:text/plain;charset=utf-8"); include_once 'fun.inc.php'; linkDB(); $uid = $_SESSION["uid"]; $data = returnMessage($uid); removeMessage($uid); echo json_encode($data, JSON_UNESCAPED_UNICODE);
$result = false; $message = ""; $data = null; $logged_in = ManagerActions::isLoggedIn(); if ($logged_in && isset($_POST['json'])) { //logged in $json = json_decode($_POST['json'], true); $folder_name = $json["folder_name"]; $folder_path = $json["folder_path"]; $illegal_chars = preg_match("/[\\/\\s\\\\]/", $folder_name); //4 /'s in a row match backslash if (!$illegal_chars && strlen($folder_name) > 0) { $f_path = $folder_path . "/" . $folder_name; $folder_pwd = $GLOBALS['index_path'] . "/" . $f_path; if (!is_dir($folder_pwd)) { if (mkdir($folder_pwd, 0774)) { $message = "Folder Added"; $result = true; $data = FileGetter::getDirectoryInfo($f_path); } else { $message = "Create Folder Failed"; } } else { $message = $folder_name . " is already in folder in " . $folder_path; } } else { $message = "Folder name can contain no spaces, or slashes"; } } echo returnMessage($result, $message, $data);
/** * @author : NanQi * @date : 20150423 09:44 * * @desc 返回错误信息,通过手动验证或自动验证得到错误信息 * @return boolean 验证失败直接返回错误 */ public function retError($errmsg = null, $errcode = null) { $code = empty($errcode) ? $this->getErrorCode() : $errcode; $error = empty($errmsg) ? $this->getError() : $errmsg; $matches = array(); if (preg_match('/\\[(\\d{3})\\](.+)/', $error, $matches)) { $code = $matches[1]; $error = $matches[2]; } $code = empty($code) ? 599 : $code; $error = empty($error) ? '操作失败' : $error; returnMessage($code, $error); }
function write_modrewrite($status) { if (false === ($lines = @file(BASE_DIR . ".htaccess")) or !is_file(BASE_DIR . ".htaccess")) { return ajax_return("error", false, returnMessage(false, getLanguageValue("error_read_htaccess")), true, true); } $change = false; foreach ($lines as $pos => $value) { if (strpos($value, "# mozilo generated not change from here to mozilo_end") !== false) { $change = true; continue; } if (strpos($value, "# mozilo_end") !== false) { break; } if ($change and strpos($value, "RewriteRule \\.html\$ index\\.php [QSA,L]") !== false) { $lines[$pos] = str_replace("# mozilo_change ", "", $lines[$pos]); if ($status == "false") { $lines[$pos] = "# mozilo_change " . $lines[$pos]; } } } if ($change and true != mo_file_put_contents(BASE_DIR . ".htaccess", implode("", $lines))) { return ajax_return("error", false, returnMessage(false, getLanguageValue("error_write_htaccess")), true, true); } return true; }
function get_Message($message) { global $LOGINCONF; global $ADMIN_CONF; $html = ""; if (!empty($message)) { if (is_array($message)) { foreach ($message as $inhalt) { $html .= $inhalt; } } else { $html .= $message; } } // Warnung, wenn seit dem letzten Login Logins fehlgeschlagen sind if ($LOGINCONF->get("falselogincount") > 0) { $html .= returnMessage(false, getLanguageValue("messages_false_logins") . " " . $LOGINCONF->get("falselogincount")); // Gesamt-Counter fuer falsche Logins zuruecksetzen $LOGINCONF->set("falselogincount", 0); } // Warnung, wenn die letzte Backupwarnung mehr als $intervallsetting Tage her ist if (ROOT or is_array($ADMIN_CONF->get("admin")) and in_array("backupmsgintervall", $ADMIN_CONF->get("admin"))) { $intervallsetting = $ADMIN_CONF->get("backupmsgintervall"); if ($intervallsetting != "" and $intervallsetting > 0) { $intervallinseconds = 60 * 60 * 24 * $intervallsetting; $lastbackup = $ADMIN_CONF->get("lastbackup"); // initial: nur setzen if ($lastbackup == "") { $ADMIN_CONF->set("lastbackup", time()); // wenn schon gesetzt: pruefen und ggfs. warnen } else { $nextbackup = $lastbackup + $intervallinseconds; if ($nextbackup <= time()) { $html .= '<span id="lastbackup">' . returnMessage(true, getLanguageValue("admin_messages_backup")) . '</span><span style="display:none;" id="lastbackup_yes">lastbackup_yes=true</span>'; } } } } if (strlen($html) > 1) { return '<div id="dialog-auto" style="display:none;">' . $html . '</div>'; } else { return ""; } }
function home() { require_once BASE_DIR_CMS . "Mail.php"; // Testmail schicken und gleich raus hier if (false !== ($test_mail_adresse = getRequestValue('test_mail_adresse', 'post')) and $test_mail_adresse != "") { header('content-type: text/html; charset=' . CHARSET . ''); global $specialchars; $test_mail_adresse = $specialchars->rebuildSpecialChars($test_mail_adresse, false, false); if (isMailAddressValid($test_mail_adresse)) { sendMail(getLanguageValue("home_mailtest_mailsubject"), getLanguageValue("home_mailtest_mailcontent"), $test_mail_adresse, $test_mail_adresse); ajax_return("success", true, returnMessage(true, getLanguageValue("home_messages_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true); } else { ajax_return("error", true, returnMessage(false, getLanguageValue("home_error_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true); } exit; } global $CMS_CONF; if ($CMS_CONF->get('usesitemap') == "true") { global $message; if (!is_file(BASE_DIR . 'robots.txt')) { if (true !== ($error_message = write_robots())) { $message .= $error_message; } } if (!is_file(BASE_DIR . 'sitemap.xml')) { if (true != ($error_message = write_xmlsitmap())) { $message .= $error_message; } } } // CMS-Hilfe $titel = "home_help"; if (file_exists(BASE_DIR . "docu/index.php")) { $error[$titel][] = false; $template[$titel][] = getLanguageValue("home_help_text_docu") . ' <a href="' . URL_BASE . 'docu/index.php" target="_blank" class="mo-butten-a-img"><img class="mo-icons-icon mo-icons-docu" src="' . ICON_URL_SLICE . '" alt="docu" hspace="0" vspace="0" border="0" /></a>'; $error[$titel][] = false; $template[$titel][] = getLanguageValue("home_help_text_info") . ' <a href="' . URL_BASE . 'docu/index.php?menu=false&artikel=start" target="_blank" class="js-docu-link mo-butten-a-img"><img class="mo-icons-icon mo-icons-help" src="' . ICON_URL_SLICE . '" alt="help" hspace="0" vspace="0" border="0" /></a>'; } else { $error[$titel][] = true; $template[$titel][] = getLanguageValue("home_no_help"); } // Zeile "Multiuser Reset" if (defined('MULTI_USER') and MULTI_USER) { $titel = "home_multiuser"; $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_multiuser_text"), '<form action="index.php?action=' . ACTION . '" method="post">' . '<input type="hidden" name="logout_other_users" value="true" />' . '<input type="submit" name="submitlogout_other_users" value="' . getLanguageValue("home_multiuser_button") . '" />' . '</form>'); } // CMS-INFOS $titel = "home_cmsinfo"; // Zeile "CMS-VERSION" $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_cmsversion_text"), CMSVERSION . ' ("' . CMSNAME . '")<br />' . getLanguageValue("home_cmsrevision_text") . ' ' . CMSREVISION); // Zeile "Gesamtgröße des CMS" $cmssize = convertFileSizeUnit(dirsize(BASE_DIR)); if ($cmssize === false) { $error[$titel][] = true; $cmssize = "0"; } else { $error[$titel][] = false; } $template[$titel][] = array(getLanguageValue("home_cmssize_text"), $cmssize); // Zeile "Installationspfad" und alle 40 Zeichen einen Zeilenumbruch einfügen $path = BASE_DIR; if (strlen($path) >= 40) { $path = explode("/", $path); if (is_array($path)) { if (empty($path[count($path) - 1])) { unset($path[count($path) - 1]); } $i = 0; $new_path[$i] = ""; foreach ($path as $string) { $string = $string . "/"; if (strlen($new_path[$i] . $string) <= 40) { $new_path[$i] = $new_path[$i] . $string; } else { $i++; $new_path[$i] = $string; } } } $path = implode("<br />", $new_path); } $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_installpath_text"), $path); // SERVER-INFOS $titel = "home_serverinfo"; // Aktueles Datum $error[$titel][] = false; $time_zone = date("T"); if (function_exists('date_default_timezone_get')) { $time_zone = @date_default_timezone_get(); } $template[$titel][] = array(getLanguageValue("home_date_text"), date("Y-m-d H.i.s") . " " . $time_zone); // Sprache $error[$titel][] = false; if (false !== ($locale = @setlocale(LC_TIME, "0"))) { $template[$titel][] = array(getLanguageValue("home_text_locale"), $locale); } else { $template[$titel][] = array(getLanguageValue("home_text_locale"), getLanguageValue("home_text_nolocale")); } // Zeile "PHP-Version" if (version_compare(PHP_VERSION, MIN_PHP_VERSION) >= 0) { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion()); } else { $error[$titel][] = getLanguageValue("home_error_phpversion_text"); $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion()); } // Zeile "Safe Mode" if (ini_get('safe_mode')) { $error[$titel][] = getLanguageValue("home_error_safe_mode"); $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("yes")); } else { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("no")); } // Zeile "GDlib installiert" if (!extension_loaded("gd")) { $error[$titel][] = getLanguageValue("home_error_gd"); $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("no")); } else { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("yes")); } if ($CMS_CONF->get('modrewrite') == "true") { # mod_rewrite wird mit javascript ermitelt und ausgetauscht $error[$titel][] = getLanguageValue("home_error_mod_rewrite"); $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("no")); } else { $error[$titel][] = false; $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("home_mod_rewrite_deact")); } # backupsystem if (function_exists('gzopen')) { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_backupsystem"), getLanguageValue("yes")); } else { $error[$titel][] = true; $template[$titel][] = array(getLanguageValue("home_error_backupsystem"), getLanguageValue("no")); } # MULTI_USER if (defined('MULTI_USER') and MULTI_USER) { $mu_string = ""; $rest_time = MULTI_USER_TIME; if ($rest_time >= 86400) { $mu_string .= floor(MULTI_USER_TIME / 86400) . " " . (floor(MULTI_USER_TIME / 86400) > 1 ? getLanguageValue("days") : getLanguageValue("day")) . " "; $rest_time = $rest_time - floor(MULTI_USER_TIME / 86400) * 86400; } if ($rest_time >= 3600) { $mu_string .= floor($rest_time / 3600) . " " . (floor($rest_time / 3600) > 1 ? getLanguageValue("hours") : getLanguageValue("hour")) . " "; $rest_time = $rest_time - floor($rest_time / 3600) * 3600; } if ($rest_time >= 60) { $mu_string .= floor($rest_time / 60) . " " . (floor($rest_time / 60) > 1 ? getLanguageValue("minutes") : getLanguageValue("minute")) . " "; $rest_time = $rest_time - floor($rest_time / 60) * 60; } if ($rest_time > 0) { $mu_string .= $rest_time . " " . ($rest_time > 1 ? getLanguageValue("seconds") : getLanguageValue("second")); } $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), $mu_string); } else { $error[$titel][] = true; $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), getLanguageValue("no")); } // E-Mail test if (isMailAvailable()) { $titel = "home_titel_test_mail"; $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_text_test_mail"), '<input type="text" class="mo-input-text" name="test_mail_adresse" value="" />'); } else { $titel = "home_titel_test_mail"; $error[$titel][] = true; $template[$titel][] = getLanguageValue("home_messages_no_mail"); } return contend_template($template, $error); }
function changeFromFtp() { global $message; global $specialchars; $success = false; $dirgallery = getDirAsArray(GALLERIES_DIR_REL, "dir"); foreach ($dirgallery as $currentgalerien) { $change = false; if (true !== ($error = setChmod(GALLERIES_DIR_REL . $currentgalerien))) { $message .= returnMessage(false, $error); return; } $test_galerie = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($currentgalerien, false, false), false); if ($test_galerie != $currentgalerien) { $nr = 0; $new_name = $test_galerie; while (in_array($new_name, $dirgallery)) { $new_name = "%23_" . $nr . "_" . $test_galerie; $nr++; } if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien, GALLERIES_DIR_REL . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; $currentgalerien = $new_name; } if (!is_dir(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME)) { if (true !== ($error = mkdirMulti(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME))) { $message .= returnMessage(false, $error); return; } $change = true; } if (!file_exists(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf.php")) { if (false === newConf(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf.php")) { $message .= returnMessage(false, getLanguageValue("gallery_error_subtitle_conf")); return; } $change = true; } $dirimg = getDirAsArray(GALLERIES_DIR_REL . $currentgalerien, "img"); foreach ($dirimg as $currentimg) { if (true !== ($error = setChmod(GALLERIES_DIR_REL . $currentgalerien . "/" . $currentimg))) { $message .= returnMessage(false, $error); return; } $test_img = cleanUploadFile($currentimg); if ($test_img != $currentimg) { $nr = 0; $new_name = $test_img; while (in_array($new_name, $dirimg)) { $new_name = "_" . $nr . "_" . $test_img; $nr++; } if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien . "/" . $currentimg, GALLERIES_DIR_REL . $currentgalerien . "/" . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; if (is_file(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $currentimg)) { if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $currentimg, GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; } } } if ($change) { $success .= "<b>" . $specialchars->rebuildSpecialChars($currentgalerien, false, true) . "</b><br />"; } } if ($success) { $message .= returnMessage(true, getLanguageValue("gallery_messages_from_ftp") . "<br /><br />" . $success); } else { $message .= returnMessage(true, getLanguageValue("gallery_messages_from_ftp_no") . ""); } }
public function login($username, $password) { $db = new database(); $db->query("SELECT password FROM tbl_user\n WHERE username = ?"); $db->bind(1, $username); $db->execute(); $user = $db->single(); if (!$user) { return returnError("Password incorrect"); } if (!password_verify($password, $user->password)) { return returnError("Password incorrect"); } else { $db->query("SELECT uid, username, email, rank, status\n FROM tbl_user\n WHERE username = :username"); $db->bind(':username', $username); $db->execute(); $login = $db->single(); if ($login->status == 0) { return returnMessage("Your account is awaiting activation. Please try again at a later time."); } else { $_SESSION['uid'] = $login->uid; $_SESSION['app'] = APP_NAME; $this->username = $login->username; $this->status = $login->status; $this->uid = $login->uid; $this->rank = $login->rank; $app = new app(); $app->logEvent("LI", "{$this->username} logged in"); return returnSuccess("You are now logged in as {$this->username}"); } } }
/** * 错误输出 * @param mixed $error 错误 * @return void */ public static function halt($error) { $e = array(); $isShow = C('UN_SHOW_ERROR_PAGE'); if ($isShow) { returnMessage(999, $error['message']); } // 发送404信息 header('HTTP/1.1 404 Not Found'); header('Status:404 Not Found'); if (APP_DEBUG || IS_CLI) { //调试模式下输出错误信息 if (!is_array($error)) { $trace = debug_backtrace(); $e['message'] = $error; $e['file'] = $trace[0]['file']; $e['line'] = $trace[0]['line']; ob_start(); debug_print_backtrace(); $e['trace'] = ob_get_clean(); } else { $e = $error; } if (IS_CLI) { exit(iconv('UTF-8', 'gbk', $e['message']) . PHP_EOL . 'FILE: ' . $e['file'] . '(' . $e['line'] . ')' . PHP_EOL . $e['trace']); } } else { //否则定向到错误页面 $error_page = C('ERROR_PAGE'); if (!empty($error_page)) { redirect($error_page); } else { $message = is_array($error) ? $error['message'] : $error; $e['message'] = C('SHOW_ERROR_MSG') ? $message : C('ERROR_MESSAGE'); } } // 包含异常页面模板 $exceptionFile = C('TMPL_EXCEPTION_FILE', null, THINK_PATH . 'Tpl/think_exception.tpl'); include $exceptionFile; exit; }
} else { $cursor = $db_getter->getBlogManagePosts($page_num, $cat); } $posts = iterator_to_array($cursor); if (count($posts) > $GLOBALS['amount_on_manger_tab']) { array_pop($posts); $next = true; } else { $next = false; } $parsedown = new Parsedown(); $post_views = new PostViews($parsedown); $modified_array = array(); $post_template = file_get_contents($GLOBALS['template_dir'] . "/blog_post.txt"); foreach ($posts as $row) { $post_cat = strlen($cat) > 0 ? $cat : $row["category"][0]; //when viewing all posts/search cat will be empty string so use base cat $modified_row = $post_views->generateModifedListingForPostInfo($row, $post_cat); $row["show_id"] = true; //show_id on template, so manager page JavaScript can identify them $post_html = $post_views->makePostHtmlFromData($row, $post_cat, $post_template); array_push($modified_array, array("post_data" => $modified_row, "post_html" => $post_html)); } $prev = $page_num > 1 ? true : false; $data = array("posts" => $modified_array, "next" => $next, "prev" => $prev); header('Content-Type: application/json; charset=utf-8'); echo json_encode(array("result" => true, "data" => $data)); } catch (MongoCursorException $e) { echo returnMessage(false, 'ERROR:' . $e->getMessage(), null); } }
function get_page($cat, $page) { global $CatPage; $cat = $CatPage->get_FileSystemName($cat, false); $page = $CatPage->get_FileSystemName($cat, $page); if ($CatPage->get_Type($cat, $page) != EXT_LINK) { if (false !== ($pagecontent = get_contents_ace_edit(CONTENT_DIR_REL . $cat . '/' . $page))) { return ajax_return("success", false) . '<textarea id="page-content">' . $pagecontent . '</textarea>'; } } return ajax_return("error", false, returnMessage(false, getLanguageValue("editor_content_error_open")), true, true); }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php function displayMessage($FirstMessage) { echo "<p>{$FirstMessage}</p>"; } function returnMessage() { return "<p>This message was returned from a function.</p>"; } displayMessage("This message was displayed from a function."); $ReturnValue = returnMessage(); echo $ReturnValue; ?> </body> </html>
function template_del() { global $specialchars; global $message; global $debug; $template_del = getRequestValue('template-del', 'post'); if (is_array($template_del)) { foreach ($template_del as $template) { $debug .= "del=" . $template . "<br />\n"; if (true !== ($error = deleteDir(BASE_DIR . LAYOUT_DIR_NAME . "/" . $specialchars->replaceSpecialChars($template, false)))) { $message .= $error; } } } else { $message .= returnMessage(false, getLanguageValue("error_post_parameter")); } }
function login_formular($enabled, $error_lang = false) { # das "error" wird gebraucht damit bei einer ajax anfrage der login erscheint $form = '<div class="error mo-login-box js-dialog-content js-dialog-reload">'; $enabled_css = "ui-state-highlight"; $enabled_input = ""; if (!$enabled) { $enabled_css = "ui-state-error"; $enabled_input = ' readonly="readonly"'; } if ($error_lang !== false) { $form .= '<div class="mo-login_message_fehler ui-widget-content ui-state-error ui-corner-all ui-helper-clearfix">' . returnMessage(false, getLanguageValue($error_lang)) . "</div>"; if ($error_lang == "install_login") { return $form . '</div>'; } } $form .= '<div class="mo-login ' . $enabled_css . ' ui-corner-all">'; if ($enabled) { $form .= '<form accept-charset="' . CHARSET . '" name="loginform" action="' . URL_BASE . ADMIN_DIR_NAME . "/index.php" . '" method="post">'; } $form .= '<table width="100%" cellspacing="10" border="0" cellpadding="0">' . "<tr>" . '<td width="1%" rowspan="2" align="center" valign="middle">' . '<img src="' . ICON_URL . 'login.png" alt="Login" />' . "</td>" . '<td width="1%" class="mo-nowrap">' . getLanguageValue("username") . ":" . "</td>" . "<td>" . '<input class="mo-login_input" type="text" size="15" name="username" autocomplete="off"' . $enabled_input . ' />' . "</td>" . "</tr>" . "<tr>" . '<td class="mo-nowrap">' . getLanguageValue("password") . ":" . "</td>" . "<td>" . '<input class="mo-login_input" type="password" size="15" name="password" autocomplete="off"' . $enabled_input . ' />' . "</td>" . "</tr>" . "<tr>" . '<td colspan="3" class="mo-align-center">' . '<input name="login" value="Login" class="mo-login_submit" type="submit"' . $enabled_input . ' />' . "</td>" . "</tr>" . "</table>"; if ($enabled) { $form .= "</form>"; } $form .= '</div></div>'; return $form; }
/** * 返回分页数据 * @param $countnum 总条数 * @param $data 数据 */ protected function retPager($countnum, $data) { $data = empty($data) ? array() : $data; returnMessage(200, $data, array('countnum' => $countnum)); }
function set_config_para() { global $CMS_CONF, $specialchars; $title = ""; $main = makeDefaultConf("main"); unset($main['expert']); foreach ($main as $type => $type_array) { foreach ($main[$type] as $syntax_name => $dumy) { if (false === ($syntax_value = getRequestValue($syntax_name, 'post'))) { continue; } if ($type == 'text') { if ($CMS_CONF->get($syntax_name) != $syntax_value) { $CMS_CONF->set($syntax_name, $syntax_value); if ($syntax_name == "websitetitle") { $title = '<span id="replace-item"><span id="admin-websitetitle" class="mo-bold mo-td-middle">' . $specialchars->rebuildSpecialChars($syntax_value, false, true) . '</span></span>'; } } } if ($type == 'checkbox') { if ($syntax_value != "true" and $syntax_value != "false") { return ajax_return("error", false, returnMessage(false, getLanguageValue("properties_error_save")), true, true); } # die checkbox hat immer einen anderen wert als der gespeicherte deshalb keine prüfung $CMS_CONF->set($syntax_name, $syntax_value); if ($syntax_name == "modrewrite" and true !== ($error = write_modrewrite($syntax_value))) { return $error; } if ($syntax_name == "usesitemap") { if (true !== ($error = write_robots())) { return $error; } if (true != ($error = write_xmlsitmap(true))) { return $error; } } } } } return ajax_return("success", false) . $title; }
function plugin_install($zip = false) { if (!function_exists('gzopen')) { return; } global $debug; @set_time_limit(600); global $message, $specialchars; $dir = PLUGIN_DIR_REL; if ($zip === false) { $zip_file = $dir . $specialchars->replaceSpecialChars($_FILES["plugin-install-file"]["name"], false); } else { if (getChmod() !== false) { setChmod($dir . $zip); } $zip_file = $dir . $zip; } $debug .= $zip_file . "<br />"; # if(true === (move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file))) { if ($zip !== false and strlen($zip_file) > strlen($dir) or $zip === false and true === move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file)) { require_once BASE_DIR_ADMIN . "pclzip.lib.php"; $archive = new PclZip($zip_file); if (0 != ($file_list = $archive->listContent())) { uasort($file_list, "helpUasort"); $find = installFindPlugins($file_list, $archive); if (count($find) > 0) { foreach ($find as $liste) { if (strlen($liste['index']) > 0) { $debug .= '<pre>'; $debug .= var_export($liste, true); $debug .= '</pre>'; if (getChmod() !== false) { $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_OPT_SET_CHMOD, getChmod(), PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER); setChmod($dir . $liste['name']); } else { $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER); } } else { # die file strucktur im zip stimt nicht $message .= returnMessage(false, getLanguageValue("error_zip_structure")); } } } else { # die file strucktur im zip stimt nicht $message .= returnMessage(false, getLanguageValue("error_zip_structure")); } } else { # scheint kein gühltiges zip zu sein $message .= returnMessage(false, getLanguageValue("error_zip_nozip") . "<br />" . $zip_file); } unlink($zip_file); } else { # das zip konnte nicht hochgeladen werden $message .= returnMessage(false, getLanguageValue("error_file_upload") . "<br />" . $zip_file); } }
header("Location: http://{$url}"); exit; } # nur reingehen wenn action home ist oder es noch keine get parameter gibt } elseif (getRequestValue('multi', 'get') or !getRequestValue('multi', 'get') and !$tmp_action) { $USERS->set($id, "freetab"); } # im FileUpload wird der tab besetzt mit window.location.href behandelt if (getRequestValue('fileupload', 'get')) { $url = $_SERVER['HTTP_HOST'] . URL_BASE . ADMIN_DIR_NAME . '/index.php?nojs=true&action=home&multi=true'; $USERS->set($id, "busy#" . getRequestValue('fileupload', 'get')); header("Location: http://{$url}"); exit; # hier gehts um die anfragen die von ajax kommen } elseif (!getRequestValue('multi', 'get') and in_array(getRequestValue('action'), $users_array)) { ajax_return("error", true, returnMessage(false, getLanguageValue("error_multi_user_tab", false, getLanguageValue(getRequestValue('action') . "_button"), MULTI_USER_TIME)), true, true); } unset($id); } if (in_array($tmp_action, $array_tabs)) { define("ACTION", $tmp_action); } else { define("ACTION", "home"); } unset($tmp_action); if (file_exists(BASE_DIR_ADMIN . ACTION . '.php')) { require_once BASE_DIR_ADMIN . ACTION . '.php'; } else { die("Fatal Error File doesn't exist: " . ACTION . ".php"); } $func = ACTION;
<?php include_once dirname(__FILE__) . "/../configs.php"; $result = false; $message = "File Not Found"; $logged_in = ManagerActions::isLoggedIn(); if ($logged_in) { //logged in $json = json_decode($_POST['json'], true); $file_path = $json["file_path"]; $server_path = $GLOBALS['index_path'] . $file_path; if (is_file($server_path)) { $deleted = unlink($server_path); $result = $deleted; $message = $deleted ? "File Deleted" : "File Not Deleted"; } } echo returnMessage($result, $message, null);
<?php include_once dirname(__FILE__) . "/../configs.php"; $success = false; $message = ""; $logged_in = ManagerActions::isLoggedIn(); if ($logged_in && isset($_POST["json"])) { $json = json_decode($_POST['json'], true); $id = trim(strip_tags($json["id"])); $post_data = $json["post_data"]; if (count($post_data > 0)) { try { $db = MongoConnection(); $db_getter = new MongoGetter($db); $db_getter->updateSinglePostDataById($id, $post_data); $success = true; $message = "Post Edited"; } catch (MongoCursorException $e) { $message = "error message: " . $e->getMessage() . "\n"; } } } echo returnMessage($success, $message, null);
function send_backup_zip() { $tmp_date = date('Y_m_d_H-i-s'); $incl = ""; $make_zip = true; $send = false; $dirs = array(); if (getRequestValue('backup_include_cms', 'post') == "true") { $dirs[] = BASE_DIR_ADMIN; $dirs[] = BASE_DIR_CMS; $dirs[] = BASE_DIR . "index.php"; if (is_file(BASE_DIR . "install.php")) { $dirs[] = BASE_DIR . "install.php"; } if (is_file(BASE_DIR . "update.php")) { $dirs[] = BASE_DIR . "update.php"; } if (is_file(BASE_DIR . "robots.txt")) { $dirs[] = BASE_DIR . "robots.txt"; } if (is_file(BASE_DIR . "sitemap.xml")) { $dirs[] = BASE_DIR . "sitemap.xml"; } if (is_file(BASE_DIR . "sitemap_addon.xml")) { $dirs[] = BASE_DIR . "sitemap_addon.xml"; } if (is_file(BASE_DIR . ".htaccess")) { $dirs[] = BASE_DIR . ".htaccess"; } } if (getRequestValue('backup_include_catpage', 'post') == "true") { $dirs[] = CONTENT_DIR_REL; $incl .= "catpage_"; } if (getRequestValue('backup_include_gallery', 'post') == "true") { $dirs[] = GALLERIES_DIR_REL; $incl .= "gallery_"; } if (getRequestValue('backup_include_layouts', 'post') == "true") { $dirs[] = BASE_DIR . LAYOUT_DIR_NAME; $incl .= "layouts_"; } if (getRequestValue('backup_include_plugins', 'post') == "true") { $dirs[] = BASE_DIR . PLUGIN_DIR_NAME; $incl .= "plugins_"; } if (getRequestValue('backup_include_docu', 'post') == "true") { $dirs[] = BASE_DIR . "docu/"; $incl .= "docu_"; } if (strlen($incl) > 1) { $incl = "Include_" . $incl; } if (count($dirs) < 1) { $make_zip = false; global $message; $message .= returnMessage(false, getLanguageValue("admin_error_no_backups_select")); } if ($make_zip) { if (!is_dir(BASE_DIR . BACKUP_DIR_NAME)) { @mkdir(BASE_DIR . BACKUP_DIR_NAME); setChmod(BASE_DIR . BACKUP_DIR_NAME); } $filename = 'moziloCMS_Backup_' . $incl . $tmp_date . '.zip'; $file = BASE_DIR . BACKUP_DIR_NAME . '/' . $filename; define("PCLZIP_TEMPORARY_DIR", BASE_DIR . BACKUP_DIR_NAME . '/'); require_once BASE_DIR_ADMIN . "pclzip.lib.php"; $backup = new PclZip($file); if (0 != $backup->create($dirs, PCLZIP_OPT_REMOVE_PATH, BASE_DIR, PCLZIP_OPT_ADD_PATH, 'moziloCMS_Backup_' . $tmp_date)) { $send = true; } else { global $message; $message .= returnMessage(false, "Error : " . $backup->errorInfo()); $dh = opendir(BASE_DIR . BACKUP_DIR_NAME); while (($entry = readdir($dh)) !== false) { if ($entry == "." or $entry == "..") { continue; } @unlink(BASE_DIR . BACKUP_DIR_NAME . '/' . $entry); } closedir($dh); } } if ($send) { $filesize = filesize($file); // Header schreiben header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: application/zip"); header("Content-Disposition: inline; filename=\"" . $filename . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $filesize); # bei grossen dateien senden in kleinen stücken damit der speicherunter browserdialog schnell aufgeht if ($filesize > 1048576 * 10) { # 1048576 = 1mb $fp = fopen($file, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); } else { @readfile($file); } @unlink($file); exit; } }