Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x
This commit is contained in:
commit
17c8df76f1
@ -124,6 +124,7 @@ class BlankAdPlugin extends UAPPlugin
|
|||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:BlankAdPlugin',
|
'homepage' => 'http://status.net/wiki/Plugin:BlankAdPlugin',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Plugin for testing ad layout.'));
|
_m('Plugin for testing ad layout.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -82,13 +82,19 @@ class BlogspamNetPlugin extends Plugin
|
|||||||
} else {
|
} else {
|
||||||
common_debug("Blogspamnet results = " . $response);
|
common_debug("Blogspamnet results = " . $response);
|
||||||
if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
|
if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
|
||||||
throw new ServerException(sprintf(_m("Error from %1$s: %2$s"), $this->baseUrl, $match[2]), 500);
|
// TRANS: Server exception thrown when blogspam.net returns error status.
|
||||||
|
// TRANS: %1$s is the base URL, %2$s is the error (unknown contents; no period).
|
||||||
|
throw new ServerException(sprintf(_m('Error from %1$s: %2$s'), $this->baseUrl, $match[2]), 500);
|
||||||
} else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
|
} else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
|
||||||
throw new ClientException(sprintf(_m("Spam checker results: %s"), $match[2]), 400);
|
// TRANS: Server exception thrown when blogspam.net returns spam status.
|
||||||
|
// TRANS: Does not end with period because of unknown contents for %s (spam match).
|
||||||
|
throw new ClientException(sprintf(_m('Spam checker results: %s'), $match[2]), 400);
|
||||||
} else if (preg_match('/^OK$/', $response)) {
|
} else if (preg_match('/^OK$/', $response)) {
|
||||||
// don't do anything
|
// don't do anything
|
||||||
} else {
|
} else {
|
||||||
throw new ServerException(sprintf(_m("Unexpected response from %1$s: %2$s"), $this->baseUrl, $response), 500);
|
// TRANS: Server exception thrown when blogspam.net returns an unexpected status.
|
||||||
|
// TRANS: %1$s is the base URL, %2$s is the response (unknown contents; no period).
|
||||||
|
throw new ServerException(sprintf(_m('Unexpected response from %1$s: %2$s'), $this->baseUrl, $response), 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -149,6 +155,7 @@ class BlogspamNetPlugin extends Plugin
|
|||||||
'author' => 'Evan Prodromou, Brion Vibber',
|
'author' => 'Evan Prodromou, Brion Vibber',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:BlogspamNet',
|
'homepage' => 'http://status.net/wiki/Plugin:BlogspamNet',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Plugin to check submitted notices with blogspam.net.'));
|
_m('Plugin to check submitted notices with blogspam.net.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
|||||||
*
|
*
|
||||||
* @see DB_DataObject
|
* @see DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Bookmark extends Memcached_DataObject
|
class Bookmark extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'bookmark'; // table name
|
public $__table = 'bookmark'; // table name
|
||||||
@ -65,7 +64,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
* @return User_greeting_count object found, or null for no hits
|
* @return User_greeting_count object found, or null for no hits
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function staticGet($k, $v=null)
|
function staticGet($k, $v=null)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::staticGet('Bookmark', $k, $v);
|
return Memcached_DataObject::staticGet('Bookmark', $k, $v);
|
||||||
@ -83,7 +81,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
* @return Bookmark object found, or null for no hits
|
* @return Bookmark object found, or null for no hits
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function pkeyGet($kv)
|
function pkeyGet($kv)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::pkeyGet('Bookmark', $kv);
|
return Memcached_DataObject::pkeyGet('Bookmark', $kv);
|
||||||
@ -97,7 +94,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array array of column definitions
|
* @return array array of column definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function table()
|
function table()
|
||||||
{
|
{
|
||||||
return array('id' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
|
return array('id' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
|
||||||
@ -106,7 +102,7 @@ class Bookmark extends Memcached_DataObject
|
|||||||
'title' => DB_DATAOBJECT_STR,
|
'title' => DB_DATAOBJECT_STR,
|
||||||
'description' => DB_DATAOBJECT_STR,
|
'description' => DB_DATAOBJECT_STR,
|
||||||
'uri' => DB_DATAOBJECT_STR,
|
'uri' => DB_DATAOBJECT_STR,
|
||||||
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE +
|
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE +
|
||||||
DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +111,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array list of key field names
|
* @return array list of key field names
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keys()
|
function keys()
|
||||||
{
|
{
|
||||||
return array_keys($this->keyTypes());
|
return array_keys($this->keyTypes());
|
||||||
@ -126,7 +121,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array associative array of key definitions
|
* @return array associative array of key definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function keyTypes()
|
function keyTypes()
|
||||||
{
|
{
|
||||||
return array('id' => 'K',
|
return array('id' => 'K',
|
||||||
@ -138,7 +132,6 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return array magic three-false array that stops auto-incrementing.
|
* @return array magic three-false array that stops auto-incrementing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{
|
{
|
||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
@ -146,12 +139,11 @@ class Bookmark extends Memcached_DataObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a bookmark based on a notice
|
* Get a bookmark based on a notice
|
||||||
*
|
*
|
||||||
* @param Notice $notice Notice to check for
|
* @param Notice $notice Notice to check for
|
||||||
*
|
*
|
||||||
* @return Bookmark found bookmark or null
|
* @return Bookmark found bookmark or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getByNotice($notice)
|
function getByNotice($notice)
|
||||||
{
|
{
|
||||||
return self::staticGet('uri', $notice->uri);
|
return self::staticGet('uri', $notice->uri);
|
||||||
@ -165,11 +157,10 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return Bookmark bookmark found or null
|
* @return Bookmark bookmark found or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getByURL($profile, $url)
|
static function getByURL($profile, $url)
|
||||||
{
|
{
|
||||||
$nb = new Bookmark();
|
$nb = new Bookmark();
|
||||||
|
|
||||||
$nb->profile_id = $profile->id;
|
$nb->profile_id = $profile->id;
|
||||||
$nb->url = $url;
|
$nb->url = $url;
|
||||||
|
|
||||||
@ -192,13 +183,13 @@ class Bookmark extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @return Notice saved notice
|
* @return Notice saved notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function saveNew($profile, $title, $url, $rawtags, $description,
|
static function saveNew($profile, $title, $url, $rawtags, $description,
|
||||||
$options=null)
|
$options=null)
|
||||||
{
|
{
|
||||||
$nb = self::getByURL($profile, $url);
|
$nb = self::getByURL($profile, $url);
|
||||||
|
|
||||||
if (!empty($nb)) {
|
if (!empty($nb)) {
|
||||||
|
// TRANS: Client exception thrown when trying to save a new bookmark that already exists.
|
||||||
throw new ClientException(_m('Bookmark already exists.'));
|
throw new ClientException(_m('Bookmark already exists.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +200,7 @@ class Bookmark extends Memcached_DataObject
|
|||||||
if (array_key_exists('uri', $options)) {
|
if (array_key_exists('uri', $options)) {
|
||||||
$other = Bookmark::staticGet('uri', $options['uri']);
|
$other = Bookmark::staticGet('uri', $options['uri']);
|
||||||
if (!empty($other)) {
|
if (!empty($other)) {
|
||||||
|
// TRANS: Client exception thrown when trying to save a new bookmark that already exists.
|
||||||
throw new ClientException(_m('Bookmark already exists.'));
|
throw new ClientException(_m('Bookmark already exists.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,15 +273,15 @@ class Bookmark extends Memcached_DataObject
|
|||||||
try {
|
try {
|
||||||
$user = User::staticGet('id', $profile->id);
|
$user = User::staticGet('id', $profile->id);
|
||||||
|
|
||||||
$shortUrl = File_redirection::makeShort($url,
|
$shortUrl = File_redirection::makeShort($url,
|
||||||
empty($user) ? null : $user);
|
empty($user) ? null : $user);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Don't let this stop us.
|
// Don't let this stop us.
|
||||||
$shortUrl = $url;
|
$shortUrl = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo FIXME: i18n documentation.
|
// TRANS: Bookmark content.
|
||||||
// TRANS: %1$s is a title, %2$s is a short URL, %3$s is a description,
|
// TRANS: %1$s is a title, %2$s is a short URL, %3$s is the bookmark description,
|
||||||
// TRANS: %4$s is space separated list of hash tags.
|
// TRANS: %4$s is space separated list of hash tags.
|
||||||
$content = sprintf(_m('"%1$s" %2$s %3$s %4$s'),
|
$content = sprintf(_m('"%1$s" %2$s %3$s %4$s'),
|
||||||
$title,
|
$title,
|
||||||
@ -297,6 +289,9 @@ class Bookmark extends Memcached_DataObject
|
|||||||
$description,
|
$description,
|
||||||
implode(' ', $hashtags));
|
implode(' ', $hashtags));
|
||||||
|
|
||||||
|
// TRANS: Rendered bookmark content.
|
||||||
|
// TRANS: %1$s is a URL, %2$s the bookmark title, %3$s is the bookmark description,
|
||||||
|
// TRANS: %4$s is space separated list of hash tags.
|
||||||
$rendered = sprintf(_m('<span class="xfolkentry">'.
|
$rendered = sprintf(_m('<span class="xfolkentry">'.
|
||||||
'<a class="taggedlink" href="%1$s">%2$s</a> '.
|
'<a class="taggedlink" href="%1$s">%2$s</a> '.
|
||||||
'<span class="description">%3$s</span> '.
|
'<span class="description">%3$s</span> '.
|
||||||
|
@ -43,7 +43,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BookmarkPlugin extends MicroAppPlugin
|
class BookmarkPlugin extends MicroAppPlugin
|
||||||
{
|
{
|
||||||
const VERSION = '0.1';
|
const VERSION = '0.1';
|
||||||
@ -60,7 +59,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onUserRightsCheck($profile, $right, &$result)
|
function onUserRightsCheck($profile, $right, &$result)
|
||||||
{
|
{
|
||||||
if ($right == self::IMPORTDELICIOUS) {
|
if ($right == self::IMPORTDELICIOUS) {
|
||||||
@ -78,7 +76,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onCheckSchema()
|
function onCheckSchema()
|
||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
@ -127,7 +124,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndShowStyles($action)
|
function onEndShowStyles($action)
|
||||||
{
|
{
|
||||||
$action->cssLink($this->path('bookmark.css'));
|
$action->cssLink($this->path('bookmark.css'));
|
||||||
@ -141,7 +137,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
$dir = dirname(__FILE__);
|
$dir = dirname(__FILE__);
|
||||||
@ -175,7 +170,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
* @return boolean hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onRouterInitialized($m)
|
function onRouterInitialized($m)
|
||||||
{
|
{
|
||||||
$m->connect('main/bookmark/new',
|
$m->connect('main/bookmark/new',
|
||||||
@ -204,10 +198,9 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
* Add our two queue handlers to the queue manager
|
* Add our two queue handlers to the queue manager
|
||||||
*
|
*
|
||||||
* @param QueueManager $qm current queue manager
|
* @param QueueManager $qm current queue manager
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndInitializeQueueManager($qm)
|
function onEndInitializeQueueManager($qm)
|
||||||
{
|
{
|
||||||
$qm->connect('dlcsback', 'DeliciousBackupImporter');
|
$qm->connect('dlcsback', 'DeliciousBackupImporter');
|
||||||
@ -219,10 +212,9 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
* Plugin version data
|
* Plugin version data
|
||||||
*
|
*
|
||||||
* @param array &$versions array of version data
|
* @param array &$versions array of version data
|
||||||
*
|
*
|
||||||
* @return value
|
* @return value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'Sample',
|
$versions[] = array('name' => 'Sample',
|
||||||
@ -230,6 +222,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
'author' => 'Evan Prodromou',
|
'author' => 'Evan Prodromou',
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:Bookmark',
|
'homepage' => 'http://status.net/wiki/Plugin:Bookmark',
|
||||||
'rawdescription' =>
|
'rawdescription' =>
|
||||||
|
// TRANS: Plugin description.
|
||||||
_m('Simple extension for supporting bookmarks.'));
|
_m('Simple extension for supporting bookmarks.'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -242,7 +235,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onStartLoadDoc(&$title, &$output)
|
function onStartLoadDoc(&$title, &$output)
|
||||||
{
|
{
|
||||||
if ($title == 'bookmarklet') {
|
if ($title == 'bookmarklet') {
|
||||||
@ -256,8 +248,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a link to our delicious import page on profile settings form
|
* Show a link to our delicious import page on profile settings form
|
||||||
*
|
*
|
||||||
@ -265,15 +255,15 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onEndProfileSettingsActions($action)
|
function onEndProfileSettingsActions($action)
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
if (!empty($user) && $user->hasRight(self::IMPORTDELICIOUS)) {
|
if (!empty($user) && $user->hasRight(self::IMPORTDELICIOUS)) {
|
||||||
$action->elementStart('li');
|
$action->elementStart('li');
|
||||||
$action->element('a',
|
$action->element('a',
|
||||||
array('href' => common_local_url('importdelicious')),
|
array('href' => common_local_url('importdelicious')),
|
||||||
|
// TRANS: Link text in proile leading to import form.
|
||||||
_m('Import del.icio.us bookmarks'));
|
_m('Import del.icio.us bookmarks'));
|
||||||
$action->elementEnd('li');
|
$action->elementEnd('li');
|
||||||
}
|
}
|
||||||
@ -314,7 +304,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return Notice resulting notice.
|
* @return Notice resulting notice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static private function _postRemoteBookmark(Ostatus_profile $author,
|
static private function _postRemoteBookmark(Ostatus_profile $author,
|
||||||
Activity $activity)
|
Activity $activity)
|
||||||
{
|
{
|
||||||
@ -324,7 +313,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
'url' => $bookmark->link,
|
'url' => $bookmark->link,
|
||||||
'is_local' => Notice::REMOTE_OMB,
|
'is_local' => Notice::REMOTE_OMB,
|
||||||
'source' => 'ostatus');
|
'source' => 'ostatus');
|
||||||
|
|
||||||
return self::_postBookmark($author->localProfile(), $activity, $options);
|
return self::_postBookmark($author->localProfile(), $activity, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +324,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return true if it's a Post of a Bookmark, else false
|
* @return true if it's a Post of a Bookmark, else false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static private function _isPostBookmark($activity)
|
static private function _isPostBookmark($activity)
|
||||||
{
|
{
|
||||||
return ($activity->verb == ActivityVerb::POST &&
|
return ($activity->verb == ActivityVerb::POST &&
|
||||||
@ -351,10 +339,9 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
* When a notice is deleted, delete the related Bookmark
|
* When a notice is deleted, delete the related Bookmark
|
||||||
*
|
*
|
||||||
* @param Notice $notice Notice being deleted
|
* @param Notice $notice Notice being deleted
|
||||||
*
|
*
|
||||||
* @return boolean hook value
|
* @return boolean hook value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteRelated($notice)
|
function deleteRelated($notice)
|
||||||
{
|
{
|
||||||
$nb = Bookmark::getByNotice($notice);
|
$nb = Bookmark::getByNotice($notice);
|
||||||
@ -375,7 +362,6 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
*
|
*
|
||||||
* @return Notice resulting notice
|
* @return Notice resulting notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveNoticeFromActivity($activity, $profile, $options=array())
|
function saveNoticeFromActivity($activity, $profile, $options=array())
|
||||||
{
|
{
|
||||||
$bookmark = $activity->objects[0];
|
$bookmark = $activity->objects[0];
|
||||||
@ -383,6 +369,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
$relLinkEls = ActivityUtils::getLinks($bookmark->element, 'related');
|
$relLinkEls = ActivityUtils::getLinks($bookmark->element, 'related');
|
||||||
|
|
||||||
if (count($relLinkEls) < 1) {
|
if (count($relLinkEls) < 1) {
|
||||||
|
// TRANS: Client exception thrown when a bookmark is formatted incorrectly.
|
||||||
throw new ClientException(_m('Expected exactly 1 link '.
|
throw new ClientException(_m('Expected exactly 1 link '.
|
||||||
'rel=related in a Bookmark.'));
|
'rel=related in a Bookmark.'));
|
||||||
}
|
}
|
||||||
@ -476,6 +463,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
$attachments = $notice->attachments();
|
$attachments = $notice->attachments();
|
||||||
|
|
||||||
if (count($attachments) != 1) {
|
if (count($attachments) != 1) {
|
||||||
|
// TRANS: Server exception thrown when a bookmark has multiple attachments.
|
||||||
throw new ServerException(_m('Bookmark notice with the '.
|
throw new ServerException(_m('Bookmark notice with the '.
|
||||||
'wrong number of attachments.'));
|
'wrong number of attachments.'));
|
||||||
}
|
}
|
||||||
@ -490,7 +478,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$object->extra[] = array('link', $attrs, null);
|
$object->extra[] = array('link', $attrs, null);
|
||||||
|
|
||||||
// Attributes of the thumbnail, if any
|
// Attributes of the thumbnail, if any
|
||||||
|
|
||||||
$thumbnail = $target->getThumbnail();
|
$thumbnail = $target->getThumbnail();
|
||||||
@ -530,7 +518,8 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
if (count($atts) < 1) {
|
if (count($atts) < 1) {
|
||||||
// Something wrong; let default code deal with it.
|
// Something wrong; let default code deal with it.
|
||||||
throw new Exception("That can't be right.");
|
// TRANS: Exception thrown when a bookmark has no attachments.
|
||||||
|
throw new Exception(_m('Bookmark has no attachments.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$att = $atts[0];
|
$att = $atts[0];
|
||||||
@ -562,7 +551,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
if (!empty($replies) || !empty($tags)) {
|
if (!empty($replies) || !empty($tags)) {
|
||||||
|
|
||||||
$out->elementStart('ul', array('class' => 'bookmark-tags'));
|
$out->elementStart('ul', array('class' => 'bookmark-tags'));
|
||||||
|
|
||||||
foreach ($replies as $reply) {
|
foreach ($replies as $reply) {
|
||||||
$other = Profile::staticGet('id', $reply);
|
$other = Profile::staticGet('id', $reply);
|
||||||
$out->elementStart('li');
|
$out->elementStart('li');
|
||||||
@ -576,7 +565,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$out->elementStart('li');
|
$out->elementStart('li');
|
||||||
$out->element('a',
|
$out->element('a',
|
||||||
array('rel' => 'tag',
|
array('rel' => 'tag',
|
||||||
'href' => Notice_tag::url($tag)),
|
'href' => Notice_tag::url($tag)),
|
||||||
$tag);
|
$tag);
|
||||||
@ -612,7 +601,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
|
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
|
||||||
|
|
||||||
$out->element('img',
|
$out->element('img',
|
||||||
array('src' => ($avatar) ?
|
array('src' => ($avatar) ?
|
||||||
$avatar->displayUrl() :
|
$avatar->displayUrl() :
|
||||||
Avatar::defaultImage(AVATAR_MINI_SIZE),
|
Avatar::defaultImage(AVATAR_MINI_SIZE),
|
||||||
@ -624,7 +613,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
$out->raw(' '); // avoid for AJAX XML compatibility
|
$out->raw(' '); // avoid for AJAX XML compatibility
|
||||||
|
|
||||||
$out->elementStart('span', 'vcard author'); // hack for belongsOnTimeline; JS needs to be able to find the author
|
$out->elementStart('span', 'vcard author'); // hack for belongsOnTimeline; JS needs to be able to find the author
|
||||||
$out->element('a',
|
$out->element('a',
|
||||||
array('class' => 'url',
|
array('class' => 'url',
|
||||||
'href' => $profile->profileurl,
|
'href' => $profile->profileurl,
|
||||||
'title' => $profile->getBestName()),
|
'title' => $profile->getBestName()),
|
||||||
@ -644,6 +633,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
function appTitle()
|
function appTitle()
|
||||||
{
|
{
|
||||||
return _m('Bookmark');
|
// TRANS: Application title.
|
||||||
|
return _m('TITLE','Bookmark');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Form for adding a new bookmark
|
* Form for adding a new bookmark
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BookmarkForm extends Form
|
class BookmarkForm extends Form
|
||||||
{
|
{
|
||||||
private $_title = null;
|
private $_title = null;
|
||||||
@ -63,7 +62,6 @@ class BookmarkForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out=null, $title=null, $url=null, $tags=null,
|
function __construct($out=null, $title=null, $url=null, $tags=null,
|
||||||
$description=null)
|
$description=null)
|
||||||
{
|
{
|
||||||
@ -80,7 +78,6 @@ class BookmarkForm extends Form
|
|||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_new_bookmark';
|
return 'form_new_bookmark';
|
||||||
@ -91,7 +88,6 @@ class BookmarkForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings ajax-notice';
|
return 'form_settings ajax-notice';
|
||||||
@ -102,7 +98,6 @@ class BookmarkForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('newbookmark');
|
return common_local_url('newbookmark');
|
||||||
@ -113,7 +108,6 @@ class BookmarkForm extends Form
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
|
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
|
||||||
@ -121,30 +115,38 @@ class BookmarkForm extends Form
|
|||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('title',
|
$this->out->input('title',
|
||||||
|
// TRANS: Field label on form for adding a new bookmark.
|
||||||
_m('LABEL','Title'),
|
_m('LABEL','Title'),
|
||||||
$this->_title,
|
$this->_title,
|
||||||
_m('Title of the bookmark'));
|
// TRANS: Field title on form for adding a new bookmark.
|
||||||
|
_m('Title of the bookmark.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('url',
|
$this->out->input('url',
|
||||||
|
// TRANS: Field label on form for adding a new bookmark.
|
||||||
_m('LABEL','URL'),
|
_m('LABEL','URL'),
|
||||||
$this->_url,
|
$this->_url,
|
||||||
_m('URL to bookmark'));
|
// TRANS: Field title on form for adding a new bookmark.
|
||||||
|
_m('URL to bookmark.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('tags',
|
$this->out->input('tags',
|
||||||
|
// TRANS: Field label on form for adding a new bookmark.
|
||||||
_m('LABEL','Tags'),
|
_m('LABEL','Tags'),
|
||||||
$this->_tags,
|
$this->_tags,
|
||||||
_m('Comma- or space-separated list of tags'));
|
// TRANS: Field title on form for adding a new bookmark.
|
||||||
|
_m('Comma- or space-separated list of tags.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
$this->out->input('description',
|
$this->out->input('description',
|
||||||
|
// TRANS: Field label on form for adding a new bookmark.
|
||||||
_m('LABEL','Description'),
|
_m('LABEL','Description'),
|
||||||
$this->_description,
|
$this->_description,
|
||||||
_m('Description of the URL'));
|
// TRANS: Field title on form for adding a new bookmark.
|
||||||
|
_m('Description of the URL.'));
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
@ -165,6 +167,7 @@ class BookmarkForm extends Form
|
|||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
|
// TRANS: Button text for action to save a new bookmark.
|
||||||
$this->out->submit('submit', _m('BUTTON', 'Save'));
|
$this->out->submit('submit', _m('BUTTON', 'Save'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,12 @@ class BookmarkpopupAction extends NewbookmarkAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTitle()
|
function showTitle()
|
||||||
{
|
{
|
||||||
// TRANS: Title for mini-posting window loaded from bookmarklet.
|
$this->element('title',
|
||||||
// TRANS: %s is the StatusNet site name.
|
// TRANS: Title for mini-posting window loaded from bookmarklet.
|
||||||
$this->element('title',
|
// TRANS: %s is the StatusNet site name.
|
||||||
null, sprintf(_m('Bookmark on %s'),
|
null, sprintf(_m('Bookmark on %s'),
|
||||||
common_config('site', 'name')));
|
common_config('site', 'name')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +65,6 @@ class BookmarkpopupAction extends NewbookmarkAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showHeader()
|
function showHeader()
|
||||||
{
|
{
|
||||||
$this->elementStart('div', array('id' => 'header'));
|
$this->elementStart('div', array('id' => 'header'));
|
||||||
@ -86,10 +84,9 @@ class BookmarkpopupAction extends NewbookmarkAction
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the core section of the page
|
* Hide the core section of the page
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showCore()
|
function showCore()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -99,7 +96,6 @@ class BookmarkpopupAction extends NewbookmarkAction
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showFooter()
|
function showFooter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Importer class for Delicious.com backups
|
* Importer class for Delicious.com backups
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DeliciousBackupImporter extends QueueHandler
|
class DeliciousBackupImporter extends QueueHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -52,7 +51,6 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return string transport string
|
* @return string transport string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function transport()
|
function transport()
|
||||||
{
|
{
|
||||||
return 'dlcsback';
|
return 'dlcsback';
|
||||||
@ -72,7 +70,6 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return boolean success value
|
* @return boolean success value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($data)
|
function handle($data)
|
||||||
{
|
{
|
||||||
list($user, $body) = $data;
|
list($user, $body) = $data;
|
||||||
@ -82,7 +79,8 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
$dls = $doc->getElementsByTagName('dl');
|
$dls = $doc->getElementsByTagName('dl');
|
||||||
|
|
||||||
if ($dls->length != 1) {
|
if ($dls->length != 1) {
|
||||||
throw new ClientException(_m("Bad import file."));
|
// TRANS: Client exception thrown when a file upload is incorrect.
|
||||||
|
throw new ClientException(_m('Bad import file.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$dl = $dls->item(0);
|
$dl = $dls->item(0);
|
||||||
@ -123,7 +121,7 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
common_log(LOG_INFO, 'Skipping the <p> in the <dl>.');
|
common_log(LOG_INFO, 'Skipping the <p> in the <dl>.');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
"Unexpected element $child->tagName ".
|
"Unexpected element $child->tagName ".
|
||||||
" found in import.");
|
" found in import.");
|
||||||
}
|
}
|
||||||
@ -146,12 +144,12 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Import a single bookmark
|
* Import a single bookmark
|
||||||
*
|
*
|
||||||
* Takes a <dt>/<dd> pair. The <dt> has a single
|
* Takes a <dt>/<dd> pair. The <dt> has a single
|
||||||
* <a> in it with some non-standard attributes.
|
* <a> in it with some non-standard attributes.
|
||||||
*
|
*
|
||||||
* A <dt><dt><dd> sequence will appear as a <dt> with
|
* A <dt><dt><dd> sequence will appear as a <dt> with
|
||||||
* anothe <dt> as a child. We handle this case recursively.
|
* anothe <dt> as a child. We handle this case recursively.
|
||||||
*
|
*
|
||||||
* @param User $user User to import data as
|
* @param User $user User to import data as
|
||||||
* @param DOMElement $dt <dt> element
|
* @param DOMElement $dt <dt> element
|
||||||
@ -159,12 +157,12 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return Notice imported notice
|
* @return Notice imported notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function importBookmark($user, $dt, $dd = null)
|
function importBookmark($user, $dt, $dd = null)
|
||||||
{
|
{
|
||||||
$as = $dt->getElementsByTagName('a');
|
$as = $dt->getElementsByTagName('a');
|
||||||
|
|
||||||
if ($as->length == 0) {
|
if ($as->length == 0) {
|
||||||
|
// TRANS: Client exception thrown when a bookmark in an import file is incorrectly formatted.
|
||||||
throw new ClientException(_m("No <A> tag in a <DT>."));
|
throw new ClientException(_m("No <A> tag in a <DT>."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +171,7 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
$private = $a->getAttribute('private');
|
$private = $a->getAttribute('private');
|
||||||
|
|
||||||
if ($private != 0) {
|
if ($private != 0) {
|
||||||
|
// TRANS: Client exception thrown when a bookmark in an import file is private.
|
||||||
throw new ClientException(_m('Skipping private bookmark.'));
|
throw new ClientException(_m('Skipping private bookmark.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,5 +305,4 @@ class DeliciousBackupImporter extends QueueHandler
|
|||||||
$this->fixListItem($node);
|
$this->fixListItem($node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Importer class for Delicious.com bookmarks
|
* Importer class for Delicious.com bookmarks
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DeliciousBookmarkImporter extends QueueHandler
|
class DeliciousBookmarkImporter extends QueueHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -52,7 +51,6 @@ class DeliciousBookmarkImporter extends QueueHandler
|
|||||||
*
|
*
|
||||||
* @return string 'dlcsbkmk'
|
* @return string 'dlcsbkmk'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function transport()
|
function transport()
|
||||||
{
|
{
|
||||||
return 'dlcsbkmk';
|
return 'dlcsbkmk';
|
||||||
@ -60,12 +58,11 @@ class DeliciousBookmarkImporter extends QueueHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the data
|
* Handle the data
|
||||||
*
|
*
|
||||||
* @param array $data associative array of user & bookmark info from DeliciousBackupImporter::importBookmark()
|
* @param array $data associative array of user & bookmark info from DeliciousBackupImporter::importBookmark()
|
||||||
*
|
*
|
||||||
* @return boolean success value
|
* @return boolean success value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($data)
|
function handle($data)
|
||||||
{
|
{
|
||||||
$profile = Profile::staticGet('id', $data['profile_id']);
|
$profile = Profile::staticGet('id', $data['profile_id']);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010 StatusNet, Inc.
|
* Copyright (C) 2010 StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Import a bookmarks file as notices
|
* Import a bookmarks file as notices
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -46,7 +46,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bookmarks file as a string
|
* Get the bookmarks file as a string
|
||||||
*
|
*
|
||||||
* Uses the -f or --file parameter to open and read a
|
* Uses the -f or --file parameter to open and read a
|
||||||
* a bookmarks file
|
* a bookmarks file
|
||||||
*
|
*
|
||||||
@ -63,19 +63,25 @@ function getBookmarksFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
throw new Exception("No such file '$filename'.");
|
// TRANS: Exception thrown when a file upload cannot be found.
|
||||||
|
// TRANS: %s is the file that could not be found.
|
||||||
|
throw new Exception(sprintf(_m('No such file "%s".'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file($filename)) {
|
if (!is_file($filename)) {
|
||||||
throw new Exception("Not a regular file: '$filename'.");
|
// TRANS: Exception thrown when a file upload is incorrect.
|
||||||
|
// TRANS: %s is the irregular file.
|
||||||
|
throw new Exception(sprintf(_m('Not a regular file: "%s".'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_readable($filename)) {
|
if (!is_readable($filename)) {
|
||||||
throw new Exception("File '$filename' not readable.");
|
// TRANS: Exception thrown when a file upload is not readable.
|
||||||
|
// TRANS: %s is the file that could not be read.
|
||||||
|
throw new Exception(sprintf(_m('File "%s" not readable.'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRANS: %s is the filename that contains a backup for a user.
|
// TRANS: %s is the filename that contains a backup for a user.
|
||||||
printfv(_m("Getting backup from file \"%s\".")."\n", $filename);
|
printfv(_m('Getting backup from file "%s".')."\n", $filename);
|
||||||
|
|
||||||
$html = file_get_contents($filename);
|
$html = file_get_contents($filename);
|
||||||
|
|
||||||
@ -87,7 +93,7 @@ try {
|
|||||||
$html = getBookmarksFile();
|
$html = getBookmarksFile();
|
||||||
|
|
||||||
$qm = QueueManager::get();
|
$qm = QueueManager::get();
|
||||||
|
|
||||||
$qm->enqueue(array($user, $html), 'dlcsback');
|
$qm->enqueue(array($user, $html), 'dlcsback');
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Import del.icio.us bookmarks backups
|
* Import del.icio.us bookmarks backups
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ImportdeliciousAction extends Action
|
class ImportdeliciousAction extends Action
|
||||||
{
|
{
|
||||||
protected $success = false;
|
protected $success = false;
|
||||||
@ -55,9 +54,9 @@ class ImportdeliciousAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title for page to import del.icio.us bookmark backups on.
|
||||||
return _m("Import del.icio.us bookmarks");
|
return _m("Import del.icio.us bookmarks");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ class ImportdeliciousAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
@ -76,12 +74,14 @@ class ImportdeliciousAction extends Action
|
|||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
|
||||||
if (empty($cur)) {
|
if (empty($cur)) {
|
||||||
|
// TRANS: Client exception thrown when trying to import bookmarks without being logged in.
|
||||||
throw new ClientException(_m('Only logged-in users can '.
|
throw new ClientException(_m('Only logged-in users can '.
|
||||||
'import del.icio.us backups.'),
|
'import del.icio.us backups.'),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cur->hasRight(BookmarkPlugin::IMPORTDELICIOUS)) {
|
if (!$cur->hasRight(BookmarkPlugin::IMPORTDELICIOUS)) {
|
||||||
|
// TRANS: Client exception thrown when trying to import bookmarks without having the rights to do so.
|
||||||
throw new ClientException(_m('You may not restore your account.'), 403);
|
throw new ClientException(_m('You may not restore your account.'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,6 @@ class ImportdeliciousAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
parent::handle($argarray);
|
parent::handle($argarray);
|
||||||
@ -110,17 +109,17 @@ class ImportdeliciousAction extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue a file for importation
|
* Queue a file for importation
|
||||||
*
|
*
|
||||||
* Uses the DeliciousBackupImporter class; may take a long time!
|
* Uses the DeliciousBackupImporter class; may take a long time!
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function importDelicious()
|
function importDelicious()
|
||||||
{
|
{
|
||||||
$this->checkSessionToken();
|
$this->checkSessionToken();
|
||||||
|
|
||||||
if (!isset($_FILES[ImportDeliciousForm::FILEINPUT]['error'])) {
|
if (!isset($_FILES[ImportDeliciousForm::FILEINPUT]['error'])) {
|
||||||
|
// TRANS: Client exception thrown when trying to import bookmarks and upload fails.
|
||||||
throw new ClientException(_m('No uploaded file.'));
|
throw new ClientException(_m('No uploaded file.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,36 +133,37 @@ class ImportdeliciousAction extends Action
|
|||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_FORM_SIZE:
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
throw new ClientException(
|
throw new ClientException(
|
||||||
// TRANS: Client exception.
|
// TRANS: Client exception thrown when an uploaded file is too large.
|
||||||
_m('The uploaded file exceeds the MAX_FILE_SIZE directive' .
|
_m('The uploaded file exceeds the MAX_FILE_SIZE directive' .
|
||||||
' that was specified in the HTML form.'));
|
' that was specified in the HTML form.'));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_PARTIAL:
|
case UPLOAD_ERR_PARTIAL:
|
||||||
@unlink($_FILES[ImportDeliciousForm::FILEINPUT]['tmp_name']);
|
@unlink($_FILES[ImportDeliciousForm::FILEINPUT]['tmp_name']);
|
||||||
// TRANS: Client exception.
|
// TRANS: Client exception thrown when a file was only partially uploaded.
|
||||||
throw new ClientException(_m('The uploaded file was only' .
|
throw new ClientException(_m('The uploaded file was only' .
|
||||||
' partially uploaded.'));
|
' partially uploaded.'));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_NO_FILE:
|
case UPLOAD_ERR_NO_FILE:
|
||||||
// No file; probably just a non-AJAX submission.
|
// No file; probably just a non-AJAX submission.
|
||||||
|
// TRANS: Client exception thrown when a file upload has failed.
|
||||||
throw new ClientException(_m('No uploaded file.'));
|
throw new ClientException(_m('No uploaded file.'));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_NO_TMP_DIR:
|
case UPLOAD_ERR_NO_TMP_DIR:
|
||||||
// TRANS: Client exception thrown when a temporary folder is not present
|
// TRANS: Client exception thrown when a temporary folder is not present.
|
||||||
throw new ClientException(_m('Missing a temporary folder.'));
|
throw new ClientException(_m('Missing a temporary folder.'));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_CANT_WRITE:
|
case UPLOAD_ERR_CANT_WRITE:
|
||||||
// TRANS: Client exception thrown when writing to disk is not possible
|
// TRANS: Client exception thrown when writing to disk is not possible.
|
||||||
throw new ClientException(_m('Failed to write file to disk.'));
|
throw new ClientException(_m('Failed to write file to disk.'));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_EXTENSION:
|
case UPLOAD_ERR_EXTENSION:
|
||||||
// TRANS: Client exception thrown when a file upload has been stopped
|
// TRANS: Client exception thrown when a file upload has been stopped.
|
||||||
throw new ClientException(_m('File upload stopped by extension.'));
|
throw new ClientException(_m('File upload stopped by extension.'));
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
|
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
|
||||||
$_FILES[ImportDeliciousForm::FILEINPUT]['error']);
|
$_FILES[ImportDeliciousForm::FILEINPUT]['error']);
|
||||||
// TRANS: Client exception thrown when a file upload operation has failed
|
// TRANS: Client exception thrown when a file upload operation has failed.
|
||||||
throw new ClientException(_m('System error uploading file.'));
|
throw new ClientException(_m('System error uploading file.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -172,18 +172,24 @@ class ImportdeliciousAction extends Action
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
throw new ServerException("No such file '$filename'.");
|
// TRANS: Server exception thrown when a file upload cannot be found.
|
||||||
|
// TRANS: %s is the file that could not be found.
|
||||||
|
throw new ServerException(sprintf(_m('No such file "%s".'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file($filename)) {
|
if (!is_file($filename)) {
|
||||||
throw new ServerException("Not a regular file: '$filename'.");
|
// TRANS: Server exception thrown when a file upload is incorrect.
|
||||||
|
// TRANS: %s is the irregular file.
|
||||||
|
throw new ServerException(sprintf(_m('Not a regular file: "%s".'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_readable($filename)) {
|
if (!is_readable($filename)) {
|
||||||
throw new ServerException("File '$filename' not readable.");
|
// TRANS: Server exception thrown when a file upload is not readable.
|
||||||
|
// TRANS: %s is the file that could not be read.
|
||||||
|
throw new ServerException(sprintf(_m('File "%s" not readable.'),$filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
common_debug(sprintf(_m("Getting backup from file '%s'."), $filename));
|
common_debug(sprintf("Getting backup from file '%s'.", $filename));
|
||||||
|
|
||||||
$html = file_get_contents($filename);
|
$html = file_get_contents($filename);
|
||||||
|
|
||||||
@ -214,14 +220,15 @@ class ImportdeliciousAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if ($this->success) {
|
if ($this->success) {
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
|
// TRANS: Success message after importing bookmarks.
|
||||||
_m('Bookmarks have been imported. Your bookmarks should now appear in search and your profile page.'));
|
_m('Bookmarks have been imported. Your bookmarks should now appear in search and your profile page.'));
|
||||||
} else if ($this->inprogress) {
|
} else if ($this->inprogress) {
|
||||||
$this->element('p', null,
|
$this->element('p', null,
|
||||||
|
// TRANS: Busy message for importing bookmarks.
|
||||||
_m('Bookmarks are being imported. Please wait a few minutes for results.'));
|
_m('Bookmarks are being imported. Please wait a few minutes for results.'));
|
||||||
} else {
|
} else {
|
||||||
$form = new ImportDeliciousForm($this);
|
$form = new ImportDeliciousForm($this);
|
||||||
@ -238,7 +245,6 @@ class ImportdeliciousAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return !$this->isPost();
|
return !$this->isPost();
|
||||||
@ -255,21 +261,19 @@ class ImportdeliciousAction extends Action
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ImportDeliciousForm extends Form
|
class ImportDeliciousForm extends Form
|
||||||
{
|
{
|
||||||
const FILEINPUT = 'deliciousbackupfile';
|
const FILEINPUT = 'deliciousbackupfile';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* Set the encoding type, since this is a file upload.
|
* Set the encoding type, since this is a file upload.
|
||||||
*
|
*
|
||||||
* @param HTMLOutputter $out output channel
|
* @param HTMLOutputter $out output channel
|
||||||
*
|
*
|
||||||
* @return ImportDeliciousForm this
|
* @return ImportDeliciousForm this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out=null)
|
function __construct($out=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
@ -281,7 +285,6 @@ class ImportDeliciousForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string the form's class
|
* @return string the form's class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_import_delicious';
|
return 'form_import_delicious';
|
||||||
@ -292,7 +295,6 @@ class ImportDeliciousForm extends Form
|
|||||||
*
|
*
|
||||||
* @return string the form's action URL
|
* @return string the form's action URL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('importdelicious');
|
return common_local_url('importdelicious');
|
||||||
@ -300,19 +302,19 @@ class ImportDeliciousForm extends Form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Output form data
|
* Output form data
|
||||||
*
|
*
|
||||||
* Really, just instructions for doing a backup.
|
* Really, just instructions for doing a backup.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('p', 'instructions');
|
$this->out->elementStart('p', 'instructions');
|
||||||
|
|
||||||
|
// TRANS: Form instructions for importing bookmarks.
|
||||||
$this->out->raw(_m('You can upload a backed-up '.
|
$this->out->raw(_m('You can upload a backed-up '.
|
||||||
'delicious.com bookmarks file.'));
|
'delicious.com bookmarks file.'));
|
||||||
|
|
||||||
$this->out->elementEnd('p');
|
$this->out->elementEnd('p');
|
||||||
|
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
@ -328,7 +330,7 @@ class ImportDeliciousForm extends Form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Buttons for the form
|
* Buttons for the form
|
||||||
*
|
*
|
||||||
* In this case, a single submit button
|
* In this case, a single submit button
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -337,9 +339,11 @@ class ImportDeliciousForm extends Form
|
|||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit',
|
$this->out->submit('submit',
|
||||||
|
// TRANS: Button text on form to import bookmarks.
|
||||||
_m('BUTTON', 'Upload'),
|
_m('BUTTON', 'Upload'),
|
||||||
'submit',
|
'submit',
|
||||||
null,
|
null,
|
||||||
_m('Upload the file'));
|
// TRANS: Button title on form to import bookmarks.
|
||||||
|
_m('Upload the file.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Add a new bookmark
|
* Add a new bookmark
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -43,7 +43,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NewbookmarkAction extends Action
|
class NewbookmarkAction extends Action
|
||||||
{
|
{
|
||||||
protected $user = null;
|
protected $user = null;
|
||||||
@ -59,9 +58,9 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string Action title
|
* @return string Action title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title for action to create a new bookmark.
|
||||||
return _m('New bookmark');
|
return _m('New bookmark');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +71,6 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
@ -80,7 +78,8 @@ class NewbookmarkAction extends Action
|
|||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
throw new ClientException(_m("Must be logged in to post a bookmark."),
|
// TRANS: Client exception thrown when trying to create a new bookmark while not logged in.
|
||||||
|
throw new ClientException(_m('Must be logged in to post a bookmark.'),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +102,6 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
parent::handle($argarray);
|
parent::handle($argarray);
|
||||||
@ -122,7 +120,6 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newBookmark()
|
function newBookmark()
|
||||||
{
|
{
|
||||||
if ($this->boolean('ajax')) {
|
if ($this->boolean('ajax')) {
|
||||||
@ -130,10 +127,12 @@ class NewbookmarkAction extends Action
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (empty($this->title)) {
|
if (empty($this->title)) {
|
||||||
|
// TRANS: Client exception thrown when trying to create a new bookmark without a title.
|
||||||
throw new ClientException(_m('Bookmark must have a title.'));
|
throw new ClientException(_m('Bookmark must have a title.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->url)) {
|
if (empty($this->url)) {
|
||||||
|
// TRANS: Client exception thrown when trying to create a new bookmark without a URL.
|
||||||
throw new ClientException(_m('Bookmark must have an URL.'));
|
throw new ClientException(_m('Bookmark must have an URL.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +158,8 @@ class NewbookmarkAction extends Action
|
|||||||
$this->xw->startDocument('1.0', 'UTF-8');
|
$this->xw->startDocument('1.0', 'UTF-8');
|
||||||
$this->elementStart('html');
|
$this->elementStart('html');
|
||||||
$this->elementStart('head');
|
$this->elementStart('head');
|
||||||
// TRANS: Page title after sending a notice.
|
// TRANS: Page title after posting a bookmark.
|
||||||
$this->element('title', null, _m('Notice posted'));
|
$this->element('title', null, _m('Bookmark posted'));
|
||||||
$this->elementEnd('head');
|
$this->elementEnd('head');
|
||||||
$this->elementStart('body');
|
$this->elementStart('body');
|
||||||
$this->showNotice($saved);
|
$this->showNotice($saved);
|
||||||
@ -192,7 +191,6 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
if (!empty($this->error)) {
|
if (!empty($this->error)) {
|
||||||
@ -219,7 +217,6 @@ class NewbookmarkAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||||
@ -230,4 +227,3 @@ class NewbookmarkAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2010, StatusNet, Inc.
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
*
|
*
|
||||||
* Notice stream of notices with a given attachment
|
* Notice stream of notices with a given attachment
|
||||||
*
|
*
|
||||||
* PHP version 5
|
* PHP version 5
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NoticebyurlAction extends Action
|
class NoticebyurlAction extends Action
|
||||||
{
|
{
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
@ -59,15 +58,15 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($argarray)
|
function prepare($argarray)
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
|
|
||||||
$this->file = File::staticGet('id', $this->trimmed('id'));
|
$this->file = File::staticGet('id', $this->trimmed('id'));
|
||||||
|
|
||||||
if (empty($this->file)) {
|
if (empty($this->file)) {
|
||||||
throw new ClientException(_m('Unknown URL'));
|
// TRANS: Client exception thrown when an unknown URL is provided.
|
||||||
|
throw new ClientException(_m('Unknown URL.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$pageArg = $this->trimmed('page');
|
$pageArg = $this->trimmed('page');
|
||||||
@ -85,13 +84,16 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->page == 1) {
|
if ($this->page == 1) {
|
||||||
return sprintf(_m("Notices linking to %s"), $this->file->url);
|
// TRANS: Title of notice stream of notices with a given attachment (first page).
|
||||||
|
// TRANS: %s is the URL.
|
||||||
|
return sprintf(_m('Notices linking to %s'), $this->file->url);
|
||||||
} else {
|
} else {
|
||||||
return sprintf(_m("Notices linking to %1$s, page %2$d"),
|
// TRANS: Title of notice stream of notices with a given attachment (all but first page).
|
||||||
|
// TRANS: %1$s is the URL, %2$s is the page number.
|
||||||
|
return sprintf(_m('Notices linking to %1$s, page %2$d'),
|
||||||
$this->file->url,
|
$this->file->url,
|
||||||
$this->page);
|
$this->page);
|
||||||
}
|
}
|
||||||
@ -104,7 +106,6 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($argarray=null)
|
function handle($argarray=null)
|
||||||
{
|
{
|
||||||
$this->showPage();
|
$this->showPage();
|
||||||
@ -117,7 +118,6 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
$nl = new NoticeList($this->notices, $this);
|
$nl = new NoticeList($this->notices, $this);
|
||||||
@ -142,7 +142,6 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -169,7 +168,6 @@ class NoticebyurlAction extends Action
|
|||||||
*
|
*
|
||||||
* @return string etag http header
|
* @return string etag http header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -50,7 +50,6 @@ class ShowbookmarkAction extends ShownoticeAction
|
|||||||
|
|
||||||
function getNotice()
|
function getNotice()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->id = $this->trimmed('id');
|
$this->id = $this->trimmed('id');
|
||||||
|
|
||||||
$this->bookmark = Bookmark::staticGet('id', $this->id);
|
$this->bookmark = Bookmark::staticGet('id', $this->id);
|
||||||
|
@ -205,7 +205,7 @@ class QnAPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
$questionObj = $activity->objects[0];
|
$questionObj = $activity->objects[0];
|
||||||
|
|
||||||
if ($questinoObj->type != QnA_Question::OBJECT_TYPE) {
|
if ($questionObj->type != QnA_Question::OBJECT_TYPE) {
|
||||||
throw new Exception('Wrong type for object.');
|
throw new Exception('Wrong type for object.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user