Example #1
0
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;
}
Example #2
0
function gallery()
{
    global $specialchars;
    global $ADMIN_CONF;
    global $CatPage;
    global $GALLERY_CONF;
    if (false !== ($changeart = getRequestValue('changeart', 'post'))) {
        header('content-type: text/html; charset=' . CHARSET . '');
        if ($changeart == "gallery_new") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post'))) {
                echo newGallery($galleryname);
            }
            exit;
        } elseif ($changeart == "gallery_del") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post'))) {
                echo deleteGallery($galleryname);
            }
            exit;
        } elseif ($changeart == "gallery_rename") {
            if (false !== ($galleryname = getRequestValue('galleryname', 'post')) and false !== ($gallerynewname = getRequestValue('gallerynewname', 'post'))) {
                echo renameGallery($galleryname, $gallerynewname);
            }
            exit;
        } elseif ($changeart == "gallery_size") {
            if (false !== ($new_global_width = getRequestValue('new_global_width', 'post')) and false !== ($new_global_height = getRequestValue('new_global_height', 'post')) and (ctype_digit($new_global_width) or ctype_digit($new_global_height) or $new_global_width == "auto" or $new_global_height == "auto" or $new_global_width == "" or $new_global_height == "")) {
                $GALLERY_CONF->set("maxwidth", $new_global_width);
                $GALLERY_CONF->set("maxheight", $new_global_height);
                ajax_return("success", true);
            } elseif (false !== ($thumbnail_global_max_width = getRequestValue('thumbnail_global_max_width', 'post')) and false !== ($thumbnail_global_max_height = getRequestValue('thumbnail_global_max_height', 'post')) and (ctype_digit($thumbnail_global_max_width) or ctype_digit($thumbnail_global_max_height or $new_global_width == "" or $new_global_height == ""))) {
                $GALLERY_CONF->set("maxthumbwidth", $thumbnail_global_max_width);
                $GALLERY_CONF->set("maxthumbheight", $thumbnail_global_max_height);
                ajax_return("success", true);
            } else {
                ajax_return("error", true, returnMessage(false, getLanguageValue("properties_error_save")), true, true);
            }
        } elseif ($changeart == "gallery_subtitle") {
            if (false !== ($subtitle = getRequestValue('subtitle', 'post', false)) and false !== ($curent_dir = getRequestValue('curent_dir', 'post')) and false !== ($file = getRequestValue('file', 'post'))) {
                if (!is_file(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php") and false === newConf(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php")) {
                    ajax_return("error", true, returnMessage(false, getLanguageValue("gallery_error_subtitle_conf")), true, true);
                }
                $tmp = new Properties(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php");
                $tmp->set($file, $subtitle);
                ajax_return("success", true);
            }
            exit;
        } elseif ($changeart == "file_rename") {
            if (false !== ($newfile = getRequestValue('newfile', 'post')) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) {
                $dir = GALLERIES_DIR_REL . $curent_dir . "/";
                if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) {
                    ajax_return("error", true, $error, true, "js-dialog-reload");
                }
                $dir = GALLERIES_DIR_REL . $curent_dir . "/" . PREVIEW_DIR_NAME . "/";
                if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) {
                    ajax_return("error", true, $error, true, "js-dialog-reload");
                }
                $tmp = new Properties(GALLERIES_DIR_REL . $curent_dir . "/texte.conf.php");
                $tmp->set($newfile, $tmp->get($orgfile));
                $tmp->delete($orgfile);
                ajax_return("success", true);
            }
            exit;
        } elseif ($changeart == "gallery_ftp") {
            changeFromFtp();
        } else {
            exit;
        }
    }
    if (getRequestValue('chancefiles') == "true") {
        require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php";
        exit;
    }
    $dircontent = getDirAsArray(GALLERIES_DIR_REL, "dir", "sort");
    $pagecontent = "";
    require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php";
    $pagecontent .= '<ul class="js-gallery mo-ul">';
    foreach ($dircontent as $pos => $currentgalerien) {
        $pagecontent .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">';
        $pagecontent .= getFileUpload($currentgalerien, $specialchars->rebuildSpecialChars($currentgalerien, false, true), getLanguageValue("images"));
        $pagecontent .= '</li>';
    }
    $pagecontent .= '</ul>';
    $new_gallery = '<ul class="js-new-gallery mo-ul new-gallery">';
    $new_gallery .= '<li class="js-file-dir mo-li ui-widget-content ui-corner-all">';
    $new_gallery .= getFileUpload($specialchars->rebuildSpecialChars(getLanguageValue("gallery_name_new"), false, true), getLanguageValue("gallery_name_new"), getLanguageValue("images"), " mo-hidden");
    $new_gallery .= '</li>';
    $new_gallery .= '</ul>';
    $max_img = '<input type="text" name="new_global_width" value="' . $GALLERY_CONF->get('maxwidth') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit-auto" /> x <input type="text" name="new_global_height" value="' . $GALLERY_CONF->get('maxheight') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit-auto" /> ' . getLanguageValue("pixels");
    $max_prev_img = '<input type="text" name="thumbnail_global_max_width" value="' . $GALLERY_CONF->get('maxthumbwidth') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> x <input type="text" name="thumbnail_global_max_height" value="' . $GALLERY_CONF->get('maxthumbheight') . '" size="4" maxlength="4" class="mo-input-digit js-in-digit" /> ' . getLanguageValue("pixels");
    $titel = "gallery_help_conf";
    $template[$titel]["toggle"] = true;
    $template[$titel][] = array(getLanguageValue("gallery_scale"), $max_img);
    $template[$titel][] = array(getLanguageValue("gallery_scale_thumbs"), $max_prev_img);
    $ftp_form = '<form action="index.php?action=' . ACTION . '" method="post">';
    $ftp_form .= '<input type="hidden" name="changeart" value="gallery_ftp" />';
    $ftp_form .= '<input type="submit" value="' . getLanguageValue("gallery_text_from_ftp_button") . '" />';
    $ftp_form .= '</form>';
    $template[$titel][] = array(getLanguageValue("gallery_text_from_ftp"), $ftp_form);
    return array(contend_template($template) . $pagecontent, $new_gallery);
}
Example #3
0
function template()
{
    global $CMS_CONF;
    global $specialchars;
    global $message;
    global $debug;
    $template_manage_open = false;
    # templates löschen
    if (getRequestValue('template-all-del', 'post') and getRequestValue('template-del', 'post')) {
        template_del();
        $template_manage_open = true;
    }
    # template activ setzen
    if (!getRequestValue('template-all-del', 'post') and !getRequestValue('template-install', 'post') and getRequestValue('template-active', 'post')) {
        $debug .= "active=" . getRequestValue('template-active', 'post') . "<br />\n";
        template_setactiv();
    }
    # hochgeladenes template installieren
    if (isset($_FILES["template-install-file"]["error"]) and getRequestValue('template-install', 'post') and $_FILES["template-install-file"]["error"] == 0 and strtolower(substr($_FILES["template-install-file"]["name"], -4)) == ".zip") {
        $debug .= "install=" . $_FILES["template-install-file"]["name"] . "<br />\n";
        template_install();
        $template_manage_open = true;
    } elseif ($template_select = $specialchars->rebuildSpecialChars(getRequestValue('template-install-select', 'post'), false, false) and getRequestValue('template-install', 'post') and is_file(BASE_DIR . LAYOUT_DIR_NAME . "/" . $template_select) !== false and strtolower(substr($template_select, -4)) == ".zip") {
        $debug .= "local install=" . getRequestValue('template-install-select', 'post') . "<br />\n";
        template_install($template_select);
        $template_manage_open = true;
    }
    $showdebug = false;
    if ($showdebug and !empty($debug)) {
        $message .= returnMessage(false, $debug);
    }
    $ACTIV_TEMPLATE = $CMS_CONF->get("cmslayout");
    $LAYOUT_DIR = LAYOUT_DIR_NAME . "/" . $ACTIV_TEMPLATE . '/';
    if (getRequestValue('chancefiles') == "true") {
        require_once BASE_DIR_ADMIN . "jquery/File-Upload/upload.class.php";
    }
    if (false !== ($newfile = getRequestValue('newfile', 'post')) and false !== ($orgfile = getRequestValue('orgfile', 'post')) and false !== ($curent_dir = getRequestValue('curent_dir', 'post'))) {
        $dir = BASE_DIR . LAYOUT_DIR_NAME . "/" . str_replace('%2F', '/', $curent_dir) . "/";
        if (true !== ($error = moveFileDir($dir . $orgfile, $dir . $newfile, true))) {
            ajax_return("error", true, $error, true, "js-dialog-reload");
        }
        ajax_return("success", true);
    }
    if (getRequestValue('templateselectbox', 'post') == "true") {
        require_once BASE_DIR_ADMIN . 'editsite.php';
        # wir schiken die neue selectbox zurück
        echo '<span id="replace-item">' . returnTemplateSelectbox() . '</span>';
        ajax_return("success", true);
    }
    if (getRequestValue('configtemplate', 'post') == "true") {
        if (false !== ($templatefile = BASE_DIR . getRequestValue('templatefile', 'post', false)) and !file_exists($templatefile)) {
            ajax_return("error", true, returnMessage(false, getLanguageValue("error_no_file_dir") . " " . $templatefile), true, true);
        }
        if (false !== ($content = getRequestValue('content', 'post', false))) {
            if (false === mo_file_put_contents($templatefile, $content)) {
                ajax_return("error", true, returnMessage(false, getLanguageValue("editor_content_error_save")), true, true);
            }
            echo ajax_return("success", false);
        } else {
            if (false === ($syntax = get_contents_ace_edit($templatefile))) {
                ajax_return("error", true, returnMessage(false, getLanguageValue("editor_content_error_open")), true, true);
            }
            echo '<textarea id="page-content">' . $syntax . '</textarea>';
            echo ajax_return("success", false);
        }
        exit;
    }
    global $ADMIN_CONF;
    $show = $ADMIN_CONF->get("template");
    if (!is_array($show)) {
        $show = array();
    }
    $html_manage = "";
    if (ROOT or in_array("template_manage", $show)) {
        $template_manage = array();
        $disabled = '';
        if (!function_exists('gzopen')) {
            $disabled = ' disabled="disabled"';
        }
        $template_install = array();
        foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, array(".zip")) as $zip_file) {
            $template_install[] = '<option value="' . mo_rawurlencode($zip_file) . '">' . $zip_file . '</option>';
        }
        $template_install_html = "";
        if (count($template_install) > 0) {
            $template_install_html .= '<br /><select class="mo-install-select mo-select-div" name="template-install-select" size="1"' . $disabled . '>' . '<option value="">' . getLanguageValue("template_select", true) . '</option>' . implode("", $template_install) . '</select>';
        }
        $template_manage["template_title_manage"][] = '<div class="mo-nowrap align-right ui-helper-clearfix">' . '<span class="align-left" style="float:left"><span class="mo-bold">' . getLanguageValue("template_text_filebutton") . '</span><br />' . getLanguageValue("template_text_fileinfo") . '</span>' . '<input type="file" id="js-template-install-file" name="template-install-file" class="mo-select-div"' . $disabled . ' />' . $template_install_html . '<input type="submit" id="js-template-install-submit" name="template-install" value="' . getLanguageValue("template_button_install", true) . '"' . $disabled . ' /><br />' . '<input type="submit" id="js-template-del-submit" value="' . getLanguageValue("template_button_delete", true) . '" class="mo-margin-top" />' . '</div>';
        foreach (getDirAsArray(BASE_DIR . LAYOUT_DIR_NAME, "dir", "natcasesort") as $pos => $file) {
            $template_activ = '';
            $checkbox_del = '<input type="checkbox" name="template-del[]" value="' . $file . '" class="mo-checkbox" />';
            $radio_activ = '<input id="template-status' . $pos . '" name="template-active" type="radio" value="' . $file . '" class="mo-radio" /><label for="template-status' . $pos . '">' . getLanguageValue("template_input_set_active") . '</label>';
            if ($ACTIV_TEMPLATE == $file) {
                $checkbox_del = '&nbsp;';
                $radio_activ = "";
                $template_activ = ' mo-bold';
            }
            $template_manage["template_title_manage"][] = '<div class="mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="mo-nowrap  mo-padding-left' . $template_activ . '">' . $specialchars->rebuildSpecialChars($file, false, true) . '</span>' . '<div style="float:right;">' . $checkbox_del . '</div>' . '<div style="float:right;width:30%;">' . $radio_activ . '</div>' . '</div>';
        }
        $multi_user = "";
        if (defined('MULTI_USER') and MULTI_USER) {
            $multi_user = "******";
        }
        if (count($template_manage["template_title_manage"]) > 0) {
            $template_manage["template_title_manage"]["toggle"] = true;
            $html_manage = '<form id="js-template-manage" action="index.php?nojs=true&amp;action=template' . $multi_user . '" method="post" enctype="multipart/form-data">' . contend_template($template_manage) . '</form>';
            # es wurde in der template verwaltung was gemacht dann soll die aufgeklapt bleiben
            if ($template_manage_open) {
                $html_manage = str_replace("display:none;", "", $html_manage);
            }
        }
    }
    $html_template = "";
    if (ROOT or in_array("template_edit", $show)) {
        $template = array();
        foreach (getDirAsArray(BASE_DIR . $LAYOUT_DIR, array(".html"), "natcasesort") as $file) {
            $template["template_title_html_css"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left">' . $file . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-html mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars($LAYOUT_DIR . $file, true) . '</span>' . '</div>';
        }
        foreach (getDirAsArray(BASE_DIR . $LAYOUT_DIR . 'css', array(".css"), "natcasesort") as $file) {
            $template["template_title_html_css"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left"><span class="mo-bold mo-padding-right">css/</span>' . $file . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-css mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars($LAYOUT_DIR . 'css/' . $file, true) . '</span>' . '</div>';
        }
        require_once BASE_DIR_ADMIN . "jquery/File-Upload/fileupload.php";
        $template_img = getFileUpload($CMS_CONF->get("cmslayout") . '/grafiken');
        $html_img = get_template_truss('<li class="mo-li ui-corner-all">' . $template_img . '</li>', "template_title_grafiken", true);
        $html_template = get_template_truss('<li class="ui-corner-all">' . contend_template($template) . $html_img . '</li>', "template_title_template", false);
        $html_template = str_replace("{TemplateName}", '<span style="font-weight:normal;">' . $specialchars->rebuildSpecialChars($CMS_CONF->get("cmslayout"), false, true) . '</span>', $html_template);
    }
    $html_plugins = "";
    if (ROOT or in_array("template_plugin_css", $show)) {
        $show = $ADMIN_CONF->get("plugins");
        if (!is_array($show)) {
            $show = array();
        }
        global $activ_plugins;
        $template_plugins = array();
        $template_plugins["template_title_plugins"] = array();
        foreach ($activ_plugins as $plugin) {
            if (!ROOT and !in_array($plugin, $show)) {
                continue;
            }
            if (!is_file(BASE_DIR . PLUGIN_DIR_NAME . "/" . $plugin . "/plugin.css")) {
                continue;
            }
            $template_plugins["template_title_plugins"][] = '<div class="js-tools-show-hide mo-middle mo-tag-height-from-icon ui-helper-clearfix">' . '<span class="js-filename mo-nowrap mo-padding-left"><span class="mo-bold mo-padding-right">css/</span>' . $plugin . '</span>' . '<img style="float:right;" class="js-tools-icon-show-hide js-edit-template js-css mo-tool-icon mo-icons-icon mo-icons-page-edit" src="' . ICON_URL_SLICE . '" alt="page-edit" hspace="0" vspace="0" />' . '<span class="js-edit-file-pfad" style="display:none;">' . $specialchars->replaceSpecialChars(PLUGIN_DIR_NAME . "/" . $plugin . "/plugin.css", true) . '</span>' . '</div>';
        }
        if (count($template_plugins["template_title_plugins"]) > 0) {
            $template_plugins["template_title_plugins"]["toggle"] = true;
            $html_plugins = contend_template($template_plugins);
        }
    }
    $html_editor = "";
    if (!empty($html_template) or !empty($html_plugins)) {
        $html_editor = pageedit_dialog();
    }
    return $html_manage . $html_template . $html_plugins . $html_editor;
}