diff options
-rw-r--r-- | Zotlabs/Module/Hq.php | 5 | ||||
-rw-r--r-- | Zotlabs/Photo/PhotoDriver.php | 10 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 8 | ||||
-rw-r--r-- | include/feedutils.php | 14 | ||||
-rw-r--r-- | include/oembed.php | 12 | ||||
-rw-r--r-- | include/text.php | 3 | ||||
-rw-r--r-- | include/zid.php | 2 |
7 files changed, 31 insertions, 23 deletions
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 29b0df739..5001bbe62 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -27,6 +27,8 @@ class Hq extends \Zotlabs\Web\Controller { return; } + $item_hash = ''; + if(argc() > 1 && argv(1) !== 'load') { $item_hash = unpack_link_id(argv(1)); } @@ -97,7 +99,7 @@ class Hq extends \Zotlabs\Web\Controller { 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], - 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), 'permissions' => $channel_acl, 'bang' => '', @@ -112,6 +114,7 @@ class Hq extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ]; + $a = ''; $o = status_editor($a, $x, true); } diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php index 4c4f26e32..6bdb89ab1 100644 --- a/Zotlabs/Photo/PhotoDriver.php +++ b/Zotlabs/Photo/PhotoDriver.php @@ -2,7 +2,7 @@ namespace Zotlabs\Photo; -use Zotlabs\Lib\Hashpath; +use Zotlabs\Lib\Hashpath; /** * @brief Abstract photo driver class. @@ -494,11 +494,11 @@ abstract class PhotoDriver { ( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, allow_cid, allow_gid, deny_cid, deny_gid, expires, profile ) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", intval($p['aid']), intval($p['uid']), dbesc($p['xchan']), dbesc($p['resource_id']), dbescdate($p['created']), dbescdate($p['edited']), dbesc(basename($p['filename'])), dbesc($p['mimetype']), dbesc($p['album']), intval($p['height']), intval($p['width']), (intval($p['os_storage']) ? dbescbin($p['os_syspath']) : dbescbin($this->imageString())), intval($p['os_storage']), (intval($p['os_storage']) ? @filesize($p['os_syspath']) : strlen($this->imageString())), intval($p['imgscale']), intval($p['photo_usage']), dbesc($p['title']), dbesc($p['description']), dbesc($p['os_path']), dbesc($p['display_path']), dbesc($p['allow_cid']), dbesc($p['allow_gid']), dbesc($p['deny_cid']), dbesc($p['deny_gid']), dbescdate($p['expires']), intval($p['profile'])); } - logger('Photo save imgscale ' . $p['imgscale'] . ' returned ' . intval($r)); + logger('Photo save imgscale ' . $p['imgscale'] . ' returned: ' . (($r) ? 1 : 0)); return $r; } - + /** * @brief Stores thumbnail to database or filesystem. * @@ -530,13 +530,13 @@ abstract class PhotoDriver { } else $arr['os_storage'] = 0; - + if(! $this->save($arr)) { if(array_key_exists('os_syspath', $arr)) @unlink($arr['os_syspath']); return false; } - + return true; } diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index e7341b556..86ce2fa29 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -17,8 +17,8 @@ class Messages { $tpl = get_markup_template('messages_widget.tpl'); $o = replace_macros($tpl, [ - '$entries' => $page['entries'], - '$offset' => $page['offset'], + '$entries' => $page['entries'] ?? [], + '$offset' => $page['offset'] ?? 0, '$feature_star' => feature_enabled(local_channel(), 'star_posts'), '$strings' => [ 'messages_title' => t('Public and restricted messages'), @@ -37,11 +37,11 @@ class Messages { if (!local_channel()) return; - if ($options['offset'] == -1) { + if (isset($options['offset']) && $options['offset'] == -1) { return; } - if ($options['type'] == 'notification') { + if (isset($options['type']) && $options['type'] == 'notification') { return self::get_notices_page($options); } diff --git a/include/feedutils.php b/include/feedutils.php index 1c653325d..b21495d72 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -194,14 +194,14 @@ function construct_activity_object($item) { $r = json_decode($item['obj'],false); if(! $r) - return ''; - if($r->type) + return EMPTY_STR; + if(isset($r->type)) $o .= '<as:obj_type>' . xmlify($r->type) . '</as:obj_type>' . "\r\n"; - if($r->id) + if(isset($r->id)) $o .= '<id>' . xmlify($r->id) . '</id>' . "\r\n"; - if($r->title) + if(isset($r->title)) $o .= '<title>' . xmlify($r->title) . '</title>' . "\r\n"; - if($r->links) { + if(isset($r->links)) { /** @FIXME!! */ if(substr($r->link,0,1) === '<') { $r->link = preg_replace('/\<link(.*?)\"\>/','<link$1"/>',$r->link); @@ -210,7 +210,7 @@ function construct_activity_object($item) { else $o .= '<link rel="alternate" type="text/html" href="' . xmlify($r->link) . '" />' . "\r\n"; } - if($r->content) { + if(isset($r->content)) { $o .= '<content type="html" >' . xmlify(bbcode($r->content)) . '</content>' . "\r\n"; } $o .= '</as:object>' . "\r\n"; @@ -218,7 +218,7 @@ function construct_activity_object($item) { return $o; } - return ''; + return EMPTY_STR; } function construct_activity_target($item) { diff --git a/include/oembed.php b/include/oembed.php index 9a25686fa..36938c577 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -134,6 +134,7 @@ function oembed_fetch_url($embedurl){ } $txt = null; + $j = null; // we should try to cache this and avoid a lookup on each render $is_matrix = is_matrix_url($embedurl); @@ -160,7 +161,7 @@ function oembed_fetch_url($embedurl){ if(is_null($txt)) { - $txt = ""; + $txt = EMPTY_STR; if ($action !== 'block') { // try oembed autodiscovery @@ -168,7 +169,7 @@ function oembed_fetch_url($embedurl){ $result = z_fetch_url($furl, false, $redirects, [ 'timeout' => 30, - 'accept_content' => "text/*", + 'accept_content' => 'text/*', 'novalidate' => true, 'session' => ((local_channel() && $zrl) ? true : false) ] @@ -227,9 +228,10 @@ function oembed_fetch_url($embedurl){ $txt = $x['embed']; } - $txt=trim($txt); + $txt = trim($txt); - if ($txt[0]!="{") $txt='{"type":"error"}'; + if (substr($txt, 0, 1) !== '{') + $txt = '{"type":"error"}'; // save in cache @@ -247,7 +249,7 @@ function oembed_fetch_url($embedurl){ } if($action === 'filter') { - if($j['html']) { + if(isset($j['html']) && $j['html']) { $orig = $j['html']; $allow_position = (($is_matrix) ? true : false); diff --git a/include/text.php b/include/text.php index f69801302..9a2ca1af4 100644 --- a/include/text.php +++ b/include/text.php @@ -4057,9 +4057,10 @@ function sanitize_text_field($str) { */ function substr_words($str, $max_length, $suffix = '...') { + $ret = ''; + if (strlen($str) > $max_length) { $words = preg_split('/\s/', $str); - $ret = ''; $i = 0; while (true) { $length = (strlen($ret) + strlen($words[$i])); diff --git a/include/zid.php b/include/zid.php index ae7d9e252..5710d9f3f 100644 --- a/include/zid.php +++ b/include/zid.php @@ -58,6 +58,8 @@ function zid($s, $address = '') { $mine_parsed = parse_url($mine); $s_parsed = parse_url($s); + + $url_match = false; if(isset($mine_parsed['host']) && isset($s_parsed['host']) && $mine_parsed['host'] === $s_parsed['host']) $url_match = true; |