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 getContent($value) { global $CatPage, $specialchars; if ($value == "plugin_first") { if (getRequestValue('action', 'get') and getRequestValue('action', 'get') == "sitemap") { if (!defined("ACTION_CONTENT")) { define("ACTION_CONTENT", false); } global $pagecontent; $pagecontent = "{MenuSubsMobile|sitemap_content}"; } return; } global $syntax; $syntax->insert_in_head('<script type="text/javascript" src="' . $this->PLUGIN_SELF_URL . 'menusubsmobile.js"></script>'); if ($this->settings->get("menusubs_2") != "no_menusubs_2" and $CatPage->exists_CatPage(replaceFileMarker($this->settings->get("menusubs_2"), false), false)) { global $specialchars; $this->menu2 = $specialchars->replaceSpecialChars(replaceFileMarker($this->settings->get("menusubs_2"), false), false); } if ($value === false) { return $this->getMenuCat(); } if ($value === "main") { return $this->getMenuCat(true); } if ($value === "detail") { if (strpos(CAT_REQUEST, "%2F") > 1) { $tmp_cat = explode("%2F", CAT_REQUEST); return $this->getMenuPage($tmp_cat[0], false, false, true); } else { return $this->getMenuPage(CAT_REQUEST, false, false, true); } } if ($this->menu2 and $value === "menusubs_2") { return $this->getMenuPage($this->menu2, false, true); } if ($value === "sitemap_content") { return $this->getSitemapCat(); } if ($value === "breadcrumb") { $this->breadcrumb_delimiter = "»"; if ($this->settings->get("breadcrumb_delimiter")) { $this->breadcrumb_delimiter = $this->settings->get("breadcrumb_delimiter"); } return $this->getBreadcrumb(); } return NULL; }
function getContent($value) { global $CatPage; if ($value == "plugin_first" and getRequestValue('action', 'get') and getRequestValue('action', 'get') == "sitemap") { if (!defined("ACTION_CONTENT")) { define("ACTION_CONTENT", false); } global $pagecontent; $pagecontent = "{MenuSubs|sitemap_content}"; return; } if ($this->settings->get("menusubs_2") != "no_menusubs_2" and $CatPage->exists_CatPage(replaceFileMarker($this->settings->get("menusubs_2"), false), false)) { global $specialchars; $this->menu2 = $specialchars->replaceSpecialChars(replaceFileMarker($this->settings->get("menusubs_2"), false), false); } if ($value === false) { return $this->getMenuCat(); } if ($value === "main") { return $this->getMenuCat(true); } if ($value === "detail") { if (strpos(CAT_REQUEST, "%2F") > 1) { $tmp_cat = explode("%2F", CAT_REQUEST); return $this->getMenuPage($tmp_cat[0]); } else { return $this->getMenuPage(CAT_REQUEST); } } if ($this->menu2 and $value === "menusubs_2") { return $this->getMenuPage($this->menu2, false, true); } if ($value === "sitemap_content") { return $this->getSitemapCat(); } if ($value === "breadcrumb") { $this->breadcrumb_delimiter = "»"; if ($this->settings->get("breadcrumb_delimiter")) { $this->breadcrumb_delimiter = $this->settings->get("breadcrumb_delimiter"); } return $this->getBreadcrumb(); } return NULL; }
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; }
header("Location: http://{$url}"); exit; } # nur reingehen wenn action home ist oder es noch keine get parameter gibt } elseif (getRequestValue('multi', 'get') or !getRequestValue('multi', 'get') and !$tmp_action) { $USERS->set($id, "freetab"); } # im FileUpload wird der tab besetzt mit window.location.href behandelt if (getRequestValue('fileupload', 'get')) { $url = $_SERVER['HTTP_HOST'] . URL_BASE . ADMIN_DIR_NAME . '/index.php?nojs=true&action=home&multi=true'; $USERS->set($id, "busy#" . getRequestValue('fileupload', 'get')); header("Location: http://{$url}"); exit; # hier gehts um die anfragen die von ajax kommen } elseif (!getRequestValue('multi', 'get') and in_array(getRequestValue('action'), $users_array)) { ajax_return("error", true, returnMessage(false, getLanguageValue("error_multi_user_tab", false, getLanguageValue(getRequestValue('action') . "_button"), MULTI_USER_TIME)), true, true); } unset($id); } if (in_array($tmp_action, $array_tabs)) { define("ACTION", $tmp_action); } else { define("ACTION", "home"); } unset($tmp_action); if (file_exists(BASE_DIR_ADMIN . ACTION . '.php')) { require_once BASE_DIR_ADMIN . ACTION . '.php'; } else { die("Fatal Error File doesn't exist: " . ACTION . ".php"); } $func = ACTION;
function plugin_del() { global $specialchars; global $message; global $debug; $plugin_del = getRequestValue('plugin-del', 'post'); if (is_array($plugin_del)) { foreach ($plugin_del as $plugin) { $debug .= "del=" . $plugin . "<br />\n"; if (true !== ($error = deleteDir(PLUGIN_DIR_REL . $plugin))) { $message .= $error; } } } else { $message .= returnMessage(false, getLanguageValue("error_post_parameter")); } }
// Anmeldung fehlerhaft } elseif (getRequestValue('login', 'post', false)) { // Counter hochzählen $falselogincounttemp = $LOGINCONF->get("falselogincounttemp") + 1; $LOGINCONF->set("falselogincounttemp", $falselogincounttemp); // Zähler für die aktuelle Sperrzeit $falselogincount = $LOGINCONF->get("falselogincount") + 1; $LOGINCONF->set("falselogincount", $falselogincount); // Gesamtzähler // maximale Anzahl falscher Logins erreicht? if ($falselogincounttemp >= $FALSELOGINLIMIT) { // Sperrzeit starten $LOGINCONF->set("loginlockstarttime", time()); // Mail an Admin if (strlen($ADMIN_CONF->get("adminmail")) > 5 and ($falselogincounttemp == $FALSELOGINLIMIT or $falselogincounttemp % 100 == 0)) { $mailcontent = getLanguageValue("loginlocked_mailcontent") . "\r\n\r\n" . strftime(getLanguageValue("_dateformat"), time()) . "\r\n" . $_SERVER['REMOTE_ADDR'] . " / " . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\r\n" . getLanguageValue("username") . ": " . getRequestValue('username', 'post', false); require_once BASE_DIR_CMS . "Mail.php"; // Prüfen, ob die Mail-Funktion vorhanden ist if (function_exists("isMailAvailable")) { sendMailToAdmin(getLanguageValue("loginlocked_mailsubject"), $mailcontent); } } // Formular ausgrauen return login_formular(false, "warning_false_logins"); } else { // Formular nochmal normal anzeigen return login_formular(true, "incorrect_login"); } // Formular noch nicht abgeschickt? Dann wurde die Seite zum ersten Mal aufgerufen. } else { // Login noch gesperrt?
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); }
public function resize_img() { $file_name = $this->trim_file_name(getRequestValue('file', false, false), null); foreach ($this->options['image_versions'] as $version => $options) { $resize = $this->create_scaled_image($file_name, $options); } $success = array("error" => "Resize fehlgeschlagen"); if ($resize) { $success = $this->get_file_object($file_name); } header('content-type: text/html'); echo '<div id="json-data">' . $this->my_json_encode($success) . '</div>'; }
function make_NewOrgCatPageFromRequest() { $post = getRequestValue('cat_page_change', 'post', false); $new_cat = key($post); $new_page = false; if (is_array($post[$new_cat])) { $new_page = key($post[$new_cat]); $tmp = substr($post[$new_cat][$new_page], 1, -1); if (strpos($tmp, "][") > 1) { list($org_cat, $org_page) = explode("][", $tmp); } else { return false; } } else { $org_page = false; $org_cat = substr($post[$new_cat], 1, -1); } global $CatPage; $name = array(); $name["type"] = "cat"; $name["new"] = $CatPage->get_UrlCoded($new_cat); $name["org"] = $CatPage->get_UrlCoded($org_cat); if ($new_page and $org_page) { $name["type"] = "page"; $name["new"] .= "/" . $CatPage->get_UrlCoded($new_page); $name["org"] .= "/" . $CatPage->get_UrlCoded($org_page); } return $name; }
function download($file) { // Infos zur Datei $len = filesize($file); $filename = basename($file); $file_extension = strtolower(substr(strrchr($filename, "."), 1)); // abhängig von der Extension: Content-Type setzen switch ($file_extension) { case "pdf": $ctype = "application/pdf"; break; case "exe": $ctype = "application/octet-stream"; break; case "zip": $ctype = "application/zip"; break; case "doc": case "docx": $ctype = "application/msword"; break; case "xls": case "xlsx": $ctype = "application/vnd.ms-excel"; break; case "ppt": $ctype = "application/vnd.ms-powerpoint"; break; case "gif": $ctype = "image/gif"; break; case "png": $ctype = "image/png"; break; case "jpeg": case "jpg": $ctype = "image/jpg"; break; case "mp3": $ctype = "audio/mpeg"; break; case "wav": $ctype = "audio/x-wav"; break; case "mpeg": case "mpg": case "mpe": $ctype = "video/mpeg"; break; case "mov": $ctype = "video/quicktime"; break; case "avi": $ctype = "video/x-msvideo"; break; case "txt": $ctype = "text/plain"; break; case "htm": case "html": $ctype = "Content-type:text/html"; break; // PHP-Dateien dürfen nicht heruntergeladen werden // PHP-Dateien dürfen nicht heruntergeladen werden case "php": die($ERRORMESSAGE); break; default: $ctype = "application/force-download"; } // 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"); // oben ausgewählter Content-Type header("Content-Type: " . $ctype); // Datei direkt im Browser anzeigen (inline); Dateinamen setzen $header = "Content-Disposition: inline; filename=" . $filename . ";"; // Mit "Content-Disposition: attachment" wird der Download über ein Downloadfenster erzwungen: if (false !== getRequestValue('dialog', "get")) { $header = "Content-Disposition: attachment; filename=" . $filename . ";"; } header($header); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $len); @readfile($file); exit; }
private function make_DirCatPageArray($dir) { global $CMS_CONF; $draft_modus = false; $draft_cat = ""; if (!IS_ADMIN and getRequestValue('draft') != "true" and $CMS_CONF->get("draftmode") == "true") { $draft_modus = true; $draft_cat = $CMS_CONF->get("defaultcat"); } $cat_a = array(); $cat_sort = array(); $currentdir = getDirAsArray($dir, "dir", "sort_cat_page"); foreach ($currentdir as $file) { if ($draft_modus and $draft_cat != $file) { continue; } if (substr($file, -EXT_LENGTH) == EXT_LINK) { $target = "-_blank-"; if (strpos($file, "-_self-") > 1) { $target = "-_self-"; } $tmp = explode($target, $file); $cat_a[$tmp[0]]["_name-"] = $tmp[0]; $cat_a[$tmp[0]]["_orgname-"] = $cat_a[$tmp[0]]["_name-"]; $cat_a[$tmp[0]]["_type-"] = EXT_LINK; $url = str_replace($this->link_search, $this->link_replace, substr($tmp[1], 0, strlen($tmp[1]) - EXT_LENGTH)); $cat_a[$tmp[0]]["_link-"] = $url; $cat_a[$tmp[0]]["_target-"] = str_replace("-", "", $target); } else { $cat_a[$file]['_pages-'] = $this->make_DirPageArray($dir . "/" . $file); $cat_a[$file]["_name-"] = $file; $cat_a[$file]["_orgname-"] = $cat_a[$file]["_name-"]; $cat_a[$file]["_type-"] = "cat"; $cat_a[$file]["_files-"] = getDirAsArray($dir . "/" . $file . "/" . CONTENT_FILES_DIR_NAME, "file"); $cat_a[$file]["_time-"] = filemtime($dir . "/" . $file); $cat_a[$file]["_protect-"] = false; } } return $cat_a; }
function set_CatPageRequest() { if (defined("CAT_REQUEST") and defined("PAGE_REQUEST")) { return; } // Wenn ein Action-Parameter uebergeben wurde: keine aktiven Kat./Inhaltts. anzeigen # $CAT_REQUEST und $PAGE_REQUEST bleiben lehr if (ACTION_REQUEST == "sitemap" or ACTION_REQUEST == "search") { define("CAT_REQUEST", NULL); define("PAGE_REQUEST", NULL); return; } global $CatPage; $CAT_REQUEST_URL = $CatPage->get_UrlCoded(getRequestValue('cat', 'get')); $PAGE_REQUEST_URL = $CatPage->get_UrlCoded(getRequestValue('page', 'get')); #!!!!!!!!!!! file upload #exists_File( $cat, $file ) #echo $CAT_REQUEST_URL." -> ".$PAGE_REQUEST_URL."<br />\n"; # übergebene cat und page gibts if ($CatPage->exists_CatPage($CAT_REQUEST_URL, $PAGE_REQUEST_URL)) { define("CAT_REQUEST", $CatPage->get_AsKeyName($CAT_REQUEST_URL)); define("PAGE_REQUEST", $CatPage->get_AsKeyName($PAGE_REQUEST_URL)); return; # übergebene cat gibts aber page nicht cat hat aber pages } elseif ($CatPage->exists_CatPage($CAT_REQUEST_URL, false) and $CatPage->get_FirstPageOfCat($CAT_REQUEST_URL)) { define("CAT_REQUEST", $CatPage->get_AsKeyName($CAT_REQUEST_URL)); # erste page nehmen define("PAGE_REQUEST", $CatPage->get_FirstPageOfCat(CAT_REQUEST)); return; } # so wir sind bishierher gekommen dann probieren wirs mit defaultcat # oder mit erster cat die page hat $DEFAULT_CATEGORY = $CAT_REQUEST_URL; # $CAT_REQUEST_URL ist lehr # oder $CAT_REQUEST_URL gibts nicht als cat # oder $CAT_REQUEST_URL hat keine pages # dann defaultcat aus conf holen if (empty($CAT_REQUEST_URL) or !$CatPage->exists_CatPage($CAT_REQUEST_URL, false) or !$CatPage->get_FirstPageOfCat($CAT_REQUEST_URL)) { global $CMS_CONF; $DEFAULT_CATEGORY = $CMS_CONF->get("defaultcat"); } # prüfen ob die $DEFAULT_CATEGORY existiert if ($CatPage->exists_CatPage($DEFAULT_CATEGORY, false)) { # die erste page holen # und setze $CAT_REQUEST und $PAGE_REQUEST define("CAT_REQUEST", $CatPage->get_AsKeyName($DEFAULT_CATEGORY)); if ($CatPage->get_FirstPageOfCat(CAT_REQUEST)) { define("PAGE_REQUEST", $CatPage->get_FirstPageOfCat(CAT_REQUEST)); } else { define("PAGE_REQUEST", NULL); } # defaultcat gibts nicht hol die erste cat die auch pages hat und setze sie } else { list($CAT_REQUEST, $PAGE_REQUEST) = $CatPage->get_FirstCatPage(); if ($CatPage->exists_CatPage($CAT_REQUEST, false)) { define("CAT_REQUEST", $CAT_REQUEST); } if ($CatPage->exists_CatPage($CAT_REQUEST, $PAGE_REQUEST)) { define("PAGE_REQUEST", $PAGE_REQUEST); } } if (!defined("CAT_REQUEST")) { define("CAT_REQUEST", NULL); } if (!defined("PAGE_REQUEST")) { define("PAGE_REQUEST", NULL); } }
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 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); }
function buildContactForm($settings) { global $lang_contact; global $CMS_CONF; global $specialchars; global $lang_contact; $WEBSITE_NAME = $specialchars->rebuildSpecialChars($CMS_CONF->get("websitetitle"), false, true); if ($WEBSITE_NAME == "") { $WEBSITE_NAME = "Titel der Website"; } foreach (array("name", "website", "mail", "message", "privacy") as $name) { ${"config_" . $name}[0] = $lang_contact->getLanguageValue("contactform_" . $name); if ($settings->get("titel_" . $name)) { ${"config_" . $name}[0] = $specialchars->rebuildSpecialChars($settings->get("titel_" . $name), false, false); } ${"config_" . $name}[1] = "false"; if ($settings->get("titel_" . $name . "_show")) { ${"config_" . $name}[1] = $settings->get("titel_" . $name . "_show"); } ${"config_" . $name}[2] = "false"; if ($settings->get("titel_" . $name . "_mandatory")) { ${"config_" . $name}[2] = $settings->get("titel_" . $name . "_mandatory"); } } $mandatory = false; if ($config_name[2] == "true" or $config_mail[2] == "true" or $config_website[2] == "true" or $config_message[2] == "true" or $config_privacy[2] == "true") { $mandatory = true; } $errormessage = ""; $form = ""; if (isset($_SESSION['contactform_name'])) { $name = getRequestValue($_SESSION['contactform_name'], 'post', false); $mail = getRequestValue($_SESSION['contactform_mail'], 'post', false); $website = getRequestValue($_SESSION['contactform_website'], 'post', false); $message = getRequestValue($_SESSION['contactform_message'], 'post', false); $calcresult = getRequestValue($_SESSION['contactform_calculation'], 'post', false); $privacy = ""; if (getRequestValue($_SESSION['contactform_privacy'], 'post', false)) { $privacy = getRequestValue($_SESSION['contactform_privacy'], 'post', false); } } else { $name = ""; $mail = ""; $website = ""; $message = ""; $calcresult = ""; $privacy = ""; } // Das Formular wurde abgesendet if (getRequestValue('submit', 'post', false) != "") { // Bot-Schutz: Wurde das Formular innerhalb von x Sekunden abgeschickt? $sendtime = $settings->get("contactformwaittime"); if ($sendtime == "" || !preg_match("/^[\\d+]+\$/", $sendtime)) { $sendtime = 15; } if (time() - $_SESSION['contactform_loadtime'] < $sendtime) { $errormessage = $lang_contact->getLanguageValue("contactform_senttoofast", $sendtime); } if ($settings->get("contactformusespamprotection") == "true") { // Nochmal Spamschutz: Ergebnis der Spamschutz-Aufgabe auswerten if (strtolower($calcresult) != strtolower($_SESSION['calculation_result'])) { $errormessage = $lang_contact->getLanguageValue("contactform_wrongresult"); } } // Es ist ein Fehler aufgetreten! if ($errormessage == "") { // Eines der Pflichtfelder leer? if ($config_name[2] == "true" && $name == "") { $errormessage = $lang_contact->getLanguageValue("contactform_fieldnotset") . " " . $config_name[0]; } else { if ($config_mail[2] == "true" && $mail == "") { $errormessage = $lang_contact->getLanguageValue("contactform_fieldnotset") . " " . $config_mail[0]; } else { if ($config_website[2] == "true" && $website == "") { $errormessage = $lang_contact->getLanguageValue("contactform_fieldnotset") . " " . $config_website[0]; } else { if ($config_message[2] == "true" && $message == "") { $errormessage = $lang_contact->getLanguageValue("contactform_fieldnotset") . " " . $config_message[0]; } else { if ($config_privacy[2] == "true" && $privacy == "") { $errormessage = $lang_contact->getLanguageValue("contactform_fieldnotset_privacy"); } } } } } } // Es ist ein Fehler aufgetreten! if ($errormessage != "") { $form .= "<span id=\"contact_errormessage\">" . $errormessage . "</span>"; } else { $mailcontent = ""; if ($config_name[1] == "true") { $mailcontent .= $config_name[0] . ":\t" . $name . "\r\n"; } if ($config_mail[1] == "true") { $mailcontent .= $config_mail[0] . ":\t" . $mail . "\r\n"; } if ($config_website[1] == "true") { $mailcontent .= $config_website[0] . ":\t" . $website . "\r\n"; } if ($config_message[1] == "true") { $mailcontent .= "\r\n" . $config_message[0] . ":\r\n" . $message . "\r\n"; } if ($config_privacy[1] == "true") { # ☐ ☐ ☒ ☒ $checket = "☐"; if (!empty($privacy)) { $checket = "☒"; } $mailcontent .= $checket . " " . $config_privacy[0] . "\r\n"; } $mailsubject = $lang_contact->getLanguageValue("contactform_mailsubject", $specialchars->getHtmlEntityDecode($WEBSITE_NAME)); $mailsubject_confirm = $lang_contact->getLanguageValue("contactform_mailsubject_confirm", $specialchars->getHtmlEntityDecode($WEBSITE_NAME)); require_once BASE_DIR_CMS . "Mail.php"; // Wenn Mail-Adresse im Formular gesetzt ist - versuchen Kopie dorthin zu senden if ($mail != "" and $settings->get("titel_mail_send_copy") == "true") { sendMail($mailsubject_confirm, $mailcontent, $settings->get("formularmail"), $mail, $settings->get("formularmail")); } // Mail an eingestellte Mail-Adresse (Mail-Absender muss auch diese Adresse sein, // sonst gibts kein Mail wenn der keine oder ungültige Adresse eingibt.. sendMail($mailsubject, $mailcontent, $settings->get("formularmail"), $settings->get("formularmail"), $mail); $form .= "<span id=\"contact_successmessage\">" . $lang_contact->getLanguageValue("contactform_confirmation") . "</span>"; // Felder leeren $name = ""; $mail = ""; $website = ""; $message = ""; $privacy = ""; } } else { renameContactInputs(); } // aktuelle Zeit merken $_SESSION['contactform_loadtime'] = time(); global $CatPage; $action_para = $CatPage->get_Href(CAT_REQUEST, PAGE_REQUEST); $form .= "<form accept-charset=\"" . CHARSET . "\" method=\"post\" action=\"{$action_para}\" name=\"contact_form\" id=\"contact_form\">" . "<input type=\"hidden\" name=\"cat\" value=\"" . $CatPage->get_AsKeyName(CAT_REQUEST) . "\" />" . "<input type=\"hidden\" name=\"page\" value=\"" . $CatPage->get_AsKeyName(PAGE_REQUEST) . "\" />" . "<table id=\"contact_table\" summary=\"contact form table\">"; if ($config_name[1] == "true") { // Bezeichner aus formular.conf nutzen, wenn gesetzt $form .= "<tr><td style=\"padding-right:10px;\">" . $config_name[0]; if ($config_name[2] == "true") { $form .= "*"; } $form .= "</td><td><input type=\"text\" id=\"contact_name\" name=\"" . $_SESSION['contactform_name'] . "\" value=\"" . $name . "\" /></td></tr>"; } if ($config_website[1] == "true") { // Bezeichner aus formular.conf nutzen, wenn gesetzt $form .= "<tr><td style=\"padding-right:10px;\">" . $config_website[0]; if ($config_website[2] == "true") { $form .= "*"; } $form .= "</td><td><input type=\"text\" id=\"contact_website\" name=\"" . $_SESSION['contactform_website'] . "\" value=\"" . $website . "\" /></td></tr>"; } if ($config_mail[1] == "true") { // Bezeichner aus formular.conf nutzen, wenn gesetzt $form .= "<tr><td style=\"padding-right:10px;\">" . $config_mail[0]; if ($config_mail[2] == "true") { $form .= "*"; } $form .= "</td><td><input type=\"text\" id=\"contact_mail\" name=\"" . $_SESSION['contactform_mail'] . "\" value=\"" . $mail . "\" /></td></tr>"; } if ($config_message[1] == "true") { // Bezeichner aus formular.conf nutzen, wenn gesetzt $form .= "<tr><td style=\"padding-right:10px;\">" . $config_message[0]; if ($config_message[2] == "true") { $form .= "*"; } $form .= "</td><td><textarea rows=\"10\" cols=\"50\" id=\"contact_message\" name=\"" . $_SESSION['contactform_message'] . "\">" . $message . "</textarea></td></tr>"; } if ($settings->get("contactformusespamprotection") == "true") { $mandatory = true; // Spamschutz-Aufgabe $calculation_data = getRandomCalculationData($settings); $_SESSION['calculation_result'] = $calculation_data[1]; $form .= "<tr><td colspan=\"2\">" . $lang_contact->getLanguageValue("contactform_spamprotection_text") . "</td></tr>" . "<tr><td style=\"padding-right:10px;\">" . $calculation_data[0] . "*</td>" . "<td><input type=\"text\" id=\"contact_calculation\" name=\"" . $_SESSION['contactform_calculation'] . "\" value=\"\" /></td></tr>"; } if ($config_privacy[1] == "true") { $form .= "<tr><td colspan=\"2\" style=\"padding-right:10px;\"><input type=\"checkbox\" id=\"contact_privacy\" name=\"" . $_SESSION['contactform_privacy'] . "\" value=\"" . $_SESSION['contactform_privacy'] . "\" /><label for=\"contact_privacy\" style=\"padding-left:10px;\">" . $config_privacy[0]; if ($config_privacy[2] == "true") { $form .= "*"; } $form .= "</label></td></tr>"; } if ($mandatory) { $form .= "<tr><td style=\"padding-right:10px;\"> </td><td>" . $lang_contact->getLanguageValue("contactform_mandatory_fields") . "</td></tr>"; } $form .= "<tr><td style=\"padding-right:10px;\"> </td><td><input type=\"submit\" class=\"submit\" id=\"contact_submit\" name=\"submit\" value=\"" . $lang_contact->getLanguageValue("contactform_submit") . "\" /></td></tr>"; $form .= "</table>" . "</form>"; return $form; }
function getContent($value) { if (defined("PLUGINADMIN")) { $settings_array = $this->settings->toArray(); if (getRequestValue('saveogp', "post", false)) { if (getRequestValue('ogp', "post", false) and is_array(getRequestValue('ogp', "post", false))) { $post_array = getRequestValue('ogp', "post", false); # aufräumen foreach ($settings_array as $cat_page => $tmp) { if (strstr($cat_page, FILE_START) !== false and strstr($cat_page, FILE_END) !== false) { if (!array_key_exists($cat_page, $post_array)) { $this->settings->delete($cat_page); } } } foreach ($post_array as $cat_page => $value) { if (strlen($value['og_title']) > 2 and strlen($value['og_description']) > 2) { $value['og_title'] = htmlentities($value['og_title'], ENT_QUOTES, CHARSET); $value['og_description'] = htmlentities($value['og_description'], ENT_QUOTES, CHARSET); if (!isset($value['og_image'])) { $value['og_image'] = false; } $this->settings->set($cat_page, $value); } } } } elseif (getRequestValue('clearogp', "post", false)) { foreach ($settings_array as $cat_page => $tmp) { if ("--default--" === $cat_page or strstr($cat_page, FILE_START) !== false and strstr($cat_page, FILE_END) !== false) { $this->settings->delete($cat_page); } } } return $this->getAdmin(); } $ogp = ""; if ($value === false) { $key = false; if ($this->settings->keyExists(FILE_START . CAT_REQUEST . ":" . PAGE_REQUEST . FILE_END)) { $key = FILE_START . CAT_REQUEST . ":" . PAGE_REQUEST . FILE_END; } elseif ($this->settings->keyExists("--default--")) { $key = "--default--"; } if ($key) { $setting = $this->settings->get($key); if (is_array($setting)) { global $CatPage, $CMS_CONF; $host = (defined("HTTP") ? HTTP : "http://") . $_SERVER['SERVER_NAME']; $url = $host . $CatPage->get_Href(CAT_REQUEST, PAGE_REQUEST); $locale = substr($CMS_CONF->get("cmslanguage"), 0, 2) . "_" . substr($CMS_CONF->get("cmslanguage"), 2); if ($locale == "en_EN") { $locale = "en_GB"; } $ogp = '' . '<meta property="og:site_name" content="' . $_SERVER['SERVER_NAME'] . '" />' . "\n" . '<meta property="og:locale" content="' . $locale . '" />' . "\n" . '<meta property="og:title" content="' . $setting['og_title'] . '" />' . "\n" . '<meta property="og:description" content="' . $setting['og_description'] . '" />' . "\n" . '<meta property="og:type" content="website" />' . "\n" . '<meta property="og:url" content="' . $url . '" />' . "\n"; if ($CatPage->exists_File(CAT_REQUEST, $setting['og_image'])) { $ogp .= '<meta property="og:image" content="' . $host . $CatPage->get_srcFile(CAT_REQUEST, $setting['og_image']) . '" />' . "\n"; } elseif ($CatPage->exists_File($CMS_CONF->get("defaultcat"), $setting['og_image'])) { $ogp .= '<meta property="og:image" content="' . $host . $CatPage->get_srcFile($CMS_CONF->get("defaultcat"), $setting['og_image']) . '" />' . "\n"; } } } } return $ogp; }
function getContent($value) { $values = explode(",", $value); global $CMS_CONF; global $specialchars; global $lang_gallery_cms; $dir = PLUGIN_DIR_REL . "Galerie/"; $lang_gallery_cms = new Language($dir . "sprachen/cms_language_" . $CMS_CONF->get("cmslanguage") . ".txt"); $embedded = $this->settings->get("target"); $linkprefix = "index.php?cat=" . CAT_REQUEST . "&page=" . PAGE_REQUEST . "&"; if ($embedded == "_blank") { $linkprefix = "index.php?galtemplate=true&"; } if ($CMS_CONF->get("modrewrite") == "true") { $linkprefix = URL_BASE . CAT_REQUEST . "/" . PAGE_REQUEST . ".html?"; if ($embedded == "_blank") { $linkprefix = "index.php.html?galtemplate=true&"; } } $index = NULL; if (getRequestValue('index', 'get', false)) { $index = getRequestValue('index', 'get', false); } $cat_activ = ""; if (CAT_REQUEST == basename(dirname($_SERVER['REQUEST_URI'])) and $embedded == "_self") { $cat_activ = "../"; } if ($this->settings->get("usethumbs") == "true") { $usethumbs = true; } else { $usethumbs = false; } // Übergebene Parameter überprüfen $gal_request = $specialchars->replacespecialchars($specialchars->getHtmlEntityDecode($values[0]), false); if (getRequestValue("gal", 'get', false)) { $gal_request = $specialchars->replacespecialchars(getRequestValue("gal", 'get', false), false); } $GALERIE_DIR = BASE_DIR . GALLERIES_DIR_NAME . "/" . $gal_request . "/"; $GALERIE_DIR_SRC = str_replace("%", "%25", URL_BASE . GALLERIES_DIR_NAME . "/" . $gal_request . "/"); # keine Galerie angegeben oder Galerie gibts nicht if ($gal_request == "" || !file_exists($GALERIE_DIR)) { global $syntax; if ($gal_request == "") { return $syntax->createDeadlink($lang_gallery_cms->getLanguageValue("message_gallerydir_error_0"), $lang_gallery_cms->getLanguageValue("message_gallerydir_error_0")); } else { return $syntax->createDeadlink($specialchars->rebuildSpecialChars($gal_request, false, true), $lang_gallery_cms->getLanguageValue("message_gallerydir_error_1", $specialchars->rebuildSpecialChars($gal_request, false, true))); } } # Galerie erzeugen if ($embedded == "_self" or getRequestValue('gal', 'get', false)) { $alldescriptions = false; if (is_file($GALERIE_DIR . "texte.conf.php")) { $alldescriptions = new Properties($GALERIE_DIR . "texte.conf.php"); } // Galerieverzeichnis einlesen $picarray = getDirAsArray($GALERIE_DIR, "img"); $allindexes = array(); for ($i = 1; $i <= count($picarray); $i++) { array_push($allindexes, $i); } // globaler Index if (!isset($index) || !in_array($index, $allindexes)) { $index = 1; } else { $index = $index; } // Bestimmung der Positionen $first = 1; $last = count($allindexes); if (!in_array($index - 1, $allindexes)) { $previous = $last; } else { $previous = $index - 1; } if (!in_array($index + 1, $allindexes)) { $next = 1; } else { $next = $index + 1; } $template = NULL; if ($this->settings->get("gallerytemplate")) { if ($embedded == "_self") { $template = '<div class="embeddedgallery">' . $this->settings->get("gallerytemplate") . '</div>'; } else { $template = $this->settings->get("gallerytemplate"); if (strrpos("tmp" . $value, '{NUMBERMENU}') > 0) { $template = $value; } } } else { $template = "{GALLERYMENU}{NUMBERMENU}\n{CURRENTPIC}\n{CURRENTDESCRIPTION}"; if (strrpos("tmp" . $value, '{NUMBERMENU}') > 0) { $template = $value; } } $html = $template; if (count($picarray) == 0) { $html = str_replace('{NUMBERMENU}', $lang_gallery_cms->getLanguageValue("message_galleryempty_0"), $html); } # Titel der Galerie $html = str_replace('{CURRENTGALLERY}', $specialchars->rebuildSpecialChars($gal_request, false, true), $html); if ($usethumbs) { $html = str_replace('{GALLERYMENU}', " ", $html); $html = str_replace('{NUMBERMENU}', $this->getThumbnails($picarray, $alldescriptions, $GALERIE_DIR, $GALERIE_DIR_SRC), $html); $html = str_replace('{CURRENTPIC}', " ", $html); $html = str_replace('{CURRENTDESCRIPTION}', " ", $html); $html = str_replace('{XOUTOFY}', " ", $html); } else { $html = str_replace('{GALLERYMENU}', $this->getGalleryMenu($picarray, $linkprefix, $gal_request, $index, $first, $previous, $next, $last), $html); $html = str_replace('{NUMBERMENU}', $this->getNumberMenu($picarray, $linkprefix, $index, $gal_request, $first, $last), $html); $html = str_replace('{CURRENTPIC}', $this->getCurrentPic($picarray, $index, $GALERIE_DIR_SRC), $html); if (count($picarray) > 0) { $html = str_replace('{CURRENTDESCRIPTION}', $this->getCurrentDescription($picarray[$index - 1], $picarray, $alldescriptions), $html); } else { $html = str_replace('{CURRENTDESCRIPTION}', "", $html); } $html = str_replace('{XOUTOFY}', $this->getXoutofY($picarray, $index, $last), $html); $html = str_replace('{CURRENT_INDEX}', $index, $html); $html = str_replace('{PREVIOUS_INDEX}', $previous, $html); $html = str_replace('{NEXT_INDEX}', $next, $html); } return $html; # Galerie Link erzeugen } else { $j = 0; if (file_exists($GALERIE_DIR)) { $handle = opendir($GALERIE_DIR); while ($file = readdir($handle)) { if (is_file($GALERIE_DIR . $file) and $file != "texte.conf.php") { $j++; } } closedir($handle); } else { global $syntax; // Galerie nicht vorhanden return $syntax->createDeadlink($specialchars->rebuildSpecialChars($values[0], false, true), $lang_gallery_cms->getLanguageValue("tooltip_link_gallery_error_1", $specialchars->rebuildSpecialChars($values[0], false, true))); } $gal_name = NULL; if (isset($values[0])) { $gal_name = $specialchars->rebuildSpecialChars($values[0], false, false); } if (isset($values[1])) { $gal_name = $specialchars->rebuildSpecialChars($values[1], false, false); } global $syntax; return "<a class=\"gallery\" href=\"" . $linkprefix . "gal=" . $gal_request . "\" " . $syntax->getTitleAttribute($lang_gallery_cms->getLanguageValue("tooltip_link_gallery_2", $specialchars->rebuildSpecialChars($values[0], false, true), $j)) . "target=\"" . $this->settings->get("target") . "\">" . $gal_name . "</a>"; } }
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; } }