function handle($args)
 {
     // Trigger short error responses; not a human-readable web page.
     StatusNet::setApi(true);
     // We're not a general oEmbed proxy service; limit to valid sessions.
     $token = $this->trimmed('token');
     if (!$token || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token does not match or is not given.
         $this->clientError(_m('There was a problem with your session token. ' . 'Try again, please.'));
     }
     $format = $this->arg('format');
     if ($format && $format != 'json') {
         // TRANS: Client exception thrown when requesting a different format than JSON.
         throw new ClientException(_m('Invalid format; only JSON supported.'));
     }
     $url = $this->arg('url');
     if (!common_valid_http_url($url)) {
         // TRANS: Client exception thrown when not providing a valid URL.
         throw new ClientException(_m('Invalid URL.'));
     }
     $params = array();
     if ($this->arg('maxwidth')) {
         $params['maxwidth'] = $this->arg('maxwidth');
     }
     if ($this->arg('maxheight')) {
         $params['maxheight'] = $this->arg('maxheight');
     }
     $data = oEmbedHelper::getObject($url, $params);
     $this->init_document('json');
     print json_encode($data);
 }
Exemplo n.º 2
0
 /**
  * Check for an API key, and throw an exception if it's not set
  *
  * @param array $args URL and POST params
  *
  * @return boolean continuation flag
  */
 function prepare($args)
 {
     StatusNet::setApi(true);
     // reduce exception reports to aid in debugging
     parent::prepare($args);
     if (!common_config('globalapi', 'enabled')) {
         throw new ClientException(_('Global API not enabled.'), 403);
     }
     $apikey = $this->trimmed('apikey');
     if (empty($apikey)) {
         throw new ClientException(_('No API key.'), 403);
     }
     $expected = common_config('globalapi', 'key');
     if ($expected != $apikey) {
         // FIXME: increment a counter by IP address to prevent brute-force
         // attacks on the key.
         throw new ClientException(_('Bad API key.'), 403);
     }
     $email = common_canonical_email($this->trimmed('email'));
     if (empty($email)) {
         throw new ClientException(_('No email address.'));
     }
     if (!Validate::email($email, common_config('email', 'check_domain'))) {
         throw new ClientException(_('Invalid email address.'));
     }
     $this->email = $email;
     return true;
 }
Exemplo n.º 3
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
         // short error results!
     }
     $rsvpId = $this->trimmed('rsvp');
     if (empty($rsvpId)) {
         // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
         throw new ClientException(_m('No such RSVP.'));
     }
     $this->rsvp = RSVP::staticGet('id', $rsvpId);
     if (empty($this->rsvp)) {
         // TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
         throw new ClientException(_m('No such RSVP.'));
     }
     $this->event = Happening::staticGet('id', $this->rsvp->event_id);
     if (empty($this->event)) {
         // TRANS: Client exception thrown when referring to a non-existing event.
         throw new ClientException(_m('No such event.'));
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Client exception thrown when trying tp RSVP ("please respond") while not logged in.
         throw new ClientException(_m('You must be logged in to RSVP for an event.'));
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Client exception thrown trying to respond to a poll while not logged in.
         throw new ClientException(_m('You must be logged in to respond to a poll.'), 403);
     }
     if ($this->isPost()) {
         $this->checkSessionToken();
     }
     $id = $this->trimmed('id');
     $this->poll = Poll::staticGet('id', $id);
     if (empty($this->poll)) {
         // TRANS: Client exception thrown trying to respond to a non-existing poll.
         throw new ClientException(_m('Invalid or missing poll.'), 404);
     }
     $selection = intval($this->trimmed('pollselection'));
     if ($selection < 1 || $selection > count($this->poll->getOptions())) {
         // TRANS: Client exception thrown responding to a poll with an invalid answer.
         throw new ClientException(_m('Invalid poll selection.'));
     }
     $this->selection = $selection;
     return true;
 }
Exemplo n.º 5
0
 /**
  * Load attributes based on database arguments
  *
  * Loads all the DB stuff
  *
  * @param array $args $_REQUEST array
  *
  * @return success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     $this->notice = $this->getNotice();
     $cur = common_current_user();
     if (!empty($cur)) {
         $curProfile = $cur->getProfile();
     } else {
         $curProfile = null;
     }
     if (!$this->notice->inScope($curProfile)) {
         // TRANS: Client exception thrown when trying a view a notice the user has no access to.
         throw new ClientException(_('Not available.'), 403);
     }
     $this->profile = $this->notice->getProfile();
     if (empty($this->profile)) {
         // TRANS: Server error displayed trying to show a notice without a connected profile.
         $this->serverError(_('Notice has no profile.'), 500);
         return false;
     }
     $this->user = User::staticGet('id', $this->profile->id);
     $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
     return true;
 }
Exemplo n.º 6
0
 function handle($args)
 {
     parent::handle($args);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
         return;
     }
     $user = common_current_user();
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
         return;
     }
     /* Use a session token for CSRF protection. */
     $token = $this->trimmed('token');
     if (!$token || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token does not match or is not given.
         $this->clientError(_('There was a problem with your session token. ' . 'Try again, please.'));
         return;
     }
     $other_id = $this->arg('unsubscribeto');
     if (!$other_id) {
         // TRANS: Client error displayed when trying to leave a group without specifying an ID.
         $this->clientError(_('No profile ID in request.'));
         return;
     }
     $other = Profile::staticGet('id', $other_id);
     if (!$other) {
         // TRANS: Client error displayed when trying to leave a non-existing group.
         $this->clientError(_('No profile with that ID.'));
         return;
     }
     $this->request = Subscription_queue::pkeyGet(array('subscriber' => $user->id, 'subscribed' => $other->id));
     if (empty($this->request)) {
         // TRANS: Client error displayed when trying to approve a non-existing group join request.
         // TRANS: %s is a user nickname.
         $this->clientError(sprintf(_('%s is not in the moderation queue for this group.'), $this->profile->nickname), 403);
     }
     $this->request->abort();
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Title after unsubscribing from a group.
         $this->element('title', null, _m('TITLE', 'Unsubscribed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $subscribe = new SubscribeForm($this, $other);
         $subscribe->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)), 303);
     }
 }
