Merge remote branch 'friendika-master/master'

This commit is contained in:
Fabio Comuni 2011-01-31 09:54:08 +01:00
commit e962561f8d
29 changed files with 315 additions and 129 deletions

View file

@ -29,7 +29,7 @@ php.ini file
- Mysql 5.x - Mysql 5.x
- ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks - ability to schedule jobs with cron (Linux/Mac) or Scheduled Tasks
(Windows) (Windows) [Note: other options are presented in Section 7 of this document]
- Installation into a top-level domain or sub-domain (without a - Installation into a top-level domain or sub-domain (without a
directory/path component in the URL) is preferred. Directory paths will directory/path component in the URL) is preferred. Directory paths will
@ -89,3 +89,18 @@ You can generally find the location of PHP by executing "which php". If you
have troubles with this section please contact your hosting provider for have troubles with this section please contact your hosting provider for
assistance. Friendika will not work correctly if you cannot perform this step. assistance. Friendika will not work correctly if you cannot perform this step.
Alternative: You may be able to use the 'poormancron' plugin to perform this
step if you are using a recent Friendika release. To do this, edit the file
".htconfig.php" and look for a line describing your plugins. On a fresh
installation, it will look like
$a->config['system']['addon'] = 'js_upload';
This indicates the "js_upload" addon module is enabled. You may add additional
addons/plugins using this same line in the configuration file. Change it to
read
$a->config['system']['addon'] = 'js_upload,poormancron';
and save your changes.

View file

@ -0,0 +1,48 @@
<?php
/**
* Poor Man Cron. Execute updates on pageviews
*
* Addon Name: poormancron
*
*/
function poormancron_install() {
register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
logger("installed poormancron");
}
function poormancron_uninstall() {
unregister_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
logger("removed poormancron");
}
function poormancron_hook($a,&$b) {
$now = time();
$lastupdate = get_config('poormancron', 'lastupdate');
// 300 secs, 5 mins
if (!$lastupdate || ($now-$lastupdate)>300) {
set_config('poormancron','lastupdate', $now);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_run($php_path,"include/poller.php");
}
}
function poormancron_procrun($a, $argv) {
logger("poormancron procrun ".implode(", ",$argv));
array_shift($argv);
$argc = count($argv);
logger("poormancron procrun require_once ".basename($argv[0]));
require_once(basename($argv[0]));
$funcname=str_replace(".php", "", basename($argv[0]))."_run";
$funcname($argv, $argc);
}
?>

View file

