예제 #1
0
 public function testNumbers()
 {
     $this->assertTrue(Validator::number("0", null));
     $this->assertTrue(Validator::number("47", null));
     $this->assertFalse(Validator::number("abcd", null));
     $this->assertFalse(Validator::number("12abcd", null));
     $this->assertTrue(Validator::number("47.47", null));
 }
 function _buildQuery()
 {
     if (!DailyStatistics::validateDate($this->date)) {
         return $this->_error('date');
     }
     $query = DBModel::getInstance();
     $query->reset('DailyStatistics');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('datemark', 'equals', $this->date);
     if (isset($this->visits)) {
         if (!Validator::number($this->visits, 1)) {
             return $this->_error('visits');
         }
         $query->setAttribute('visits', $this->visits);
     }
     return $query;
 }
 static function getParent($id)
 {
     if (!Validator::number($id, 1)) {
         return null;
     }
     $context = Model_Context::getInstance();
     $pool = new DBModel();
     $pool->reset('Categories');
     $blogid = intval($context->getProperty('blog.id'));
     $pool->setQualifier('blogid', 'equals', $blogid);
     $pool->setQualifier('id', 'equals', $id);
     return $pool->getCell('parent');
 }
 function _buildQuery()
 {
     global $database;
     $this->host = trim($this->host);
     if (empty($this->host)) {
         return $this->_error('host');
     }
     $query = DBModel::getInstance();
     $query->reset('SubscriptionStatistics');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->host)) {
         $query->setAttribute('host', $this->host, true);
     }
     if (isset($this->useragent)) {
         $query->setAttribute('useragent', $this->useragent, true);
     }
     if (isset($this->subscribed)) {
         if (!Validator::number($this->subscribed, 1)) {
             return $this->_error('subscribed');
         }
         $query->setAttribute('subscribed', $this->subscribed);
     }
     if (isset($this->referred)) {
         if (!Validator::number($this->referred, 1)) {
             return $this->_error('referred');
         }
         $query->setAttribute('referred', $this->referred);
     }
     return $query;
 }
예제 #5
0
 function _buildQuery()
 {
     global $database;
     $this->init();
     $query = DBModel::getInstance();
     $query->reset('Entries');
     $query->setQualifier('blogid', 'equals', $this->blogid);
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->userid)) {
         if (!Validator::number($this->userid, 1)) {
             return $this->_error('userid');
         }
         $query->setQualifier('userid', 'equals', $this->userid);
     }
     if (isset($this->title)) {
         $query->setAttribute('title', Utils_Unicode::lessenAsEncoding($this->title, 255), true);
     }
     if (isset($this->content)) {
         $query->setAttribute('content', $this->content, true);
         $query->setAttribute('contentformatter', $this->contentformatter, true);
         $query->setAttribute('contenteditor', $this->contenteditor, true);
     }
     if (isset($this->visibility)) {
         switch ($this->visibility) {
             case 'appointed':
                 $query->setAttribute('visibility', -2);
                 break;
             case 'private':
                 $query->setAttribute('visibility', 0);
                 break;
             case 'protected':
                 $query->setAttribute('visibility', 1);
                 if (empty($this->password)) {
                     $this->password = $this->makePassword();
                 }
                 break;
             case 'public':
                 $query->setAttribute('visibility', 2);
                 break;
             case 'syndicated':
                 $query->setAttribute('visibility', 3);
                 break;
             default:
                 return $this->_error('visibility');
         }
     }
     if (isset($this->starred)) {
         $query->setAttribute('starred', $this->starred);
     } else {
         $query->setAttribute('starred', 0);
     }
     if (isset($this->category)) {
         if (!Category::doesExist($this->category)) {
             return $this->_error('category');
         }
         $query->setAttribute('category', $this->category);
     }
     if (isset($this->location)) {
         $query->setAttribute('location', Utils_Unicode::lessenAsEncoding($this->location, 255), true);
     }
     if (isset($this->password)) {
         $query->setAttribute('password', $this->password, true);
     }
     if (isset($this->acceptcomment)) {
         $query->setAttribute('acceptcomment', Validator::getBit($this->acceptcomment));
     }
     if (isset($this->accepttrackback)) {
         $query->setAttribute('accepttrackback', Validator::getBit($this->accepttrackback));
     }
     if (isset($this->published)) {
         if (!Validator::number($this->published, 0)) {
             return $this->_error('published');
         }
         $query->setAttribute('published', $this->published);
     }
     if (isset($this->longitude) && Validator::number($this->longitude)) {
         $query->setAttribute('longitude', $this->longitude);
     }
     if (isset($this->latitude) && Validator::number($this->latitude)) {
         $query->setAttribute('latitude', $this->latitude);
     }
     if (isset($this->created)) {
         if (!Validator::number($this->created, 0)) {
             return $this->_error('created');
         }
         $query->setAttribute('created', $this->created);
     }
     if (isset($this->modified)) {
         if (!Validator::number($this->modified, 0)) {
             return $this->_error('modified');
         }
         $query->setAttribute('modified', $this->modified);
     }
     return $query;
 }
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('Comments');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('entry', 'equals', 0);
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->parent)) {
         if (!Validator::number($this->parent, 1)) {
             return $this->_error('parent');
         }
     }
     $query->setAttribute('parent', $this->parent);
     if (isset($this->commenter)) {
         if (!Validator::number($this->commenter, 1)) {
             return $this->_error('commenter');
         }
         if (!($this->name = User::getName($this->commenter))) {
             return $this->_error('commenter');
         }
         $query->setAttribute('replier', $this->commenter);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->openid)) {
         $this->openid = Utils_Unicode::lessenAsEncoding(trim($this->openid), 128);
         if (empty($this->openid)) {
             return $this->_error('openid');
         }
         $query->setAttribute('openid', $this->openid, true);
     }
     if (isset($this->homepage)) {
         $this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
         if (empty($this->homepage)) {
             return $this->_error('homepage');
         }
         $query->setAttribute('homepage', $this->homepage, true);
     }
     if (isset($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->secret)) {
         $query->setAttribute('secret', Validator::getBit($this->secret));
     }
     if (isset($this->content)) {
         $this->content = trim($this->content);
         if (empty($this->content)) {
             return $this->_error('content');
         }
         $query->setAttribute('comment', $this->content, true);
     }
     if (isset($this->written)) {
         if (!Validator::timestamp($this->written)) {
             return $this->_error('written');
         }
         $query->setAttribute('written', $this->written);
     }
     if (isset($this->isfiltered)) {
         $query->setAttribute('isfiltered', Validator::getBit($this->isfiltered));
     }
     if (isset($this->password)) {
         $this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
         $query->setAttribute('password', $this->password, true);
         $this->password = null;
     }
     return $query;
 }
