Ejemplo n.º 1
0
 /**
  * Verifies the site meets any requirements specified by the app or theme.
  */
 public static function verify_requires($requires)
 {
     if (isset($requires->php) && version_compare(PHP_VERSION, $requires->php) < 0) {
         self::$error = i18n_getf('Verification failed: This install requires PHP %s or newer.', $requires->php);
         return false;
     }
     if (isset($requires->elefant) && version_compare(ELEFANT_VERSION, $requires->elefant) < 0) {
         self::$error = i18n_getf('Verification failed: This install requires Elefant %s or newer.', $requires->elefant);
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 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 = DB::$error;
         return false;
     }
     // Add an initial airport/hub, because I love KJFK so much
     $data = array('icao' => 'KJFK', 'name' => 'Kennedy International', 'country' => 'USA', 'lat' => '40.6398', 'lng' => '-73.7787', 'hub' => false, 'fuelprice' => 0);
     $ret = OperationsData::AddAirport($data);
     // 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 = DB::$error;
         return false;
     }
     // Add a rank
     RanksData::updateRank(1, 'New Hire', 0, fileurl('/lib/images/ranks/newhire.jpg'), 18.0);
     # Add to admin group
     $pilotdata = PilotData::GetPilotByEmail($_POST['email']);
     if (!PilotGroups::AddUsertoGroup($pilotdata->pilotid, 'Administrators')) {
         self::$error = 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;
 }
Ejemplo n.º 4
0
 /**
  * check dependencies of given modules and plugins
  *
  * @param AbstractInstallLauncher[] $list
  * @param Installer $installer to report error
  * @return false|array  list of arrays: 0:ModuleInstallLauncher 1: true to install, false to update
  */
 public function getOrderedDependencies($list, $installer = null)
 {
     $this->_checkedComponents = array();
     $this->_componentsToInstall = array();
     $result = true;
     $epId = $this->getEpId();
     foreach ($list as $component) {
         $this->_checkedCircularDependency = array();
         if (!isset($this->_checkedComponents[$component->getName()])) {
             try {
                 $this->_checkDependencies($component);
                 if ($this->config->disableInstallers || !$component->isInstalled($epId)) {
                     $this->_componentsToInstall[] = array($component, true);
                 } else {
                     if (!$component->isUpgraded($epId)) {
                         $this->_componentsToInstall[] = array($component, false);
                     }
                 }
             } catch (\Jelix\Installer\Exception $e) {
                 $result = false;
                 if ($installer) {
                     $installer->error($e->getLocaleKey(), $e->getLocaleParameters());
                 } else {
                     throw $e;
                 }
             } catch (\Exception $e) {
                 $result = false;
                 if ($installer) {
                     $installer->error($e->getMessage() . " comp=" . $component->getName(), null, true);
                 } else {
                     throw $e;
                 }
             }
         }
     }
     if ($result) {
         return $this->_componentsToInstall;
     }
     return false;
 }