Exemplo n.º 7
0
 function handle()
 {
     StatusNet::setApi(true);
     // Minimize error messages to aid in debugging
     parent::handle();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $this->handlePost();
     } else {
         $this->handleGet();
     }
 }
Exemplo n.º 8
0
 function __construct($message, $code, $output = 'php://output', $indent = null)
 {
     parent::__construct($output, $indent);
     $this->code = $code;
     $this->message = $message;
     $this->minimal = StatusNet::isApi();
     // XXX: hack alert: usually we aren't going to
     // call this page directly, but because it's
     // an action it needs an args array anyway
     $this->prepare($_REQUEST);
 }
Exemplo n.º 9
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     StatusNet::setApi(true);
     // Send smaller error pages
     parent::prepare($argarray);
     $license = $_POST['omb_listenee_license'];
     $site_license = common_config('license', 'url');
     if (!common_compatible_license($license, $site_license)) {
         $this->clientError(sprintf(_('Listenee stream license ‘%1$s’ is not ' . 'compatible with site license ‘%2$s’.'), $license, $site_license));
         return false;
     }
     return true;
 }
Exemplo n.º 10
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     StatusNet::setApi(true);
     // Send smaller error pages
     parent::prepare($argarray);
     try {
         $this->checkNotice();
     } catch (Exception $e) {
         $this->clientError($e->getMessage());
         return false;
     }
     return true;
 }
Exemplo n.º 11
0
 /**
  * Check the posted activity type and break out to appropriate processing.
  */
 function handle($args)
 {
     StatusNet::setApi(true);
     // Send smaller error pages
     common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
     if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) && Event::handle('StartHandleSalmon', array($this->activity))) {
         switch ($this->activity->verb) {
             case ActivityVerb::POST:
                 $this->handlePost();
                 break;
             case ActivityVerb::SHARE:
                 $this->handleShare();
                 break;
             case ActivityVerb::FAVORITE:
                 $this->handleFavorite();
                 break;
             case ActivityVerb::UNFAVORITE:
                 $this->handleUnfavorite();
                 break;
             case ActivityVerb::FOLLOW:
             case ActivityVerb::FRIEND:
                 $this->handleFollow();
                 break;
             case ActivityVerb::UNFOLLOW:
                 $this->handleUnfollow();
                 break;
             case ActivityVerb::JOIN:
                 $this->handleJoin();
                 break;
             case ActivityVerb::LEAVE:
                 $this->handleLeave();
                 break;
             case ActivityVerb::TAG:
                 $this->handleTag();
                 break;
             case ActivityVerb::UNTAG:
                 $this->handleUntag();
                 break;
             case ActivityVerb::UPDATE_PROFILE:
                 $this->handleUpdateProfile();
                 break;
             default:
                 // TRANS: Client exception.
                 throw new ClientException(_m('Unrecognized activity type.'));
         }
         Event::handle('EndHandleSalmon', array($this->activity));
         Event::handle('EndHandleSalmonTarget', array($this->activity, $this->target));
     }
 }
Exemplo n.º 12
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     StatusNet::setApi(true);
     // Send smaller error pages
     parent::prepare($argarray);
     $license = $_POST['omb_listenee_license'];
     $site_license = common_config('license', 'url');
     if (!common_compatible_license($license, $site_license)) {
         // TRANS: Client error displayed when trying to update profile with an incompatible license.
         // TRANS: %1$s is the license incompatible with site license %2$s.
         $this->clientError(sprintf(_('Listenee stream license "%1$s" is not ' . 'compatible with site license "%2$s".'), $license, $site_license));
         return false;
     }
     return true;
 }
Exemplo n.º 13
0
 /**
  * Initialization.
  *
  * @param array $args Web and URL arguments
  *
  * @return boolean false if user doesn't exist
  */
 function prepare($args)
 {
     StatusNet::setApi(true);
     // reduce exception reports to aid in debugging
     parent::prepare($args);
     $this->format = $this->arg('format');
     $this->page = (int) $this->arg('page', 1);
     $this->count = (int) $this->arg('count', 20);
     $this->max_id = (int) $this->arg('max_id', 0);
     $this->since_id = (int) $this->arg('since_id', 0);
     if ($this->arg('since')) {
         header('X-StatusNet-Warning: since parameter is disabled; use since_id');
     }
     return true;
 }
Exemplo n.º 14
0
 function onEndShowScripts($action)
 {
     if (isset($action->recaptchaPluginNeedsOutput) && $action->recaptchaPluginNeedsOutput) {
         // Load the AJAX API
         if (StatusNet::isHTTPS()) {
             $url = "https://www.google.com/recaptcha/api/js/recaptcha_ajax.js";
         } else {
             $url = "http://www.google.com/recaptcha/api/js/recaptcha_ajax.js";
         }
         $action->script($url);
         // And when we're ready, fill out the captcha!
         $key = json_encode($this->public_key);
         $action->inlinescript("\$(function(){Recaptcha.create({$key}, 'recaptcha');});");
     }
     return true;
 }
Exemplo n.º 15
0
 function showPage()
 {
     if (StatusNet::isAjax()) {
         $this->extraHeaders();
         $this->ajaxErrorMsg();
         exit;
     }
     if ($this->minimal) {
         // Even more minimal -- we're in a machine API
         // and don't want to flood the output.
         $this->extraHeaders();
         $this->showContent();
     } else {
         parent::showPage();
     }
     // We don't want to have any more output after this
     exit;
 }
Exemplo n.º 16
0
 function prepare($args)
 {
     // If we die, show short error messages.
     StatusNet::setApi(true);
     parent::prepare($args);
     $cur = common_current_user();
     if (!$cur) {
         // TRANS: Client exception in autocomplete plugin.
         throw new ClientException(_m('Access forbidden.'), true);
     }
     $this->groups = array();
     $this->users = array();
     $q = $this->arg('q');
     $limit = $this->arg('limit');
     if ($limit > 200) {
         $limit = 200;
     }
     //prevent DOS attacks
     if (substr($q, 0, 1) == '@') {
         //user search
         $q = substr($q, 1);
         $user = new User();
         $user->limit($limit);
         $user->whereAdd('nickname like \'' . trim($user->escape($q), '\'') . '%\'');
         if ($user->find()) {
             while ($user->fetch()) {
                 $this->users[] = clone $user;
             }
         }
     }
     if (substr($q, 0, 1) == '!') {
         //group search
         $q = substr($q, 1);
         $group = new User_group();
         $group->limit($limit);
         $group->whereAdd('nickname like \'' . trim($group->escape($q), '\'') . '%\'');
         if ($group->find()) {
             while ($group->fetch()) {
                 $this->groups[] = clone $group;
             }
         }
     }
     return true;
 }
