コード例 #1
0
 /**
  * Return the active lock system.
  *
  * @param boolean $canInit (optional) if false and lockSystem isn't yet initialized, return null
  * @return array GalleryStatus a status code
  *               GalleryLockSystem the lock implementation (reference)
  */
 function &getLockSystem($canInit = true)
 {
     if (!isset($this->_lockSystem)) {
         if ($canInit) {
             list($ret, $which) = MyOOS_CoreApi::getPluginParameter('module', 'core', 'lock.system');
             if ($ret) {
                 $ret = array($ret, null);
                 return $ret;
             }
         } else {
             $which = 'null';
         }
         switch ($which) {
             case 'flock':
                 MyOOS_CoreApi::requireOnce('modules/core/classes/FlockLockSystem.class');
                 $this->_lockSystem = new FlockLockSystem();
                 break;
             case 'database':
                 MyOOS_CoreApi::requireOnce('modules/core/classes/DatabaseLockSystem.class');
                 $this->_lockSystem = new DatabaseLockSystem();
                 break;
             case 'null':
                 $this->_lockSystem = null;
                 break;
             default:
                 $ret = array(MyOOS_CoreApi::error(ERROR_BAD_PARAMETER), null);
                 return $ret;
         }
     }
     $ret = array(null, &$this->_lockSystem);
     return $ret;
 }
コード例 #2
0
 /**
  * Get id of the guest user.
  *
  * @return array GalleryStatus a status code
  *               int user id
  */
 function getAnonymousUserId()
 {
     global $gallery;
     $id = $gallery->getConfig('anonymousUserId');
     if (empty($id)) {
         list($ret, $id) = MyOOS_CoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
         if ($ret) {
             return array($ret, null);
         }
     }
     return array(null, $id);
 }