Merge remote-tracking branch 'upstream/master'
Conflicts: mod/admin.php mod/settings.php
This commit is contained in:
commit
e0cf2c5167
4
boot.php
4
boot.php
|
@ -12,9 +12,9 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
|
|||
require_once('include/features.php');
|
||||
|
||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '3.2.1744' );
|
||||
define ( 'FRIENDICA_VERSION', '3.2.1745' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1165 );
|
||||
define ( 'DB_UPDATE_VERSION', 1166 );
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
||||
|
|
19
database.sql
19
database.sql
|
@ -1156,3 +1156,22 @@ CREATE TABLE IF NOT EXISTS `tag` (
|
|||
PRIMARY KEY (`iid`, `tag`),
|
||||
KEY `tag` (`tag`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `push_subscriber`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `push_subscriber` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`uid` int(11) NOT NULL,
|
||||
`callback_url` char(255) NOT NULL,
|
||||
`topic` char(255) NOT NULL,
|
||||
`nickname` char(255) NOT NULL,
|
||||
`push` int(11) NOT NULL,
|
||||
`last_update` datetime NOT NULL,
|
||||
`secret` char(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -24,6 +24,11 @@ Bevor du anfängst: suche dir einen Domain- oder Subdomainnamen für deinen Serv
|
|||
|
||||
[Dreamhost.com bietet ein ausreichendes Hosting-Paket mit den nötigen Features zu einem annehmbaren Preis. Wenn dein Hosting-Anbieter keinen Unix-Zugriff erlaubt, kannst du Schwierigkeiten mit der Einrichtung der Webseite haben.
|
||||
|
||||
1.1. APT-Pakete
|
||||
- Apache: sudo apt-get install apache2
|
||||
- PHP5: sudo apt-get install php5
|
||||
- PHP5-Zusätzliche Pakete: sudo apt-get install php5-curl php5-gd php5-mysql php5-mcrypt
|
||||
- MySQL: sudo apt-get install mysql-server
|
||||
|
||||
2. Entpacke die Friendica-Daten in das Quellverzeichnis (root) des Dokumentenbereichs deines Webservers.
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ function contact_photo_menu($contact) {
|
|||
$status_link="";
|
||||
$photos_link="";
|
||||
$posts_link="";
|
||||
$contact_drop_link = "";
|
||||
$poke_link="";
|
||||
|
||||
$sparkle = false;
|
||||
|
@ -214,6 +215,7 @@ function contact_photo_menu($contact) {
|
|||
$status_link = $profile_link . "?url=status";
|
||||
$photos_link = $profile_link . "?url=photos";
|
||||
$profile_link = $profile_link . "?url=profile";
|
||||
$contact_drop_link = $a->get_baseurl() . '/contacts/' . $contact['id'] . '/drop';
|
||||
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
|
||||
}
|
||||
|
||||
|
@ -228,6 +230,7 @@ function contact_photo_menu($contact) {
|
|||
'photos' => array(t("View Photos"), $photos_link),
|
||||
'network' => array(t("Network Posts"), $posts_link),
|
||||
'edit' => array(t("Edit Contact"), $contact_url),
|
||||
'drop' => array(t("Drop Contact"), $contact_drop_link),
|
||||
'pm' => array(t("Send PM"), $pm_url),
|
||||
);
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ function fetch_lrdd_template($host) {
|
|||
}
|
||||
if(count($links)) {
|
||||
foreach($links as $link)
|
||||
if($link['@attributes']['rel'] && $link['@attributes']['rel'] === 'lrdd')
|
||||
if($link['@attributes']['rel'] && $link['@attributes']['rel'] === 'lrdd' && (!$link['@attributes']['type'] || $link['@attributes']['type'] === 'application/xrd+xml'))
|
||||
$tpl = $link['@attributes']['template'];
|
||||
}
|
||||
if(! strpos($tpl,'{uri}'))
|
||||
|
@ -566,7 +566,7 @@ function fetch_xrd_links($url) {
|
|||
|
||||
$xrd_timeout = intval(get_config('system','xrd_timeout'));
|
||||
$redirects = 0;
|
||||
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 20));
|
||||
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 20), "application/xrd+xml");
|
||||
|
||||
logger('fetch_xrd_links: ' . $xml, LOGGER_DATA);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ require_once('include/html2plain.php');
|
|||
* tgroup (in items.php)
|
||||
* wall-new (in photos.php, item.php)
|
||||
* removeme (in Contact.php)
|
||||
* relocate (in uimport.php)
|
||||
*
|
||||
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
|
||||
*/
|
||||
|
@ -965,9 +966,18 @@ function notifier_run(&$argv, &$argc){
|
|||
$h = trim($h);
|
||||
if(! strlen($h))
|
||||
continue;
|
||||
$params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
|
||||
|
||||
if ($h === '[internal]') {
|
||||
// Set push flag for PuSH subscribers to this topic,
|
||||
// they will be notified in queue.php
|
||||
q("UPDATE `push_subscriber` SET `push` = 1 " .
|
||||
"WHERE `nickname` = '%s'", dbesc($owner['nickname']));
|
||||
} else {
|
||||
|
||||
$params = 'hub.mode=publish&hub.url=' . urlencode( $a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
|
||||
post_url($h,$params);
|
||||
logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
|
||||
}
|
||||
if(count($hubs) > 1)
|
||||
sleep(7); // try and avoid multiple hubs responding at precisely the same time
|
||||
}
|
||||
|
|
|
@ -2,6 +2,64 @@
|
|||
require_once("boot.php");
|
||||
require_once('include/queue_fn.php');
|
||||
|
||||
function handle_pubsubhubbub() {
|
||||
global $a, $db;
|
||||
|
||||
logger('queue [pubsubhubbub]: start');
|
||||
|
||||
// We'll push to each subscriber that has push > 0,
|
||||
// i.e. there has been an update (set in notifier.php).
|
||||
|
||||
$r = q("SELECT * FROM `push_subscriber` WHERE `push` > 0");
|
||||
|
||||
foreach($r as $rr) {
|
||||
$params = get_feed_for($a, '', $rr['nickname'], $rr['last_update']);
|
||||
$hmac_sig = hash_hmac("sha1", $params, $rr['secret']);
|
||||
|
||||
$headers = array("Content-type: application/atom+xml",
|
||||
sprintf("Link: <%s>;rel=hub," .
|
||||
"<%s>;rel=self",
|
||||
$a->get_baseurl() . '/pubsubhubbub',
|
||||
$rr['topic']),
|
||||
"X-Hub-Signature: sha1=" . $hmac_sig);
|
||||
|
||||
logger('queue [pubsubhubbub]: POST', $headers);
|
||||
|
||||
post_url($rr['callback_url'], $params, $headers);
|
||||
$ret = $a->get_curl_code();
|
||||
|
||||
if ($ret >= 200 && $ret <= 299) {
|
||||
logger('queue [pubsubhubbub]: successfully pushed to ' .
|
||||
$rr['callback_url']);
|
||||
|
||||
// set last_update to "now", and reset push=0
|
||||
$date_now = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
|
||||
q("UPDATE `push_subscriber` SET `push` = 0, last_update = '%s' " .
|
||||
"WHERE id = %d",
|
||||
dbesc($date_now),
|
||||
intval($rr['id']));
|
||||
|
||||
} else {
|
||||
logger('queue [pubsubhubbub]: error when pushing to ' .
|
||||
$rr['callback_url'] . 'HTTP: ', $ret);
|
||||
|
||||
// we use the push variable also as a counter, if we failed we
|
||||
// increment this until some upper limit where we give up
|
||||
$new_push = intval($rr['push']) + 1;
|
||||
|
||||
if ($new_push > 30) // OK, let's give up
|
||||
$new_push = 0;
|
||||
|
||||
q("UPDATE `push_subscriber` SET `push` = %d, last_update = '%s' " .
|
||||
"WHERE id = %d",
|
||||
$new_push,
|
||||
dbesc($date_now),
|
||||
intval($rr['id']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function queue_run(&$argv, &$argc){
|
||||
global $a, $db;
|
||||
|
||||
|
@ -38,6 +96,8 @@ function queue_run(&$argv, &$argc){
|
|||
|
||||
logger('queue: start');
|
||||
|
||||
handle_pubsubhubbub();
|
||||
|
||||
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
|
||||
|
||||
$r = q("select * from deliverq where 1");
|
||||
|
|
|
@ -1554,7 +1554,7 @@ if(! function_exists('feed_hublinks')) {
|
|||
* @return string hub link xml elements
|
||||
*/
|
||||
function feed_hublinks() {
|
||||
|
||||
$a = get_app();
|
||||
$hub = get_config('system','huburl');
|
||||
|
||||
$hubxml = '';
|
||||
|
@ -1565,6 +1565,8 @@ function feed_hublinks() {
|
|||
$h = trim($h);
|
||||
if(! strlen($h))
|
||||
continue;
|
||||
if ($h === '[internal]')
|
||||
$h = $a->get_baseurl() . '/pubsubhubbub';
|
||||
$hubxml .= '<link rel="hub" href="' . xmlify($h) . '" />' . "\n" ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ function admin_content(&$a) {
|
|||
|
||||
/* get plugins admin page */
|
||||
|
||||
$r = q("SELECT * FROM `addon` WHERE `plugin_admin`=1");
|
||||
$r = q("SELECT name FROM `addon` WHERE `plugin_admin`=1");
|
||||
$aside['plugins_admin']=Array();
|
||||
foreach ($r as $h){
|
||||
$plugin =$h['name'];
|
||||
|
@ -237,6 +237,70 @@ function admin_page_site_post(&$a){
|
|||
|
||||
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
|
||||
|
||||
// relocate
|
||||
if (x($_POST,'relocate') && x($_POST,'relocate_url') && $_POST['relocate_url']!=""){
|
||||
$new_url = $_POST['relocate_url'];
|
||||
$new_url = rtrim($new_url,"/");
|
||||
|
||||
$parsed = @parse_url($new_url);
|
||||
if (!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
|
||||
notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
}
|
||||
|
||||
/* steps:
|
||||
* replace all "baseurl" to "new_url" in config, profile, term, items and contacts
|
||||
* send relocate for every local user
|
||||
* */
|
||||
|
||||
$old_url = $a->get_baseurl(true);
|
||||
|
||||
function update_table($table_name, $fields, $old_url, $new_url) {
|
||||
global $db, $a;
|
||||
|
||||
$dbold = dbesc($old_url);
|
||||
$dbnew = dbesc($new_url);
|
||||
|
||||
$upd = array();
|
||||
foreach ($fields as $f) {
|
||||
$upd[] = "`$f` = REPLACE(`$f`, '$dbold', '$dbnew')";
|
||||
}
|
||||
|
||||
$upds = implode(", ", $upd);
|
||||
|
||||
|
||||
|
||||
$q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
|
||||
$r = q($q);
|
||||
if (!$r) {
|
||||
notice( "Falied updating '$table_name': " . $db->error );
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
}
|
||||
}
|
||||
|
||||
// update tables
|
||||
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
|
||||
update_table("term", array('url'), $old_url, $new_url);
|
||||
update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
|
||||
update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
|
||||
|
||||
// update config
|
||||
$a->set_baseurl($new_url);
|
||||
set_config('system','url',$new_url);
|
||||
|
||||
// send relocate
|
||||
$users = q("SELECT uid FROM user WHERE account_removed = 0 AND account_expired = 0");
|
||||
|
||||
foreach ($users as $user) {
|
||||
proc_run('php', 'include/notifier.php', 'relocate', $user['uid']);
|
||||
}
|
||||
|
||||
info("Relocation started. Could take a while to complete.");
|
||||
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
}
|
||||
// end relocate
|
||||
|
||||
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
|
||||
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
|
||||
$info = ((x($_POST,'info')) ? trim($_POST['info']) : false);
|
||||
|
@ -502,13 +566,13 @@ function admin_page_site(&$a) {
|
|||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Site'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$registration' => t('Registration'),
|
||||
'$upload' => t('File upload'),
|
||||
'$corporate' => t('Policies'),
|
||||
'$advanced' => t('Advanced'),
|
||||
'$performance' => t('Performance'),
|
||||
|
||||
'$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
// name, label, value, help string, extra data...
|
||||
'$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), 'UTF-8'),
|
||||
|
@ -564,6 +628,9 @@ function admin_page_site(&$a) {
|
|||
'$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), "The lock file is used to avoid multiple pollers at one time. Only define a folder here."),
|
||||
'$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), "If you have a restricted system where the webserver can't access the system temp path, enter another path here."),
|
||||
'$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), "If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."),
|
||||
|
||||
'$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."),
|
||||
|
||||
'$form_security_token' => get_form_security_token("admin_site"),
|
||||
|
||||
));
|
||||
|
@ -605,7 +672,7 @@ function admin_page_dbsync(&$a) {
|
|||
}
|
||||
|
||||
$failed = array();
|
||||
$r = q("select * from config where `cat` = 'database' ");
|
||||
$r = q("select k, v from config where `cat` = 'database' ");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$upd = intval(substr($rr['k'],7));
|
||||
|
@ -711,7 +778,7 @@ function admin_page_users_post(&$a){
|
|||
function admin_page_users(&$a){
|
||||
if ($a->argc>2) {
|
||||
$uid = $a->argv[3];
|
||||
$user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
|
||||
$user = q("SELECT username, blocked FROM `user` WHERE `uid`=%d", intval($uid));
|
||||
if (count($user)==0){
|
||||
notice( 'User not found' . EOL);
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
|
@ -827,7 +894,7 @@ function admin_page_users(&$a){
|
|||
// strings //
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Users'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Add User'),
|
||||
'$select_all' => t('select all'),
|
||||
'$h_pending' => t('User registrations waiting for confirm'),
|
||||
'$h_deleted' => t('User waiting for permanent deletion'),
|
||||
|
@ -973,7 +1040,7 @@ function admin_page_plugins(&$a){
|
|||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Plugins'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$function' => 'plugins',
|
||||
'$plugins' => $plugins,
|
||||
|
@ -1173,7 +1240,7 @@ function admin_page_themes(&$a){
|
|||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Themes'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$function' => 'themes',
|
||||
'$plugins' => $xthemes,
|
||||
|
@ -1260,7 +1327,7 @@ readable.");
|
|||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Logs'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$clear' => t('Clear'),
|
||||
'$data' => $data,
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
|
|
|
@ -84,7 +84,7 @@ function group_content(&$a) {
|
|||
$tpl = get_markup_template('group_edit.tpl');
|
||||
|
||||
$context = array(
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Group'),
|
||||
);
|
||||
|
||||
if(($a->argc == 2) && ($a->argv[1] === 'new')) {
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
function post_var($name) {
|
||||
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
|
||||
}
|
||||
|
||||
function pubsubhubbub_init(&$a) {
|
||||
// PuSH subscription must be considered "public" so just block it
|
||||
// if public access isn't enabled.
|
||||
if (get_config('system', 'block_public')) {
|
||||
http_status_exit(403);
|
||||
}
|
||||
|
||||
// Subscription request from subscriber
|
||||
// https://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.4.html#anchor4
|
||||
// Example from GNU Social:
|
||||
// [hub_mode] => subscribe
|
||||
// [hub_callback] => http://status.local/main/push/callback/1
|
||||
// [hub_verify] => sync
|
||||
// [hub_verify_token] => af11...
|
||||
// [hub_secret] => af11...
|
||||
// [hub_topic] => http://friendica.local/dfrn_poll/sazius
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$hub_mode = post_var('hub_mode');
|
||||
$hub_callback = post_var('hub_callback');
|
||||
$hub_verify = post_var('hub_verify');
|
||||
$hub_verify_token = post_var('hub_verify_token');
|
||||
$hub_secret = post_var('hub_secret');
|
||||
$hub_topic = post_var('hub_topic');
|
||||
|
||||
// check for valid hub_mode
|
||||
if ($hub_mode === 'subscribe') {
|
||||
$subscribe = 1;
|
||||
} else if ($hub_mode === 'unsubscribe') {
|
||||
$subscribe = 0;
|
||||
} else {
|
||||
logger("pubsubhubbub: invalid hub_mode=$hub_mode, ignoring.");
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
logger("pubsubhubbub: $hub_mode request from " .
|
||||
$_SERVER['REMOTE_ADDR']);
|
||||
|
||||
// get the nick name from the topic, a bit hacky but needed
|
||||
$nick = substr(strrchr($hub_topic, "/"), 1);
|
||||
|
||||
if (!$nick) {
|
||||
logger('pubsubhubbub: bad hub_topic=$hub_topic, ignoring.');
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
// fetch user from database given the nickname
|
||||
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s'" .
|
||||
" AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
|
||||
dbesc($nick));
|
||||
|
||||
if(!count($r)) {
|
||||
logger('pubsubhubbub: local account not found: ' . $nick);
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
$owner = $r[0];
|
||||
|
||||
// abort if user's wall is supposed to be private
|
||||
if ($r[0]['hidewall']) {
|
||||
logger('pubsubhubbub: local user ' . $nick .
|
||||
'has chosen to hide wall, ignoring.');
|
||||
http_status_exit(403);
|
||||
}
|
||||
|
||||
// get corresponding row from contact table
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0" .
|
||||
" AND `pending` = 0 LIMIT 1",
|
||||
intval($owner['uid']));
|
||||
if(!count($r)) {
|
||||
logger('pubsubhubbub: contact not found.');
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
$contact = $r[0];
|
||||
|
||||
// sanity check that topic URLs are the same
|
||||
if(!link_compare($hub_topic, $contact['poll'])) {
|
||||
logger('pubsubhubbub: hub topic ' . $hub_topic . ' != ' .
|
||||
$contact['poll']);
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
// do subscriber verification according to the PuSH protocol
|
||||
$hub_challenge = random_string(40);
|
||||
$params = 'hub.mode=' .
|
||||
($subscribe == 1 ? 'subscribe' : 'unsubscribe') .
|
||||
'&hub.topic=' . urlencode($hub_topic) .
|
||||
'&hub.challenge=' . $hub_challenge .
|
||||
'&hub.lease_seconds=604800' .
|
||||
'&hub.verify_token=' . $hub_verify_token;
|
||||
|
||||
// lease time is hard coded to one week (in seconds)
|
||||
// we don't actually enforce the lease time because GNU
|
||||
// Social/StatusNet doesn't honour it (yet)
|
||||
|
||||
$body = fetch_url($hub_callback . "?" . $params);
|
||||
$ret = $a->get_curl_code();
|
||||
|
||||
// give up if the HTTP return code wasn't a success (2xx)
|
||||
if ($ret < 200 || $ret > 299) {
|
||||
logger("pubsubhubbub: subscriber verification at $hub_callback ".
|
||||
"returned $ret, ignoring.");
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
// check that the correct hub_challenge code was echoed back
|
||||
if (trim($body) !== $hub_challenge) {
|
||||
logger("pubsubhubbub: subscriber did not echo back ".
|
||||
"hub.challenge, ignoring.");
|
||||
logger("\"$hub_challenge\" != \"".trim($body)."\"");
|
||||
http_status_exit(404);
|
||||
}
|
||||
|
||||
// fetch the old subscription if it exists
|
||||
$r = q("SELECT * FROM `push_subscriber` WHERE `callback_url` = '%s'",
|
||||
dbesc($hub_callback));
|
||||
|
||||
// delete old subscription if it exists
|
||||
q("DELETE FROM `push_subscriber` WHERE `callback_url` = '%s'",
|
||||
dbesc($hub_callback));
|
||||
|
||||
if ($subscribe) {
|
||||
$last_update = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
|
||||
$push_flag = 0;
|
||||
|
||||
// if we are just updating an old subscription, keep the
|
||||
// old values for push and last_update
|
||||
if (count($r)) {
|
||||
$last_update = $r[0]['last_update'];
|
||||
$push_flag = $r[0]['push'];
|
||||
}
|
||||
|
||||
// subscribe means adding the row to the table
|
||||
q("INSERT INTO `push_subscriber` (`uid`, `callback_url`, " .
|
||||
"`topic`, `nickname`, `push`, `last_update`, `secret`) values " .
|
||||
"(%d, '%s', '%s', '%s', %d, '%s', '%s')",
|
||||
intval($owner['uid']),
|
||||
dbesc($hub_callback),
|
||||
dbesc($hub_topic),
|
||||
dbesc($nick),
|
||||
intval($push_flag),
|
||||
dbesc($last_update),
|
||||
dbesc($hub_secret));
|
||||
logger("pubsubhubbub: successfully subscribed [$hub_callback].");
|
||||
} else {
|
||||
logger("pubsubhubbub: successfully unsubscribed [$hub_callback].");
|
||||
// we do nothing here, since the row was already deleted
|
||||
}
|
||||
http_status_exit(202);
|
||||
}
|
||||
|
||||
killme();
|
||||
}
|
||||
|
||||
?>
|
|
@ -306,11 +306,17 @@ function settings_post(&$a) {
|
|||
|
||||
check_form_security_token_redirectOnErr('/settings', 'settings');
|
||||
|
||||
if (x($_POST,'resend_relocate')) {
|
||||
proc_run('php', 'include/notifier.php', 'relocate', local_user());
|
||||
info(t("Relocate message has been send to your contacts"));
|
||||
goaway($a->get_baseurl(true) . '/settings');
|
||||
}
|
||||
|
||||
call_hooks('settings_post', $_POST);
|
||||
|
||||
if((x($_POST,'npassword')) || (x($_POST,'confirm'))) {
|
||||
if((x($_POST,'password')) || (x($_POST,'confirm'))) {
|
||||
|
||||
$newpass = $_POST['npassword'];
|
||||
$newpass = $_POST['password'];
|
||||
$confirm = $_POST['confirm'];
|
||||
$oldpass = hash('whirlpool', $_POST['opassword']);
|
||||
|
||||
|
@ -416,7 +422,7 @@ function settings_post(&$a) {
|
|||
$email_changed = true;
|
||||
// check for the correct password
|
||||
$r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
|
||||
$password = hash('whirlpool', $_POST['password']);
|
||||
$password = hash('whirlpool', $_POST['mpassword']);
|
||||
if ($password != $r[0]['password']) {
|
||||
$err .= t('Wrong Password') . EOL;
|
||||
$email = $a->user['email'];
|
||||
|
@ -592,7 +598,7 @@ function settings_content(&$a) {
|
|||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_oauth"),
|
||||
'$title' => t('Add application'),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$cancel' => t('Cancel'),
|
||||
'$name' => array('name', t('Name'), '', ''),
|
||||
'$key' => array('key', t('Consumer Key'), '', ''),
|
||||
|
@ -702,7 +708,7 @@ function settings_content(&$a) {
|
|||
'$form_security_token' => get_form_security_token("settings_features"),
|
||||
'$title' => t('Additional Features'),
|
||||
'$features' => $arr,
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
));
|
||||
return $o;
|
||||
}
|
||||
|
@ -771,7 +777,7 @@ function settings_content(&$a) {
|
|||
'$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
|
||||
'$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder'))),
|
||||
'$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
|
||||
'$settings_connectors' => $settings_connectors
|
||||
));
|
||||
|
@ -847,7 +853,7 @@ function settings_content(&$a) {
|
|||
$o = replace_macros($tpl, array(
|
||||
'$ptitle' => t('Display Settings'),
|
||||
'$form_security_token' => get_form_security_token("settings_display"),
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$uid' => local_user(),
|
||||
|
||||
|
@ -1075,17 +1081,17 @@ function settings_content(&$a) {
|
|||
$o .= replace_macros($stpl, array(
|
||||
'$ptitle' => t('Account Settings'),
|
||||
|
||||
'$submit' => t('Submit'),
|
||||
'$submit' => t('Save Settings'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$uid' => local_user(),
|
||||
'$form_security_token' => get_form_security_token("settings"),
|
||||
'$nickname_block' => $prof_addr,
|
||||
|
||||
'$h_pass' => t('Password Settings'),
|
||||
'$password1'=> array('npassword', t('New Password:'), '', ''),
|
||||
'$password1'=> array('password', t('New Password:'), '', ''),
|
||||
'$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')),
|
||||
'$password3'=> array('opassword', t('Current Password:'), '', t('Your current password to confirm the changes')),
|
||||
'$password4'=> array('password', t('Password:'), '', t('Your current password to confirm the changes')),
|
||||
'$password4'=> array('mpassword', t('Password:'), '', t('Your current password to confirm the changes')),
|
||||
'$oid_enable' => (! get_config('system','no_openid')),
|
||||
'$openid' => $openid_field,
|
||||
|
||||
|
@ -1152,6 +1158,10 @@ function settings_content(&$a) {
|
|||
'$h_descadvn' => t('Change the behaviour of this account for special situations'),
|
||||
'$pagetype' => $pagetype,
|
||||
|
||||
'$relocate' => t('Relocate'),
|
||||
'$relocate_text' => t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."),
|
||||
'$relocate_button' => t("Resend relocate message to contacts"),
|
||||
|
||||
));
|
||||
|
||||
call_hooks('settings_form',$o);
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
# /etc/nginx/sites-available
|
||||
#
|
||||
# Then customize to your needs. To enable the configuration
|
||||
# symlink it to /etc/nginx/sites-enabled and reload Nginx
|
||||
# using /etc/init.d/nginx reload
|
||||
# symlink it to /etc/nginx/sites-enabled and reload Nginx using
|
||||
#
|
||||
# service nginx reload
|
||||
##
|
||||
|
||||
##
|
||||
|
@ -22,14 +23,16 @@
|
|||
##
|
||||
# This configuration assumes your domain is example.net
|
||||
# You have a separate subdomain friendica.example.net
|
||||
# You want all friendica traffic to be https
|
||||
# You want all Friendica traffic to be HTTPS
|
||||
# You have an SSL certificate and key for your subdomain
|
||||
# You have PHP FastCGI Process Manager (php5-fpm) running on localhost
|
||||
# You have Friendica installed in /mnt/friendica/www
|
||||
##
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name friendica.example.net;
|
||||
|
||||
index index.php;
|
||||
root /mnt/friendica/www;
|
||||
rewrite ^ https://friendica.example.net$request_uri? permanent;
|
||||
|
@ -48,9 +51,6 @@ server {
|
|||
listen 443 ssl;
|
||||
server_name friendica.example.net;
|
||||
|
||||
index index.php;
|
||||
root /mnt/friendica/www;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/ssl/friendica.example.net.chain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/example.net.key;
|
||||
|
@ -59,6 +59,10 @@ server {
|
|||
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
index index.php;
|
||||
charset utf-8;
|
||||
root /mnt/friendica/www;
|
||||
access_log /var/log/nginx/friendica.log;
|
||||
# allow uploads up to 20MB in size
|
||||
client_max_body_size 20m;
|
||||
client_body_buffer_size 128k;
|
||||
|
@ -79,7 +83,7 @@ server {
|
|||
# otherwise fall back to front controller
|
||||
# allow browser to cache them
|
||||
# added .htm for advanced source code editor library
|
||||
location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|svg)$ {
|
||||
location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {
|
||||
expires 30d;
|
||||
try_files $uri /index.php?q=$uri&$args;
|
||||
}
|
||||
|
@ -90,17 +94,28 @@ server {
|
|||
}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
# or a unix socket
|
||||
location ~* \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
# Zero-day exploit defense.
|
||||
# http://forum.nginx.org/read.php?2,88845,page=3
|
||||
# Won't work properly (404 error) if the file is not stored on this
|
||||
# server, which is entirely possible with php-fpm/php-fcgi.
|
||||
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on
|
||||
# another machine. And then cross your fingers that you won't get hacked.
|
||||
try_files $uri =404;
|
||||
|
||||
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
||||
# With php5-cgi alone:
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
|
||||
# With php5-fpm:
|
||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
|
||||
include fastcgi_params;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
}
|
||||
|
||||
# deny access to all dot files
|
||||
|
|
19
update.php
19
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1165 );
|
||||
define( 'UPDATE_VERSION' , 1166 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1509,3 +1509,20 @@ function update_1164() {
|
|||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
function update_1165() {
|
||||
$r = q("CREATE TABLE IF NOT EXISTS `push_subscriber` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`uid` INT NOT NULL,
|
||||
`callback_url` CHAR( 255 ) NOT NULL,
|
||||
`topic` CHAR( 255 ) NOT NULL,
|
||||
`nickname` CHAR( 255 ) NOT NULL,
|
||||
`push` INT NOT NULL,
|
||||
`last_update` DATETIME NOT NULL,
|
||||
`secret` CHAR( 255 ) NOT NULL
|
||||
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
|
||||
if (!$r)
|
||||
return UPDATE_FAILED;
|
||||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
|
11889
util/messages.po
11889
util/messages.po
File diff suppressed because it is too large
Load Diff
2599
util/strings.php
2599
util/strings.php
File diff suppressed because it is too large
Load Diff
12027
view/cs/messages.po
12027
view/cs/messages.po
File diff suppressed because it is too large
Load Diff
2440
view/cs/strings.php
2440
view/cs/strings.php
File diff suppressed because it is too large
Load Diff
12045
view/de/messages.po
12045
view/de/messages.po
File diff suppressed because it is too large
Load Diff
2434
view/de/strings.php
2434
view/de/strings.php
File diff suppressed because it is too large
Load Diff
12054
view/pt-br/messages.po
12054
view/pt-br/messages.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,3 @@
|
|||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
|
@ -115,9 +110,17 @@
|
|||
{{include file="field_checkbox.tpl" field=$use_fulltext_engine}}
|
||||
{{include file="field_input.tpl" field=$itemcache}}
|
||||
{{include file="field_input.tpl" field=$itemcache_duration}}
|
||||
|
||||
|
||||
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
||||
|
||||
</form>
|
||||
|
||||
{{* separate form for relocate... *}}
|
||||
<form action="{{$baseurl}}/admin/site" method="post">
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
<h3>{{$relocate}}</h3>
|
||||
{{include file="field_input.tpl" field=$relocate_url}}
|
||||
<input type="hidden" name="page_site" value="{{$submit}}">
|
||||
<div class="submit"><input type="submit" name="relocate" value="{{$submit}}" /></div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<h3>{{$connect}}</h3>
|
||||
<div id="connect-desc">{{$desc}}</div>
|
||||
<form action="follow" method="post" >
|
||||
<input id="side-follow-url" type="text" name="url" size="24" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
|
||||
<input id="side-follow-url" type="text" name="url" size="24" placeholder="{{$hint}}" title="{{$hint}}" /><input id="side-follow-submit" type="submit" name="submit" value="{{$follow}}" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<h1>{{$ptitle}}</h1>
|
||||
|
||||
{{$nickname_block}}
|
||||
|
@ -149,4 +144,12 @@
|
|||
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}" />
|
||||
</div>
|
||||
|
||||
<h3 class="settings-heading">{{$relocate}}</h3>
|
||||
<div id="settings-pagetype-desc">{{$relocate_text}}</div>
|
||||
|
||||
<div class="settings-submit-wrapper" >
|
||||
<input type="submit" name="resend_relocate" class="settings-submit" value="{{$relocate_button}}" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -114,6 +114,14 @@ nav #site-location {
|
|||
padding: 10px;
|
||||
}
|
||||
|
||||
.warning-message {
|
||||
background-color: #F4FA58;
|
||||
border: 1px solid #F3F781;
|
||||
color: #000000;
|
||||
font-size: 1.1em;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
nav #banner {
|
||||
display: block;
|
||||
|
@ -1601,7 +1609,7 @@ input#dfrn-url {
|
|||
|
||||
#contact-profile-selector {
|
||||
width: 175px;
|
||||
margin-left: 175px;
|
||||
/*margin-left: 175px;*/
|
||||
}
|
||||
|
||||
.contact-edit-submit {
|
||||
|
@ -1654,6 +1662,7 @@ input#dfrn-url {
|
|||
|
||||
#profile-jot-text {
|
||||
height: 20px;
|
||||
width: 100%;
|
||||
color:#cccccc;
|
||||
border: 1px solid #cccccc;
|
||||
padding: 3px 0px 0px 5px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user