Exemplo n.º 17
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         throw new ClientException(_m("You must be logged in to answer to a question."), 403);
     }
     $id = substr($this->trimmed('id'), 7);
     $this->answer = QnA_Answer::staticGet('id', $id);
     $this->question = $this->answer->getQuestion();
     if (empty($this->answer) || empty($this->question)) {
         throw new ClientException(_m('Invalid or missing answer.'), 404);
     }
     $this->answerText = $this->trimmed('answer');
     return true;
 }
Exemplo n.º 18
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Client exception thrown when trying to create a new bookmark while not logged in.
         throw new ClientException(_m('Must be logged in to post a bookmark.'), 403);
     }
     if ($this->isPost()) {
         $this->checkSessionToken();
     }
     $this->title = $this->trimmed('title');
     $this->url = $this->trimmed('url');
     $this->tags = $this->trimmed('tags');
     $this->description = $this->trimmed('description');
     return true;
 }
Exemplo n.º 19
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         throw new ClientException(_m("You must be logged in to close a question."), 403);
     }
     if ($this->isPost()) {
         $this->checkSessionToken();
     }
     $id = substr($this->trimmed('id'), 9);
     $this->question = QnA_Question::staticGet('id', $id);
     if (empty($this->question)) {
         // TRANS: Client exception thrown trying to respond to a non-existing question.
         throw new ClientException(_m('Invalid or missing question.'), 404);
     }
     return true;
 }
Exemplo n.º 20
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     common_debug("in qnanewanswer");
     $this->user = common_current_user();
     if (empty($this->user)) {
         throw new ClientException(_m("You must be logged in to answer to a question."), 403);
     }
     if ($this->isPost()) {
         $this->checkSessionToken();
     }
     $id = substr($this->trimmed('id'), 9);
     $this->question = QnA_Question::staticGet('id', $id);
     if (empty($this->question)) {
         throw new ClientException(_m('Invalid or missing question.'), 404);
     }
     $this->answerText = $this->trimmed('answer');
     return true;
 }
Exemplo n.º 21
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
         // short error results!
     }
     $eventId = $this->trimmed('event');
     if (empty($eventId)) {
         // TRANS: Client exception thrown when requesting a non-exsting event.
         throw new ClientException(_m('No such event.'));
     }
     $this->event = Happening::staticGet('id', $eventId);
     if (empty($this->event)) {
         // TRANS: Client exception thrown when requesting a non-exsting event.
         throw new ClientException(_m('No such event.'));
     }
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Client exception thrown when trying to RSVP ("please respond") while not logged in.
         throw new ClientException(_m('You must be logged in to RSVP for an event.'));
     }
     common_debug(print_r($this->args, true));
     switch (strtolower($this->trimmed('submitvalue'))) {
         case 'yes':
             $this->verb = RSVP::POSITIVE;
             break;
         case 'no':
             $this->verb = RSVP::NEGATIVE;
             break;
         case 'maybe':
             $this->verb = RSVP::POSSIBLE;
             break;
         default:
             // TRANS: Client exception thrown when using an invalid value for RSVP ("please respond").
             throw new ClientException(_m('Unknown submit value.'));
     }
     return true;
 }
Exemplo n.º 22
0
 /**
  * Check pre-requisites and instantiate attributes
  *
  * @param Array $args array of arguments (URL, GET, POST)
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     if ($this->boolean('ajax')) {
         StatusNet::setApi(true);
     }
     // Only allow POST requests
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         // TRANS: Client error displayed trying to perform any request method other than POST.
         // TRANS: Do not translate POST.
         $this->clientError(_m('This action only accepts POST requests.'));
         return false;
     }
     // CSRF protection
     $token = $this->trimmed('token');
     if (!$token || $token != common_session_token()) {
         // TRANS: Client error displayed when the session token is not okay.
         $this->clientError(_m('There was a problem with your session token.' . ' Try again, please.'));
         return false;
     }
     // Only for logged-in users
     $this->user = common_current_user();
     if (empty($this->user)) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_m('Not logged in.'));
         return false;
     }
     // Profile to subscribe to
     $this->tag = $this->arg('tag');
     if (empty($this->tag)) {
         // TRANS: Client error displayed trying to subscribe to a non-existing profile.
         $this->clientError(_m('No such profile.'));
         return false;
     }
     return true;
 }
Exemplo n.º 23
0
Arquivo: doc.php Projeto: himmelex/NTW
 function getFilename()
 {
     $localDef = null;
     $local = null;
     $site = StatusNet::currentSite();
     if (!empty($site) && file_exists(INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title)) {
         $localDef = INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title;
         $local = glob(INSTALLDIR . '/local/doc-src/' . $site . '/' . $this->title . '.*');
         if ($local === false) {
             // Some systems return false, others array(), if dir didn't exist.
             $local = array();
         }
     } else {
         if (file_exists(INSTALLDIR . '/local/doc-src/' . $this->title)) {
             $localDef = INSTALLDIR . '/local/doc-src/' . $this->title;
         }
         $local = glob(INSTALLDIR . '/local/doc-src/' . $this->title . '.*');
         if ($local === false) {
             $local = array();
         }
     }
     if (count($local) || isset($localDef)) {
         return $this->negotiateLanguage($local, $localDef);
     }
     if (file_exists(INSTALLDIR . '/doc-src/' . $this->title)) {
         $distDef = INSTALLDIR . '/doc-src/' . $this->title;
     }
     $dist = glob(INSTALLDIR . '/doc-src/' . $this->title . '.*');
     if ($dist === false) {
         $dist = array();
     }
     if (count($dist) || isset($distDef)) {
         return $this->negotiateLanguage($dist, $distDef);
     }
     return null;
 }
Exemplo n.º 24
0
 /**
  * Initialization.
  *
  * @param array $args Web and URL arguments
  *
  * @return boolean false if user doesn't exist
  */
 function prepare($args)
 {
     StatusNet::setApi(true);
     // reduce exception reports to aid in debugging
     parent::prepare($args);
     $this->format = $this->arg('format');
     $this->callback = $this->arg('callback');
     $this->page = (int) $this->arg('page', 1);
     $this->count = (int) $this->arg('count', 20);
     $this->max_id = (int) $this->arg('max_id', 0);
     $this->since_id = (int) $this->arg('since_id', 0);
     if ($this->arg('since')) {
         header('X-StatusNet-Warning: since parameter is disabled; use since_id');
     }
     $this->source = $this->trimmed('source');
     if (empty($this->source) || in_array($this->source, self::$reserved_sources)) {
         $this->source = 'api';
     }
     return true;
 }
