v3: major change

qvitter is now a plugin
This commit is contained in:
Hannes Mannerheim 2014-05-14 09:46:07 +02:00
parent 19ad3abdac
commit bbf123b664
44 changed files with 5736 additions and 10504 deletions

216
QvitterPlugin.php Normal file
View File

@ -0,0 +1,216 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
class QvitterPlugin extends Plugin {
public function settings($setting)
{
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· S E T T I N G S ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
// ENABLED BY DEFAULT (true/false)
$settings['enabledbydefault'] = true;
// DEFAULT BACKGROUND COLOR
$settings['defaultbackgroundcolor'] = '#f4f4f4';
// DEFAULT LINK COLOR
$settings['defaultlinkcolor'] = '#0084B4';
// TIME BETWEEN POLLING
$settings['timebetweenpolling'] = 5000; // ms
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· (o> >o) ·
· \\\\_\ /_//// .
· \____) (____/ ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
return $settings[$setting];
}
public function onRouterInitialized($m)
{
$m->connect('api/qvitter.json', array('action' => 'qvitterapi'));
$m->connect('api/statuses/public_and_external_timeline.:format',
array('action' => 'ApiTimelinePublicAndExternal',
'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/qvitter/update_link_color.json',
array('action' => 'apiqvitterupdatelinkcolor'));
$m->connect('api/qvitter/update_background_color.json',
array('action' => 'apiqvitterupdatebackgroundcolor'));
$m->connect('settings/qvitter',
array('action' => 'qvittersettings'));
$m->connect('main/qlogin',
array('action' => 'qvitterlogin'));
// check if we should reroute UI to qvitter
$logged_in_user = common_current_user();
$qvitter_enabled_by_user = false;
$qvitter_disabled_by_user = false;
if($logged_in_user) {
try {
$qvitter_enabled_by_user = Profile_prefs::getData($logged_in_user->getProfile(), 'qvitter', 'enable_qvitter');
} catch (NoResultException $e) {
$qvitter_enabled_by_user = false;
}
try {
$qvitter_disabled_by_user = Profile_prefs::getData($logged_in_user->getProfile(), 'qvitter', 'disable_qvitter');
} catch (NoResultException $e) {
$qvitter_disabled_by_user = false;
}
}
if((self::settings('enabledbydefault') && !$logged_in_user) ||
(self::settings('enabledbydefault') && !$qvitter_disabled_by_user) ||
(!self::settings('enabledbydefault') && $qvitter_enabled_by_user)) {
$m->connect('', array('action' => 'qvitter'));
$m->connect('main/all', array('action' => 'qvitter'));
$m->connect('search/notice', array('action' => 'qvitter'));
URLMapperOverwrite::overwrite_variable($m, ':nickname',
array('action' => 'showstream'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/',
array('action' => 'showstream'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/all',
array('action' => 'all'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/subscriptions',
array('action' => 'subscriptions'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/subscribers',
array('action' => 'subscribers'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/groups',
array('action' => 'usergroups'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/replies',
array('action' => 'replies'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, ':nickname/favorites',
array('action' => 'showfavorites'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, 'group/:nickname',
array('action' => 'showgroup'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
URLMapperOverwrite::overwrite_variable($m, 'group/:nickname/members',
array('action' => 'groupmembers'),
array('nickname' => Nickname::DISPLAY_FMT),
'qvitter');
$m->connect('group/:nickname/admins',
array('action' => 'qvitter'),
array('nickname' => Nickname::DISPLAY_FMT));
URLMapperOverwrite::overwrite_variable($m, 'tag/:tag',
array('action' => 'showstream'),
array('tag' => Router::REGEX_TAG),
'qvitter');
}
}
/**
* Menu item for Qvitter
*
* @param Action $action action being executed
*
* @return boolean hook return
*/
function onEndAccountSettingsNav($action)
{
$action_name = $action->trimmed('action');
$action->menuItem(common_local_url('qvittersettings'),
// TRANS: Poll plugin menu item on user settings page.
_m('MENU', 'Qvitter'),
// TRANS: Poll plugin tooltip for user settings menu item.
_m('Enable/Disable Qvitter UI'),
$action_name === 'qvittersettings');
return true;
}
}
/**
* Overwrites variables in URL-mapping
*
*/
class URLMapperOverwrite extends URLMapper
{
function overwrite_variable($m, $path, $args, $paramPatterns, $newaction)
{
$m->connect($path, array('action' => $newaction), $paramPatterns);
$regex = URLMapper::makeRegex($path, $paramPatterns);
foreach($m->variables as $n=>$v)
if($v[1] == $regex)
$m->variables[$n][0]['action'] = $newaction;
}
}
?>

View File

@ -2,8 +2,8 @@ Qvitter
==========================================
* Author: Hannes Mannerheim (<h@nnesmannerhe.im>)
* Last mod.: November, 2013
* Version: 2
* Last mod.: May, 2014
* Version: 3
* GitHub: <https://github.com/hannesmannerheim/qvitter>
Qvitter is free software: you can redistribute it and / or modify it
@ -22,19 +22,20 @@ along with Qvitter. If not, see <http://www.gnu.org/licenses/>.
Setup
-----
1. You need a webserver with PHP support.
1. Install GNU Social
2. Edit settings.php.
2. Put all files in /plugins/Qvitter
3. You should really put some security-by-obscurity-stuff in the registration process. E-mail h@nnesmannerhe.im if you want to copy mine.
3. Add `addPlugin('Qvitter')` to your /config.php file;
Qvitter uses a slightly modified statusnet API. Some things will not work
if you connect to a site with standard API. Files are included if you want
to Qvitter-mod your Statusnet API.
4. There are a few settings in /plugins/Qvitter/QvitterPlugin.php. By default Qvitter is
opt-out for users. If you set `$settings['enabledbydefault'] = false;` Qvitter will
be opt-in instead.
Recently MMN-o has implemented these API-changes in GNU Social. The API changes should
only be needed if you are running Statusnet 1.1.1, not if you have a recent GNU Social
version.
5. Users can go to ://{instance}/settings/qvitter and enable or disable Qvitter.
NOTE: Qvitter is now a plugin for GNU Social. There will probably be bugs because of
this change.
TODO
@ -52,7 +53,7 @@ TODO
7. Settings (e.g. don't show replies to people I don't follow)
9. Image/file upload, drag-n-drop!
9. Image/file upload
10. Search users
@ -60,14 +61,16 @@ TODO
12. Filters (hide queets containing strings, e.g. mute users)
14. More languages
14. More languages, maybe make proper po/mo-files
15. Queet-page
15. Notice-page
16. Admin-interface
16. New api for serving _number_ of new items in several streams (to show number of new items in menu/history)
17. Notifications-page with likes and repeats
17. New "expand queet" api for getting conversation, retweets, favs and attachment in the same request
19. Node.js long polling server and an new api that serve aggregate of all polling users requests in one go

View File

@ -0,0 +1,89 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterUpdateBackgroundColorAction extends ApiAuthAction
{
var $backgroundcolor = null;
protected $needPost = true;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
protected function prepare(array $args=array())
{
parent::prepare($args);
$this->backgroundcolor = $this->trimmed('backgroundcolor');
return true;
}
/**
* Handle the request
*
* Try to save the user's colors in her design. Create a new design
* if the user doesn't already have one.
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
$validhex = preg_match('/^[a-f0-9]{6}$/i',$this->backgroundcolor);
if ($validhex === false || $validhex == 0) {
$this->clientError(_('Not a valid hex color.'), 400);
}
Profile_prefs::setData($this->scoped, 'theme', 'backgroundcolor', $this->backgroundcolor);
$twitter_user = $this->twitterUserArray($this->scoped, true);
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}

View File

@ -0,0 +1,90 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterUpdateLinkColorAction extends ApiAuthAction
{
var $linkcolor = null;
protected $needPost = true;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
protected function prepare(array $args=array())
{
parent::prepare($args);
$this->linkcolor = $this->trimmed('linkcolor');
return true;
}
/**
* Handle the request
*
* Try to save the user's colors in her design. Create a new design
* if the user doesn't already have one.
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
$validhex = preg_match('/^[a-f0-9]{6}$/i',$this->linkcolor);
if ($validhex === false || $validhex == 0) {
$this->clientError(_('Not a valid hex color.'), 400);
}
// save the new color
Profile_prefs::setData($this->scoped, 'theme', 'linkcolor', $this->linkcolor);
$twitter_user = $this->twitterUserArray($this->scoped, true);
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}

View File

@ -38,8 +38,6 @@ if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiprivateauth.php';
/**
* Returns the most recent notices (default 20) posted by everybody
*

350
actions/qvitter.php Normal file
View File

@ -0,0 +1,350 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
class QvitterAction extends Action
{
function isReadOnly($args)
{
return true;
}
protected function prepare(array $args=array())
{
parent::prepare($args);
$user = common_current_user();
return true;
}
protected function handle()
{
parent::handle();
$this->showQvitter();
}
function showQvitter()
{
$logged_in_user_nickname = '';
$logged_in_user = common_current_user();
if($logged_in_user) {
$logged_in_user_nickname = $logged_in_user->nickname;
}
$sitetitle = common_config('site','name');
$siterootdomain = common_config('site','server');
$qvitterpath = Plugin::staticPath('Qvitter', '');
$apiroot = common_path('api/', true);
$instanceurl = common_path('', true);
common_set_returnto(''); // forget this
// if this is a profile we add a link header for LRDD Discovery (see WebfingerPlugin.php)
if(substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
$acct = 'acct:'. $nickname .'@'. common_config('site', 'server');
$url = common_local_url('webfinger') . '?resource='.$acct;
foreach (array(Discovery::JRD_MIMETYPE, Discovery::XRD_MIMETYPE) as $type) {
header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="'.$type.'"');
}
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print $sitetitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/qvitter.css?v=15" />
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/jquery.minicolors.css" />
<link rel="shortcut icon" type="image/x-icon" href="<?php print $qvitterpath; ?>favicon.ico?v=2">
<?php
// if qvitter is a webapp and this is a users url we add feeds
if(substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
$user = User::getKV('nickname', $nickname);
if(!isset($user->id)) {
error_log("QVITTER: Could not get user id for user with nickname: $nickname REQUEST_URI: ".$_SERVER['REQUEST_URI']);
}
else {
print '<link title="Notice feed for '.$nickname.' (Activity Streams JSON)" type="application/stream+json" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.as" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 1.0)" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 2.0)" type="application/rss+xml" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (Atom)" type="application/atom+xml" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.atom" rel="alternate">'."\n";
print ' <link title="FOAF for '.$nickname.'" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/foaf" rel="meta">'."\n";
print ' <link href="'.$instanceurl.$nickname.'/microsummary" rel="microsummary">'."\n";
}
}
}
elseif(substr($_SERVER['REQUEST_URI'],0,7) == '/group/') {
$group_id_or_name = substr($_SERVER['REQUEST_URI'],7);
if(stristr($group_id_or_name,'/id')) {
$group_id_or_name = substr($group_id_or_name, 0, strpos($group_id_or_name,'/id'));
$group = User_group::getKV('id', $group_id_or_name);
$group_name = $group->nickname;
$group_id = $group_id_or_name;
}
else {
$group = User_group::getKV('nickname', $group_id_or_name);
$group_id = $group->id;
$group_name = $group_id_or_name;
}
if(preg_match("/^[a-zA-Z0-9]+$/", $group_id_or_name) == 1) {
print '<link rel="alternate" href="'.$apiroot.'statusnet/groups/timeline/'.$group_id.'.as" type="application/stream+json" title="Notice feed for '.$group_id_or_name.' group (Activity Streams JSON)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'group/'.$group_name.'/rss" type="application/rdf+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 1.0)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'api/statusnet/groups/timeline/'.$group_id.'.rss" type="application/rss+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 2.0)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'api/statusnet/groups/timeline/'.$group_id.'.atom" type="application/atom+xml" title="Notice feed for '.$group_id_or_name.' group (Atom)"/>'."\n";
print ' <link rel="meta" href="'.$instanceurl.'group/'.$group_name.'/foaf" type="application/rdf+xml" title="FOAF for '.$group_id_or_name.' group"/>'."\n";
}
}
?>
<script>
window.siteTitle = '<?php print $sitetitle ?>';
window.isLoggedIn = <?php if($logged_in_user) { print 'true'; } else { print 'false'; } ?>;
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
window.qvitterApiRoot = '<?php print common_path("api/qvitter.json", true); ?>';
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';
window.defaultLinkColor = '<?php print QvitterPlugin::settings("defaultlinkcolor"); ?>';
window.defaultBackgroundColor = '<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>';
</script>
<style>
a, a:visited, a:active,
ul.stats li:hover a,
ul.stats li:hover a strong,
#user-body a:hover div strong,
#user-body a:hover div div,
.permalink-link:hover,
.stream-item.expanded > .queet .stream-item-expand,
.stream-item-footer .with-icn .requeet-text a b:hover,
.queet-text span.attachment.more,
.stream-item-header .created-at a:hover,
.stream-item-header a.account-group:hover .name,
.queet:hover .stream-item-expand,
.show-full-conversation:hover,
#new-queets-bar,
.menu-container div,
#user-header:hover #user-name,
.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email {
color:#0084B4;/*COLOREND*/
}
.topbar .global-nav,
.menu-container {
background-color:#0084B4;/*BACKGROUNDCOLOREND*/
}
</style>
</head>
<body style="background-color:<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>">
<div class="topbar">
<a href="<?php print $instanceurl; ?>"><div id="logo"></div></a>
<a id="settingslink">
<div class="dropdown-toggle">
<i class="nav-session"></i>
<b class="caret"></b>
</div>
</a>
<div id="top-compose" class="hidden"></div>
<ul class="quitter-settings dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</li>
<li><a id="settings"></a></li>
<?php
if($siterootdomain == 'quitter.se') { print '<li><a id="classic" href="https://old.quitter.se/">Classic Quitter</a></li>'; } // sry for this junk
?><li class="dropdown-divider"></li>
<li><a id="logout"></a></li>
<li class="language dropdown-divider"></li>
<li class="language"><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li class="language"><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li class="language"><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li class="language"><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li class="language"><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li class="language"><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li class="language"><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li class="language"><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li class="language"><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
<div id="birds-top"></div>
<div class="global-nav">
<div class="global-nav-inner">
<div class="container">
<div id="search">
<input type="text" spellcheck="false" autocomplete="off" name="q" placeholder="Sök" id="search-query" class="search-input">
<span class="search-icon">
<button class="icon nav-search" type="submit" tabindex="-1">
<span> Sök </span>
</button>
</span>
<input type="text" spellcheck="false" autocomplete="off" id="search-query-hint" class="search-input search-hinting-input" disabled="disabled">
</div>
<ul class="language-dropdown">
<li class="dropdown">
<a class="dropdown-toggle">
<small></small>
<span class="current-language"></span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</li>
<li><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="page-container">
<div class="front-welcome-text">
<h1></h1>
<p></p>
</div>
<div id="user-container" style="display:none;">
<div id="login-content">
<form id="form_login" class="form_settings" action="<?php print common_local_url('qvitterlogin'); ?>" method="post">
<div id="username-container">
<input id="nickname" name="nickname" type="text" value="<?php print $logged_in_user_nickname ?>" tabindex="1" />
</div>
<table class="password-signin"><tbody><tr>
<td class="flex-table-primary">
<div class="placeholding-input">
<input id="password" name="password" type="password" tabindex="2" value="" />
</div>
</td>
<td class="flex-table-secondary">
<button class="submit" type="submit" id="submit-login" tabindex="4"></button>
</td>
</tr></tbody></table>
<div id="remember-forgot">
<input type="checkbox" id="rememberme" name="rememberme" value="yes" tabindex="3" checked="checked"> <span id="rememberme_label"></span> · <a href="<?php print $instanceurl ?>main/recoverpassword"></a>
<input type="hidden" id="token" name="token" value="<?php print common_session_token(); ?>">
</div>
</form>
</div>
<div class="front-signup">
<h2></h2>
<div class="signup-input-container"><input placeholder="" type="text" name="user[name]" autocomplete="off" class="text-input" id="signup-user-name"></div>
<div class="signup-input-container"><input placeholder="" type="text" name="user[email]" autocomplete="off" id="signup-user-email"></div>
<div class="signup-input-container"><input placeholder="" type="password" name="user[user_password]" class="text-input" id="signup-user-password"></div>
<button id="signup-btn-step1" class="signup-btn" type="submit"></button>
<div id="other-servers-link"></div>
</div>
<div id="user-header">
<img id="user-avatar" src="" />
<div id="user-name"></div>
<div id="user-screen-name"></div>
<div id="user-profile-link"></div>
</div>
<div id="user-body">
<a><div id="user-queets"><strong></strong><div class="label"></div></div></a>
<a><div id="user-following"><strong></strong><div class="label"></div></div></a>
<a><div id="user-followers"><strong></strong><div class="label"></div></div></a>
<a><div id="user-groups"><strong></strong><div class="label"></div></div></a>
</div>
<div id="user-footer">
<textarea id="codemirror-queet-box"></textarea>
<div id="queet-box" class="queet-box"></div>
<div id="queet-toolbar">
<div id="queet-box-extras"></div>
<div id="queet-button">
<span id="queet-counter"></span>
<button id="queet"></button>
</div>
</div>
</div>
<div class="menu-container">
<a class="stream-selection friends-timeline" data-stream-header="" data-stream-name="statuses/friends_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection mentions" data-stream-header="" data-stream-name="statuses/mentions.json"><i class="chev-right"></i></a>
<a class="stream-selection my-timeline" data-stream-header="@statuses/user_timeline.json" data-stream-name="statuses/user_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection favorites" data-stream-header="" data-stream-name="favorites.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>" class="stream-selection public-timeline" data-stream-header="" data-stream-name="statuses/public_timeline.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>main/all" class="stream-selection public-and-external-timeline" data-stream-header="" data-stream-name="statuses/public_and_external_timeline.json?since_id=1"><i class="chev-right"></i></a>
</div>
<div class="menu-container" id="history-container"></div>
</div>
<div id="feed">
<div id="feed-header">
<div id="feed-header-inner">
<h2></h2>
</div>
</div>
<div id="new-queets-bar-container" class="hidden"><div id="new-queets-bar"></div></div>
<div id="feed-body"></div>
</div>
<div id="footer"></div>
</div>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/codemirror.4.0.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.minicolors.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=18"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=11"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=5"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=14"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=13"></script>
</body>
</html>
<?
}
}

View File

@ -34,57 +34,66 @@
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
require_once('settings.php');
class QvitterApiAction extends ApiAction
{
header("Content-type: application/json; charset=utf-8");
protected $needPost = true;
protected function prepare(array $args=array())
{
parent::prepare($args);
return true;
}
protected function handle()
{
parent::handle();
$apiroot = common_path('api/', true);
header("Content-type: application/json; charset=utf-8");
// post requests
if(isset($_POST['postRequest'])) {
$query = http_build_query($_POST, '', '&');
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $apiroot.urldecode($_POST['postRequest']));
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
session_write_close(); // fix problem with curling to local
$reply=curl_exec($ch);
curl_close($ch);
// get requests
} elseif(isset($_POST['getRequest'])) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $apiroot.$_POST['getRequest']);
if(isset($_POST['username'])) {
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
session_write_close();
$reply=curl_exec($ch);
curl_close($ch);
} else {
// 400 Bad request, since neither postRequest or getRequest were included
http_response_code(400);
exit;
}
session_start();
echo $reply;
}
// add slash if missing
if(substr($apiroot,-1) != '/') {
$apiroot .= '/';
}
// post requests
if(isset($_POST['postRequest'])) {
$query = http_build_query($_POST, '', '&');
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $apiroot.urldecode($_POST['postRequest']));
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
session_write_close(); // fix problem with curling to local
$reply=curl_exec($ch);
curl_close($ch);
// get requests
} elseif(isset($_POST['getRequest'])) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $apiroot.$_POST['getRequest']);
if(isset($_POST['username'])) {
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
session_write_close();
$reply=curl_exec($ch);
curl_close($ch);
} else {
// 400 Bad request, since neither postRequest or getRequest were included
http_response_code(400);
exit;
}
session_start();
// force ssl on our domain
if($forcessl) {
$reply = str_replace('http://'.$siterootdomain,'https://'.$siterootdomain, $reply);
}
echo $reply;
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· (o> >o) ·

137
actions/qvitterlogin.php Normal file
View File

@ -0,0 +1,137 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class QvitterLoginAction extends FormAction
{
protected $needLogin = false;
/**
* Prepare page to run
*
*
* @param $args
* @return string title
*/
protected function prepare(array $args=array())
{
// @todo this check should really be in index.php for all sensitive actions
$ssl = common_config('site', 'ssl');
if (empty($_SERVER['HTTPS']) && ($ssl == 'always' || $ssl == 'sometimes')) {
common_redirect(common_local_url('login'));
}
return parent::prepare($args);
}
/**
* Handle input, produce output
*
* Switches on request method; either shows the form or handles its input.
*
* @return void
*/
protected function handle()
{
if (common_is_real_login()) {
common_redirect(common_local_url('all', array('nickname' => $this->scoped->nickname)), 307);
}
return parent::handle();
}
/**
* Check the login data
*
* Determines if the login data is valid. If so, logs the user
* in, and redirects to the 'with friends' page, or to the stored
* return-to URL.
*
* @return void
*/
protected function handlePost()
{
parent::handlePost();
// XXX: login throttle
$nickname = $this->trimmed('nickname');
$password = $this->arg('password');
$user = common_check_user($nickname, $password);
if (!$user instanceof User) {
// TRANS: Form validation error displayed when trying to log in with incorrect credentials.
throw new ServerException(_('Incorrect username or password.'));
}
// success!
if (!common_set_user($user)) {
// TRANS: Server error displayed when during login a server error occurs.
throw new ServerException(_('Error setting user. You are probably not authorized.'));
}
common_real_login(true);
$this->updateScopedProfile();
if ($this->boolean('rememberme')) {
common_rememberme($user);
}
$url = common_get_returnto();
if ($url) {
// We don't have to return to it again
common_set_returnto(null);
$url = common_inject_session($url);
} else {
$url = common_local_url('all',
array('nickname' => $this->scoped->nickname));
}
common_redirect($url, 303);
}
function showPage()
{
QvitterAction::showQvitter();
}
}

213
actions/qvittersettings.php Normal file
View File

@ -0,0 +1,213 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
class QvitterSettingsAction extends SettingsAction
{
/**
* Title of the page
*
* @return string Page title
*/
function title()
{
// TRANS: Page title.
return _m('Qvitter settings');
}
/**
* Instructions for use
*
* @return string Instructions for use
*/
function getInstructions()
{
// TRANS: Page instructions.
return _m('Enable or disable Qvitter UI');
}
/**
* Show the form for Qvitter
*
* @return void
*/
function showContent()
{
$user = common_current_user();
if(QvitterPlugin::settings('enabledbydefault')) {
try {
$prefs = Profile_prefs::getData($user->getProfile(), 'qvitter', 'disable_qvitter');
} catch (NoResultException $e) {
$prefs = false;
}
} else {
try {
$prefs = Profile_prefs::getData($user->getProfile(), 'qvitter', 'enable_qvitter');
} catch (NoResultException $e) {
$prefs = false;
}
}
$form = new QvitterPrefsForm($this, $prefs);
$form->show();
}
/**
* Handler method
*
* @param array $argarray is ignored since it's now passed in in prepare()
*
* @return void
*/
function handlePost()
{
$user = common_current_user();
if(QvitterPlugin::settings('enabledbydefault')) {
Profile_prefs::setData($user->getProfile(), 'qvitter', 'disable_qvitter', $this->boolean('disable_qvitter'));
}
else {
Profile_prefs::setData($user->getProfile(), 'qvitter', 'enable_qvitter', $this->boolean('enable_qvitter'));
}
// TRANS: Confirmation shown when user profile settings are saved.
$this->showForm(_('Settings saved.'), true);
return;
}
}
class QvitterPrefsForm extends Form
{
var $prefs;
function __construct($out, $prefs)
{
parent::__construct($out);
$this->prefs = $prefs;
}
/**
* Visible or invisible data elements
*
* Display the form fields that make up the data of the form.
* Sub-classes should overload this to show their data.
*
* @return void
*/
function formData()
{
if(QvitterPlugin::settings('enabledbydefault')) {
$enabledisable = 'disable_qvitter';
$enabledisablelabel = _('Disable Qvitter');
} else {
$enabledisable = 'enable_qvitter';
$enabledisablelabel = _('Enable Qvitter');
}
$this->elementStart('fieldset');
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->checkbox($enabledisable,
$enabledisablelabel,
(!empty($this->prefs)));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
}
/**
* Buttons for form actions
*
* Submit and cancel buttons (or whatever)
* Sub-classes should overload this to show their own buttons.
*
* @return void
*/
function formActions()
{
$this->submit('submit', _('Save'));
}
/**
* ID of the form
*
* Should be unique on the page. Sub-classes should overload this
* to show their own IDs.
*
* @return int ID of the form
*/
function id()
{
return 'form_qvitter_prefs';
}
/**
* Action of the form.
*
* URL to post to. Should be overloaded by subclasses to give
* somewhere to post to.
*
* @return string URL to post to
*/
function action()
{
return common_local_url('qvittersettings');
}
/**
* Class of the form. May include space-separated list of multiple classes.
*
* @return string the form's class
*/
function formClass()
{
return 'form_settings';
}
}

View File

@ -1,208 +0,0 @@
CHANGES TO API
--------------
* actions/apiattachment.php New api action
* actions/apistatusesfavs.php New api action
* actions/apicheckhub.php New api action (not used yet)
* actions/apiexternalprofileshow.php New api action
* actions/apigroupadmins.php New api action
* actions/apiaccountupdatelinkcolor.php New api action
* actions/apiaccountupdatelinkcolor.php New api action
* actions/apichecknickname.php New api action
* actions/apiaccountregister.php New api action
* actions/apitimelinepublicandexternal.php New api action
* lib/publicandexternalnoticestream.php
* lib/apiaction.php
- add urls to larger avatars, groupcount, linkcolor and backgroundcolor fields
~LINE 213
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() :
Avatar::defaultImage(AVATAR_STREAM_SIZE);
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$twitter_user['profile_image_url_profile_size'] = ($avatar) ? $avatar->displayUrl() :
Avatar::defaultImage(AVATAR_PROFILE_SIZE);
$avatar = $profile->getOriginalAvatar();
$twitter_user['profile_image_url_original'] = ($avatar) ? $avatar->displayUrl() :
Avatar::defaultImage(AVATAR_PROFILE_SIZE);
$twitter_user['groups_count'] = $profile->getGroups(0, null)->N;
$twitter_user['linkcolor'] = $user->linkcolor;
$twitter_user['backgroundcolor'] = $user->backgroundcolor;
- add the uri-field
~line 330
$twitter_status['uri'] = $notice->uri;
- show if a notices is favorited by auth_user
~line 355
if (isset($this->auth_user)) {
$this_profile = $this->auth_user->getProfile();
$twitter_status['favorited'] = $this->auth_user->hasFave($notice);
$twitter_status['repeated'] = $this_profile->hasRepeated($notice->id);
} else {
$twitter_status['favorited'] = false;
$twitter_status['repeated'] = false;
}
- show number of admins in group api
~line 414
$admins = $group->getAdmins();
$admin_count = 0; while($admins->fetch()) $admin_count++;
$twitter_group['admin_count'] = $admin_count;
- to be able to get group profile by uri.
- hackish though, because if uri get-var is sent, it will discard the id get var
- (but id still needs to be sent and be non-numerical, so I do "?id=foo&uri={uri}")
- should be possible to only supply uri get var, but I was lazy... sry
~line 1565
} else if ($this->arg('uri')) {
return User_group::staticGet('uri', urldecode($this->arg('uri')));
* lib/router.php
- add routing for new api actions
~line 467:
$m->connect('api/statuses/favs/:id.json',
array('action' => 'ApiStatusesFavs',
'id' => '[0-9]+'));
$m->connect('api/attachment/:id.json',
array('action' => 'ApiAttachment',
'id' => '[0-9]+'));
$m->connect('api/checkhub.json',
array('action' => 'ApiCheckHub'));
$m->connect('api/externalprofile/show.json',
array('action' => 'ApiExternalProfileShow'));
$m->connect('api/statusnet/groups/admins/:id.:format',
array('action' => 'ApiGroupAdmins',
'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)'));
$m->connect('api/account/update_link_color.json',
array('action' => 'ApiAccountUpdateLinkColor'));
$m->connect('api/account/update_background_color.json',
array('action' => 'ApiAccountUpdateBackgroundColor'));
$m->connect('api/account/register.json',
array('action' => 'ApiAccountRegister'));
$m->connect('api/check_nickname.json',
array('action' => 'ApiCheckNickname'));
- also, tags need regexp to work with unicode charachters, e.g. farsi and arabic:
$m->connect('api/statusnet/tags/timeline/:tag.:format',
array('action' => 'ApiTimelineTag',
'tag' => self::REGEX_TAG,
'format' => '(xml|json|rss|atom|as)'));
* acitons/apiconversation.php
- I didn't always get Profile::current() to show me the auth user's profile, so I changed it to the normal $this->auth_user used in other api actions
~ line 80:
if(isset($this->auth_user)) {
$profile = $this->auth_user->getProfile();
} else {
$profile = null;
}
*actions/apitimelineuser.php
- this api did only return the public user timeline, not the auth user's.
- e.g. it did not show notices from people who post to "my colleques at quitter"
- changed to return timeline according to which auth user is requesting
~ line 238
$user_profile = $this->user->getProfile();
if(isset($this->auth_user)) {
$auth_user_profile = $this->auth_user->getProfile();
}
else {
$auth_user_profile = null;
}
$stream = new ProfileNoticeStream($user_profile, $auth_user_profile);
$notice = $stream->getNotices(($this->page-1) * $this->count,
$this->count + 1,
$this->since_id,
$this->max_id);
* search.json
- changed response to normal twitter format, maybe I should have created a new api action for that,
- but... i don't see the point in having a special format for searches, it should be same as other streams
* actions/timelinetags.php
- added max_id and since_id
~line 179
$notice = Notice_tag::getStream(
$this->tag,
($this->page - 1) * $this->count,
$this->count + 1,
$this->since_id,
$this->max_id
);
* actions/apistatusesupdate.php
- we don't want statuses to shorten if sent through the api
~ line 290:
//$status_shortened = $this->auth_user->shortenlinks($this->status);
$status_shortened = $this->status;
* classes/Notice.php
- to _not_ shorten urls sent through api, we need to comment out this also
~ line 352
// if ($user) {
// // Use the local user's shortening preferences, if applicable.
/ $final = $user->shortenLinks($content);
// } else {
// $final = common_shorten_links($content);
// }
* classes/User.php
- add fields "linkcolor" and "background_image_url" to user table (do this is the db too!)
~ line 64 public $linkcolor; // varchar(6)
public $background_image_url; // varchar(255)
~ line 105 'linkcolor' => array('type' => 'varchar', 'length' => 6, 'description' => 'hex link color'),
'background_image_url' => array('type' => 'varchar', 'length' => 255, 'description' => 'url to profile image'),

View File

@ -1,257 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Register account
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
class ApiAccountRegisterAction extends ApiAction
{
/**
* Has there been an error?
*/
var $error = null;
/**
* Have we registered?
*/
var $registered = false;
/**
* Are we processing an invite?
*/
var $invite = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->code = $this->trimmed('code');
if (empty($this->code)) {
common_ensure_session();
if (array_key_exists('invitecode', $_SESSION)) {
$this->code = $_SESSION['invitecode'];
}
}
if (common_config('site', 'inviteonly') && empty($this->code)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.'),404,'json');
return false;
}
if (!empty($this->code)) {
$this->invite = Invitation::staticGet('code', $this->code);
if (empty($this->invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation.
$this->clientError(_('Sorry, invalid invitation code.'),404,'json');
return false;
}
// Store this in case we need it
common_ensure_session();
$_SESSION['invitecode'] = $this->code;
}
return true;
}
/**
* Handle the request
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
_('This method requires a POST.'),
400, $this->format
);
return;
} else {
$nickname = $this->trimmed('nickname');
$email = $this->trimmed('email');
$fullname = $this->trimmed('fullname');
$homepage = $this->trimmed('homepage');
$bio = $this->trimmed('bio');
$location = $this->trimmed('location');
// We don't trim these... whitespace is OK in a password!
$password = $this->arg('password');
$confirm = $this->arg('confirm');
// invitation code, if any
$code = $this->trimmed('code');
if ($code) {
$invite = Invitation::staticGet($code);
}
if (common_config('site', 'inviteonly') && !($code && $invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without an invitation.
$this->clientError(_('Sorry, only invited people can register.'),404,'json');
return;
}
// Input scrubbing
try {
$nickname = Nickname::normalize($nickname);
} catch (NicknameException $e) {
$this->showForm($e->getMessage());
}
$email = common_canonical_email($email);
if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
// TRANS: Form validation error displayed when trying to register without a valid e-mail address.
$this->clientError(_('Not a valid email address.'),404,'json');
} else if ($this->nicknameExists($nickname)) {
// TRANS: Form validation error displayed when trying to register with an existing nickname.
$this->clientError(_('Nickname already in use. Try another one.'),404,'json');
} else if (!User::allowed_nickname($nickname)) {
// TRANS: Form validation error displayed when trying to register with an invalid nickname.
$this->clientError(_('Not a valid nickname.'),404,'json');
} else if ($this->emailExists($email)) {
// TRANS: Form validation error displayed when trying to register with an already registered e-mail address.
$this->clientError(_('Email address already exists.'),404,'json');
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage,
array('allowed_schemes' =>
array('http', 'https')))) {
// TRANS: Form validation error displayed when trying to register with an invalid homepage URL.
$this->clientError(_('Homepage is not a valid URL.'),404,'json');
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Form validation error displayed when trying to register with a too long full name.
$this->clientError(_('Full name is too long (maximum 255 characters).'),404,'json');
return;
} else if (Profile::bioTooLong($bio)) {
// TRANS: Form validation error on registration page when providing too long a bio text.
// TRANS: %d is the maximum number of characters for bio; used for plural.
$this->clientError(sprintf(_m('Bio is too long (maximum %d character).',
'Bio is too long (maximum %d characters).',
Profile::maxBio()),
Profile::maxBio()),404,'json');
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Form validation error displayed when trying to register with a too long location.
$this->clientError(_('Location is too long (maximum 255 characters).'),404,'json');
return;
} else if (strlen($password) < 6) {
// TRANS: Form validation error displayed when trying to register with too short a password.
$this->clientError(_('Password must be 6 or more characters.'),404,'json');
return;
} else if ($password != $confirm) {
// TRANS: Form validation error displayed when trying to register with non-matching passwords.
$this->clientError(_('Passwords do not match.'),404,'json');
} else {
// annoy spammers
sleep(7);
if ($user = User::register(array('nickname' => $nickname,
'password' => $password,
'email' => $email,
'fullname' => $fullname,
'homepage' => $homepage,
'bio' => $bio,
'location' => $location,
'code' => $code))) {
if (!$user) {
// TRANS: Form validation error displayed when trying to register with an invalid username or password.
$this->clientError(_('Invalid username or password.'),404,'json');
return;
}
Event::handle('EndRegistrationTry', array($this));
$this->initDocument('json');
$this->showJsonObjects($this->twitterUserArray($user->getProfile()));
$this->endDocument('json');
} else {
// TRANS: Form validation error displayed when trying to register with an invalid username or password.
$this->clientError(_('Invalid username or password.'),404,'json');
}
}
}
}
/**
* Does the given nickname already exist?
*
* Checks a canonical nickname against the database.
*
* @param string $nickname nickname to check
*
* @return boolean true if the nickname already exists
*/
function nicknameExists($nickname)
{
$user = User::staticGet('nickname', $nickname);
return is_object($user);
}
/**
* Does the given email address already exist?
*
* Checks a canonical email address against the database.
*
* @param string $email email address to check
*
* @return boolean true if the address already exists
*/
function emailExists($email)
{
$email = common_canonical_email($email);
if (!$email || strlen($email) == 0) {
return false;
}
$user = User::staticGet('email', $email);
return is_object($user);
}
}

View File

@ -1,108 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Update a user's background color
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
class ApiAccountUpdateBackgroundColorAction extends ApiAuthAction
{
var $backgroundcolor = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->auth_user;
$this->backgroundcolor = $this->trimmed('backgroundcolor');
return true;
}
/**
* Handle the request
*
* Try to save the user's colors in her design. Create a new design
* if the user doesn't already have one.
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
_('This method requires a POST.'),
400, $this->format
);
return;
}
$validhex = preg_match('/^[a-f0-9]{6}$/i',$this->backgroundcolor);
if($validhex === false || $validhex == 0) {
$this->clientError(_('Not a valid hex color.'),404,'json');
return;
}
// save the new color
$original = clone($this->user);
$this->user->backgroundcolor = $this->backgroundcolor;
if (!$this->user->update($original)) {
$this->clientError(_('Error updating user.'),404,'json');
return;
}
$profile = $this->user->getProfile();
if (empty($profile)) {
$this->clientError(_('User has no profile.'),'json');
return;
}
$twitter_user = $this->twitterUserArray($profile, true);
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}

View File

@ -1,109 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Update a user's link color
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
class ApiAccountUpdateLinkColorAction extends ApiAuthAction
{
var $linkcolor = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->auth_user;
$this->linkcolor = $this->trimmed('linkcolor');
return true;
}
/**
* Handle the request
*
* Try to save the user's colors in her design. Create a new design
* if the user doesn't already have one.
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
_('This method requires a POST.'),
400, $this->format
);
return;
}
$validhex = preg_match('/^[a-f0-9]{6}$/i',$this->linkcolor);
if($validhex === false || $validhex == 0) {
$this->clientError(_('Not a valid hex color.'),404,'json');
return;
}
// save the new color
$original = clone($this->user);
$this->user->linkcolor = $this->linkcolor;
if (!$this->user->update($original)) {
$this->clientError(_('Error updating user.'),404,'json');
return;
}
$profile = $this->user->getProfile();
if (empty($profile)) {
$this->clientError(_('User has no profile.'),'json');
return;
}
$twitter_user = $this->twitterUserArray($profile, true);
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
}

View File

@ -1,106 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show a notice's attachment
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
require_once INSTALLDIR . '/lib/mediafile.php';
/**
* Show a notice's attachment
*
*/
class ApiAttachmentAction extends ApiAuthAction
{
const MAXCOUNT = 100;
var $original = null;
var $cnt = self::MAXCOUNT;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
return true;
}
/**
* Handle the request
*
* Make a new notice for the update, save it, and show it
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$file = new File();
$file->selectAdd(); // clears it
$file->selectAdd('url');
$file->id = $this->trimmed('id');
$url = $file->fetchAll('url');
$file_txt = '';
if(strstr($url[0],'.html')) {
$file_txt['txt'] = file_get_contents(str_replace('://quitter.se','://127.0.0.1',$url[0]));
$file_txt['body_start'] = strpos($file_txt['txt'],'<body>')+6;
$file_txt['body_end'] = strpos($file_txt['txt'],'</body>');
$file_txt = substr($file_txt['txt'],$file_txt['body_start'],$file_txt['body_end']-$file_txt['body_start']);
}
$this->initDocument('json');
$this->showJsonObjects($file_txt);
$this->endDocument('json');
}
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -1,122 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show a notice's attachment
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
require_once INSTALLDIR . '/lib/mediafile.php';
/**
* Check if a url have a push-hub, i.e. if it is possible to subscribe
*
*/
class ApiCheckHubAction extends ApiAuthAction
{
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->url = urldecode($args['url']);
if (!$this->url) {
$this->clientError(_('No URL.'), 403, 'json');
return;
}
if (!Validate::uri(
$this->url, array(
'allowed_schemes' =>
array('http', 'https')
)
)) {
$this->clientError(_('Invalid URL.'), 403, 'json');
return;
}
return true;
}
/**
* Handle the request
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
$discover = new FeedDiscovery();
try {
$feeduri = $discover->discoverFromURL($this->url);
if($feeduri) {
$huburi = $discover->getHubLink();
}
} catch (FeedSubNoFeedException $e) {
$this->clientError(_('No feed found'), 403, 'json');
return;
} catch (FeedSubBadResponseException $e) {
$this->clientError(_('No hub found'), 403, 'json');
return;
}
$hub_status = array();
if ($huburi) {
$hub_status = array('huburi' => $huburi);
}
$this->initDocument('json');
$this->showJsonObjects($hub_status);
$this->endDocument('json');
}
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -1,74 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Check nickname
*
* Returns 1 if nickname is ok, 0 if not
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
class ApiCheckNicknameAction extends ApiAction
{
function prepare($args)
{
parent::prepare($args);
return true;
}
function handle($args)
{
parent::handle($args);
$nickname = $this->trimmed('nickname');
if ($this->nicknameExists($nickname)) {
$nickname_ok = 0;
} else if (!User::allowed_nickname($nickname)) {
$nickname_ok = 0; }
else {
$nickname_ok = 1;
}
$this->initDocument('json');
$this->showJsonObjects($nickname_ok);
$this->endDocument('json');
}
function nicknameExists($nickname)
{
$user = User::staticGet('nickname', $nickname);
return is_object($user);
}
}

View File

@ -1,244 +0,0 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Show a stream of notices in a particular conversation
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
/**
* Show a stream of notices in a particular conversation
*
* @category API
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class ApiconversationAction extends ApiAuthAction
{
protected $conversation = null;
protected $notices = null;
/**
* For initializing members of the class.
*
* @param array $argarray misc. arguments
*
* @return boolean true
*/
function prepare($argarray)
{
parent::prepare($argarray);
$convId = $this->trimmed('id');
if (empty($convId)) {
// TRANS: Client exception thrown when no conversation ID is given.
throw new ClientException(_('No conversation ID.'));
}
$this->conversation = Conversation::staticGet('id', $convId);
if (empty($this->conversation)) {
// TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
throw new ClientException(sprintf(_('No conversation with ID %d.'), $convId),
404);
}
// $profile = Profile::current();
if(isset($this->auth_user)) {
$profile = $this->auth_user->getProfile();
}
else {
$profile = null;
}
$stream = new ConversationNoticeStream($convId, $profile);
$notice = $stream->getNotices(($this->page-1) * $this->count,
$this->count,
$this->since_id,
$this->max_id);
$this->notices = $notice->fetchAll();
return true;
}
/**
* Handler method
*
* @param array $argarray is ignored since it's now passed in in prepare()
*
* @return void
*/
function handle($argarray=null)
{
$sitename = common_config('site', 'name');
// TRANS: Title for conversion timeline.
$title = _m('TITLE', 'Conversation');
$id = common_local_url('apiconversation', array('id' => $this->conversation->id, 'format' => $this->format));
$link = common_local_url('conversation', array('id' => $this->conversation->id));
$self = $id;
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline(
$this->notices,
$title,
$link,
null,
null,
null,
$self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
return true;
} else {
return false;
}
}
/**
* Return last modified, if applicable.
*
* MAY override
*
* @return string last modified http header
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
return null;
}
/**
* Return etag, if applicable.
*
* MAY override
*
* @return string etag http header
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
. '"';
}
return null;
}
/**
* Does this require authentication?
*
* @return boolean true if delete, else false
*/
function requiresAuth()
{
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
$_SERVER['REQUEST_METHOD'] == 'HEAD') {
return false;
} else {
return true;
}
}
}

View File

@ -1,99 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show an external user's profile information
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiprivateauth.php';
/**
* Ouputs information for a user, specified by ID or screen name.
* The user's most recent status will be returned inline.
*/
class ApiExternalProfileShowAction extends ApiPrivateAuthAction
{
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
$profileurl = urldecode($this->arg('profileurl'));
$this->profile = Profile::staticGet('profileurl', $profileurl);
return true;
}
/**
* Handle the request
*
* Check the format and show the user info
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (empty($this->profile)) {
// TRANS: Client error displayed when requesting profile information for a non-existing profile.
$this->clientError(_('Profile not found.'), 404, 'json');
return;
}
$twitter_user = $this->twitterUserArray($this->profile, true);
$this->initDocument('json');
$this->showJsonObjects($twitter_user);
$this->endDocument('json');
}
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -1,193 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* List a group's admins
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @copyright 2009 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiprivateauth.php';
/**
* List 20 newest admins of the group specified by name or ID.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiGroupAdminsAction extends ApiPrivateAuthAction
{
var $group = null;
var $profiles = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->group = $this->getTargetGroup($this->arg('id'));
if (empty($this->group)) {
// TRANS: Client error displayed trying to show group membership on a non-existing group.
$this->clientError(_('Group not found.'), 404, $this->format);
return false;
}
$this->profiles = $this->getProfiles();
return true;
}
/**
* Handle the request
*
* Show the admin of the group
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
// XXX: RSS and Atom
switch($this->format) {
case 'xml':
$this->showTwitterXmlUsers($this->profiles);
break;
case 'json':
$this->showJsonUsers($this->profiles);
break;
default:
$this->clientError(
// TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'),
404,
$this->format
);
break;
}
}
/**
* Fetch the admins of a group
*
* @return array $profiles list of profiles
*/
function getProfiles()
{
$profiles = array();
$profile = $this->group->getAdmins(
($this->page - 1) * $this->count,
$this->count,
$this->since_id,
$this->max_id
);
while ($profile->fetch()) {
$profiles[] = clone($profile);
}
return $profiles;
}
/**
* Is this action read only?
*
* @param array $args other arguments
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
}
/**
* When was this list of profiles last modified?
*
* @return string datestamp of the lastest profile in the group
*/
function lastModified()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
return strtotime($this->profiles[0]->created);
}
return null;
}
/**
* An entity tag for this list of groups
*
* Returns an Etag based on the action name, language
* the group id, and timestamps of the first and last
* user who has joined the group
*
* @return string etag
*/
function etag()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
$last = count($this->profiles) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->group->id,
strtotime($this->profiles[0]->created),
strtotime($this->profiles[$last]->created))
)
. '"';
}
return null;
}
}