@ -10,6 +10,16 @@ define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
define ( 'DOWN_ARROW', '&#x21e9;' ); define ( 'DOWN_ARROW', '&#x21e9;' );
/**
* SSL redirection policies
*/
define ( 'SSL_POLICY_NONE', 0 );
define ( 'SSL_POLICY_FULL', 1 );
define ( 'SSL_POLICY_SELFSIGN', 2 );
/** /**
* log levels * log levels
*/ */
@ -270,10 +280,17 @@ class App {
} }
function get_baseurl($ssl = false) { function get_baseurl($ssl = false) {
if(strlen($this->baseurl))
return $this->baseurl;
$this->baseurl = (($ssl) ? 'https' : $this->scheme) . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); $scheme = $this->scheme;
if(x($this->config,'ssl_policy')) {
if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL))
$scheme = 'https';
if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
$scheme = 'https';
}
$this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
return $this->baseurl; return $this->baseurl;
} }
@ -1655,7 +1672,6 @@ function attribute_contains($attr,$s) {
if(! function_exists('logger')) { if(! function_exists('logger')) {
function logger($msg,$level = 0) { function logger($msg,$level = 0) {
$debugging = get_config('system','debugging'); $debugging = get_config('system','debugging');
$loglevel = intval(get_config('system','loglevel')); $loglevel = intval(get_config('system','loglevel'));
$logfile = get_config('system','logfile'); $logfile = get_config('system','logfile');
@ -2225,7 +2241,31 @@ function prepare_body($item) {
$s = smilies(bbcode($item['body'])); $s = smilies(bbcode($item['body']));
return $s; return $s;
}}
/**
*
* Wrap calls to proc_close(proc_open()) and call hook
* so plugins can take part in process :)
*
* args:
* $cmd program to run
* next args are passed as $cmd command line
*
* e.g.: proc_run("ls","-la","/tmp");
*
* $cmd and string args are surrounded with ""
*/
if(! function_exists('run_proc')) {
function proc_run($cmd){
$args = func_get_args();
call_hooks("proc_run", $args);
foreach ($args as &$arg){
if(is_string($arg)) $arg='"'.$arg.'"';
}
$cmdline = implode($args," ");
proc_close(proc_open($cmdline." &",array(),$foo));
}}
}}

View file

@ -30,7 +30,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false) { function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false) {
$o = ''; $o = '';
@ -43,6 +43,10 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD)); $sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD));
} }
if($privmail || $privatenet) {
$sql_extra .= " AND `network` IN ( 'dfrn' ) ";
}
if($privmail) if($privmail)
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n"; $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
else else
@ -61,11 +65,8 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
else else
$selected = ''; $selected = '';
if(($privmail) && ($rr['network'] === 'stat'))
$disabled = ' disabled="true" ' ; $o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['url']}\" >{$rr['name']}</option>\r\n";
else
$disabled = '';
$o .= "<option value=\"{$rr['id']}\" $selected $disabled title=\"{$rr['url']}\" >{$rr['name']}</option>\r\n";
} }
} }
@ -110,7 +111,7 @@ function populate_acl($user = null,$celeb = false) {
$o .= '</div>'; $o .= '</div>';
$o .= '<div id="contact_allow_wrapper">'; $o .= '<div id="contact_allow_wrapper">';
$o .= '<label id="acl-allow-contact-label" for="contact_allow" >' . t('Contacts') . '</label>'; $o .= '<label id="acl-allow-contact-label" for="contact_allow" >' . t('Contacts') . '</label>';
$o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb); $o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb,true);
$o .= '</div>'; $o .= '</div>';
$o .= '</div>' . "\r\n"; $o .= '</div>' . "\r\n";
$o .= '<div id="acl-allow-end"></div>' . "\r\n"; $o .= '<div id="acl-allow-end"></div>' . "\r\n";
@ -125,7 +126,7 @@ function populate_acl($user = null,$celeb = false) {
$o .= '</div>'; $o .= '</div>';
$o .= '<div id="contact_deny_wrapper" >'; $o .= '<div id="contact_deny_wrapper" >';
$o .= '<label id="acl-deny-contact-label" for="contact_deny" >' . t('Contacts') . '</label>'; $o .= '<label id="acl-deny-contact-label" for="contact_deny" >' . t('Contacts') . '</label>';
$o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb); $o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb,true);
$o .= '</div>'; $o .= '</div>';
$o .= '</div>' . "\r\n"; $o .= '</div>' . "\r\n";
$o .= '<div id="acl-deny-end"></div>' . "\r\n"; $o .= '<div id="acl-deny-end"></div>' . "\r\n";

View file

@ -1,17 +1,22 @@
<?php <?php
require_once("boot.php");
require_once("boot.php"); function directory_run($argv, $argc){
global $a, $db;
$a = new App;
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if(is_null($a)){
$a = new App;
}
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
if($argc != 2) if($argc != 2)
exit; return;
load_config('system'); load_config('system');
@ -20,9 +25,14 @@
$dir = get_config('system','directory_submit_url'); $dir = get_config('system','directory_submit_url');
if(! strlen($dir)) if(! strlen($dir))
exit; return;
fetch_url($dir . '?url=' . bin2hex($argv[1])); fetch_url($dir . '?url=' . bin2hex($argv[1]));
exit; return;
}
if (array_search(__file__,get_included_files())===0){
directory_run($argv,$argc);
killme();
}

View file

