Exemple #1
0
/**
 * phpVMS - Virtual Airline Administration Software
 * Copyright (c) 2008 Nabeel Shahzad
 * For more information, visit www.phpvms.net
 *	Forums: http://www.phpvms.net/forum
 *	Documentation: http://www.phpvms.net/docs
 *
 * phpVMS is licenced under the following license:
 *   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
 *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @link http://www.phpvms.net
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
 */
function pre_module_load()
{
    if (is_dir(CORE_PATH . '/local.config.php')) {
        Debug::showCritical('core/local.config.php is a folder, not a file. Please delete and create as a file');
        die;
    }
}
Exemple #2
0
/**
 * phpVMS - Virtual Airline Administration Software
 * Copyright (c) 2008 Nabeel Shahzad
 * For more information, visit www.phpvms.net
 *	Forums: http://www.phpvms.net/forum
 *	Documentation: http://www.phpvms.net/docs
 *
 * phpVMS is licenced under the following license:
 *   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
 *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @link http://www.phpvms.net
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
 */
function pre_module_load()
{
    if (is_dir(CORE_PATH . '/local.config.php')) {
        Debug::showCritical('core/local.config.php is a folder, not a file. Please delete and create as a file');
        die;
    }
    if (!file_exists(CORE_PATH . '/local.config.php') || filesize(CORE_PATH . '/local.config.php') == 0) {
        Debug::showCritical('phpVMS has not been installed yet! Goto <a href="install/install.php">install/install.php</a> to start!');
        exit;
    }
    SiteData::loadSiteSettings();
    Auth::StartAuth();
}
Exemple #3
0
 public function BuildFeed($filepath)
 {
     $fp = @fopen($filepath, 'w');
     if (!$fp) {
         Debug::showCritical("{$filepath} is not writeable!");
         return;
     }
     $writestring = '<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel>';
     fwrite($fp, utf8_encode($writestring), strlen($writestring));
     fwrite($fp, utf8_encode($this->feed_contents), strlen($this->feed_contents));
     $writestring = '</channel></rss>';
     fwrite($fp, utf8_encode($writestring), strlen($writestring));
     fclose($fp);
     return true;
 }
Exemple #4
0
/**
 * phpVMS - Virtual Airline Administration Software
 * Copyright (c) 2008 Nabeel Shahzad
 * For more information, visit www.phpvms.net
 *	Forums: http://www.phpvms.net/forum
 *	Documentation: http://www.phpvms.net/docs
 *
 * phpVMS is licenced under the following license:
 *   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
 *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @link http://www.phpvms.net
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
 */
function pre_module_load()
{
    if (is_dir(CORE_PATH . '/local.config.php')) {
        Debug::showCritical('core/local.config.php is a folder, not a file. Please delete and create as a file');
        die;
    }
    if (!file_exists(CORE_PATH . '/local.config.php') || filesize(CORE_PATH . '/local.config.php') == 0) {
        Debug::showCritical('phpVMS has not been installed yet! Goto <a href="install/install.php">install/install.php</a> to start!');
        exit;
    }
    SiteData::loadSiteSettings();
    Auth::StartAuth();
    # Set a "authuser" super variable, so it's available in every template...
    if (Auth::LoggedIn() === true) {
        Template::set('authuser', Auth::$userinfo);
    } else {
        Template::set('authuser', null);
    }
}
Exemple #5
0
function post_module_load()
{
    /* Misc tasks which need to get done */
    /* If the setting to auto-retired pilots is on, then do that
    		and only check every 24 hours
    	 */
    if (Config::Get('USE_CRON') === true) {
        if (Config::Get('PILOT_AUTO_RETIRE') == true) {
            $within_timelimit = CronData::check_hoursdiff('find_retired_pilots', '24');
            if ($within_timelimit == false) {
                PilotData::findRetiredPilots();
                CronData::set_lastupdate('find_retired_pilots');
            }
        }
        if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) {
            $within_timelimit = CronData::check_hoursdiff('check_expired_bids', '24');
            if ($within_timelimit == false) {
                SchedulesData::deleteExpiredBids();
                CronData::set_lastupdate('check_expired_bids');
            }
        }
        /* Expenses, make sure they're all populated */
        $within_timelimit = CronData::check_hoursdiff('populate_expenses', '18');
        if ($within_timelimit == false) {
            FinanceData::updateAllExpenses();
            CronData::set_lastupdate('populate_expenses');
        }
        /* And finally, clear expired sessions */
        Auth::clearExpiredSessions();
    }
    // @TODO: Clean ACARS records older than one month
    if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
        echo '<html><head><title>Down for maintenance - ' . SITE_NAME . '</title></head><body>';
        Debug::showCritical(Config::Get('MAINTENANCE_MESSAGE'), 'Down for maintenance');
        echo '</body></html>';
        die;
    }
    return true;
}
Exemple #6
0
 * @link http://www.nsslive.net/codon
 * @license BSD License
 * @package codon_core
 */
/**
 * @author Nabeel Shahzad <www.phpvms.net>
 * @desc Admin panel home
 */