View File

@ -1,143 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Action for showing Twitter-like JSON search results
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @copyright 2008-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/apiprivateauth.php';
require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
/**
* Action handler for Twitter-compatible API search
*
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @see ApiAction
*/
class ApiSearchJSONAction extends ApiPrivateAuthAction
{
var $query;
var $lang;
var $rpp;
var $page;
var $since_id;
var $limit;
var $geocode;
/**
* Initialization.
*
* @param array $args Web and URL arguments
*
* @return boolean true if nothing goes wrong
*/
function prepare($args)
{
parent::prepare($args);
$this->query = $this->trimmed('q');
$this->lang = $this->trimmed('lang');
$this->rpp = $this->trimmed('rpp');
if (!$this->rpp) {
$this->rpp = 15;
}
if ($this->rpp > 100) {
$this->rpp = 100;
}
$this->page = $this->trimmed('page');
if (!$this->page) {
$this->page = 1;
}
// TODO: Suppport max_id -- we need to tweak the backend
// Search classes to support it.
$this->since_id = $this->trimmed('since_id');
$this->geocode = $this->trimmed('geocode');
return true;
}
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$this->showResults();
}
/**
* Show search results
*
* @return void
*/
function showResults()
{
// TODO: Support search operators like from: and to:, boolean, etc.
$notice = new Notice();
// lcase it for comparison
$q = strtolower($this->query);
$this->notices = array();
$search_engine = $notice->getSearchEngine('notice');
$search_engine->set_sort_mode('chron');
$search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1);
if ($search_engine->query($q)) {
$cnt = $notice->find();
$this->notices = $notice->fetchAll();
}
$this->showJsonTimeline($this->notices);
}
/**
* Do we need to write to the database?
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -1,139 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show up to 100 favs of a notice
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
require_once INSTALLDIR . '/lib/mediafile.php';
/**
* Show up to 100 favs of a notice
*
*/
class ApiStatusesFavsAction extends ApiAuthAction
{
const MAXCOUNT = 100;
var $original = null;
var $cnt = self::MAXCOUNT;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$id = $this->trimmed('id');
$this->original = Notice::staticGet('id', $id);
if (empty($this->original)) {
// TRANS: Client error displayed trying to display redents of a non-exiting notice.
$this->clientError(_('No such notice.'),
400, $this->format);
return false;
}
$cnt = $this->trimmed('count');
if (empty($cnt) || !is_integer($cnt)) {
$cnt = 100;
} else {
$this->cnt = min((int)$cnt, self::MAXCOUNT);
}
return true;
}
/**
* Handle the request
*
* Get favs and return them as json object
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$fave = new Fave();
$fave->selectAdd();
$fave->selectAdd('user_id');
$fave->notice_id = $this->original->id;
$fave->orderBy('modified');
if (!is_null($this->cnt)) {
$fave->limit(0, $this->cnt);
}
$ids = $fave->fetchAll('user_id');
// get nickname and profile image
$ids_with_profile_data = array();
$i=0;
foreach($ids as $id) {
$profile = Profile::staticGet('id', $id);
$ids_with_profile_data[$i]['user_id'] = $id;
$ids_with_profile_data[$i]['nickname'] = $profile->nickname;
$ids_with_profile_data[$i]['fullname'] = $profile->fullname;
$ids_with_profile_data[$i]['profileurl'] = $profile->profileurl;
$profile = new Profile();
$profile->id = $id;
$avatarurl = $profile->avatarUrl(24);
$ids_with_profile_data[$i]['avatarurl'] = $avatarurl;
$i++;
}
$this->initDocument('json');
$this->showJsonObjects($ids_with_profile_data);
$this->endDocument('json');
}
/**
* Return true if read only.
*
* MAY override
*
* @param array $args other arguments
*
* @return boolean is read only action?
*/
function isReadOnly($args)
{
return true;
}
}

