From 951800eca6045f6e0dc1e9a12c225c8e55b044e9 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 14 Nov 2024 18:40:15 +0000 Subject: Several issues discovered by PHPStan --- Zotlabs/Module/Achievements.php | 44 ++++++++++++++++---------------- Zotlabs/Module/Admin/Features.php | 5 ++-- Zotlabs/Module/Admin/Site.php | 3 ++- Zotlabs/Module/Authorize.php | 9 +++---- Zotlabs/Module/Authtest.php | 4 +-- Zotlabs/Module/Changeaddr.php | 40 +++++++++++++---------------- Zotlabs/Module/Cover_photo.php | 9 +++---- Zotlabs/Module/Dav.php | 1 + Zotlabs/Module/Display.php | 7 ++++- Zotlabs/Module/Fbrowser.php | 2 ++ Zotlabs/Module/Go.php | 4 +-- Zotlabs/Module/Mitem.php | 30 ++++++++++------------ Zotlabs/Module/OAuth2TestVehicle.php | 8 +++--- Zotlabs/Module/Oauth.php | 12 ++++----- Zotlabs/Module/Oauth2.php | 12 ++++----- Zotlabs/Module/Page.php | 4 +-- Zotlabs/Module/Pdledit.php | 2 +- Zotlabs/Module/Profperm.php | 2 ++ Zotlabs/Module/Removeaccount.php | 20 ++++++--------- Zotlabs/Module/Removeme.php | 6 +---- Zotlabs/Module/Search_ac.php | 7 +---- Zotlabs/Module/Settings/Account.php | 4 +-- Zotlabs/Module/Settings/Calendar.php | 5 +--- Zotlabs/Module/Settings/Channel_home.php | 5 +--- Zotlabs/Module/Settings/Connections.php | 5 +--- Zotlabs/Module/Settings/Conversation.php | 2 +- Zotlabs/Module/Settings/Directory.php | 5 +--- Zotlabs/Module/Settings/Editor.php | 5 +--- Zotlabs/Module/Settings/Events.php | 5 +--- Zotlabs/Module/Settings/Features.php | 7 ++--- Zotlabs/Module/Settings/Manage.php | 5 +--- Zotlabs/Module/Settings/Network.php | 5 +--- Zotlabs/Module/Settings/Photos.php | 5 +--- Zotlabs/Module/Settings/Profiles.php | 5 +--- Zotlabs/Module/Thing.php | 11 +++----- Zotlabs/Module/Webfinger.php | 14 +++++----- Zotlabs/Module/Webpages.php | 5 ++-- 37 files changed, 133 insertions(+), 191 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Achievements.php b/Zotlabs/Module/Achievements.php index 1529448d3..a16294039 100644 --- a/Zotlabs/Module/Achievements.php +++ b/Zotlabs/Module/Achievements.php @@ -8,25 +8,25 @@ class Achievements extends \Zotlabs\Web\Controller { // This doesn't work, so if (! is_developer()) return; - + if(argc() > 1) $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); return; } - + $profile = 0; - $profile = argv(1); + $profile = argv(1); profile_load($which,$profile); - + $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which) ); if($r) { $owner = intval($r[0]['channel_id']); } - + $observer = \App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); $perms = get_all_perms($owner,$ob_hash); @@ -34,60 +34,60 @@ class Achievements extends \Zotlabs\Web\Controller { notice( t('Permission denied.') . EOL); return; } - + $newmembertext = t('Some blurb about what to do when you\'re new here'); - - + + // By default, all badges are false $contactbadge = false; $profilebadge = false; $keywordsbadge = false; - + // Check number of contacts. Award a badge if over 10 - // We'll figure these out on each page load instead of + // We'll figure these out on each page load instead of // writing them to the DB because that will mean one needs // to retain their achievements - eg, you can't add // a bunch of channels just to get your badge, and then // delete them all again. If these become popular or // used in profiles or something, we may need to reconsider // and add a table for this - because this won't scale. - + $r = q("select * from abook where abook_channel = %d", intval($owner) ); - + if (count($r)) $contacts = count($r); // We're checking for 11 to adjust for the abook record for self if ($contacts >= 11) $contactbadge = true; - + // Check if an about field in the profile has been created. - + $r = q("select * from profile where uid = %d and about <> ''", intval($owner) ); - + if ($r) $profilebadge = 1; - + // Check if keywords have been set - + $r = q("select * from profile where uid = %d and keywords <> ''", intval($owner) ); - + if($r) $keywordsbadge = 1; - + return replace_macros(get_markup_template("achievements.tpl"), array( '$newmembertext' => $newmembertext, '$profilebadge' => $profilebadge, '$contactbadge' => $contactbadge, '$keywordsbadge' => $keywordsbadge, - '$channelsbadge' => $channelsbadge + '$channelsbadge' => null, )); - + } - + } diff --git a/Zotlabs/Module/Admin/Features.php b/Zotlabs/Module/Admin/Features.php index e0b3a3fd4..eb82ae1ff 100644 --- a/Zotlabs/Module/Admin/Features.php +++ b/Zotlabs/Module/Admin/Features.php @@ -59,14 +59,13 @@ class Features { } $tpl = get_markup_template("admin_settings_features.tpl"); - $o .= replace_macros($tpl, array( + + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("admin_manage_features"), '$title' => t('Manage Additional Features'), '$features' => $arr, '$submit' => t('Submit'), )); - - return $o; } } diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index abc56d298..9ef5dc20f 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -6,6 +6,8 @@ use Zotlabs\Lib\Config; class Site { + private string $eol; + private string $joo; /** * @brief POST handler for Admin Site Page. @@ -208,7 +210,6 @@ class Site { //Config::Set('system','force_queue_threshold', $force_queue); Config::Set('system','no_community_page', $no_community_page); - Config::Set('system','no_utf', $no_utf); Config::Set('system','sse_enabled', $sse_enabled); diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php index c6709f602..b015c3284 100644 --- a/Zotlabs/Module/Authorize.php +++ b/Zotlabs/Module/Authorize.php @@ -9,7 +9,7 @@ class Authorize extends \Zotlabs\Web\Controller { function get() { if (! local_channel()) { return login(); - } + } else { $name = $_REQUEST['client_name']; @@ -25,7 +25,7 @@ class Authorize extends \Zotlabs\Web\Controller { $link = (($app['url']) ? '' . $app['name'] . ' ' : $app['name']); - $o .= replace_macros(get_markup_template('oauth_authorize.tpl'), [ + return replace_macros(get_markup_template('oauth_authorize.tpl'), [ '$title' => t('Authorize'), '$authorize' => sprintf( t('Do you authorize the app %s to access your channel data?'), $link ), '$app' => $app, @@ -35,7 +35,6 @@ class Authorize extends \Zotlabs\Web\Controller { '$redirect_uri' => (x($_REQUEST, 'redirect_uri') ? $_REQUEST['redirect_uri'] : ''), '$state' => (x($_REQUEST, 'state') ? $_REQUEST['state'] : ''), ]); - return $o; } } @@ -50,7 +49,7 @@ class Authorize extends \Zotlabs\Web\Controller { // TODO: The automatic client registration protocol below should adhere more // closely to "OAuth 2.0 Dynamic Client Registration Protocol" defined // at https://tools.ietf.org/html/rfc7591 - + // If no client_id was provided, generate a new one. if (x($_POST, 'client_id')) { $client_id = $_POST['client_id']; @@ -67,7 +66,7 @@ class Authorize extends \Zotlabs\Web\Controller { $request = \OAuth2\Request::createFromGlobals(); $response = new \OAuth2\Response(); - // Note, "sub" field must match type and content. $user_id is used to populate - make sure it's a string. + // Note, "sub" field must match type and content. $user_id is used to populate - make sure it's a string. $channel = channelx_by_n(local_channel()); $user_id = $channel['channel_id']; diff --git a/Zotlabs/Module/Authtest.php b/Zotlabs/Module/Authtest.php index d85af09dc..bf199ccf6 100644 --- a/Zotlabs/Module/Authtest.php +++ b/Zotlabs/Module/Authtest.php @@ -7,7 +7,7 @@ class Authtest extends \Zotlabs\Web\Controller { $auth_success = false; - $o .= '

Magic-Auth Diagnostic

'; + $o = '

Magic-Auth Diagnostic

'; if(! local_channel()) { notice( t('Permission denied.') . EOL); @@ -27,7 +27,7 @@ class Authtest extends \Zotlabs\Web\Controller { $_REQUEST['test'] = 1; $mod = new Magic(); - $x = $mod->init($a); + $x = $mod->init(); $o .= 'Local Setup returns: ' . print_r($x,true); diff --git a/Zotlabs/Module/Changeaddr.php b/Zotlabs/Module/Changeaddr.php index ed139c9f9..f8a045727 100644 --- a/Zotlabs/Module/Changeaddr.php +++ b/Zotlabs/Module/Changeaddr.php @@ -5,30 +5,30 @@ namespace Zotlabs\Module; class Changeaddr extends \Zotlabs\Web\Controller { function post() { - + if(! local_channel()) return; - + if($_SESSION['delegate']) return; - + if((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password'])))) return; - + if((! x($_POST,'verify')) || (! strlen(trim($_POST['verify'])))) return; - + if($_POST['verify'] !== $_SESSION['remove_account_verify']) return; - - + + $account = \App::get_account(); $channel = \App::get_channel(); - + $x = account_verify_password($account['account_email'],$_POST['qxz_password']); if(! ($x && $x['account'])) return; - + if($account['account_password_changed'] > NULL_DATE) { $d1 = datetime_convert('UTC','UTC','now - 48 hours'); if($account['account_password_changed'] > $d1) { @@ -36,7 +36,7 @@ class Changeaddr extends \Zotlabs\Web\Controller { return; } } - + $new_address = trim($_POST['newname']); if($new_address === $channel['channel_address']) @@ -55,23 +55,23 @@ class Changeaddr extends \Zotlabs\Web\Controller { channel_change_address($channel,$new_address); goaway(z_root() . '/changeaddr'); - + } - - + + function get() { - + if(! local_channel()) goaway(z_root()); - + $channel = \App::get_channel(); $hash = random_string(); - + $_SESSION['remove_account_verify'] = $hash; - + $tpl = get_markup_template('channel_rename.tpl'); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$basedir' => z_root(), '$hash' => $hash, '$title' => t('Change channel nickname/address'), @@ -80,9 +80,5 @@ class Changeaddr extends \Zotlabs\Web\Controller { '$newname' => array('newname', t('New channel address'),$channel['channel_address'], ''), '$submit' => t('Rename Channel') )); - - return $o; - } - } diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index aa2464ac2..2d2ffd52d 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -371,7 +371,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { $tpl = get_markup_template('cover_photo.tpl'); - $o .= replace_macros($tpl,array( + $output = replace_macros($tpl,array( '$user' => \App::$channel['channel_address'], '$info' => t('Your cover photo may be visible to anybody on the internet'), '$existing' => get_cover_photo(local_channel(),'array',PHOTO_RES_COVER_850), @@ -397,15 +397,15 @@ class Cover_photo extends \Zotlabs\Web\Controller { )); - call_hooks('cover_photo_content_end', $o); + call_hooks('cover_photo_content_end', $output); - return $o; + return $output; } else { $filename = \App::$data['imagecrop'] . '-3'; $resolution = 3; $tpl = get_markup_template("cropcover.tpl"); - $o .= replace_macros($tpl,array( + return replace_macros($tpl,array( '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), '$resource' => \App::$data['imagecrop'] . '-3', @@ -415,7 +415,6 @@ class Cover_photo extends \Zotlabs\Web\Controller { '$form_security_token' => get_form_security_token("cover_photo"), '$done' => t('Done Editing') )); - return $o; } } diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php index 96fe2c898..5254d436d 100644 --- a/Zotlabs/Module/Dav.php +++ b/Zotlabs/Module/Dav.php @@ -9,6 +9,7 @@ namespace Zotlabs\Module; use Sabre\DAV as SDAV; +use Zotlabs\Lib\Libzot; use Zotlabs\Storage; use Zotlabs\Web\HTTPSig; diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 451ddeb1f..090e0c92e 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -344,7 +344,12 @@ class Display extends Controller { '$profile_page' => xmlify(z_root() . '/display/' . gen_link_id($target_item['mid'])), )); - $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ]; + $x = [ + 'xml' => $atom, + 'channel' => $channel, + 'observer_hash' => $observer_hash, + 'params' => [], + ]; call_hooks('atom_feed_top',$x); $atom = $x['xml']; diff --git a/Zotlabs/Module/Fbrowser.php b/Zotlabs/Module/Fbrowser.php index 3bac81c5a..e8517e095 100644 --- a/Zotlabs/Module/Fbrowser.php +++ b/Zotlabs/Module/Fbrowser.php @@ -6,6 +6,8 @@ namespace Zotlabs\Module; * @author Fabio Comuni */ +use function Zotlabs\Render\template_escape; + require_once('include/photo/photo_driver.php'); /** diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php index ec528fb1a..77a3ffac6 100644 --- a/Zotlabs/Module/Go.php +++ b/Zotlabs/Module/Go.php @@ -2,7 +2,7 @@ namespace Zotlabs\Module; -use Zorlabs\Lib\Config; +use Zotlabs\Lib\Config; class Go extends \Zotlabs\Web\Controller { @@ -19,7 +19,7 @@ class Go extends \Zotlabs\Web\Controller { function get() { if(! local_channel()) { - notify( t('This page is available only to site members') . EOL); + notice( t('This page is available only to site members') . EOL); } $channel = \App::get_channel(); diff --git a/Zotlabs/Module/Mitem.php b/Zotlabs/Module/Mitem.php index ac7470e13..81787f8c4 100644 --- a/Zotlabs/Module/Mitem.php +++ b/Zotlabs/Module/Mitem.php @@ -184,8 +184,8 @@ class Mitem extends \Zotlabs\Web\Controller { '$nick' => $which, '$sys' => \App::$is_sys )); - - $o .= replace_macros(get_markup_template('mitemlist.tpl'),array( + + return replace_macros(get_markup_template('mitemlist.tpl'),array( '$title' => t('Menu:'), '$create' => $create, '$nametitle' => t('Link Name'), @@ -204,29 +204,27 @@ class Mitem extends \Zotlabs\Web\Controller { '$hintedit' => t('Edit this menu item'), '$nick' => $which, )); - - return $o; } - - + + if(argc() > 3) { if(intval(argv(3))) { - + $m = q("select * from menu_item where mitem_id = %d and mitem_channel_id = %d limit 1", intval(argv(3)), intval($owner) ); - + if(! $m) { notice( t('Menu item not found.') . EOL); goaway(z_root() . '/menu/'. $which . ((\App::$is_sys) ? '?f=&sys=1' : '')); } - + $mitem = $m[0]; - + $lockstate = (($mitem['allow_cid'] || $mitem['allow_gid'] || $mitem['deny_cid'] || $mitem['deny_gid']) ? 'lock' : 'unlock'); - + if(argc() == 5 && argv(4) == 'drop') { menu_sync_packet($owner,get_observer_hash(),$mitem['mitem_menu_id']); $r = menu_del_item($mitem['mitem_menu_id'], $owner, intval(argv(3))); @@ -235,12 +233,12 @@ class Mitem extends \Zotlabs\Web\Controller { info( t('Menu item deleted.') . EOL); else notice( t('Menu item could not be deleted.'). EOL); - + goaway(z_root() . '/mitem/' . $which . '/' . $mitem['mitem_menu_id'] . ((\App::$is_sys) ? '?f=&sys=1' : '')); } - + // edit menu item - $o = replace_macros(get_markup_template('mitemedit.tpl'), array( + return replace_macros(get_markup_template('mitemedit.tpl'), array( '$header' => t('Edit Menu Element'), '$menu_id' => \App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), @@ -261,10 +259,8 @@ class Mitem extends \Zotlabs\Web\Controller { '$menu_names' => $menu_names, '$nick' => $which )); - - return $o; } } } - + } diff --git a/Zotlabs/Module/OAuth2TestVehicle.php b/Zotlabs/Module/OAuth2TestVehicle.php index 5ae278e8c..57cda3c28 100644 --- a/Zotlabs/Module/OAuth2TestVehicle.php +++ b/Zotlabs/Module/OAuth2TestVehicle.php @@ -31,8 +31,8 @@ class OAuth2TestVehicle extends \Zotlabs\Web\Controller { $_SESSION['api_response'] = (x($_SESSION, 'api_response') ? $_SESSION['api_response'] : ''); } function get() { - - $o .= replace_macros(get_markup_template('oauth2testvehicle.tpl'), array( + + $output = replace_macros(get_markup_template('oauth2testvehicle.tpl'), array( '$baseurl' => z_root(), '$api_response' => $_SESSION['api_response'], /* @@ -97,8 +97,10 @@ class OAuth2TestVehicle extends \Zotlabs\Web\Controller { ) ) )); + $_SESSION['success'] = ''; - return $o; + + return $output; } function post() { diff --git a/Zotlabs/Module/Oauth.php b/Zotlabs/Module/Oauth.php index 061296257..6063c7738 100644 --- a/Zotlabs/Module/Oauth.php +++ b/Zotlabs/Module/Oauth.php @@ -103,7 +103,8 @@ class Oauth extends Controller { if((argc() > 1) && (argv(1) === 'add')) { $tpl = get_markup_template("oauth_edit.tpl"); - $o .= replace_macros($tpl, array( + + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth"), '$title' => t('Add application'), '$submit' => t('Submit'), @@ -114,7 +115,6 @@ class Oauth extends Controller { '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')), '$icon' => array('icon', t('Icon url'), '', t('Optional')), )); - return $o; } if((argc() > 2) && (argv(1) === 'edit')) { @@ -129,7 +129,7 @@ class Oauth extends Controller { $app = $r[0]; $tpl = get_markup_template("oauth_edit.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth"), '$title' => t('Add application'), '$submit' => t('Update'), @@ -140,7 +140,6 @@ class Oauth extends Controller { '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''), '$icon' => array('icon', t('Icon url'), $app['icon'], ''), )); - return $o; } if((argc() > 2) && (argv(1) === 'delete')) { @@ -163,7 +162,8 @@ class Oauth extends Controller { $tpl = get_markup_template("oauth.tpl"); - $o .= replace_macros($tpl, array( + + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth"), '$baseurl' => z_root(), '$title' => t('Connected OAuth Apps'), @@ -175,8 +175,6 @@ class Oauth extends Controller { '$remove' => t('Remove authorization'), '$apps' => $r, )); - return $o; - } } diff --git a/Zotlabs/Module/Oauth2.php b/Zotlabs/Module/Oauth2.php index 4b0b1991e..7aadd91bc 100644 --- a/Zotlabs/Module/Oauth2.php +++ b/Zotlabs/Module/Oauth2.php @@ -108,7 +108,8 @@ class Oauth2 extends Controller { if((argc() > 1) && (argv(1) === 'add')) { $tpl = get_markup_template("oauth2_edit.tpl"); - $o .= replace_macros($tpl, array( + + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth2"), '$title' => t('Add OAuth2 application'), '$submit' => t('Submit'), @@ -119,7 +120,6 @@ class Oauth2 extends Controller { '$grant' => array('grant', t('Grant Types'), '', t('leave blank unless your application sepcifically requires this')), '$scope' => array('scope', t('Authorization scope'), '', t('leave blank unless your application sepcifically requires this')), )); - return $o; } if((argc() > 2) && (argv(1) === 'edit')) { @@ -136,7 +136,7 @@ class Oauth2 extends Controller { $app = $r[0]; $tpl = get_markup_template("oauth2_edit.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth2"), '$title' => t('Add application'), '$submit' => t('Update'), @@ -147,7 +147,6 @@ class Oauth2 extends Controller { '$grant' => array('grant', t('Grant Types'), $app['grant_types'], t('leave blank unless your application specifically requires this')), '$scope' => array('scope', t('Authorization scope'), $app['scope'], t('leave blank unless your application specifically requires this')), )); - return $o; } if((argc() > 2) && (argv(1) === 'delete')) { @@ -184,7 +183,8 @@ class Oauth2 extends Controller { ); $tpl = get_markup_template("oauth2.tpl"); - $o .= replace_macros($tpl, array( + + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("oauth2"), '$baseurl' => z_root(), '$title' => t('Connected OAuth2 Apps'), @@ -196,8 +196,6 @@ class Oauth2 extends Controller { '$remove' => t('Remove authorization'), '$apps' => $r, )); - return $o; - } } diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php index 8a698005a..a4ee5eaa2 100644 --- a/Zotlabs/Module/Page.php +++ b/Zotlabs/Module/Page.php @@ -183,9 +183,7 @@ class Page extends \Zotlabs\Web\Controller { if($r[0]['mimetype'] === 'application/x-pdl') \App::$page['pdl_content'] = true; - $o .= prepare_page($r[0]); - return $o; - + return prepare_page($r[0]); } } diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php index e0bbc31d0..aa512e6da 100644 --- a/Zotlabs/Module/Pdledit.php +++ b/Zotlabs/Module/Pdledit.php @@ -51,7 +51,7 @@ class Pdledit extends Controller { if(argc() > 1) $module = 'mod_' . argv(1) . '.pdl'; else { - $o .= '
'; + $o = '
'; $o .= '

' . t('Edit System Page Description') . '

'; $edited = []; diff --git a/Zotlabs/Module/Profperm.php b/Zotlabs/Module/Profperm.php index 842197415..4594728b1 100644 --- a/Zotlabs/Module/Profperm.php +++ b/Zotlabs/Module/Profperm.php @@ -55,6 +55,8 @@ class Profperm extends \Zotlabs\Web\Controller { } + $o = ''; + if((argc() > 1) && (intval(argv(1)))) { $r = q("SELECT * FROM profile WHERE id = %d AND uid = %d AND is_default = 0 LIMIT 1", intval(argv(1)), diff --git a/Zotlabs/Module/Removeaccount.php b/Zotlabs/Module/Removeaccount.php index cd18b79c0..b41acb8b0 100644 --- a/Zotlabs/Module/Removeaccount.php +++ b/Zotlabs/Module/Removeaccount.php @@ -36,22 +36,22 @@ class Removeaccount extends \Zotlabs\Web\Controller { return; } } - + $global_remove = 0; //intval($_POST['global']); - - account_remove($account_id, 1 - $global_remove); + + account_remove($account_id, 1 - $global_remove); } - + function get() { - + if(! local_channel()) goaway(z_root()); - + $hash = random_string(); - + $_SESSION['remove_account_verify'] = $hash; $tpl = get_markup_template('removeaccount.tpl'); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$basedir' => z_root(), '$hash' => $hash, '$title' => t('Remove This Account'), @@ -60,9 +60,5 @@ class Removeaccount extends \Zotlabs\Web\Controller { // '$global' => array('global', t('Remove this account, all its channels and all its channel clones from the network'), false, t('By default only the instances of the channels located on this hub will be removed from the network')), '$submit' => t('Remove Account') )); - - return $o; - } - } diff --git a/Zotlabs/Module/Removeme.php b/Zotlabs/Module/Removeme.php index 4d475ead6..d71f8d4ab 100644 --- a/Zotlabs/Module/Removeme.php +++ b/Zotlabs/Module/Removeme.php @@ -54,7 +54,7 @@ class Removeme extends \Zotlabs\Web\Controller { $_SESSION['remove_account_verify'] = $hash; $tpl = get_markup_template('removeme.tpl'); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$basedir' => z_root(), '$hash' => $hash, '$title' => t('Remove Channel'), @@ -63,9 +63,5 @@ class Removeme extends \Zotlabs\Web\Controller { // '$global' => [ 'global', t('Remove this channel and all its clones from the network'), false, t('By default only the instance of the channel located on this hub will be removed from the network'), [ t('No'),t('Yes') ] ], '$submit' => t('Remove Channel') )); - - return $o; - } - } diff --git a/Zotlabs/Module/Search_ac.php b/Zotlabs/Module/Search_ac.php index 24b724c5d..cd0960859 100644 --- a/Zotlabs/Module/Search_ac.php +++ b/Zotlabs/Module/Search_ac.php @@ -90,12 +90,7 @@ class Search_ac extends \Zotlabs\Web\Controller { 'items' => $results, ); echo json_encode($o); - - logger('search_ac: ' . print_r($x,true),LOGGER_DATA,LOG_INFO); - + killme(); } - - - } diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php index 0266cee12..7f0d11069 100644 --- a/Zotlabs/Module/Settings/Account.php +++ b/Zotlabs/Module/Settings/Account.php @@ -100,7 +100,7 @@ class Account { $attremail = ((!strpos($email, '@')) ? 'disabled="disabled"' : ''); $tpl = get_markup_template("settings_account.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_account"), '$title' => t('Account Settings'), '$origpass' => array('origpass', t('Current Password'), ' ',''), @@ -114,7 +114,5 @@ class Account { '$removeaccount' => t('Remove this account including all its channels'), '$account_settings' => $account_settings )); - return $o; } - } diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php index 65240c635..3b15f4aa6 100644 --- a/Zotlabs/Module/Settings/Calendar.php +++ b/Zotlabs/Module/Settings/Calendar.php @@ -33,7 +33,7 @@ class Calendar { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Calendar { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php index 470dbe4c3..388b70942 100644 --- a/Zotlabs/Module/Settings/Channel_home.php +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -81,7 +81,7 @@ class Channel_home { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -90,8 +90,5 @@ class Channel_home { '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php index 52a95a3d1..9d1069cf3 100644 --- a/Zotlabs/Module/Settings/Connections.php +++ b/Zotlabs/Module/Settings/Connections.php @@ -33,7 +33,7 @@ class Connections { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Connections { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Conversation.php b/Zotlabs/Module/Settings/Conversation.php index 5f3d903a8..51ee2c83a 100644 --- a/Zotlabs/Module/Settings/Conversation.php +++ b/Zotlabs/Module/Settings/Conversation.php @@ -36,7 +36,7 @@ class Conversation { $tpl = (($aj) ? get_markup_template("settings_module_ajax.tpl") : get_markup_template("settings_module.tpl")); - $o .= replace_macros($tpl, array( + $o = replace_macros($tpl, array( '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Conversation Settings'), diff --git a/Zotlabs/Module/Settings/Directory.php b/Zotlabs/Module/Settings/Directory.php index 09ea61f60..e1957d2fa 100644 --- a/Zotlabs/Module/Settings/Directory.php +++ b/Zotlabs/Module/Settings/Directory.php @@ -33,7 +33,7 @@ class Directory { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Directory { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 85c3e69ae..50bd2b2ad 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -33,7 +33,7 @@ class Editor { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Editor { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php index 0a0e3516c..3a7faa8b4 100644 --- a/Zotlabs/Module/Settings/Events.php +++ b/Zotlabs/Module/Settings/Events.php @@ -33,7 +33,7 @@ class Events { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Events { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php index 553ff0836..84c868e48 100644 --- a/Zotlabs/Module/Settings/Features.php +++ b/Zotlabs/Module/Settings/Features.php @@ -38,17 +38,14 @@ class Features { $arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On'))); } } - + $tpl = get_markup_template("settings_features.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_features"), '$title' => t('Additional Features'), '$features' => $arr, '$baseurl' => z_root(), '$submit' => t('Submit'), )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php index 6fb57eafb..6e47cfcc7 100644 --- a/Zotlabs/Module/Settings/Manage.php +++ b/Zotlabs/Module/Settings/Manage.php @@ -34,7 +34,7 @@ class Manage { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -42,8 +42,5 @@ class Manage { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index eae963a25..39c66622e 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -52,7 +52,7 @@ class Network { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -61,8 +61,5 @@ class Network { '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Photos.php b/Zotlabs/Module/Settings/Photos.php index f68c8847b..05c380850 100644 --- a/Zotlabs/Module/Settings/Photos.php +++ b/Zotlabs/Module/Settings/Photos.php @@ -33,7 +33,7 @@ class Photos { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -41,8 +41,5 @@ class Photos { '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index 0ff2dfb6d..5052385a8 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -42,7 +42,7 @@ class Profiles { $tpl = get_markup_template("settings_module.tpl"); - $o .= replace_macros($tpl, array( + return replace_macros($tpl, array( '$rpath' => escape_url($rpath), '$action_url' => 'settings/' . $module, '$form_security_token' => get_form_security_token('settings_' . $module), @@ -51,8 +51,5 @@ class Profiles { '$extra_settings_html' => $extra_settings_html, '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php index a77081741..aef494e13 100644 --- a/Zotlabs/Module/Thing.php +++ b/Zotlabs/Module/Thing.php @@ -339,7 +339,7 @@ class Thing extends \Zotlabs\Web\Controller { return ''; } - $o .= replace_macros(get_markup_template('thing_edit.tpl'),array( + return replace_macros(get_markup_template('thing_edit.tpl'),array( '$thing_hdr' => t('Edit Thing'), '$multiprof' => feature_enabled(local_channel(),'multi_profiles'), '$profile_lbl' => t('Select a profile'), @@ -363,8 +363,6 @@ class Thing extends \Zotlabs\Web\Controller { '$lockstate' => $lockstate, '$submit' => t('Submit') )); - - return $o; } if(argc() == 3 && argv(1) === 'drop') { @@ -392,10 +390,10 @@ class Thing extends \Zotlabs\Web\Controller { Libsync::build_sync_packet(0,array('obj' => $r)); - return $o; + return ''; } - $o .= replace_macros(get_markup_template('thing_input.tpl'),array( + return replace_macros(get_markup_template('thing_input.tpl'),array( '$thing_hdr' => t('Add Thing to your Profile'), '$multiprof' => feature_enabled(local_channel(),'multi_profiles'), '$profile_lbl' => t('Select a profile'), @@ -415,8 +413,5 @@ class Thing extends \Zotlabs\Web\Controller { '$lockstate' => $lockstate, '$submit' => t('Submit') )); - - return $o; } - } diff --git a/Zotlabs/Module/Webfinger.php b/Zotlabs/Module/Webfinger.php index 0dafae23c..ba0dca9e7 100644 --- a/Zotlabs/Module/Webfinger.php +++ b/Zotlabs/Module/Webfinger.php @@ -7,16 +7,16 @@ namespace Zotlabs\Module; class Webfinger extends \Zotlabs\Web\Controller { function get() { - - - $o .= '

Webfinger Diagnostic

'; - + + + $o = '

Webfinger Diagnostic

'; + $o .= '
'; $o .= 'Lookup address: '; - $o .= '
'; - + $o .= ''; + $o .= '

'; - + if(x($_GET,'addr')) { $addr = trim($_GET['addr']); diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index ffb0d94ea..ca15c0b3a 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -63,7 +63,7 @@ class Webpages extends Controller { switch ($_SESSION['action']) { case 'import': $_SESSION['action'] = null; - $o .= replace_macros(get_markup_template('webpage_import.tpl'), array( + return replace_macros(get_markup_template('webpage_import.tpl'), array( '$title' => t('Import Webpage Elements'), '$importbtn' => t('Import selected'), '$action' => 'import', @@ -71,7 +71,6 @@ class Webpages extends Controller { '$layouts' => $_SESSION['layouts'], '$blocks' => $_SESSION['blocks'], )); - return $o; case 'importselected': $_SESSION['action'] = null; @@ -87,7 +86,7 @@ class Webpages extends Controller { $pages = get_webpage_elements($channel, 'pages'); $layouts = get_webpage_elements($channel, 'layouts'); $blocks = get_webpage_elements($channel, 'blocks'); - $o .= replace_macros(get_markup_template('webpage_export_list.tpl'), array( + $o = replace_macros(get_markup_template('webpage_export_list.tpl'), array( '$title' => t('Export Webpage Elements'), '$exportbtn' => t('Export selected'), '$action' => $_SESSION['export'], // value should be 'zipfile' or 'cloud' -- cgit v1.2.3