define('ADMIN_PANEL', true);
include '../core/codon.config.php';
if (!Auth::LoggedIn()) {
    Debug::showCritical('Please login first');
    die;
}
if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access');
    die;
}
$BaseTemplate = new TemplateSet();
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
    $tplname = 'layout';
}
//load the main skin
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
    include $settings_file;
}
$BaseTemplate->template_path = SITE_ROOT . '/admin/lib/' . $tplname;
$BaseTemplate->Set('title', SITE_NAME);
Template::Set('MODULE_NAV_INC', $NAVBAR);
Exemple #7
0
    DB::$show_errors = Config::Get('DEBUG_MODE');
    DB::$throw_exceptions = false;
    DB::init(DBASE_TYPE);
    DB::set_log_errors(Config::Get('DEBUG_MODE'));
    DB::set_error_handler(array('Debug', 'db_error'));
    DB::set_caching(false);
    DB::$table_prefix = TABLE_PREFIX;
    DB::set_cache_dir(CACHE_PATH);
    DB::$DB->debug_all = false;
    if (Config::Get('DEBUG_MODE') == true) {
        DB::show_errors();
    } else {
        DB::hide_errors();
    }
    if (!DB::connect(DBASE_USER, DBASE_PASS, DBASE_NAME, DBASE_SERVER)) {
        Debug::showCritical(Lang::gs('database.connection.failed') . ' (' . DB::$errno . ': ' . DB::$error . ')');
        die;
    }
    # Set the charset type to send to mysql
    if (Config::Get('DB_CHARSET_NAME') !== '') {
        DB::query('SET NAMES \'' . Config::Get('DB_CHARSET_NAME') . '\'');
    }
    # Include ORM
    #include_once(VENDORS_PATH.DS.'orm'.DS.'idiorm.php');
    #include_once(VENDORS_PATH.DS.'orm'.DS.'paris.php');
    #ORM::configure('mysql:host='.DBASE_SERVER.';dbname='.DBASE_NAME);
    #ORM::configure('username', DBASE_USER);
    #ORM::configure('password', DBASE_PASS);
}
include CORE_PATH . DS . 'bootstrap.inc.php';
if (function_exists('pre_module_load')) {
 /**
  * This runs the Controller() function of all the
  * 	modules, and gives priority to the module passed
  *	in the parameter
  *
  * @param string $module_priority Module that is called first
  * 
  * Change - Oct 2009
  *	Makes this more "cake-esque" - check if the "Controller" function
  *	exists (for backwards compat), if it doesn't then run the function
  *	defined by the "action" bit in the URL
  */
 public static function RunAllActions()
 {
     //$call_function = 'Controller';
     $ModuleName = strtoupper(self::$activeModule);
     global ${$ModuleName};
     // Make sure this module is valid
     if (!is_object(${$ModuleName})) {
         Debug::showCritical("The module \"{$ModuleName}\" doesn't exist!");
         return;
     }
     // Check if we have a function for the page we are calling
     $name = CodonRewrite::$current_action;
     if ($name == '') {
         $call_function = 'index';
     } else {
         $call_function = $name;
     }
     /* Don't call self::Run() - parameters could change. They have to stay the same
     			due to the fact that outside modules, etc will still use Run(), so it has
     			to stay the same */
     $ret = call_user_func_array(array(${$ModuleName}, $call_function), CodonRewrite::$params);
     /* Set the title, based on what the module has, if it's blank,
     			then just set it to the module name */
     self::$page_title = ${$ModuleName}->title;
     if (strlen(self::$page_title) === 0) {
         self::$page_title = ucwords(strtolower($ModuleName));
     }
     return true;
 }
Exemple #9
0
 /**
  * PilotAdmin::ViewPilotDetails()
  * 
  * @return
  */
 protected function ViewPilotDetails()
 {
     //This is for the main tab
     if (PilotGroups::group_has_perm(Auth::$usergroups, EDIT_PILOTS) || PilotGroups::group_has_perm(Auth::$usergroups, EDIT_GROUPS) || PilotGroups::group_has_perm(Auth::$usergroups, EDIT_AWARDS) || PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) {
         $this->set('pilotinfo', PilotData::GetPilotData($this->get->pilotid));
         $this->set('customfields', PilotData::GetFieldData($this->get->pilotid, true));
         $this->set('allawards', AwardsData::GetPilotAwards($this->get->pilotid));
         $this->set('pireps', PIREPData::GetAllReportsForPilot($this->get->pilotid));
         $this->set('countries', Countries::getAllCountries());
         $this->SetGroupsData($this->get->pilotid);
         // For the PIREP list
         $this->set('pending', false);
         $this->set('load', 'pilotpireps');
         $this->render('pilots_detailtabs.php');
     } else {
         Debug::showCritical('Unauthorized access - Invalid Permissions.');
         die;
     }
 }
 private static function checkPerm($perm)
 {
     if (!PilotGroups::group_has_perm(Auth::$usergroups, $perm)) {
         Debug::showCritical('Unauthorized access - Invalid Permissions.');
         die;
     }
 }