Example #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;
    }
    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();
}
Example #2
0
 public static function init($action = "news")
 {
     self::$routerData = Router::getParams();
     if (!isset(self::$routerData['clanid'])) {
         self::$routerData['clanid'] = 1;
     }
     if (!isset(self::$routerData['site'])) {
         self::$routerData['site'] = "news";
     }
     SiteData::siteExists(self::$routerData['clanid']);
     self::$clanData = SiteData::getSiteData(self::$routerData['clanid']);
     self::testTemplateType();
 }
Example #3
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);
    }
}
Example #4
0
 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');
     }
 }
 protected function save_new_event()
 {
     $event = array();
     $event['title'] = DB::escape($this->post->title);
     $event['description'] = DB::escape($this->post->description);
     $event['image'] = DB::escape($this->post->image);
     $event['time'] = DB::escape($this->post->time);
     $event['dep'] = DB::escape($this->post->dep);
     $event['arr'] = DB::escape($this->post->arr);
     $event['schedule'] = DB::escape($this->post->schedule);
     $event['limit'] = DB::escape($this->post->limit);
     $event['interval'] = DB::escape($this->post->interval);
     $event['active'] = DB::escape($this->post->active);
     $event['postnews'] = DB::escape($this->post->postnews);
     $event['month'] = DB::escape($this->post->month);
     $event['day'] = DB::escape($this->post->day);
     $event['year'] = DB::escape($this->post->year);
     if (!$event['image']) {
         $event['image'] = 'none';
     }
     foreach ($event as $test) {
         if (empty($test)) {
             $this->set('event', $event);
             $this->show('events/events_new_form.tpl');
             return;
         }
     }
     $event['date'] = $event['year'] . '-' . $event['month'] . '-' . $event['day'];
     EventsData::save_new_event($event['date'], $event['time'], $event['title'], $event['description'], $event['image'], $event['dep'], $event['arr'], $event['schedule'], $event['limit'], $event['interval'], $event['active']);
     if ($event['postnews'] == '1') {
         SiteData::AddNewsItem($event['title'], $event['description']);
     }
     $this->set('events', EventsData::get_upcoming_events());
     $this->set('history', EventsData::get_past_events());
     $this->show('events/events_index.tpl');
 }
Example #6
0
    /**
     * SiteData::EditFile()
     * 
     * @param mixed $pageid
     * @param mixed $content
     * @param mixed $public
     * @param mixed $enabled
     * @return
     */
    public static function EditFile($pageid, $content, $public, $enabled)
    {
        $pagedata = SiteData::GetPageData($pageid);
        if ($public == true) {
            $public = 1;
        } else {
            $public = 0;
        }
        if ($enabled == true) {
            $enabled = 1;
        } else {
            $enabled = 0;
        }
        $sql = 'UPDATE ' . TABLE_PREFIX . 'pages
				  SET public=' . $public . ', enabled=' . $enabled . '
				  WHERE pageid=' . $pageid;
        DB::query($sql);
        if (self::EditPageFile($pagedata->filename, stripslashes($content))) {
            return true;
        } else {
            return false;
        }
    }
 /**
  * CentralData::send_news()
  * 
  * @return
  */
 public static function send_news()
 {
     if (!self::central_enabled()) {
         return false;
     }
     $all_news = SiteData::getAllNews();
     if (!is_array($all_news) && count($all_news) == 0) {
         return false;
     }
     self::startBody('vanews');
     self::addElement(null, 'total', count($all));
     $news_parent = self::addElement('newsitems');
     foreach ($all_news as $news) {
         $news_xml = self::addElement($news_parent, 'news', null, array('id' => $news->id, 'subject' => $news->subject, 'body' => '<![CDATA[' . $news->body . ']]>', 'postdate' => $news->postdate, 'postedby' => $news->postedby));
     }
     CronData::set_lastupdate('vanews');
     $res = self::sendToCentral();
     return $res;
 }
Example #8
0
 protected function DeleteNewsItem()
 {
     $this->checkPermission(EDIT_NEWS);
     if (!SiteData::DeleteItem($this->post->id)) {
         $this->set('message', Lang::gs('news.delete.error'));
         $this->render('core_error.php');
         return;
     }
     $this->set('message', Lang::gs('news.item.deleted'));
     $this->render('core_success.php');
     LogData::addLog(Auth::$userinfo->pilotid, 'Deleted news ' . $this->post->id);
 }
    echo '<p>No settings have been added</p>';
} else {
    foreach ($allsettings as $setting) {
        echo '<tr>
					<td width="15%" nowrap>
						<strong>' . $setting->friendlyname . '</strong></td>
						<td>';
        switch ($setting->name) {
            case 'PHPVMS_VERSION':
                echo PHPVMS_VERSION;
                break;
            case 'TOTAL_HOURS':
                echo $setting->value;
                break;
            case 'CURRENT_SKIN':
                $skins = SiteData::GetAvailableSkins();
                $skin = SettingsData::GetSetting('CURRENT_SKIN');
                echo '<SELECT name="CURRENT_SKIN">';
                $tot = count($skins);
                for ($i = 0; $i < $tot; $i++) {
                    $sel = $skin->value == $skins[$i] ? 'selected' : '';
                    echo '<option value="' . $skins[$i] . '" ' . $sel . '>' . $skins[$i] . '</option>';
                }
                echo '</SELECT>';
                break;
            case 'DEFAULT_GROUP':
                $allgroups = PilotGroups::getAllGroups();
                $current = SettingsData::getSetting('DEFAULT_GROUP');
                echo '<select name="DEFAULT_GROUP">';
                foreach ($allgroups as $group) {
                    $sel = $current->value == $group->groupid ? 'selected="selected"' : '';