View File

@ -1,380 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Post a notice (update your status) through the API
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Tom Blankenship <mac65@mac65.com>
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <robin@millette.info>
* @author Zach Copley <zach@status.net>
* @copyright 2009-2010 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
/* External API usage documentation. Please update when you change how this method works. */
/*! @page statusesupdate statuses/update
@section Description
Updates the authenticating user's status. Requires the status parameter specified below.
Request must be a POST.
@par URL pattern
/api/statuses/update.:format
@par Formats (:format)
xml, json
@par HTTP Method(s)
POST
@par Requires Authentication
Yes
@param status (Required) The URL-encoded text of the status update.
@param source (Optional) The source application name, if using HTTP authentication or an anonymous OAuth consumer.
@param in_reply_to_status_id (Optional) The ID of an existing status that the update is in reply to.
@param lat (Optional) The latitude the status refers to.
@param long (Optional) The longitude the status refers to.
@param media (Optional) a media upload, such as an image or movie file.
@sa @ref authentication
@sa @ref apiroot
@subsection usagenotes Usage notes
@li The URL pattern is relative to the @ref apiroot.
@li If the @e source parameter is not supplied the source of the status will default to 'api'. When authenticated via a registered OAuth application, the application's registered name and URL will always override the source parameter.
@li The XML response uses <a href="http://georss.org/Main_Page">GeoRSS</a>
to encode the latitude and longitude (see example response below <georss:point>).
@li Data uploaded via the @e media parameter should be multipart/form-data encoded.
@subsection exampleusage Example usage
@verbatim
curl -u username:password http://example.com/api/statuses/update.xml -d status='Howdy!' -d lat='30.468' -d long='-94.743'
@endverbatim
@subsection exampleresponse Example response
@verbatim
<?xml version="1.0" encoding="UTF-8"?>
<status>
<text>Howdy!</text>
<truncated>false</truncated>
<created_at>Tue Mar 30 23:28:05 +0000 2010</created_at>
<in_reply_to_status_id/>
<source>api</source>
<id>26668724</id>
<in_reply_to_user_id/>
<in_reply_to_screen_name/>
<geo xmlns:georss="http://www.georss.org/georss">
<georss:point>30.468 -94.743</georss:point>
</geo>
<favorited>false</favorited>
<user>
<id>25803</id>
<name>Jed Sanders</name>
<screen_name>jedsanders</screen_name>
<location>Hoop and Holler, Texas</location>
<description>I like to think of myself as America's Favorite.</description>
<profile_image_url>http://avatar.example.com/25803-48-20080924200604.png</profile_image_url>
<url>http://jedsanders.net</url>
<protected>false</protected>
<followers_count>5</followers_count>
<profile_background_color/>
<profile_text_color/>
<profile_link_color/>
<profile_sidebar_fill_color/>
<profile_sidebar_border_color/>
<friends_count>2</friends_count>
<created_at>Wed Sep 24 20:04:00 +0000 2008</created_at>
<favourites_count>0</favourites_count>
<utc_offset>0</utc_offset>
<time_zone>UTC</time_zone>
<profile_background_image_url/>
<profile_background_tile>false</profile_background_tile>
<statuses_count>70</statuses_count>
<following>true</following>
<notifications>true</notifications>
</user>
</status>
@endverbatim
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiauth.php';
require_once INSTALLDIR . '/lib/mediafile.php';
/**
* Updates the authenticating user's status (posts a notice).
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Tom Blankenship <mac65@mac65.com>
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <robin@millette.info>
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiStatusesUpdateAction extends ApiAuthAction
{
var $status = null;
var $in_reply_to_status_id = null;
var $lat = null;
var $lon = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->status = $this->trimmed('status');
$this->lat = $this->trimmed('lat');
$this->lon = $this->trimmed('long');
$this->in_reply_to_status_id
= intval($this->trimmed('in_reply_to_status_id'));
return true;
}
/**
* Handle the request
*
* Make a new notice for the update, save it, and show it
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
// TRANS: Client error. POST is a HTTP command. It should not be translated.
_('This method requires a POST.'),
400,
$this->format
);
return;
}
// Workaround for PHP returning empty $_POST and $_FILES when POST
// length > post_max_size in php.ini
if (empty($_FILES)
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
if (empty($this->status)) {
$this->clientError(
// TRANS: Client error displayed when the parameter "status" is missing.
_('Client must provide a \'status\' parameter with a value.'),
400,
$this->format
);
return;
}
if (empty($this->auth_user)) {
// TRANS: Client error displayed when updating a status for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
/* Do not call shortenlinks until the whole notice has been build */
// Check for commands
$inter = new CommandInterpreter();
$cmd = $inter->handle_command($this->auth_user, $this->status);
if ($cmd) {
if ($this->supported($cmd)) {
$cmd->execute(new Channel());
}
// Cmd not supported? Twitter just returns your latest status.
// And, it returns your last status whether the cmd was successful
// or not!
$this->notice = $this->auth_user->getCurrentNotice();
} else {
$reply_to = null;
if (!empty($this->in_reply_to_status_id)) {
// Check whether notice actually exists
$reply = Notice::staticGet($this->in_reply_to_status_id);
if ($reply) {
$reply_to = $this->in_reply_to_status_id;
} else {
$this->clientError(
// TRANS: Client error displayed when replying to a non-existing notice.
_('Parent notice not found.'),
$code = 404,
$this->format
);
return;
}
}
$upload = null;
try {
$upload = MediaFile::fromUpload('media', $this->auth_user);
} catch (Exception $e) {
$this->clientError($e->getMessage(), $e->getCode(), $this->format);
return;
}
if (isset($upload)) {
$this->status .= ' ' . $upload->shortUrl();
/* Do not call shortenlinks until the whole notice has been build */
}
/* Do call shortenlinks here & check notice length since notice is about to be saved & sent */
//$status_shortened = $this->auth_user->shortenlinks($this->status);
/* DO NOT! */
$status_shortened = $this->status;
if (Notice::contentTooLong($status_shortened)) {
if (isset($upload)) {
$upload->delete();
}
// TRANS: Client error displayed exceeding the maximum notice length.
// TRANS: %d is the maximum lenth for a notice.
$msg = _m('Maximum notice size is %d character, including attachment URL.',
'Maximum notice size is %d characters, including attachment URL.',
Notice::maxContent());
/* Use HTTP 413 error code (Request Entity Too Large)
* instead of basic 400 for better understanding
*/
$this->clientError(sprintf($msg, Notice::maxContent()),
413,
$this->format);
}
$content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8');
$options = array('reply_to' => $reply_to);
if ($this->auth_user->shareLocation()) {
$locOptions = Notice::locationOptions($this->lat,
$this->lon,
null,
null,
$this->auth_user->getProfile());
$options = array_merge($options, $locOptions);
}
try {
$this->notice = Notice::saveNew(
$this->auth_user->id,
$content,
$this->source,
$options
);
} catch (Exception $e) {
$this->clientError($e->getMessage(), $e->getCode(), $this->format);
return;
}
if (isset($upload)) {
$upload->attachToNotice($this->notice);
}
}
$this->showNotice();
}
/**
* Show the resulting notice
*
* @return void
*/
function showNotice()
{
if (!empty($this->notice)) {
if ($this->format == 'xml') {
$this->showSingleXmlStatus($this->notice);
} elseif ($this->format == 'json') {
$this->show_single_json_status($this->notice);
}
}
}
/**
* Is this command supported when doing an update from the API?
*
* @param string $cmd the command to check for
*
* @return boolean true or false
*/
function supported($cmd)
{
static $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand',
'FavCommand', 'OnCommand', 'OffCommand', 'JoinCommand', 'LeaveCommand');
if (in_array(get_class($cmd), $cmdlist)) {
return true;
}
return false;
}
}