Exemplo n.º 25
0
 /**
  * Make sure we're on the right site configuration
  */
 protected function switchSite()
 {
     if ($this->site != StatusNet::currentSite()) {
         common_log(LOG_DEBUG, __METHOD__ . ": switching to site {$this->site}");
         $this->stats('switch');
         StatusNet::switchSite($this->site);
     }
 }
Exemplo n.º 26
0
 * StatusNet - a distributed open-source microblogging tool
 * Copyright (C) 2010, StatusNet, Inc.
 *
 * 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/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
require_once INSTALLDIR . '/scripts/commandline.inc';
foreach (StatusNet::getActivePlugins() as $plugin => $args) {
    echo "{$plugin}: ";
    if (empty($args)) {
        echo "(no args)\n";
    } else {
        foreach ($args as $arg => $val) {
            echo "\n  {$arg}: ";
            var_export($val);
        }
        echo "\n";
    }
    echo "\n";
}
Exemplo n.º 27
0
 static function url($filename)
 {
     if (!self::validFilename($filename)) {
         // TRANS: Client exception thrown if a file upload does not have a valid name.
         throw new ClientException(_("Invalid filename."));
     }
     if (common_config('site', 'private')) {
         return common_local_url('getfile', array('filename' => $filename));
     }
     if (StatusNet::isHTTPS()) {
         $sslserver = common_config('attachments', 'sslserver');
         if (empty($sslserver)) {
             // XXX: this assumes that background dir == site dir + /file/
             // not true if there's another server
             if (is_string(common_config('site', 'sslserver')) && mb_strlen(common_config('site', 'sslserver')) > 0) {
                 $server = common_config('site', 'sslserver');
             } else {
                 if (common_config('site', 'server')) {
                     $server = common_config('site', 'server');
                 }
             }
             $path = common_config('site', 'path') . '/file/';
         } else {
             $server = $sslserver;
             $path = common_config('attachments', 'sslpath');
             if (empty($path)) {
                 $path = common_config('attachments', 'path');
             }
         }
         $protocol = 'https';
     } else {
         $path = common_config('attachments', 'path');
         $server = common_config('attachments', 'server');
         if (empty($server)) {
             $server = common_config('site', 'server');
         }
         $ssl = common_config('attachments', 'ssl');
         $protocol = $ssl ? 'https' : 'http';
     }
     if ($path[strlen($path) - 1] != '/') {
         $path .= '/';
     }
     if ($path[0] != '/') {
         $path = '/' . $path;
     }
     return $protocol . '://' . $server . $path . $filename;
 }
Exemplo n.º 28
0
 /**
  * Checks for deleted remote notices and deleted the locally
  * A local qvitter-delete-notice is outputted in the onNoticeDeleteRelated event above
  *
  * @return boolean hook flag
  */
 public function onEndHandleFeedEntry($activity)
 {
     if ($activity->verb == 'qvitter-delete-notice' && class_exists('StatusNet') && !array_key_exists('ActivityModeration', StatusNet::getActivePlugins())) {
         $deleter_profile_uri = $activity->actor->id;
         $deleted_notice_uri = $activity->objects[0]->objects[0]->content;
         $deleted_notice_uri = substr($deleted_notice_uri, strpos($deleted_notice_uri, '{{') + 2);
         $deleted_notice_uri = substr($deleted_notice_uri, 0, strpos($deleted_notice_uri, '}}'));
         $deleter_ostatus_profile = Ostatus_profile::getKV('uri', $deleter_profile_uri);
         if (!$deleter_ostatus_profile instanceof Ostatus_profile) {
             return true;
         }
         $deleter_profile = Profile::getKV('id', $deleter_ostatus_profile->profile_id);
         $deleted_notice = Notice::getKV('uri', $deleted_notice_uri);
         if (!$deleter_profile instanceof Profile || !$deleted_notice instanceof Notice) {
             return true;
         }
         if ($deleter_profile->id != $deleted_notice->profile_id) {
             return true;
         }
         $deleted_notice->delete();
     }
     return true;
 }
Exemplo n.º 29
0
    function showQvitter()
    {
        $logged_in_user_nickname = '';
        $logged_in_user_obj = false;
        $logged_in_user = common_current_user();
        if ($logged_in_user) {
            $logged_in_user_nickname = $logged_in_user->nickname;
            $logged_in_user_obj = ApiAction::twitterUserArray($logged_in_user->getProfile());
        }
        $registrationsclosed = false;
        if (common_config('site', 'closed') == 1 || common_config('site', 'inviteonly') == 1) {
            $registrationsclosed = true;
        }
        // check if the client's ip address is blocked for registration
        if (is_array(QvitterPlugin::settings("blocked_ips"))) {
            $client_ip_is_blocked = in_array($_SERVER['REMOTE_ADDR'], QvitterPlugin::settings("blocked_ips"));
        }
        $sitetitle = common_config('site', 'name');
        $siterootdomain = common_config('site', 'server');
        $qvitterpath = Plugin::staticPath('Qvitter', '');
        $apiroot = common_path('api/', StatusNet::isHTTPS());
        $attachmentroot = common_path('attachment/', StatusNet::isHTTPS());
        $instanceurl = common_path('', StatusNet::isHTTPS());
        // user's browser's language setting
        $user_browser_language = 'en';
        // use english if we can't find the browser language
        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $user_browser_language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
        }
        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?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/css/qvitter.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;
        print QvitterPlugin::settings("favicon");
        ?>
