コード例 #1
0
ファイル: stream.php プロジェクト: rair/yacs
     $text .= '</div>' . "\n" . '<p style="text-align: center; margin: 0.5em 0 1em 0;"><button type="button" onclick="self.close()">' . i18n::s('Close') . '</button></p>' . "\n";
     // page postamble
     $text .= '</body>' . "\n" . '</html>' . "\n";
     break;
 case 'swf':
     // display a large Flash file
     $type = '';
     $mime = 'text/html';
     // allow to load Flash objects
     $script = 'included/browser/js_header/swfobject.js';
     // page preamble
     $text = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<title>' . $context['page_title'] . '</title>' . "\n";
     // load the full library
     $text .= '<script type="text/javascript" src="' . $context['url_to_root'] . $script . '"></script>' . "\n";
     // load javascript files from the skin directory -- e.g., Global Crossing js extensions, etc.
     if (isset($context['skin']) && ($pathnames = Safe::glob($context['path_to_root'] . $context['skin'] . '/*.js'))) {
         foreach ($pathnames as $name) {
             $text .= '<script type="text/javascript" src="' . $context['url_to_root'] . $context['skin'] . '/' . basename($name) . '"></script>' . "\n";
         }
     }
     // load skin style sheet
     // 		if(isset($context['skin']))
     // 			$text .= '<link rel="stylesheet" href="'.$context['url_to_root'].$context['skin'].'/'.str_replace('skins/', '', $context['skin']).'.css" type="text/css" media="all" />'."\n";
     // full screen
     $text .= '</head>' . "\n" . '<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">' . "\n" . '<div id="live_flash">' . "\n";
     // render object full size
     $text .= Codes::render_embed($item['id'] . ', 100%, 90%');
     // add a link to close the window
     $text .= '</div>' . "\n" . '<p style="text-align: center; margin: 0.5em 0 1em 0;"><button type="button" onclick="self.close()">' . i18n::s('Close') . '</button></p>' . "\n";
     // page postamble
     $text .= '</body>' . "\n" . '</html>' . "\n";
コード例 #2
0
ファイル: update_trailer.php プロジェクト: rair/yacs
}
// version 8.4
if (!defined('YACS')) {
    define('YACS', TRUE);
}
// version 8.5 - new side menu
if (!isset($context['page_tools'])) {
    $context['page_tools'] = array();
}
if (!isset($context['script_url'])) {
    $context['script_url'] = '';
}
// version 8.6 - new page components
if (!isset($context['page_tags'])) {
    $context['page_tags'] = '';
}
if (!isset($_SESSION['surfer_interface'])) {
    $_SESSION['surfer_interface'] = 'C';
}
// force a refresh of compacted javascript libraries
if ($items = Safe::glob($context['path_to_root'] . 'temporary/cache_*.js')) {
    foreach ($items as $name) {
        Safe::unlink($name);
    }
}
// safe copy of footprints.php to the root directory
Safe::unlink($context['path_to_root'] . 'footprints.php.bak');
Safe::rename($context['path_to_root'] . 'footprints.php', $context['path_to_root'] . 'footprints.php.bak');
Safe::copy($context['path_to_root'] . 'scripts/staging/footprints.php', $context['path_to_root'] . 'footprints.php');
// remember this as a significant event --i18n::s does not exist before 6.12
Logger::remember('scripts/update_trailer.php: update trailer has been executed');
コード例 #3
0
ファイル: index.php プロジェクト: rair/yacs
 // available commands for system management
 $commands = array();
 $commands[] = sprintf(i18n::s('%s - basic view of the system'), '<a href="test.php">' . i18n::s('Test') . '</a>');
 // more information to associates
 if (Surfer::is_associate()) {
     $commands[] = sprintf(i18n::s('%s - phpinfo() and more'), '<a href="info.php">' . i18n::s('Run-time information') . '</a>');
     $commands[] = sprintf(i18n::s('%s - operation summary'), '<a href="../agents/">' . i18n::s('Background processing') . '</a>');
 }
 // commands for associates -- complex command
 if (Surfer::is_associate() && Surfer::has_all()) {
     $commands[] = sprintf(i18n::s('%s - the safety tool; also useful to submit bulk SQL statements'), '<a href="backup.php">' . i18n::s('Backup/Restore') . '</a>');
     $commands[] = sprintf(i18n::s('%s - check the database structure; also optimize data tables and update index'), '<a href="setup.php">' . i18n::s('Database maintenance') . '</a>');
     $commands[] = sprintf(i18n::s('%s - clear the cache or delete what can be safely deleted'), '<a href="purge.php">' . i18n::s('Purge') . '</a>');
     $commands[] = sprintf(i18n::s('%s - shut the server down, or fire it up again'), '<a href="switch.php">' . i18n::s('Switch') . '</a>');
     // signal scripts to run once, if any
     if (Safe::glob($context['path_to_root'] . 'scripts/run_once/*.php') !== FALSE) {
         $commands[] = sprintf(i18n::s('%s - some upgrades are waiting for execution'), '<a href="../scripts/run_once.php">' . i18n::s('Run once') . '</a>');
     }
     $commands[] = sprintf(i18n::s('%s - server software'), '<a href="../scripts/">Yacs</a>');
     $commands[] = sprintf(i18n::s('%s - plugins and other pieces of software hooked into yacs'), '<a href="scan.php">' . i18n::s('Extensions') . '</a>');
     $commands[] = sprintf(i18n::s('%s - change permissions of files'), '<a href="chmod.php">' . i18n::s('Permissions') . '</a>');
     $commands[] = sprintf(i18n::s('%s - other commands'), '<a href="../tools/">' . i18n::s('Tools') . '</a>');
 }
 // insert commands
 if (count($commands)) {
     $text .= Skin::build_box(i18n::s('System management'), '<ul><li>' . join('</li><li>', $commands) . '</li></ul>', 'header1', 'system_management');
 }
 // build another tab
 if ($text) {
     $all_tabs = array_merge($all_tabs, array(array('system', i18n::s('System'), 'system_panel', $text)));
 }
