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 makeUpdate() { $update_page_files = array(); if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf')) { updateConf(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf'); } if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf.php')) { global $gallery_plugin; $gallery_plugin = new Properties(BASE_DIR . PLUGIN_DIR_NAME . '/Galerie/plugin.conf.php'); } if (is_dir(BASE_DIR . 'update')) { $cms_confs = array("basic", "main", "passwords", "gallery", "version", "logindata", "downloads", "catpage", "syntax", "user"); $files = getDirAsArray(BASE_DIR . 'update', array(".conf"), "none"); if (count($files) > 0) { global $GALLERY, $SYNTAX; $SYNTAX = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . '/syntax.conf.php'); $GALLERY = new Properties(BASE_DIR_CMS . CONF_DIR_NAME . '/gallery.conf.php'); foreach ($files as $datei) { if (in_array(str_replace(".conf", "", $datei), $cms_confs)) { updateCMSConf($datei); mo_unlink(BASE_DIR . 'update/' . $datei); } } } } if (is_dir(BASE_DIR . 'galerien') and is_readable(BASE_DIR . 'galerien')) { foreach (getDirAsArray(BASE_DIR . GALLERIES_DIR_NAME, "dir", "none") as $datei) { $tmp_conf = false; if (is_file(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf')) { updateConf(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf'); } else { newConf(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . "/texte.conf.php"); } if (is_file(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . '/texte.conf.php')) { $tmp_conf = new Properties(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei . "/texte.conf.php"); } $update_text = array(); foreach (getDirAsArray(BASE_DIR . GALLERIES_DIR_NAME . '/' . $datei, "file", "none") as $img) { if ($img == 'texte.conf') { continue; } if (false !== ($newname = isUpdateFileName($img, "file", true))) { $status = updateRename($img, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/"); if ($status) { $newname = $status; } if ($tmp_conf !== false and $tmp_conf->keyExists($img)) { $tmp_conf->set($newname, toUtf($tmp_conf->get($img))); $tmp_conf->delete($img); } $update_page_files[$img] = $newname; if (is_file(BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/" . PREVIEW_DIR_NAME . "/" . $img)) { updateRename($img, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/" . $datei . "/" . PREVIEW_DIR_NAME . "/"); } } } unset($tmp_conf); if (false !== ($newname = isUpdateFileName($datei, false, true))) { updateRename($datei, $newname, BASE_DIR . GALLERIES_DIR_NAME . "/"); } } } if (is_dir(BASE_DIR . 'kategorien')) { $sort_array = array(); $cats = getDirAsArray(BASE_DIR . CONTENT_DIR_NAME, "dir", "sort"); $cats = sort_cat_page($cats, BASE_DIR . CONTENT_DIR_NAME, "dir"); foreach ($cats as $cat) { #echo $cat."<br />\n"; if (false !== ($newname = isUpdateFileName($cat, "catpage", true))) { updateRename($cat, $newname, BASE_DIR . CONTENT_DIR_NAME . "/"); $cat = $newname; } $sort_array[$cat] = "null"; if (substr($cat, -EXT_LENGTH) == EXT_LINK) { continue; } $sort_array[$cat] = array(); $pages = getDirAsArray(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat, "file", "sort"); $pages = sort_cat_page($pages, BASE_DIR . CONTENT_DIR_NAME . '/' . $cat, "file"); foreach ($pages as $page) { if (false !== ($newname = isUpdateFileName($page, "catpage", true))) { updateRename($page, $newname, BASE_DIR . CONTENT_DIR_NAME . "/" . $cat . "/"); $page = $newname; } $sort_array[$cat][$page] = "null"; } if (is_dir(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat . '/' . CONTENT_FILES_DIR_NAME)) { foreach (getDirAsArray(BASE_DIR . CONTENT_DIR_NAME . '/' . $cat . '/' . CONTENT_FILES_DIR_NAME, "file", "none") as $file) { if (false !== ($newname = isUpdateFileName($file, "file", true))) { $status = updateRename($file, $newname, BASE_DIR . CONTENT_DIR_NAME . "/" . $cat . "/" . CONTENT_FILES_DIR_NAME . "/"); if ($status) { $newname = $status; } $tmp_file = cleanUploadFile(changeMoziloOldSpecialChars($file, false)); $update_page_files[rawurldecode($cat)][$tmp_file] = $newname; } } } } $sort_array = var_export($sort_array, true); file_put_contents(SORT_CAT_PAGE, "<?php if(!defined('IS_CMS')) die();\n\$cat_page_sort_array = " . $sort_array . ";\n?>", LOCK_EX); if (isset($_POST['update_pages']) and $_POST['update_pages'] == "true") { updatePages($update_page_files); } } if (is_dir(BASE_DIR . 'plugins')) { foreach (getDirAsArray(BASE_DIR . PLUGIN_DIR_NAME, "dir", "none") as $datei) { if (is_file(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf')) { updateConf(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf'); } if ($datei == "CONTACT") { makeCONTACTSetings(BASE_DIR . PLUGIN_DIR_NAME . '/' . $datei . '/plugin.conf.php'); } } } if (is_dir(BASE_DIR . 'layouts')) { foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, "dir", "none") as $datei) { if (is_file(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/layoutsettings.conf') and is_file(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/template.html')) { updateTemplate(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/'); } if (is_dir(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/css')) { updateTemplateCSS(BASE_DIR . LAYOUT_DIR_NAME . '/' . $datei . '/'); } if (false !== ($newname = isUpdateFileName($datei, false, true))) { updateRename($datei, $newname, BASE_DIR . LAYOUT_DIR_NAME . "/"); } } } }