示例#1
0
 /**
  * Get the current instance of the ConfigManager or a new one if there is no
  * instance alive.
  * @return ConfigManager
  */
 public static function &getInstance()
 {
     if (ConfigManager::$instance == null) {
         ConfigManager::$instance = new ConfigManager();
     }
     return ConfigManager::$instance;
 }
 public static function singleton($args = NULL)
 {
     $name = __CLASS__;
     if (!self::$instance) {
         if (!empty($args)) {
             self::$instance = new $name($args);
         } else {
             self::$instance = null;
         }
     }
     return self::$instance;
 }
	public function OsimoPaths(){
		parent::OsimoModule();
		$config = array(
			'site_folder' => ConfigManager::instance()->get('site_folder')
		);
		$this->set_options($config);
		
		$this->site_folder = $this->parseFolderPath($this->site_folder);

		$this->site_root = $_SERVER['DOCUMENT_ROOT'].$this->site_folder;
		
		$this->init();
	}
	function OsimoCache(){
		parent::OsimoModule();
		try{
			$config = ConfigManager::instance()->get('cache');
			$this->set_options($config);
		} catch (Exception $e) {
			$this->enabled = false;
		}			
		
		
		/* Register the cache debugging defaults */
		get('debug')->register('OsimoCache',array(
			'events'=>false
		));
		
		if(class_exists('Memcache')){
			$this->memcache = new Memcache;
		}
		else{
			$this->enabled = false;
		}
		
		$this->init();
	}
 private function loadConfig()
 {
     get('debug')->register('Osimo', array('events' => false, 'object_creation' => false));
     ConfigManager::instance()->load();
 }
 /**
  * OsimoDB Constructor.
  *
  * @param Array $options (optional)
  */
 private function OsimoDB()
 {
     parent::OsimoModule(ConfigManager::instance()->get('database'));
     $this->autoconnect = true;
 }
示例#7
0
function createAdminAccount() {
	ConfigManager::instance()->register_user_config($_SESSION['installConfig']);
	OsimoDB::instance()->init();
	
	try {
		$userID = UserManager::register_user($_POST['user']['username'], $_POST['user']['password'], $_POST['user']['email'], false);
		UserManager::update_user_info($userID, array('is_admin' => 1, 'is_confirmed' => 1));
		
		return true;
	} catch (OsimoException $e) {
		echo json_encode(array("error" => $e->getMessage())); exit;
	}
}