Пример #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;
}
Пример #2
0
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") . "");
    }
}
Пример #3
0
function fileManager()
{
    if ($_SESSION['adminType'] == 'sadmin') {
        $fileManPath = RAZOR_SADMIN_PATH;
    } else {
        $fileManPath = RAZOR_FILEMAN_PATH;
    }
    // set upload limits if server permits //
    @ini_set('upload_max_filesize', '100M');
    @ini_set('post_max_size', '105M');
    @ini_set('memory_limit', '205M');
    @ini_set('max_execution_time', '300');
    // end of set //
    $dirToView = '';
    $dirFound = false;
    $fileFound = false;
    if (isset($_GET['dir']) && $_GET['dir']) {
        // get sub dir from url //
        $subDir = $_GET['dir'];
        // ensure no one has injected url, force to correct format //
        // IMPORTANT - TO PREVENT ACCESS TO OTHER AREAS ON SERVER //
        $subDir = str_replace('/', '>', $subDir);
        $subDir = str_replace('..', '', $subDir);
        // change to path format //
        $subDir = str_replace('>', '/', $subDir);
        if (is_dir(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $subDir)) {
            $dirToView = $subDir . '/';
            $dirFound = true;
        } elseif (file_exists(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $subDir)) {
            $dirToView = $subDir;
            $fileFound = true;
        }
        // remove user level ability to do anything with restricted files //
        if ($_SESSION['adminType'] == 'user') {
            $noAccessArray = noReadWriteAccess();
            if (in_array($dirToView, $noAccessArray)) {
                return;
            }
        }
    }
    if (isset($_GET['del']) && $_GET['del']) {
        if ($dirFound) {
            $dirArray = array();
            if (substr($dirToView, -1) == '/') {
                $dirToView = substr($dirToView, 0, -1);
            }
            $dirArray = explode('/', $dirToView);
            array_pop($dirArray);
            $verifyDir = implode('/', $dirArray) . '/';
            if (is_dir(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $verifyDir)) {
                $dirDelRes = deleteDirR($fileManPath . $dirToView);
                if (!$dirDelRes) {
                    MsgBox(lt('Folder and contents deleted') . '...', 'greenbox');
                } else {
                    MsgBox(lt('Error deleting folder and contents') . '...', 'redbox');
                }
                $dirToView = $verifyDir;
            }
        } elseif ($fileFound) {
            $verifyFile = str_replace(basename($dirToView), '', $dirToView);
            if (is_dir(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $verifyFile)) {
                deleteFile($fileManPath . $dirToView);
                $dirToView = $verifyFile;
            }
        }
    }
    if (isset($_POST['upload'])) {
        uploadFiles();
    }
    if (isset($_POST['rename'])) {
        renameFileDir();
    }
    if (isset($_POST['copy'])) {
        copyFileDir();
    }
    if (isset($_POST['move'])) {
        moveFileDir();
    }
    if (isset($_POST['createnewdir'])) {
        createNewDir();
    }
    if (isset($_POST['edit'])) {
        editFile();
    }
    $filesPath = getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $dirToView;
    if (is_dir($filesPath)) {
        if (isset($_GET['up']) && $_GET['up']) {
            displayFileUpload($dirToView);
        } elseif (isset($_GET['ren']) && $_GET['ren']) {
            displayRenameFileDir($dirToView, false);
        } elseif (isset($_GET['cop']) && $_GET['cop']) {
            displayCopyFileDir($dirToView, false);
        } elseif (isset($_GET['mov']) && $_GET['mov']) {
            displayMoveFileDir($dirToView, false);
        } elseif (isset($_GET['newdir']) && $_GET['newdir']) {
            displayCreateNewDir($dirToView);
        } else {
            $readFiles = array();
            $readFiles = readDirContents($filesPath);
            BsocketB('admin-datastore-data', array(&$filesPath, &$readFiles));
            displayDirContents($readFiles, $dirToView);
        }
    } elseif (file_exists($filesPath)) {
        if (isset($_GET['ren']) && $_GET['ren']) {
            displayRenameFileDir($dirToView, true);
        } elseif (isset($_GET['cop']) && $_GET['cop']) {
            displayCopyFileDir($dirToView, true);
        } elseif (isset($_GET['mov']) && $_GET['mov']) {
            displayMoveFileDir($dirToView, true);
        } elseif (isset($_GET['edit']) && $_GET['edit']) {
            displayEditFile($dirToView);
        } else {
            displayFileType($dirToView);
        }
    }
}
Пример #4
0
function cat_page_move($name)
{
    if (true !== ($error = moveFileDir(CONTENT_DIR_REL . $name["org"], CONTENT_DIR_REL . $name["new"]))) {
        return ajax_return("error", false, $error, true, "js-dialog-reload");
    }
    return write_sort_list($name);
}
Пример #5
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;
}