mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Make sure the website URL that the commenter posts has a correct "http://" or "http://" bit at the start of the string
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@68999 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b4d24d441d
commit
6eea8c657f
@ -119,6 +119,29 @@ class PageComment extends DataObject {
|
||||
return $labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called just before this object is
|
||||
* written to the database.
|
||||
*
|
||||
* Specifically, make sure "http://" exists at the start
|
||||
* of the URL, if it doesn't have https:// or http://
|
||||
*/
|
||||
public function onBeforeWrite() {
|
||||
parent::onBeforeWrite();
|
||||
|
||||
$url = $this->CommenterURL;
|
||||
|
||||
if($url) {
|
||||
if(substr($url, 0, 8) != 'https://') {
|
||||
if(substr($url, 0, 7) != 'http://') {
|
||||
$url = $this->CommenterURL = 'http://' . $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->CommenterURL = strtolower($url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -228,6 +251,7 @@ class PageComment_Controller extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user