Example #1
0
function pages_homepage()
{
    $page = new Template();
    $page->c('<h1 class="ten columns">' . 'Welcome to FreshNetworks Reporting' . '</h1>');
    $page->c('<p>' . 'Click on the client name below to run queries on the correct database.');
    $sites = exec_hook('register_sites');
    foreach ($sites as &$site) {
        $site = l($site['name'], '/' . $site['path']);
    }
    $page->c(template_list($sites));
    return $page->render();
}
 private function load_less()
 {
     $this->less = array();
     $files = exec_hook('global_less');
     foreach ($files as $module_name => $module) {
         foreach ($module as $file) {
             $this->less[] = get_url('/' . PATH_TO_MODULES . '/' . $module_name . '/' . $file);
         }
     }
 }
Example #3
0
$path = rtrim($split[0], "/");
$args = array();
if (!empty($split[1])) {
    $split[1] = trim($split[1], "/");
    $args = explode('/', $split[1]);
}
$_GET = array_merge($_POST, $_GET);
$_POST = array_merge($_POST, $_GET);
$db = new Database();
registerModules();
//run the init hook, nothing should be returned
exec_hook('init');
$status = 0;
ob_start();
//get the routing from each module, check them against the current path
$paths = exec_hook('routes');
foreach ($paths as $module_name => $module) {
    current_module($module_name);
    if (array_key_exists($path, $module)) {
        $callback = $module[$path];
        $access = true;
        if (isset($callback['access_callback']) && function_exists($callback['access_callback'])) {
            $access = call_user_func_array($callback['access_callback'], $args);
        }
        if ($access) {
            if (isset($callback['callback']) && function_exists($callback['callback'])) {
                $returned = call_user_func_array($callback['callback'], $args);
                print $returned;
            } else {
                $status = 500;
                elog('either callback is not set or is invalid', 'error', 'bootstrap');
Example #4
0
$path = rtrim($split[0], "/");
$args = array();
if (!empty($split[1])) {
    $split[1] = trim($split[1], "/");
    $args = explode('/', $split[1]);
}
$_GET = array_merge($_POST, $_GET);
$_POST = array_merge($_POST, $_GET);
registerModules();
//run the init hook, nothing should be returned
exec_hook('init');
$status = 0;
ob_start();
//get the routing from each module, check them against the current path
global $system_routes;
$system_routes = exec_hook('routes');
$status = 404;
foreach ($system_routes as $module) {
    if (array_key_exists($path, $module)) {
        $callback = $module[$path];
        $access = true;
        if (isset($callback['access_callback']) && function_exists($callback['access_callback'])) {
            $access = call_user_func_array($callback['access_callback'], $args);
        }
        if ($access) {
            if (isset($callback['callback']) && function_exists($callback['callback'])) {
                $status = 200;
                $returned = call_user_func_array($callback['callback'], $args);
                print $returned;
            } else {
                $status = 500;
/**
 * Execute Security Filter
 *
 * Allows changing of the passed variable
 *
 * @since 2.0
 * @uses $filters
 *
 * @param string $script Filter name to execute
 * @param array $data
 */
function exec_secfilter($filter_name, $result = true)
{
    global $secfilters, $securityFilters;
    $args = prepareHookExecArgs($args = func_get_args());
    $newresult = exec_hook($secfilters, $securityFilters, $filter_name, 'exec_secfilter_callback', $args, 'exec_secfilter_complete');
    return is_bool($newresult) ? $newresult : $result;
}