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 write_sort_list($movecat = false) { if (false === getRequestValue('sort_array', 'post')) { return ajax_return("success", false); } global $cat_page_sort_array; $post = getRequestValue('sort_array', 'post'); # da im frontend die cat erst umbenant wird wenn vom server ein succsses zurück kamm # müssen wir hier das sort_array aktualiesieren if (is_array($movecat)) { if ($movecat['type'] == "cat" and isset($post[$movecat['new']]) and isset($post[$movecat['org']])) { $post[$movecat['new']] = $post[$movecat['org']]; unset($post[$movecat['org']]); } } $cat_page_sort_array = array(); foreach ($post as $cat => $tmp) { if (substr($cat, -EXT_LENGTH) == EXT_LINK) { $cat_page_sort_array[$cat] = "null"; continue; } else { $cat_page_sort_array[$cat] = array(); } if (is_array($post[$cat])) { foreach ($post[$cat] as $page => $tmp) { $cat_page_sort_array[$cat][$page] = "null"; } } } $sort_array = var_export($cat_page_sort_array, true); global $page_protect; if (true != mo_file_put_contents(SORT_CAT_PAGE, "<?php if(!defined('IS_CMS')) die();\n\$cat_page_sort_array = " . $sort_array . ";\n?>")) { return ajax_return("error", false, returnMessage(false, getLanguageValue("error_write_sort_list")), true, "js-dialog-reload"); } global $CatPage; $CatPage = new CatPageClass(); require_once BASE_DIR_ADMIN . 'editsite.php'; if (true != ($error = write_xmlsitmap())) { return $error; } # wir schiken die neu selectbox zurück return ajax_return("success", false) . '<span id="replace-item">' . returnCatPagesSelectbox() . '</span>'; }
if (!is_file(SORT_CAT_PAGE)) { $cat_page_sort_array = array(); $cats = getDirAsArray(CONTENT_DIR_REL, "dir"); foreach ($cats as $cat) { $cat_page_sort_array[$cat] = array(); if (substr($cat, -EXT_LENGTH) == EXT_LINK) { $cat_page_sort_array[$cat] = "null"; continue; } $pages = getDirAsArray(CONTENT_DIR_REL . $cat, "file"); foreach ($pages as $page) { $cat_page_sort_array[$cat][$page] = "null"; } } $sort_array = var_export($cat_page_sort_array, true); if (true != mo_file_put_contents(SORT_CAT_PAGE, "<?php if(!defined('IS_CMS')) die();\n\$cat_page_sort_array = " . $sort_array . ";\n?>")) { $message .= returnMessage(false, "Achtung kann SortCatPage nicht Schreiben"); } } require_once BASE_DIR_CMS . 'idna_convert.class.php'; $Punycode = new idna_convert(); require_once BASE_DIR_CMS . "CatPageClass.php"; $CatPage = new CatPageClass(); $GALLERY_CONF = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . "/gallery.conf.php"); $USER_SYNTAX = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . "/syntax.conf.php"); define("ALLOWED_SPECIALCHARS_REGEX", $specialchars->getSpecialCharsRegex()); # hier das tabs array $array_tabs = array("home", "catpage", "files", "gallery", "config", "admin", "plugins", "template"); if ($_SESSION['username'] == $loginpassword->get("username")) { $array_tabs = $ADMIN_CONF->get("tabs"); define("ROOT", false);
function template() { global $CMS_CONF; global $specialchars; global $message; global $debug; $template_manage_open = false; # templates löschen if (getRequestValue('template-all-del', 'post') and getRequestValue('template-del', 'post')) { template_del(); $template_manage_open = true; } # template activ setzen if (!getRequestValue('template-all-del', 'post') and !getRequestValue('template-install', 'post') and getRequestValue('template-active', 'post')) { $debug .= "active=" . getRequestValue('template-active', 'post') . "<br />\n"; template_setactiv(); } # hochgeladenes template installieren if (isset($_FILES["template-install-file"]["error"]) and getRequestValue('template-install', 'post') and $_FILES["template-install-file"]["error"] == 0 and strtolower(substr($_FILES["template-install-file"]["name"], -4)) == ".zip") { $debug .= "install=" . $_FILES["template-install-file"]["name"] . "<br />\n"; template_install(); $template_manage_open = true; } elseif ($template_select = $specialchars->rebuildSpecialChars(getRequestValue('template-install-select', 'post'), false, false) and getRequestValue('template-install', 'post') and is_file(BASE_DIR . LAYOUT_DIR_NAME . "/" . $template_select) !== false and strtolower(substr($template_select, -4)) == ".zip") { $debug .= "local install=" . getRequestValue('template-install-select', 'post') . "<br />\n"; template_install($template_select); $template_manage_open = true; } $showdebug = false; if ($showdebug and !empty($debug)) { $message .= returnMessage(false, $debug); } $ACTIV_TEMPLATE = $CMS_CONF->get("cmslayout"); $LAYOUT_DIR = LAYOUT_DIR_NAME . "/" . $ACTIV_TEMPLATE . '/'; if (getRequestValue('chancefiles') == "true") { require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php"; } if (false !== ($newfile = getRequestValue('newfile', 'post')) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) { $dir = BASE_DIR . LAYOUT_DIR_NAME . "/" . str_replace('%2F', '/', $curent_dir) . "/"; if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) { ajax_return("error", true, $error, true, "js-dialog-reload"); } ajax_return("success", true); } if (getRequestValue('templateselectbox', 'post') == "true") { require_once BASE_DIR_ADMIN . 'editsite.php'; # wir schiken die neue selectbox zurück echo '<span id="replace-item">' . returnTemplateSelectbox() . '</span>'; ajax_return("success", true); } if (getRequestValue('configtemplate', 'post') == "true") { if (false !== ($templatefile = BASE_DIR . getRequestValue('templatefile', 'post', false)) and !file_exists($templatefile)) { ajax_return("error", true, returnMessage(false, getLanguageValue("error_no_file_dir") . " " . $templatefile), true, true); } if (false !== ($content = getRequestValue('content', 'post', false))) { if (false === mo_file_put_contents($templatefile, $content)) { ajax_return("error", true, returnMessage(false, getLanguageValue("editor_content_error_save")), true, true); } echo ajax_return("success", false); } else { if (false === ($syntax = get_contents_ace_edit($templatefile))) { ajax_return("error", true, returnMessage(false, getLanguageValue("editor_content_error_open")), true, true); } echo '<textarea id="page-content">' . $syntax . '</textarea>'; echo ajax_return("success", false); } exit; } global $ADMIN_CONF; $show = $ADMIN_CONF->get("template"); if (!is_array($show)) { $show = array(); } $html_manage = ""; if (ROOT or in_array("template_manage", $show)) { $template_manage = array(); $disabled = ''; if (!function_exists('gzopen')) { $disabled = ' disabled="disabled"'; } $template_install = array(); foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, array(".zip")) as $zip_file) { $template_install[] = '<option value="' . mo_rawurlencode($zip_file) . '">' . $zip_file . '</option>'; } $template_install_html = ""; if (count($template_install) > 0) { $template_install_html .= '<br /><select class="mo-install-select mo-select-div" name="template-install-select" size="1"' . $disabled . '>' . '<option value="">' . getLanguageValue("template_select", true) . '</option>' . implode("", $template_install) . '</select>'; } $template_manage["template_title_manage"][] = '<div class="mo-nowrap align-right ui-helper-clearfix">' . '<span class="align-left" style="float:left"><span class="mo-bold">' . getLanguageValue("template_text_filebutton") . '</span><br />' . getLanguageValue("template_text_fileinfo") . '</span>' . '<input type="file" id="js-template-install-file" name="template-install-file" class="mo-select-div"' . $disabled . ' />' . $template_install_html . '<input type="submit" id="js-template-install-submit" name="template-install" value="' . getLanguageValue("template_button_install", true) . '"' . $disabled . ' /><br />' . '<input type="submit" id="js-template-del-submit" value="' . getLanguageValue("template_button_delete", true) . '" class="mo-margin-top" />' . '</div>'; foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, "dir", "natcasesort") as $pos => $file) { $template_activ = ''; $checkbox_del = '<input type="checkbox" name="template-del[]" value="' . $file . '" class="mo-checkbox" />'; $radio_activ = '<input id="template-status' . $pos . '" name="template-active" type="radio" value="' . $file . '" class="mo-radio" /><label for="template-status' . $pos . '">' . getLanguageValue("template_input_set_active") . '</label>'; if ($ACTIV_TEMPLATE == $file) { $checkbox_del = ' '; $radio_activ = ""; $template_activ = ' mo-bold'; } $template_manage["template_title_manage"][] = '<div class="mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="mo-nowrap mo-padding-left' . $template_activ . '">' . $specialchars->rebuildSpecialChars($file, false, true) . '</span>' . '<div style="float:right;">' . $checkbox_del . '</div>' . '<div style="float:right;width:30%;">' . $radio_activ . '</div>' . '</div>'; } $multi_user = ""; if (defined('MULTI_USER') and MULTI_USER) { $multi_user = "******"; } if (count($template_manage["template_title_manage"]) > 0) { $template_manage["template_title_manage"]["toggle"] = true; $html_manage = '<form id="js-template-manage" action="index.php?nojs=true&action=template' . $multi_user . '" method="post" enctype="multipart/form-data">' . contend_template($template_manage) . '</form>'; # es wurde in der template verwaltung was gemacht dann soll die aufgeklapt bleiben if ($template_manage_open) { $html_manage = str_replace("display:none;", "", $html_manage); } } } $html_template = ""; if (ROOT or in_array("template_edit", $show)) { $template = array(); foreach (getDirAsArray(BASE_DIR . $LAYOUT_DIR, array(".html"), "natcasesort") as $file) { $template["template_title_html_css"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left">' . $file . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-html mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars($LAYOUT_DIR . $file, true) . '</span>' . '</div>'; } foreach (getDirAsArray(BASE_DIR . $LAYOUT_DIR . 'css', array(".css"), "natcasesort") as $file) { $template["template_title_html_css"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left"><span class="mo-bold mo-padding-right">css/</span>' . $file . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-css mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars($LAYOUT_DIR . 'css/' . $file, true) . '</span>' . '</div>'; } require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php"; $template_img = getFileUpload($CMS_CONF->get("cmslayout") . '/grafiken'); $html_img = get_template_truss('<li class="mo-li ui-corner-all">' . $template_img . '</li>', "template_title_grafiken", true); $html_template = get_template_truss('<li class="ui-corner-all">' . contend_template($template) . $html_img . '</li>', "template_title_template", false); $html_template = str_replace("{TemplateName}", '<span style="font-weight:normal;">' . $specialchars->rebuildSpecialChars($CMS_CONF->get("cmslayout"), false, true) . '</span>', $html_template); } $html_plugins = ""; if (ROOT or in_array("template_plugin_css", $show)) { $show = $ADMIN_CONF->get("plugins"); if (!is_array($show)) { $show = array(); } global $activ_plugins; $template_plugins = array(); $template_plugins["template_title_plugins"] = array(); foreach ($activ_plugins as $plugin) { if (!ROOT and !in_array($plugin, $show)) { continue; } if (!is_file(BASE_DIR . PLUGIN_DIR_NAME . "/" . $plugin . "/plugin.css")) { continue; } $template_plugins["template_title_plugins"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left"><span class="mo-bold mo-padding-right">css/</span>' . $plugin . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-css mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars(PLUGIN_DIR_NAME . "/" . $plugin . "/plugin.css", true) . '</span>' . '</div>'; } if (count($template_plugins["template_title_plugins"]) > 0) { $template_plugins["template_title_plugins"]["toggle"] = true; $html_plugins = contend_template($template_plugins); } } $html_editor = ""; if (!empty($html_template) or !empty($html_plugins)) { $html_editor = pageedit_dialog(); } return $html_manage . $html_template . $html_plugins . $html_editor; }