예제 #7
0
 function add()
 {
     global $database, $blogid;
     $this->id = null;
     $this->url = trim($this->url);
     if (empty($this->url)) {
         return $this->_error('url');
     }
     if (!isset($this->group) || !Validator::number($this->group, 0)) {
         return $this->_error('group');
     }
     $query = DBModel::getInstance();
     $query->reset('Feeds');
     $query->setQualifier('xmlurl', 'equals', Utils_Unicode::lessenAsEncoding($this->url, 255), true);
     $query->setAttribute('title', Utils_Unicode::lessenAsEncoding($this->url, 255), true);
     $query->setAttribute('id', $this->_getMaxId() + 1);
     if (!$query->doesExist()) {
         if (!$query->insert()) {
             return $this->_error('insert');
         }
     }
     $this->id = $query->getCell('id');
     $query->reset('FeedGroupRelations');
     $query->setQualifier('blogid', 'equals', $blogid);
     $query->setQualifier('feed', 'equals', $this->id);
     $query->setQualifier('groupid', 'equals', $this->group);
     if (!$query->doesExist()) {
         if (!$query->insert()) {
             return $this->_error('insert');
         }
     }
     return true;
 }
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('CommentsNotifiedSiteInfo');
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->title)) {
         $this->title = Utils_Unicode::lessenAsEncoding(trim($this->title), 255);
         $query->setAttribute('title', $this->title, true);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 255);
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->url)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
         if (empty($this->url)) {
             return $this->_error('url');
         }
         $query->setAttribute('url', $this->url, true);
     }
     if (isset($this->modified)) {
         if (!Validator::timestamp($this->modified)) {
             return $this->_error('modified');
         }
         $query->setAttribute('modified', $this->modified);
     }
     return $query;
 }
