예제 #1
0
파일: DB.php 프로젝트: shupp/Framework
 /**
  * createDB
  *
  * @access  private
  * @return  reference
  */
 private static function &createDB()
 {
     if (is_null(self::$dbDriver)) {
         $dsn = null;
         $class = 'Framework_DB';
         $file = null;
         if (isset(Framework::$site->config->dbClass)) {
             $class = 'Framework_DB_' . (string) Framework::$site->config->dbClass;
             $file = 'Framework/DB/' . Framework::$site->config->dbClass . '.php';
         }
         if (isset(Framework::$site->config->dsn)) {
             $dsn = (string) Framework::$site->config->dsn;
         } else {
             $class = 'Framework_DB_None';
         }
         if (!is_null($file)) {
             if (!(include_once $file)) {
                 return PEAR::raiseError('Could not load class file: ' . $file);
             }
         }
         self::$dbDriver = new $class();
     }
     if (is_null(Framework::$db)) {
         self::$dbDriver->start($dsn);
     }
     return Framework::$db;
 }
예제 #2
0
파일: Web.php 프로젝트: joestump/framework
 /**
  * __construct
  *
  * @access      public
  * @return      void
  */
 public function __construct()
 {
     parent::__construct();
     if (!is_null($this->db)) {
         $this->user = Framework_User::singleton();
     }
     $this->session = Framework_Session::singleton();
 }
예제 #3
0
파일: User.php 프로젝트: joestump/framework
 /**
  * __construct
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @return void
  */
 public function __construct($userID = null)
 {
     parent::__construct();
     if (is_null($userID)) {
         $session = Framework_Session::singleton();
         $userID = $session->{Framework::$site->config->user->userField};
         if (is_null($userID)) {
             $userID = (string) Framework::$site->config->user->defaultUser;
         } else {
             $userID = $session->{(string) Framework::$site->config->user->userField};
         }
     }
     $sql = "SELECT *\n                FROM " . Framework::$site->config->user->userTable . "\n                WHERE " . Framework::$site->config->user->userField . "='" . $userID . "'";
     $result = $this->db->getRow($sql);
     if (!PEAR::isError($result) && is_array($result)) {
         $this->data = $result;
     } else {
         throw new Framework_Exception('Could not look up userID');
     }
 }
예제 #4
0
파일: User.php 프로젝트: shupp/Framework
 /**
  * __construct
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @return void
  */
 public function __construct($userID = null)
 {
     parent::__construct();
     $this->getUserData($userID);
 }
예제 #5
0
파일: Web.php 프로젝트: shupp/Framework
 /**
  * __construct
  *
  * @access      public
  * @return      void
  */
 public function __construct()
 {
     parent::__construct();
     $this->user = Framework_User::singleton();
     $this->session = Framework_Session::singleton();
 }