@ -903,6 +903,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
$feed->enable_order_by_date(false); $feed->enable_order_by_date(false);
$feed->init(); $feed->init();
if($feed->error())
logger('consume_feed: Error parsing XML: ' . $feed->error());
// Check at the feed level for updated contact name and/or photo // Check at the feed level for updated contact name and/or photo
$name_updated = ''; $name_updated = '';

View file

@ -44,12 +44,14 @@
$('#pause').html(''); $('#pause').html('');
} }
} }
if(event.keyCode == '36' && event.shiftKey == true) { // this is shift-home on FF, but $ on IE, disabling until I figure out why the diff.
if(homebase !== undefined) { // update: incompatible usage of onKeyDown vs onKeyPress
event.preventDefault(); // if(event.keyCode == '36' && event.shiftKey == true) {
document.location = homebase; // if(homebase !== undefined) {
} // event.preventDefault();
} // document.location = homebase;
// }
// }
}); });
}); });

View file

@ -1,14 +1,19 @@
<?php <?php
require_once("boot.php");
require_once("boot.php"); function notifier_run($argv, $argc){
global $a, $db;
$a = new App;
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if(is_null($a)){
$a = new App;
}
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once("session.php"); require_once("session.php");
require_once("datetime.php"); require_once("datetime.php");
@ -16,7 +21,7 @@
require_once('include/bbcode.php'); require_once('include/bbcode.php');
if($argc < 3) if($argc < 3)
exit; return;
$a->set_baseurl(get_config('system','url')); $a->set_baseurl(get_config('system','url'));
@ -29,8 +34,9 @@
case 'mail': case 'mail':
default: default:
$item_id = intval($argv[2]); $item_id = intval($argv[2]);
if(! $item_id) if(! $item_id){
killme(); return;
}
break; break;
} }
@ -42,22 +48,24 @@
$message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
intval($item_id) intval($item_id)
); );
if(! count($message)) if(! count($message)){
killme(); return;
}
$uid = $message[0]['uid']; $uid = $message[0]['uid'];
$recipients[] = $message[0]['contact-id']; $recipients[] = $message[0]['contact-id'];
$item = $message[0]; $item = $message[0];
} }
else { else {
// find ancestors
// find ancestors
$r = q("SELECT `parent`, `uid`, `edited` FROM `item` WHERE `id` = %d LIMIT 1", $r = q("SELECT `parent`, `uid`, `edited` FROM `item` WHERE `id` = %d LIMIT 1",
intval($item_id) intval($item_id)
); );
if(! count($r)) if(! count($r)){
killme(); return;
}
$parent_id = $r[0]['parent']; $parent_id = $r[0]['parent'];
$uid = $r[0]['uid']; $uid = $r[0]['uid'];
$updated = $r[0]['edited']; $updated = $r[0]['edited'];
@ -66,8 +74,9 @@
intval($parent_id) intval($parent_id)
); );
if(! count($items)) if(! count($items)){
killme(); return;
}
} }
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags` $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags`
@ -78,9 +87,9 @@
if(count($r)) if(count($r))
$owner = $r[0]; $owner = $r[0];
else else {
killme(); return;
}
$hub = get_config('system','huburl'); $hub = get_config('system','huburl');
// If this is a public conversation, notify the feed hub // If this is a public conversation, notify the feed hub
@ -150,8 +159,9 @@
$r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0"); $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0");
if( ! count($r)) if( ! count($r)){
killme(); return;
}
$contacts = $r; $contacts = $r;
} }
@ -248,9 +258,9 @@
$r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 ", $r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 ",
dbesc($recip_str) dbesc($recip_str)
); );
if(! count($r)) if(! count($r)){
killme(); return;
}
// delivery loop // delivery loop
require_once('include/salmon.php'); require_once('include/salmon.php');
@ -353,12 +363,18 @@
continue; continue;
$params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] ); $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
post_url($h,$params); post_url($h,$params);
logger('pubsub: publish: ' . $h . ' returned ' . $a->get_curl_code()); logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
if(count($hubs) > 1) if(count($hubs) > 1)
sleep(7); // try and avoid multiple hubs responding at precisely the same time sleep(7); // try and avoid multiple hubs responding at precisely the same time
} }
} }
} }
killme(); return;
}
if (array_search(__file__,get_included_files())===0){
echo "run!";
notifier_run($argv,$argc);
killme();
}