예제 #9
0
 static function validateArray(&$array, &$rules)
 {
     // Workaround for non Fancy-URL user.
     $cropArray = array();
     foreach ($array as $name => $value) {
         $doesHaveRequest = strpos($name, '?');
         if ($doesHaveRequest !== false) {
             $name = substr($name, $doesHaveRequest + 1);
         }
         $cropArray[$name] = $value;
     }
     $array = $cropArray;
     foreach ($rules as $key => $rule) {
         if (!isset($rule[0])) {
             trigger_error("Validator: The type of '{$key}' is not defined", E_USER_WARNING);
             continue;
         }
         if (isset($array[$key]) && ($rule[0] == 'file' || strlen($array[$key]) > 0)) {
             $value =& $array[$key];
             if (isset($rule['min'])) {
                 $rule[1] = $rule['min'];
             }
             if (isset($rule['max'])) {
                 $rule[2] = $rule['max'];
             }
             if (isset($rule['bypass'])) {
                 $rule[3] = $rule['bypass'];
             }
             switch ($rule[0]) {
                 case 'any':
                     if (isset($rule[1]) && strlen($value) < $rule[1]) {
                         return false;
                     }
                     if (isset($rule[2]) && strlen($value) > $rule[2]) {
                         return false;
                     }
                     break;
                 case 'bit':
                     $array[$key] = Validator::getBit($value);
                     break;
                 case 'bool':
                     $array[$key] = Validator::getBool($value);
                     break;
                 case 'number':
                     if (!Validator::number($value, isset($rule[1]) ? $rule[1] : null, isset($rule[2]) ? $rule[2] : null, isset($rule[3]) ? $rule[3] : false)) {
                         return false;
                     }
                     break;
                 case 'int':
                     if (!Validator::isInteger($value, isset($rule[1]) ? $rule[1] : -2147483648.0, isset($rule[2]) ? $rule[2] : 2147483647, isset($rule[3]) ? $rule[3] : false)) {
                         return false;
                     }
                     break;
                 case 'id':
                     if (!Validator::id($value, isset($rule[1]) ? $rule[1] : 1, isset($rule[2]) ? $rule[2] : 2147483647)) {
                         return false;
                     }
                     break;
                 case 'url':
                 case 'string':
                     if (!Utils_Unicode::validate($value)) {
                         $value = Utils_Unicode::bring($value);
                         if (!Utils_Unicode::validate($value)) {
                             return false;
                         }
                     }
                     $value = $array[$key] = Utils_Unicode::correct($value);
                     if (isset($rule[1]) && Utils_Unicode::length($value) < $rule[1]) {
                         return false;
                     }
                     if (isset($rule[2]) && Utils_Unicode::length($value) > $rule[2]) {
                         return false;
                     }
                     break;
                 case 'list':
                     if (!Validator::isList($value)) {
                         return false;
                     }
                     break;
                 case 'timestamp':
                     if (!Validator::timestamp($value)) {
                         return false;
                     }
                     break;
                 case 'period':
                     if (!Validator::period($value)) {
                         return false;
                     }
                     break;
                 case 'ip':
                     if (!Validator::ip($value)) {
                         return false;
                     }
                     break;
                 case 'domain':
                     if (!Validator::domain($value)) {
                         return false;
                     }
                     break;
                 case 'email':
                     if (!Validator::email($value)) {
                         return false;
                     }
                     break;
                 case 'language':
                     if (!Validator::language($value)) {
                         return false;
                     }
                     break;
                 case 'filename':
                     if (!Validator::filename($value)) {
                         return false;
                     }
                     break;
                 case 'directory':
                     if (!Validator::directory($value)) {
                         return false;
                     }
                     break;
                 case 'path':
                     if (!Validator::path($value)) {
                         return false;
                     }
                     break;
                 case 'file':
                     if (!isset($value['name']) || preg_match('@[/\\\\]@', $value['name'])) {
                         return false;
                     }
                     break;
                 default:
                     if (is_array($rule[0])) {
                         if (!in_array($value, $rule[0])) {
                             return false;
                         }
                     } else {
                         trigger_error("Validator: The type of '{$key}' is unknown", E_USER_WARNING);
                     }
                     break;
             }
             if (isset($rule['check'])) {
                 $rule[5] = $rule['check'];
             }
             if (isset($rule[5])) {
                 if (function_exists($rule[5])) {
                     if (!call_user_func($rule[5], $value)) {
                         return false;
                     }
                 } else {
                     trigger_error("Validator: The check function of '{$key}' is not defined", E_USER_WARNING);
                 }
             }
         } else {
             if (array_key_exists(3, $rule)) {
                 $array[$key] = $rule[3];
             } else {
                 if (array_key_exists('default', $rule)) {
                     $array[$key] = $rule['default'];
                 } else {
                     if ((!isset($rule[4]) || $rule[4]) && (!isset($rule['mandatory']) || $rule['mandatory'])) {
                         return false;
                     }
                 }
             }
         }
     }
     return true;
 }
예제 #10
0
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('Comments');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->entry)) {
         if (!Validator::number($this->entry, 1)) {
             return $this->_error('entry');
         }
         $query->setAttribute('entry', $this->entry);
     }
     if (isset($this->parent)) {
         if (!Validator::number($this->parent, 1)) {
             return $this->_error('parent');
         }
     }
     $query->setAttribute('parent', $this->parent);
     if (isset($this->commenter)) {
         if (!Validator::number($this->commenter, 1)) {
             return $this->_error('commenter');
         }
         if (!isset($this->name)) {
             if (!($this->name = User::getName($this->commenter))) {
                 return $this->_error('commenter');
             }
         } else {
             // name information exists. however, replier maybe different from services.
             // It is a limitation of spec.
             if ($this->name == User::getName($this->commenter)) {
                 // If name == commenter, it is same service (maybe).
                 $query->setAttribute('replier', $this->commenter);
             }
         }
         //			$query->setAttribute('replier', $this->commenter);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->openid)) {
         $this->openid = Utils_Unicode::lessenAsEncoding(trim($this->openid), 128);
         if (empty($this->openid)) {
             return $this->_error('openid');
         }
         $query->setAttribute('openid', $this->openid, true);
     }
     if (isset($this->homepage)) {
         $this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
         if (empty($this->homepage)) {
             return $this->_error('homepage');
         }
         $query->setAttribute('homepage', $this->homepage, true);
     }
     if (isset($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->secret)) {
         $query->setAttribute('secret', Validator::getBit($this->secret));
     }
     if (isset($this->content)) {
         $this->content = trim($this->content);
         if (empty($this->content)) {
             return $this->_error('content');
         }
         $query->setAttribute('comment', $this->content, true);
     }
     if (isset($this->longitude) && Validator::number($this->longitude)) {
         $query->setAttribute('longitude', $this->longitude, false);
     } else {
         $query->setAttribute('longitude', null);
     }
     if (isset($this->latitude) && Validator::number($this->latitude)) {
         $query->setAttribute('latitude', $this->latitude, false);
     } else {
         $query->setAttribute('latitude', null);
     }
     if (isset($this->written)) {
         if (!Validator::timestamp($this->written)) {
             return $this->_error('written');
         }
         $query->setAttribute('written', $this->written);
     }
     if (isset($this->isfiltered)) {
         $query->setAttribute('isfiltered', Validator::getBit($this->isfiltered));
     }
     if (isset($this->password)) {
         $this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
         $query->setAttribute('password', $this->password, true);
         $this->password = null;
     }
     return $query;
 }
