*
* @return Bookmark found bookmark or null
*/
- static function getByNotice($notice)
+ static function getByNotice(Notice $notice)
{
return self::getKV('uri', $notice->uri);
}
*
* @return Bookmark bookmark found or null
*/
- static function getByURL($profile, $url)
+ static function getByURL(Profile $profile, $url)
{
$nb = new Bookmark();
*
* @return Notice saved notice
*/
- static function saveNew($profile, $title, $url, $rawtags, $description,
- $options=null)
+ static function saveNew(Profile $profile, $title, $url, $rawtags, $description,
+ array $options=array())
{
+ if (!common_valid_http_url($url)) {
+ throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).'));
+ }
+
$nb = self::getByURL($profile, $url);
if (!empty($nb)) {
throw new ClientException(_m('Bookmark already exists.'));
}
- if (empty($options)) {
- $options = array();
- }
-
if (array_key_exists('uri', $options)) {
$other = Bookmark::getKV('uri', $options['uri']);
if (!empty($other)) {