예제 #1
0
 function testCSS()
 {
     $dh = opendir(get_file_base() . '/themes/default/css');
     while (($f = readdir($dh)) !== false) {
         if (substr($f, -4) == '.css' && $f != 'svg.css' && $f != 'quizzes.css') {
             $path = css_enforce(basename($f, '.css'), 'default', false);
             $contents = file_get_contents($path);
             $errors = check_css($contents);
             if (!is_null($errors) && $errors['errors'] == array()) {
                 $errors = NULL;
             }
             // Normalise
             $this->assertTrue(is_null($errors), 'Bad CSS in ' . $f);
             if (!is_null($errors)) {
                 var_dump($errors['errors']);
                 var_dump($contents);
             }
         }
     }
 }
예제 #2
0
if (substr($FILE_BASE, -4) == '.php') {
    $a = strrpos($FILE_BASE, '/');
    $b = strrpos($FILE_BASE, '\\');
    $FILE_BASE = substr($FILE_BASE, 0, $a > $b ? $a : $b);
}
$RELATIVE_PATH = '';
@chdir($FILE_BASE);
global $NON_PAGE_SCRIPT;
$NON_PAGE_SCRIPT = 1;
if (!is_file($FILE_BASE . '/sources/global.php')) {
    exit('<html><head><title>Critical startup error</title></head><body><h1>ocPortal startup error</h1><p>The second most basic ocPortal startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the ocPortal system, so please check all files are uploaded correctly.</p><p>Once all ocPortal files are in place, ocPortal must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.</p><p>ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://ocportal.com">ocPortal website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.</p><hr /><p style="font-size: 0.8em">ocPortal is a website engine created by ocProducts.</p></body></html>');
}
require $FILE_BASE . '/sources/global.php';
require_code('developer_tools');
destrictify();
css_enforce('global');
if (!has_zone_access(get_member(), 'adminzone')) {
    exit('Security error (did you get logged out?)');
}
$max_width = 800;
$large_image_location = $_GET['file'];
if (get_magic_quotes_gpc()) {
    $large_image_location = stripslashes($large_image_location);
}
$thumb_image_location = $_GET['thumb'];
if (get_magic_quotes_gpc()) {
    $thumb_image_location = stripslashes($thumb_image_location);
}
if (substr($large_image_location, 0, strlen('uploads/attachments/')) != 'uploads/attachments/') {
    exit('Security error');
}
예제 #3
0
/**
 * Get tempcode to tie in (to the HTML, in <head>) all the CSS files that have been required.
 *
 * @param  boolean		Force inline CSS
 * @param  boolean		Only do global CSS
 * @param  ?string		HTML context for which we filter (minimise) any CSS we spit out as inline (NULL: none)
 * @param  ?ID_TEXT		The name of the theme (NULL: current theme)
 * @return tempcode		The tempcode to tie in the CSS files
 */
function css_tempcode($inline = false, $only_global = false, $context = NULL, $theme = NULL)
{
    global $CSSS;
    $seed = '';
    if (has_specific_permission(get_member(), 'view_profiling_modes')) {
        $seed = get_param('keep_theme_seed', '');
    }
    $text_only = get_param_integer('keep_textonly', 0) == 1;
    $minify = get_param_integer('keep_no_minify', 0) == 0;
    $https = get_option('enable_https', true) == '1' && function_exists('is_page_https') && function_exists('get_zone_name') && (tacit_https() || is_page_https(get_zone_name(), get_page_name()));
    $mobile = is_mobile();
    $css = new ocp_tempcode();
    $css_need_inline = new ocp_tempcode();
    $css_to_do = $only_global ? array('global', 'no_cache') : array_keys($CSSS);
    foreach ($css_to_do as $c) {
        if (is_integer($c)) {
            $c = strval($c);
        }
        if ($seed != '') {
            $keep = symbol_tempcode('KEEP');
            $css->attach(do_template('CSS_NEED_FULL', array('URL' => find_script('themewizard') . '?type=css&show=' . $c . '.css' . $keep->evaluate()), user_lang(), false, NULL, '.tpl', 'templates', $theme));
        } elseif ($c == 'no_cache' || $inline) {
            if (!$text_only) {
                $_css = do_template($c, NULL, user_lang(), false, NULL, '.css', 'css', $theme);
                $__css = $_css->evaluate();
                if ($context !== NULL) {
                    $__css = filter_css($__css, $context);
                } else {
                    $__css = str_replace('} ', '}' . chr(10), preg_replace('#\\s+#', ' ', $__css));
                }
                if (trim($__css) != '') {
                    $css_need_inline->attach(do_template('CSS_NEED_INLINE', array('_GUID' => 'f5b225e080c633ffa033ec5af5aec866', 'CSS' => $__css), user_lang(), false, NULL, '.tpl', 'templates', $theme));
                }
            }
        } else {
            $temp = css_enforce($c, $theme);
            if (!$minify) {
                $c .= '_non_minified';
            }
            if ($https) {
                $c .= '_ssl';
            }
            if ($mobile) {
                $c .= '_mobile';
            }
            if ($temp != '') {
                $css->attach(do_template('CSS_NEED', array('_GUID' => 'ed35fac857214000f69a1551cd483096', 'CODE' => $c), user_lang(), false, NULL, '.tpl', 'templates', $theme));
            }
        }
    }
    $css_need_inline->attach($css);
    return $css_need_inline;
}
예제 #4
0
파일: ajax.php 프로젝트: erico-deh/ocPortal
/**
 * AJAX script for dynamic inclusion of CSS.
 */
function sheet_script()
{
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header('Content-Type: text/css');
    $sheet = get_param('sheet');
    if ($sheet != '') {
        echo str_replace('../../../', '', file_get_contents(css_enforce(filter_naughty_harsh($sheet))));
    }
}