Ejemplo n.º 1
0
 /**
  *	Instantiates a database connection. It requires PDO which is available in PHP 5.1
  *  It then passes this information to the ActiveRecord object.
  *
  *  A few defaults are allowed in case you are too lazy to specify.
  *  Dbtype defaults to mysql
  *  Host defaults to localhost
  *  Port defaults to 3306
  *  
  *
  *  @access private
  *  @return void
  */
 private function initialise_database()
 {
     if ($db = WXConfiguration::get('db')) {
         if ($db['dbtype'] == "none") {
             return false;
         }
         if (!$db['host']) {
             $db['host'] = "localhost";
         }
         if (!$db['port']) {
             $db['port'] = "3306";
         }
         /****** Deprecated support for WXActiveRecord only around for one more version *****/
         WXActiveRecord::$pdo_settings = $db;
         /**********************************************************/
         WaxModel::load_adapter($db);
     }
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $this->javascript_default_sources = array('prototype', 'builder', 'effects', 'dragdrop', 'controls', 'slider');
     self::$asset_server = WXConfiguration::get("assets");
 }
Ejemplo n.º 3
0
 public function remote($argv)
 {
     $deployment_settings = WXConfiguration::get('deploy');
     $remote = new WXRemote($deployment_settings['user'], $deployment_settings['server']);
     $remote->add_command($argv[1]);
     $remote->run_commands();
 }
Ejemplo n.º 4
0
 public static function detect_environments()
 {
     if (!is_array(WXConfiguration::get("environments"))) {
         return false;
     }
     if ($_SERVER['HOSTNAME']) {
         $addr = gethostbyname($_SERVER['HOSTNAME']);
     } elseif ($_SERVER['SERVER_ADDR']) {
         $addr = $_SERVER['SERVER_ADDR'];
     }
     if ($envs = WXConfiguration::get("environments")) {
         foreach ($envs as $env => $range) {
             $range = "/" . str_replace(".", "\\.", $range) . "/";
             if (preg_match($range, $addr) && !defined($env)) {
                 define('ENV', $env);
             }
         }
     }
 }