Merge remote-tracking branch 'upstream/develop' into 1509-worker
This commit is contained in:
+3
-1
@@ -819,7 +819,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
|
||||
}
|
||||
}
|
||||
|
||||
Cache::set("probe_url:".$mode.":".$url,serialize($result), CACHE_DAY);
|
||||
// Only store into the cache if the value seems to be valid
|
||||
if ($result['network'] != NETWORK_FEED)
|
||||
Cache::set("probe_url:".$mode.":".$url,serialize($result), CACHE_DAY);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ function directory_run(&$argv, &$argc){
|
||||
if(is_null($a)) {
|
||||
$a = new App;
|
||||
}
|
||||
|
||||
|
||||
if(is_null($db)) {
|
||||
@include(".htconfig.php");
|
||||
require_once("include/dba.php");
|
||||
@@ -29,11 +29,13 @@ function directory_run(&$argv, &$argc){
|
||||
|
||||
$a->set_baseurl(get_config('system','url'));
|
||||
|
||||
$dir = get_config('system','directory_submit_url');
|
||||
$dir = get_config('system','directory');
|
||||
|
||||
if(! strlen($dir))
|
||||
return;
|
||||
|
||||
$dir .= "/submit";
|
||||
|
||||
$arr = array('url' => $argv[1]);
|
||||
|
||||
call_hooks('globaldir_update', $arr);
|
||||
|
||||
@@ -28,9 +28,14 @@ function dsprphotoq_run($argv, $argc){
|
||||
|
||||
foreach($dphotos as $dphoto) {
|
||||
|
||||
$r = q("SELECT * FROM user WHERE uid = %d",
|
||||
intval($dphoto['uid'])
|
||||
);
|
||||
$r = array();
|
||||
|
||||
if ($dphoto['uid'] == 0)
|
||||
$r[0] = array("uid" => 0, "page-flags" => PAGE_FREELOVE);
|
||||
else
|
||||
$r = q("SELECT * FROM user WHERE uid = %d",
|
||||
intval($dphoto['uid']));
|
||||
|
||||
if(!$r) {
|
||||
logger("diaspora photo queue: user " . $dphoto['uid'] . " not found");
|
||||
return;
|
||||
|
||||
@@ -285,6 +285,7 @@ if(! function_exists('profile_sidebar')) {
|
||||
$lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname))));
|
||||
|
||||
$diaspora = array(
|
||||
'guid' => $profile['guid'],
|
||||
'podloc' => $a->get_baseurl(),
|
||||
'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ),
|
||||
'nickname' => $profile['nickname'],
|
||||
|
||||
+58
-25
@@ -1096,6 +1096,48 @@ function add_guid($item) {
|
||||
dbesc($item["uri"]), dbesc($item["network"]));
|
||||
}
|
||||
|
||||
// Adds a "lang" specification in a "postopts" element of given $arr,
|
||||
// if possible and not already present.
|
||||
// Expects "body" element to exist in $arr.
|
||||
// TODO: add a parameter to request forcing override
|
||||
function item_add_language_opt(&$arr) {
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) return; // LanguageDetect.php not available ?
|
||||
|
||||
if ( x($arr, 'postopts') )
|
||||
{
|
||||
if ( strstr($arr['postopts'], 'lang=') )
|
||||
{
|
||||
// do not override
|
||||
// TODO: add parameter to request overriding
|
||||
return;
|
||||
}
|
||||
$postopts = $arr['postopts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$postopts = "";
|
||||
}
|
||||
|
||||
require_once('library/langdet/Text/LanguageDetect.php');
|
||||
$naked_body = preg_replace('/\[(.+?)\]/','',$arr['body']);
|
||||
$l = new Text_LanguageDetect;
|
||||
//$lng = $l->detectConfidence($naked_body);
|
||||
//$arr['postopts'] = (($lng['language']) ? 'lang=' . $lng['language'] . ';' . $lng['confidence'] : '');
|
||||
$lng = $l->detect($naked_body, 3);
|
||||
|
||||
if (sizeof($lng) > 0) {
|
||||
if ($postopts != "") $postopts .= '&'; // arbitrary separator, to be reviewed
|
||||
$postopts .= 'lang=';
|
||||
$sep = "";
|
||||
foreach ($lng as $language => $score) {
|
||||
$postopts .= $sep . $language.";".$score;
|
||||
$sep = ':';
|
||||
}
|
||||
$arr['postopts'] = $postopts;
|
||||
}
|
||||
}
|
||||
|
||||
function item_store($arr,$force_parent = false, $notify = false, $dontcache = false) {
|
||||
|
||||
// If it is a posting where users should get notifications, then define it as wall posting
|
||||
@@ -1185,32 +1227,15 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||
//if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
|
||||
// $arr['body'] = strip_tags($arr['body']);
|
||||
|
||||
item_add_language_opt($arr);
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
require_once('library/langdet/Text/LanguageDetect.php');
|
||||
$naked_body = preg_replace('/\[(.+?)\]/','',$arr['body']);
|
||||
$l = new Text_LanguageDetect;
|
||||
//$lng = $l->detectConfidence($naked_body);
|
||||
//$arr['postopts'] = (($lng['language']) ? 'lang=' . $lng['language'] . ';' . $lng['confidence'] : '');
|
||||
$lng = $l->detect($naked_body, 3);
|
||||
|
||||
if (sizeof($lng) > 0) {
|
||||
$postopts = "";
|
||||
|
||||
foreach ($lng as $language => $score) {
|
||||
if ($postopts == "")
|
||||
$postopts = "lang=";
|
||||
else
|
||||
$postopts .= ":";
|
||||
|
||||
$postopts .= $language.";".$score;
|
||||
}
|
||||
$arr['postopts'] = $postopts;
|
||||
}
|
||||
}
|
||||
if ($notify)
|
||||
$guid_prefix = "";
|
||||
else
|
||||
$guid_prefix = $arr['network'];
|
||||
|
||||
$arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0);
|
||||
$arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network']));
|
||||
$arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $guid_prefix));
|
||||
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']);
|
||||
$arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : '');
|
||||
$arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : '');
|
||||
@@ -1423,7 +1448,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||
// Fill the cache field
|
||||
put_item_in_cache($arr);
|
||||
|
||||
call_hooks('post_remote',$arr);
|
||||
if ($notify)
|
||||
call_hooks('post_local',$arr);
|
||||
else
|
||||
call_hooks('post_remote',$arr);
|
||||
|
||||
if(x($arr,'cancel')) {
|
||||
logger('item_store: post cancelled by plugin.');
|
||||
@@ -1569,7 +1597,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||
|
||||
$r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
|
||||
if (count($r) == 1) {
|
||||
call_hooks('post_remote_end', $r[0]);
|
||||
if ($notify)
|
||||
call_hooks('post_local_end', $r[0]);
|
||||
else
|
||||
call_hooks('post_remote_end', $r[0]);
|
||||
} else
|
||||
logger('item_store: new item not found in DB, id ' . $current_post);
|
||||
}
|
||||
@@ -1989,6 +2020,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
||||
|
||||
$rino = get_config('system','rino_encrypt');
|
||||
$rino = intval($rino);
|
||||
// use RINO1 if mcrypt isn't installed and RINO2 was selected
|
||||
if ($rino==2 and !function_exists('mcrypt_create_iv')) $rino=1;
|
||||
|
||||
logger("Local rino version: ". $rino, LOGGER_DEBUG);
|
||||
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ function nav_info(&$a) {
|
||||
$gdirpath = 'directory';
|
||||
|
||||
if(strlen(get_config('system','singleuser'))) {
|
||||
$gdir = dirname(get_config('system','directory_submit_url'));
|
||||
$gdir = get_config('system','directory');
|
||||
if(strlen($gdir))
|
||||
$gdirpath = $gdir;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ function profile_change() {
|
||||
return;
|
||||
|
||||
// $url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||
// if($url && strlen(get_config('system','directory_submit_url')))
|
||||
// if($url && strlen(get_config('system','directory')))
|
||||
// proc_run('php',"include/directory.php","$url");
|
||||
|
||||
$recips = q("SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s'
|
||||
|
||||
@@ -1224,7 +1224,7 @@ function update_suggestions() {
|
||||
|
||||
$done[] = $a->get_baseurl() . '/poco';
|
||||
|
||||
if(strlen(get_config('system','directory_submit_url'))) {
|
||||
if(strlen(get_config('system','directory'))) {
|
||||
$x = fetch_url(get_server()."/pubsites");
|
||||
if($x) {
|
||||
$j = json_decode($x);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ function create_user($arr) {
|
||||
$verified = ((x($arr,'verified')) ? intval($arr['verified']) : 0);
|
||||
|
||||
$publish = ((x($arr,'profile_publish_reg') && intval($arr['profile_publish_reg'])) ? 1 : 0);
|
||||
$netpublish = ((strlen(get_config('system','directory_submit_url'))) ? $publish : 0);
|
||||
$netpublish = ((strlen(get_config('system','directory'))) ? $publish : 0);
|
||||
|
||||
if ($password1 != $confirm) {
|
||||
$result['message'] .= t('Passwords do not match. Password unchanged.') . EOL;
|
||||
|
||||
Reference in New Issue
Block a user