Esempio n. 1
0
function gallery()
{
    global $specialchars;
    global $ADMIN_CONF;
    global $CatPage;
    global $GALLERY_CONF;
    if (false !== ($changeart = getRequestValue('changeart', 'post'))) {
        header('content-type: text/html; charset=' . CHARSET . '');
        if ($changeart == "gallery_new") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post'))) {
                echo newGallery($galleryname);
            }
            exit;
        } elseif ($changeart == "gallery_del") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post'))) {
                echo deleteGallery($galleryname);
            }
            exit;
        } elseif ($changeart == "gallery_rename") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post')) and false !== ($gallerynewname = getRequestValue('gallerynewname', 'post'))) {
                echo renameGallery($galleryname, $gallerynewname);
            }
            exit;
        } elseif ($changeart == "gallery_size") {
            if (false !== ($new_global_width = getRequestValue('new_global_width', 'post')) and false !== ($new_global_height = getRequestValue('new_global_height', 'post')) and (ctype_digit($new_global_width) or ctype_digit($new_global_height) or $new_global_width == "auto" or $new_global_height == "auto" or $new_global_width == "" or $new_global_height == "")) {
                $GALLERY_CONF->set("maxwidth", $new_global_width);
                $GALLERY_CONF->set("maxheight", $new_global_height);
                ajax_return("success", true);
            } elseif (false !== ($thumbnail_global_max_width = getRequestValue('thumbnail_global_max_width', 'post')) and false !== ($thumbnail_global_max_height = getRequestValue('thumbnail_global_max_height', 'post')) and (ctype_digit($thumbnail_global_max_width) or ctype_digit($thumbnail_global_max_height or $new_global_width == "" or $new_global_height == ""))) {
                $GALLERY_CONF->set("maxthumbwidth", $thumbnail_global_max_width);
                $GALLERY_CONF->set("maxthumbheight", $thumbnail_global_max_height);
                ajax_return("success", true);
            } else {
                ajax_return("error", true, returnMessage(false, getLanguageValue("properties_error_save")), true, true);
            }
        } elseif ($changeart == "gallery_subtitle") {
            if (false !== ($subtitle = getRequestValue('subtitle', 'post', false)) and false !== ($curent_dir = getRequestValue('curent_dir', 'post')) and false !== ($file = getRequestValue('file', 'post'))) {
                if (!is_file(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php") and false === newConf(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php")) {
                    ajax_return("error", true, returnMessage(false, getLanguageValue("gallery_error_subtitle_conf")), true, true);
                }
                $tmp = new Properties(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php");
                $tmp->set($file, $subtitle);
                ajax_return("success", true);
            }
            exit;
        } elseif ($changeart == "file_rename") {
            if (false !== ($newfile = getRequestValue('newfile', 'post')) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) {
                $dir = GALLERIES_DIR_REL . $curent_dir . "/";
                if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) {
                    ajax_return("error", true, $error, true, "js-dialog-reload");
                }
                $dir = GALLERIES_DIR_REL . $curent_dir . "/" . PREVIEW_DIR_NAME . "/";
                if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) {
                    ajax_return("error", true, $error, true, "js-dialog-reload");
                }
                $tmp = new Properties(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php");
                $tmp->set($newfile, $tmp->get($orgfile));
                $tmp->delete($orgfile);
                ajax_return("success", true);
            }
            exit;
        } elseif ($changeart == "gallery_ftp") {
            changeFromFtp();
        } else {
            exit;
        }
    }
    if (getRequestValue('chancefiles') == "true") {
        require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php";
        exit;
    }
    $dircontent = getDirAsArray(GALLERIES_DIR_REL, "dir", "sort");
    $pagecontent = "";
    require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php";
    $pagecontent .= '<ul class="js-gallery mo-ul">';
    foreach ($dircontent as $pos => $currentgalerien) {
        $pagecontent .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">';
        $pagecontent .= getFileUpload($currentgalerien, $specialchars->rebuildSpecialChars($currentgalerien, false, true), getLanguageValue("images"));
        $pagecontent .= '</li>';
    }
    $pagecontent .= '</ul>';
    $new_gallery = '<ul class="js-new-gallery mo-ul new-gallery">';
    $new_gallery .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">';
    $new_gallery .= getFileUpload($specialchars->rebuildSpecialChars(getLanguageValue("gallery_name_new"), false, true), getLanguageValue("gallery_name_new"), getLanguageValue("images"), " mo-hidden");
    $new_gallery .= '</li>';
    $new_gallery .= '</ul>';
    $max_img = '<input type="text" name="new_global_width" value="' . $GALLERY_CONF->get('maxwidth') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit-auto" /> x <input type="text" name="new_global_height" value="' . $GALLERY_CONF->get('maxheight') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit-auto" /> ' . getLanguageValue("pixels");
    $max_prev_img = '<input type="text" name="thumbnail_global_max_width" value="' . $GALLERY_CONF->get('maxthumbwidth') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> x <input type="text" name="thumbnail_global_max_height" value="' . $GALLERY_CONF->get('maxthumbheight') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> ' . getLanguageValue("pixels");
    $titel = "gallery_help_conf";
    $template[$titel]["toggle"] = true;
    $template[$titel][] = array(getLanguageValue("gallery_scale"), $max_img);
    $template[$titel][] = array(getLanguageValue("gallery_scale_thumbs"), $max_prev_img);
    $ftp_form = '<form action="index.php?action=' . ACTION . '" method="post">';
    $ftp_form .= '<input type="hidden" name="changeart" value="gallery_ftp" />';
    $ftp_form .= '<input type="submit" value="' . getLanguageValue("gallery_text_from_ftp_button") . '" />';
    $ftp_form .= '</form>';
    $template[$titel][] = array(getLanguageValue("gallery_text_from_ftp"), $ftp_form);
    return array(contend_template($template) . $pagecontent, $new_gallery);
}
Esempio n. 2
0
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") . '&nbsp;&nbsp;<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") . '&nbsp;&nbsp;<a href="' . URL_BASE . 'docu/index.php?menu=false&amp;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);
}
Esempio n. 3
0
function cleanUpUpdate()
{
    @unlink('install.php');
    if (is_file('update.php')) {
        @unlink('update.php');
    }
    if (is_dir(BASE_DIR . 'update') and false !== ($currentdir = opendir(BASE_DIR . 'update'))) {
        while (false !== ($file = readdir($currentdir))) {
            if ($file == "." or $file == "..") {
                continue;
            }
            @unlink(BASE_DIR . 'update/' . $file);
        }
        closedir($currentdir);
        @rmdir(BASE_DIR . 'update');
    }
    $tmp = "";
    if (is_file('install.php')) {
        $tmp .= 'install.php<br />';
    }
    if (is_file('update.php')) {
        $tmp .= 'update.php<br />';
    }
    if (is_dir(BASE_DIR . 'update')) {
        $tmp .= 'update<br />';
    }
    if (strlen($tmp) > 1) {
        return contend_template(getLanguageValue("install_finish_delerror", $tmp), false);
    }
    return contend_template(getLanguageValue("install_finish_del"), true);
}
Esempio n. 4
0
function config()
{
    global $CMS_CONF;
    global $specialchars;
    global $CONTACT_CONF;
    global $ADMIN_CONF;
    global $USER_SYNTAX;
    if (getRequestValue('savesyntax', 'post') == "true") {
        if (false !== ($content = getRequestValue('content', 'post', false)) and $CMS_CONF->get('usecmssyntax') == "true") {
            $USER_SYNTAX->setFromTextarea($content);
            require_once BASE_DIR_ADMIN . 'editsite.php';
            $selctbox = '<span id="replace-item">' . returnUserSyntaxSelectbox() . '</span>';
            $var_UserSyntax = '0E0M0P0T0Y0';
            # die userSxntax hat sich geändert deshalb schiecken wir dem editor userSyntax die neuen
            global $USER_SYNTAX;
            $moziloUserSyntax = $USER_SYNTAX->toArray();
            if (count($moziloUserSyntax) > 0) {
                $moziloUserSyntax = array_keys($moziloUserSyntax);
                rsort($moziloUserSyntax);
                $var_UserSyntax = implode('|', $moziloUserSyntax);
            }
            $var_UserSyntax = '<span id="moziloUserSyntax">' . $var_UserSyntax . '</span>';
            echo ajax_return("success", false) . $selctbox . $var_UserSyntax;
        } elseif ($CMS_CONF->get('usecmssyntax') == "true") {
            require_once BASE_DIR_ADMIN . 'editsite.php';
            $selctbox = '<span id="replace-item">' . returnUserSyntaxSelectbox() . '</span>';
            $selctbox .= '<textarea id="page-content">' . $USER_SYNTAX->getToTextarea() . '</textarea>';
            echo ajax_return("success", false) . $selctbox;
        }
        exit;
    } elseif (getRequestValue('chanceconfig', 'post') == "true") {
        echo set_config_para();
        exit;
    }
    $pagecontent = NULL;
    $show = $ADMIN_CONF->get("config");
    if (!is_array($show)) {
        $show = array();
    }
    $template = array();
    $error = array();
    // ALLGEMEINE EINSTELLUNGEN
    $titel = "config_titel_cmsglobal";
    // Zeile "WEBSITE-TITEL", "TITEL-TRENNER" und "WEBSITE-TITELLEISTE"
    if (ROOT or in_array("websitetitle", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = '<div class="ui-helper-clearfix">' . '<div class="mo-in-li-l">' . getLanguageValue("config_text_websitetitle") . '</div>' . '<div class="mo-in-li-r">' . '<input type="text" class="mo-input-text" name="websitetitle" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("websitetitle"), true, true) . '" />' . '</div>' . '</div>' . '<div class="mo-padding-top ui-helper-clearfix">' . '<div class="mo-in-li-l">' . getLanguageValue("config_text_websitetitleseparator") . '</div>' . '<div class="mo-in-li-r">' . '<input type="text" class="mo-input-text" name="titlebarseparator" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("titlebarseparator"), true, true) . '" />' . '</div>' . '</div>' . '<div class="mo-padding-top">' . getLanguageValue("config_text_websitetitlebar") . '<br /><input type="text" class="mo-input-text mo-input-margin-top" name="titlebarformat" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("titlebarformat"), true, true) . '" />' . '</div>';
    }
    // Zeile "WEBSITE-BESCHREIBUNG" und "WEBSITE-KEYWORDS"
    if (ROOT or in_array("websitedescription", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = getLanguageValue("config_text_websitedescription") . '<br /><input type="text" class="mo-input-text mo-input-margin-top" name="websitedescription" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("websitedescription"), true, true) . '" /><div class="mo-padding-top">' . getLanguageValue("config_text_websitekeywords") . '</div><input type="text" class="mo-input-text mo-input-margin-top" name="websitekeywords" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("websitekeywords"), true, true) . '" />';
    }
    // Zeile "SPRACHAUSWAHL"
    if (ROOT or in_array("cmslanguage", $show)) {
        $tmp_array = getDirAsArray(BASE_DIR_CMS . 'sprachen', "file", "natcasesort");
        if (count($tmp_array) <= 0) {
            $error[$titel][] = getLanguageValue("config_error_language_empty");
        } elseif (!in_array("language_" . $CMS_CONF->get('cmslanguage') . ".txt", $tmp_array)) {
            $error[$titel][] = getLanguageValue("config_error_languagefile_error") . "<br />" . CMS_DIR_NAME . "/sprachen/language_" . $CMS_CONF->get('cmslanguage') . ".txt";
        } else {
            $error[$titel][] = false;
        }
        $conf_inhalt = '<div class="mo-select-div"><select name="cmslanguage" class="mo-select">';
        foreach ($tmp_array as $file) {
            $currentlanguagecode = substr($file, strlen("language_"), strlen($file) - strlen("language_") - strlen(".txt"));
            $selected = NULL;
            // aktuell ausgewählte Sprache als ausgewählt markieren
            if ($currentlanguagecode == $CMS_CONF->get("cmslanguage")) {
                $selected = " selected";
            }
            $conf_inhalt .= '<option' . $selected . ' value="' . $currentlanguagecode . '">';
            // Übersetzer aus der aktuellen Sprachdatei holen
            $languagefile = new Properties(BASE_DIR_CMS . "sprachen/" . $file);
            $conf_inhalt .= $currentlanguagecode . " (" . getLanguageValue("config_input_translator") . " " . $languagefile->get("_translator_0") . ")";
            $conf_inhalt .= "</option>";
        }
        $conf_inhalt .= "</select></div>";
        $template[$titel][] = array(getLanguageValue("config_text_cmslanguage"), $conf_inhalt);
    }
    // Zeile "STANDARD-KATEGORIE"
    if (ROOT or in_array("defaultcat", $show)) {
        $tmp_array = getDirAsArray(CONTENT_DIR_REL, "dir", "natcasesort");
        if (count($tmp_array) <= 0) {
            $error[$titel][] = getLanguageValue("config_error_defaultcat_emty");
        } elseif (!in_array($CMS_CONF->get('defaultcat'), $tmp_array)) {
            $error[$titel][] = getLanguageValue("config_error_defaultcat_existed") . "<br />" . $specialchars->rebuildSpecialChars($CMS_CONF->get('defaultcat'), true, true);
        } else {
            $error[$titel][] = false;
        }
        $conf_inhalt = '<div class="mo-select-div"><select name="defaultcat" class="mo-select">';
        foreach ($tmp_array as $element) {
            if (count(getDirAsArray(CONTENT_DIR_REL . $element, array(EXT_PAGE, EXT_HIDDEN), "none")) == 0) {
                continue;
            }
            $selected = NULL;
            if ($element == $CMS_CONF->get("defaultcat")) {
                $selected = "selected ";
            }
            $conf_inhalt .= '<option ' . $selected . 'value="' . $element . '">' . $specialchars->rebuildSpecialChars($element, true, true) . "</option>";
        }
        $conf_inhalt .= "</select></div>";
        $template[$titel][] = array(getLanguageValue("config_text_defaultcat"), $conf_inhalt);
    }
    if (ROOT or in_array("draftmode", $show)) {
        $conf_checkbox = buildCheckBox("draftmode", $CMS_CONF->get("draftmode"), getLanguageValue("config_input_draftmode"));
        $conf_select = "";
        $tmp_array = getDirAsArray(BASE_DIR . "layouts", "dir", "natcasesort");
        if (count($tmp_array) <= 0) {
            $error[$titel][] = getLanguageValue("config_error_layouts_emty");
        } else {
            $error[$titel][] = false;
        }
        $conf_select .= '<div style="font-size:.4em;">&nbsp;</div><div class="mo-select-div"><select name="draftlayout" class="mo-select">';
        $conf_select .= '<option value="false">' . getLanguageValue("config_input_draftlayout") . '</option>';
        foreach ($tmp_array as $file) {
            $selected = NULL;
            if ($file == $CMS_CONF->get("draftlayout")) {
                $selected = " selected";
            }
            $conf_select .= '<option' . $selected . ' value="' . $file . '">';
            $conf_select .= $specialchars->rebuildSpecialChars($file, true, true);
            $conf_select .= "</option>";
        }
        $conf_select .= "</select></div>";
        $template[$titel][] = array(getLanguageValue("config_text_draftmode"), $conf_checkbox . $conf_select);
    }
    # sitemap.xml
    if (ROOT or in_array("usesitemap", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_usesitemap"), buildCheckBox("usesitemap", $CMS_CONF->get("usesitemap"), getLanguageValue("config_input_usesitemap")));
    }
    // Zeile "NUTZE CMS-SYNTAX"
    // SYNTAX-EINSTELLUNGEN
    $titel = "config_titel_cmssyntax";
    if (ROOT or in_array("usecmssyntax", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_usesyntax"), buildCheckBox("usecmssyntax", $CMS_CONF->get("usecmssyntax"), getLanguageValue("config_input_usesyntax")));
    }
    if (ROOT or (in_array("usecmssyntax", $show) or !in_array("usecmssyntax", $show) and $CMS_CONF->get("usecmssyntax") == "true")) {
        if (ROOT or in_array("editusersyntax", $show)) {
            $error[$titel][] = false;
            $template[$titel][] = array(getLanguageValue("config_text_usersyntax"), '<div class="js-usecmssyntax">' . '<img class="js-editsyntax mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '</div>');
        }
        // Zeile "ERSETZE EMOTICONS"
        if (ROOT or in_array("replaceemoticons", $show)) {
            $error[$titel][] = false;
            $template[$titel][] = array(getLanguageValue("config_text_replaceemoticons"), '<div class="js-usecmssyntax">' . buildCheckBox("replaceemoticons", $CMS_CONF->get("replaceemoticons") == "true", getLanguageValue("config_input_replaceemoticons")) . '</div>');
        }
        if (ROOT or in_array("defaultcolors", $show)) {
            $error[$titel][] = false;
            $colors_div = '<div class="mo-in-li-l">';
            $colors_div .= '<img class="js-save-default-color mo-tool-icon mo-icons-icon mo-icons-save" src="' . ICON_URL_SLICE . '" alt="save" />';
            $colors_div .= '<img id="js-del-config-default-color" class="mo-tool-icon ui-corner-all mo-icons-icon mo-icons-delete" src="' . ICON_URL_SLICE . '" alt="delete" hspace="0" vspace="0" />';
            $colors_div .= '<div id="js-config-default-color-box" class="ce-default-color-box ui-widget-content ui-corner-all">&nbsp;';
            $colors_div .= '</div>';
            $colors_div .= '</div>';
            $colors_div .= '<div id="js-menu-config-default-color" class="mo-in-li-r">' . '← <img class="js-new-config-default-color ce-bg-color-change ce-default-color-img ui-widget-content ui-corner-all" alt="" title="" src="' . ICON_URL_SLICE . '" />' . '<input type="text" maxlength="6" value="DD0000" class="ce-bg-color-change js-in-hex ce-in-hex" id="js-new-default-color-value" size="6" />' . '<img class="js-coloreditor-button ed-icon-border ed-syntax-icon ed-farbeedit" alt="' . getLanguageValue("dialog_title_coloredit") . '" title="' . getLanguageValue("dialog_title_coloredit") . '" src="' . ICON_URL_SLICE . '" style="display:none;" />' . '</div>';
            $template[$titel][] = '<div class="mo-margin-bottom">' . getLanguageValue("config_text_defaultcolors") . '</div>' . $colors_div . '<input type="hidden" name="defaultcolors" value="' . $specialchars->rebuildSpecialChars($CMS_CONF->get("defaultcolors"), false, false) . '" />';
        }
    }
    // Erweiterte Einstellungen
    // Zeile "showhiddenpagesin"
    $titel = "config_titel_expert";
    if (ROOT or in_array("hiddenpages", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_showhiddenpages"), buildCheckBox("showhiddenpagesinsearch", $CMS_CONF->get("showhiddenpagesinsearch") == "true", getLanguageValue("config_input_search")) . '<br />' . buildCheckBox("showhiddenpagesinsitemap", $CMS_CONF->get("showhiddenpagesinsitemap") == "true", getLanguageValue("config_input_sitemap")) . '<br />' . buildCheckBox("showhiddenpagesasdefaultpage", $CMS_CONF->get("showhiddenpagesasdefaultpage") == "true", getLanguageValue("config_input_pagesasdefaultpage")));
    }
    // Zeile "Links öffnen self blank"
    if (ROOT or in_array("targetblank", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_target"), buildCheckBox("targetblank_download", $CMS_CONF->get("targetblank_download") == "true", getLanguageValue("config_input_download")) . '<br />' . buildCheckBox("targetblank_link", $CMS_CONF->get("targetblank_link") == "true", getLanguageValue("config_input_link")));
    }
    // Zeile "wenn page == cat"
    if (ROOT or in_array("hidecatnamedpages", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_catnamedpages"), buildCheckBox("hidecatnamedpages", $CMS_CONF->get("hidecatnamedpages") == "true", getLanguageValue("config_input_catnamedpages")));
    }
    // Zeile "mod_rewrite"
    if (ROOT or in_array("modrewrite", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_modrewrite"), buildCheckBox("modrewrite", $CMS_CONF->get("modrewrite") == "true", getLanguageValue("config_input_modrewrite")));
    }
    // Zeile "showsyntaxtooltips"
    if (ROOT or in_array("showsyntaxtooltips", $show)) {
        $error[$titel][] = false;
        $template[$titel][] = array(getLanguageValue("config_text_showsyntaxtooltips"), buildCheckBox("showsyntaxtooltips", $CMS_CONF->get("showsyntaxtooltips") == "true", getLanguageValue("config_input_showsyntaxtooltips")));
    }
    $pagecontent .= contend_template($template, $error);
    if (ROOT or in_array("editusersyntax", $ADMIN_CONF->get("config"))) {
        $pagecontent .= pageedit_dialog();
    }
    return $pagecontent;
}
Esempio n. 5
0
     session_regenerate_id(true);
 }
 # Achtung nojs darf nur von nicht ajax anfragen benutzt werden
 if (getRequestValue('nojs', 'get')) {
     session_regenerate_id(true);
 }
 # wird für den Editor gebraucht
 list($activ_plugins, $deactiv_plugins, $plugin_first) = findPlugins();
 # Backup Erinnerung bestätigen
 if (isset($_POST["lastbackup_yes"]) and $_POST["lastbackup_yes"] == "true") {
     $ADMIN_CONF->set("lastbackup", time());
     ajax_return("success", true);
 }
 # mod_rewrite test
 if (getRequestValue('moderewrite', 'get') and getRequestValue('moderewrite', 'get') == "ok") {
     echo contend_template(array("home_serverinfo" => array(array('<span id="mod-rewrite-true">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("yes")))), array("home_serverinfo" => array("ok")));
     exit;
 }
 require_once BASE_DIR_ADMIN . "filesystem.php";
 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";
Esempio n. 6
0
function get_plugin_config($conf_plugin, $config, $currentelement)
{
    if (count($config) < 1) {
        return NULL;
    }
    $search = array();
    $replace = array();
    $template = false;
    $pagecontent_conf = NULL;
    $ul_template = array();
    if (isset($config["--template~~"])) {
        $template = $config["--template~~"];
        unset($config["--template~~"]);
    }
    if (isset($config["--admin~~"]) and isset($config["--admin~~"]['description']) and isset($config["--admin~~"]['buttontext'])) {
        $ul_template["config_button"][] = array($config["--admin~~"]['description'], '<input type="button" name="' . $currentelement . '[pluginadmin]" value="' . $config["--admin~~"]['buttontext'] . '" class="js-config-adminlogin" />');
        unset($config["--admin~~"]);
    }
    foreach ($config as $name => $inhalt) {
        $value = NULL;
        if (strlen($conf_plugin->get($name)) > 0) {
            # in einem input feld type text darf der inhalt keine " haben
            if ($config[$name]['type'] == "text") {
                $value = ' value="' . str_replace('"', "&#34;", $conf_plugin->get($name)) . '"';
            }
            if ($config[$name]['type'] == "textarea") {
                $value = $conf_plugin->getToTextarea($name);
            }
            if ($config[$name]['type'] == "password") {
                $value = NULL;
            }
        }
        $template_conf = false;
        if (isset($config[$name]['template'])) {
            $template_conf = true;
        }
        $maxlength = NULL;
        if (isset($config[$name]['maxlength'])) {
            $maxlength = ' maxlength="' . $config[$name]['maxlength'] . '"';
        }
        $size = NULL;
        if (isset($config[$name]['size'])) {
            $size = ' size="' . $config[$name]['size'] . '"';
        }
        $cols = NULL;
        if (isset($config[$name]['cols'])) {
            $cols = ' cols="' . $config[$name]['cols'] . '"';
        }
        $rows = NULL;
        if (isset($config[$name]['rows'])) {
            $rows = ' rows="' . $config[$name]['rows'] . '"';
        }
        $multiple = NULL;
        if (isset($config[$name]['multiple']) and $config[$name]['multiple'] == "true") {
            $multiple = ' multiple';
        }
        $css_add = NULL;
        if (empty($size) and empty($cols)) {
            $css_add = " mo-plugin-size-cols";
        }
        $type = NULL;
        $input = NULL;
        if (isset($config[$name]['type'])) {
            $type = ' type="' . $config[$name]['type'] . '"';
            if ($config[$name]['type'] == "textarea") {
                $input = '<textarea name="' . $currentelement . '[' . $name . ']"' . $cols . $rows . ' class="mo-plugin-textarea' . $css_add . '">' . $value . '</textarea>';
                if ($template !== false or $template_conf === true) {
                    $search[] = '{' . $name . '_textarea}';
                    $replace[] = $input;
                }
            } elseif ($config[$name]['type'] == "select") {
                $plus_array = NULL;
                $css_multi = NULL;
                if (!empty($multiple)) {
                    $css_multi = " js-multi";
                    $plus_array = '[]';
                }
                $input = '<select name="' . $currentelement . '[' . $name . ']' . $plus_array . '"' . $size . $multiple . ' class="mo-plugin-select js-select' . $css_multi . $css_add . '">';
                if (is_array($config[$name]['descriptions'])) {
                    $select_array = array();
                    if ($conf_plugin->get($name)) {
                        $select_array = explode(",", $conf_plugin->get($name));
                    }
                    foreach ($config[$name]['descriptions'] as $key => $descriptions) {
                        if (is_array($descriptions)) {
                            if (count($descriptions) < 1) {
                                continue;
                            }
                            $input .= '<optgroup label="' . $key . '">';
                            foreach ($descriptions as $opt_key => $opt_descriptions) {
                                $selected = NULL;
                                if (in_array($opt_key, $select_array)) {
                                    $selected = ' selected="selected"';
                                }
                                $input .= '<option value="' . $opt_key . '"' . $selected . '>' . $opt_descriptions . '</option>';
                            }
                            $input .= '</optgroup>';
                        } else {
                            $selected = NULL;
                            if (in_array($key, $select_array)) {
                                $selected = ' selected="selected"';
                            }
                            $input .= '<option value="' . $key . '"' . $selected . '>' . $descriptions . '</option>';
                        }
                    }
                }
                $input .= '</select>';
                if ($template !== false or $template_conf === true) {
                    $search[] = '{' . $name . '_select}';
                    $replace[] = $input;
                }
            } elseif ($config[$name]['type'] == "radio") {
                if (is_array($config[$name]['descriptions'])) {
                    $input = '';
                    foreach ($config[$name]['descriptions'] as $key => $descriptions) {
                        $value = ' value="' . $key . '"';
                        $checked = NULL;
                        if ($conf_plugin->get($name) == $key) {
                            $checked = ' checked="checked"';
                        }
                        $in_radio = '<input name="' . $currentelement . '[' . $name . ']"' . $type . $value . $checked . ' id="' . $currentelement . '-' . $name . '-' . $key . '" />';
                        $descriptions = '<label for="' . $currentelement . '-' . $name . '-' . $key . '">' . $descriptions . '</label>';
                        $input .= $descriptions . '&nbsp;&nbsp;' . $in_radio . '<br />';
                        if ($template !== false or $template_conf === true) {
                            $search[] = '{' . $name . '_radio_' . $key . '}';
                            $replace[] = $in_radio;
                            $search[] = '{' . $name . '_descriptions_' . $key . '}';
                            $replace[] = $descriptions;
                        }
                    }
                }
            } elseif ($config[$name]['type'] == "checkbox") {
                $checked = NULL;
                if ($conf_plugin->get($name) == "true") {
                    $checked = ' checked="checked"';
                }
                $input = '<input name="' . $currentelement . '[' . $name . ']"' . $type . $checked . ' value="true" id="' . $currentelement . '-' . $name . '" />';
                $config[$name]['description'] = '<label for="' . $currentelement . '-' . $name . '">' . $config[$name]['description'] . '</label>';
                if ($template !== false or $template_conf === true) {
                    $search[] = '{' . $name . '_checkbox}';
                    $replace[] = $input;
                }
            } elseif ($config[$name]['type'] == "file") {
                $input = '<span style="background-color:#FF0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>';
            } else {
                $input = '<input name="' . $currentelement . '[' . $name . ']"' . $type . $value . $maxlength . $size . ' class="mo-plugin-input' . $css_add . '" />';
                if ($template !== false or $template_conf === true) {
                    $search[] = '{' . $name . '_' . $config[$name]['type'] . '}';
                    $replace[] = $input;
                }
            }
        }
        if ($template !== false or $template_conf === true) {
            $search[] = '{' . $name . '_description}';
            $replace[] = $config[$name]['description'];
        }
        if ($template === false and $template_conf === false or $template == "template_test") {
            $ul_template["config_button"][] = array($config[$name]['description'], $input);
        } elseif ($template_conf === true) {
            if ($config[$name]['template'] == "template_test") {
                # wennn in $config[name][template] nur template_test steht alle Platzhalter ausgeben
                $ul_template["config_button"][] = array("Template Platzhalter", implode("<br />", $search));
            } else {
                $ul_template["config_button"][] = str_replace($search, $replace, $config[$name]['template']);
            }
        }
    }
    # Ausgeben template
    if ($template !== false and $template != "template_test") {
        $ul_template["config_button"][] = str_replace($search, $replace, $template);
    }
    # Achtung wenn in $config['--template~~'] nur "template_test" steht werden
    # alle $search ergebnisse ausgegeben
    if ($template == "template_test") {
        $ul_template["config_button"][] = array("Template Platzhalter", implode("<br />", $search));
    }
    $show = '';
    if ($conf_plugin->get("active") != "true") {
        $show = ' style="display:none;"';
    }
    return '<div class="js-config"' . $show . '><ul class="mo-ul">' . '<li class="mo-li ui-widget-content ui-corner-all">' . '<div class="js-tools-show-hide mo-li-head-tag mo-tag-height-from-icon mo-li-head-tag-no-ul mo-middle ui-state-default ui-corner-top ui-helper-clearfix">' . '<span class="mo-bold mo-padding-left">' . getLanguageValue("config_button") . '</span>' . '<img style="float:right;" class="js-save-plugin mo-tool-icon mo-icons-icon mo-icons-save" src="' . ICON_URL_SLICE . '" alt="save" />' . '</div>' . '<ul class="mo-in-ul-ul">' . contend_template($ul_template, false, true) . '</ul>' . '</li>' . '</ul></div>';
}
Esempio n. 7
0
function update()
{
    $head = "";
    $html = "";
    $update_submit = "";
    $update_pages = "";
    if (!isset($_POST['update_cms'])) {
        $updates = testUpdate();
        if ($updates['conf'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_conf_help"), $updates['conf']);
        }
        if ($updates['kategorien'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_kategorien_help"), $updates['kategorien']);
        }
        if ($updates['galerien'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_galerien_help"), $updates['galerien']);
        }
        if ($updates['plugins'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_plugins_help"), $updates['plugins']);
        }
        if ($updates['layouts'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_layouts_help"), $updates['layouts']);
        }
        if (strlen($html) > 1) {
            $head = contend_template(installHelp("install_update_help"), "");
            $update_button = false;
            foreach ($updates as $status) {
                if ($status === false) {
                    $update_button = false;
                    $head = contend_template(getLanguageValue("install_update_error"), false) . $head;
                    break;
                }
                if ($status === true) {
                    $update_button = true;
                }
            }
            if ($update_button === true) {
                if ($updates['kategorien'] === true) {
                    $update_pages = '<input type="checkbox" value="true" name="update_pages" id="update_pages"><label for="update_pages">' . getLanguageValue("install_update_files_in_pages") . '</label><br /><br />';
                }
                $update_submit = $update_pages . '<input type="submit" name="update_cms" value="' . getLanguageValue("install_update_buttom") . '" />';
                $update_submit = contend_template($update_submit, "");
            }
        } else {
            $head = contend_template(installHelp("install_update_no_help"), "");
        }
    } elseif (isset($_POST['update_cms'])) {
        makeUpdate();
        $head = contend_template(installHelp("install_update_successful"), true);
    }
    return array(true, $head . $html . $update_submit, true);
}
Esempio n. 8
0
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 = '&nbsp;';
                $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&amp;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;
}
Esempio n. 9
0
function admin()
{
    global $ADMIN_CONF;
    global $loginpassword;
    global $specialchars;
    if (function_exists('gzopen') and getRequestValue('get_backup', 'post') == "true") {
        send_backup_zip();
    }
    if (getRequestValue('chanceadmin', 'post') == "true") {
        echo set_admin_para();
        exit;
    } elseif (getRequestValue('newpw', 'post') or getRequestValue('newname', 'post') or getRequestValue('newpwrepeat', 'post') or getRequestValue('newuserpw', 'post') or getRequestValue('newusername', 'post') or getRequestValue('newuserpwrepeat', 'post')) {
        if (false !== ($newname = getRequestValue('newname', 'post', false)) and false !== ($newpw = getRequestValue('newpw', 'post', false)) and false !== ($newpwrepeat = getRequestValue('newpwrepeat', 'post', false)) and $newname != "" and $newpw != "" and $newpwrepeat != "") {
            if (ROOT) {
                echo setPassword($newname, $newpw, $newpwrepeat, "root");
                exit;
            } else {
                ajax_return("error", true, returnMessage(false, getLanguageValue("error_no_root")), true, true);
            }
        } elseif (false !== ($newusername = getRequestValue('newusername', 'post', false)) and false !== ($newuserpw = getRequestValue('newuserpw', 'post', false)) and false !== ($newuserpwrepeat = getRequestValue('newuserpwrepeat', 'post', false)) and $newusername != "" and $newuserpw != "" and $newuserpwrepeat != "") {
            echo setPassword($newusername, $newuserpw, $newuserpwrepeat, "user");
            exit;
        } else {
            ajax_return("error", true, returnMessage(false, getLanguageValue("pw_error_missingvalues")), true, true);
        }
    } elseif (getRequestValue('deluser', 'post') == "true") {
        if (ROOT) {
            $user = $loginpassword->get("username");
            $loginpassword->set("username", "");
            $loginpassword->set("userpw", "");
            ajax_return("success", true, returnMessage(true, '<b>' . $user . '</b> ' . getLanguageValue("admin_messages_del_user")), true, true);
        } else {
            ajax_return("error", true, returnMessage(false, getLanguageValue("error_no_root")), true, true);
        }
    } elseif (USE_CHMOD and getRequestValue('chmodupdate', 'post') == "true" and false !== ($chmodnewfilesatts = getRequestValue('chmodnewfilesatts', 'post')) and $chmodnewfilesatts != "") {
        if (!preg_match("/^[0-7]{3}\$/", $chmodnewfilesatts)) {
            ajax_return("error", true, returnMessage(false, getLanguageValue("admin_error_chmodnewfilesatts")), true, true);
        }
        if ($ADMIN_CONF->get('chmodnewfilesatts') != $chmodnewfilesatts) {
            $ADMIN_CONF->set('chmodnewfilesatts', $chmodnewfilesatts);
        }
        if (true !== ($error = setUserFilesChmod())) {
            ajax_return("error", true, $error, true, true);
        }
        ajax_return("success", true, returnMessage(false, getLanguageValue("admin_messages_chmod")), true, true);
    }
    $pagecontent = "";
    $template = array();
    $error = array();
    $show = $ADMIN_CONF->get("admin");
    if (!is_array($show)) {
        $show = array();
    }
    $titel = "admin_button";
    if (ROOT or in_array("language", $show)) {
        $count = 0;
        if (isset($template[$titel])) {
            $count = count($template[$titel]);
        }
        // Zeile "SPRACHAUSWAHL"
        $language_array = getDirAsArray(BASE_DIR_ADMIN . 'sprachen', "file", "natcasesort");
        if (count($language_array) <= 0) {
            $error[$titel][$count] = getLanguageValue("admin_error_language_empty");
        } elseif (!in_array("language_" . $ADMIN_CONF->get('language') . ".txt", $language_array)) {
            $error[$titel][$count] = getLanguageValue("admin_error_languagefile_error") . "<br />" . ADMIN_DIR_NAME . "/sprachen/language_" . $ADMIN_CONF->get('language') . ".txt";
        } else {
            $error[$titel][$count] = false;
        }
        $admin_inhalt = '<div class="mo-select-div"><select name="language" class="mo-select js-language">';
        foreach ($language_array as $element) {
            if (substr($element, 0, 9) == "language_") {
                $selected = NULL;
                $tmp_array = file(BASE_DIR_ADMIN . "sprachen/" . $element);
                $currentlanguage = NULL;
                foreach ($tmp_array as $line) {
                    if (preg_match("/^#/", $line) || preg_match("/^\\s*\$/", $line)) {
                        continue;
                    }
                    if (preg_match("/^([^=]*)=(.*)/", $line, $matches)) {
                        if (trim($matches[1]) == "_translator") {
                            $currentlanguage = trim($matches[2]);
                            break;
                        }
                    }
                }
                if (substr($element, 9, 4) == $ADMIN_CONF->get("language")) {
                    $selected = "selected ";
                }
                $admin_inhalt .= "<option " . $selected . "value=\"" . substr($element, 9, 4) . "\">" . substr($element, 9, 4) . " (" . getLanguageValue("admin_input_translator") . " " . $currentlanguage . ")</option>";
            }
        }
        $admin_inhalt .= "</select></div>";
        $template[$titel][] = array(getLanguageValue("admin_input_language"), $admin_inhalt);
    }
    // Zeile "ADMIN-MAIL"
    if (ROOT or in_array("adminmail", $show)) {
        if (function_exists("isMailAvailable")) {
            $template[$titel][] = array(getLanguageValue("admin_text_adminmail"), '<input type="text" class="mo-input-text" name="adminmail" value="' . $specialchars->rebuildSpecialChars($ADMIN_CONF->get("adminmail"), true, true) . '" />');
        }
    }
    // Zeile "BACKUP-ERINNERUNG"
    if (ROOT or in_array("backupmsgintervall", $show)) {
        $template[$titel][] = array(getLanguageValue("admin_text_backup"), '<input type="text" class="mo-input-digit js-in-digit" name="backupmsgintervall" value="' . $ADMIN_CONF->get("backupmsgintervall") . '" />');
    }
    // Zeile "Backup"
    if (ROOT or in_array("getbackup", $show)) {
        if (function_exists('gzopen')) {
            $cms_size = dirsize(BASE_DIR_ADMIN) + dirsize(BASE_DIR_CMS);
            if (false !== ($tmp_size = dirsize(BASE_DIR . "jquery/"))) {
                $cms_size += $tmp_size;
            }
            $cms_input = buildCheckBox("backup_include_cms", "true", getLanguageValue("admin_button_include_cms") . " (<span class=\"js-file-size\">" . convertFileSizeUnit($cms_size) . "</span>)") . '<br />';
            $catpage_input = "";
            if (false !== ($tmp_size = dirsize(CONTENT_DIR_REL))) {
                $catpage_input = buildCheckBox("backup_include_catpage", "false", getLanguageValue("admin_button_include_catpage") . "  (<span class=\"js-file-size\">" . convertFileSizeUnit($tmp_size) . "</span>)") . '<br />';
            }
            $gallery_input = "";
            if (false !== ($tmp_size = dirsize(GALLERIES_DIR_REL))) {
                $gallery_input = buildCheckBox("backup_include_gallery", "false", getLanguageValue("admin_button_include_gallery") . "  (<span class=\"js-file-size\">" . convertFileSizeUnit($tmp_size) . "</span>)") . '<br />';
            }
            $layouts_input = "";
            if (false !== ($tmp_size = dirsize(BASE_DIR . LAYOUT_DIR_NAME))) {
                $layouts_input = buildCheckBox("backup_include_layouts", "false", getLanguageValue("admin_button_include_layouts") . "  (<span class=\"js-file-size\">" . convertFileSizeUnit($tmp_size) . "</span>)") . '<br />';
            }
            $plugins_input = "";
            if (false !== ($tmp_size = dirsize(BASE_DIR . PLUGIN_DIR_NAME))) {
                $plugins_input = buildCheckBox("backup_include_plugins", "false", getLanguageValue("admin_button_include_plugins") . "  (<span class=\"js-file-size\">" . convertFileSizeUnit($tmp_size) . "</span>)") . '<br />';
            }
            $docu_input = "";
            if (false !== ($tmp_size = dirsize(BASE_DIR . "docu/"))) {
                $docu_input = buildCheckBox("backup_include_docu", "false", getLanguageValue("admin_button_include_docu") . "  (<span class=\"js-file-size\">" . convertFileSizeUnit($tmp_size) . "</span>)") . '<br />';
            }
            $template[$titel][] = array(getLanguageValue("admin_text_get_backup"), '<form action="index.php?action=' . ACTION . '" method="post">' . '<input type="hidden" name="get_backup" value="true" />' . $cms_input . $catpage_input . $gallery_input . $layouts_input . $plugins_input . $docu_input . '<div style="font-size:.4em;">&nbsp;</div>' . '<input type="submit" name="admin_button_get_backup" value="' . getLanguageValue("admin_button_get_backup") . '" />' . '<span class="js-file-size-summe mo-padding-left">' . convertFileSizeUnit($cms_size) . '</span>' . '</form>');
        }
    }
    // Zeile "SETZE DATEIRECHTE FÜR NEUE DATEIEN"
    if (ROOT or in_array("chmodnewfilesatts", $show)) {
        if (USE_CHMOD) {
            $template[$titel][] = array(getLanguageValue("admin_text_chmodnewfiles"), '<input type="text" class="mo-input-digit js-in-chmod" size="4" maxlength="3" name="chmodnewfilesatts" value="' . $ADMIN_CONF->get("chmodnewfilesatts") . '" /><br /><br />' . '<input type="button" name="chmodupdate" value="' . getLanguageValue("admin_input_chmodupdate") . '" />');
        }
    }
    // Zeile "UPLOAD-FILTER"
    if (ROOT or in_array("noupload", $show)) {
        $template[$titel][] = array(getLanguageValue("admin_text_uploadfilter"), '<input type="text" class="mo-input-text" name="noupload" value="' . $specialchars->rebuildSpecialChars($ADMIN_CONF->get("noupload"), true, true) . '" />');
    }
    global $loginpassword;
    if (ROOT) {
        $template[$titel][] = getLanguageValue("pw_text_login") . '<br /><br />' . getLanguageValue("pw_help") . '<table width="100%" cellspacing="0" border="0" cellpadding="0" class="">' . '<tr><td>&nbsp;</td><td class="mo-in-li-r">' . getLanguageValue("pw_titel_newname") . '</td><td class="mo-in-li-r">' . '<input type="text" class="js-in-pwroot mo-input-text" name="newname" value="' . $loginpassword->get("name") . '" />' . '</td></tr>' . '<tr><td>&nbsp;</td><td>' . getLanguageValue("pw_titel_newpw") . '</td><td>' . '<input type="password" class="js-in-pwroot mo-input-text" value="' . NULL . '" name="newpw" />' . '</td></tr>' . '<tr><td>&nbsp;</td><td>' . getLanguageValue("pw_titel_newpwrepeat") . '</td><td>' . '<input type="password" class="js-in-pwroot mo-input-text" value="" name="newpwrepeat" />' . '</td></tr>' . "</table>";
    }
    if (ROOT or in_array("userpassword", $show)) {
        $deluser = NULL;
        $user_allowed_settings = NULL;
        if (ROOT) {
            $deluser = '******' . '<input type="button" name="deluser" value="' . getLanguageValue("admin_button_del_user") . '" />' . '<div style="font-size:.4em;">&nbsp;</div>' . '</td></tr>';
            $user_allowed_settings = '<br />' . '<div class="ui-helper-clearfix">' . '<div class="mo-in-li-l">' . getLanguageValue("admin_noroot_text") . '</div>' . '<div class="mo-in-li-r">' . userSettings("tabs") . '<div style="font-size:.4em;">&nbsp;</div>' . userSettings("config") . '<div style="font-size:.4em;">&nbsp;</div>' . userSettings("admin") . '<div style="font-size:.4em;">&nbsp;</div>' . userSettings("plugins") . '<div style="font-size:.4em;">&nbsp;</div>' . userSettings("template") . '</div>' . '</div>';
        }
        $template[$titel][] = getLanguageValue("userpw_text_login") . '<br /><br />' . getLanguageValue("pw_help") . '<table width="100%" cellspacing="0" border="0" cellpadding="0" class="">' . $deluser . '<tr><td>&nbsp;</td><td class="mo-in-li-r">' . getLanguageValue("userpw_titel_newname") . '</td><td class="mo-in-li-r">' . '<input type="text" class="js-in-pwuser mo-input-text" name="newusername" value="' . $loginpassword->get("username") . '" />' . '</td></tr>' . '<tr><td>&nbsp;</td><td>' . getLanguageValue("userpw_titel_newpw") . '</td><td>' . '<input type="password" class="js-in-pwuser mo-input-text" value="' . NULL . '" name="newuserpw" />' . '</td></tr>' . '<tr><td>&nbsp;</td><td>' . getLanguageValue("userpw_titel_newpwrepeat") . '</td><td>' . '<input type="password" class="js-in-pwuser mo-input-text" value="" name="newuserpwrepeat" />' . '</td></tr>' . "</table>" . $user_allowed_settings;
    }
    $pagecontent .= contend_template($template, $error);
    return $pagecontent;
}