Esempio n. 1
0
function init_global()
{
    global $gbl, $sgbl, $ghtml;
    global $g_demo;
    $sgbl = new Sgbl();
    $gbl = new Gbl();
    $gbl->get();
    //
    // Turn on demo version by putting a empty file called demo in the etc dir
    //
    if (lfile_exists("__path_program_etc/demo")) {
        $g_demo = 1;
    }
    //
    // ### LxCenter
    //
    // Check for Development/Debug version
    // If file not exists, Production mode (-1)
    // If file exists it can have the following numbers to enable
    // 1  = Debug mode 1
    // 2  = Debug mode 2
    // 3  = Debug mode 3
    // 4  = Debug mode 4
    // 5  = Debug mode 5
    // -1 = Turn Off and go to production mode
    check_for_debug("/commands.php");
    // Disabled by LxCenter, we are not at PHP version with number 1 at postition N ( x.N.x )
    //  $v = explode(".", PHP_VERSION);
    //  if ($v[1] == "1" && $sgbl->isDebug()) {
    //      date_default_timezone_set("UTC");
    //  }
    $sgbl->method = $sgbl->dbg >= 1 ? "get" : "post";
}
Esempio n. 2
0
function init_global()
{
    global $gbl, $sgbl, $ghtml;
    global $g_demo;
    $sgbl = new Sgbl();
    $gbl = new Gbl();
    $gbl->get();
    date_default_timezone_set("UTC");
    //
    // Turn on demo version by putting a empty file called demo in the etc dir.
    // More info about enable a demo server soon at our wiki
    //
    if (lfile_exists("__path_program_etc/demo")) {
        $g_demo = 1;
    }
    check_for_debug("/usr/local/lxlabs/hypervm/httpdocs/commands.php");
    $sgbl->method = $sgbl->dbg >= 1 ? "get" : "post";
    //
    // ### LxCenter
    //
    // Check for Development/Debug version
    // If file not exists, Production mode (-1)
    // If file exists it can have the following numbers to enable
    // 1  = Debug mode 1
    // 2  = Debug mode 2
    // 3  = Debug mode 3
    // 4  = Debug mode 4
    // 5  = Debug mode 5
    // -1 = Turn Off and go to production mode
}
Esempio n. 3
0
 public function get_controller()
 {
     if (SITE_AVAILABLE) {
         $controllers_array = Gbl::get('controllers_array');
         if (!empty($this->up[0]) && Cleaner::sanitized(CTYPE_ARRAY, $this->up[0], array_keys($controllers_array))) {
             $controller_name = $controllers_array[$this->up[0]];
         } else {
             # we are running from the default page of the site, so pass the default back
             $controller_name = Gbl::get('default_controller');
         }
     } else {
         $controller_name = 'MaintenanceController';
     }
     # do we have to include the code for the controller?
     if (!is_object($controller_name)) {
         require_once CONTROLLERS_PATH . '/' . $controller_name . '.lib.php';
     }
     return new $controller_name();
 }
Esempio n. 4
0
 protected function _load($template_name, $cache_timeout = 86400, $cache_id = '')
 {
     $template_engine = Gbl::get('template_engine');
     # check for cached version of the template by the cache id (which can be empty)
     if (!$template_engine->is_cached($template_name, $cache_id)) {
         $template_engine->cache_lifetime = $cache_timeout;
     }
     //$template_engine->assign('user',Gbl::get('user'));
     # set up the variables for the template engine
     if (!empty($this->state)) {
         foreach ($this->state as $vn => $vv) {
             $template_engine->assign($vn, $vv);
         }
     }
     # fetch or display the template
     if ($this->_fetch_template) {
         return $template_engine->fetch($template_name, $cache_id);
     } else {
         $template_engine->display($template_name, $cache_id);
         return true;
     }
 }
Esempio n. 5
0
 protected function dump_log()
 {
     $log = "============\n" . strftime("%X %x", time()) . "\n" . $this->url . "\n";
     $log .= print_r($this->curlinfo, 1);
     $log .= "\n\nheader ------\n";
     $log .= print_r($this->header, 1);
     $log .= "\n\njson ------\n";
     $log .= print_r($this->json_response, 1);
     $log .= "\n\nerror ------\n";
     $log .= print_r($this->json_error, 1);
     Gbl::get('system_log')->write(LOG_LEVEL_ALL, $log);
 }
Esempio n. 6
0
#!/usr/bin/php5 -q
<?php 
define('CRON_MODE', 1);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '768M');
$dir = explode('/', __FILE__);
array_pop($dir);
$dir = implode('/', $dir);
require_once $dir . '/../../config/node.conf.php';
require_once MODULES_PATH . '/Cron.lib.php';
mb_internal_encoding("UTF-8");
try {
    $cron = new Cron();
    $cron->run_script();
} catch (Exception $e) {
    Gbl::get('system_log')->write(LOG_LEVEL_ERROR, 'Fatal website error (run-cron.php):' . $e->getMessage());
    die('Exception!');
}
Esempio n. 7
0
function query_count($count_query) {
	$return = mysqli_query(Gbl::get('db'), $count_query); 
	return(mysqli_num_rows($return));
}