">
				<?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";
                    // maybe openid
                    if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
                        print '				<link rel="openid2.provider" href="' . common_local_url('openidserver') . '"/>' . "\n";
                        print '				<link rel="openid2.local_id" href="' . $user->getProfile()->profileurl . '"/>' . "\n";
                        print '				<link rel="openid2.server" href="' . common_local_url('openidserver') . '"/>' . "\n";
                        print '				<link rel="openid2.delegate" href="' . $user->getProfile()->profileurl . '"/>' . "\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);
                if ($group instanceof User_group) {
                    $group_name = $group->nickname;
                    $group_id = $group_id_or_name;
                }
            } else {
                $group = Local_group::getKV('nickname', $group_id_or_name);
                if ($group instanceof Local_group) {
                    $group_id = $group->group_id;
                    $group_name = $group_id_or_name;
                }
            }
            if (preg_match("/^[a-zA-Z0-9]+\$/", $group_id_or_name) == 1 && isset($group_name) && isset($group_id)) {
                ?>

				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'as')));
                ?>
" type="application/stream+json" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (Activity Streams JSON)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('grouprss', array('nickname' => $group_name)));
                ?>
" type="application/rdf+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (RSS 1.0)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'rss')));
                ?>
" type="application/rss+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (RSS 2.0)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'atom')));
                ?>
" type="application/atom+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (Atom)" />
				<link rel="meta" href="<?php 
                echo htmlspecialchars(common_local_url('foafgroup', array('nickname' => $group_name)));
                ?>
" type="application/rdf+xml" title="FOAF for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group" />
                <?php 
            }
        }
        // oembed discovery for local notices
        if (substr($_SERVER['REQUEST_URI'], 0, 8) == '/notice/' && $this->arg('notice') && array_key_exists('Oembed', StatusNet::getActivePlugins())) {
            $notice = Notice::getKV('id', $this->arg('notice'));
            if ($notice instanceof Notice) {
                if ($notice->isLocal()) {
                    try {
                        $notice_url = $notice->getUrl();
                        print '<link title="oEmbed" href="' . common_local_url('apiqvitteroembednotice', array('id' => $notice->id, 'format' => 'json')) . '?url=' . urlencode($notice_url) . '" type="application/json+oembed" rel="alternate">';
                        print '<link title="oEmbed" href="' . common_local_url('apiqvitteroembednotice', array('id' => $notice->id, 'format' => 'xml')) . '?url=' . urlencode($notice_url) . '" type="application/xml+oembed" rel="alternate">';
                    } catch (Exception $e) {
                        //
                    }
                }
            }
        }
        ?>
				<script>

					/*
					@licstart  The following is the entire license notice for the
					JavaScript code in this page.

					Copyright (C) 2015  Hannes Mannerheim and other contributors

					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/>.

					@licend  The above is the entire license notice
					for the JavaScript code in this page.
					*/

                    window.usersLanguageCode = <?php 
        print json_encode($user_browser_language);
        ?>
;
                    window.usersLanguageNameInEnglish = <?php 
        print json_encode(Locale::getDisplayLanguage($user_browser_language, 'en'));
        ?>
;
                    window.englishLanguageData = <?php 
        print file_get_contents(QVITTERDIR . '/locale/en.json');
        ?>
;
                    window.defaultAvatarStreamSize = <?php 
        print json_encode(Avatar::defaultImage(AVATAR_STREAM_SIZE));
        ?>
;
                    window.defaultAvatarProfileSize = <?php 
        print json_encode(Avatar::defaultImage(AVATAR_PROFILE_SIZE));
        ?>
;
					window.textLimit = <?php 
        print json_encode((int) common_config('site', 'textlimit'));
        ?>
;
					window.registrationsClosed = <?php 
        print json_encode($registrationsclosed);
        ?>
;
					window.thisSiteThinksItIsHttpButIsActuallyHttps = <?php 
        // this is due to a crazy setup at quitter.se, sorry about that
        $siteSSL = common_config('site', 'ssl');
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' && $siteSSL == 'never') {
            $this_site_thinks_it_is_http_but_is_actually_https = true;
            print 'true';
        } else {
            $this_site_thinks_it_is_http_but_is_actually_https = false;
            print 'false';
        }
        ?>
;
					window.siteTitle = <?php 
        print json_encode($sitetitle);
        ?>
;
					window.loggedIn = <?php 
        $logged_in_user_json = json_encode($logged_in_user_obj);
        $logged_in_user_json = str_replace('http:\\/\\/quitter.se\\/', 'https:\\/\\/quitter.se\\/', $logged_in_user_json);
        print $logged_in_user_json;
        ?>
;
					window.timeBetweenPolling = <?php 
        print QvitterPlugin::settings("timebetweenpolling");
        ?>
;
					window.apiRoot = <?php 
        $api_root = common_path("api/", StatusNet::isHTTPS());
        if ($this_site_thinks_it_is_http_but_is_actually_https) {
            $api_root = str_replace('http://', 'https://', $api_root);
        }
        print '\'' . $api_root . '\'';
        ?>
;
					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");
        ?>
';
					window.siteBackground = '<?php 
        print QvitterPlugin::settings("sitebackground");
        ?>
';
					window.enableWelcomeText = <?php 
        print json_encode(QvitterPlugin::settings("enablewelcometext"));
        ?>
;
					window.customWelcomeText = <?php 
        print json_encode(QvitterPlugin::settings("customwelcometext"));
        ?>
;
					window.urlShortenerAPIURL = '<?php 
        print QvitterPlugin::settings("urlshortenerapiurl");
        ?>
';
					window.urlShortenerSignature = '<?php 
        print QvitterPlugin::settings("urlshortenersignature");
        ?>
';
					window.commonSessionToken = '<?php 
        print common_session_token();
        ?>
';
					window.siteMaxThumbnailSize = <?php 
        print common_config('thumbnail', 'maxsize');
        ?>
;
					window.siteAttachmentURLBase = '<?php 
        print $attachmentroot;
        ?>
';
					window.siteEmail = '<?php 
        print common_config('site', 'email');
        ?>
';
					window.siteLicenseTitle = '<?php 
        print common_config('license', 'title');
        ?>