View file

@ -1,14 +1,19 @@
<?php <?php
require_once("boot.php");
function poller_run($argv, $argc){
global $a, $db;
require_once('boot.php'); if(is_null($a)){
$a = new App;
$a = new App; }
@include('.htconfig.php'); if(is_null($db)){
require_once('dba.php'); @include(".htconfig.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data); require_once("dba.php");
unset($db_host, $db_user, $db_pass, $db_data); $db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once('session.php'); require_once('session.php');
require_once('datetime.php'); require_once('datetime.php');
@ -19,11 +24,12 @@
$a->set_baseurl(get_config('system','url')); $a->set_baseurl(get_config('system','url'));
logger('poller: start'); logger('poller: start');
// run queue delivery process in the background // run queue delivery process in the background
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo)); //proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo));
proc_run($php_path,"include/queue.php");
$hub_update = false; $hub_update = false;
@ -46,11 +52,15 @@
$sql_extra $sql_extra
AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()"); AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()");
if(! count($contacts)) if(! count($contacts)){
killme(); return;
}
foreach($contacts as $contact) { foreach($contacts as $contact) {
if($manual_id)
$contact['last-update'] = '0000-00-00 00:00:00';
if($contact['priority'] || $contact['subhub']) { if($contact['priority'] || $contact['subhub']) {
$hub_update = true; $hub_update = true;
@ -69,7 +79,7 @@
$contact['priority'] = (($interval !== false) ? intval($interval) : 3); $contact['priority'] = (($interval !== false) ? intval($interval) : 3);
$hub_update = false; $hub_update = false;
if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)
$hub_update = true; $hub_update = true;
} }
@ -265,7 +275,10 @@
// loop - next contact // loop - next contact
} }
killme(); return;
}
if (array_search(__file__,get_included_files())===0){
poller_run($argv,$argc);
killme();
}

View file

@ -1,5 +1,5 @@
<?php <?php
require_once("boot.php");
function update_queue_time($id) { function update_queue_time($id) {
logger('queue: requeue item ' . $id); logger('queue: requeue item ' . $id);
@ -16,14 +16,19 @@ function remove_queue_item($id) {
); );
} }
require_once("boot.php"); function queue_run($argv, $argc){
global $a, $db;
$a = new App; if(is_null($a)){
$a = new App;
@include(".htconfig.php"); }
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data); if(is_null($db)){
unset($db_host, $db_user, $db_pass, $db_data); @include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once("session.php"); require_once("session.php");
@ -50,9 +55,9 @@ function remove_queue_item($id) {
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); $r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ");
if(! count($r)) if(! count($r)){
killme(); return;
}
// delivery loop // delivery loop
require_once('include/salmon.php'); require_once('include/salmon.php');
@ -118,7 +123,11 @@ function remove_queue_item($id) {
} }
} }
killme(); return;
// NOTREACHED }
if (array_search(__file__,get_included_files())===0){
queue_run($argv,$argc);
killme();
}

View file

@ -140,7 +140,7 @@ if(strlen($a->module)) {
} }
else { else {
if((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) { if((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
logger('index.php: dreamhost_error_hack invoked'); logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']); goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']);
} }

View file

@ -121,6 +121,15 @@ function contacts_content(&$a) {
return; // NOTREACHED return; // NOTREACHED
} }
if($cmd === 'update') {
// pull feed and consume it, which should subscribe to the hub.
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_run($php_path,"include/poller.php","$contact_id");
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
// NOTREACHED
}
if($cmd === 'block') { if($cmd === 'block') {
$blocked = (($orig_record[0]['blocked']) ? 0 : 1); $blocked = (($orig_record[0]['blocked']) ? 0 : 1);
@ -248,6 +257,7 @@ function contacts_content(&$a) {
'$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00')
? t('Never') ? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')), : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
'$udnow' => t('Update now'),
'$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)), '$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)),
'$contact_id' => $r[0]['id'], '$contact_id' => $r[0]['id'],
'$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),

View file

@ -438,8 +438,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","activity","$i");
} }

