Esempio n. 1
1
/**
 * Output all needed JavaScript
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function js_out()
{
    global $conf;
    global $lang;
    global $config_cascade;
    // The generated script depends on some dynamic options
    $cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
    $cache->_event = 'JS_CACHE_USE';
    // load minified version for some files
    $min = $conf['compress'] ? '.min' : '';
    // array of core files
    $files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir() . 'script.js');
    // add possible plugin scripts and userscript
    $files = array_merge($files, js_pluginscripts());
    if (isset($config_cascade['userscript']['default'])) {
        $files[] = $config_cascade['userscript']['default'];
    }
    $cache_files = array_merge($files, getConfigFiles('main'));
    $cache_files[] = __FILE__;
    // check cache age & handle conditional request
    // This may exit if a cache can be used
    $cache_ok = $cache->useCache(array('files' => $cache_files));
    http_cached($cache->cache, $cache_ok);
    // start output buffering and build the script
    ob_start();
    // add some global variables
    print "var DOKU_BASE   = '" . DOKU_BASE . "';";
    print "var DOKU_TPL    = '" . tpl_basedir() . "';";
    // FIXME: Move those to JSINFO
    print "var DOKU_UHN    = " . (int) useHeading('navigation') . ";";
    print "var DOKU_UHC    = " . (int) useHeading('content') . ";";
    // load JS specific translations
    $json = new JSON();
    $lang['js']['plugins'] = js_pluginstrings();
    echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
    // load toolbar
    toolbar_JSdefines('toolbar');
    // load files
    foreach ($files as $file) {
        echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
        js_load($file);
        echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
    }
    // init stuff
    if ($conf['locktime'] != 0) {
        js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
    }
    // init hotkeys - must have been done after init of toolbar
    # disabled for FS#1958    js_runonstart('initializeHotkeys()');
    // end output buffering and get contents
    $js = ob_get_contents();
    ob_end_clean();
    // compress whitespace and comments
    if ($conf['compress']) {
        $js = js_compress($js);
    }
    $js .= "\n";
    // https://bugzilla.mozilla.org/show_bug.cgi?id=316033
    http_cached_finish($cache->cache, $js);
}
Esempio n. 2
0
/**
 * Output all needed JavaScript
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function js_out()
{
    global $conf;
    global $lang;
    global $config_cascade;
    // The generated script depends on some dynamic options
    $cache = getCacheName('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
    // array of core files
    $files = array(DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/events.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/ajax.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/subscriptions.js', DOKU_TPLINC . 'script.js');
    // add possible plugin scripts and userscript
    $files = array_merge($files, js_pluginscripts());
    if (isset($config_cascade['userscript']['default'])) {
        $files[] = $config_cascade['userscript']['default'];
    }
    // check cache age & handle conditional request
    header('Cache-Control: public, max-age=3600');
    header('Pragma: public');
    if (js_cacheok($cache, $files)) {
        http_conditionalRequest(filemtime($cache));
        if ($conf['allowdebug']) {
            header("X-CacheUsed: {$cache}");
        }
        // finally send output
        if ($conf['gzip_output'] && http_gzip_valid($cache)) {
            header('Vary: Accept-Encoding');
            header('Content-Encoding: gzip');
            readfile($cache . ".gz");
        } else {
            if (!http_sendfile($cache)) {
                readfile($cache);
            }
        }
        return;
    } else {
        http_conditionalRequest(time());
    }
    // start output buffering and build the script
    ob_start();
    // add some global variables
    print "var DOKU_BASE   = '" . DOKU_BASE . "';";
    print "var DOKU_TPL    = '" . DOKU_TPL . "';";
    print "var DOKU_UHN    = " . (int) useHeading('navigation') . ";";
    print "var DOKU_UHC    = " . (int) useHeading('content') . ";";
    // load JS specific translations
    $json = new JSON();
    $lang['js']['plugins'] = js_pluginstrings();
    echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
    // load toolbar
    toolbar_JSdefines('toolbar');
    // load files
    foreach ($files as $file) {
        echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
        js_load($file);
        echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
    }
    // init stuff
    js_runonstart("addEvent(document,'click',closePopups)");
    js_runonstart('addTocToggle()');
    js_runonstart("initSizeCtl('size__ctl','wiki__text')");
    js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)");
    if ($conf['locktime'] != 0) {
        js_runonstart("locktimer.init(" . ($conf['locktime'] - 60) . ",'" . js_escape($lang['willexpire']) . "'," . $conf['usedraft'] . ")");
    }
    js_runonstart('scrollToMarker()');
    js_runonstart('focusMarker()');
    // init hotkeys - must have been done after init of toolbar
    # disabled for FS#1958    js_runonstart('initializeHotkeys()');
    // end output buffering and get contents
    $js = ob_get_contents();
    ob_end_clean();
    // compress whitespace and comments
    if ($conf['compress']) {
        $js = js_compress($js);
    }
    $js .= "\n";
    // https://bugzilla.mozilla.org/show_bug.cgi?id=316033
    // save cache file
    io_saveFile($cache, $js);
    if (function_exists('gzopen')) {
        io_saveFile("{$cache}.gz", $js);
    }
    // finally send output
    if ($conf['gzip_output']) {
        header('Vary: Accept-Encoding');
        header('Content-Encoding: gzip');
        print gzencode($js, 9, FORCE_GZIP);
    } else {
        print $js;
    }
}
Esempio n. 3
0
    exit;
}
if (isset($_POST["username"])) {
    wifidog_authenticate();
    exit;
}
if (isset($_GET["css"])) {
    css();
    exit;
}
if (isset($_GET["endusers"])) {
    endusers_load();
    exit;
}
if (isset($_GET["jsload"])) {
    js_load();
    exit;
}
if (isset($_GET["imgload"])) {
    imgload();
    exit;
}
session_start();
if (isset($_POST["register-password"])) {
    register_save();
    exit;
}
if (isset($_GET["verbose"])) {
    $GLOBALS["VERBOSE"] = true;
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
Esempio n. 4
0
/**
 * Output all needed JavaScript
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function js_out()
{
    global $conf;
    global $lang;
    global $config_cascade;
    global $INPUT;
    // decide from where to get the template
    $tpl = trim(preg_replace('/[^\\w-]+/', '', $INPUT->str('t')));
    if (!$tpl) {
        $tpl = $conf['template'];
    }
    // The generated script depends on some dynamic options
    $cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'] . DOKU_BASE . $tpl, '.js');
    $cache->_event = 'JS_CACHE_USE';
    // load minified version for some files
    $min = $conf['compress'] ? '.min' : '';
    // array of core files
    $files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/jquery/jquery-migrate{$min}.js", DOKU_INC . 'inc/lang/' . $conf['lang'] . '/jquery.ui.datepicker.js', DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir($tpl) . 'script.js');
    // add possible plugin scripts and userscript
    $files = array_merge($files, js_pluginscripts());
    if (!empty($config_cascade['userscript']['default'])) {
        foreach ($config_cascade['userscript']['default'] as $userscript) {
            $files[] = $userscript;
        }
    }
    $cache_files = array_merge($files, getConfigFiles('main'));
    $cache_files[] = __FILE__;
    // check cache age & handle conditional request
    // This may exit if a cache can be used
    $cache_ok = $cache->useCache(array('files' => $cache_files));
    http_cached($cache->cache, $cache_ok);
    // start output buffering and build the script
    ob_start();
    $json = new JSON();
    // add some global variables
    print "var DOKU_BASE   = '" . DOKU_BASE . "';";
    print "var DOKU_TPL    = '" . tpl_basedir($tpl) . "';";
    print "var DOKU_COOKIE_PARAM = " . $json->encode(array('path' => empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'], 'secure' => $conf['securecookie'] && is_ssl())) . ";";
    // FIXME: Move those to JSINFO
    print "var DOKU_UHN    = " . (int) useHeading('navigation') . ";";
    print "var DOKU_UHC    = " . (int) useHeading('content') . ";";
    // load JS specific translations
    $lang['js']['plugins'] = js_pluginstrings();
    $templatestrings = js_templatestrings($tpl);
    if (!empty($templatestrings)) {
        $lang['js']['template'] = $templatestrings;
    }
    echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
    // load toolbar
    toolbar_JSdefines('toolbar');
    // load files
    foreach ($files as $file) {
        if (!file_exists($file)) {
            continue;
        }
        $ismin = substr($file, -7) == '.min.js';
        $debugjs = $conf['allowdebug'] && strpos($file, DOKU_INC . 'lib/scripts/') !== 0;
        echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
        if ($ismin) {
            echo "\n/* BEGIN NOCOMPRESS */\n";
        }
        if ($debugjs) {
            echo "\ntry {\n";
        }
        js_load($file);
        if ($debugjs) {
            echo "\n} catch (e) {\n   logError(e, '" . str_replace(DOKU_INC, '', $file) . "');\n}\n";
        }
        if ($ismin) {
            echo "\n/* END NOCOMPRESS */\n";
        }
        echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
    }
    // init stuff
    if ($conf['locktime'] != 0) {
        js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
    }
    // init hotkeys - must have been done after init of toolbar
    # disabled for FS#1958    js_runonstart('initializeHotkeys()');
    // end output buffering and get contents
    $js = ob_get_contents();
    ob_end_clean();
    // strip any source maps
    stripsourcemaps($js);
    // compress whitespace and comments
    if ($conf['compress']) {
        $js = js_compress($js);
    }
    $js .= "\n";
    // https://bugzilla.mozilla.org/show_bug.cgi?id=316033
    http_cached_finish($cache->cache, $js);
}
Esempio n. 5
0
<?php