View File

@ -1,248 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show the latest notices for a given tag
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
* @copyright 2009-2010 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apiprivateauth.php';
/**
* Returns the 20 most recent notices tagged by a given tag
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineTagAction extends ApiPrivateAuthAction
{
var $notices = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
common_debug("apitimelinetag prepare()");
$this->tag = $this->arg('tag');
$this->notices = $this->getNotices();
return true;
}
/**
* Handle the request
*
* Just show the notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$this->showTimeline();
}
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
// TRANS: Title for timeline with lastest notices with a given tag.
// TRANS: %s is the tag.
$title = sprintf(_("Notices tagged with %s"), $this->tag);
$subtitle = sprintf(
// TRANS: Subtitle for timeline with lastest notices with a given tag.
// TRANS: %1$s is the tag, $2$s is the StatusNet sitename.
_('Updates tagged with %1$s on %2$s!'),
$this->tag,
$sitename
);
$taguribase = TagURI::base();
$id = "tag:$taguribase:TagTimeline:".$this->tag;
$link = common_local_url(
'tag',
array('tag' => $this->tag)
);
$self = $this->getSelfUri();
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline(
$this->notices,
$title,
$link,
$subtitle,
null,
$sitelogo,
$self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
/**
* Get notices
*
* @return array notices
*/
function getNotices()
{
$notices = array();
$notice = Notice_tag::getStream(
$this->tag,
($this->page - 1) * $this->count,
$this->count + 1,
$this->since_id,
$this->max_id
);
while ($notice->fetch()) {
$notices[] = clone($notice);
}
return $notices;
}
/**
* Is this action read only?
*
* @param array $args other arguments
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
}
/**
* When was this feed last modified?
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
return null;
}
/**
* An entity tag for this stream
*
* Returns an Etag based on the action name, language, and
* timestamps of the first and last notice in the timeline
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->tag,
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
. '"';
}
return null;
}
}

View File

@ -1,524 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Show a user's timeline
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author mac65 <mac65@mac65.com>
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <robin@millette.info>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
require_once INSTALLDIR . '/lib/apibareauth.php';
/**
* Returns the most recent notices (default 20) posted by the authenticating
* user. Another user's timeline can be requested via the id parameter. This
* is the API equivalent of the user profile web page.
*
* @category API
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author mac65 <mac65@mac65.com>
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <robin@millette.info>
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiTimelineUserAction extends ApiBareAuthAction
{
var $notices = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
// TRANS: Client error displayed requesting most recent notices for a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
$this->notices = $this->getNotices();
return true;
}
/**
* Handle the request
*
* Just show the notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if ($this->isPost()) {
$this->handlePost();
} else {
$this->showTimeline();
}
}
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
// We'll use the shared params from the Atom stub
// for other feed types.
$atom = new AtomUserNoticeFeed($this->user, $this->auth_user);
$link = common_local_url(
'showstream',
array('nickname' => $this->user->nickname)
);
$self = $this->getSelfUri();
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
$suplink = common_local_url('sup', null, null, $this->user->id);
header('X-SUP-ID: ' . $suplink);
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline(
$this->notices,
$atom->title,
$link,
$atom->subtitle,
$suplink,
$atom->logo,
$self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom->setId($self);
$atom->setSelfLink($self);
// Add navigation links: next, prev, first
// Note: we use IDs rather than pages for navigation; page boundaries
// change too quickly!
if (!empty($this->next_id)) {
$nextUrl = common_local_url('ApiTimelineUser',
array('format' => 'atom',
'id' => $this->user->id),
array('max_id' => $this->next_id));
$atom->addLink($nextUrl,
array('rel' => 'next',
'type' => 'application/atom+xml'));
}
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$lastNotice = $this->notices[0];
$lastId = $lastNotice->id;
$prevUrl = common_local_url('ApiTimelineUser',
array('format' => 'atom',
'id' => $this->user->id),
array('since_id' => $lastId));
$atom->addLink($prevUrl,
array('rel' => 'prev',
'type' => 'application/atom+xml'));
}
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$firstUrl = common_local_url('ApiTimelineUser',
array('format' => 'atom',
'id' => $this->user->id));
$atom->addLink($firstUrl,
array('rel' => 'first',
'type' => 'application/atom+xml'));
}
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($atom->title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
// XXX: Add paging extension?
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
/**
* Get notices
*
* @return array notices
*/
function getNotices()
{
$notices = array();
$user_profile = $this->user->getProfile();
if(isset($this->auth_user)) {
$auth_user_profile = $this->auth_user->getProfile();
}
else {
$auth_user_profile = null;
}
$stream = new ProfileNoticeStream($user_profile, $auth_user_profile);
$notice = $stream->getNotices(($this->page-1) * $this->count,
$this->count + 1,
$this->since_id,
$this->max_id);
while ($notice->fetch()) {
if (count($notices) < $this->count) {
$notices[] = clone($notice);
} else {
$this->next_id = $notice->id;
break;
}
}
return $notices;
}
/**
* We expose AtomPub here, so non-GET/HEAD reqs must be read/write.
*
* @param array $args other arguments
*
* @return boolean true
*/
function isReadOnly($args)
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
}
/**
* When was this feed last modified?
*
* @return string datestamp of the latest notice in the stream
*/
function lastModified()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
return null;
}
/**
* An entity tag for this stream
*
* Returns an Etag based on the action name, language, user ID, and
* timestamps of the first and last notice in the timeline
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return '"' . implode(
':',
array($this->arg('action'),
common_user_cache_hash($this->auth_user),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
. '"';
}
return null;
}
function handlePost()
{
if (empty($this->auth_user) ||
$this->auth_user->id != $this->user->id) {
// TRANS: Client error displayed trying to add a notice to another user's timeline.
$this->clientError(_('Only the user can add to their own timeline.'));
return;
}
// Only handle posts for Atom
if ($this->format != 'atom') {
// TRANS: Client error displayed when using another format than AtomPub.
$this->clientError(_('Only accept AtomPub for Atom feeds.'));
return;
}
$xml = trim(file_get_contents('php://input'));
if (empty($xml)) {
// TRANS: Client error displayed attempting to post an empty API notice.
$this->clientError(_('Atom post must not be empty.'));
}
$old = error_reporting(error_reporting() & ~(E_WARNING | E_NOTICE));
$dom = new DOMDocument();
$ok = $dom->loadXML($xml);
error_reporting($old);
if (!$ok) {
// TRANS: Client error displayed attempting to post an API that is not well-formed XML.
$this->clientError(_('Atom post must be well-formed XML.'));
}
if ($dom->documentElement->namespaceURI != Activity::ATOM ||
$dom->documentElement->localName != 'entry') {
// TRANS: Client error displayed when not using an Atom entry.
$this->clientError(_('Atom post must be an Atom entry.'));
return;
}
$activity = new Activity($dom->documentElement);
$saved = null;
if (Event::handle('StartAtomPubNewActivity', array(&$activity, $this->user, &$saved))) {
if ($activity->verb != ActivityVerb::POST) {
// TRANS: Client error displayed when not using the POST verb. Do not translate POST.
$this->clientError(_('Can only handle POST activities.'));
return;
}
$note = $activity->objects[0];
if (!in_array($note->type, array(ActivityObject::NOTE,
ActivityObject::BLOGENTRY,
ActivityObject::STATUS))) {
// TRANS: Client error displayed when using an unsupported activity object type.
// TRANS: %s is the unsupported activity object type.
$this->clientError(sprintf(_('Cannot handle activity object type "%s".'),
$note->type));
return;
}
$saved = $this->postNote($activity);
Event::handle('EndAtomPubNewActivity', array($activity, $this->user, $saved));
}
if (!empty($saved)) {
header('HTTP/1.1 201 Created');
header("Location: " . common_local_url('ApiStatusesShow', array('id' => $saved->id,
'format' => 'atom')));
$this->showSingleAtomStatus($saved);
}
}
function postNote($activity)
{
$note = $activity->objects[0];
// Use summary as fallback for content
if (!empty($note->content)) {
$sourceContent = $note->content;
} else if (!empty($note->summary)) {
$sourceContent = $note->summary;
} else if (!empty($note->title)) {
$sourceContent = $note->title;
} else {
// @fixme fetch from $sourceUrl?
// TRANS: Client error displayed when posting a notice without content through the API.
// TRANS: %d is the notice ID (number).
$this->clientError(sprintf(_('No content for notice %d.'),
$note->id));
return;
}
// Get (safe!) HTML and text versions of the content
$rendered = $this->purify($sourceContent);
$content = html_entity_decode(strip_tags($rendered), ENT_QUOTES, 'UTF-8');
$shortened = $this->auth_user->shortenLinks($content);
$options = array('is_local' => Notice::LOCAL_PUBLIC,
'rendered' => $rendered,
'replies' => array(),
'groups' => array(),
'tags' => array(),
'urls' => array());
// accept remote URI (not necessarily a good idea)
common_debug("Note ID is {$note->id}");
if (!empty($note->id)) {
$notice = Notice::staticGet('uri', trim($note->id));
if (!empty($notice)) {
// TRANS: Client error displayed when using another format than AtomPub.
// TRANS: %s is the notice URI.
$this->clientError(sprintf(_('Notice with URI "%s" already exists.'),
$note->id));
return;
}
common_log(LOG_NOTICE, "Saving client-supplied notice URI '$note->id'");
$options['uri'] = $note->id;
}
// accept remote create time (also maybe not such a good idea)
if (!empty($activity->time)) {
common_log(LOG_NOTICE, "Saving client-supplied create time {$activity->time}");
$options['created'] = common_sql_date($activity->time);
}
// Check for optional attributes...
if (!empty($activity->context)) {
foreach ($activity->context->attention as $uri) {
$profile = Profile::fromURI($uri);
if (!empty($profile)) {
$options['replies'][] = $uri;
} else {
$group = User_group::staticGet('uri', $uri);
if (!empty($group)) {
$options['groups'][] = $group->id;
} else {
// @fixme: hook for discovery here
common_log(LOG_WARNING, sprintf('AtomPub post with unknown attention URI %s', $uri));
}
}
}
// Maintain direct reply associations
// @fixme what about conversation ID?
if (!empty($activity->context->replyToID)) {
$orig = Notice::staticGet('uri',
$activity->context->replyToID);
if (!empty($orig)) {
$options['reply_to'] = $orig->id;
}
}
$location = $activity->context->location;
if ($location) {
$options['lat'] = $location->lat;
$options['lon'] = $location->lon;
if ($location->location_id) {
$options['location_ns'] = $location->location_ns;
$options['location_id'] = $location->location_id;
}
}
}
// Atom categories <-> hashtags
foreach ($activity->categories as $cat) {
if ($cat->term) {
$term = common_canonical_tag($cat->term);
if ($term) {
$options['tags'][] = $term;
}
}
}
// Atom enclosures -> attachment URLs
foreach ($activity->enclosures as $href) {
// @fixme save these locally or....?
$options['urls'][] = $href;
}
$saved = Notice::saveNew($this->user->id,
$content,
'atompub', // TODO: deal with this
$options);
return $saved;
}
function purify($content)
{
require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
$config = array('safe' => 1,
'deny_attribute' => 'id,style,on*');
return htmLawed($content, $config);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Public stream
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Stream
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
// This check helps protect against security problems;
// your code file can't be executed directly from the web.
exit(1);
}
/**
* Public stream
*
* @category Stream
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class PublicAndExternalNoticeStream extends ScopingNoticeStream
{
function __construct($profile=null)
{
parent::__construct(new CachingNoticeStream(new RawPublicAndExternalNoticeStream(),
'publicAndExternal'),
$profile);
}
}
/**
* Raw public stream
*
* @category Stream
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class RawPublicAndExternalNoticeStream extends NoticeStream
{
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd(); // clears it
$notice->selectAdd('id');
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
// if (common_config('public', 'localonly')) {
// $notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
// } else {
// -1 == blacklisted, -2 == gateway (i.e. Twitter)
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !='. Notice::GATEWAY);
// }
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?php
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
@ -34,42 +34,55 @@
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('STATUSNET')) {
exit(1);
}
// SITE TITLE
$sitetitle = 'qvitter front-end';
class PublicAndExternalNoticeStream extends ScopingNoticeStream
{
function __construct($profile=null)
{
// SITE DOMAIN
$siterootdomain = 'qvitter.example.com'; // no http:// or https:// and no ending slash
parent::__construct(new CachingNoticeStream(new RawPublicAndExternalNoticeStream(),
'publicAndExternal'),
$profile);
}
}
// API ROOT (GNU social instance)
$apiroot = 'https://social.example.com/api/';
class RawPublicAndExternalNoticeStream extends NoticeStream
{
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
// DEFAULT BACKGROUND COLOR
$defaultbackgroundcolor = '#f4f4f4';
$notice = new Notice();
// DEFAULT LINK COLOR
$defaultlinkcolor = '#0084B4';
$notice->selectAdd();
$notice->selectAdd('id');
// TIME BETWEEN POLLING
$timebetweenpolling = 5000; // ms
$notice->orderBy('created DESC, id DESC');
// FORCE SSL ON AVATAR URLS AND SUCH
$forcessl = false;
// USE history.pushState TO REWRITE URLS IN THE LOCATION BAR (use with mod_rewrite)
// Try this rule in .htaccess:
// RewriteRule ^(search/)?(notice\?q=|group/|tag/)?([a-z0-9%]+)?(/all|/subscriptions|/subscribers|/groups|/replies|/favorites|/members|/admins)?$ /theme/quitter-theme2/qvitter/index.php [L]
$usehistorypushstate = false;
// FULL PATH TO THIS QVITTER APP
// (can be left blank, but if you're not doing mod_rewrites you need this)
$qvitterpath = ''; // WITH trailing slash!!
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· (o> >o) ·
· \\\\_\ /_//// .
· \____) (____/ ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !='. Notice::GATEWAY);
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
}

View File

@ -76,7 +76,7 @@ button.icon.nav-search,
#birds-top,
#logo,
.topbar .global-nav {
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
}
@ -518,7 +518,7 @@ body.rtl .front-welcome-text {
}
.front-signup input,
#login-content input#username,
#login-content input#nickname,
#login-content input#password {
font-family: Arial,sans-serif;
font-size: 13px;
@ -594,7 +594,7 @@ body.rtl .front-welcome-text {
}
.front-signup input:focus,
#login-content input#username:focus,
#login-content input#nickname:focus,
#login-content input#password:focus {
border: 1px solid #56B4EF;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 0 8px rgba(82, 168, 236, 0.6);
@ -875,7 +875,7 @@ button#submit-login:hover {
#page-container {
width:837px;
padding:14px 14px 0 14px;
background-color:rgba(0,0,0,0.3);
background-color:rgba(0,0,0,0.4);
margin-left:-432.5px;
opacity:0;
}
@ -3323,7 +3323,7 @@ body.rtl #user-body {
}
body.rtl #remember-forgot,
body.rtl #login-content input#username,
body.rtl #login-content input#nickname,
body.rtl #login-content input#password,
body.rtl .queet-box,
body.rtl #user-header,
@ -3814,7 +3814,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
}
#search-query {
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
background-position: -100px -804px;
border: 0 none;
@ -3873,7 +3873,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
#top-compose {
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
background-position: -55px -800px;
cursor: pointer;
@ -4054,7 +4054,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
display:none;
}
.nav-session {
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
background-position: 0 -800px;
height: 49px;
@ -4117,7 +4117,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
padding:0;
margin:0;
border-radius:0 0 0 0 !important;
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
background-position: center -1003px;
}
@ -4151,7 +4151,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
margin-left: -35px;
width: 70px;
height: 55px;
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
background-color:#ccc;
}
@ -4297,7 +4297,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
ul.queet-actions li .icon.sm-rt,
ul.queet-actions li .icon.sm-trash,
ul.queet-actions li .icon.sm-reply {
background-image: url("../img/sprite-2x-v3.png");
background-image: url("../img/sprite.png");
background-size: 500px 1329px;
width:35px;
height:35px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/mela.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

BIN
img/sprite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

4411
img/sprite.png.ai Normal file

File diff suppressed because one or more lines are too long

306
index.php
View File

@ -1,306 +0,0 @@
<?php
require_once 'settings.php';
// url to this instance
$instanceurl = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,strpos( $_SERVER["SERVER_PROTOCOL"],'/'))).'://'.$siterootdomain.'/';
// if used as a webapp
if($usehistorypushstate) {
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('STATUSNET', true);
define('LACONICA', true);
require_once INSTALLDIR . '/lib/common.php';
// if this is a users url we a http header
if(substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
header('Link: <'.$instanceurl.'main/xrd?uri=acct:'.$nickname.'@'.$siterootdomain.'>; rel="lrdd"; type="application/xrd+xml"');
}
}
}
?><!--
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print $sitetitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/14.css" />
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/jquery.minicolors.css" />
<link rel="shortcut icon" type="image/x-icon" href="<?php print $qvitterpath; ?>favicon.ico?v=2">
<?php
// if qvitter is a webapp and this is a users url we add feeds
if($usehistorypushstate && substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
$user = User::staticGet('nickname', $nickname);
if(!isset($user->id)) {
error_log("QVITTER: Could not get user id for user with nickname: $nickname REQUEST_URI: ".$_SERVER['REQUEST_URI']);
}
else {
print '<link title="Notice feed for '.$nickname.' (Activity Streams JSON)" type="application/stream+json" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.as" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 1.0)" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 2.0)" type="application/rss+xml" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (Atom)" type="application/atom+xml" href="'.$instanceurl.'api/statuses/user_timeline/'.$user->id.'.atom" rel="alternate">'."\n";
print ' <link title="FOAF for '.$nickname.'" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/foaf" rel="meta">'."\n";
print ' <link href="'.$instanceurl.$nickname.'/microsummary" rel="microsummary">'."\n";
}
}
}
elseif(substr($_SERVER['REQUEST_URI'],0,7) == '/group/') {
$group_id_or_name = substr($_SERVER['REQUEST_URI'],7);
if(stristr($group_id_or_name,'/id')) {
$group_id_or_name = substr($group_id_or_name, 0, strpos($group_id_or_name,'/id'));
$group = User_group::staticGet('id', $group_id_or_name);
$group_name = $group->nickname;
$group_id = $group_id_or_name;
}
else {
$group = User_group::staticGet('nickname', $group_id_or_name);
$group_id = $group->id;
$group_name = $group_id_or_name;
}
if(preg_match("/^[a-zA-Z0-9]+$/", $group_id_or_name) == 1) {
print '<link rel="alternate" href="'.$apiroot.'statusnet/groups/timeline/'.$group_id.'.as" type="application/stream+json" title="Notice feed for '.$group_id_or_name.' group (Activity Streams JSON)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'group/'.$group_name.'/rss" type="application/rdf+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 1.0)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'api/statusnet/groups/timeline/'.$group_id.'.rss" type="application/rss+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 2.0)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'api/statusnet/groups/timeline/'.$group_id.'.atom" type="application/atom+xml" title="Notice feed for '.$group_id_or_name.' group (Atom)"/>'."\n";
print ' <link rel="meta" href="'.$instanceurl.'group/'.$group_name.'/foaf" type="application/rdf+xml" title="FOAF for '.$group_id_or_name.' group"/>'."\n";
}
}
?>
<script>
window.timeBetweenPolling = <?php print $timebetweenpolling; ?>;
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';
window.useHistoryPushState = <?php if($usehistorypushstate) print 'true'; else print 'false'; ?>;
window.defaultLinkColor = '<?php print $defaultlinkcolor; ?>';
window.defaultBackgroundColor = '<?php print $defaultbackgroundcolor; ?>';
</script>
<style>
a, a:visited, a:active,
ul.stats li:hover a,
ul.stats li:hover a strong,
#user-body a:hover div strong,
#user-body a:hover div div,
.permalink-link:hover,
.stream-item.expanded > .queet .stream-item-expand,
.stream-item-footer .with-icn .requeet-text a b:hover,
.queet-text span.attachment.more,
.stream-item-header .created-at a:hover,
.stream-item-header a.account-group:hover .name,
.queet:hover .stream-item-expand,
.show-full-conversation:hover,
#new-queets-bar,
.menu-container div,
#user-header:hover #user-name,
.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email {
color:#0084B4;/*COLOREND*/
}
.topbar .global-nav,
.menu-container {
background-color:#0084B4;/*BACKGROUNDCOLOREND*/
}
</style>
</head>
<body style="background-color:<?php print $defaultbackgroundcolor; ?>">
<div class="topbar">
<a href="<?php print $instanceurl; ?>"><div id="logo"></div></a>
<a id="settingslink">
<div class="dropdown-toggle">
<i class="nav-session"></i>
<b class="caret"></b>
</div>
</a>
<div id="top-compose" class="hidden"></div>
<ul class="quitter-settings dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</li>
<li><a id="settings"></a></li>
<?php
if($siterootdomain == 'quitter.se') { print '<li><a id="classic" href="https://old.quitter.se/">Classic Quitter</a></li>'; } // sry for this junk
?><li class="dropdown-divider"></li>
<li><a id="logout"></a></li>
<li class="language dropdown-divider"></li>
<li class="language"><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li class="language"><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li class="language"><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li class="language"><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li class="language"><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li class="language"><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li class="language"><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li class="language"><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li class="language"><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
<div id="birds-top"></div>
<div class="global-nav">
<div class="global-nav-inner">
<div class="container">
<div id="search">
<input type="text" spellcheck="false" autocomplete="off" name="q" placeholder="Sök" id="search-query" class="search-input">
<span class="search-icon">
<button class="icon nav-search" type="submit" tabindex="-1">
<span> Sök </span>
</button>
</span>
<input type="text" spellcheck="false" autocomplete="off" id="search-query-hint" class="search-input search-hinting-input" disabled="disabled">
</div>
<ul class="language-dropdown">
<li class="dropdown">
<a class="dropdown-toggle">
<small></small>
<span class="current-language"></span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</li>
<li><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="page-container">
<div class="front-welcome-text">
<h1></h1>
<p></p>
</div>
<div id="user-container" style="display:none;">
<div id="login-content">
<div id="username-container">
<input id="username" type="text" value="" tabindex="1" />
</div>
<table class="password-signin"><tbody><tr>
<td class="flex-table-primary">
<div class="placeholding-input">
<input id="password" type="password" tabindex="2" value="" />
</div>
</td>
<td class="flex-table-secondary">
<button class="submit" type="submit" id="submit-login" tabindex="4"></button>
</td>
</tr></tbody></table>
<div id="remember-forgot">
<input type="checkbox" id="rememberme" name="rememberme" value="yes" tabindex="3" checked="checked"> <span id="rememberme_label"></span> · <a href="<?php print $instanceurl ?>main/recoverpassword"></a>
</div>
</div>
<div class="front-signup">
<h2></h2>
<div class="signup-input-container"><input placeholder="" type="text" name="user[name]" autocomplete="off" class="text-input" id="signup-user-name"></div>
<div class="signup-input-container"><input placeholder="" type="text" name="user[email]" autocomplete="off" id="signup-user-email"></div>
<div class="signup-input-container"><input placeholder="" type="password" name="user[user_password]" class="text-input" id="signup-user-password"></div>
<button id="signup-btn-step1" class="signup-btn" type="submit"></button>
<div id="other-servers-link"></div>
</div>
<div id="user-header">
<img id="user-avatar" src="" />
<div id="user-name"></div>
<div id="user-screen-name"></div>
<div id="user-profile-link"></div>
</div>
<div id="user-body">
<a><div id="user-queets"><strong></strong><div class="label"></div></div></a>
<a><div id="user-following"><strong></strong><div class="label"></div></div></a>
<a><div id="user-followers"><strong></strong><div class="label"></div></div></a>
<a><div id="user-groups"><strong></strong><div class="label"></div></div></a>
</div>
<div id="user-footer">
<textarea id="codemirror-queet-box"></textarea>
<div id="queet-box" class="queet-box"></div>
<div id="queet-toolbar">
<div id="queet-box-extras"></div>
<div id="queet-button">
<span id="queet-counter"></span>
<button id="queet"></button>
</div>
</div>
</div>
<div class="menu-container">
<a class="stream-selection friends-timeline" data-stream-header="" data-stream-name="statuses/friends_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection mentions" data-stream-header="" data-stream-name="statuses/mentions.json"><i class="chev-right"></i></a>
<a class="stream-selection my-timeline" data-stream-header="@statuses/user_timeline.json" data-stream-name="statuses/user_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection favorites" data-stream-header="" data-stream-name="favorites.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>" class="stream-selection public-timeline" data-stream-header="" data-stream-name="statuses/public_timeline.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>main/all" class="stream-selection public-and-external-timeline" data-stream-header="" data-stream-name="statuses/public_and_external_timeline.json?since_id=1"><i class="chev-right"></i></a>
</div>
<div class="menu-container" id="history-container"></div>
</div>
<div id="feed">
<div id="feed-header">
<div id="feed-header-inner">
<h2></h2>
</div>
</div>
<div id="new-queets-bar-container" class="hidden"><div id="new-queets-bar"></div></div>
<div id="feed-body"></div>
</div>
<div id="footer"></div>
</div>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/codemirror.4.0.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.minicolors.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=18"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=11"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=4"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=12"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=12"></script>
</body>
</html>

