Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b96f09bb3a
@ -28,7 +28,10 @@ function externals_run($argv, $argc){
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$randfunc = db_getfunc('RAND');
|
$randfunc = db_getfunc('RAND');
|
||||||
$r = q("select site_url, site_pull from site where site_url != '%s' and site_flags != %d and site_type = %d order by $randfunc limit 1",
|
|
||||||
|
// fixme this query does not deal with directory realms.
|
||||||
|
|
||||||
|
$r = q("select site_url, site_pull from site where site_url != '%s' and site_flags != %d and site_type = %d and site_dead = 0 order by $randfunc limit 1",
|
||||||
dbesc(z_root()),
|
dbesc(z_root()),
|
||||||
intval(DIRECTORY_MODE_STANDALONE),
|
intval(DIRECTORY_MODE_STANDALONE),
|
||||||
intval(SITE_TYPE_ZOT)
|
intval(SITE_TYPE_ZOT)
|
||||||
@ -37,19 +40,11 @@ function externals_run($argv, $argc){
|
|||||||
$url = $r[0]['site_url'];
|
$url = $r[0]['site_url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: blacklisted sites must be stored in the config as an array.
|
|
||||||
// No simple way to turn this into a personal config because we have no identity here.
|
|
||||||
// For that we probably need a variant of superblock.
|
|
||||||
|
|
||||||
$blacklisted = false;
|
$blacklisted = false;
|
||||||
$bl1 = get_config('system','blacklisted_sites');
|
|
||||||
if(is_array($bl1) && $bl1) {
|
if(! check_siteallowed($url)) {
|
||||||
foreach($bl1 as $bl) {
|
logger('blacklisted site: ' . $url);
|
||||||
if($bl && strpos($url,$bl) !== false) {
|
$blacklisted = true;
|
||||||
$blacklisted = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$attempts ++;
|
$attempts ++;
|
||||||
|
@ -550,6 +550,7 @@ function get_public_feed($channel, $params) {
|
|||||||
$params['direction'] = ((x($params,'direction')) ? $params['direction'] : 'desc');
|
$params['direction'] = ((x($params,'direction')) ? $params['direction'] : 'desc');
|
||||||
$params['pages'] = ((x($params,'pages')) ? intval($params['pages']) : 0);
|
$params['pages'] = ((x($params,'pages')) ? intval($params['pages']) : 0);
|
||||||
$params['top'] = ((x($params,'top')) ? intval($params['top']) : 0);
|
$params['top'] = ((x($params,'top')) ? intval($params['top']) : 0);
|
||||||
|
$params['cat'] = ((x($params,'cat')) ? $params['cat'] : '');
|
||||||
|
|
||||||
switch($params['type']) {
|
switch($params['type']) {
|
||||||
case 'json':
|
case 'json':
|
||||||
@ -593,7 +594,8 @@ function get_feed_for($channel, $observer_hash, $params) {
|
|||||||
'direction' => $params['direction'], // FIXME
|
'direction' => $params['direction'], // FIXME
|
||||||
'pages' => $params['pages'],
|
'pages' => $params['pages'],
|
||||||
'order' => 'post',
|
'order' => 'post',
|
||||||
'top' => $params['top']
|
'top' => $params['top'],
|
||||||
|
'cat' => $params['cat']
|
||||||
), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
|
), $channel, $observer_hash, CLIENT_MODE_NORMAL, get_app()->module);
|
||||||
|
|
||||||
|
|
||||||
@ -4817,6 +4819,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
if($arr['since_id'])
|
if($arr['since_id'])
|
||||||
$sql_extra .= " and item.id > " . $since_id . " ";
|
$sql_extra .= " and item.id > " . $since_id . " ";
|
||||||
|
|
||||||
|
if($arr['cat'])
|
||||||
|
$sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY));
|
||||||
|
|
||||||
if($arr['gid'] && $uid) {
|
if($arr['gid'] && $uid) {
|
||||||
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
|
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
|
||||||
intval($arr['group']),
|
intval($arr['group']),
|
||||||
|
@ -1709,3 +1709,162 @@ function do_delivery($deliveries) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_site_info() {
|
||||||
|
|
||||||
|
global $db;
|
||||||
|
global $a;
|
||||||
|
|
||||||
|
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
|
||||||
|
$directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_SECONDARY','DIRECTORY_MODE_PRIMARY', 256 => 'DIRECTORY_MODE_STANDALONE');
|
||||||
|
|
||||||
|
$sql_extra = '';
|
||||||
|
|
||||||
|
$r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 )>0 and account_default_channel = channel_id");
|
||||||
|
|
||||||
|
|
||||||
|
if($r) {
|
||||||
|
$admin = array();
|
||||||
|
foreach($r as $rr) {
|
||||||
|
if($rr['channel_pageflags'] & PAGE_HUBADMIN)
|
||||||
|
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
|
||||||
|
}
|
||||||
|
if(! $admin) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$admin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$def_service_class = get_config('system','default_service_class');
|
||||||
|
if($def_service_class)
|
||||||
|
$service_class = get_config('service_class',$def_service_class);
|
||||||
|
else
|
||||||
|
$service_class = false;
|
||||||
|
|
||||||
|
$visible_plugins = array();
|
||||||
|
if(is_array($a->plugins) && count($a->plugins)) {
|
||||||
|
$r = q("select * from addon where hidden = 0");
|
||||||
|
if(count($r))
|
||||||
|
foreach($r as $rr)
|
||||||
|
$visible_plugins[] = $rr['name'];
|
||||||
|
}
|
||||||
|
sort($visible_plugins);
|
||||||
|
|
||||||
|
if(@is_dir('.git') && function_exists('shell_exec'))
|
||||||
|
$commit = trim(@shell_exec('git log -1 --format="%h"'));
|
||||||
|
if(! isset($commit) || strlen($commit) > 16)
|
||||||
|
$commit = '';
|
||||||
|
|
||||||
|
$site_info = get_config('system','info');
|
||||||
|
$site_name = get_config('system','sitename');
|
||||||
|
if(! get_config('system','hidden_version_siteinfo')) {
|
||||||
|
$version = RED_VERSION;
|
||||||
|
if(@is_dir('.git') && function_exists('shell_exec')) {
|
||||||
|
$commit = trim( @shell_exec('git log -1 --format="%h"'));
|
||||||
|
if(! get_config('system','hidden_tag_siteinfo'))
|
||||||
|
$tag = trim( @shell_exec('git describe --tags --abbrev=0'));
|
||||||
|
else
|
||||||
|
$tag = '';
|
||||||
|
}
|
||||||
|
if(! isset($commit) || strlen($commit) > 16)
|
||||||
|
$commit = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$version = $commit = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Statistics
|
||||||
|
$channels_total_stat = intval(get_config('system','channels_total_stat'));
|
||||||
|
$channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat'));
|
||||||
|
$channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat'));
|
||||||
|
$local_posts_stat = intval(get_config('system','local_posts_stat'));
|
||||||
|
$hide_in_statistics = intval(get_config('system','hide_in_statistics'));
|
||||||
|
$site_expire = intval(get_config('system', 'default_expire_days'));
|
||||||
|
|
||||||
|
|
||||||
|
$data = Array(
|
||||||
|
'version' => $version,
|
||||||
|
'version_tag' => $tag,
|
||||||
|
'commit' => $commit,
|
||||||
|
'url' => z_root(),
|
||||||
|
'plugins' => $visible_plugins,
|
||||||
|
'register_policy' => $register_policy[get_config('system','register_policy')],
|
||||||
|
'directory_mode' => $directory_mode[get_config('system','directory_mode')],
|
||||||
|
'language' => get_config('system','language'),
|
||||||
|
'rss_connections' => get_config('system','feed_contacts'),
|
||||||
|
'expiration' => $site_expire,
|
||||||
|
'default_service_restrictions' => $service_class,
|
||||||
|
'admin' => $admin,
|
||||||
|
'site_name' => (($site_name) ? $site_name : ''),
|
||||||
|
'platform' => PLATFORM_NAME,
|
||||||
|
'dbdriver' => $db->getdriver(),
|
||||||
|
'lastpoll' => get_config('system','lastpoll'),
|
||||||
|
'info' => (($site_info) ? $site_info : ''),
|
||||||
|
'channels_total' => $channels_total_stat,
|
||||||
|
'channels_active_halfyear' => $channels_active_halfyear_stat,
|
||||||
|
'channels_active_monthly' => $channels_active_monthly_stat,
|
||||||
|
'local_posts' => $local_posts_stat,
|
||||||
|
'hide_in_statistics' => $hide_in_statistics
|
||||||
|
);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function check_siteallowed($url) {
|
||||||
|
|
||||||
|
$retvalue = true;
|
||||||
|
|
||||||
|
$bl1 = get_config('system','whitelisted_sites');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl1 === '*')
|
||||||
|
$retvalue = true;
|
||||||
|
if($bl && strpos($url,$bl) !== false)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$bl1 = get_config('system','blacklisted_sites');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl1 === '*')
|
||||||
|
$retvalue = false;
|
||||||
|
if($bl && strpos($url,$bl) !== false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_channelallowed($hash) {
|
||||||
|
|
||||||
|
$retvalue = true;
|
||||||
|
|
||||||
|
$bl1 = get_config('system','whitelisted_channels');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl1 === '*')
|
||||||
|
$retvalue = true;
|
||||||
|
if($bl && strpos($hash,$bl) !== false)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$bl1 = get_config('system','blacklisted_channels');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl1 === '*')
|
||||||
|
$retvalue = false;
|
||||||
|
if($bl && strpos($hash,$bl) !== false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -554,18 +554,8 @@ function zot_gethub($arr,$multiple = false) {
|
|||||||
|
|
||||||
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
|
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
|
||||||
|
|
||||||
$blacklisted = false;
|
if(! check_siteallowed($arr['url'])) {
|
||||||
$bl1 = get_config('system','blacklisted_sites');
|
logger('blacklisted site: ' . $arr['url']);
|
||||||
if(is_array($bl1) && $bl1) {
|
|
||||||
foreach($bl1 as $bl) {
|
|
||||||
if($bl && strpos($arr['url'],$bl) !== false) {
|
|
||||||
$blacklisted = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($blacklisted) {
|
|
||||||
logger('zot_gethub: blacklisted site: ' . $arr['url']);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,6 +1236,10 @@ function zot_import($arr, $sender_url) {
|
|||||||
$no_dups = array();
|
$no_dups = array();
|
||||||
if($deliveries) {
|
if($deliveries) {
|
||||||
foreach($deliveries as $d) {
|
foreach($deliveries as $d) {
|
||||||
|
if(! is_array($d)) {
|
||||||
|
logger('Delivery hash array is not an array: ' . print_r($d,true));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(! in_array($d['hash'],$no_dups))
|
if(! in_array($d['hash'],$no_dups))
|
||||||
$no_dups[] = $d['hash'];
|
$no_dups[] = $d['hash'];
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ function feed_init(&$a) {
|
|||||||
$params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
|
$params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
|
||||||
$params['records'] = ((x($params,'records')) ? intval($params['records']) : 40);
|
$params['records'] = ((x($params,'records')) ? intval($params['records']) : 40);
|
||||||
$params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
|
$params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
|
||||||
|
$params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
|
||||||
|
|
||||||
$channel = '';
|
$channel = '';
|
||||||
if(argc() > 1) {
|
if(argc() > 1) {
|
||||||
|
@ -14,7 +14,7 @@ $install_wizard_pass = 1;
|
|||||||
*
|
*
|
||||||
* @param[in,out] App &$a
|
* @param[in,out] App &$a
|
||||||
*/
|
*/
|
||||||
function setup_init(&$a){
|
function setup_init(&$a) {
|
||||||
|
|
||||||
// Ensure that if somebody hasn't read the install documentation and doesn't have all
|
// Ensure that if somebody hasn't read the install documentation and doesn't have all
|
||||||
// the required modules or has a totally borked shared hosting provider and they can't
|
// the required modules or has a totally borked shared hosting provider and they can't
|
||||||
|
@ -1,104 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function siteinfo_init(&$a) {
|
function siteinfo_init(&$a) {
|
||||||
global $db;
|
|
||||||
|
|
||||||
if ($a->argv[1]=="json"){
|
|
||||||
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
|
|
||||||
$directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_SECONDARY','DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_STANDALONE');
|
|
||||||
|
|
||||||
$sql_extra = '';
|
|
||||||
|
|
||||||
$r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 )>0 and account_default_channel = channel_id");
|
|
||||||
|
|
||||||
|
|
||||||
if($r) {
|
if (argv(1) === 'json') {
|
||||||
$admin = array();
|
$data = get_site_info();
|
||||||
foreach($r as $rr) {
|
|
||||||
if($rr['channel_pageflags'] & PAGE_HUBADMIN)
|
|
||||||
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
|
|
||||||
}
|
|
||||||
if(! $admin) {
|
|
||||||
foreach($r as $rr) {
|
|
||||||
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$admin = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$def_service_class = get_config('system','default_service_class');
|
|
||||||
if($def_service_class)
|
|
||||||
$service_class = get_config('service_class',$def_service_class);
|
|
||||||
else
|
|
||||||
$service_class = false;
|
|
||||||
|
|
||||||
$visible_plugins = array();
|
|
||||||
if(is_array($a->plugins) && count($a->plugins)) {
|
|
||||||
$r = q("select * from addon where hidden = 0");
|
|
||||||
if(count($r))
|
|
||||||
foreach($r as $rr)
|
|
||||||
$visible_plugins[] = $rr['name'];
|
|
||||||
}
|
|
||||||
sort($visible_plugins);
|
|
||||||
|
|
||||||
if(@is_dir('.git') && function_exists('shell_exec'))
|
|
||||||
$commit = trim(@shell_exec('git log -1 --format="%h"'));
|
|
||||||
if(! isset($commit) || strlen($commit) > 16)
|
|
||||||
$commit = '';
|
|
||||||
|
|
||||||
$site_info = get_config('system','info');
|
|
||||||
$site_name = get_config('system','sitename');
|
|
||||||
if(! get_config('system','hidden_version_siteinfo')) {
|
|
||||||
$version = RED_VERSION;
|
|
||||||
if(@is_dir('.git') && function_exists('shell_exec')) {
|
|
||||||
$commit = trim( @shell_exec('git log -1 --format="%h"'));
|
|
||||||
if(! get_config('system','hidden_tag_siteinfo'))
|
|
||||||
$tag = trim( @shell_exec('git describe --tags --abbrev=0'));
|
|
||||||
else
|
|
||||||
$tag = '';
|
|
||||||
}
|
|
||||||
if(! isset($commit) || strlen($commit) > 16)
|
|
||||||
$commit = '';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$version = $commit = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Statistics
|
|
||||||
$channels_total_stat = intval(get_config('system','channels_total_stat'));
|
|
||||||
$channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat'));
|
|
||||||
$channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat'));
|
|
||||||
$local_posts_stat = intval(get_config('system','local_posts_stat'));
|
|
||||||
$hide_in_statistics = intval(get_config('system','hide_in_statistics'));
|
|
||||||
$site_expire = intval(get_config('system', 'default_expire_days'));
|
|
||||||
|
|
||||||
|
|
||||||
$data = Array(
|
|
||||||
'version' => $version,
|
|
||||||
'version_tag' => $tag,
|
|
||||||
'commit' => $commit,
|
|
||||||
'url' => z_root(),
|
|
||||||
'plugins' => $visible_plugins,
|
|
||||||
'register_policy' => $register_policy[get_config('system','register_policy')],
|
|
||||||
'directory_mode' => $directory_mode[get_config('system','directory_mode')],
|
|
||||||
'language' => get_config('system','language'),
|
|
||||||
'rss_connections' => get_config('system','feed_contacts'),
|
|
||||||
'expiration' => $site_expire,
|
|
||||||
'default_service_restrictions' => $service_class,
|
|
||||||
'admin' => $admin,
|
|
||||||
'site_name' => (($site_name) ? $site_name : ''),
|
|
||||||
'platform' => PLATFORM_NAME,
|
|
||||||
'dbdriver' => $db->getdriver(),
|
|
||||||
'lastpoll' => get_config('system','lastpoll'),
|
|
||||||
'info' => (($site_info) ? $site_info : ''),
|
|
||||||
'channels_total' => $channels_total_stat,
|
|
||||||
'channels_active_halfyear' => $channels_active_halfyear_stat,
|
|
||||||
'channels_active_monthly' => $channels_active_monthly_stat,
|
|
||||||
'local_posts' => $local_posts_stat,
|
|
||||||
'hide_in_statistics' => $hide_in_statistics
|
|
||||||
);
|
|
||||||
json_return_and_die($data);
|
json_return_and_die($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
mod/siteinfo_json.php
Normal file
8
mod/siteinfo_json.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function siteinfo_json_init(&$a) {
|
||||||
|
|
||||||
|
$data = get_site_info();
|
||||||
|
json_return_and_die($data);
|
||||||
|
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
2015-11-28.1230
|
2015-11-30.1232
|
||||||
|
12381
view/it/hmessages.po
12381
view/it/hmessages.po
File diff suppressed because it is too large
Load Diff
2528
view/it/hstrings.php
2528
view/it/hstrings.php
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user