Merge remote-tracking branch 'origin/master'

This commit is contained in:
Evan Prodromou 2013-06-15 11:13:57 -04:00
commit 67f80e8503
8 changed files with 42 additions and 11 deletions

View File

@ -65,6 +65,12 @@ class ApiFavoriteCreateAction extends ApiAuthAction
$this->user = $this->auth_user;
$this->notice = Notice::staticGet($this->arg('id'));
if ($this->notice->repeat_of != '' ) {
common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of);
common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
$this->notice = Notice::staticGet($real_notice_id);
}
return true;
}

View File

@ -65,6 +65,12 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
$this->user = $this->auth_user;
$this->notice = Notice::staticGet($this->arg('id'));
if ($this->notice->repeat_of != '' ) {
common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id);
common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
$this->notice = Notice::staticGet($real_notice_id);
}
return true;
}

View File

@ -31,6 +31,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR . '/lib/applicationlist.php';
require_once INSTALLDIR . '/lib/statusnetoauthstore.php';
/**
* Show a user's registered OAuth applications
*

View File

@ -55,7 +55,7 @@ class ClientSideShortenPlugin extends Plugin
$user = common_current_user();
$action->inlineScript('var maxNoticeLength = ' . User_urlshortener_prefs::maxNoticeLength($user));
$action->inlineScript('var maxUrlLength = ' . User_urlshortener_prefs::maxUrlLength($user));
$action->script('plugins/ClientSideShorten/shorten.js');
$action->script($this->path('shorten.js'));
}
}

View File

@ -33,6 +33,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
class InfiniteScrollPlugin extends Plugin
{
public $on_next_only = false;
function __construct()
{
parent::__construct();
@ -41,6 +44,7 @@ class InfiniteScrollPlugin extends Plugin
function onEndShowScripts($action)
{
$action->inlineScript('var infinite_scroll_on_next_only = ' . ($this->on_next_only?'true':'false') . ';');
$action->inlineScript('var ajax_loader_url = "' . ($this->path('ajax-loader.gif')) . '";');
$action->script($this->path('jquery.infinitescroll.js'));
$action->script($this->path('infinitescroll.js'));
}

View File

@ -9,7 +9,7 @@ jQuery(document).ready(function($){
'body#showfavorites li.nav_next a,'+
'body#showgroup li.nav_next a,'+
'body#favorited li.nav_next a',
loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
loadingImg : ajax_loader_url,
text : "<em>Loading the next set of posts...</em>",
donetext : "<em>Congratulations, you\'ve reached the end of the Internet.</em>",
navSelector : "#pagination",

View File

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'u:a';
$longoptions = array('uri=', 'all');

View File

@ -172,8 +172,8 @@ class TwitterImport
$notice->is_local = Notice::GATEWAY;
$notice->content = html_entity_decode($status->text, ENT_QUOTES, 'UTF-8');
$notice->rendered = $this->linkify($status);
$notice->content = html_entity_decode($this->linkify($status, FALSE), ENT_QUOTES, 'UTF-8');
$notice->rendered = $this->linkify($status, TRUE);
if (Event::handle('StartNoticeSave', array(&$notice))) {
@ -540,7 +540,7 @@ class TwitterImport
const HASHTAG = 2;
const MENTION = 3;
function linkify($status)
function linkify($status, $html = FALSE)
{
$text = $status->text;
@ -596,13 +596,21 @@ class TwitterImport
$orig = $this->twitEscape(mb_substr($text, $start, $end - $start));
switch($type) {
case self::URL:
$linkText = $this->makeUrlLink($object, $orig);
$linkText = $this->makeUrlLink($object, $orig, $html);
break;
case self::HASHTAG:
$linkText = $this->makeHashtagLink($object, $orig);
if ($html) {
$linkText = $this->makeHashtagLink($object, $orig);
}else{
$linkText = $orig;
}
break;
case self::MENTION:
$linkText = $this->makeMentionLink($object, $orig);
if ($html) {
$linkText = $this->makeMentionLink($object, $orig);
}else{
$linkText = $orig;
}
break;
default:
$linkText = $orig;
@ -630,9 +638,13 @@ class TwitterImport
return htmlspecialchars(html_entity_decode($str, ENT_COMPAT, 'UTF-8'));
}
function makeUrlLink($object, $orig)
function makeUrlLink($object, $orig, $html)
{
return "<a href='{$object->url}' class='extlink'>{$orig}</a>";
if ($html) {
return '<a href="'.htmlspecialchars($object->expanded_url).'" class="extlink">'.htmlspecialchars($object->display_url).'</a>';
}else{
return htmlspecialchars($object->expanded_url);
}
}
function makeHashtagLink($object, $orig)