예제 #11
0
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('Links');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->pid)) {
         if (!Validator::number($this->pid, 1)) {
             return $this->_error('pid');
         }
         $query->setQualifier('pid', 'equals', $this->pid);
     }
     if (isset($this->category)) {
         if (intval($this->category) < 0) {
             return $this->_error('category');
         }
         $query->setQualifier('category', 'equals', $this->category);
     }
     if (isset($this->url)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
         if (empty($this->url)) {
             return $this->_error('url');
         }
         $query->setQualifier('url', 'equals', $this->url, true);
     }
     if (isset($this->title)) {
         $this->title = Utils_Unicode::lessenAsEncoding(trim($this->title), 255);
         if (empty($this->title)) {
             return $this->_error('title');
         }
         $query->setAttribute('name', $this->title, true);
     }
     if (isset($this->feed)) {
         $this->feed = Utils_Unicode::lessenAsEncoding(trim($this->feed), 255);
         if (empty($this->feed)) {
             return $this->_error('feed');
         }
         $query->setAttribute('rss', $this->feed, true);
     }
     if (isset($this->registered)) {
         if (!Validator::number($this->registered, 1)) {
             return $this->_error('registered');
         }
         $query->setAttribute('written', $this->registered);
     }
     if (isset($this->xfn)) {
         $this->xfn = Utils_Unicode::lessenAsEncoding(trim($this->xfn), 255);
         if (empty($this->xfn)) {
             return $this->_error('xfn');
         }
         $query->setAttribute('xfn', $this->xfn, true);
     }
     $this->_count = 0;
     $this->reset();
     return $query;
 }
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('RemoteResponseLogs');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('responsetype', 'equals', 'trackback', true);
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->entry)) {
         if (!Validator::number($this->entry, 1)) {
             return $this->_error('entry');
         }
         $query->setAttribute('entry', $this->entry);
     }
     if (isset($this->url)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
         if (empty($this->url)) {
             return $this->_error('url');
         }
         $query->setAttribute('url', $this->url, true);
     }
     if (isset($this->sent)) {
         if (!Validator::timestamp($this->sent)) {
             return $this->_error('sent');
         }
         $query->setAttribute('written', $this->sent);
     }
     return $query;
 }
예제 #13
0
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('Filters');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->type)) {
         switch ($this->type) {
             case 'content':
             case 'ip':
             case 'name':
             case 'url':
             case 'whiteurl':
                 break;
             default:
                 return $this->_error('type');
         }
         if (isset($this->id)) {
             $query->setAttribute('filtertype', $this->type, false);
         } else {
             $query->setQualifier('filtertype', 'equals', $this->type, false);
         }
     }
     if (isset($this->pattern)) {
         $this->pattern = Utils_Unicode::lessenAsEncoding(trim($this->pattern), 255);
         if (empty($this->pattern)) {
             return $this->_error('pattern');
         }
         if (isset($this->id)) {
             $query->setAttribute('pattern', $this->pattern, true);
         } else {
             $query->setQualifier('pattern', 'equals', $this->pattern, true);
         }
     }
     return $query;
 }
예제 #14
0
 function _buildQuery()
 {
     if (!Validator::filename($this->name)) {
         return $this->_error('name');
     }
     $query = DBModel::getInstance();
     $query->reset('Attachments');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('name', 'equals', $this->name, true);
     if (isset($this->parent)) {
         if (!Validator::number($this->parent, -1)) {
             return $this->_error('parent');
         }
         $query->setAttribute('parent', $this->parent);
     }
     if (isset($this->label)) {
         $this->label = Utils_Unicode::lessenAsEncoding(trim($this->label), 64);
         if (empty($this->label)) {
             return $this->_error('label');
         }
         $query->setAttribute('label', $this->label, true);
     }
     if (isset($this->mime)) {
         $this->mime = Utils_Unicode::lessenAsEncoding(trim($this->mime), 32);
         $query->setAttribute('mime', $this->mime, true);
     }
     if (isset($this->size)) {
         if (!Validator::number($this->size, 0)) {
             return $this->_error('size');
         }
         $query->setAttribute('size', $this->size);
     }
     if (isset($this->width)) {
         if (!Validator::number($this->width, 0)) {
             return $this->_error('width');
         }
         $query->setAttribute('width', $this->width);
     }
     if (isset($this->height)) {
         if (!Validator::number($this->height, 0)) {
             return $this->_error('height');
         }
         $query->setAttribute('height', $this->height);
     }
     if (isset($this->downloads)) {
         if (!Validator::number($this->downloads, 0)) {
             return $this->_error('downloads');
         }
         $query->setAttribute('downloads', $this->downloads);
     }
     if (isset($this->enclosure)) {
         $query->setAttribute('enclosure', Validator::getBit($this->enclosure));
     }
     if (isset($this->attached)) {
         if (!Validator::number($this->attached, 1)) {
             return $this->_error('attached');
         }
         $query->setAttribute('attached', $this->attached);
     }
     return $query;
 }
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('LinkCategories');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->pid)) {
         if (!Validator::number($this->pid, 1)) {
             return $this->_error('pid');
         }
         $query->setQualifier('pid', 'equals', $this->pid);
     }
     if (isset($this->priority)) {
         if (intval($this->priority) < 0) {
             return $this->_error('category');
         }
         $query->setQualifier('priority', 'equals', $this->priority);
     }
     if (isset($this->name)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->name), 255);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setQualifier('name', 'equals', $this->name, true);
     }
     if (isset($this->visibility)) {
         if (intval($this->visibility) < 0) {
             return $this->_error('visibility');
         }
         $query->setQualifier('visibility', 'equals', $this->visibility);
     }
     return $query;
 }
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('RefererLogs');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->host)) {
         $this->host = Utils_Unicode::lessenAsEncoding(trim($url['host']), 64);
         if (empty($this->host)) {
             return $this->_error('host');
         }
         $query->setAttribute('host', $this->host, true);
     }
     if (isset($this->url)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
         if (empty($this->url)) {
             return $this->_error('url');
         }
         $url = parse_url($this->url);
         if (empty($url['host'])) {
             return $this->_error('url');
         }
         $this->host = Utils_Unicode::lessenAsEncoding(trim($url['host']), 64);
         $query->setAttribute('host', $this->host, true);
         if (empty($url['scheme'])) {
             $this->url = 'http://' . $this->url;
         }
         $query->setAttribute('url', $this->url, true);
     }
     if (isset($this->referred)) {
         if (!Validator::number($this->referred, 1)) {
             return $this->_error('referred');
         }
         $query->setAttribute('referred', $this->referred);
     }
     return $query;
 }
