Example #1
0
 public function __construct($application, $parameters = array())
 {
     $this->map = array_merge($this->map, array('identifier' => array('fieldName' => 'id', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'ipAddress' => array('fieldName' => 'ipAddress', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'userId' => array('fieldName' => 'userId', 'dataType' => BM_VT_INTEGER, 'defaultValue' => C_DEFAULT_USER_ID), 'userAgent' => array('fieldName' => 'userAgent', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'location' => array('fieldName' => 'location', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'createTime' => array('fieldName' => 'createTime', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'lastActivity' => array('fieldName' => 'lastActivity', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'lastVisit' => array('fieldName' => 'lastVisit', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0)));
     $load = array_key_exists('load', $parameters);
     $identifier = array_key_exists('identifier', $parameters) ? $parameters['identifier'] : '';
     if ($load && $identifier == '') {
         $parameters['load'] = false;
     }
     parent::__construct($application, $parameters);
     if ($load && $parameters['load']) {
         if ($this->application->errorHandler->getLast() != E_SUCCESS) {
             $sql = "SELECT \n                    `link_user_session`.`userId` AS `userId`,\n                    `link_user_session`.`sessionHash` AS `sessionId`\n                  FROM \n                    `link_user_session`\n                  JOIN \n                    `user` ON (`link_user_session`.`userId` = `user`.`id`)\n                  WHERE \n                    `link_user_session`.`sessionHash` = '" . $this->application->dataLink->formatInput($this->identifier) . "'";
             $oldSession = $this->application->dataLink->getObject($sql);
             if ($oldSession) {
                 $this->userId = intval($oldSession->userId);
                 $this->ipAddress = $this->application->cgi->getIPAddress();
                 $this->createTime = time();
             } else {
                 $this->identifier = md5(uniqid(microtime(true), true));
                 $this->userId = C_DEFAULT_USER_ID;
                 $this->createTime = time();
             }
         }
     } else {
         $this->identifier = md5(uniqid(microtime(true), true));
         $this->userId = C_DEFAULT_USER_ID;
         $this->createTime = time();
     }
     $this->ipAddress = $this->application->cgi->getIPAddress();
     $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
     $this->location = $_SERVER['REQUEST_URI'];
     $this->lastActivity = time();
     $this->application->user = new bmUser($this->application, array('identifier' => $this->properties['userId'], 'load' => true));
 }
Example #2
0
 public function __get($propertyName)
 {
     switch ($propertyName) {
         case 'dataObjectMapIds':
             if (!array_key_exists('dataObjectMapIds', $this->properties)) {
                 $this->properties['dataObjectMapIds'] = $this->getDataObjectMaps(false);
             }
             return $this->properties['dataObjectMapIds'];
             break;
         case 'dataObjectMaps':
             return $this->getDataObjectMaps();
             break;
         case 'referenceMapIds':
             if (!array_key_exists('referenceMapIds', $this->properties)) {
                 $this->properties['referenceMapIds'] = $this->getReferenceMaps(false);
             }
             return $this->properties['referenceMapIds'];
             break;
         case 'referenceMaps':
             return $this->getReferenceMaps();
             break;
         default:
             return parent::__get($propertyName);
             break;
     }
 }
Example #3
0
 public function __get($propertyName)
 {
     $this->checkDirty();
     switch ($propertyName) {
         /*FF::AC::TOP::GETTER::{*/
         /*FF::AC::TOP::GETTER::}*/
         default:
             return parent::__get($propertyName);
             break;
     }
 }
Example #4
0
 public function __get($propertyName)
 {
     $this->checkDirty();
     switch ($propertyName) {
         case 'fieldIds':
             if (!array_key_exists('fieldIds', $this->properties)) {
                 $this->properties['fieldIds'] = $this->application->dataObjectMapCache->getFields($this, false);
             }
             return $this->properties['fieldIds'];
             break;
         case 'fields':
             return $this->application->dataObjectMapCache->getFields($this);
             break;
         default:
             return parent::__get($propertyName);
             break;
     }
 }
Example #5
0
 public function __get($propertyName)
 {
     $this->checkDirty();
     switch ($propertyName) {
         /*FF::AC::TOP::GETTER::{*/
         /*FF::AC::GETTER_CASE::image::{*/
         case 'imageIds':
             if (!array_key_exists('imageIds', $this->properties)) {
                 $this->properties['imageIds'] = $this->getImages(false);
             }
             return $this->properties['imageIds'];
             break;
         case 'images':
             return $this->getImages();
             break;
             /*FF::AC::GETTER_CASE::image::}*/
             /*FF::AC::TOP::GETTER::}*/
         /*FF::AC::GETTER_CASE::image::}*/
         /*FF::AC::TOP::GETTER::}*/
         default:
             return parent::__get($propertyName);
             break;
     }
 }
 public function __get($propertyName)
 {
     $this->checkDirty();
     switch ($propertyName) {
         case 'dataObjectMapId':
             if (!array_key_exists('dataObjectMapId', $this->properties)) {
                 $this->properties['dataObjectMapId'] = $this->application->dataObjectFieldCache->getDataObjectMap($this, false);
             }
             return $this->properties['dataObjectMapId'];
             break;
         case 'dataObjectMap':
             $this->properties['dataObjectMap'] = $this->application->dataObjectFieldCache->getDataObjectMap($this);
             break;
         case 'localNames':
             if (!array_key_exists('localNames', $this->properties)) {
                 $this->properties['localNames'] = unserialize($this->properties['localName']);
             }
             return $this->properties['localNames'];
             break;
         default:
             return parent::__get($propertyName);
             break;
     }
 }
Example #7
0
 public function __construct($application, $parameters)
 {
     $this->map = array_merge($this->map, array('identifier' => array('fieldName' => 'id', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'passwordHash' => array('fieldName' => 'password', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'email' => array('fieldName' => 'email', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'homePage' => array('fieldName' => 'homePage', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'avatar' => array('fieldName' => 'avatar', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'name' => array('fieldName' => 'name', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'firstName' => array('fieldName' => 'firstname', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'lastName' => array('fieldName' => 'lastname', 'dataType' => BM_VT_STRING, 'defaultValue' => ''), 'birthday' => array('fieldName' => 'birthday', 'dataType' => BM_VT_DATETIME, 'defaultValue' => '0000-01-01 00:00:00'), 'sex' => array('fieldName' => 'sex', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'offset' => array('fieldName' => 'offset', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'type' => array('fieldName' => 'type', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'timeOnline' => array('fieldName' => 'timeOnline', 'dataType' => BM_VT_INTEGER, 'defaultValue' => 0), 'joinDate' => array('fieldName' => 'joinDate', 'dataType' => BM_VT_DATETIME, 'defaultValue' => '0000-00-00 00:00:00'), 'lastActivity' => array('fieldName' => 'lastActivity', 'dataType' => BM_VT_DATETIME, 'defaultValue' => '0000-00-00 00:00:00'), 'lastVisit' => array('fieldName' => 'lastVisit', 'dataType' => BM_VT_DATETIME, 'defaultValue' => '0000-00-00 00:00:00')));
     parent::__construct($application, $parameters);
 }