コード例 #1
0
ファイル: settings.php プロジェクト: pmeth/autoCMS
 function post()
 {
     $users = new UsersData();
     if ($users->checkPass() && !$users->authNeeded()) {
         $settings = new SettingsData();
         $settings->updateData($_POST);
         header('Location: /admin/settings/?updated=true');
     } else {
         include_once '401.html';
     }
 }
コード例 #2
0
ファイル: install_test.php プロジェクト: ryanunderwood/phpVMS
 public function testSettingsDoSave()
 {
     $val = SettingsData::GetSettingValue('PHPVMS_VERSION');
     $this->assertTrue($val);
     $save = SettingsData::SaveSetting('PHPVMS_VERSION', $val);
     $this->assertTrue($val, DB::$error);
     echo '<br />';
 }
コード例 #3
0
ファイル: rss.php プロジェクト: pmeth/autoCMS
 function buildDataFile($files)
 {
     foreach ($files as $file) {
         $fileData = file_get_contents('../' . $file, true);
         $html = str_get_html($fileData);
         foreach ($html->find('.auto-rss-link') as $rssFeed) {
             $settingsData = new SettingsData();
             $this->data['rss'] = array('rss' => $settingsData->getHost() . "feed/", 'type' => 'rss');
             $rssFeed->href = "<?=get('{$this->dataFile}', 'rss')?>";
         }
         $fp = fopen('../' . $file, 'w');
         fwrite($fp, $html);
         fclose($fp);
     }
     if ($this->hasFeed()) {
         $this->copyFeed();
     }
 }
コード例 #4
0
ファイル: SiteData.class.php プロジェクト: Galihom/phpVMS
 /**
  * SiteData::loadSiteSettings()
  * 
  * @return
  */
 public static function loadSiteSettings()
 {
     $all_settings = SettingsData::getAllSettings();
     if (!$all_settings) {
         return false;
     }
     foreach ($all_settings as $setting) {
         if ($setting->name == 'PHPVMS_VERSION') {
             continue;
         }
         //correct value for booleans
         if ($setting->value == 'true') {
             $setting->value = true;
         } elseif ($setting->value == 'false') {
             $setting->value = false;
         }
         define($setting->name, $setting->value);
     }
     /*define('PHPVMS_VERSION',file_get_contents(SITE_ROOT.'/core/version'));*/
 }
コード例 #5
0
ファイル: UserTest.php プロジェクト: Galihom/phpVMS
 /**
  * UserTest::testUserDataIntegrity()
  * 
  * @return void
  */
 public function testUserDataIntegrity()
 {
     # See if basic data matched
     $pilot = PilotData::getPilotByEmail('*****@*****.**');
     foreach ($this->registrationData as $key => $value) {
         if ($key == 'password') {
             continue;
         }
         $this->assertEquals($value, $pilot->{$key}, "Checking {$key}");
     }
     # Did they get added to the default group?
     $defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP');
     $pilotGroups = PilotGroups::getUserGroups($pilot->pilotid);
     $this->assertNotEmpty($pilotGroups, 'PilotGroups::getUserGroups()');
     $found = false;
     foreach ($pilotGroups as $group) {
         if (strtolower(trim($group->name)) == strtolower(trim($defaultGroup))) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'User found in default group');
 }
コード例 #6
0
ファイル: Settings.php プロジェクト: Galihom/phpVMS
 protected function ShowFields()
 {
     $this->set('allfields', SettingsData::GetAllFields());
     $this->render('settings_customfieldsform.tpl');
 }
コード例 #7
0
 /**
  * Get the total number of hours flown by pilots
  */
 public static function TotalHours()
 {
     return SettingsData::GetSettingValue('TOTAL_HOURS');
 }
