Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-02-22 18:39:58 -08:00
commit 222f318988
4 changed files with 34 additions and 8 deletions

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '21.02.22' );
define ( 'STD_VERSION', '21.02.23' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1247 );
@ -1930,11 +1930,11 @@ function is_site_admin() {
if(! session_id())
return false;
if($_SESSION['delegate'])
if(isset($_SESSION['delegate']))
return false;
if((intval($_SESSION['authenticated']))
&& (is_array(App::$account))
if(isset($_SESSION['authenticated']) && intval($_SESSION['authenticated'])
&& is_array(App::$account)
&& (App::$account['account_roles'] & ACCOUNT_ROLE_ADMIN))
return true;
@ -1953,7 +1953,8 @@ function is_developer() {
if(! session_id())
return false;
if((intval($_SESSION['authenticated']))
if(isset($_SESSION['authenticated'])
&& (intval($_SESSION['authenticated']))
&& (is_array(App::$account))
&& (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER))
return true;

View file

@ -1362,17 +1362,41 @@ function decode_tags($t) {
return '';
}
function purify_imported_object($obj) {
$ret = null;
if (is_array($obj)) {
foreach ( $obj as $k => $v ) {
$ret[$k] = purify_html($v);
}
}
elseif (is_string($obj)) {
$ret = purify_html($obj);
}
return $ret;
}
/**
* @brief Santise a potentially complex array.
* @brief Sanitise a potentially complex array.
*
* Walks the array and applies htmlspecialchars to the content unless it is a known HTML element,
* in which case the result is purified
*
* @param array $arr
* @return array|string
*/
function activity_sanitise($arr) {
if($arr) {
if(is_array($arr)) {
$ret = array();
foreach($arr as $k => $x) {
if (in_array($k, [ 'content', 'summary', 'contentMap', 'summaryMap' ])) {
$ret[$k] = purify_imported_object($arr[$k]);
continue;
}
if(is_array($x))
$ret[$k] = activity_sanitise($x);
else

View file

@ -59,7 +59,8 @@ function zid($s, $address = '') {
$mine_parsed = parse_url($mine);
$s_parsed = parse_url($s);
if($mine_parsed['host'] === $s_parsed['host'])
if(isset($mine_parsed['host']) && isset($s_parsed['host'])
&& $mine_parsed['host'] === $s_parsed['host'])
$url_match = true;
if ($mine && $myaddr && (! $url_match))