';
					window.siteLicenseURL = '<?php 
        print common_config('license', 'url');
        ?>
';
					window.customTermsOfUse = <?php 
        print json_encode(QvitterPlugin::settings("customtermsofuse"));
        ?>
;
                    window.siteLocalOnlyDefaultPath = <?php 
        print common_config('public', 'localonly') ? 'true' : 'false';
        ?>
;
                    <?php 
        // Get all topics in Qvitter's namespace in Profile_prefs
        if ($logged_in_user) {
            try {
                $qvitter_profile_prefs = Profile_prefs::getNamespace(Profile::current(), 'qvitter');
            } catch (Exception $e) {
                $qvitter_profile_prefs = array();
            }
            if (count($qvitter_profile_prefs) > 0) {
                $topic_data = new stdClass();
                foreach ($qvitter_profile_prefs as $pref) {
                    $topic_data->{$pref->topic} = $pref->data;
                }
                print 'window.qvitterProfilePrefs = ' . json_encode($topic_data) . ';';
            } else {
                print 'window.qvitterProfilePrefs = false;';
            }
        }
        ?>

					// available language files and their last update time
					window.availableLanguages = {<?php 
        // scan all files in the locale directory and create a json object with their change date added
        $available_languages = array_diff(scandir(QVITTERDIR . '/locale'), array('..', '.'));
        foreach ($available_languages as $lankey => $lan) {
            $lancode = substr($lan, 0, strpos($lan, '.'));
            // for the paranthesis containing language region to work with rtl in ltr enviroment and vice versa, we add a
            // special rtl or ltr html char after the paranthesis
            // this list is incomplete, but if any rtl language gets a regional translation, it will probably be arabic
            $rtl_or_ltr_special_char = '&lrm;';
            $base_lancode = substr($lancode, 0, strpos($lancode, '_'));
            if ($base_lancode == 'ar' || $base_lancode == 'fa' || $base_lancode == 'he') {
                $rtl_or_ltr_special_char = '&rlm;';
            }
            // also make an array with all language names, to use for generating menu
            $languagecodesandnames[$lancode]['english_name'] = Locale::getDisplayLanguage($lancode, 'en');
            $languagecodesandnames[$lancode]['name'] = Locale::getDisplayLanguage($lancode, $lancode);
            if (Locale::getDisplayRegion($lancode, $lancode)) {
                $languagecodesandnames[$lancode]['name'] .= ' (' . Locale::getDisplayRegion($lancode, $lancode) . ')' . $rtl_or_ltr_special_char;
            }
            // ahorita meme only on quitter.es
            if ($lancode == 'es_ahorita') {
                if ($siterootdomain == 'quitter.es') {
                    $languagecodesandnames[$lancode]['name'] = 'español (ahorita)';
                } else {
                    unset($available_languages[$lankey]);
                    unset($languagecodesandnames[$lancode]);
                    continue;
                }
            }
            print "\n" . '						"' . $lancode . '": "' . $lan . '?changed=' . date('YmdHis', filemtime(QVITTERDIR . '/locale/' . $lan)) . '",';
        }
        ?>

						};

				</script>
				<?php 
        // event for other plugins to use to add head elements to qvitter
        Event::handle('QvitterEndShowHeadElements', array($this));
        ?>
			</head>
			<body style="background-color:<?php 
        print QvitterPlugin::settings("defaultbackgroundcolor");
        ?>
">
                <?php 
        // add an accessibility toggle link to switch to standard UI, if we're logged in
        if ($logged_in_user) {
            print '<a id="accessibility-toggle-link" href="#"></a>';
        }
        ?>
				<input id="upload-image-input" class="upload-image-input" type="file" name="upload-image-input">
				<div class="topbar">
					<a href="<?php 
        // if we're logged in, the logo links to the home stream
        // if logged out it links to the site's public stream
        if ($logged_in_user) {
            print $instanceurl . $logged_in_user_nickname . '/all';
        } else {
            print $instanceurl . 'main/public';
        }
        ?>
"><div id="logo"></div></a><?php 
        // menu for logged in users
        if ($logged_in_user) {
            ?>
    					<a id="settingslink">
    						<div class="dropdown-toggle">
    							<div class="nav-session" style="background-image:url('<?php 
            print htmlspecialchars($logged_in_user_obj['profile_image_url_profile_size']);
            ?>
')"></div>
    						</div>
    					</a><?php 
        }
        ?>
<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 class="fullwidth"><a id="logout"></a></li>
						<li class="fullwidth dropdown-divider"></li>
						<li class="fullwidth"><a id="edit-profile-header-link"></a></li>
						<li class="fullwidth"><a id="settings" href="<?php 
        print $instanceurl;
        ?>
settings/profile" donthijack></a></li>
						<li class="fullwidth"><a id="faq-link"></a></li>
                        <li class="fullwidth"><a id="shortcuts-link"></a></li>
						<?php 
        if (common_config('invite', 'enabled') && !common_config('site', 'closed')) {
            ?>
							<li class="fullwidth"><a id="invite-link" href="<?php 
            print $instanceurl;
            ?>
main/invite"></a></li>
						<?php 
        }
        ?>
						<li class="fullwidth"><a id="classic-link"></a></li>
						<li class="fullwidth language dropdown-divider"></li>
						<?php 
        // languages
        foreach ($languagecodesandnames as $lancode => $lan) {
            print '<li class="language"><a class="language-link" title="' . $lan['english_name'] . '" data-lang-code="' . $lancode . '">' . $lan['name'] . '</a></li>';
        }
        ?>
                        <li class="fullwidth language dropdown-divider"></li>
                        <li class="fullwidth"><a href="https://git.gnu.io/h2p/Qvitter/tree/master/locale" target="_blank" id="add-edit-language-link"></a></li>
					</ul>
					<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>
								</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>
											<?php 
        // languages
        foreach ($languagecodesandnames as $lancode => $lan) {
            print '<li><a class="language-link" title="' . $lan['english_name'] . '" data-lang-code="' . $lancode . '">' . $lan['name'] . '</a></li>';
        }
        ?>
										</ul>
									</li>
								</ul>
							</div>
						</div>
					</div>
				</div>
                <div id="no-js-error">Please enable javascript to use this site.<script>var element = document.getElementById('no-js-error'); element.parentNode.removeChild(element);</script></div>
				<div id="page-container">
					<?php 
        $site_notice = common_config('site', 'notice');
        if (!empty($site_notice)) {
            print '<div id="site-notice">' . common_config('site', 'notice') . '</div>';
        }
        // welcome text, login and register container if logged out
        if ($logged_in_user === null) {
            ?>
                        <div class="front-welcome-text <?php 
            if ($registrationsclosed) {
                print 'registrations-closed';
            }
            ?>
"></div>
                        <div id="login-register-container">
    						<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 id="forgot-password" href="<?php 
            print $instanceurl;
            ?>
main/recoverpassword" ></a>
    									<input type="hidden" id="token" name="token" value="<?php 
            print common_session_token();
            ?>
">
    									<?php 
            if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
                print '<a href="' . $instanceurl . 'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>';
            }
            ?>
    								</div>
    							</form>
    						</div>
    						<?php 
            if ($registrationsclosed === false && $client_ip_is_blocked === false) {
                ?>
<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>
                            <div id="other-servers-link"></div><?php 
            }
            ?>
