fix validation of url

darcs-hash:20080520192634-84dde-2394dbf8767ff886817a5f20f5c9064ea3a1bc79.gz
This commit is contained in:
Evan Prodromou 2008-05-20 15:26:34 -04:00
parent 52600ce0b0
commit 5137eb20d8

View File

@ -43,14 +43,8 @@ class Notice extends DB_DataObject
/* the code above is auto generated do not remove the tag below */ /* the code above is auto generated do not remove the tag below */
###END_AUTOCODE ###END_AUTOCODE
// XXX: if profile_id changes, this goes invalid. To be fair, that's a very edge case
static $profile;
function getProfile() { function getProfile() {
if (!$this->profile) { return Profile::staticGet($this->profile_id);
$this->profile = Profile::staticGet($this->profile_id);
}
return $this->profile;
} }
function validateContent() { function validateContent() {
@ -58,7 +52,7 @@ class Notice extends DB_DataObject
} }
function validateUrl() { function validateUrl() {
return is_null($this->url) || return is_null($this->url) || (strlen($this->url) == 0) ||
Validate::uri($this->url, array('allowed_schemes' => array('http', 'https'))); Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')));
} }
} }