diff options
Diffstat (limited to 'plugins/OStatus/classes/Ostatus_profile.php')
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 898c63e83..6a0fd1f3b 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -188,9 +188,11 @@ class Ostatus_profile extends Memcached_DataObject } else if ($this->group_id && !$this->profile_id) { return true; } else if ($this->group_id && $this->profile_id) { - throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri"); + // @todo i18n FIXME: use sprintf and add i18n. + throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri."); } else { - throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri"); + // @todo i18n FIXME: use sprintf and add i18n. + throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri."); } } @@ -370,7 +372,8 @@ class Ostatus_profile extends Memcached_DataObject } else if ($entry instanceof Notice) { return $preamble . $entry->asAtomEntry(true, true); } else { - throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry"); + // @todo i18n FIXME: use sprintf and add i18n. + throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry."); } } @@ -549,7 +552,8 @@ class Ostatus_profile extends Memcached_DataObject $sourceContent = $note->title; } else { // @fixme fetch from $sourceUrl? - throw new ClientException("No content for notice {$sourceUri}"); + // @todo i18n FIXME: use sprintf and add i18n. + throw new ClientException("No content for notice {$sourceUri}."); } // Get (safe!) HTML and text versions of the content @@ -587,7 +591,7 @@ class Ostatus_profile extends Memcached_DataObject ' class="attachment more"' . ' title="'. htmlspecialchars(_m('Show more')) . '">' . '…' . - '</a>'; + '</a>'; // @todo i18n FIXME: add translator hint/context. } } @@ -772,6 +776,7 @@ class Ostatus_profile extends Memcached_DataObject $response = $client->get($profile_url); if (!$response->isOk()) { + // @todo i18n FIXME: use sprintf and add i18n. throw new Exception("Could not reach profile page: " . $profile_url); } @@ -829,6 +834,7 @@ class Ostatus_profile extends Memcached_DataObject return self::ensureFeedURL($feedurl, $hints); } + // @todo i18n FIXME: use sprintf and add i18n. throw new Exception("Could not find a feed URL for profile page " . $finalUrl); } @@ -861,6 +867,7 @@ class Ostatus_profile extends Memcached_DataObject $user = User::staticGet('id', $profile->id); if (!empty($user)) { + // @todo i18n FIXME: use sprintf and add i18n. throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'."); } @@ -1025,7 +1032,7 @@ class Ostatus_profile extends Memcached_DataObject return; } if (!common_valid_http_url($url)) { - throw new ServerException(sprintf(_m("Invalid avatar URL %s"), $url)); + throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url)); } if ($this->isGroup()) { @@ -1035,7 +1042,7 @@ class Ostatus_profile extends Memcached_DataObject } if (!$self) { throw new ServerException(sprintf( - _m("Tried to update avatar for unsaved remote profile %s"), + _m("Tried to update avatar for unsaved remote profile %s."), $this->uri)); } @@ -1043,7 +1050,7 @@ class Ostatus_profile extends Memcached_DataObject // ripped from oauthstore.php (for old OMB client) $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); if (!copy($url, $temp_filename)) { - throw new ServerException(sprintf(_m("Unable to fetch avatar from %s"), $url)); + throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url)); } if ($this->isGroup()) { @@ -1226,7 +1233,7 @@ class Ostatus_profile extends Memcached_DataObject if ($object->link && common_valid_http_url($object->link)) { return $object->link; } - throw new ServerException("No author ID URI found"); + throw new ServerException("No author ID URI found."); } /** @@ -1256,10 +1263,12 @@ class Ostatus_profile extends Memcached_DataObject $user = User::staticGet('uri', $homeuri); if ($user) { + // @todo i18n FIXME: add i18n. throw new Exception("Local user can't be referenced as remote."); } if (OStatusPlugin::localGroupFromUrl($homeuri)) { + // @todo i18n FIXME: add i18n. throw new Exception("Local group can't be referenced as remote."); } @@ -1311,7 +1320,8 @@ class Ostatus_profile extends Memcached_DataObject $oprofile->profile_id = $profile->insert(); if (!$oprofile->profile_id) { - throw new ServerException("Can't save local profile"); + // @todo i18n FIXME: add i18n. + throw new ServerException("Can't save local profile."); } } else { $group = new User_group(); @@ -1321,14 +1331,16 @@ class Ostatus_profile extends Memcached_DataObject $oprofile->group_id = $group->insert(); if (!$oprofile->group_id) { - throw new ServerException("Can't save local profile"); + // @todo i18n FIXME: add i18n. + throw new ServerException("Can't save local profile."); } } $ok = $oprofile->insert(); if (!$ok) { - throw new ServerException("Can't save OStatus profile"); + // @todo i18n FIXME: add i18n. + throw new ServerException("Can't save OStatus profile."); } $avatar = self::getActivityObjectAvatar($object, $hints); @@ -1586,6 +1598,7 @@ class Ostatus_profile extends Memcached_DataObject if ($uri !== false) { if (is_null($uri)) { // Negative cache entry + // @todo i18n FIXME: add i18n. throw new Exception('Not a valid webfinger address.'); } $oprofile = Ostatus_profile::staticGet('uri', $uri); @@ -1613,6 +1626,7 @@ class Ostatus_profile extends Memcached_DataObject // Save negative cache entry so we don't waste time looking it up again. // @fixme distinguish temporary failures? self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null); + // @todo i18n FIXME: add i18n. throw new Exception('Not a valid webfinger address.'); } @@ -1694,7 +1708,8 @@ class Ostatus_profile extends Memcached_DataObject if (!$profile_id) { common_log_db_error($profile, 'INSERT', __FILE__); - throw new Exception("Couldn't save profile for '$addr'"); + // @todo i18n FIXME: add i18n and use sprintf for parameter. + throw new Exception("Couldn't save profile for '$addr'."); } $oprofile = new Ostatus_profile(); @@ -1712,13 +1727,15 @@ class Ostatus_profile extends Memcached_DataObject if (!$result) { common_log_db_error($oprofile, 'INSERT', __FILE__); - throw new Exception("Couldn't save ostatus_profile for '$addr'"); + // @todo i18n FIXME: add i18n and use sprintf for parameter. + throw new Exception("Couldn't save ostatus_profile for '$addr'."); } self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri); return $oprofile; } + // @todo i18n FIXME: add i18n and use sprintf for parameter. throw new Exception("Couldn't find a valid profile for '$addr'"); } @@ -1818,4 +1835,3 @@ class OStatusShadowException extends Exception parent::__construct($message); } } - |