示例#1
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);
}
示例#2
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;
}