コード例 #4
0
ファイル: backup.php プロジェクト: rair/yacs
        echo $zipfile->get();
        // do not allow for regular rendering
        return;
        // no file
    } else {
        $context['text'] .= BR . i18n::s('No image have been found.') . '</p>' . "\n";
    }
    // backup parameter files
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'parameters') {
    // splash message
    $context['text'] .= '<p>' . i18n::s('On-going archive preparation...') . '</p>' . "\n";
    // build a zip archive
    include_once '../shared/zipfile.php';
    $zipfile = new zipfile();
    // list parameter files
    if (($files = Safe::glob($context['path_to_root'] . 'parameters/*.include.php')) !== FALSE) {
        // process every parameter file
        foreach ($files as $file) {
            // store binary data
            if (($content = Safe::file_get_contents($file)) !== FALSE) {
                $zipfile->store(basename($file), Safe::filemtime($file), $content);
            }
        }
    }
    // suggest a download
    Safe::header('Content-Type: application/zip');
    Safe::header('Content-Disposition: attachment; filename="backup_parameters.zip"');
    // send the archive content
    echo $zipfile->get();
    // do not allow for regular rendering
    return;
コード例 #5
0
ファイル: cache.php プロジェクト: rair/yacs
 /**
  * purge some temporary files
  *
  * This function works in conjunction with Cache::hash().
  *
  * @param string extension of files to purge
  */
 public static function purge($type = '*')
 {
     global $context;
     // delete files cached by yacs
     if ($items = Safe::glob($context['path_to_root'] . 'temporary/cache_*.' . $type)) {
         foreach ($items as $name) {
             Safe::unlink($name);
         }
     }
     // also delete files cached by SimplePie
     if ($items = Safe::glob($context['path_to_root'] . 'temporary/*.spc')) {
         foreach ($items as $name) {
             Safe::unlink($name);
         }
     }
 }
コード例 #6
0
ファイル: js_css.php プロジェクト: rair/yacs
 /**
  * return <script> html tags to declare external js libraries stored
  * in a given folder
  * @see shared/global.php to see use with /included/browser
  *
  *
  * @param string, folder where to search js file, from included/browsers
  * @param string or array of strings, relative path to other libraries
  * to deal with (e.g. shared/yacs.js)
  * @return string in html format
  */
 public static function get_js_libraries($folder = '', $other_files = '')
 {
     global $context;
     // we provide html tags links to scripts files
     $html = '';
     // in production mode, provide link without scanning if compressed lib is present
     if ($context['with_debug'] == 'N') {
         $path = 'included/browser/library_' . $folder . '.min.js';
         if (file_exists($context['path_to_root'] . $path)) {
             $revision = Js_css::get_revision($context['path_to_root'] . $path);
             $html = Js_Css::build_js_declaration($context['url_to_master'] . $context['url_to_root'] . $path . $revision);
             return $html;
         }
     }
     // path to search for js file, default is "include/browser"
     $path = 'included/browser/' . ($folder ? $folder . '/' : '');
     // scan for js files in folder
     $js_libs = array();
     if (!($files = Safe::glob($context['path_to_root'] . $path . '*.js'))) {
         return $html;
     }
     foreach ($files as $file) {
         $js_libs[] = basename($file);
     }
     if ($js_libs) {
         // files can be renamed with a letter prefix to sort loading from browsers
         natsort($js_libs);
         // build declarations file by file
         foreach ($js_libs as $js) {
             $revision = Js_css::get_revision($context['path_to_root'] . $path . $js);
             $html .= Js_Css::build_js_declaration($context['url_to_master'] . $context['url_to_root'] . $path . $js . $revision);
         }
     }
     if ($other_files) {
         if (gettype($other_files) == 'string') {
             $other_files = (array) $other_files;
         }
         foreach ($other_files as $file) {
             if (file_exists($context['path_to_root'] . $file)) {
                 $revision = Js_css::get_revision($context['path_to_root'] . $file);
                 $html .= Js_Css::build_js_declaration($context['url_to_master'] . $context['url_to_root'] . $file . $revision);
             }
         }
     }
     return $html;
 }
コード例 #7
0
ファイル: virtual.php プロジェクト: rair/yacs
 // the splash label
 $context['text'] .= '<p>' . i18n::s('This script allows to create, modify or delete configuration files for virtual hosts.') . "</p>\n";
 // form to configure a new virtual host
 $content = '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>';
 // name of the new virtual host
 $content .= '<p>' . i18n::s('Virtual host to be created') . ' <input type="text" name="id" size="30" />';
 // the submit button
 $content .= '<input type="hidden" name="action" value="new" />' . Skin::build_submit_button(i18n::s('Create'), NULL, NULL, 'go', 'no_spin_on_click');
 // end of this form
 $content .= '</p></div></form>';
 // insert a box
 $context['text'] .= Skin::build_box(i18n::s('Add a new virtual host'), $content);
 // set the focus on the backup button
 Page::insert_script('$("#id").focus();');
 // list available configuration files
 if ($items = Safe::glob($context['path_to_root'] . 'parameters/virtual_*.include.php')) {
     $rows = array();
     foreach ($items as $item) {
         if (preg_match('/parameters\\/virtual_(.+).include.php/', $item, $matches)) {
             $link = 'control/virtual.php?id=' . urlencode($matches[1]);
             $menu = array();
             $menu[] = '<a href="' . $context['url_to_root'] . $link . '">' . i18n::s('view') . '</a>';
             $menu[] = '<a href="' . $context['url_to_root'] . $link . '&action=edit">' . i18n::s('edit') . '</a>';
             $menu[] = '<a href="' . $context['url_to_root'] . $link . '&action=delete">' . i18n::s('delete') . '</a>';
             $rows[] = array($matches[1], '<a href="' . $context['url_to_root'] . $link . '">' . $matches[0] . '</a>', Skin::build_list($menu, 'menu'));
         }
     }
     // insert a box
     $row_headers = array(i18n::s('Host'), i18n::s('Configuration file'), i18n::s('Commands'));
     $context['text'] .= Skin::build_box(i18n::s('Configured virtual hosts'), Skin::table($row_headers, $rows));
 }
コード例 #8
0
ファイル: jsmin.php プロジェクト: rair/yacs
             }
             // one file has been compressed
             $count++;
         }
     }
 }
 // save the library to call in page header
 $file_min = $context['path_to_root'] . 'included/browser/library_js_header.min.js';
 if ($minified) {
     Safe::file_put_contents($file_min, $minified);
 } else {
     Safe::unlink($file_min);
 }
 // do the same with included/browser/js_endpage, including shared/yacs.js
 $minified = '';
 $files = Safe::glob($context['path_to_root'] . 'included/browser/js_endpage/*.js');
 if (is_array($files) && count($files)) {
     foreach ($files as $name) {
         if (in_array(basename($name), $to_avoid)) {
             continue;
         }
         $context['text'] .= 'included/browser/js_endpage/' . basename($name) . BR . "\n";
         // we do have some content
         if ($text = Safe::file_get_contents($name)) {
             // actual compression
             if (!preg_match('/\\.min\\./', basename($name))) {
                 $minified .= JSMin::minify($text);
             } else {
                 $minified .= $text;
             }
             // one file has been compressed