예제 #17
0
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('Users');
     $query->setQualifier('userid', getUserId());
     if (isset($this->userid)) {
         if (!Validator::number($this->userid, 1)) {
             return $this->_error('userid');
         }
         $query->setQualifier('userid', $this->userid);
     }
     if (isset($this->loginid)) {
         $this->loginid = Utils_Unicode::lessenAsEncoding(trim($this->loginid), 64);
         if (empty($this->loginid)) {
             return $this->_error('loginid');
         }
         $query->setAttribute('loginid', $this->loginid, true);
     }
     if (isset($this->password)) {
         $this->password = trim($this->password);
         if (empty($this->password)) {
             return $this->_error('password');
         }
         $query->setAttribute('password', $this->password, true);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 32);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->created)) {
         if (!Validator::number($this->created, 0)) {
             return $this->_error('created');
         }
         $query->setAttribute('created', $this->created);
     }
     if (isset($this->lastLogin)) {
         if (!Validator::number($this->lastLogin, 1)) {
             return $this->_error('lastLogin');
         }
         $query->setAttribute('lastLogin', $this->lastLogin);
     }
     if (isset($this->host)) {
         if (!Validator::number($this->host, 0)) {
             return $this->_error('host');
         }
         $query->setAttribute('host', $this->host);
     }
     return $query;
 }