View File

@ -45,7 +45,7 @@
· · · · · · · · · */
function checkLogin(username,password,actionOnSuccess) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: 'POST',
data: {
getRequest: "account/verify_credentials.json",
@ -94,7 +94,7 @@ function getFromAPI(stream, actionOnSuccess) {
// request without username/password
if(typeof window.loginUsername == 'undefined') {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
getRequest: stream
@ -112,7 +112,7 @@ function getFromAPI(stream, actionOnSuccess) {
}
// with username/password if set
else {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
getRequest: stream,
@ -144,7 +144,7 @@ function getFromAPI(stream, actionOnSuccess) {
· · · · · · · · · · · · · */
function postQueetToAPI(queetText_txt, actionOnSuccess) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'statuses/update.json',
@ -169,10 +169,10 @@ function postQueetToAPI(queetText_txt, actionOnSuccess) {
· · · · · · · · · · · · · */
function postNewLinkColor(newLinkColor) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'account/update_link_color.json',
postRequest: 'qvitter/update_link_color.json',
linkcolor: newLinkColor,
username: window.loginUsername,
password: window.loginPassword
@ -196,10 +196,10 @@ function postNewLinkColor(newLinkColor) {
· · · · · · · · · · · · · */
function postNewBackgroundColor(newBackgroundColor) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'account/update_background_color.json',
postRequest: 'qvitter/update_background_color.json',
backgroundcolor: newBackgroundColor,
username: window.loginUsername,
password: window.loginPassword
@ -233,7 +233,7 @@ function APIFollowOrUnfollowUser(followOrUnfollow,user_id,this_element,actionOnS
var postRequest = 'friendships/destroy.json';
}
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: postRequest,
@ -259,7 +259,7 @@ function APIFollowOrUnfollowUser(followOrUnfollow,user_id,this_element,actionOnS
· · · · · · · · · · · · · */
function APIJoinOrLeaveGroup(joinOrLeave,group_id,this_element,actionOnSuccess) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'statusnet/groups/' + joinOrLeave + '.json',
@ -285,7 +285,7 @@ function APIJoinOrLeaveGroup(joinOrLeave,group_id,this_element,actionOnSuccess)
· · · · · · · · · · · · · */
function postReplyToAPI(queetText_txt, in_reply_to_status_id, actionOnSuccess) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'statuses/update.json',
@ -314,7 +314,7 @@ function postReplyToAPI(queetText_txt, in_reply_to_status_id, actionOnSuccess) {
· · · · · · · · · · · · · */
function postActionToAPI(action, actionOnSuccess) {
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: action,
@ -373,7 +373,7 @@ function unRequeet(this_stream_item, this_action, my_rq_id) {
function getFavsOrRequeetsForQueet(apiaction,qid,actionOnSuccess) {
if(apiaction=="requeets") { apiaction="retweets"; } // we might mix this up...
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
getRequest: "statuses/" + apiaction + "/" + qid + ".json",

View File

@ -304,7 +304,7 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
window.oldStreams[window.currentStream] = $('#feed').siblings('.profile-card').outerHTML() + $('#feed').outerHTML();
// set location bar from stream
if(setLocation && window.useHistoryPushState) {
if(setLocation) {
setUrlFromStream(stream);
}

View File

@ -131,13 +131,13 @@ window.l.es.settings = 'Configuración';
window.l.es.saveChanges = 'Guardar cambios';
window.l.es.linkColor = 'Color del enlace';
window.l.es.backgroundColor = 'Color de fondo';
window.l.es.newToQuitter = '¿Eres nuevo en Quitter?';
window.l.es.newToQuitter = '¿Eres nuevo en ' + window.siteTitle + '?';
window.l.es.signUp = 'Regístrate';
window.l.es.signUpFullName = 'Nombre completo';
window.l.es.signUpEmail = 'Correo electrónico';
window.l.es.signUpButtonText = 'Regístrate en Quitter';
window.l.es.welcomeHeading = 'Bienvenido a Quitter.';
window.l.es.welcomeText = 'Somos una <span id="federated-tooltip"><div id="what-is-federation">« Federación » significa que no debes tener una cuenta de Quitter para seguir su usuarios, estar seguido por o communicar con ellos. ¡Puedes registrar con cualquier servidor StatusNet o <a href="http://www.gnu.org/software/social/">GNU Social</a>, o cualquier servicio utilizando el protocolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! También no debes registrarse en cualquier servicio para participar - simplemente instala el software GNU Social en tu propio servidor. (:</div>federación</span> de microblogueros que, como tú, estan motivados por ética y solidaridad y quieren abandonar los servicios centralizados capitalistas. Estamos aquí desde 2010 y siempre vamos a ser no-profit.';
window.l.es.signUpButtonText = 'Regístrate en ' + window.siteTitle;
window.l.es.welcomeHeading = 'Bienvenido a ' + window.siteTitle + '.';
window.l.es.welcomeText = 'Somos una <span id="federated-tooltip"><div id="what-is-federation">« Federación » significa que no debes tener una cuenta de ' + window.siteTitle + ' para seguir su usuarios, estar seguido por o communicar con ellos. ¡Puedes registrar con cualquier servidor StatusNet o <a href="http://www.gnu.org/software/social/">GNU Social</a>, o cualquier servicio utilizando el protocolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! También no debes registrarse en cualquier servicio para participar - simplemente instala el software GNU Social en tu propio servidor. (:</div>federación</span> de microblogueros que, como tú, estan motivados por ética y solidaridad y quieren abandonar los servicios centralizados capitalistas. Estamos aquí desde 2010 y siempre vamos a ser no-profit.';
window.l.es.registerNickname = 'Nombre de usuario';
window.l.es.registerHomepage = 'Sitio web';
window.l.es.registerBio = 'Biografía';
@ -242,13 +242,13 @@ window.l.fr.settings = 'Paramètres';
window.l.fr.saveChanges = 'Sauvegarder les modifications';
window.l.fr.linkColor = 'Couleur des liens';
window.l.fr.backgroundColor = 'Couleur de l\'arrière-plan';
window.l.fr.newToQuitter = 'Nouveau sur Quitter ?';
window.l.fr.newToQuitter = 'Nouveau sur ' + window.siteTitle + ' ?';
window.l.fr.signUp = 'Inscrivez-vous';
window.l.fr.signUpFullName = 'Nom complet';
window.l.fr.signUpEmail = 'Email';
window.l.fr.signUpButtonText = 'S\'inscrire sur Quitter';
window.l.fr.welcomeHeading = 'Bienvenue sur Quitter.';
window.l.fr.welcomeText = 'Nous sommes une <span id="federated-tooltip"><div id="what-is-federation">La « fédération » signifie que vous n\'êtes pas obligé d\'avoir un compte Quitter pour pouvoir suivre ses utilisateurs, être suivis par eux ou interagir avec eux. Vous pouvez vous enregistrer sur n\'importe quel serveur StatusNet ou <a href="http://www.gnu.org/software/social/">GNU Social</a>, ou n\'importe quel service utilisant le protocole <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a> ! Vous n\'êtes pas même obligés de vous inscrire où que ce soit, puisque vous pouvez aussi installer le programme GNU Social sur votre propre serveur ! :)</div>fédération</span> de microbloggers qui, comme vous, a le souci de l\'éthique, de la solidarité, et de s\'extraire des services centralisés capitalistes. Nous sommes en ligne depuis 2010 et resterons toujours sans but lucratif.';
window.l.fr.signUpButtonText = 'S\'inscrire sur ' + window.siteTitle;
window.l.fr.welcomeHeading = 'Bienvenue sur ' + window.siteTitle + '.';
window.l.fr.welcomeText = 'Nous sommes une <span id="federated-tooltip"><div id="what-is-federation">La « fédération » signifie que vous n\'êtes pas obligé d\'avoir un compte ' + window.siteTitle + ' pour pouvoir suivre ses utilisateurs, être suivis par eux ou interagir avec eux. Vous pouvez vous enregistrer sur n\'importe quel serveur StatusNet ou <a href="http://www.gnu.org/software/social/">GNU Social</a>, ou n\'importe quel service utilisant le protocole <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a> ! Vous n\'êtes pas même obligés de vous inscrire où que ce soit, puisque vous pouvez aussi installer le programme GNU Social sur votre propre serveur ! :)</div>fédération</span> de microbloggers qui, comme vous, a le souci de l\'éthique, de la solidarité, et de s\'extraire des services centralisés capitalistes. Nous sommes en ligne depuis 2010 et resterons toujours sans but lucratif.';
window.l.fr.registerNickname = 'Nom d\'utilisateur';
window.l.fr.registerHomepage = 'Site Web';
window.l.fr.registerBio = 'Biographie';
@ -352,16 +352,16 @@ window.l.de.settings = 'Einstellungen';
window.l.de.saveChanges = 'Änderungen speichern';
window.l.de.linkColor = 'Linkfarbe';
window.l.de.backgroundColor = 'Hintergrundfarbe';
window.l.de.newToQuitter = 'Neu bei Quitter?';
window.l.de.newToQuitter = 'Neu bei ' + window.siteTitle + '?';
window.l.de.signUp = 'Registriere Dich!';
window.l.de.signUpFullName = 'Vollständiger Name';
window.l.de.signUpEmail = 'E-Mail';
window.l.de.signUpButtonText = 'Registriere Dich bei Quitter!';
window.l.de.welcomeHeading = 'Willkommen bei Quitter!';
window.l.de.signUpButtonText = 'Registriere Dich bei ' + window.siteTitle + '!';
window.l.de.welcomeHeading = 'Willkommen bei ' + window.siteTitle + '!';
window.l.de.welcomeText = 'Wir sind eine Community von Microbloggern, verteilt über einen weltweiten \
<span id="federated-tooltip"><div id="what-is-federation">"Verbund" bedeutet, \
dass du nicht selbst einen Quitter-Account brauchst, um mit Quitter-Nutzern zu \
kommunizieren, ihnen zu folgen oder Follower bei Quitter zu haben. Du kannst dich \
dass du nicht selbst einen ' + window.siteTitle + '-Account brauchst, um mit ' + window.siteTitle + '-Nutzern zu \
kommunizieren, ihnen zu folgen oder Follower bei ' + window.siteTitle + ' zu haben. Du kannst dich \
genauso gut bei einem der anderen <a href="http://www.gnu.org/software/social/">\
GNU-Social</a>-Server registrieren oder einem anderen Dienst, der das \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>-Protokoll \
@ -388,13 +388,13 @@ window.l.en.loginPassword = 'Password';
window.l.en.loginSignIn = 'Sign in';
window.l.en.loginRememberMe = 'Remember me';
window.l.en.loginForgotPassword = 'Forgot password?';
window.l.en.notices = 'Queets';
window.l.en.notices = 'Notices';
window.l.en.followers = 'Followers';
window.l.en.following = 'Following';
window.l.en.groups = 'Groups';
window.l.en.compose = 'Compose a new Queet...';
window.l.en.queetVerb = 'Queet';
window.l.en.queetsNounPlural = 'Queets';
window.l.en.compose = 'Compose a new notice...';
window.l.en.queetVerb = 'Send';
window.l.en.queetsNounPlural = 'Notices';
window.l.en.logout = 'Sign out';
window.l.en.languageSelected = 'Language:';
window.l.en.viewMyProfilePage = 'View my profile page';
@ -403,18 +403,18 @@ window.l.en.collapse = 'Collapse';
window.l.en.details = 'Details';
window.l.en.expandFullConversation = 'Expand full conversation';
window.l.en.replyVerb = 'Reply';
window.l.en.requeetVerb = 'Requeet';
window.l.en.requeetVerb = 'Repeat';
window.l.en.favoriteVerb = 'Favorite';
window.l.en.requeetedVerb = 'Requeeted';
window.l.en.requeetedVerb = 'Repeated';
window.l.en.favoritedVerb = 'Favorited';
window.l.en.replyTo = 'Reply to';
window.l.en.requeetedBy = 'Requeeted by';
window.l.en.requeetedBy = 'Repeated by';
window.l.en.favoriteNoun = 'Favorite';
window.l.en.favoritesNoun = 'Favorites';
window.l.en.requeetNoun = 'Requeet';
window.l.en.requeetsNoun = 'Requeets';
window.l.en.newQueet = 'new Queet';
window.l.en.newQueets = 'new Queets';
window.l.en.requeetNoun = 'Repeat';
window.l.en.requeetsNoun = 'Repeats';
window.l.en.newQueet = 'new notice';
window.l.en.newQueets = 'new notices';
window.l.en.longmonthsJanuary = "January";
window.l.en.longmonthsFebruary = "February";
window.l.en.longmonthsMars = "March";
@ -458,7 +458,7 @@ window.l.en.publicAndExtTimeline = 'The whole known network';
window.l.en.searchVerb = 'Search';
window.l.en.deleteVerb = 'Delete';
window.l.en.cancelVerb = 'Cancel';
window.l.en.deleteConfirmation = 'Are you sure you want to delete this queet?';
window.l.en.deleteConfirmation = 'Are you sure you want to delete this notice?';
window.l.en.userExternalFollow = 'Remote follow';
window.l.en.userExternalFollowHelp = 'Your account ID (e.g. user@rainbowdash.net).';
window.l.en.userFollow = 'Follow';
@ -474,15 +474,15 @@ window.l.en.settings = 'Settings';
window.l.en.saveChanges = 'Save changes';
window.l.en.linkColor = 'Link color';
window.l.en.backgroundColor = 'Background color';
window.l.en.newToQuitter = 'New to Quitter?';
window.l.en.newToQuitter = 'New to ' + window.siteTitle + '?';
window.l.en.signUp = 'Sign up';
window.l.en.signUpFullName = 'Full name';
window.l.en.signUpEmail = 'Email';
window.l.en.signUpButtonText = 'Sign up to Quitter';
window.l.en.welcomeHeading = 'Welcome to Quitter.';
window.l.en.signUpButtonText = 'Sign up to ' + window.siteTitle + '';
window.l.en.welcomeHeading = 'Welcome to ' + window.siteTitle + '.';
window.l.en.welcomeText = 'We are a <span id="federated-tooltip"><div id="what-is-federation">"Federation" \
means that you don\'t need a Quitter account to be able to follow, be followed \
by or interact with Quitter users. You can register on any StatusNet or GNU Social server \
means that you don\'t need a ' + window.siteTitle + ' account to be able to follow, be followed \
by or interact with ' + window.siteTitle + ' users. You can register on any StatusNet or GNU Social server \
or any service based on the the \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a> protocol! \
You don\'t even have to join a service try installing the lovely \
@ -593,13 +593,13 @@ window.l.sv.settings = 'Inställningar';
window.l.sv.saveChanges = 'Spara ändringarna';
window.l.sv.linkColor = 'Länkfärg';
window.l.sv.backgroundColor = 'Bakgrundsfärg';
window.l.sv.newToQuitter = 'Ny på Quitter?';
window.l.sv.newToQuitter = 'Ny på ' + window.siteTitle + '?';
window.l.sv.signUp = 'Registrera dig';
window.l.sv.signUpFullName = 'Fullständigt namn';
window.l.sv.signUpEmail = 'E-post';
window.l.sv.signUpButtonText = 'Registrera dig på Quitter';
window.l.sv.welcomeHeading = 'Välkommen till Quitter.';
window.l.sv.welcomeText = 'Vi är en <span id="federated-tooltip"><div id="what-is-federation">"Federering" betyder att du inte behöver ha ett Quitter-konto för att följa, följas av eller prata med quittrare. Du kan registrera dig på vilken sajt som helst som stödjer protokollet <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a>, eller mikroblogga på en helt egen server, förslagsvis med den fria programvaran <a href="http://www.gnu.org/software/social/">GNU Social</a> (som Quitter bygger på).</div>federerad</span> allmänning, där du som har hoppat av de centraliserade kapitalistiska tjänsterna kan mikroblogga etiskt och solidariskt. Vi har funnits sedan 2010 och sajten drivs helt ideellt.';
window.l.sv.signUpButtonText = 'Registrera dig på ' + window.siteTitle + '';
window.l.sv.welcomeHeading = 'Välkommen till ' + window.siteTitle + '.';
window.l.sv.welcomeText = 'Vi är en <span id="federated-tooltip"><div id="what-is-federation">"Federering" betyder att du inte behöver ha ett ' + window.siteTitle + '-konto för att följa, följas av eller prata med quittrare. Du kan registrera dig på vilken sajt som helst som stödjer protokollet <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a>, eller mikroblogga på en helt egen server, förslagsvis med den fria programvaran <a href="http://www.gnu.org/software/social/">GNU Social</a> (som ' + window.siteTitle + ' bygger på).</div>federerad</span> allmänning, där du som har hoppat av de centraliserade kapitalistiska tjänsterna kan mikroblogga etiskt och solidariskt. Vi har funnits sedan 2010 och sajten drivs helt ideellt.';
window.l.sv.registerNickname = 'Användarnamn';
window.l.sv.registerHomepage = 'Webbplats';
window.l.sv.registerBio = 'Biografi';
@ -924,15 +924,15 @@ window.l.eo.settings = 'Agordo';
window.l.eo.saveChanges = 'Konservi ŝanĝojn';
window.l.eo.linkColor = 'Koloro de ligiloj';
window.l.eo.backgroundColor = 'Koloro de fono';
window.l.eo.newToQuitter = 'Ĉu vi estas novanto je Quitter?';
window.l.eo.newToQuitter = 'Ĉu vi estas novanto je ' + window.siteTitle + '?';
window.l.eo.signUp = 'Regístriĝi';
window.l.eo.signUpFullName = 'Plena nomo';
window.l.eo.signUpEmail = 'Retpoŝto';
window.l.eo.signUpButtonText = 'Regístriĝi ĉe Quitter';
window.l.eo.welcomeHeading = 'Bonvenon al Quitter.';
window.l.eo.signUpButtonText = 'Regístriĝi ĉe ' + window.siteTitle + '';
window.l.eo.welcomeHeading = 'Bonvenon al ' + window.siteTitle + '.';
window.l.eo.welcomeText = 'Ni estas <span id="federated-tooltip"><div id="what-is-federation">Helpindiko\
por federaĵon: federaĵon signifas, ke vi ne bezonas konton ĉe Quitter por\
ebli sekvi, esti sekvanta far aliaj, interagi kun uzantoj de Quitter. Vi povas\
por federaĵon: federaĵon signifas, ke vi ne bezonas konton ĉe ' + window.siteTitle + ' por\
ebli sekvi, esti sekvanta far aliaj, interagi kun uzantoj de ' + window.siteTitle + '. Vi povas\
registriĝi ĉe ajna servaĵo de StatusNet \
<a href="http://www.gnu.org/software/social/">GNU Social</a>, aŭ ajna servaĵo, kiu baziĝas\
sur la protokolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>!\
@ -1043,15 +1043,15 @@ window.l.it.settings = 'Opzioni';
window.l.it.saveChanges = 'Salva modifiche';
window.l.it.linkColor = 'Colore dei link';
window.l.it.backgroundColor = 'Colore dello sfondo';
window.l.it.newToQuitter = 'Sei nuovo su Quitter?';
window.l.it.newToQuitter = 'Sei nuovo su ' + window.siteTitle + '?';
window.l.it.signUp = 'Registrati';
window.l.it.signUpFullName = 'Nome e cognome';
window.l.it.signUpEmail = 'Indirizzo di posta elettronica';
window.l.it.signUpButtonText = 'Registrati su Quitter';
window.l.it.welcomeHeading = 'Benvenuto su Quitter.';
window.l.it.signUpButtonText = 'Registrati su ' + window.siteTitle + '';
window.l.it.welcomeHeading = 'Benvenuto su ' + window.siteTitle + '.';
window.l.it.welcomeText = 'Siamo una <span id="federated-tooltip"><div id="what-is-federation">"Federazione" \
significa che non è necessario avere un account su Quitter per essere in grado di seguire, \
essere seguito, o interagire con gli altri utenti Quitter. Potete registrarvi su \
significa che non è necessario avere un account su ' + window.siteTitle + ' per essere in grado di seguire, \
essere seguito, o interagire con gli altri utenti ' + window.siteTitle + '. Potete registrarvi su \
qualsiasi server StatusNet, <a href="http://www.gnu.org/software/social/">GNU Social</a>, \
o qualsiasi altro servizio basato sul protocollo \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! Non avete \
@ -1096,7 +1096,7 @@ window.siteTitle = $('head title').html(); // remember this for later use
// set some static string
$('.front-welcome-text h1').html(window.sL.welcomeHeading);
$('.front-welcome-text p').html(window.sL.welcomeText);
$('#username').attr('placeholder',window.sL.loginUsername);
$('#nickname').attr('placeholder',window.sL.loginUsername);
$('#password').attr('placeholder',window.sL.loginPassword);
$('button#submit-login').html(window.sL.loginSignIn);
$('#rememberme_label').html(window.sL.loginRememberMe);

View File

@ -39,18 +39,16 @@ window.oldStreams = new Object();
/* ·
·
· Update stream on back button (if we're using history push state)
· Update stream on back button
·
· · · · · · · · · · · · · */
if(window.useHistoryPushState) {
window.onpopstate = function(event) {
if(event && event.state) {
display_spinner();
setNewCurrentStream(event.state.strm,function(){
remove_spinner();
},false);
}
window.onpopstate = function(event) {
if(event && event.state) {
display_spinner();
setNewCurrentStream(event.state.strm,function(){
remove_spinner();
},false);
}
}
@ -169,7 +167,7 @@ $('#signup-btn-step1').click(function(){
$('#signup-btn-step2').click(function(){
$('#popup-register input,#popup-register button').addClass('disabled');
display_spinner();
$.ajax({ url: window.fullUrlToThisQvitterApp + 'API.php',
$.ajax({ url: window.qvitterApiRoot,
type: "POST",
data: {
postRequest: 'account/register.json',
@ -190,7 +188,7 @@ $('#signup-btn-step1').click(function(){
success: function(data) {
remove_spinner();
if(typeof data.error == 'undefined') {
$('input#username').val($('#signup-user-nickname-step2').val());
$('input#nickname').val($('#signup-user-nickname-step2').val());
$('input#password').val($('#signup-user-password1-step2').val());
$('input#rememberme').prop('checked', true);
$('#submit-login').trigger('click');
@ -240,28 +238,28 @@ $(window).load(function() {
// check for localstorage, if none, we remove possibility to remember login
var userInLocalStorage = false;
if(localStorageIsEnabled()) {
if(typeof localStorage.autologinUsername != 'undefined') {
if(typeof localStorage.autologinPassword != 'undefined') {
userInLocalStorage = true;
}
}
else {
$('input#rememberme').css('display','none');
$('span#rememberme_label').css('display','none');
$('#remember-forgot').css('font-size','0');
$('.language-dropdown').css('display','none');
// if we have a user logged in to localStorage, but not to gnusocial, delete
// and send them to front page and tell it to shake loginbox
if(!window.isLoggedIn && userInLocalStorage) {
localStorage.doShake = true;
delete localStorage.autologinUsername;
delete localStorage.autologinPassword;
window.location.href =window.siteInstanceURL;
}
// autologin if saved
if(userInLocalStorage) {
$('input#username').val(localStorage.autologinUsername);
// if login credentials in localstorage got lost somewhere, logout
if(window.isLoggedIn && !userInLocalStorage) {
window.location.href =window.siteInstanceURL + 'main/logout';
}
// autologin
else if(window.isLoggedIn && userInLocalStorage) {
$('input#nickname').val(localStorage.autologinUsername);
$('input#password').val(localStorage.autologinPassword);
// if we're in client mode, i.e. not webapp mode, always go to friends timeline if logged in
if(window.useHistoryPushState === false) {
streamToSet = 'statuses/friends_timeline.json';
}
doLogin("get stream from url");
}
else {
@ -282,17 +280,15 @@ $(window).load(function() {
·
· · · · · · · · · · · · · */
$('#submit-login').click(function () {
$('#form_login').submit(function(e) {
// if this is a special url for user, notice etc, grab that stream (UGLY SORRRRRY)
var streamToSet = "get stream from url";
// if this is the public feed, we redirect to friends_timline (I think that's intuitive)
if(getStreamFromUrl() == 'statuses/public_timeline.json') {
streamToSet = 'statuses/friends_timeline.json';
// store username and password in localstorage before submitting
if(typeof localStorage.autologinPassword == 'undefined') {
e.preventDefault();
localStorage.autologinPassword = $('input#password').val();
localStorage.autologinUsername = $('input#nickname').val();
$(this).submit();
}
doLogin(streamToSet);
});
function doLogin(streamToSet) {
@ -301,7 +297,7 @@ function doLogin(streamToSet) {
display_spinner();
// login with ajax
checkLogin($('input#username').val(),$('input#password').val(),function(user){
checkLogin($('input#nickname').val(),$('input#password').val(),function(user){
console.log(user);
@ -350,7 +346,7 @@ function doLogin(streamToSet) {
if($('#rememberme').is(':checked')) {
if(localStorageIsEnabled()) {
localStorage.autologinPassword = $('input#password').val();
localStorage.autologinUsername = $('input#username').val();
localStorage.autologinUsername = $('input#nickname').val();
}
}
@ -396,18 +392,6 @@ $('#rememberme_label').click(function(){
$('#rememberme_label').disableSelection();
/* ·
·
· Submit login form on enter key
·
· · · · · · · · · · · · · */
$('input#username,input#password,input#rememberme').keyup(function(e){
if(e.keyCode==13) {
$('#submit-login').trigger('click');
}
});
/* ·
@ -421,7 +405,7 @@ $('#logout').click(function(){
delete localStorage.autologinUsername;
delete localStorage.autologinPassword;
}
location.reload();
window.location.href =window.siteInstanceURL + 'main/logout';
});
@ -435,7 +419,7 @@ $('#logout').click(function(){
$('#settings').click(function(){
// buttons to add later: '<div class="right"><button class="close">' + window.sL.cancelVerb + '</button><button class="primary disabled">' + window.sL.saveChanges + '</button></div>'
popUpAction('popup-settings', window.sL.settings,'<div id="settings-container"><div><label for="link-color-selection">' + window.sL.linkColor + '</label><input id="link-color-selection" type="text" value="#' + window.userLinkColor + '" /></div><div><label for="link-color-selection">' + window.sL.backgroundColor + '</label><input id="background-color-selection" type="text" value="#' + window.userBackgroundColor + '" /></div><a id="moresettings">' + window.sL.moreSettings + '<form action="' + window.siteInstanceURL + '/main/login" method="post" target="_blank"><input type="hidden" id="nickname" name="nickname" value="' + $('input#username').val() + '" /><input type="hidden" id="password" name="password" value="' + $('input#password').val() + '" /><input type="hidden" id="returnto" name="returnto" value="/settings/profile" /></form></a></div>',false);
popUpAction('popup-settings', window.sL.settings,'<div id="settings-container"><div><label for="link-color-selection">' + window.sL.linkColor + '</label><input id="link-color-selection" type="text" value="#' + window.userLinkColor + '" /></div><div><label for="link-color-selection">' + window.sL.backgroundColor + '</label><input id="background-color-selection" type="text" value="#' + window.userBackgroundColor + '" /></div><a href="' + window.siteInstanceURL + 'settings/profile" id="moresettings">' + window.sL.moreSettings + '</a></div>',false);
$('#link-color-selection').minicolors({
change: function(hex) {
changeLinkColor(hex);
@ -500,7 +484,7 @@ $('body').on('click','#moresettings',function(){
function logoutWithoutReload(doShake) {
if(window.currentStream == 'statuses/public_timeline.json') {
$('body').css('background-image', 'url(' + window.fullUrlToThisQvitterApp + 'img/ekan4.jpg)');
$('body').css('background-image', 'url(' + window.fullUrlToThisQvitterApp + 'img/mela.jpg)');
}
$('#submit-login').removeAttr('disabled');
@ -519,17 +503,18 @@ function logoutWithoutReload(doShake) {
$('.dropdown-menu.quitter-settings li.language').css('display','none');
$('#settingslink').fadeOut('slow');
$('#search').fadeOut('slow');
$('input#username').focus();
$('input#nickname').focus();
$('.front-signup').animate({opacity:'1'},200);
if(doShake) {
$('input#username').css('background-color','pink');
if(doShake || localStorage.doShake) {
$('input#nickname').css('background-color','pink');
$('input#password').css('background-color','pink');
}
$('#login-content').animate({opacity:'1'},200, function(){
if(doShake) {
if(doShake || localStorage.doShake) {
$('#login-content').effect('shake',{distance:5,times:2},function(){
$('input#username').animate({backgroundColor:'#fff'},1000);
$('input#nickname').animate({backgroundColor:'#fff'},1000);
$('input#password').animate({backgroundColor:'#fff'},1000);
delete localStorage.doShake;
});
}
$('.front-welcome-text').fadeIn(3000);

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 KiB