function getConfig() { global $lang_contact_admin; $config = array(); $config['formularmail'] = array("type" => "text", "description" => $lang_contact_admin->get("config_text_formularmail"), "maxlength" => "100", "regex" => MAIL_REGEX, "regex_error" => $lang_contact_admin->get("config_error_formularmail")); $config['contactformwaittime'] = array("type" => "text", "description" => $lang_contact_admin->get("config_text_contactformwaittime"), "maxlength" => "4", "size" => "3", "regex" => "/^[\\d+]+\$/", "regex_error" => getLanguageValue("check_digit")); $config['contactformusespamprotection'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_text_contactformusespamprotection")); $config['contactformcalcs'] = array("type" => "textarea", "rows" => "10", "description" => $lang_contact_admin->get("config_titel_spam_question")); # name $config['titel_name'] = array("type" => "text", "description" => $lang_contact_admin->get("config_input_contact_name"), "maxlength" => "100"); $config['titel_name_show'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_show")); $config['titel_name_mandatory'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_mandatory")); # website $config['titel_website'] = array("type" => "text", "description" => $lang_contact_admin->get("config_input_contact_website"), "maxlength" => "100"); $config['titel_website_show'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_show")); $config['titel_website_mandatory'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_mandatory")); # mail $config['titel_mail'] = array("type" => "text", "description" => $lang_contact_admin->get("config_input_contact_mail"), "maxlength" => "100"); $config['titel_mail_send_copy'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_input_contact_mail_send_copy")); $config['titel_mail_show'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_show")); $config['titel_mail_mandatory'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_mandatory")); # message $config['titel_message'] = array("type" => "text", "description" => $lang_contact_admin->get("config_input_contact_textarea"), "maxlength" => "100"); $config['titel_message_show'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_show")); $config['titel_message_mandatory'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_mandatory")); $config['titel_privacy'] = array("type" => "text", "description" => $lang_contact_admin->get("config_input_contact_privacy"), "maxlength" => "100"); $config['titel_privacy_show'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_show")); $config['titel_privacy_mandatory'] = array("type" => "checkbox", "description" => $lang_contact_admin->get("config_titel_contact_mandatory")); $config['--template~~'] = '' . '<div class="mo-in-li-l">{formularmail_description}</div>' . '<div class="mo-in-li-r">{formularmail_text}</div>' . '</div></li>' . '<li class="mo-in-ul-li mo-inline ui-widget-content ui-corner-all ui-helper-clearfix"><div>' . '<div class="mo-in-li-l">{contactformwaittime_description}</div>' . '<div class="mo-in-li-r">{contactformwaittime_text}</div>' . '</div></li>' . '<li class="mo-in-ul-li mo-inline ui-widget-content ui-corner-all ui-helper-clearfix"><div>' . '<div class="mo-in-li-l" style="width:94%;">{contactformusespamprotection_description}<br /><br /></div>' . '<div class="mo-in-li-r" style="width:5%;">{contactformusespamprotection_checkbox}</div>' . '<div class="mo-clear"></div>' . '<div class="mo-in-li-l" style="width:30%;">{contactformcalcs_description}</div>' . '<div class="mo-in-li-r" style="width:69%;">{contactformcalcs_textarea}</div>' . '</div></li>' . '<li class="mo-in-ul-li mo-inline ui-widget-content ui-corner-all ui-helper-clearfix"><div>' . $lang_contact_admin->get("config_text_contact") . '<br /><br />' . '<table width="100%" cellspacing="0" border="0" cellpadding="0"><tr>' . '<td width="5%"> </td>' . '<td class="mo-nowrap mo-bold">' . $lang_contact_admin->get("config_titel_contact_help") . '</td>' . '<td width="30%" class="mo-nowrap mo-bold">' . $lang_contact_admin->get("config_titel_contact_input") . '</td>' . '<td width="1%" class="mo-nowrap mo-bold" style="padding:0 2em;">' . $lang_contact_admin->get("config_titel_contact_show") . '</td>' . '<td width="1%" class="mo-nowrap mo-bold">' . $lang_contact_admin->get("config_titel_contact_mandatory") . '</td>' . '</tr><tr>' . '<td> </td>' . '<td class="mo-nowrap mo-padding-top">{titel_name_description}</td>' . '<td class="mo-padding-top">{titel_name_text}</td>' . '<td class="mo-align-center mo-padding-top">{titel_name_show_checkbox}</td>' . '<td class="mo-align-center mo-padding-top">{titel_name_mandatory_checkbox}</td>' . '</tr><tr>' . '<td> </td>' . '<td class="mo-nowrap mo-padding-top">{titel_website_description}</td>' . '<td class="mo-padding-top">{titel_website_text}</td>' . '<td class="mo-align-center mo-padding-top">{titel_website_show_checkbox}</td>' . '<td class="mo-align-center mo-padding-top">{titel_website_mandatory_checkbox}</td>' . '</tr><tr>' . '<td> </td>' . '<td class="mo-nowrap mo-padding-top">{titel_mail_description}' . '<span style="float:right;padding-right:1em;">{titel_mail_send_copy_description} {titel_mail_send_copy_checkbox}</span><br class="mo-clear" />' . '</td>' . '<td class="mo-padding-top">{titel_mail_text}</td>' . '<td class="mo-align-center mo-padding-top">{titel_mail_show_checkbox}</td>' . '<td class="mo-align-center mo-padding-top">{titel_mail_mandatory_checkbox}</td>' . '</tr><tr>' . '<td> </td>' . '<td class="mo-nowrap mo-padding-top">{titel_message_description}</td>' . '<td class="mo-padding-top">{titel_message_text}</td>' . '<td class="mo-align-center mo-padding-top">{titel_message_show_checkbox}</td>' . '<td class="mo-align-center mo-padding-top">{titel_message_mandatory_checkbox}</td>' . '</tr><tr>' . '<td> </td>' . '<td class="mo-nowrap mo-padding-top">{titel_privacy_description}</td>' . '<td class="mo-padding-top">{titel_privacy_text}</td>' . '<td class="mo-align-center mo-padding-top">{titel_privacy_show_checkbox}</td>' . '<td class="mo-align-center mo-padding-top">{titel_privacy_mandatory_checkbox}</td>' . '</tr></table>'; return $config; }
function files() { global $CatPage; if (getRequestValue('chancefiles') == "true") { require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php"; exit; } if (false !== ($newfile = getRequestValue('newfile', 'post', false)) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) { $dir = CONTENT_DIR_REL . $curent_dir . "/" . CONTENT_FILES_DIR_NAME . "/"; if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) { ajax_return("error", true, $error, true, "js-dialog-reload"); } ajax_return("success", true); } $pagecontent = ""; require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php"; $pagecontent .= '<ul class="js-files mo-ul">'; $text_files = getLanguageValue("files"); foreach ($CatPage->get_CatArray(true, false) as $pos => $cat) { $pagecontent .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">'; $pagecontent .= getFileUpload($cat, $CatPage->get_HrefText($cat, false), $text_files); $pagecontent .= '</li>'; } $pagecontent .= '</ul>'; return $pagecontent; }
function getFileUpload($curent_dir, $dir = false, $count_text = false, $newcss = "") { $head = ""; if (ACTION != "template") { $count = "0"; $gallery_tools = ""; if (ACTION == "gallery") { $count = count(getDirAsArray(GALLERIES_DIR_REL . $curent_dir, "img")); $gallery_tools = '<img class="js-tools-icon-show-hide js-rename-file mo-tool-icon mo-icon' . $newcss . ' mo-icons-icon mo-icons-work" src="' . ICON_URL_SLICE . '" alt="work" />' . '<img class="js-tools-icon-show-hide js-edit-delete mo-tool-icon mo-icon' . $newcss . ' mo-icons-icon mo-icons-delete" src="' . ICON_URL_SLICE . '" alt="delete" hspace="0" vspace="0" />'; } elseif (ACTION == "files") { global $CatPage; $count = count($CatPage->get_FileArray($curent_dir)); } $head = '<div class="js-tools-show-hide mo-li-head-tag mo-li-head-tag-no-ul ui-state-active ui-corner-all mo-middle">' . '<span class="js-gallery-name mo-padding-left mo-bold">' . $dir . '</span>' . '<div style="float:right;" class="mo-nowrap">' . '<span class="mo-staus mo-font-small' . $newcss . '">( ' . '<span class="files-count">' . $count . '</span> ' . $count_text . ' )</span>' . '<img class="js-tools-icon-show-hide js-toggle mo-tool-icon' . $newcss . ' mo-icons-icon mo-icons-edit" src="' . ICON_URL_SLICE . '" alt="edit" />' . $gallery_tools . '</div>' . '<br class="mo-clear" />' . '</div>'; } $css = "mo-ul"; if (ACTION != "template") { $css = "mo-in-ul-ul"; } $fileupload = '<ul class="js-toggle-content ' . $css . ' ui-corner-bottom" style="display:none;">' . '<li class="ui-widget-content ui-corner-all">' . '<input type="hidden" name="curent_dir" value="' . $curent_dir . '" />' . '<input type="hidden" name="chancefiles" value="true" />' . '<input type="hidden" name="action" value="' . ACTION . '" />' . '<div class="fileupload-buttonbar mo-li-head-tag mo-li-head-tag-no-ul ui-widget-header ui-corner-top">' . '<span class="fileinput-button">' . '<img class="mo-icons-icon mo-icons-add-file" src="' . ICON_URL_SLICE . '" alt="add-file" />' . '<input type="file" name="files[]" />' . '</span>' . '<button type="submit" class="fu-img-button start mo-icons-icon mo-icons-save"> </button>' . '<button type="reset" class="fu-img-button cancel mo-icons-icon mo-icons-stop"> </button>' . '<img style="width:2em;height:1px;" src="' . ICON_URL_SLICE . '" alt=" " />' . '<button type="button" class="fu-img-button delete mo-icons-icon mo-icons-delete"> </button>'; if (ACTION == "gallery") { $fileupload .= '<button type="button" class="fu-img-button resize mo-icons-icon mo-icons-img-scale"> </button>'; } $fileupload .= '<input type="checkbox" class="toggle" />'; if (ACTION == "gallery") { global $GALLERY_CONF; $tmp_w = ""; $tmp_h = ""; if ($GALLERY_CONF->get('maxwidth') != "auto" and $GALLERY_CONF->get('maxwidth') > 0) { $tmp_w = $GALLERY_CONF->get('maxwidth'); } if ($GALLERY_CONF->get('maxheight') != "auto" and $GALLERY_CONF->get('maxheight') > 0) { $tmp_h = $GALLERY_CONF->get('maxheight'); } $fileupload .= '' . '<img style="width:2em;height:1px;" src="' . ICON_URL_SLICE . '" alt=" " />' . getLanguageValue("gallery_image_size") . ' <input type="text" name="new_width" value="' . $tmp_w . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> x <input type="text" name="new_height" value="' . $tmp_h . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" />' . '<img style="width:2em;height:1px;" src="' . ICON_URL_SLICE . '" alt=" " />' . getLanguageValue("gallery_preview_size") . ' <input type="text" name="thumbnail_max_width" value="' . $GALLERY_CONF->get('maxthumbwidth') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> x <input type="text" name="thumbnail_max_height" value="' . $GALLERY_CONF->get('maxthumbheight') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" />' . ''; } $fileupload .= '</div>' . '<ul class="files"></ul>' . '</li>' . '</ul>'; $form_start = '<form class="fileupload" action="index.php" method="post" enctype="multipart/form-data">'; $form_end = '</form>'; return $form_start . $head . $fileupload . $form_end; }
function set_config_para() { global $CMS_CONF, $specialchars; $title = ""; $main = makeDefaultConf("main"); unset($main['expert']); foreach ($main as $type => $type_array) { foreach ($main[$type] as $syntax_name => $dumy) { if (false === ($syntax_value = getRequestValue($syntax_name, 'post'))) { continue; } if ($type == 'text') { if ($CMS_CONF->get($syntax_name) != $syntax_value) { $CMS_CONF->set($syntax_name, $syntax_value); if ($syntax_name == "websitetitle") { $title = '<span id="replace-item"><span id="admin-websitetitle" class="mo-bold mo-td-middle">' . $specialchars->rebuildSpecialChars($syntax_value, false, true) . '</span></span>'; } } } if ($type == 'checkbox') { if ($syntax_value != "true" and $syntax_value != "false") { return ajax_return("error", false, returnMessage(false, getLanguageValue("properties_error_save")), true, true); } # die checkbox hat immer einen anderen wert als der gespeicherte deshalb keine prüfung $CMS_CONF->set($syntax_name, $syntax_value); if ($syntax_name == "modrewrite" and true !== ($error = write_modrewrite($syntax_value))) { return $error; } if ($syntax_name == "usesitemap") { if (true !== ($error = write_robots())) { return $error; } if (true != ($error = write_xmlsitmap(true))) { return $error; } } } } } return ajax_return("success", false) . $title; }
function returnTemplateSelectbox() { global $CMS_CONF; global $specialchars; $LAYOUT_DIR = BASE_DIR . LAYOUT_DIR_NAME . "/" . $CMS_CONF->get("cmslayout") . '/'; $selectbox = '<select name="template_css" class="overviewselect" title="' . getLanguageValue("toolbar_template", true) . ':">'; $selectbox .= '<optgroup label="' . getLanguageValue("toolbar_template_css", true) . '">'; foreach (getDirAsArray($LAYOUT_DIR . 'css', array(".css"), "natcasesort") as $file) { $selectbox .= '<option value="{LAYOUT_DIR}/css/' . $specialchars->replaceSpecialChars($file, true) . '">' . $specialchars->rebuildSpecialChars($file, false, true) . '</option>'; } $selectbox .= '</optgroup>'; $selectbox .= '<optgroup label="' . getLanguageValue("toolbar_template_image", true) . '">'; foreach (getDirAsArray($LAYOUT_DIR . 'grafiken', "img", "natcasesort") as $file) { $selectbox .= '<option value="{LAYOUT_DIR}/grafiken/' . $specialchars->replaceSpecialChars($file, true) . '">' . $specialchars->rebuildSpecialChars($file, false, true) . '</option>'; } $selectbox .= '</optgroup>'; $selectbox .= "</select>"; return $selectbox; }
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 getHtml($art, $current_step = false) { $install_js = 'function test_modrewrite(url,para,step) { var send_to_test = false; $.ajax({ global: true, cache: false, type: "POST", url: url, data: para, async: true, dataType: "html", timeout:20000, success: function(data, textStatus, jqXHR){ if($("<span>"+data+"</span>").find("#mod-rewrite-true").length > 0) { finish_test = true; } else if($("<span>"+data+"</span>").find("#return-modconf").length > 0) { send_to_test = true; } }, complete: function() { if(send_to_test === true) { test_modrewrite("install/xy/test.php","",step); } else if(finish_test === false && step < max_step) { step++; $("#step-mod-conf").text(step); test_modrewrite("install.php","fromajax=true¤t_step=rewrite&modconf="+step,step); } else if(finish_test === true) { $("#step-mod-conf").text(step); $(\'input[name="rewrite"]\').val(step); $("form").trigger("submit"); } else { $("#step-mod-conf").text(step); $(\'input[name="rewrite"]\').val("no_modrewrite"); $("form").trigger("submit"); } }, }); } $(function() { if(typeof max_step != "undefined") { $("#step-mod-conf").text("0"); test_modrewrite("install.php","fromajax=true¤t_step=rewrite&modconf=0",0); } $(".step_tabs").bind("click", function(event) { event.preventDefault(); if($(this).closest("li").hasClass("js-no-click")) return false; $("#step_input").val($(this).attr("name")); $("form").trigger("submit"); }); $("#select-lang").bind("change", function(event) { event.preventDefault(); $("form").trigger("submit"); }); $(".js-in-pwroot").bind("keydown", function(event) { if(event.which == 13) event.preventDefault(); }); $("form").bind("submit",function(event) { if($("#step_input").val() == "") $("#step_input").val($(".ui-tabs-selected a").attr("name")); }); var toggle_out = "' . getLanguageValue("install_toggle_open") . '", toggle_in = "' . getLanguageValue("install_toggle_close") . '", toggle_speed = 600, toggle_speed_half = Math.round(toggle_speed / 2), toggle_before = " <a class=\\"toggle-link\\" href=\\"#\\">"+toggle_out+"</a>"; $(".toggle-content").fadeOut(0).before(toggle_before); $("body").on({ click: function(event) { event.preventDefault(); var toggle_item = $(this).next(".toggle-content").eq(0), that = $(this), toggle_out_in = toggle_out; if(toggle_item.is(":hidden")) { toggle_item.fadeIn(toggle_speed); toggle_out_in = toggle_in; } else { toggle_item.fadeOut(toggle_speed); }; that.animate({opacity : 0},toggle_speed_half,function() { that.text(toggle_out_in); that.animate({opacity : 1},toggle_speed_half); }); } },".toggle-link"); });'; $html_start = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="de">' . '<head>' . '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '" />' . '<link type="image/x-icon" rel="SHORTCUT ICON" href="' . URL_BASE . ADMIN_DIR_NAME . '/favicon.ico" />' . '<link type="text/css" rel="stylesheet" href="' . URL_BASE . ADMIN_DIR_NAME . '/css/mozilo/jquery-ui-1.9.2.custom.css" />' . '<link type="text/css" rel="stylesheet" href="' . URL_BASE . ADMIN_DIR_NAME . '/admin.css" />' . '<script type="text/javascript" src="' . URL_BASE . CMS_DIR_NAME . '/jquery/jquery-1.7.2.min.js"></script>' . '<script language="Javascript" type="text/javascript">/*<![CDATA[*/' . $install_js . '/*]]>*/</script>' . '<title>Setup</title>' . '</head>' . '<body>' . '<body class="ui-widget" style="font-size:12px;">' . '<table summary="" width="100%" cellspacing="0" border="0" cellpadding="0" style="margin-top:1.5em;">' . '<tr><td> </td>' . '<td class="mo-td-content-width" style="vertical-align:top;">' . '<noscript><div class="mo-noscript mo-td-content-width ui-state-error ui-corner-all"><div>' . getLanguageValue("error_no_javascript") . '</div></div></noscript>'; # if($current_step === "finish") # $html_start .= '<form action="admin/index.php" method="post">'; # else $html_start .= '<form action="install.php" method="post">'; $html_start .= '<div class="mo-td-content-width ui-tabs ui-widget ui-widget-content ui-corner-all mo-ui-tabs" style="position:relative;">'; $html_end = '</div></form>' . '<div id="out"></div>' . '</td><td> </td></tr></table>'; if ($art == "start") { return $html_start; } if ($art == "end") { return $html_end; } }
function get_template_truss($content, $titel, $toggle = false) { if ($toggle) { $template = '<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($titel) . '</span>' . '<img style="float:right;" class="js-toggle mo-tool-icon mo-icon mo-icons-icon mo-icons-edit" src="' . ICON_URL_SLICE . '" alt="edit" />' . '</div>' . '<ul class="mo-in-ul-ul js-toggle-content" style="display:none;">'; } else { $template = '<ul class="mo-ul">' . '<li class="mo-li ui-widget-content ui-corner-all">' . '<div class="mo-li-head-tag mo-tag-height-from-icon mo-li-head-tag-no-ul mo-middle ui-state-default ui-corner-top">' . '<span class="mo-bold mo-padding-left">' . getLanguageValue($titel) . '</span></div>' . '<ul class="mo-in-ul-ul">'; } $template .= $content; $template .= '</ul>' . '</li>' . '</ul>'; return $template; }
function get_Message($message) { global $LOGINCONF; global $ADMIN_CONF; $html = ""; if (!empty($message)) { if (is_array($message)) { foreach ($message as $inhalt) { $html .= $inhalt; } } else { $html .= $message; } } // Warnung, wenn seit dem letzten Login Logins fehlgeschlagen sind if ($LOGINCONF->get("falselogincount") > 0) { $html .= returnMessage(false, getLanguageValue("messages_false_logins") . " " . $LOGINCONF->get("falselogincount")); // Gesamt-Counter fuer falsche Logins zuruecksetzen $LOGINCONF->set("falselogincount", 0); } // Warnung, wenn die letzte Backupwarnung mehr als $intervallsetting Tage her ist if (ROOT or is_array($ADMIN_CONF->get("admin")) and in_array("backupmsgintervall", $ADMIN_CONF->get("admin"))) { $intervallsetting = $ADMIN_CONF->get("backupmsgintervall"); if ($intervallsetting != "" and $intervallsetting > 0) { $intervallinseconds = 60 * 60 * 24 * $intervallsetting; $lastbackup = $ADMIN_CONF->get("lastbackup"); // initial: nur setzen if ($lastbackup == "") { $ADMIN_CONF->set("lastbackup", time()); // wenn schon gesetzt: pruefen und ggfs. warnen } else { $nextbackup = $lastbackup + $intervallinseconds; if ($nextbackup <= time()) { $html .= '<span id="lastbackup">' . returnMessage(true, getLanguageValue("admin_messages_backup")) . '</span><span style="display:none;" id="lastbackup_yes">lastbackup_yes=true</span>'; } } } } if (strlen($html) > 1) { return '<div id="dialog-auto" style="display:none;">' . $html . '</div>'; } else { return ""; } }
function adminFilesSelectbox($cat, $keyToCheck, $in_og_image) { global $specialchars; global $CatPage; global $ALOWED_IMG_ARRAY; $select = '<select name="ogp[' . $keyToCheck . '][og_image]" class="overviewselect" title="' . getLanguageValue("files_button", true) . ':">'; $select .= '<option value="' . "false" . '">' . "Kein Bild" . "</option>"; $cleancatname = $CatPage->get_HrefText($cat, false); foreach ($CatPage->get_FileArray($cat, $ALOWED_IMG_ARRAY) as $current_file) { $selected = ''; if ($current_file == $in_og_image) { $selected = ' selected="selected"'; } $select .= '<option value="' . $specialchars->rebuildSpecialChars($current_file, true, true) . '"' . $selected . '>' . $specialchars->rebuildSpecialChars($current_file, false, true) . "</option>"; } $select .= "</select>"; return $select; }
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); }
function get_page($cat, $page) { global $CatPage; $cat = $CatPage->get_FileSystemName($cat, false); $page = $CatPage->get_FileSystemName($cat, $page); if ($CatPage->get_Type($cat, $page) != EXT_LINK) { if (false !== ($pagecontent = get_contents_ace_edit(CONTENT_DIR_REL . $cat . '/' . $page))) { return ajax_return("success", false) . '<textarea id="page-content">' . $pagecontent . '</textarea>'; } } return ajax_return("error", false, returnMessage(false, getLanguageValue("editor_content_error_open")), true, true); }
function template_del() { global $specialchars; global $message; global $debug; $template_del = getRequestValue('template-del', 'post'); if (is_array($template_del)) { foreach ($template_del as $template) { $debug .= "del=" . $template . "<br />\n"; if (true !== ($error = deleteDir(BASE_DIR . LAYOUT_DIR_NAME . "/" . $specialchars->replaceSpecialChars($template, false)))) { $message .= $error; } } } else { $message .= returnMessage(false, getLanguageValue("error_post_parameter")); } }
function login_formular($enabled, $error_lang = false) { # das "error" wird gebraucht damit bei einer ajax anfrage der login erscheint $form = '<div class="error mo-login-box js-dialog-content js-dialog-reload">'; $enabled_css = "ui-state-highlight"; $enabled_input = ""; if (!$enabled) { $enabled_css = "ui-state-error"; $enabled_input = ' readonly="readonly"'; } if ($error_lang !== false) { $form .= '<div class="mo-login_message_fehler ui-widget-content ui-state-error ui-corner-all ui-helper-clearfix">' . returnMessage(false, getLanguageValue($error_lang)) . "</div>"; if ($error_lang == "install_login") { return $form . '</div>'; } } $form .= '<div class="mo-login ' . $enabled_css . ' ui-corner-all">'; if ($enabled) { $form .= '<form accept-charset="' . CHARSET . '" name="loginform" action="' . URL_BASE . ADMIN_DIR_NAME . "/index.php" . '" method="post">'; } $form .= '<table width="100%" cellspacing="10" border="0" cellpadding="0">' . "<tr>" . '<td width="1%" rowspan="2" align="center" valign="middle">' . '<img src="' . ICON_URL . 'login.png" alt="Login" />' . "</td>" . '<td width="1%" class="mo-nowrap">' . getLanguageValue("username") . ":" . "</td>" . "<td>" . '<input class="mo-login_input" type="text" size="15" name="username" autocomplete="off"' . $enabled_input . ' />' . "</td>" . "</tr>" . "<tr>" . '<td class="mo-nowrap">' . getLanguageValue("password") . ":" . "</td>" . "<td>" . '<input class="mo-login_input" type="password" size="15" name="password" autocomplete="off"' . $enabled_input . ' />' . "</td>" . "</tr>" . "<tr>" . '<td colspan="3" class="mo-align-center">' . '<input name="login" value="Login" class="mo-login_submit" type="submit"' . $enabled_input . ' />' . "</td>" . "</tr>" . "</table>"; if ($enabled) { $form .= "</form>"; } $form .= '</div></div>'; return $form; }
function changeFromFtp() { global $message; global $specialchars; $success = false; $dirgallery = getDirAsArray(GALLERIES_DIR_REL, "dir"); foreach ($dirgallery as $currentgalerien) { $change = false; if (true !== ($error = setChmod(GALLERIES_DIR_REL . $currentgalerien))) { $message .= returnMessage(false, $error); return; } $test_galerie = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($currentgalerien, false, false), false); if ($test_galerie != $currentgalerien) { $nr = 0; $new_name = $test_galerie; while (in_array($new_name, $dirgallery)) { $new_name = "%23_" . $nr . "_" . $test_galerie; $nr++; } if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien, GALLERIES_DIR_REL . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; $currentgalerien = $new_name; } if (!is_dir(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME)) { if (true !== ($error = mkdirMulti(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME))) { $message .= returnMessage(false, $error); return; } $change = true; } if (!file_exists(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf.php")) { if (false === newConf(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf.php")) { $message .= returnMessage(false, getLanguageValue("gallery_error_subtitle_conf")); return; } $change = true; } $dirimg = getDirAsArray(GALLERIES_DIR_REL . $currentgalerien, "img"); foreach ($dirimg as $currentimg) { if (true !== ($error = setChmod(GALLERIES_DIR_REL . $currentgalerien . "/" . $currentimg))) { $message .= returnMessage(false, $error); return; } $test_img = cleanUploadFile($currentimg); if ($test_img != $currentimg) { $nr = 0; $new_name = $test_img; while (in_array($new_name, $dirimg)) { $new_name = "_" . $nr . "_" . $test_img; $nr++; } if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien . "/" . $currentimg, GALLERIES_DIR_REL . $currentgalerien . "/" . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; if (is_file(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $currentimg)) { if (true !== ($error = moveFileDir(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $currentimg, GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . "/" . $new_name))) { $message .= returnMessage(false, $error); return; } $change = true; } } } if ($change) { $success .= "<b>" . $specialchars->rebuildSpecialChars($currentgalerien, false, true) . "</b><br />"; } } if ($success) { $message .= returnMessage(true, getLanguageValue("gallery_messages_from_ftp") . "<br /><br />" . $success); } else { $message .= returnMessage(true, getLanguageValue("gallery_messages_from_ftp_no") . ""); } }
function plugin_install($zip = false) { if (!function_exists('gzopen')) { return; } global $debug; @set_time_limit(600); global $message, $specialchars; $dir = PLUGIN_DIR_REL; if ($zip === false) { $zip_file = $dir . $specialchars->replaceSpecialChars($_FILES["plugin-install-file"]["name"], false); } else { if (getChmod() !== false) { setChmod($dir . $zip); } $zip_file = $dir . $zip; } $debug .= $zip_file . "<br />"; # if(true === (move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file))) { if ($zip !== false and strlen($zip_file) > strlen($dir) or $zip === false and true === move_uploaded_file($_FILES["plugin-install-file"]["tmp_name"], $zip_file)) { require_once BASE_DIR_ADMIN . "pclzip.lib.php"; $archive = new PclZip($zip_file); if (0 != ($file_list = $archive->listContent())) { uasort($file_list, "helpUasort"); $find = installFindPlugins($file_list, $archive); if (count($find) > 0) { foreach ($find as $liste) { if (strlen($liste['index']) > 0) { $debug .= '<pre>'; $debug .= var_export($liste, true); $debug .= '</pre>'; if (getChmod() !== false) { $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_OPT_SET_CHMOD, getChmod(), PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER); setChmod($dir . $liste['name']); } else { $tmp1 = $archive->extractByIndex($liste['index'], PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_ADD_PATH, $liste['name'], PCLZIP_OPT_REMOVE_PATH, $liste['remove_dir'], PCLZIP_CB_PRE_EXTRACT, "PclZip_PreExtractCallBack", PCLZIP_OPT_REPLACE_NEWER); } } else { # die file strucktur im zip stimt nicht $message .= returnMessage(false, getLanguageValue("error_zip_structure")); } } } else { # die file strucktur im zip stimt nicht $message .= returnMessage(false, getLanguageValue("error_zip_structure")); } } else { # scheint kein gühltiges zip zu sein $message .= returnMessage(false, getLanguageValue("error_zip_nozip") . "<br />" . $zip_file); } unlink($zip_file); } else { # das zip konnte nicht hochgeladen werden $message .= returnMessage(false, getLanguageValue("error_file_upload") . "<br />" . $zip_file); } }
function home() { require_once BASE_DIR_CMS . "Mail.php"; // Testmail schicken und gleich raus hier if (false !== ($test_mail_adresse = getRequestValue('test_mail_adresse', 'post')) and $test_mail_adresse != "") { header('content-type: text/html; charset=' . CHARSET . ''); global $specialchars; $test_mail_adresse = $specialchars->rebuildSpecialChars($test_mail_adresse, false, false); if (isMailAddressValid($test_mail_adresse)) { sendMail(getLanguageValue("home_mailtest_mailsubject"), getLanguageValue("home_mailtest_mailcontent"), $test_mail_adresse, $test_mail_adresse); ajax_return("success", true, returnMessage(true, getLanguageValue("home_messages_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true); } else { ajax_return("error", true, returnMessage(false, getLanguageValue("home_error_test_mail") . "<br /><br /><b>" . $test_mail_adresse . '</b>'), true, true); } exit; } global $CMS_CONF; if ($CMS_CONF->get('usesitemap') == "true") { global $message; if (!is_file(BASE_DIR . 'robots.txt')) { if (true !== ($error_message = write_robots())) { $message .= $error_message; } } if (!is_file(BASE_DIR . 'sitemap.xml')) { if (true != ($error_message = write_xmlsitmap())) { $message .= $error_message; } } } // CMS-Hilfe $titel = "home_help"; if (file_exists(BASE_DIR . "docu/index.php")) { $error[$titel][] = false; $template[$titel][] = getLanguageValue("home_help_text_docu") . ' <a href="' . URL_BASE . 'docu/index.php" target="_blank" class="mo-butten-a-img"><img class="mo-icons-icon mo-icons-docu" src="' . ICON_URL_SLICE . '" alt="docu" hspace="0" vspace="0" border="0" /></a>'; $error[$titel][] = false; $template[$titel][] = getLanguageValue("home_help_text_info") . ' <a href="' . URL_BASE . 'docu/index.php?menu=false&artikel=start" target="_blank" class="js-docu-link mo-butten-a-img"><img class="mo-icons-icon mo-icons-help" src="' . ICON_URL_SLICE . '" alt="help" hspace="0" vspace="0" border="0" /></a>'; } else { $error[$titel][] = true; $template[$titel][] = getLanguageValue("home_no_help"); } // Zeile "Multiuser Reset" if (defined('MULTI_USER') and MULTI_USER) { $titel = "home_multiuser"; $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_multiuser_text"), '<form action="index.php?action=' . ACTION . '" method="post">' . '<input type="hidden" name="logout_other_users" value="true" />' . '<input type="submit" name="submitlogout_other_users" value="' . getLanguageValue("home_multiuser_button") . '" />' . '</form>'); } // CMS-INFOS $titel = "home_cmsinfo"; // Zeile "CMS-VERSION" $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_cmsversion_text"), CMSVERSION . ' ("' . CMSNAME . '")<br />' . getLanguageValue("home_cmsrevision_text") . ' ' . CMSREVISION); // Zeile "Gesamtgröße des CMS" $cmssize = convertFileSizeUnit(dirsize(BASE_DIR)); if ($cmssize === false) { $error[$titel][] = true; $cmssize = "0"; } else { $error[$titel][] = false; } $template[$titel][] = array(getLanguageValue("home_cmssize_text"), $cmssize); // Zeile "Installationspfad" und alle 40 Zeichen einen Zeilenumbruch einfügen $path = BASE_DIR; if (strlen($path) >= 40) { $path = explode("/", $path); if (is_array($path)) { if (empty($path[count($path) - 1])) { unset($path[count($path) - 1]); } $i = 0; $new_path[$i] = ""; foreach ($path as $string) { $string = $string . "/"; if (strlen($new_path[$i] . $string) <= 40) { $new_path[$i] = $new_path[$i] . $string; } else { $i++; $new_path[$i] = $string; } } } $path = implode("<br />", $new_path); } $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_installpath_text"), $path); // SERVER-INFOS $titel = "home_serverinfo"; // Aktueles Datum $error[$titel][] = false; $time_zone = date("T"); if (function_exists('date_default_timezone_get')) { $time_zone = @date_default_timezone_get(); } $template[$titel][] = array(getLanguageValue("home_date_text"), date("Y-m-d H.i.s") . " " . $time_zone); // Sprache $error[$titel][] = false; if (false !== ($locale = @setlocale(LC_TIME, "0"))) { $template[$titel][] = array(getLanguageValue("home_text_locale"), $locale); } else { $template[$titel][] = array(getLanguageValue("home_text_locale"), getLanguageValue("home_text_nolocale")); } // Zeile "PHP-Version" if (version_compare(PHP_VERSION, MIN_PHP_VERSION) >= 0) { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion()); } else { $error[$titel][] = getLanguageValue("home_error_phpversion_text"); $template[$titel][] = array(getLanguageValue("home_phpversion_text"), phpversion()); } // Zeile "Safe Mode" if (ini_get('safe_mode')) { $error[$titel][] = getLanguageValue("home_error_safe_mode"); $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("yes")); } else { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_safemode"), getLanguageValue("no")); } // Zeile "GDlib installiert" if (!extension_loaded("gd")) { $error[$titel][] = getLanguageValue("home_error_gd"); $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("no")); } else { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_gd"), getLanguageValue("yes")); } if ($CMS_CONF->get('modrewrite') == "true") { # mod_rewrite wird mit javascript ermitelt und ausgetauscht $error[$titel][] = getLanguageValue("home_error_mod_rewrite"); $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("no")); } else { $error[$titel][] = false; $template[$titel][] = array('<span id="mod-rewrite-false">' . getLanguageValue("home_mod_rewrite") . '</span>', getLanguageValue("home_mod_rewrite_deact")); } # backupsystem if (function_exists('gzopen')) { $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_text_backupsystem"), getLanguageValue("yes")); } else { $error[$titel][] = true; $template[$titel][] = array(getLanguageValue("home_error_backupsystem"), getLanguageValue("no")); } # MULTI_USER if (defined('MULTI_USER') and MULTI_USER) { $mu_string = ""; $rest_time = MULTI_USER_TIME; if ($rest_time >= 86400) { $mu_string .= floor(MULTI_USER_TIME / 86400) . " " . (floor(MULTI_USER_TIME / 86400) > 1 ? getLanguageValue("days") : getLanguageValue("day")) . " "; $rest_time = $rest_time - floor(MULTI_USER_TIME / 86400) * 86400; } if ($rest_time >= 3600) { $mu_string .= floor($rest_time / 3600) . " " . (floor($rest_time / 3600) > 1 ? getLanguageValue("hours") : getLanguageValue("hour")) . " "; $rest_time = $rest_time - floor($rest_time / 3600) * 3600; } if ($rest_time >= 60) { $mu_string .= floor($rest_time / 60) . " " . (floor($rest_time / 60) > 1 ? getLanguageValue("minutes") : getLanguageValue("minute")) . " "; $rest_time = $rest_time - floor($rest_time / 60) * 60; } if ($rest_time > 0) { $mu_string .= $rest_time . " " . ($rest_time > 1 ? getLanguageValue("seconds") : getLanguageValue("second")); } $error[$titel][] = "ok"; $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), $mu_string); } else { $error[$titel][] = true; $template[$titel][] = array(getLanguageValue("home_multiuser_mode_text"), getLanguageValue("no")); } // E-Mail test if (isMailAvailable()) { $titel = "home_titel_test_mail"; $error[$titel][] = false; $template[$titel][] = array(getLanguageValue("home_text_test_mail"), '<input type="text" class="mo-input-text" name="test_mail_adresse" value="" />'); } else { $titel = "home_titel_test_mail"; $error[$titel][] = true; $template[$titel][] = getLanguageValue("home_messages_no_mail"); } return contend_template($template, $error); }
function send_backup_zip() { $tmp_date = date('Y_m_d_H-i-s'); $incl = ""; $make_zip = true; $send = false; $dirs = array(); if (getRequestValue('backup_include_cms', 'post') == "true") { $dirs[] = BASE_DIR_ADMIN; $dirs[] = BASE_DIR_CMS; $dirs[] = BASE_DIR . "index.php"; if (is_file(BASE_DIR . "install.php")) { $dirs[] = BASE_DIR . "install.php"; } if (is_file(BASE_DIR . "update.php")) { $dirs[] = BASE_DIR . "update.php"; } if (is_file(BASE_DIR . "robots.txt")) { $dirs[] = BASE_DIR . "robots.txt"; } if (is_file(BASE_DIR . "sitemap.xml")) { $dirs[] = BASE_DIR . "sitemap.xml"; } if (is_file(BASE_DIR . "sitemap_addon.xml")) { $dirs[] = BASE_DIR . "sitemap_addon.xml"; } if (is_file(BASE_DIR . ".htaccess")) { $dirs[] = BASE_DIR . ".htaccess"; } } if (getRequestValue('backup_include_catpage', 'post') == "true") { $dirs[] = CONTENT_DIR_REL; $incl .= "catpage_"; } if (getRequestValue('backup_include_gallery', 'post') == "true") { $dirs[] = GALLERIES_DIR_REL; $incl .= "gallery_"; } if (getRequestValue('backup_include_layouts', 'post') == "true") { $dirs[] = BASE_DIR . LAYOUT_DIR_NAME; $incl .= "layouts_"; } if (getRequestValue('backup_include_plugins', 'post') == "true") { $dirs[] = BASE_DIR . PLUGIN_DIR_NAME; $incl .= "plugins_"; } if (getRequestValue('backup_include_docu', 'post') == "true") { $dirs[] = BASE_DIR . "docu/"; $incl .= "docu_"; } if (strlen($incl) > 1) { $incl = "Include_" . $incl; } if (count($dirs) < 1) { $make_zip = false; global $message; $message .= returnMessage(false, getLanguageValue("admin_error_no_backups_select")); } if ($make_zip) { if (!is_dir(BASE_DIR . BACKUP_DIR_NAME)) { @mkdir(BASE_DIR . BACKUP_DIR_NAME); setChmod(BASE_DIR . BACKUP_DIR_NAME); } $filename = 'moziloCMS_Backup_' . $incl . $tmp_date . '.zip'; $file = BASE_DIR . BACKUP_DIR_NAME . '/' . $filename; define("PCLZIP_TEMPORARY_DIR", BASE_DIR . BACKUP_DIR_NAME . '/'); require_once BASE_DIR_ADMIN . "pclzip.lib.php"; $backup = new PclZip($file); if (0 != $backup->create($dirs, PCLZIP_OPT_REMOVE_PATH, BASE_DIR, PCLZIP_OPT_ADD_PATH, 'moziloCMS_Backup_' . $tmp_date)) { $send = true; } else { global $message; $message .= returnMessage(false, "Error : " . $backup->errorInfo()); $dh = opendir(BASE_DIR . BACKUP_DIR_NAME); while (($entry = readdir($dh)) !== false) { if ($entry == "." or $entry == "..") { continue; } @unlink(BASE_DIR . BACKUP_DIR_NAME . '/' . $entry); } closedir($dh); } } if ($send) { $filesize = filesize($file); // Header schreiben header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: application/zip"); header("Content-Disposition: inline; filename=\"" . $filename . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $filesize); # bei grossen dateien senden in kleinen stücken damit der speicherunter browserdialog schnell aufgeht if ($filesize > 1048576 * 10) { # 1048576 = 1mb $fp = fopen($file, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); } else { @readfile($file); } @unlink($file); exit; } }