<div id="qvitter-notice-logged-out"><?php 
            print common_config('site', 'qvitternoticeloggedout');
            ?>
</div>
                        </div><?php 
        }
        // box containing the logged in users queet count and compose form
        if ($logged_in_user) {
            ?>
                        <div id="user-container" style="display:none;">
    						<div id="user-header" style="background-image:url('<?php 
            print htmlspecialchars($logged_in_user_obj['cover_photo']);
            ?>
')">
    							<div id="mini-edit-profile-button"></div>
    							<div class="profile-header-inner-overlay"></div>
    							<div id="user-avatar-container"><img id="user-avatar" src="<?php 
            print htmlspecialchars($logged_in_user_obj['profile_image_url_profile_size']);
            ?>
" /></div>
    							<div id="user-name"><?php 
            print htmlspecialchars($logged_in_user_obj['name']);
            ?>
</div>
    							<div id="user-screen-name"><?php 
            print htmlspecialchars($logged_in_user_obj['screen_name']);
            ?>
</div>
    						</div>
    						<ul id="user-body">
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
" id="user-queets"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['statuses_count'];
            ?>
</strong></a></li>
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
/subscriptions" id="user-following"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['friends_count'];
            ?>
</strong></a></li>
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
/groups" id="user-groups"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['groups_count'];
            ?>
</strong></a></li>
    						</ul>
    						<div id="user-footer">
    							<div id="user-footer-inner">
    								<div id="queet-box" class="queet-box queet-box-syntax" data-start-text=""></div>
    								<div class="syntax-middle"></div>
    								<div class="syntax-two" contenteditable="true"></div>
    								<div class="mentions-suggestions"></div>
    								<div class="queet-toolbar">
    									<div class="queet-box-extras">
    										<button class="upload-image"></button>
    										<button class="shorten disabled">URL</button>
    									</div>
    									<div class="queet-button">
    										<span class="queet-counter"></span>
    										<button></button>
    									</div>
    								</div>
    							</div>
    						</div>
                            <div id="main-menu" class="menu-container"><?php 
            if ($logged_in_user) {
                ?>
<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/all" class="stream-selection friends-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/notifications" class="stream-selection notifications"><span id="unseen-notifications"></span><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/replies" class="stream-selection mentions"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
" class="stream-selection my-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/favorites" class="stream-selection favorites"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl;
                ?>
main/public" class="stream-selection public-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl;
                ?>
main/all" class="stream-selection public-and-external-timeline"><i class="chev-right"></i></a>
                                        <?php 
            }
            ?>
        						</div>
        						<div class="menu-container" id="bookmark-container"></div>
                                <div class="menu-container" id="history-container"></div>
                                <div id="clear-history"></div>
        						<div id="qvitter-notice"><?php 
            print common_config('site', 'qvitternotice');
            ?>
</div>
        					</div><?php 
        }
        ?>

                    <div id="feed">
						<div id="feed-header">
							<div id="feed-header-inner">
								<h2></h2>
								<div class="reload-stream"></div>
							</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="hidden-html"><?php 
        // adds temporary support for microformats and linkbacks on the notice page
        if (substr($_SERVER['REQUEST_URI'], 0, 8) == '/notice/' && $this->arg('notice')) {
            echo '<ol class="notices xoxo">';
            if ($notice instanceof Notice) {
                $widget = new NoticeListItem($notice, $this);
                $widget->show();
                $this->flush();
            }
            echo '</ol>';
        }
        Event::handle('QvitterHiddenHtml', array($this));
        ?>
</div>
					<div id="footer"><div id="footer-spinner-container"></div></div>
				</div>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery-2.1.4.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery-2.1.4.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery-ui.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery-ui.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery.minicolors.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery.minicolors.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery.jWindowCrop.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery.jWindowCrop.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/load-image.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/load-image.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/xregexp-all-3.0.0-pre.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/xregexp-all-3.0.0-pre.js'));
        ?>
"></script>
                <script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/lz-string.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/lz-string.js'));
        ?>
"></script>
                <script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/bowser.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/bowser.min.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/dom-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/dom-functions.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/misc-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/misc-functions.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/ajax-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/ajax-functions.js'));
        ?>
"></script>
                <script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/stream-router.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/stream-router.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/qvitter.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/qvitter.js'));
        ?>