View file

@ -304,9 +304,9 @@ function dfrn_notify_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","comment-import","$posted_id");
if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) { if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
require_once('bbcode.php'); require_once('bbcode.php');
$from = stripslashes($datarray['author-name']); $from = stripslashes($datarray['author-name']);

View file

@ -26,6 +26,7 @@ function dfrn_poll_init(&$a) {
} }
if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] );
header("Content-type: application/atom+xml"); header("Content-type: application/atom+xml");
$o = get_feed_for($a, '*', $a->argv[1],$last_update); $o = get_feed_for($a, '*', $a->argv[1],$last_update);
echo $o; echo $o;

View file

@ -10,7 +10,9 @@ function follow_post(&$a) {
// NOTREACHED // NOTREACHED
} }
$url = notags(trim($_POST['url'])); $url = $orig_url = notags(trim($_POST['url']));
$email_conversant = false;
if($url) { if($url) {
$links = lrdd($url); $links = lrdd($url);
@ -29,6 +31,11 @@ function follow_post(&$a) {
} }
} }
else {
if((strpos($orig_url,'@')) && validate_email($orig_url)) {
$email_conversant = true;
}
}
} }
// If we find a DFRN site, send our subscriber to the other person's // If we find a DFRN site, send our subscriber to the other person's
@ -208,8 +215,8 @@ function follow_post(&$a) {
// pull feed and consume it, which should subscribe to the hub. // pull feed and consume it, which should subscribe to the hub.
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo)); //proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
proc_run($php_path,"include/poller.php","$contact_id");
// create a follow slap // create a follow slap

View file

@ -71,6 +71,7 @@ function item_post(&$a) {
$location = notags(trim($_POST['location'])); $location = notags(trim($_POST['location']));
$coord = notags(trim($_POST['coord'])); $coord = notags(trim($_POST['coord']));
$verb = notags(trim($_POST['verb'])); $verb = notags(trim($_POST['verb']));
$emailcc = notags(trim($_POST['emailcc']));
if(! strlen($body)) { if(! strlen($body)) {
notice( t('Empty post discarded.') . EOL ); notice( t('Empty post discarded.') . EOL );
@ -421,8 +422,7 @@ function item_post(&$a) {
logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &"); logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &", proc_run($php_path, "include/notifier.php", $notify_type, "$post_id");
array(),$foo));
$datarray['id'] = $post_id; $datarray['id'] = $post_id;
@ -520,8 +520,8 @@ function item_content(&$a) {
// send the notification upstream/downstream as the case may be // send the notification upstream/downstream as the case may be
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo));
array(), $foo)); proc_run($php_path,"include/notifier.php","drop","$drop_id");
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
return; //NOTREACHED return; //NOTREACHED

View file

@ -102,8 +102,8 @@ function like_content(&$a) {
); );
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","like","$post_id");
return; return;
} }
@ -176,8 +176,8 @@ EOT;
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","like","$post_id");
return; // NOTREACHED return; // NOTREACHED
} }

View file

@ -72,8 +72,8 @@ function message_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($post_id) { if($post_id) {
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","mail","$post_id");
notice( t('Message sent.') . EOL ); notice( t('Message sent.') . EOL );
} }
else { else {

View file

@ -187,9 +187,8 @@ foreach($_FILES AS $key => $val) {
// send the notification upstream/downstream as the case may be // send the notification upstream/downstream as the case may be
if($rr['visible']) if($rr['visible'])
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","drop","$drop_id");
} }
} }
} }
@ -236,8 +235,8 @@ foreach($_FILES AS $key => $val) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($i[0]['visible']) if($i[0]['visible'])
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ", array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","drop","$drop_id");
} }
} }
@ -462,8 +461,8 @@ foreach($_FILES AS $key => $val) {
$item_id = item_store($arr); $item_id = item_store($arr);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ", //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",array(),$foo));
array(),$foo)); proc_run($php_path,"include/notifier.php","tag","$item_id");
} }
} }