コード例 #8
0
ファイル: install.php プロジェクト: rallin/phpVMS
        break;
    case 'installdb':
        if ($_POST['action'] == 'submitdb') {
            if ($_POST['DBASE_NAME'] == '' || $_POST['DBASE_USER'] == '' || $_POST['DBASE_TYPE'] == '' || $_POST['DBASE_SERVER'] == '' || $_POST['SITE_URL'] == '') {
                echo '<div id="error">You must fill out all the required fields</div>';
                break;
            }
            if (!Installer::AddTables()) {
                echo '<div id="error">' . Installer::$error . '</div>';
                break;
            }
            if (!Installer::WriteConfig()) {
                echo '<div id="error">' . Installer::$error . '</div>';
                break;
            }
            SettingsData::saveSetting('PHPVMS_VERSION', INSTALLER_VERSION);
            echo '<div align="center" style="font-size: 18px;"><br />
					<a href="install.php?page=sitesetup">Continue to the next step</a>
				  </div>';
        }
        break;
    case 'sitesetup':
        Template::Show('s2_site_setup.tpl');
        break;
    case 'complete':
        if ($_POST['action'] == 'submitsetup') {
            if ($_POST['firstname'] == '' || $_POST['lastname'] == '' || $_POST['email'] == '' || $_POST['password'] == '' || $_POST['vaname'] == '' || $_POST['vacode'] == '') {
                Template::Set('message', 'You must fill out all of the fields');
                Template::Show('s2_site_setup.tpl');
                break;
            }
コード例 #9
0
 /**
  * Add a  User
  * 
  * $data = array(
  * 'firstname' => '',
  * 'lastname' => '',
  * 'email' => '',
  * 'password' => '',
  * 'code' => '',
  * 'location' => '',
  * 'hub' => '',
  * 'confirm' => false);
  */
 public static function addUser($data)
 {
     /*$data = array(
       'firstname' => '',
       'lastname' => '',
       'email' => '',
       'password' => '',
       'code' => '',
       'location' => '',
       'hub' => '',
       'confirm' => false);*/
     $exists = self::CheckUserEmail($data['email']);
     if (is_object($exists)) {
         self::$error = 'Email already exists';
         return false;
     }
     //Set the password, add some salt
     $salt = md5(date('His'));
     $password = md5($data['password'] . $salt);
     //Stuff it into here, the confirmation email will use it.
     self::$salt = $salt;
     $code = DB::escape(strtoupper($data['code']));
     $firstname = DB::escape(ucwords($data['firstname']));
     $lastname = DB::escape(ucwords($data['lastname']));
     $location = DB::escape(strtoupper($data['location']));
     //Add this stuff in
     if ($data['confirm'] === true) {
         $confirm = 1;
     } else {
         $confirm = 0;
     }
     $sql = "INSERT INTO " . TABLE_PREFIX . "pilots (firstname, lastname, email,\n\t\t\t\t\tcode, location, hub, password, salt, confirmed, joindate, lastip)\n\t\t\t\t  VALUES ('{$firstname}', '{$lastname}', '{$data['email']}', '{$code}',\n\t\t\t\t\t\t\t'{$location}', '{$data['hub']}', '{$password}', '{$salt}', {$confirm}, NOW(), '{$_SERVER['REMOTE_ADDR']}')";
     $res = DB::query($sql);
     if (DB::errno() != 0) {
         if (DB::errno() == 1062) {
             self::$error = 'This email address is already registered';
             return false;
         }
         self::$error = DB::error();
         return false;
     }
     //Grab the new pilotid, we need it to insert those "custom fields"
     $pilotid = DB::$insert_id;
     RanksData::CalculateUpdatePilotRank($pilotid);
     PilotData::GenerateSignature($pilotid);
     /* Add them to the default group */
     $defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP');
     PilotGroups::addUsertoGroup($pilotid, $defaultGroup);
     // For later
     self::$pilotid = $pilotid;
     //Get customs fields
     $fields = self::GetCustomFields();
     if (!$fields) {
         return true;
     }
     foreach ($fields as $field) {
         $value = Vars::POST($field->fieldname);
         $value = DB::escape($value);
         if ($value != '') {
             $sql = "INSERT INTO " . TABLE_PREFIX . "fieldvalues (fieldid, pilotid, value)\n\t\t\t\t\t\t\tVALUES ({$field->fieldid}, {$pilotid}, '{$value}')";
             DB::query($sql);
         }
     }
     return true;
 }
コード例 #10
0
ファイル: settings.php プロジェクト: pmeth/autoCMS
<?php

include_once 'header.php';
$settingsData = new SettingsData();
$data = $settingsData->getData();
?>
<div class="container">
    <div class="row">
        <div class="col-lg-12">
            <h2 class="page-header">Settings</h2>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <form action="/admin/settings/update/" method="post" class="form-horizontal">
                <?php 
foreach ($data as $key => $datum) {
    ?>
                    <div class="form-group">
                        <?php 
    $desc = $datum['description'];
    ?>
                        <label for="<?php 
    echo $key;
    ?>
" class="col-lg-2 col-sm-2 control-label"><?php 
    echo $desc;
    ?>
</label>
                        <?php 
コード例 #11
0
 public static function RegisterInstall($version = '')
 {
     if ($version == '') {
         $version = PHPVMS_VERSION;
     }
     $ext = serialize(get_loaded_extensions());
     $params = new SimpleXMLElement('<registration/>');
     $params->addChild('name', SITE_NAME);
     $params->addChild('url', SITE_URL);
     $params->addChild('email', SettingsData::GetSettingValue('ADMIN_EMAIL'));
     $params->addChild('version', $version);
     $params->addChild('php', phpversion());
     $params->addChild('mysql', @mysql_get_server_info());
     $params->addChild('ext', $ext);
     $url = 'http://api.phpvms.net/register';
     # Do fopen(), if that fails then it'll default to
     #	curl
     error_reporting(0);
     $file = new CodonWebService();
     $response = $file->post($url, $params->asXML());
 }
コード例 #12
0
ファイル: update.php プロジェクト: phpmods/phpvms_5.5.x
    }
}
OperationsData::updateAircraftRankLevels();
/* Add them to the default group */
$status_type_list = Config::get('PILOT_STATUS_TYPES');
$pilot_list = PilotData::getAllPilots();
foreach ($pilot_list as $pilot) {
    echo "Fixing settings for " . $pilot->firstname . " " . $pilot->lastname . "<br>";
    PilotData::resetLedgerforPilot($pilot->pilotid);
    PilotGroups::addUsertoGroup($pilot->pilotid, DEFAULT_GROUP);
    # Reset the default groups
    $status = $status_type_list[$pilot->retired];
    foreach ($status['group_add'] as $group) {
        PilotGroups::addUsertoGroup($pilot->pilotid, $group);
    }
    foreach ($status['group_remove'] as $group) {
        PilotGroups::removeUserFromGroup($pilot->pilotid, $group);
    }
}
SettingsData::saveSetting('PHPVMS_VERSION', $FULL_VERSION_STRING);
# Don't count forced updates
if (!isset($_GET['force'])) {
    Installer::RegisterInstall($FULL_VERSION_STRING);
}
echo '<p><strong>Update completed!</strong></p>
		<hr>
	  <p >If there were any errors, you may have to manually run the SQL update, 
		or correct the errors, and click the following to re-run the update: <br />
		<a href="update.php?force">Click here to force the update to run again</a></p>
	  <p>Click here to <a href="' . SITE_URL . '">goto your site</a>, or <a href="' . SITE_URL . '/admin">your admin panel</a></p>  ';
