mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-21 19:35:24 +00:00
Merge branch 'dev' of /home/macgirvin/roadhouse into dev
This commit is contained in:
commit
20ae97efd6
19 changed files with 97 additions and 79 deletions
|
@ -64,10 +64,12 @@ class Poller {
|
||||||
|
|
||||||
// Only poll from those with suitable relationships
|
// Only poll from those with suitable relationships
|
||||||
|
|
||||||
$abandon_sql = (($abandon_days)
|
// $abandon_sql = (($abandon_days)
|
||||||
? sprintf(" AND account_lastlog > %s - INTERVAL %s ", db_utcnow(), db_quoteinterval(intval($abandon_days).' DAY'))
|
// ? sprintf(" AND account_lastlog > %s - INTERVAL %s ", db_utcnow(), db_quoteinterval(intval($abandon_days).' DAY'))
|
||||||
: ''
|
// : ''
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
$abandon_sql = EMPTY_STR;
|
||||||
|
|
||||||
$randfunc = db_getfunc('RAND');
|
$randfunc = db_getfunc('RAND');
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Enotify {
|
||||||
dbesc($params['to_xchan'])
|
dbesc($params['to_xchan'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($x & $y) {
|
if ($x && $y) {
|
||||||
$sender = $x[0];
|
$sender = $x[0];
|
||||||
$recip = $y[0];
|
$recip = $y[0];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -44,13 +44,13 @@ class Libprofile {
|
||||||
|
|
||||||
// Can the observer see our profile?
|
// Can the observer see our profile?
|
||||||
require_once('include/permissions.php');
|
require_once('include/permissions.php');
|
||||||
if (! perm_is_allowed($channel['channel_id'],$observer['xchan_hash'],'view_profile')) {
|
if (! perm_is_allowed($channel['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'view_profile')) {
|
||||||
$can_view_profile = false;
|
$can_view_profile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $profile) {
|
if (! $profile) {
|
||||||
$r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1",
|
$r = q("SELECT abook_profile FROM abook WHERE abook_xchan = '%s' and abook_channel = '%d' limit 1",
|
||||||
dbesc($observer['xchan_hash']),
|
dbesc(($observer) ? $observer['xchan_hash'] : ''),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
);
|
);
|
||||||
if ($r)
|
if ($r)
|
||||||
|
@ -98,7 +98,7 @@ class Libprofile {
|
||||||
);
|
);
|
||||||
if ($q) {
|
if ($q) {
|
||||||
|
|
||||||
$extra_fields = array();
|
$extra_fields = [];
|
||||||
|
|
||||||
$profile_fields_basic = get_profile_fields_basic();
|
$profile_fields_basic = get_profile_fields_basic();
|
||||||
$profile_fields_advanced = get_profile_fields_advanced();
|
$profile_fields_advanced = get_profile_fields_advanced();
|
||||||
|
@ -120,7 +120,7 @@ class Libprofile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$p[0]['extra_fields'] = $extra_fields;
|
$p[0]['extra_fields'] = ((isset($extra_fields)) ? $extra_fields : []);
|
||||||
|
|
||||||
$z = q("select xchan_photo_date, xchan_addr from xchan where xchan_hash = '%s' limit 1",
|
$z = q("select xchan_photo_date, xchan_addr from xchan where xchan_hash = '%s' limit 1",
|
||||||
dbesc($p[0]['channel_hash'])
|
dbesc($p[0]['channel_hash'])
|
||||||
|
@ -142,9 +142,13 @@ class Libprofile {
|
||||||
|
|
||||||
if ($p[0]['keywords']) {
|
if ($p[0]['keywords']) {
|
||||||
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$p[0]['keywords']);
|
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$p[0]['keywords']);
|
||||||
if (strlen($keywords) && $can_view_profile)
|
if (strlen($keywords) && $can_view_profile) {
|
||||||
|
if (! isset(App::$page['htmlhead'])) {
|
||||||
|
App::$page['htmlhead'] = EMPTY_STR;
|
||||||
|
}
|
||||||
App::$page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ;
|
App::$page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
App::$profile = $p[0];
|
App::$profile = $p[0];
|
||||||
App::$profile_uid = $p[0]['profile_uid'];
|
App::$profile_uid = $p[0]['profile_uid'];
|
||||||
|
|
|
@ -755,7 +755,7 @@ class Libzot {
|
||||||
if (intval($r[0]['xchan_selfcensored']) != intval($arr['adult_content'])) {
|
if (intval($r[0]['xchan_selfcensored']) != intval($arr['adult_content'])) {
|
||||||
$adult_changed = 1;
|
$adult_changed = 1;
|
||||||
}
|
}
|
||||||
if (intval($r[0]['xchan_deleted']) != intval($arr['deleted'])) {
|
if (isset($arr['deleted']) && intval($r[0]['xchan_deleted']) != intval($arr['deleted'])) {
|
||||||
$deleted_changed = 1;
|
$deleted_changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3146,7 +3146,7 @@ class Libzot {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a template for our follow url, %s will be replaced with a webbie
|
// This is a template for our follow url, %s will be replaced with a webbie
|
||||||
if (! $ret['follow_url']) {
|
if (! isset($ret['follow_url'])) {
|
||||||
$ret['follow_url'] = z_root() . '/follow?f=&url=%s';
|
$ret['follow_url'] = z_root() . '/follow?f=&url=%s';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Zotlabs\Lib;
|
namespace Zotlabs\Lib;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class for handling observer's config.
|
* @brief Class for handling observer's config.
|
||||||
*
|
*
|
||||||
|
@ -39,8 +41,8 @@ class XConfig {
|
||||||
if(! $xchan)
|
if(! $xchan)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(! array_key_exists($xchan, \App::$config))
|
if(! array_key_exists($xchan, App::$config))
|
||||||
\App::$config[$xchan] = array();
|
App::$config[$xchan] = [];
|
||||||
|
|
||||||
$r = q("SELECT * FROM xconfig WHERE xchan = '%s'",
|
$r = q("SELECT * FROM xconfig WHERE xchan = '%s'",
|
||||||
dbesc($xchan)
|
dbesc($xchan)
|
||||||
|
@ -50,11 +52,11 @@ class XConfig {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$k = $rr['k'];
|
$k = $rr['k'];
|
||||||
$c = $rr['cat'];
|
$c = $rr['cat'];
|
||||||
if(! array_key_exists($c, \App::$config[$xchan])) {
|
if(! array_key_exists($c, App::$config[$xchan])) {
|
||||||
\App::$config[$xchan][$c] = array();
|
App::$config[$xchan][$c] = array();
|
||||||
\App::$config[$xchan][$c]['config_loaded'] = true;
|
App::$config[$xchan][$c]['config_loaded'] = true;
|
||||||
}
|
}
|
||||||
\App::$config[$xchan][$c][$k] = $rr['v'];
|
App::$config[$xchan][$c][$k] = $rr['v'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,13 +84,13 @@ class XConfig {
|
||||||
if(! $xchan)
|
if(! $xchan)
|
||||||
return $default;
|
return $default;
|
||||||
|
|
||||||
if(! array_key_exists($xchan, \App::$config))
|
if(! array_key_exists($xchan, App::$config))
|
||||||
load_xconfig($xchan);
|
load_xconfig($xchan);
|
||||||
|
|
||||||
if((! array_key_exists($family, \App::$config[$xchan])) || (! array_key_exists($key, \App::$config[$xchan][$family])))
|
if((! array_key_exists($family, App::$config[$xchan])) || (! array_key_exists($key, App::$config[$xchan][$family])))
|
||||||
return $default;
|
return $default;
|
||||||
|
|
||||||
return unserialise(\App::$config[$xchan][$family][$key]);
|
return unserialise(App::$config[$xchan][$family][$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,10 +116,10 @@ class XConfig {
|
||||||
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
|
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
|
||||||
|
|
||||||
if(self::Get($xchan, $family, $key) === false) {
|
if(self::Get($xchan, $family, $key) === false) {
|
||||||
if(! array_key_exists($xchan, \App::$config))
|
if(! array_key_exists($xchan, App::$config))
|
||||||
\App::$config[$xchan] = array();
|
App::$config[$xchan] = [];
|
||||||
if(! array_key_exists($family, \App::$config[$xchan]))
|
if(! array_key_exists($family, App::$config[$xchan]))
|
||||||
\App::$config[$xchan][$family] = array();
|
App::$config[$xchan][$family] = [];
|
||||||
|
|
||||||
$ret = q("INSERT INTO xconfig ( xchan, cat, k, v ) VALUES ( '%s', '%s', '%s', '%s' )",
|
$ret = q("INSERT INTO xconfig ( xchan, cat, k, v ) VALUES ( '%s', '%s', '%s', '%s' )",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
|
@ -135,7 +137,7 @@ class XConfig {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
\App::$config[$xchan][$family][$key] = $value;
|
App::$config[$xchan][$family][$key] = $value;
|
||||||
|
|
||||||
if($ret)
|
if($ret)
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -159,8 +161,8 @@ class XConfig {
|
||||||
*/
|
*/
|
||||||
static public function Delete($xchan, $family, $key) {
|
static public function Delete($xchan, $family, $key) {
|
||||||
|
|
||||||
if(x(\App::$config[$xchan][$family], $key))
|
if(isset(App::$config[$xchan]) && isset(App::$config[$xchan][$family]) && isset(App::$config[$xchan][$family][$key]))
|
||||||
unset(\App::$config[$xchan][$family][$key]);
|
unset(App::$config[$xchan][$family][$key]);
|
||||||
|
|
||||||
$ret = q("DELETE FROM xconfig WHERE xchan = '%s' AND cat = '%s' AND k = '%s'",
|
$ret = q("DELETE FROM xconfig WHERE xchan = '%s' AND cat = '%s' AND k = '%s'",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
|
|
|
@ -342,7 +342,7 @@ class Channel extends Controller {
|
||||||
'title' => 'oembed'
|
'title' => 'oembed'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($update && $_SESSION['loadtime']) {
|
if ($update && isset($_SESSION['loadtime'])) {
|
||||||
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
|
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
|
||||||
}
|
}
|
||||||
if ($load) {
|
if ($load) {
|
||||||
|
@ -524,13 +524,13 @@ class Channel extends Controller {
|
||||||
* comment likes could also get somewhat hairy.
|
* comment likes could also get somewhat hairy.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($parents_str) {
|
if (isset($parents_str) && $parents_str) {
|
||||||
$update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
|
$update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
|
||||||
$update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
|
$update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($parents_str) {
|
if (isset($parents_str) && $parents_str) {
|
||||||
$update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )";
|
$update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ class Channel extends Controller {
|
||||||
// We reset $channel so that info can be obtained for unlogged visitors
|
// We reset $channel so that info can be obtained for unlogged visitors
|
||||||
$channel = channelx_by_n(App::$profile['profile_uid']);
|
$channel = channelx_by_n(App::$profile['profile_uid']);
|
||||||
|
|
||||||
if ($_REQUEST['mid']) {
|
if (isset($_REQUEST['mid']) && $_REQUEST['mid']) {
|
||||||
|
|
||||||
if(preg_match("/\[[zi]mg(.*?)\]([^\[]+)/is", $items[0]['body'], $matches)) {
|
if(preg_match("/\[[zi]mg(.*?)\]([^\[]+)/is", $items[0]['body'], $matches)) {
|
||||||
$ogimage = $matches[2];
|
$ogimage = $matches[2];
|
||||||
|
|
|
@ -51,11 +51,12 @@ class Ping extends Controller {
|
||||||
$result['forums_sub'] = [];
|
$result['forums_sub'] = [];
|
||||||
$result['reports'] = 0;
|
$result['reports'] = 0;
|
||||||
|
|
||||||
if (! $_SESSION['static_loadtime']) {
|
if (! (isset($_SESSION['static_loadtime']) && $_SESSION['static_loadtime'])) {
|
||||||
$_SESSION['static_loadtime'] = datetime_convert();
|
$_SESSION['static_loadtime'] = datetime_convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
$vnotify = false;
|
$vnotify = false;
|
||||||
|
$evdays = 3;
|
||||||
|
|
||||||
$item_normal = item_normal();
|
$item_normal = item_normal();
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ class Ping extends Controller {
|
||||||
* of the now current channel.
|
* of the now current channel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$result['invalid'] = ((intval($_GET['uid'])) && (intval($_GET['uid']) != local_channel()) ? 1 : 0);
|
$result['invalid'] = ((isset($_GET['uid']) && intval($_GET['uid'])) && (intval($_GET['uid']) != local_channel()) ? 1 : 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send all system messages (alerts) to the browser.
|
* Send all system messages (alerts) to the browser.
|
||||||
|
|
|
@ -13,13 +13,13 @@ class HTTPHeaders {
|
||||||
if ($lines) {
|
if ($lines) {
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
if (preg_match('/^\s+/',$line,$matches) && trim($line)) {
|
if (preg_match('/^\s+/',$line,$matches) && trim($line)) {
|
||||||
if ($this->in_progress['k']) {
|
if (isset($this->in_progress['k'])) {
|
||||||
$this->in_progress['v'] .= ' ' . ltrim($line);
|
$this->in_progress['v'] .= ' ' . ltrim($line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($this->in_progress['k']) {
|
if (isset($this->in_progress['k'])) {
|
||||||
$this->parsed[] = [ $this->in_progress['k'] => $this->in_progress['v'] ];
|
$this->parsed[] = [ $this->in_progress['k'] => $this->in_progress['v'] ];
|
||||||
$this->in_progress = [];
|
$this->in_progress = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,13 +165,13 @@ class WebServer {
|
||||||
[
|
[
|
||||||
'rel' => 'jrd',
|
'rel' => 'jrd',
|
||||||
'type' => 'application/jrd+json',
|
'type' => 'application/jrd+json',
|
||||||
'url' => z_root() . '/.well-known/webfinger?f=&resource=acct%3A' . argv(1) . '%40' . App::get_hostname()
|
'href' => z_root() . '/.well-known/webfinger?f=&resource=acct%3A' . argv(1) . '%40' . App::get_hostname()
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'rel' => 'zot',
|
'rel' => 'zot',
|
||||||
'type' => 'application/x-zot+json',
|
'type' => 'application/x-zot+json',
|
||||||
'url' => z_root() . '/channel/' . argv(1)
|
'href' => z_root() . '/channel/' . argv(1)
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
@ -8,7 +8,7 @@ interface IHandler {
|
||||||
|
|
||||||
function Rekey($sender,$data,$hub);
|
function Rekey($sender,$data,$hub);
|
||||||
|
|
||||||
function Refresh($sender,$recipients,$hub);
|
function Refresh($sender,$recipients,$hub,$force);
|
||||||
|
|
||||||
function Purge($sender,$recipients,$hub);
|
function Purge($sender,$recipients,$hub);
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,11 @@ class Receiver {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'refresh':
|
case 'refresh':
|
||||||
$this->response = $this->handler->Refresh($this->sender,$this->recipients,$this->hub);
|
$this->response = $this->handler->Refresh($this->sender,$this->recipients,$this->hub,false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'force_refresh':
|
||||||
|
$this->response = $this->handler->Refresh($this->sender,$this->recipients,$this->hub,true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rekey':
|
case 'rekey':
|
||||||
|
|
|
@ -15,8 +15,8 @@ class Zot6Handler implements IHandler {
|
||||||
return self::reply_rekey_request($sender,$data,$hub);
|
return self::reply_rekey_request($sender,$data,$hub);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Refresh($sender,$recipients,$hub) {
|
function Refresh($sender,$recipients,$hub,$force) {
|
||||||
return self::reply_refresh($sender,$recipients,$hub);
|
return self::reply_refresh($sender,$recipients,$hub,$force);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Purge($sender,$recipients,$hub) {
|
function Purge($sender,$recipients,$hub) {
|
||||||
|
@ -58,7 +58,7 @@ class Zot6Handler implements IHandler {
|
||||||
* @return json_return_and_die()
|
* @return json_return_and_die()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function reply_refresh($sender, $recipients,$hub) {
|
static function reply_refresh($sender, $recipients,$hub,$force) {
|
||||||
$ret = array('success' => false);
|
$ret = array('success' => false);
|
||||||
|
|
||||||
if($recipients) {
|
if($recipients) {
|
||||||
|
@ -72,13 +72,13 @@ class Zot6Handler implements IHandler {
|
||||||
dbesc($recip)
|
dbesc($recip)
|
||||||
);
|
);
|
||||||
|
|
||||||
$x = Libzot::refresh( [ 'hubloc_id_url' => $hub['hubloc_id_url'] ], $r[0], (($msgtype === 'force_refresh') ? true : false));
|
$x = Libzot::refresh( [ 'hubloc_id_url' => $hub['hubloc_id_url'] ], $r[0], $force );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// system wide refresh
|
// system wide refresh
|
||||||
$x = Libzot::refresh( [ 'hubloc_id_url' => $hub['hubloc_id_url'] ], null, (($msgtype === 'force_refresh') ? true : false));
|
$x = Libzot::refresh( [ 'hubloc_id_url' => $hub['hubloc_id_url'] ], null, $force );
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
|
|
4
boot.php
4
boot.php
|
@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
|
||||||
* @brief This file defines some global constants and includes the central App class.
|
* @brief This file defines some global constants and includes the central App class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define ( 'STD_VERSION', '21.03.08' );
|
define ( 'STD_VERSION', '21.03.11' );
|
||||||
define ( 'ZOT_REVISION', '6.0' );
|
define ( 'ZOT_REVISION', '6.0' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1247 );
|
define ( 'DB_UPDATE_VERSION', 1247 );
|
||||||
|
@ -1042,7 +1042,7 @@ class App {
|
||||||
if ($s) {
|
if ($s) {
|
||||||
$s .= ',';
|
$s .= ',';
|
||||||
}
|
}
|
||||||
$s .= '<' . $y['url'] . '>; rel="' . $y['rel'] . '"; type="' . $y['type'] . '"';
|
$s .= '<' . $y['href'] . '>; rel="' . $y['rel'] . '"; type="' . $y['type'] . '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $s;
|
return $s;
|
||||||
|
|
|
@ -599,10 +599,12 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
|
||||||
$channel = App::get_channel();
|
$channel = App::get_channel();
|
||||||
$observer = App::get_observer();
|
$observer = App::get_observer();
|
||||||
|
|
||||||
if($update)
|
if($update && isset($_SESSION['return_url'])) {
|
||||||
$return_url = $_SESSION['return_url'];
|
$return_url = $_SESSION['return_url'];
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$return_url = $_SESSION['return_url'] = App::$query_string;
|
$return_url = $_SESSION['return_url'] = App::$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
load_contact_links(local_channel());
|
load_contact_links(local_channel());
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ function feature_level($feature,$def) {
|
||||||
|
|
||||||
function get_features($filtered = true, $level = (-1)) {
|
function get_features($filtered = true, $level = (-1)) {
|
||||||
|
|
||||||
$account = \App::get_account();
|
$account = App::get_account();
|
||||||
|
|
||||||
$arr = [
|
$arr = [
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function get_features($filtered = true, $level = (-1)) {
|
||||||
'start_menu',
|
'start_menu',
|
||||||
t('New Member Links'),
|
t('New Member Links'),
|
||||||
t('Display new member quick links menu'),
|
t('Display new member quick links menu'),
|
||||||
(($account['account_created'] > datetime_convert('','','now - 30 days')) ? true : false),
|
(($account && $account['account_created'] > datetime_convert('','','now - 30 days')) ? true : false),
|
||||||
get_config('feature_lock','start_menu'),
|
get_config('feature_lock','start_menu'),
|
||||||
feature_level('start_menu',1),
|
feature_level('start_menu',1),
|
||||||
],
|
],
|
||||||
|
|
|
@ -118,7 +118,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
||||||
|
|
||||||
@$doc->loadHTML($tmp_message);
|
@$doc->loadHTML($tmp_message);
|
||||||
|
|
||||||
$xpath = new DomXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$list = $xpath->query("//pre");
|
$list = $xpath->query("//pre");
|
||||||
foreach ($list as $node) {
|
foreach ($list as $node) {
|
||||||
$node->nodeValue = str_replace("\n", "\r", htmlspecialchars($node->nodeValue));
|
$node->nodeValue = str_replace("\n", "\r", htmlspecialchars($node->nodeValue));
|
||||||
|
|
|
@ -7,6 +7,9 @@ use Zotlabs\Lib\Apps;
|
||||||
use Zotlabs\Lib\Connect;
|
use Zotlabs\Lib\Connect;
|
||||||
use Zotlabs\Lib\LibBlock;
|
use Zotlabs\Lib\LibBlock;
|
||||||
use Zotlabs\Daemon\Run;
|
use Zotlabs\Daemon\Run;
|
||||||
|
use Zotlabs\Access\PermissionRoles;
|
||||||
|
use Zotlabs\Access\PermissionLimits;
|
||||||
|
|
||||||
|
|
||||||
require_once('include/menu.php');
|
require_once('include/menu.php');
|
||||||
|
|
||||||
|
|
|
@ -177,8 +177,8 @@ function oembed_fetch_url($embedurl){
|
||||||
logger('fetch failure: ' . $furl);
|
logger('fetch failure: ' . $furl);
|
||||||
|
|
||||||
if($html_text) {
|
if($html_text) {
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = DOMDocument::loadHTML($html_text);
|
||||||
if ($dom){
|
if ($dom) {
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
$attr = "oembed";
|
$attr = "oembed";
|
||||||
$xattr = oe_build_xpath("class","oembed");
|
$xattr = oe_build_xpath("class","oembed");
|
||||||
|
@ -418,15 +418,14 @@ function oe_get_inner_html( $node ) {
|
||||||
*/
|
*/
|
||||||
function oembed_html2bbcode($text) {
|
function oembed_html2bbcode($text) {
|
||||||
// start parser only if 'oembed' is in text
|
// start parser only if 'oembed' is in text
|
||||||
if (strpos($text, "oembed")){
|
if (strpos($text, "oembed")) {
|
||||||
|
|
||||||
// convert non ascii chars to html entities
|
// convert non ascii chars to html entities
|
||||||
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
|
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
|
||||||
|
|
||||||
// If it doesn't parse at all, just return the text.
|
// If it doesn't parse at all, just return the text.
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = DOMDocument::loadHTML($html_text);
|
||||||
if(! $dom)
|
if ($dom) {
|
||||||
return $text;
|
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
$attr = "oembed";
|
$attr = "oembed";
|
||||||
|
|
||||||
|
@ -439,9 +438,10 @@ function oembed_html2bbcode($text) {
|
||||||
if(!is_null($href)) $e->parentNode->replaceChild(new DOMText("[embed]".$href."[/embed]"), $e);
|
if(!is_null($href)) $e->parentNode->replaceChild(new DOMText("[embed]".$href."[/embed]"), $e);
|
||||||
}
|
}
|
||||||
return oe_get_inner_html( $dom->getElementsByTagName("body")->item(0) );
|
return oe_get_inner_html( $dom->getElementsByTagName("body")->item(0) );
|
||||||
} else {
|
|
||||||
return $text;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ function poco() {
|
||||||
$system_mode = true;
|
$system_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = (($_REQUEST['format']) ? $_REQUEST['format'] : 'json');
|
$format = ((isset($_REQUEST['format']) && $_REQUEST['format']) ? $_REQUEST['format'] : 'json');
|
||||||
|
|
||||||
$justme = false;
|
$justme = false;
|
||||||
|
|
||||||
|
@ -456,15 +456,15 @@ function poco() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($justme)
|
if(isset($justme) && $justme)
|
||||||
$sql_extra = " and abook_self = 1 ";
|
$sql_extra = " and abook_self = 1 ";
|
||||||
else
|
else
|
||||||
$sql_extra = " and abook_self = 0 ";
|
$sql_extra = " and abook_self = 0 ";
|
||||||
|
|
||||||
if($cid)
|
if(isset($cid) && $cid)
|
||||||
$sql_extra = sprintf(" and abook_id = %d and abook_archived = 0 and abook_hidden = 0 and abook_pending = 0 ",intval($cid));
|
$sql_extra = sprintf(" and abook_id = %d and abook_archived = 0 and abook_hidden = 0 and abook_pending = 0 ",intval($cid));
|
||||||
|
|
||||||
if($system_mode) {
|
if(isset($system_mode) && $system_mode) {
|
||||||
$r = q("SELECT count(*) as total from abook where abook_self = 1
|
$r = q("SELECT count(*) as total from abook where abook_self = 1
|
||||||
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') ");
|
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') ");
|
||||||
}
|
}
|
||||||
|
@ -482,11 +482,11 @@ function poco() {
|
||||||
else
|
else
|
||||||
$totalResults = 0;
|
$totalResults = 0;
|
||||||
|
|
||||||
$startIndex = intval($_GET['startIndex']);
|
$startIndex = ((isset($_GET['startIndex'])) ? intval($_GET['startIndex']) : 0);
|
||||||
if(! $startIndex)
|
if($startIndex < 0)
|
||||||
$startIndex = 0;
|
$startIndex = 0;
|
||||||
|
|
||||||
$itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
|
$itemsPerPage = ((isset($_GET['count']) && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
|
||||||
|
|
||||||
if($system_mode) {
|
if($system_mode) {
|
||||||
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1
|
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1
|
||||||
|
|
Loading…
Reference in a new issue