View file

@ -90,8 +90,8 @@ function profile_photo_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
array(),$foo)); proc_run($php_path,"include/directory.php","$url");
} }
else else
notice( t('Unable to process image') . EOL); notice( t('Unable to process image') . EOL);

View file

@ -203,8 +203,8 @@ function profiles_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", array(),$foo));
array(),$foo)); proc_run($php_path,"include/directory.php","$url");
} }
} }
} }

View file

@ -182,8 +182,8 @@ function settings_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
array(),$foo)); proc_run($php_path,"include/directory.php","$url");
} }
$_SESSION['theme'] = $theme; $_SESSION['theme'] = $theme;

View file

@ -3,6 +3,8 @@
<div id="contact-edit-banner-name">$name</div> <div id="contact-edit-banner-name">$name</div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
@ -24,13 +26,12 @@
</div> </div>
<div id="contact-edit-nav-end"></div> <div id="contact-edit-nav-end"></div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-poll-wrapper"> <div id="contact-edit-poll-wrapper">
<div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div> <div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div>
<div id="contact-edit-poll-text">$updpub</div> <div id="contact-edit-poll-text">$updpub</div>
$poll_interval $poll_interval
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update">$udnow</a></div>
</div> </div>
</div> </div>
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>

View file

@ -3,6 +3,8 @@
<div id="contact-edit-banner-name">$name</div> <div id="contact-edit-banner-name">$name</div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
@ -24,13 +26,12 @@
</div> </div>
<div id="contact-edit-nav-end"></div> <div id="contact-edit-nav-end"></div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-poll-wrapper"> <div id="contact-edit-poll-wrapper">
<div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div> <div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div>
<div id="contact-edit-poll-text">$updpub</div> <div id="contact-edit-poll-text">$updpub</div>
$poll_interval $poll_interval
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update">$udnow</a></div>
</div> </div>
</div> </div>
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>

View file

@ -3,6 +3,8 @@
<div id="contact-edit-banner-name">$name</div> <div id="contact-edit-banner-name">$name</div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
@ -24,14 +26,13 @@
</div> </div>
<div id="contact-edit-nav-end"></div> <div id="contact-edit-nav-end"></div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-poll-wrapper"> <div id="contact-edit-poll-wrapper">
<div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div> <div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div>
<div id="contact-edit-poll-text">$updpub</div> <div id="contact-edit-poll-text">$updpub</div>
$poll_interval $poll_interval
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update">$udnow</a></div>
</div> </div>
</div> </div>
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>

View file

@ -3,6 +3,8 @@
<div id="contact-edit-banner-name">$name</div> <div id="contact-edit-banner-name">$name</div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-wrapper" > <div id="contact-edit-wrapper" >
@ -24,13 +26,12 @@
</div> </div>
<div id="contact-edit-nav-end"></div> <div id="contact-edit-nav-end"></div>
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
<div id="contact-edit-poll-wrapper"> <div id="contact-edit-poll-wrapper">
<div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div> <div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span</div>
<div id="contact-edit-poll-text">$updpub</div> <div id="contact-edit-poll-text">$updpub</div>
$poll_interval $poll_interval
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update">$udnow</a></div>
</div> </div>
</div> </div>
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>

View file

@ -1333,6 +1333,9 @@ input#dfrn-url {
#contact-edit-poll-text { #contact-edit-poll-text {
margin-bottom: 10px; margin-bottom: 10px;
} }
#contact-edit-update-now {
margin-top: 15px;
}
#contact-edit-photo-wrapper { #contact-edit-photo-wrapper {
margin-bottom: 20px; margin-bottom: 20px;

View file

@ -1209,6 +1209,10 @@ input#dfrn-url {
margin-bottom: 10px; margin-bottom: 10px;
} }
#contact-edit-update-now {
margin-top: 15px;
}
#contact-edit-photo-wrapper { #contact-edit-photo-wrapper {
margin-bottom: 20px; margin-bottom: 20px;
} }