예제 #18
0
 public function save()
 {
     if (isset($this->skin)) {
         if (strncmp($this->skin, 'customize/', 10) == 0) {
             if (strcmp($this->skin, "customize/" . getBlogId()) != 0) {
                 return $this->_error('skin');
             }
         } else {
             if (!Validator::filename($this->skin)) {
                 return $this->_error('skin');
             }
         }
         if (!Validator::path($this->skin) || !file_exists(ROOT . '/skin/' . $this->skin)) {
             return $this->_error('skin');
         }
         Setting::setSkinSetting('skin', $this->skin);
     }
     if (isset($this->entriesOnRecent)) {
         if (!Validator::number($this->entriesOnRecent, 1)) {
             return $this->_error('entriesOnRecent');
         }
         Setting::setSkinSetting('entriesOnRecent', $this->entriesOnRecent);
     }
     if (isset($this->commentsOnRecent)) {
         if (!Validator::number($this->commentsOnRecent, 1)) {
             return $this->_error('commentsOnRecent');
         }
         Setting::setSkinSetting('commentsOnRecent', $this->commentsOnRecent);
     }
     if (isset($this->trackbacksOnRecent)) {
         if (!Validator::number($this->trackbacksOnRecent, 1)) {
             return $this->_error('trackbacksOnRecent');
         }
         Setting::setSkinSetting('trackbacksOnRecent', $this->trackbacksOnRecent);
     }
     if (isset($this->commentsOnGuestbook)) {
         if (!Validator::number($this->commentsOnGuestbook, 1)) {
             return $this->_error('commentsOnGuestbook');
         }
         Setting::setSkinSetting('commentsOnGuestbook', $this->commentsOnGuestbook);
     }
     if (isset($this->tagsOnTagbox)) {
         if (!Validator::number($this->tagsOnTagbox, 1)) {
             return $this->_error('tagsOnTagbox');
         }
         Setting::setSkinSetting('tagsOnTagbox', $this->tagsOnTagbox);
     }
     if (isset($this->alignOnTagbox)) {
         if (!Validator::number($this->alignOnTagbox, 1, 3)) {
             return $this->_error('alignOnTagbox');
         }
         Setting::setSkinSetting('tagboxAlign', $this->alignOnTagbox);
     }
     if (isset($this->expandComment)) {
         Setting::setSkinSetting('expandComment', Validator::getBit($this->expandComment));
     }
     if (isset($this->expandTrackback)) {
         Setting::setSkinSetting('expandTrackback', Validator::getBit($this->expandTrackback));
     }
     if (isset($this->recentNoticeLength)) {
         if (!Validator::number($this->recentNoticeLength, 0)) {
             return $this->_error('recentNoticeLength');
         }
         Setting::setSkinSetting('recentNoticeLength', $this->recentNoticeLength);
     }
     if (isset($this->recentPageLength)) {
         if (!Validator::number($this->recentPageLength, 0)) {
             return $this->_error('recentPageLength');
         }
         Setting::setSkinSetting('recentPageLength', $this->recentPageLength);
     }
     if (isset($this->recentTrackbackLength)) {
         if (!Validator::number($this->recentTrackbackLength, 0)) {
             return $this->_error('recentTrackbackLength');
         }
         Setting::setSkinSetting('recentTrackbackLength', $this->recentTrackbackLength);
     }
     if (isset($this->linkLength)) {
         if (!Validator::number($this->linkLength, 0)) {
             return $this->_error('linkLength');
         }
         Setting::setSkinSetting('linkLength', $this->linkLength);
     }
     if (isset($this->showListOnCategory)) {
         Setting::setSkinSetting('showListOnCategory', Validator::getBit($this->showListOnCategory));
     }
     if (isset($this->showListOnArchive)) {
         Setting::setSkinSetting('showListOnArchive', Validator::getBit($this->showListOnArchive));
     }
     if (isset($this->tree)) {
         if (!Validator::directory($this->tree) || !file_exists(ROOT . '/skin/tree/' . $this->tree)) {
             return $this->_error('tree');
         }
         Setting::setSkinSetting('tree', $this->tree);
     }
     if (isset($this->colorOnTree)) {
         Setting::setSkinSetting('colorOnTree', $this->colorOnTree);
     }
     if (isset($this->bgcolorOnTree)) {
         Setting::setSkinSetting('bgcolorOnTree', $this->bgcolorOnTree);
     }
     if (isset($this->activecolorOnTree)) {
         Setting::setSkinSetting('activecolorOnTree', $this->activecolorOnTree);
     }
     if (isset($this->activebgcolorOnTree)) {
         Setting::setSkinSetting('activebgcolorOnTree', $this->activebgcolorOnTree);
     }
     if (isset($this->labelLengthOnTree)) {
         if (!Validator::number($this->labelLengthOnTree, 0)) {
             return $this->_error('labelLengthOnTree');
         }
         Setting::setSkinSetting('labelLengthOnTree', $this->labelLengthOnTree);
     }
     if (isset($this->showValueOnTree)) {
         Setting::setSkinSetting('showValueOnTree', Validator::getBit($this->showValueOnTree));
     }
     return true;
 }
 function _buildQuery()
 {
     global $database;
     $this->host = Utils_Unicode::lessenAsEncoding(trim($this->host), 64);
     if (empty($this->host)) {
         return $this->_error('host');
     }
     $query = DBModel::getInstance();
     $query->reset('RefererStatistics');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('host', 'equals', $this->host, true);
     if (isset($this->count)) {
         if (!Validator::number($this->count, 1)) {
             return $this->_error('count');
         }
         $query->setAttribute('count', $this->count);
     }
     return $query;
 }
 function save()
 {
     global $database;
     importlib('model.common.setting');
     if (isset($this->name)) {
         $this->name = trim($this->name);
         if (!BlogSetting::validateName($this->name)) {
             return $this->_error('name');
         }
         Setting::setBlogSettingGlobal('name', $this->name);
     }
     if (isset($this->secondaryDomain)) {
         $this->secondaryDomain = trim($this->secondaryDomain);
         if (!Validator::domain($this->secondaryDomain)) {
             return $this->_error('secondaryDomain');
         }
         Setting::setBlogSettingGlobal('secondaryDomain', $this->secondaryDomain);
     }
     if (isset($this->defaultDomain)) {
         Setting::setBlogSettingGlobal('defaultDomain', Validator::getBit($this->defaultDomain));
     }
     if (isset($this->title)) {
         $this->title = trim($this->title);
         Setting::setBlogSettingGlobal('title', $this->title);
     }
     if (isset($this->description)) {
         $this->description = trim($this->description);
         Setting::setBlogSettingGlobal('description', $this->description);
     }
     if (isset($this->banner)) {
         if (strlen($this->banner) != 0 && !Validator::filename($this->banner)) {
             return $this->_error('banner');
         }
         Setting::setBlogSettingGlobal('logo', $this->banner);
     }
     if (isset($this->useSloganOnPost)) {
         Setting::setBlogSettingGlobal('useSloganOnPost', Validator::getBit($this->useSloganOnPost));
     }
     if (isset($this->useSloganOnCategory)) {
         Setting::setBlogSettingGlobal('useSloganOnCategory', Validator::getBit($this->useSloganOnCategory));
     }
     if (isset($this->useSloganOnTag)) {
         Setting::setBlogSettingGlobal('useSloganOnTag', Validator::getBit($this->useSloganOnTag));
     }
     if (isset($this->postsOnPage)) {
         if (!Validator::number($this->postsOnPage, 1)) {
             return $this->_error('postsOnPage');
         }
         Setting::setBlogSettingGlobal('entriesOnPage', $this->postsOnPage);
     }
     if (isset($this->postsOnList)) {
         if (!Validator::number($this->postsOnList, 1)) {
             return $this->_error('postsOnList');
         }
         Setting::setBlogSettingGlobal('entriesOnList', $this->postsOnList);
     }
     if (isset($this->postsOnFeed)) {
         if (!Validator::number($this->postsOnFeed, 1)) {
             return $this->_error('postsOnFeed');
         }
         Setting::setBlogSettingGlobal('entriesOnRSS', $this->postsOnFeed);
     }
     if (isset($this->publishWholeOnFeed)) {
         Setting::setBlogSettingGlobal('publishWholeOnRSS', Validator::getBit($this->publishWholeOnFeed));
     }
     if (isset($this->acceptGuestComment)) {
         Setting::setBlogSettingGlobal('allowWriteOnGuestbook', Validator::getBit($this->acceptGuestComment));
     }
     if (isset($this->acceptcommentOnGuestComment)) {
         Setting::setBlogSettingGlobal('allowWriteDblCommentOnGuestbook', Validator::getBit($this->acceptcommentOnGuestComment));
     }
     if (isset($this->language)) {
         if (!Validator::language($this->language)) {
             return $this->_error('language');
         }
         Setting::setBlogSettingGlobal('language', $this->language);
     }
     if (isset($this->timezone)) {
         if (empty($this->timezone)) {
             return $this->_error('timezone');
         }
         Setting::setBlogSettingGlobal('timezone', $this->timezone);
     }
     return true;
 }
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('RemoteResponses');
     $query->setQualifier('blogid', getBlogId());
     $query->setQualifier('responsetype', 'pingback');
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', $this->id);
     }
     if (isset($this->entry)) {
         if (!Validator::number($this->entry, 1)) {
             return $this->_error('entry');
         }
         $query->setQualifier('entry', $this->entry);
     }
     if (isset($this->url)) {
         $this->url = Utils_Unicode::lessenAsEncoding(trim($this->url), 255);
         if (empty($this->url)) {
             return $this->_error('url');
         }
         $query->setQualifier('url', $this->url, true);
     }
     if (isset($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->received)) {
         if (!Validator::timestamp($this->received)) {
             return $this->_error('received');
         }
         $query->setAttribute('written', $this->received);
     }
     if (isset($this->isFiltered)) {
         if ($this->isFiltered) {
             $query->setAttribute('isFiltered', 'UNIX_TIMESTAMP()');
         } else {
             $query->setAttribute('isFiltered', Validator::getBit($this->isFiltered));
         }
     }
     return $query;
 }