Template::Show('footer');
コード例 #13
0
ファイル: pages.php プロジェクト: pmeth/autoCMS
 public function buildDataFile($files)
 {
     foreach ($files as $file) {
         $this->addPage(str_replace(array('.html', '.htm'), '', $file));
         // create datafile to store stuff
         $dataFile = 'page-' . str_replace(array('.html', '.htm'), '.json', $file);
         if (file_exists($this->dataLoc . $dataFile)) {
             $data = json_decode(file_get_contents($this->dataLoc . $dataFile), true);
         } else {
             $data = array();
         }
         // start collecting fields to add to data
         $fileData = file_get_contents('../' . $file, true);
         $html = str_get_html($fileData);
         foreach ($html->find('html') as $htmlTag) {
             if (isset($htmlTag->lang)) {
                 $settingsData = new SettingsData();
                 $settingsData->setLang($htmlTag->lang);
             }
             $htmlTag->lang = "<?=get('autocms-settings.json', 'site-lang')?>";
         }
         foreach ($html->find('head link') as $pageLinks) {
             $cssFile = strtolower($pageLinks->href);
             if (!DashboardUtils::startsWith($cssFile, '//') && !DashboardUtils::startsWith($cssFile, 'http://') && !DashboardUtils::startsWith($cssFile, 'https://')) {
                 if (!DashboardUtils::startsWith($cssFile, '/')) {
                     $cssFile = '/' . $cssFile;
                 }
                 if (file_exists($_SERVER['DOCUMENT_ROOT'] . $cssFile) && strpos($cssFile, 'min') === false && strpos($cssFile, 'css') !== false) {
                     if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/')) {
                         mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/');
                     }
                     if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-css/')) {
                         mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-css/');
                     }
                     $cssFileData = file_get_contents('../' . $cssFile, true);
                     $cssFileData = MinimizeTools::minimize_css($cssFileData);
                     $fileName = pathinfo($cssFile, PATHINFO_FILENAME);
                     $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-css/' . $fileName . '.min.css', 'w');
                     fwrite($fp, $cssFileData);
                     fclose($fp);
                     $pageLinks->href = '/assets/auto-css/' . $fileName . '.min.css';
                 }
             }
         }
         foreach ($html->find('.auto-head title') as $pageTitle) {
             $data['title'] = array('text' => $pageTitle->innertext, 'description' => 'title', 'type' => 'text');
             $pageTitle->innertext = "<?=get('{$dataFile}', 'title')?>";
         }
         foreach ($html->find('.auto-head meta') as $pageMeta) {
             if ($pageMeta->name == 'keywords' || $pageMeta->name == 'description' || $pageMeta->name == 'author') {
                 $data[$pageMeta->name] = array('text' => $pageMeta->content, 'description' => $pageMeta->name, 'type' => 'text');
                 $pageMeta->content = "<?=get('{$dataFile}', '{$pageMeta->name}')?>";
             }
             if (isset($pageMeta->property) && isset($pageMeta->content)) {
                 $property = preg_replace("/[^a-z^A-Z^0-9_-]/", "", $pageMeta->property);
                 if ($pageMeta->property == "og:image") {
                     //todo: fix this (copy og:image and put in library if exist)
                     /*$imgFileName = '';
                                             $source = $pageMeta->content;
                                             $source = parse_url($source, PHP_URL_PATH);
                                             $fileExt = pathinfo(parse_url($source, PHP_URL_PATH), PATHINFO_EXTENSION);
                                             $fileExt = MediaData::getImageType($fileExt, $source);
                     
                                             if ($fileExt != 'error') {
                                                 $media = new MediaData();
                                                 if (!$media->checkMediaLibrary('images', $source)) {
                                                     $imgFileName = $media->makeDateFolders() . uniqid() . '.' . $fileExt;
                     
                                                     copy($source, $_SERVER['DOCUMENT_ROOT'] . $imgFileName);
                                                     $media->addToMediaLibrary('images', $imgFileName, $source);
                                                 } else {
                                                     $imgFileName = $media->getFromMediaLibrary('images', $source);
                                                 }
                                             }
                                             */
                     $data[$property] = array('image' => $pageMeta->content, 'description' => $pageMeta->property, 'type' => 'image');
                     $pageMeta->content = "<?=get('{$dataFile}', '{$property}')?>";
                 } else {
                     if ($pageMeta->property == "og:url") {
                         $pageMeta->content = '<?="http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]?>';
                     } else {
                         if ($pageMeta->property == "og:title") {
                             $pageMeta->content = "<?=get('{$dataFile}', 'title')?>";
                         } else {
                             if ($pageMeta->property == "og:description") {
                                 $pageMeta->content = "<?=get('{$dataFile}', 'description')?>";
                             } else {
                                 if ($pageMeta->property == "og:site_name") {
                                     $pageMeta->content = "<?=get('autocms-settings.json', 'site-name')?>";
                                 } else {
                                     $data[$property] = array('text' => $pageMeta->content, 'description' => $pageMeta->property, 'type' => 'text');
                                     $pageMeta->content = "<?=get('{$dataFile}', '{$property}')?>";
                                 }
                             }
                         }
                     }
                 }
             }
         }
         foreach ($html->find('.auto-head') as $pageHead) {
             $rssData = new RSSData();
             $rssFeed = '';
             if ($rssData->hasFeed()) {
                 $rssFeed = '<link rel="alternate" type="application/rss+xml" href="' . $rssData->getFeedLocation() . '" title="RSS feed for My Page">';
             }
             $pageHead->innertext .= $rssFeed . "<?=get('autocms-analytics.json', 'analytics')?>";
             $pageHead->class = str_replace('auto-head', '', $pageHead->class);
             if (trim($pageHead->class) === '') {
                 $pageHead->class = null;
             }
         }
         foreach ($html->find('.auto-color, .auto-edit, .auto-edit-text, .auto-link, .auto-edit-img, .auto-edit-bg-img, .auto-repeat') as $edit) {
             $fieldID = uniqid();
             $desc = '';
             if (strpos($edit->class, 'auto-repeat') !== false) {
                 if (isset($edit->autocms)) {
                     $desc = $edit->autocms;
                 }
                 $data[$fieldID] = array('repeat' => array(), 'description' => $desc, 'type' => 'repeat');
                 $count = 0;
                 $data[$fieldID]['repeat'][$count] = array();
                 foreach ($html->find('.auto-repeat .auto-color, .auto-repeat .auto-edit, .auto-repeat .auto-edit-text, .auto-repeat .auto-link, .auto-repeat .auto-edit-img, .auto-repeat .auto-edit-bg-img') as $repeat) {
                     $desc = '';
                     $repeatFieldID = uniqid();
                     if (strpos($repeat->class, 'auto-edit-img') !== false) {
                         $this->makeImageBGImage($repeat, $data, $dataFile, $fieldID, $desc, false, $count, $repeatFieldID);
                     } else {
                         if (strpos($repeat->class, 'auto-edit-bg-img') !== false) {
                             $this->makeImageBGImage($repeat, $data, $dataFile, $fieldID, $desc, true, $count, $repeatFieldID);
                         } else {
                             if (strpos($repeat->class, 'auto-link') !== false) {
                                 $this->makeLink($repeat, $data, $dataFile, $fieldID, $desc, $count, $repeatFieldID);
                             } else {
                                 if (strpos($repeat->class, 'auto-edit-text') !== false) {
                                     $this->makeHTMLText($repeat, $data, $dataFile, $fieldID, $desc, 'text', $count, $repeatFieldID);
                                 } else {
                                     if (strpos($repeat->class, 'auto-edit') !== false) {
                                         $this->makeHTMLText($repeat, $data, $dataFile, $fieldID, $desc, 'html', $count, $repeatFieldID);
                                     } else {
                                         if (strpos($repeat->class, 'auto-color') !== false) {
                                             $this->makeColor($repeat, $data, $dataFile, $fieldID, $desc, $count, $repeatFieldID);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $edit->class = str_replace('auto-repeat', '', $edit->class);
                 if (trim($edit->class) === '') {
                     $edit->class = null;
                 }
                 $edit->autocms = null;
                 $edit->outertext = '<?php for ($x = 0; $x ' . "< repeatCount('{$dataFile}', '{$fieldID}');" . ' $x++) { ?>' . $edit->outertext . "<?php } ?>";
             } else {
                 if (strpos($edit->class, 'auto-edit-img') !== false) {
                     $this->makeImageBGImage($edit, $data, $dataFile, $fieldID, $desc);
                 } else {
                     if (strpos($edit->class, 'auto-edit-bg-img') !== false) {
                         $this->makeImageBGImage($edit, $data, $dataFile, $fieldID, $desc, true);
                     } else {
                         if (strpos($edit->class, 'auto-link') !== false) {
                             $this->makeLink($edit, $data, $dataFile, $fieldID, $desc);
                         } else {
                             if (strpos($edit->class, 'auto-edit-text') !== false) {
                                 $this->makeHTMLText($edit, $data, $dataFile, $fieldID, $desc, 'text');
                             } else {
                                 if (strpos($edit->class, 'auto-edit') !== false) {
                                     $this->makeHTMLText($edit, $data, $dataFile, $fieldID, $desc);
                                 } else {
                                     if (strpos($edit->class, 'auto-color') !== false) {
                                         $this->makeColor($edit, $data, $dataFile, $fieldID, $desc);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // write data file
         $fp = fopen($this->dataLoc . $dataFile, 'w');
         fwrite($fp, json_encode($data));
         fclose($fp);
         $fileTopper = '<?php require_once("admin/other/get.php") ?>';
         // write html file
         $fp = fopen('../' . $file, 'w');
         fwrite($fp, $fileTopper . $html);
         fclose($fp);
     }
 }
コード例 #14
0
ファイル: blog.php プロジェクト: pmeth/autoCMS
 public function updateBlogPost($post_id, $data, $publish = false)
 {
     $dataFile = $this->blogDataLocation . 'blog-' . $post_id . '.json';
     $changeLog = array();
     $isNew = false;
     $updateTime = time();
     $creationTime = time();
     if (file_exists($dataFile)) {
         $json = json_decode(file_get_contents($dataFile), true);
     } else {
         $isNew = true;
         $json = array('title' => null, 'keywords' => null, 'description' => null, 'author' => null, 'image' => null, 'image-alt-text' => null, 'short-blog' => null, 'full-blog' => null, 'link-text' => null, 'link-href' => null);
     }
     foreach ($data as $key => $datum) {
         if (DashboardUtils::endsWith($key, '-loaded') && trim($datum) != '') {
             $key = str_replace('-loaded', '', $key);
         }
         if ($key != 'save' && $key != 'publish') {
             $changeLog[] = array('key' => $key, 'change' => array('original' => $json[$key], 'new' => trim($datum)));
             $json[$key] = trim($datum);
         }
     }
     $json['published'] = $updateTime;
     $logsData = new LogsData();
     if (count($changeLog) > 0 && !$isNew) {
         $logsData->addToLog('has updated', $data['title'] . ' blog', $changeLog);
     } else {
         if (count($changeLog) > 0 && $isNew) {
             $logsData->addToLog('has created', $data['title'] . ' blog', $changeLog);
         }
     }
     $externalTitle = preg_replace('/[^a-z0-9-]/i', '', str_replace(' ', '-', strtolower(trim($json['title']))));
     if ($isNew || isset($this->data['posts'][$post_id]['external']) && $this->data['posts'][$post_id]['external'] != $externalTitle) {
         $externalTitleOriginal = $externalTitle;
         $count = 0;
         foreach ($this->data['posts'] as $key => $data) {
             while ($data['external'] == $externalTitle) {
                 $externalTitle = $externalTitleOriginal . '-' . $count++;
             }
         }
         if ($isNew) {
             $this->data['posts'][$post_id] = array('external' => $externalTitle, 'title' => $json['title'], 'creator' => $_SESSION["user"], 'created' => $creationTime);
         } else {
             $this->data['posts'][$post_id]['title'] = $json['title'];
             $this->data['posts'][$post_id]['external'] = $externalTitle;
             $this->data['posts'][$post_id]['last-updated'] = $updateTime;
         }
     } else {
         $this->data['posts'][$post_id]['last-updated'] = $updateTime;
     }
     if ($publish) {
         $this->data['posts'][$post_id]['published'] = $updateTime;
     }
     $settingsData = new SettingsData();
     $postPage = $this->data['post-page'];
     $json['link-href'] = $settingsData->getHost() . $postPage . '/' . $externalTitle . '/';
     $fp = fopen($dataFile, 'w');
     fwrite($fp, json_encode($json));
     fclose($fp);
     DashboardUtils::createXMLSitemap();
 }
コード例 #15
0
     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"' : '';
         echo '<option value="' . $group->groupid . '" ' . $sel . '>' . $group->name . '</option>';
     }
     echo '</select>';
     break;
     break;
 default:
     if ($setting->value == 'true' || $setting->value == 'false') {
         if ($setting->value == 'true') {
             $sel_true = 'selected';
             $sel_false = '';
         } else {
             $sel_true = '';
コード例 #16
0
ファイル: profile_edit.php プロジェクト: phpmods/phpvms_5.5.x
    } else {
        $sel = '';
    }
    echo '<option value="' . $image . '" ' . $sel . '>' . $image . '</option>';
}
?>
		</select>
	</dd>
	
	<?php 
if ($customfields) {
    foreach ($customfields as $field) {
        echo '<dt>' . $field->title . '</dt>
				  <dd>';
        if ($field->type == 'dropdown') {
            $field_values = SettingsData::GetField($field->fieldid);
            $values = explode(',', $field_values->value);
            echo "<select name=\"{$field->fieldname}\">";
            if (is_array($values)) {
                foreach ($values as $val) {
                    $val = trim($val);
                    if ($val == $field->value) {
                        $sel = " selected ";
                    } else {
                        $sel = '';
                    }
                    echo "<option value=\"{$val}\" {$sel}>{$val}</option>";
                }
            }
            echo '</select>';
        } elseif ($field->type == 'textarea') {
コード例 #17
0
ファイル: Installer.class.php プロジェクト: Galihom/phpVMS
 /**
  * Installer::SiteSetup()
  * 
  * @return
  */
 public static function SiteSetup()
 {
     /*$_POST['SITE_NAME'] == '' || $_POST['firstname'] == '' || $_POST['lastname'] == ''
     		|| $_POST['email'] == '' ||  $_POST['password'] == '' || $_POST['vaname'] == ''
     		|| $_POST['vacode'] == ''*/
     // first add the airline
     $_POST['vacode'] = strtoupper($_POST['vacode']);
     if (!OperationsData::addAirline($_POST['vacode'], $_POST['vaname'])) {
         self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error;
         return false;
     }
     // Add the user
     $data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], l, 'password' => $_POST['password'], 'code' => $_POST['vacode'], 'location' => 'US', 'hub' => 'KJFK', 'confirm' => true);
     if (!RegistrationData::addUser($data)) {
         self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error;
         return false;
     }
     RanksData::calculatePilotRanks();
     # Add to admin group
     $pilotdata = PilotData::getPilotByEmail($_POST['email']);
     if (!PilotGroups::addUsertoGroup($pilotdata->pilotid, 'Administrators')) {
         self::$error = __FILE__ . ' ' . __LINE__ . ' ' . DB::$error;
         return false;
     }
     # Add the final settings in
     SettingsData::SaveSetting('SITE_NAME', $_POST['SITE_NAME']);
     SettingsData::SaveSetting('ADMIN_EMAIL', $_POST['email']);
     SettingsData::SaveSetting('GOOGLE_KEY', $_POST['googlekey']);
     return true;
 }
コード例 #18
0
ファイル: update.php プロジェクト: rallin/phpVMS
    echo "<strong>Updating PIREPS  Hours</strong><br />";
    StatsData::UpdateTotalHours();
    echo 'Found ' . StatsData::TotalHours() . ' total hours, updated<br />';
}
if ($version < 20854) {
    Installer::add_to_config('USERS_ONLINE_TIME', 20, 'The StatsData::UserOnline() function - how many minutes to check');
    Installer::sql_file_update(SITE_ROOT . '/install/update_854.sql');
}
Installer::sql_file_update(SITE_ROOT . '/install/update.sql');
OperationsData::updateAircraftRankLevels();
/* Add them to the default group */
$allpilots = PilotData::GetAllPilots();
foreach ($allpilots as $pilot) {
    PilotGroups::AddUsertoGroup($pilot->pilotid, DEFAULT_GROUP);
}
SettingsData::saveSetting('PHPVMS_VERSION', UPDATE_VERSION);
/* Update expenses */
//FinanceData::updateAllExpenses();
/* Manually specify a revenue value for all PIREPs */
/*$allpireps = PIREPData::findPIREPS(array());
	if(is_array($allpireps))
	{
		foreach($allpireps as $pirep)
		{	
			$data = array(
				'price' => $pirep->price,
				'load' => $pirep->load,
				'fuelprice' => $pirep->fuelprice,
				'pilotpay' => $pirep->pilotpay,
				'flighttime' => $pirep->flighttime,
			);