Ejemplo n.º 1
0
/**
 * Convert URI to a full URL
 *
 * Convert a "site URL" to a full URL, using the values defined at
 * url_functions.base_url and url_functions.secure_base_url in the 
 * configuration.  If base_url is not set, it defaults to "/" - relative to the 
 * root of the host.  If secure_base_url is not set, base_url with the protocol
 * replaced with "https" is used.
 *
 * The <var>$secure</var> argument determines which base URL is used.  TRUE and
 * FALSE (boolean, not strings) force secure and normal, respectively.  If 
 * 'auto' is specified (default), then the secure URL is used if the current page
 * was served over HTTPS.
 *
 * @param   string  $uri
 * @param   mixed   $secure     Whether or not to use the secure base URL
 * @return  string
 */
function site_url($uri, $secure = 'auto')
{
    $uri = ltrim($uri, '/');
    // Check if this should use the secure URL
    $use_ssl = $secure === TRUE || $secure === 'auto' && isset($_SERVER['HTTPS']);
    if ($use_ssl) {
        return CSF::config('url_functions.secure_base_url', preg_replace('#\\w{1,10}://#A', 'https://', CSF::config('url_functions.base_url', '/'))) . $uri;
    } else {
        return CSF::config('url_functions.base_url', '/') . $uri;
    }
}
Ejemplo n.º 2
0
<?php

header('Content-Type: text/css');
require_once 'csf/csf.php';
CSF::add_library_path('extlib');
CSF::load_library('lessphp/lessc.inc');
$whitelist = array('style.less');
$infile = $_SERVER['QUERY_STRING'];
if (!in_array($infile, $whitelist)) {
    exit;
}
$lc = new lessc($infile);
echo $lc->parse();
Ejemplo n.º 3
0
<?php

/**
 * CodeScape Framework - Dispatch module
 *
 * @package     CSF
 * @author      Alan Briolat
 * @copyright   (c) 2009, Alan Briolat
 * @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 */
CSF::load_library('csf_dispatch');
CSF::register($MODULE_NAME, new CSF_Dispatch($MODULE_CONF));
Ejemplo n.º 4
0
<?php

/**
 * CodeScape Framework - Template module
 *
 * @package     CSF
 * @author      Alan Briolat <*****@*****.**>
 * @copyright   (c) 2009, Alan Briolat
 * @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 * @link        http://codescape.net/csf/doc/template/
 */
CSF::load_library('csf_template');
CSF::register($MODULE_NAME, new CSF_Template($MODULE_CONF));
Ejemplo n.º 5
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
        <title>YARG</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="<?php 
echo site_url('lessc.php?style.less');
?>
" />
        <script type="text/javascript" src="<?php 
echo site_url('js/jquery-1.4.2.min.js');
?>
"></script>
        <script type="text/javascript">
            var YARG = <?php 
echo json_encode(array('base_url' => CSF::config('url_functions.base_url'), 'refresh_interval' => 2000, 'current' => array('page' => $C['page'], 'subpage' => $C['subpage'])));
?>
;
        </script>
        <script type="text/javascript" src="<?php 
echo site_url('js/yarg.util.js');
?>
"></script>
        <script type="text/javascript" src="<?php 
echo site_url('js/yarg.js');
?>
"></script>
    </head>
    <body>
        <div id="header">
            <div id="navigation">
Ejemplo n.º 6
0
<?php

/**
 * CodeScape Framework - Database module
 *
 * @package     CSF
 * @author      Alan Briolat <*****@*****.**>
 * @copyright   (c) 2009, Alan Briolat
 * @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 */
CSF::load_library('csf_db');
CSF::register($MODULE_NAME, new CSF_DB($MODULE_CONF));
Ejemplo n.º 7
0
<?php

/**
 * CodeScape Framework - Encrypt module
 *
 * @package     CSF
 * @author      Alan Briolat
 * @copyright   (c) 2009, Alan Briolat
 * @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 */
CSF::load_library('csf_encrypt');
CSF::register($MODULE_NAME, new CSF_Encrypt($MODULE_CONF));
Ejemplo n.º 8
0
<?php

CSF::load_library('rtorrent');
CSF::register($MODULE_NAME, new rTorrent($MODULE_CONF));
Ejemplo n.º 9
0
<?php

define('YARG_NAME', 'YARG');
define('YARG_VERSION', '0.1');
define('YARG_URL', 'http://github.com/alanbriolat/YARG');
error_reporting(E_ALL | E_NOTICE);
require_once 'csf/csf.php';
require_once 'conf/system.conf.php';
require_once 'conf/user.conf.php';
CSF::init($config);
$CSF = CSF();
$response = $CSF->dispatch->dispatch_uri($CSF->request->get_uri());
echo $response;
Ejemplo n.º 10
0
<?php

/**
 * CodeScape Framework - Request module
 *
 * @package     CSF
 * @author      Alan Briolat <*****@*****.**>
 * @copyright   (c) 2009, Alan Briolat
 * @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
 * @link        http://codescape.net/csf/doc/request/
 */
CSF::load_library('csf_request');
CSF::register($MODULE_NAME, new CSF_Request($MODULE_CONF));
Ejemplo n.º 11
0
 /**
  * Allow $module->othermodule syntax
  *
  * Overrides the __get() method so that modules can be accessed using
  * $this->themodule.  If you want to override __get(), you can still
  * get this behaviour by calling CSF_Module::__get($name).
  *
  * @param   string  $name       The module name
  * @return  mixed
  */
 public function __get($name)
 {
     return CSF::get($name);
 }