Ejemplo n.º 1
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') == false) {
        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();
    }
    if (Config::Get('TWITTER_AIRLINE_ACCOUNT') != '') {
        $within_timelimit = CronData::check_hoursdiff('twitter_update', '3');
        if ($within_timelimit === false) {
            ActivityData::readTwitter();
            CronData::set_lastupdate('twitter_update');
        }
    }
    // @TODO: Clean ACARS records older than one month
    if (Config::Get('MAINTENANCE_MODE') == true && !Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
        Template::Show('maintenance.tpl');
        die;
    }
    return true;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @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);
Ejemplo n.º 4
0
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2008, Nabeel Shahzad
 * @link http://www.nsslive.net/codon
 * @license BSD License
 * @package codon_core
 */
/**
 * @author Nabeel Shahzad <www.phpvms.net>
 * @desc Handles AJAX calls
 */
define('ADMIN_PANEL', true);
include '../core/codon.config.php';
error_reporting(E_ALL ^ E_NOTICE);
if (!Auth::LoggedIn() && !PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
    Debug::showCritical('Unauthorized access!');
    die;
}
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
    $tplname = 'layout';
}
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
    include $settings_file;
}
Template::setTemplatePath(dirname(__FILE__) . '/templates');
Template::setSkinPath(SITE_ROOT . '/admin/lib/' . $tplname);
MainController::runAllActions();
# Force connection close
Ejemplo n.º 5
0
    Template::Show('pilots_addawards.tpl');
    ?>
	</div>
    <?php 
}
if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) {
    ?>
    
	<div id="pireps">
	<?php 
    Template::Show('pireps_list.tpl');
    ?>
	</div>
    <?php 
}
if (PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
    ?>
    
	<div id="resetpass">
    <?php 
    Template::Show('pilots_options.tpl');
    ?>
	</div>
    <?php 
}
?>
    
</div>
</div>

<script type="text/javascript">
<?php

//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/
?>
<h3>Events</h3>
<br />
<center>
<?php 
if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) {
    ?>
<a href="<?php 
    echo SITE_URL;
    ?>
/admin/index.php/Events_admin">Events Main</a><br />
<a href="<?php 
    echo SITE_URL;
    ?>
/admin/index.php/Events_admin/new_event">Create New Event</a><br />
<?php 
}
?>
</center>
<br />
Ejemplo n.º 7
0
<p>Welcome back, <?php 
echo Auth::$userinfo->firstname;
?>
!</p>

<h3>Latest Stats</h3>
<p>
<?php 
if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_PIREPS)) {
    ?>
<strong><a href="<?php 
    echo SITE_URL;
    ?>
/admin/index.php/pirepadmin/viewpending"><?php 
    echo count(PIREPData::GetAllReportsByAccept(PIREP_PENDING));
    ?>
</strong> PIREPs pending</a><br />
<?php 
}
if (PilotGroups::group_has_perm(Auth::$usergroups, MODERATE_REGISTRATIONS)) {
    ?>
<strong><a href="<?php 
    echo SITE_URL;
    ?>
/admin/index.php/pilotadmin/pendingpilots"><?php 
    echo count(PilotData::GetPendingPilots());
    ?>
</strong> Pilot registrations pending</a>
</p>
<?php 
}
Ejemplo n.º 8
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;
     }
 }
Ejemplo n.º 9
0
 private static function checkPerm($perm)
 {
     if (!PilotGroups::group_has_perm(Auth::$usergroups, $perm)) {
         Debug::showCritical('Unauthorized access - Invalid Permissions.');
         die;
     }
 }
Ejemplo n.º 10
0
	
	<dt>Enter password again</dt>
	<dd><input type="password" name="password2" /></dd>
	
	<dt></dt>
	<dd><input type="hidden" name="pilotid" value="<?php 
    echo $pilotid;
    ?>
" />
		<input type="hidden" name="action" value="changepassword" />
		<input type="submit" name="submit" value="Change Password" /></dd>
</dl>
</form>
<?php 
}
if ($pilotid != Auth::$userinfo->pilotid && PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN)) {
    ?>
<h3>Delete Pilot</h3>
<p><strong>Warning!</strong> This is NOT reversible. This removes all of this pilot's information and data,
	including PIREPS and their registration.</p>
<form id="deletepilot" action="<?php 
    echo SITE_URL;
    ?>
/admin/index.php/pilotadmin/viewpilots" method="post">
<dl>	
	<dt></dt>
	<dd><input type="hidden" name="pilotid" value="<?php 
    echo $pilotid;
    ?>
" />
		<input type="hidden" name="action" value="deletepilot" />