"></script>
				<?php 
        // event for other plugins to add scripts to qvitter
        Event::handle('QvitterEndShowScripts', array($this));
        // we might have custom javascript in the config file that we want to add
        if (QvitterPlugin::settings('js')) {
            print '<script type="text/javascript">' . QvitterPlugin::settings('js') . '</script>';
        }
        ?>
			<div id="dynamic-styles">
				<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,
					.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email,
					div.syntax-middle span,
					#user-body strong,
					ul.stats,
					.stream-item:not(.temp-post) ul.queet-actions li .icon:not(.is-mine):hover:before,
					.show-full-conversation,
					#user-body #user-queets:hover .label,
					#user-body #user-groups:hover .label,
					#user-body #user-following:hover .label,
					ul.stats a strong,
					.queet-box-extras button,
					#openid-login:hover:after,
                    .post-to-group {
						color:/*COLORSTART*/<?php 
        print QvitterPlugin::settings("defaultlinkcolor");
        ?>
/*COLOREND*/;
						}
					#unseen-notifications,
					.stream-item.notification.not-seen > .queet::before,
					#top-compose,
					#logo,
					.queet-toolbar button,
					#user-header,
					.profile-header-inner,
					.topbar,
					.menu-container,
					.member-button.member,
					.external-follow-button.following,
					.qvitter-follow-button.following,
					.save-profile-button,
					.crop-and-save-button,
					.topbar .global-nav.show-logo:before,
					.topbar .global-nav.pulse-logo:before,
                    .dropdown-menu li:not(.dropdown-caret) a:hover {
						background-color:/*BACKGROUNDCOLORSTART*/<?php 
        print QvitterPlugin::settings("defaultlinkcolor");
        ?>
/*BACKGROUNDCOLOREND*/;
						}
					.queet-box-syntax[contenteditable="true"]:focus,
                    .stream-item.selected-by-keyboard::before {
						border-color:/*BORDERCOLORSTART*/#999999/*BORDERCOLOREND*/;
						}
					#user-footer-inner,
					.inline-reply-queetbox,
					#popup-faq #faq-container p.indent {
						background-color:/*LIGHTERBACKGROUNDCOLORSTART*/rgb(205,230,239)/*LIGHTERBACKGROUNDCOLOREND*/;
						}
					#user-footer-inner,
					.queet-box,
					.queet-box-syntax[contenteditable="true"],
					.inline-reply-queetbox,
					span.inline-reply-caret,
				    .stream-item.expanded .stream-item.first-visible-after-parent,
					#popup-faq #faq-container p.indent,
                    .post-to-group,
                    .quoted-notice:hover,
                    .oembed-item:hover,
                    .stream-item:hover:not(.expanded) .quoted-notice:hover,
                    .stream-item:hover:not(.expanded) .oembed-item:hover {
						border-color:/*LIGHTERBORDERCOLORSTART*/rgb(155,206,224)/*LIGHTERBORDERCOLOREND*/;
						}
					span.inline-reply-caret .caret-inner {
						border-bottom-color:/*LIGHTERBORDERBOTTOMCOLORSTART*/rgb(205,230,239)/*LIGHTERBORDERBOTTOMCOLOREND*/;
						}

					.modal-close .icon,
					.chev-right,
					.close-right,
					button.icon.nav-search,
					.member-button .join-text i,
					.external-member-button .join-text i,
					.external-follow-button .follow-text i,
					.qvitter-follow-button .follow-text i,
					#logo,
					.upload-cover-photo,
					.upload-avatar,
					.upload-background-image,
					button.shorten i,
					.reload-stream,
					.topbar .global-nav:before,
					.stream-item.notification.repeat .dogear,
					.stream-item.notification.like .dogear,
					.ostatus-link,
					.close-edit-profile-window {
						background-image: url("<?php 
        print QvitterPlugin::settings("sprite");
        ?>
");
						background-size: 500px 1329px;
						}
					@media (max-width: 910px) {
						#search-query,
						.menu-container a,
						.menu-container a.current,
						.stream-selection.friends-timeline:after,
						.stream-selection.notifications:after,
						.stream-selection.my-timeline:after,
						.stream-selection.public-timeline:after {
							background-image: url("<?php 
        print QvitterPlugin::settings("sprite");
        ?>
");
							background-size: 500px 1329px;
							}
						}

				</style>
			</div>
			</body>
		</html>


			<?php 
    }
Exemplo n.º 30
0
 /**
  * Show content license.
  *
  * @return nothing
  */
 function showContentLicense()
 {
     if (Event::handle('StartShowContentLicense', array($this))) {
         // TRANS: DT element for StatusNet site content license.
         $this->element('dt', array('id' => 'site_content_license'), _('Site content license'));
         $this->elementStart('dd', array('id' => 'site_content_license_cc'));
         switch (common_config('license', 'type')) {
             case 'private':
                 // TRANS: Content license displayed when license is set to 'private'.
                 // TRANS: %1$s is the site name.
                 $this->element('p', null, sprintf(_('Content and data of %1$s are private and confidential.'), common_config('site', 'name')));
                 // fall through
             // fall through
             case 'allrightsreserved':
                 if (common_config('license', 'owner')) {
                     // TRANS: Content license displayed when license is set to 'allrightsreserved'.
                     // TRANS: %1$s is the copyright owner.
                     $this->element('p', null, sprintf(_('Content and data copyright by %1$s. All rights reserved.'), common_config('license', 'owner')));
                 } else {
                     // TRANS: Content license displayed when license is set to 'allrightsreserved' and no owner is set.
                     $this->element('p', null, _('Content and data copyright by contributors. All rights reserved.'));
                 }
                 break;
             case 'cc':
                 // fall through
             // fall through
             default:
                 $this->elementStart('p');
                 $image = common_config('license', 'image');
                 $sslimage = common_config('license', 'sslimage');
                 if (StatusNet::isHTTPS()) {
                     if (!empty($sslimage)) {
                         $url = $sslimage;
                     } else {
                         if (preg_match('#^http://i.creativecommons.org/#', $image)) {
                             // CC support HTTPS on their images
                             $url = preg_replace('/^http/', 'https', $image);
                         } else {
                             // Better to show mixed content than no content
                             $url = $image;
                         }
                     }
                 } else {
                     $url = $image;
                 }
                 $this->element('img', array('id' => 'license_cc', 'src' => $url, 'alt' => common_config('license', 'title'), 'width' => '80', 'height' => '15'));
                 $this->text(' ');
                 // TRANS: license message in footer.
                 // TRANS: %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
                 $notice = _('All %1$s content and data are available under the %2$s license.');
                 $link = "<a class=\"license\" rel=\"external license\" href=\"" . htmlspecialchars(common_config('license', 'url')) . "\">" . htmlspecialchars(common_config('license', 'title')) . "</a>";
                 $this->raw(sprintf(htmlspecialchars($notice), htmlspecialchars(common_config('site', 'name')), $link));
                 $this->elementEnd('p');
                 break;
         }
         $this->elementEnd('dd');
         Event::handle('EndShowContentLicense', array($this));
     }
 }