示例#1
0
文件: util.php 项目: kimblemj/server
 public static function rcopy($src, $dst)
 {
     //hack to "fix" security issue of this becoming open API via our terrible framework
     if (strpos($_SERVER['REQUEST_URI'], 'rcopy') !== false) {
         return new return_package(6, NULL, "Attempt to bypass authentication externally.");
     }
     $dir = opendir($src);
     @mkdir($dst);
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($src . '/' . $file)) {
                 util::rcopy($src . '/' . $file, $dst . '/' . $file);
             } else {
                 copy($src . '/' . $file, $dst . '/' . $file);
             }
         }
     }
     closedir($dir);
 }
while ($i < count($slides)) {
    if ($util->isKeyMessage($slides[$i])) {
        echo "\n" . $slides[$i] . "\n";
        if ($Relink) {
            echo "\n Relinking shared folder.\n";
            // chrdir into the current key message
            //echo("\nSlide path: " . realpath($slides[$i]) . "\n");
            chdir($slides[$i]);
            if (is_dir($globals)) {
                echo "Shared Directory Exists\n";
            } else {
                echo "Shared folder does not exist\n";
            }
            echo "Folder: " . $globals . " " . realpath($globals) . "\n";
            // add new globals
            $util->rcopy($globals, './shared');
            if ($slides[$i] == $config->getSharedFolderPrefix() . "shared") {
                echo "HTML ignored\n";
                echo "THUMB ignored\n";
                echo "PLACEHOLDER ignored\n";
            } else {
                echo "Relinking paths in files.";
                // check .html, thumbnail, and placeholder are named properly
                $criticals += $util->checkName($slides[$i], $parent_dir);
                // see if lead file is of type .html
                if (file_exists($slides[$i] . ".html")) {
                    // do find and replace inside the .html file to update the globals path
                    $filename = $slides[$i] . '.html';
                    $html = file_get_contents($filename);
                    if ($Relink) {
                        $html = str_replace("../shared", "shared", $html);
示例#3
0
    $p_tpl_desc = !empty($_POST['p_tpl_desc']) ? $_POST['p_tpl_desc'] : '';
    $p_tpl_version = !empty($_POST['p_tpl_version']) ? $_POST['p_tpl_version'] : '';
    $p_tpl_author = !empty($_POST['p_tpl_author']) ? $_POST['p_tpl_author'] : '';
    $p_tpl_tags = !empty($_POST['p_tpl_tags']) ? $_POST['p_tpl_tags'] : '';
    $p_tpl_id = util::strToLowerURL($p_tpl_id, false);
    $sTemplate = str_replace(array($sBasicTemplateTheme . '/templates', $sBasicTemplateId . '/template.php'), array($sThemeId . '/templates', $p_tpl_id . '/template.php'), $sBasicTemplate);
    $sTemplatePath = OKT_THEMES_PATH . $sTemplate;
    if (empty($p_tpl_id)) {
        $okt->error->set(__('c_a_te_error_must_tpl_id'));
    } elseif ($p_tpl_id == $sBasicTemplateId) {
        $okt->error->set(__('c_a_te_error_same_tpl_id'));
    } elseif (file_exists($sTemplatePath)) {
        $okt->error->set(sprintf(__('c_a_te_error_tpl_%s_allready_exists'), $sTemplate));
    }
    if ($okt->error->isEmpty()) {
        util::rcopy(dirname($sBasicTemplatePath), dirname($sTemplatePath));
        file_put_contents(dirname($sTemplatePath) . '/_define.php', '<?php' . "\n\n" . '$this->aCurrent = array(' . "\n" . '	\'name\' 		=> \'' . addslashes($p_tpl_name) . '\',' . "\n" . '	\'desc\' 		=> \'' . addslashes($p_tpl_desc) . '\',' . "\n" . '	\'version\' 	=> \'' . addslashes($p_tpl_version) . '\',' . "\n" . '	\'author\' 		=> \'' . addslashes($p_tpl_author) . '\',' . "\n" . '	\'tags\' 		=> \'' . addslashes($p_tpl_tags) . '\'' . "\n" . ');' . "\n");
        $okt->redirect('configuration.php?action=theme_editor&theme=' . $sThemeId . '&file=' . rawurlencode(str_replace('/' . $sThemeId . '/templates', '/templates', $sTemplate)));
    }
}
/* Affichage
----------------------------------------------------------*/
# Infos page
$okt->page->addGlobalTitle(__('c_a_theme_editor'), 'configuration.php?action=theme_editor');
if ($sThemeId) {
    $okt->page->addGlobalTitle($oThemeEditor->getThemeInfo('name'), 'configuration.php?action=theme_editor&theme=' . $sThemeId);
}
$okt->page->addGlobalTitle(__('c_a_te_new_tpl'), 'configuration.php?action=theme_editor&theme=' . $sThemeId . '&new_file=1');
$okt->page->strToSlug('#p_tpl_name', '#p_tpl_id');
# En-tête
require OKT_ADMIN_HEADER_FILE;
示例#4
0
文件: notes.php 项目: kimblemj/server
 public static function exportNotes($pack)
 {
     $pack->auth->game_id = $pack->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $export = notes::getNotesForGame($pack);
     $tmp_export_folder = $pack->game_id . "_notebook_export_" . date("mdY_Gis");
     $fs_tmp_export_folder = Config::v2_gamedata_folder . "/" . $tmp_export_folder;
     if (file_exists($fs_tmp_export_folder)) {
         util::rdel($fs_tmp_export_folder);
     }
     mkdir($fs_tmp_export_folder, 0777);
     $jsonfile = fopen($fs_tmp_export_folder . "/export.json", "w");
     fwrite($jsonfile, json_encode($export));
     fclose($jsonfile);
     util::rcopy(Config::v2_gamedata_folder . "/" . $pack->game_id, $fs_tmp_export_folder . "/gamedata");
     util::rzip($fs_tmp_export_folder, $fs_tmp_export_folder . ".zip");
     util::rdel($fs_tmp_export_folder);
     return new return_package(0, Config::v2_gamedata_www_path . "/" . $tmp_export_folder . ".zip");
 }
示例#5
0
         }
         if ($oZip->isEmpty()) {
             $oZip->close();
             files::deltree($sTempDir);
             throw new Exception(__('c_a_config_display_empty_zip_file'));
         }
         if (!$hasCssFile) {
             $oZip->close();
             files::deltree($sTempDir);
             throw new Exception(__('c_a_config_display_not_valid_theme'));
         }
         $oZip->unzipAll($sTempDir);
         $oZip->close();
         debug($sTempDir);
         $sFinalPath = OKT_PUBLIC_PATH . '/ui-themes/custom';
         util::rcopy($sTempDir . $zip_root_dir . '/css/custom-theme', $sFinalPath);
         rename($sFinalPath . '/' . basename($sTargetDir) . '.css', $sFinalPath . '/jquery-ui.css');
         rename($sFinalPath . '/' . basename($sTargetDir) . '.min.css', $sFinalPath . '/jquery-ui.min.css');
         files::deltree($sTempDir);
         $_POST['p_admin_theme'] = 'custom';
     } catch (Exception $e) {
         files::deltree($sTempDir);
         $okt->error->set($e->getMessage());
     }
 }
 # enregistrement de la configuration
 $p_public_theme = !empty($_POST['p_public_theme']) ? $_POST['p_public_theme'] : 'base';
 $p_enable_admin_bar = !empty($_POST['p_enable_admin_bar']) ? true : false;
 $p_admin_sidebar_position = !empty($_POST['p_admin_sidebar_position']) ? intval($_POST['p_admin_sidebar_position']) : 0;
 $p_admin_theme = !empty($_POST['p_admin_theme']) ? $_POST['p_admin_theme'] : 'base';
 $p_admin_compress_output = !empty($_POST['p_admin_compress_output']) ? true : false;