\\\\_\ ·
· \\) \____) ·
· ·
· ·
· ·
· 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 . ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
class QvitterAction extends ApiAction
{
function isReadOnly($args)
{
return true;
}
protected function prepare(array $args=array())
{
parent::prepare($args);
// if we're logged in but we have missing or incorrect csrf cookie, logout
if(common_logged_in()) {
$csrf_token = sha1(common_config('qvitter', 'appid').session_id());
if(!isset($_COOKIE['Qvitter-CSRF']) || $_COOKIE['Qvitter-CSRF'] != $csrf_token) {
header('Location: '.common_path('').'main/logout');
die();
}
}
$user = common_current_user();
return true;
}
protected function handle()
{
parent::handle();
$this->showQvitter();
}
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());
$favicon_path = QvitterPlugin::settings("favicon_path");
// 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.'"');
}
}
}
?>