echo doctype();
?>
  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type"
           content="application/xhtml+xml;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> 

    <?php 
echo js_load('user.js');
?>
    <?php 
echo css_load('user.css');
?>
    <title>find-me</title>
  </head>
  <body>
   <div id="wrap">
      <div id="header">
        <h1><?php 
echo anchor('/', 'Welcome to Play, Find your favorite song!');
?>
</h1>
        <ul>
          <li class="selected"><?php 
Esempio n. 6
0
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> 

    <?php 
echo js_load('jquery.corner.js');
?>
    <?php 
echo js_load('form.js');
?>
    <?php 
echo js_load('play.js');
?>

    <?php 
echo css_load('play.css');
?>
    <title><?php 
echo $title;
?>
</title>
  </head>
  <body>
    <div id="wrap">
      <div id="header">
        <h1><?php 
echo anchor('/', 'Welcome to Play, Find your favorite song!');
Esempio n. 7
0
/**
 * Output all needed JavaScript
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function js_out()
{
    global $conf;
    global $lang;
    $edit = (bool) $_REQUEST['edit'];
    // edit or preview mode?
    $write = (bool) $_REQUEST['write'];
    // writable?
    // The generated script depends on some dynamic options
    $cache = getCacheName('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'] . $edit . 'x' . $write, '.js');
    // Array of needed files
    $files = array(DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/events.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/ajax.js', DOKU_INC . 'lib/scripts/index.js');
    if ($edit) {
        if ($write) {
            $files[] = DOKU_INC . 'lib/scripts/edit.js';
        }
        $files[] = DOKU_INC . 'lib/scripts/media.js';
    }
    $files[] = DOKU_TPLINC . 'script.js';
    // get possible plugin scripts
    $plugins = js_pluginscripts();
    // check cache age & handle conditional request
    header('Cache-Control: public, max-age=3600');
    header('Pragma: public');
    if (js_cacheok($cache, array_merge($files, $plugins))) {
        http_conditionalRequest(filemtime($cache));
        if ($conf['allowdebug']) {
            header("X-CacheUsed: {$cache}");
        }
        // finally send output
        if ($conf['gzip_output'] && http_gzip_valid($cache)) {
            header('Vary: Accept-Encoding');
            header('Content-Encoding: gzip');
            readfile($cache . ".gz");
        } else {
            if (!http_sendfile($cache)) {
                readfile($cache);
            }
        }
        return;
    } else {
        http_conditionalRequest(time());
    }
    // start output buffering and build the script
    ob_start();
    // add some global variables
    print "var DOKU_BASE   = '" . DOKU_BASE . "';";
    print "var DOKU_TPL    = '" . DOKU_TPL . "';";
    //FIXME: move thes into LANG
    print "var alertText   = '" . js_escape($lang['qb_alert']) . "';";
    print "var notSavedYet = '" . js_escape($lang['notsavedyet']) . "';";
    print "var reallyDel   = '" . js_escape($lang['del_confirm']) . "';";
    // load JS strings form plugins
    $lang['js']['plugins'] = js_pluginstrings();
    // load JS specific translations
    $json = new JSON();
    echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
    // load files
    foreach ($files as $file) {
        echo "\n\n/* XXXXXXXXXX begin of {$file} XXXXXXXXXX */\n\n";
        js_load($file);
        echo "\n\n/* XXXXXXXXXX end of {$file} XXXXXXXXXX */\n\n";
    }
    // init stuff
    js_runonstart("ajax_qsearch.init('qsearch__in','qsearch__out')");
    js_runonstart("addEvent(document,'click',closePopups)");
    js_runonstart('addTocToggle()');
    if ($edit) {
        // size controls
        js_runonstart("initSizeCtl('size__ctl','wiki__text')");
        if ($write) {
            require_once DOKU_INC . 'inc/toolbar.php';
            toolbar_JSdefines('toolbar');
            js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)");
            // add pageleave check
            js_runonstart("initChangeCheck('" . js_escape($lang['notsavedyet']) . "')");
            // add lock timer
            js_runonstart("locktimer.init(" . ($conf['locktime'] - 60) . ",'" . js_escape($lang['willexpire']) . "'," . $conf['usedraft'] . ")");
        }
    }
    // load plugin scripts (suppress warnings for missing ones)
    foreach ($plugins as $plugin) {
        if (@file_exists($plugin)) {
            echo "\n\n/* XXXXXXXXXX begin of {$plugin} XXXXXXXXXX */\n\n";
            js_load($plugin);
            echo "\n\n/* XXXXXXXXXX end of {$plugin} XXXXXXXXXX */\n\n";
        }
    }
    // load user script
    @readfile(DOKU_CONF . 'userscript.js');
    // add scroll event and tooltip rewriting
    js_runonstart('scrollToMarker()');
    js_runonstart('focusMarker()');
    // end output buffering and get contents
    $js = ob_get_contents();
    ob_end_clean();
    // compress whitespace and comments
    if ($conf['compress']) {
        $js = js_compress($js);
    }
    $js .= "\n";
    // https://bugzilla.mozilla.org/show_bug.cgi?id=316033
    // save cache file
    io_saveFile($cache, $js);
    copy($cache, "compress.zlib://{$cache}.gz");
    // finally send output
    if ($conf['gzip_output']) {
        header('Vary: Accept-Encoding');
        header('Content-Encoding: gzip');
        print gzencode($js, 9, FORCE_GZIP);
    } else {
        print $js;
    }
}
Esempio n. 8
0
echo doctype();
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>

    <meta http-equiv="Content-Type"
          content="application/xhtml+xml;charset=UTF-8" />

    <script type="text/javascript" 
            src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js">
    </script> 
    <?php 
echo js_load("jquery-ui-1.7.2.custom.min.js");
?>
    <?php 
echo js_load("diary_datepicker.js");
?>
    <?php 
echo css_load("jquery-custom-css/jquery-ui-1.7.2.custom.css");
?>
    <?php 
echo css_load("diary.css");
?>
    <title>Hello</title>
  </head>
  <body>
    <?php 
echo form_open('/diary/view');
?>
      <label for='datepicker'>Date ::</label>
      <?php 
Esempio n. 9
0
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type"
           content="application/xhtml+xml;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1">

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>

    <script type="text/javascript" 
            src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js">
    </script> 
    <?php 
echo js_load('form.js');
?>
    <?php 
echo js_load('hit.js');
?>

    <?php 
echo css_load('hit.css');
?>
    <title>play-board</title>
  </head>
  <body>
    <div id="wrap">
      <div id="header">
        <h1><?php 
echo anchor('/', 'Welcome to Play, Find your favorite song!');
?>
</h1>
        <ul>