예제 #22
0
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('Entries');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('category', 'equals', -2);
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->title)) {
         $query->setAttribute('title', $this->title, true);
     }
     if (isset($this->content)) {
         $query->setAttribute('content', $this->content, true);
         $query->setAttribute('contentformatter', $this->contentformatter, true);
         $query->setAttribute('contenteditor', $this->contenteditor, true);
     }
     if (isset($this->visibility)) {
         switch ($this->visibility) {
             case 'private':
                 $query->setAttribute('visibility', 0);
                 break;
             case 'public':
                 $query->setAttribute('visibility', 2);
                 break;
             default:
                 $query->setAttribute('visibility', 0);
                 break;
         }
     }
     if (isset($this->starred)) {
         $query->setAttribute('starred', $this->starred);
     } else {
         $query->setAttribute('starred', 0);
     }
     if (isset($this->published)) {
         if (!Validator::number($this->published, 1)) {
             return $this->_error('published');
         }
         $query->setAttribute('published', $this->published);
     }
     if (isset($this->created)) {
         if (!Validator::number($this->created, 1)) {
             return $this->_error('created');
         }
         $query->setAttribute('created', $this->created);
     }
     if (isset($this->modified)) {
         if (!Validator::number($this->modified, 1)) {
             return $this->_error('modified');
         }
         $query->setAttribute('modified', $this->modified);
     }
     return $query;
 }
 /**
  * Tests the various forms of numeric filtering and validation.
  */
 public function testNumericValidation()
 {
     $validator = new Validator();
     /* By default, anything that PHP considers a number is allowed, and
        typecast as appropriate. */
     $this->assertSame(5, $validator->number(5));
     $this->assertSame(5, $validator->number('5'));
     $this->assertSame(-5 / 3, $validator->number(-5 / 3));
     $this->assertSame(-1.667, $validator->number(round(-5 / 3, 3)));
     $this->assertSame((double) 123450000, $validator->number('+0123.45e6'));
     $this->assertSame(16103058, $validator->number(0xf5b692));
     // We can assert that something looks like an integer
     $this->assertSame(5, $validator->number('5', null, Validator::ASSERT_INT));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(5.3, null, Validator::ASSERT_INT));
     // Or actually is an integer
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array('5', null, Validator::ASSERT_TYPE_MATCH | Validator::ASSERT_INT));
     $this->assertSame(5, $validator->number(5, null, Validator::ASSERT_TYPE_MATCH | Validator::ASSERT_INT));
     // Or maybe we just want to assert it's any numeric type
     $this->assertSame(5.2, $validator->number(5.2, null, Validator::ASSERT_TYPE_MATCH));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array('5.3', null, Validator::ASSERT_TYPE_MATCH));
     // Nulls are not permitted by default
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(null));
     // But we can override that
     $this->assertNull($validator->number(null, null, Validator::ASSERT_ALLOW_NULL));
     // This takes precedence over assertions about the type
     $this->assertNull($validator->number(null, null, Validator::ASSERT_ALLOW_NULL | Validator::ASSERT_INT | Validator::ASSERT_TYPE_MATCH));
     /* All of the above also works on empty strings if we assert that they
        should be coerced to null. */
     $this->assertNull($validator->number('', null, Validator::ASSERT_ALLOW_NULL | Validator::FILTER_TO_NULL));
     $this->assertNull($validator->number('', null, Validator::ASSERT_ALLOW_NULL | Validator::FILTER_TO_NULL | Validator::ASSERT_INT | Validator::ASSERT_TYPE_MATCH));
     // Truth assertions work here as expected
     $this->assertSame(-5, $validator->number('-5', null, Validator::ASSERT_TRUTH));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(0, null, Validator::ASSERT_TRUTH));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array('0', null, Validator::ASSERT_TRUTH));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(0, null, Validator::ASSERT_TRUTH | Validator::ASSERT_INT));
     // This assertion does what it says on the box
     $this->assertSame(5, $validator->number(5, null, Validator::ASSERT_POSITIVE));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(-5, null, Validator::ASSERT_POSITIVE));
     $this->assertEquals(0, $validator->number('-0', null, Validator::ASSERT_POSITIVE));
     // Assertions/filters that are meaningless for numbers do nothing
     $noopAssertions = array(Validator::ASSERT_NOT_NULL, Validator::ASSERT_SINGLE_EMAIL, Validator::FILTER_TO_NULL, Validator::FILTER_TRIM, Validator::FILTER_ADD_SCHEME);
     foreach ($noopAssertions as $assertion) {
         $this->assertSame(0, $validator->number(0, null, $assertion));
         $this->assertSame(5, $validator->number(5, null, $assertion));
         $this->assertSame(5, $validator->number('5', null, $assertion));
         $this->assertSame(-5 / 3, $validator->number(-5 / 3, null, $assertion));
         $this->assertSame(-1.667, $validator->number(round(-5 / 3, 3), null, $assertion));
         $this->assertSame((double) 123450000, $validator->number('+0123.45e6', null, $assertion));
         $this->assertSame(16103058, $validator->number(0xf5b692, null, $assertion));
     }
     // We can assert a range
     $this->assertSame(2, $validator->number(2, null, 0, null, 3));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(5, null, 0, null, 3));
     $this->assertSame(2, $validator->number(2, null, 0, 2));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(1, null, 0, 2));
     $this->assertSame(-4.7, $validator->number(-4.7, null, 0, -5.928, -2.3826));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(-7.7, null, 0, -5.928, -2.3826));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(2, null, 0, -5.928, -2.3826));
     /* We should get an exception if we pass something other than a number
        as a range boundary. */
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(5, null, 0, 'asdf'));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(5, null, 0, 0, 'asdf'));
     $this->assertThrows('InvalidArgumentException', array($validator, 'number'), array(5, null, 0, 'asdf', 'asdf'));
 }
 function _buildQuery()
 {
     $query = DBModel::getInstance();
     $query->reset('CommentsNotified');
     $query->setQualifier('blogid', 'equals', getBlogId());
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->entry)) {
         if (!Validator::number($this->entry, 0)) {
             return $this->_error('entry');
         }
         $query->setAttribute('entry', $this->entry);
     }
     if (isset($this->parent)) {
         if (empty($this->parent)) {
             $this->parent = NULL;
         } else {
             if (!Validator::number($this->parent, 0)) {
                 return $this->_error('parent');
             }
         }
     }
     $query->setAttribute('parent', $this->parent);
     if (isset($this->commenter)) {
         if (!Validator::number($this->commenter, 1)) {
             return $this->_error('commenter');
         }
         if (!($this->name = User::getName($this->commenter))) {
             return $this->_error('commenter');
         }
         $query->setAttribute('replier', $this->commenter);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->homepage) && !empty($this->homepage)) {
         $this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
         $query->setAttribute('homepage', $this->homepage, true);
     }
     if (isset($this->ip) && !empty($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->secret)) {
         $query->setAttribute('secret', Validator::getBit($this->secret));
     }
     if (isset($this->isnew)) {
         $query->setAttribute('isnew', Validator::getBit($this->isnew));
     }
     if (isset($this->content)) {
         $this->content = trim($this->content);
         if (empty($this->content)) {
             return $this->_error('content');
         }
         $query->setAttribute('comment', $this->content, true);
     }
     if (isset($this->written)) {
         if (!Validator::timestamp($this->written)) {
             return $this->_error('written');
         }
         $query->setAttribute('written', $this->written);
     }
     if (isset($this->modified)) {
         if (!Validator::timestamp($this->modified)) {
             return $this->_error('modified');
         }
         $query->setAttribute('modified', $this->modified);
     }
     if (isset($this->siteid)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setAttribute('siteid', $this->siteid);
     }
     if (isset($this->remoteid)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setAttribute('remoteid', $this->remoteid);
     }
     if (isset($this->url) && !empty($this->url)) {
         // TODO: url validator doesn't validate correctly?
         //if (!Validator::url($this->url))
         //	return $this->_error('url');
         $query->setAttribute('url', $this->url, true);
     }
     if (isset($this->entrytitle)) {
         $this->entrytitle = Utils_Unicode::lessenAsEncoding(trim($this->entrytitle), 255);
         if (empty($this->entrytitle)) {
             return $this->_error('entrytitle');
         }
         $query->setAttribute('entrytitle', $this->entrytitle, true);
     }
     if (isset($this->entryurl)) {
         //if (!Validator::url($this->entryurl))
         //	return $this->_error('entryurl');
         $query->setAttribute('entryurl', $this->entryurl, true);
     }
     if (isset($this->password)) {
         $this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
         $query->setAttribute('password', $this->password, true);
         $this->password = null;
     }
     return $query;
 }