public function index() { if (!Auth::LoggedIn()) { echo 'You must be logged in to access this page!'; return; } $this->set('allcategories', DownloadData::GetAllCategories()); $this->render('downloads_list.tpl'); }
public function jumpseat() { if (!Auth::LoggedIn()) { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } else { $icao = DB::escape($this->post->depicao); $this->set('airport', OperationsData::getAirportInfo($icao)); $this->set('cost', DB::escape($this->post->cost)); $this->show('Fltbook/jumpseatticket'); } }
public function login($redir = '') { if (Auth::LoggedIn() == true) { $this->render('login_already.tpl'); return; } $this->set('redir', $redir); if (isset($this->post->action) && $this->post->action == 'login') { $this->ProcessLogin(); } else { $this->render('login_form.tpl'); } }
public function index() { require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php'; if (Auth::LoggedIn()) { $this->render('login_already.tpl'); return; } if (isset($_POST['submit'])) { $this->ProcessRegistration(); } else { $this->ShowForm(); } }
public function index() { require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php'; if ($this->post->submit) { if (Auth::LoggedIn() == false) { # Make sure they entered an email address if (trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } $resp = recaptcha_check_answer(Config::Get('RECAPTCHA_PRIVATE_KEY'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // Check the captcha thingy if (!$resp->is_valid) { $this->set('captcha_error', $resp->error); $this->set('message', 'You failed the captcha test!'); $this->render('contact_form.tpl'); return; } if ($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from ' . $this->post->name . ' - "' . $this->post->subject . '"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; unset($_POST['recaptcha_challenge_field']); unset($_POST['recaptcha_response_field']); foreach ($_POST as $field => $value) { $message .= "-{$field} = {$value}" . PHP_EOL; } $message = nl2br($message); $message = utf8_encode($message); Util::SendEmail(ADMIN_EMAIL, $subject, $message); $this->render('contact_sent.tpl'); return; } # Just a simple addition $rand1 = rand(1, 10); $rand2 = rand(1, 10); $this->set('rand1', $rand1); $this->set('rand2', $rand2); $tot = $rand1 + $rand2; //echo "total: $tot <br />"; SessionManager::Set('captcha_sum', $tot); //echo 'output of $_SESSION: <br />'; //print_r($_SESSION); $this->render('contact_form.tpl'); }
public function index() { //Google reCaptcha //updated to Google noCaptcha 1/15 require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php'; $this->set('sitekey', RECAPTCHA_PUBLIC_KEY); $this->set('lang', 'en'); if ($this->post->submit) { if (Auth::LoggedIn() == false) { # Make sure they entered an email address if (trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } //Google reCaptcha //updated to Google noCaptcha 1/15 $resp = null; $reCaptcha = new ReCaptcha(RECAPTCHA_PRIVATE_KEY); // Was there a reCAPTCHA response? if ($_POST["g-recaptcha-response"]) { $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]); } //check if reCaptcha response was valid if ($resp == null) { $this->set('captcha_error', 'reCaptcha Validation Error'); $this->render('contact_form.tpl'); return; } //end Google reCaptcha if ($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from ' . $this->post->name . ' - "' . $this->post->subject . '"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; foreach ($_POST as $field => $value) { $message .= "-{$field} = {$value}" . PHP_EOL; } $message = nl2br($message); $message = utf8_encode($message); Util::SendEmail(ADMIN_EMAIL, $subject, $message); $this->render('contact_sent.tpl'); return; } $this->render('contact_form.tpl'); }
public function index() { //updated to Google noCaptcha 1/15 require_once CORE_LIB_PATH . '/recaptcha/recaptchalib.php'; if (Auth::LoggedIn()) { // Make sure they don't over-ride it $this->render('login_already.tpl'); return; } if (isset($_POST['submit'])) { $this->ProcessRegistration(); } else { $this->ShowForm(); } }
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; }
public function index() { if (!Auth::LoggedIn()) { $this->set('message', '<div id="error"><b>You must be logged in to access this feature!</b></div><br />'); $this->show('frontpage_main'); return; } else { $open = ExamsData::get_setting_info('2'); if ($open->value == '0') { $message = ExamsData::get_setting_info('3'); echo '<div id="error">' . $message->value . '</div>'; } else { $pid = Auth::$userinfo->pilotid; $message = ExamsData::get_setting_info('4'); $this->set('message', '<h4>' . $message->value . '</h4>'); $this->set('exams', ExamsData::get_exams()); $this->set('pilotmoney', Auth::$userinfo->totalpay); $this->show('exams/exam_list'); } } }
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; }
public function __call($name, $args) { // $name here is the filename, but we don't call it in directly // for security reasons $page = DB::escape($name); $pageinfo = SiteData::GetPageDataByName($page); if ($pageinfo->public == 0 && Auth::LoggedIn() == false) { $this->render('pages_nopermission.tpl'); return; } $content = SiteData::GetPageContent($page); if (!$content) { $this->render('pages_notfound.tpl'); } else { // Do it this way, so then that this page/template // can be customized on a skin-by-skin basis $this->title = $content->pagename; $this->set('pagename', $content->pagename); # Do entity encoding, compensate for a html_entity_decode() in the templates $this->set('content', htmlentities($content->content)); $this->render('pages_content.tpl'); } }
<td> <?php if (isset($captcha_error)) { echo '<p class="error">' . $captcha_error . '</p>'; } ?> <div class="g-recaptcha" data-sitekey="<?php echo $sitekey; ?> "></div> <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?> "> </script> </td> </tr> <tr> <td> <input type="hidden" name="loggedin" value="<?php echo Auth::LoggedIn() ? 'true' : 'false'; ?> " /> </td> <td> <input type="submit" name="submit" value='Send Message'> </td> </tr> </table> </form>
protected function change_password_post() { if (!Auth::LoggedIn()) { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } // Verify if ($this->post->oldpassword == '') { $this->set('message', 'You must enter your current password'); $this->render('core_error.tpl'); return; } if ($this->post->password1 != $this->post->password2) { $this->set('message', 'Your passwords do not match'); $this->render('core_error.tpl'); return; } // Change $hash = md5($this->post->oldpassword . Auth::$userinfo->salt); if ($hash == Auth::$userinfo->password) { RegistrationData::ChangePassword(Auth::$pilotid, $_POST['password1']); $this->set('message', 'Your password has been reset'); } else { $this->set('message', 'You entered an invalid password'); } $this->render('core_success.tpl'); }
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 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 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)) {
public function removebid() { if (!Auth::LoggedIn()) { return; } SchedulesData::RemoveBid($this->post->id); }
* 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
public function showSchedules() { $depapts = OperationsData::GetAllAirports(); $equip = OperationsData::GetAllAircraftSearchList(true); $airlines = OperationsData::GetAllAirlines(); $this->set('airlines', $airlines); $this->set('depairports', $depapts); $this->set('equipment', $equip); $this->render('schedule_searchform.tpl'); # Show the routes. Remote this to not show them. $schedules = SchedulesData::GetSchedules(); # Do some filtering and whatnots, take it out of the template... $today = getdate(); $week_number = intval(($today['mday'] - 1) / 7) + 1; $current_day == date('w'); $var_name = 'week' . $week_number; # query once, save for later if (Config::get('SCHEDULES_ONLY_LAST_PIREP') === true && Auth::LoggedIn() == true) { $reports = PIREPData::findPIREPS(array('p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED), 1); // return only one } foreach ($schedules as $key => $s) { # should we skip schedules based on day of week? if (Config::get('CHECK_SCHEDULE_DAY_OF_WEEK') === true) { if (isset($s->{$var_name}) && !empty($s->{$var_name})) { # check if today is in the active list for this week if (@substr_count($s->{$var_name}, $current_day) == 0) { unset($schedules[$key]); continue; } } else { if (substr_count($s->daysofweek, date('w')) == 0) { unset($schedules[$key]); continue; } } } # remove this schedule from the list if there's a bid on it if (Config::get('DISABLE_SCHED_ON_BID') === true && $route->bidid != 0) { unset($schedules[$key]); continue; } /* This means the aircraft rank level is higher than what the pilot's ranklevel, so just do "continue" and move onto the next route in the list */ if (Config::get('RESTRICT_AIRCRAFT_RANKS') === true && Auth::LoggedIn()) { if ($route->aircraftlevel > Auth::$userinfo->ranklevel) { unset($schedules[$key]); continue; } } if (Config::get('SCHEDULES_ONLY_LAST_PIREP') === true && Auth::LoggedIn() == true) { if (count($reports) > 0) { # IF the arrival airport doesn't match the departure airport if ($reports[0]->arricao != $s->depicao) { unset($schedules[$key]); continue; } } } } // end foreach schedules $this->set('allroutes', $schedules); $this->render('schedule_list.tpl'); }
<?php # Don't allow overlapping bids and a bid exists if (Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0) { ?> <a id="<?php echo $schedule->id; ?> " class="addbid" href="<?php echo actionurl('/schedules/addbid/?id=' . $schedule->id); ?> ">Add to Bid</a> <?php } else { if (Auth::LoggedIn()) { ?> <a id="<?php echo $schedule->id; ?> " class="addbid" href="<?php echo url('/schedules/addbid'); ?> ">Add to Bid</a> <?php } } ?> </td> </tr>
protected function SubmitPIREP() { $pilotid = Auth::$userinfo->pilotid; if ($pilotid == '' || Auth::LoggedIn() == false) { $this->set('message', 'You must be logged in to access this feature!!'); //$this->render('core_error.tpl'); return false; } if ($this->post->code == '' || $this->post->flightnum == '' || $this->post->depicao == '' || $this->post->arricao == '' || $this->post->aircraft == '' || $this->post->flighttime == '') { $this->set('message', 'You must fill out all of the required fields!'); return false; } # Only allow for valid routes to be filed $sched_data = SchedulesData::GetScheduleByFlight($this->post->code, $this->post->flightnum); if (!$sched_data) { $this->set('message', 'The flight code and number you entered is not a valid route!'); return false; } # See if they entered more than 59 in the minutes part of the flight time $this->post->flighttime = str_replace(':', '.', $this->post->flighttime); $parts = explode('.', $this->post->flighttime); if ($parts[1] > 59) { $this->set('message', 'You entered more than 60 minutes in the minutes'); return false; } /* Check the schedule and see if it's been bidded on */ if (Config::Get('DISABLE_SCHED_ON_BID') == true) { $biddata = SchedulesData::GetBid($sched_data->bidid); if ($biddata) { if ($biddata->pilotid != $pilotid) { $this->set('message', 'You are not the bidding pilot'); //$this->render('core_error.tpl'); return false; } } } /* Removed this check since maybe it's a training flight or something, who knows if($this->post->depicao == $this->post->arricao) { $this->set('message', 'The departure airport is the same as the arrival airport!'); $this->render('core_error.tpl'); return false; }*/ $this->post->flighttime = str_replace(':', '.', $this->post->flighttime); if (!is_numeric($this->post->flighttime)) { $this->set('message', 'The flight time has to be a number!'); return false; } # form the fields to submit $this->pirepdata = array('pilotid' => $pilotid, 'code' => $this->post->code, 'flightnum' => $this->post->flightnum, 'depicao' => $this->post->depicao, 'arricao' => $this->post->arricao, 'aircraft' => $this->post->aircraft, 'flighttime' => $this->post->flighttime, 'route' => $this->post->route, 'submitdate' => 'NOW()', 'fuelused' => $this->post->fuelused, 'source' => 'manual', 'comment' => $this->post->comment); CodonEvent::Dispatch('pirep_prefile', 'PIREPS'); if (CodonEvent::hasStop('pirepfile')) { return false; } if (!PIREPData::FileReport($this->pirepdata)) { $this->set('message', 'There was an error adding your PIREP : ' . PIREPData::$lasterror); return false; } $pirepid = DB::$insert_id; PIREPData::SaveFields($pirepid, $_POST); # Remove the bid $bidid = SchedulesData::GetBidWithRoute($pilotid, $this->post->code, $this->post->flightnum); if ($bidid) { SchedulesData::RemoveBid($bidid->bidid); } # Call the event CodonEvent::Dispatch('pirep_filed', 'PIREPS'); # Set them as non-retired PilotData::setPilotRetired($pilotid, 0); # Delete the bid, if the value for it is set if ($this->post->bid != '') { SchedulesData::RemoveBid($this->post->bid); } return true; }
/** * Write out a config file to the user, give the template name and * the filename to save the template as to the user * * @param mixed $template_name Template to use for config (fspax_config.php) * @param mixed $save_as File to save as (xacars.ini) * @return mixed Nothing, sends the file to the user * */ public function write_config($template_name, $save_as) { if (!Auth::LoggedIn()) { echo 'You are not logged in!'; exit; } $this->set('pilotcode', PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid)); $this->set('userinfo', Auth::$pilot); $this->set('pilot', Auth::$pilot); $acars_config = Template::GetTemplate($template_name, true); $acars_config = str_replace("\n", "\r\n", $acars_config); Util::downloadFile($acars_config, $save_as); }
</head> <body> <?php /* This should be the first thing you place after a <body> tag This is also required by phpVMS */ echo $page_htmlreq; ?> <div id="body"> <div id="innerwrapper"> <div id="topBanner"> <div id="topLogin"> <?php /* Quick example of how to see if they're logged in or not Only show this login form if they're logged in */ if (Auth::LoggedIn() == false) { ?> <form name="loginform" action="<?php echo url('/login'); ?> " method="post"> Sign-in with your pilot id or email, or <a href="<?php echo url('/registration'); ?> ">register</a><br /> <input type="text" name="email" value="" onClick="this.value=''" /> <input type="password" name="password" value="" /> <input type="hidden" name="remember" value="on" /> <input type="hidden" name="redir" value="index.php/profile" /> <input type="hidden" name="action" value="login" /> <input type="submit" name="submit" value="Log In" />
<?php if ($pirep->accepted == PIREP_ACCEPTED) { echo '<div id="success">Accepted</div>'; } elseif ($pirep->accepted == PIREP_REJECTED) { echo '<div id="error">Rejected</div>'; } elseif ($pirep->accepted == PIREP_PENDING) { echo '<div id="error">Approval Pending</div>'; } elseif ($pirep->accepted == PIREP_INPROGRESS) { echo '<div id="error">Flight in Progress</div>'; } ?> </td> <?php // Only show this column if they're logged in, and the pilot viewing is the // owner/submitter of the PIREPs if (Auth::LoggedIn() && Auth::$pilot->pilotid == $pirep->pilotid) { ?> <td align="right"> <a href="<?php echo url('/pireps/addcomment?id=' . $pirep->pirepid); ?> ">Add Comment</a><br /> <a href="<?php echo url('/pireps/editpirep?id=' . $pirep->pirepid); ?> ">Edit PIREP</a> </td> <?php } ?> </tr>