Пример #1
0
 public function __get($field)
 {
     if ($this->erased) {
         throw new Exception("Cannot access field '{$field}' of deleted group {$this->id}");
     }
     if (($this->id || $this->libraryID) && !$this->loaded) {
         $this->load();
     }
     switch ($field) {
         case 'id':
         case 'libraryID':
         case 'name':
         case 'type':
         case 'ownerUserID':
         case 'libraryEnabled':
         case 'libraryEditing':
         case 'libraryReading':
         case 'fileEditing':
         case 'description':
         case 'url':
         case 'hasImage':
         case 'dateAdded':
         case 'dateModified':
         case 'erased':
             break;
         case 'slug':
             if ($this->isPublic()) {
                 return Zotero_Utilities::slugify($this->name);
             }
             return null;
         default:
             throw new Exception("Invalid group field '{$field}'");
     }
     return $this->{$field};
 }
Пример #2
0
 public static function getUserURI($userID, $skipNames = false)
 {
     if ($skipNames) {
         return self::getBaseURI() . "users/{$userID}";
     }
     $username = Zotero_Users::getUsername($userID);
     return self::getBaseURI() . Zotero_Utilities::slugify($username);
 }
Пример #3
0
 public static function getUserURI($userID, $www = false, $useSlug = false)
 {
     if ($www) {
         $username = Zotero_Users::getUsername($userID);
         return self::getBaseWWWURI() . Zotero_Utilities::slugify($username);
     }
     if ($useSlug) {
         $username = Zotero_Users::getUsername($userID);
         return self::getBaseURI() . Zotero_Utilities::slugify($username);
     }
     return self::getBaseURI() . "users/{$userID}";
 }
Пример #4
0
 public static function publicNameExists($name)
 {
     $slug = Zotero_Utilities::slugify($name);
     $sql = "SELECT groupID FROM groups WHERE (name=? OR slug=?) AND\n\t\t\t\t\ttype IN ('PublicOpen', 'PublicClosed')";
     $groupID = Zotero_DB::valueQuery($sql, array($name, $slug));
     return $groupID ? $groupID : false;
 }