From 13c074f8b8f8340efc7c5912c615b6cfa693409d Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 19:20:57 +0200 Subject: Module\Setup: Pass all required params for the template. Non-existing keys in the array passed to the template causes a warning. Also make optional parts of the template actually optional by skipping them if the value is empty. --- Zotlabs/Module/Setup.php | 2 ++ view/tpl/install.tpl | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index 647415385..a4204afd7 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -215,9 +215,11 @@ class Setup extends \Zotlabs\Web\Controller { $tpl = get_markup_template('install.tpl'); return replace_macros($tpl, array( '$title' => $install_title, + '$icon' => null, '$pass' => '', '$status' => t('Permission denied.'), '$text' => '', + '$what_next' => null, )); } } diff --git a/view/tpl/install.tpl b/view/tpl/install.tpl index 5ab722b12..56faa0527 100644 --- a/view/tpl/install.tpl +++ b/view/tpl/install.tpl @@ -2,7 +2,9 @@

{{$title}}


+ {{if $icon}}

  {{$pass}}

+ {{/if}}
{{if $status}} @@ -11,5 +13,5 @@
{{$text}}

- {{$what_next}} + {{if $what_next}}{{$what_next}}{{/if}} -- cgit v1.2.3 From 4d5a7ec39f9d036ab6f68e3ca9f9919cc967109c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 19:59:52 +0200 Subject: includes/menu: Fix timestamp handling in menu_create. Referencing undefined array keys are not allowed anymore, so we need to check whether they exist first. --- include/menu.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/menu.php b/include/menu.php index 1f65f987d..2fcf88bca 100644 --- a/include/menu.php +++ b/include/menu.php @@ -166,7 +166,8 @@ function menu_create($arr) { if($r) return false; - $t = datetime_convert(); + $time_created = datetime_convert('UTC', 'UTC', empty($arr['menu_created']) ? 'now' : $arr['menu_created']); + $time_edited = empty($arr['menu_edited']) ? $time_created : datetime_convert('UTC', 'UTC', $arr['menu_edited']); $r = q("insert into menu ( menu_name, menu_desc, menu_flags, menu_channel_id, menu_created, menu_edited ) values( '%s', '%s', %d, %d, '%s', '%s' )", @@ -174,8 +175,8 @@ function menu_create($arr) { dbesc($menu_desc), intval($menu_flags), intval($menu_channel_id), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_created']) ? $arr['menu_created'] : $t))), - dbesc(datetime_convert('UTC','UTC',(($arr['menu_edited']) ? $arr['menu_edited'] : $t))) + dbesc($time_created), + dbesc($time_edited) ); if(! $r) return false; -- cgit v1.2.3 From c7ec3159ead30c2306a84d060ecc63e60e5c9084 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 20:01:34 +0200 Subject: Module\Rbmark: Specify all fields in the template. The `field_select` sub template wants five elements in the `field` array. --- Zotlabs/Module/Rbmark.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Zotlabs/Module/Rbmark.php b/Zotlabs/Module/Rbmark.php index b1aea2590..8ac23a4e4 100644 --- a/Zotlabs/Module/Rbmark.php +++ b/Zotlabs/Module/Rbmark.php @@ -73,6 +73,7 @@ class Rbmark extends \Zotlabs\Web\Controller { false, '', $this->get_bookmark_folders(intval($channel_id)), + null, ]; return replace_macros(get_markup_template('rbmark.tpl'), array( -- cgit v1.2.3 From 0a818191c1a282768049ecb8f65180a75594afc1 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 20:06:40 +0200 Subject: boot/login: Pass all expected args to sub templates. --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index d8b2953e8..372c26763 100644 --- a/boot.php +++ b/boot.php @@ -1758,9 +1758,9 @@ function login($register = false, $form_id = 'main_login', $hiddens = false, $lo '$login' => t('Login'), '$remote_login' => t('Remote Authentication'), '$form_id' => $form_id, - '$lname' => [$form_id . '_username', $lname_label], - '$lpassword' => [$form_id . '_password', t('Password')], - '$remember_me' => [$form_id . '_remember', t('Remember me'), '', '', [t('No'), t('Yes')]], + '$lname' => [$form_id . '_username', $lname_label, null, null, null, null], + '$lpassword' => [$form_id . '_password', t('Password'), null, null, null, null], + '$remember_me' => [$form_id . '_remember', t('Remember me'), '', '', [t('No'), t('Yes')], null, null], '$hiddens' => $hiddens, '$register' => $reg, '$lostpass' => t('Forgot your password?'), -- cgit v1.2.3 From ffc2455bea61df2fb0ecf1b39bc596541cb84c40 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 20:30:44 +0200 Subject: Module\Rbmark: Pass all fields to input field templates. --- Zotlabs/Module/Rbmark.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Rbmark.php b/Zotlabs/Module/Rbmark.php index 8ac23a4e4..df32a97c2 100644 --- a/Zotlabs/Module/Rbmark.php +++ b/Zotlabs/Module/Rbmark.php @@ -78,12 +78,12 @@ class Rbmark extends \Zotlabs\Web\Controller { return replace_macros(get_markup_template('rbmark.tpl'), array( '$header' => t('Save Bookmark'), - '$url' => array('url',t('URL of bookmark'),$_REQUEST['url']), - '$title' => array('title',t('Description'),$_REQUEST['title']), + '$url' => array('url',t('URL of bookmark'),$_REQUEST['url'], null, null, null), + '$title' => array('title',t('Description'),$_REQUEST['title'], null, null, null), '$ischat' => ((x($_REQUEST,'ischat')) ? intval($_REQUEST['ischat']) : 0), '$private' => ((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), '$submit' => t('Save'), - '$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''), + '$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'','', null, null), '$menus' => $menu_select )); } -- cgit v1.2.3 From ad9fb4d530d02c4e432f14626c1f08fe827255c5 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 20:40:56 +0200 Subject: Module\Help: Only variables can be passed by reference. Introduce an intermediate variable when extracting the file type from the file name. Otherwise we would try to pass a returned value as a reference. --- Zotlabs/Module/Help.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index 5d52440a5..fd5cacee6 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -210,7 +210,8 @@ class Help extends \Zotlabs\Web\Controller { $content = preg_replace_callback( "/#include (.*?)\;/ism", function ($matches) { - $sub_file_type = array_pop(explode('.', $matches[1])); + $parts = explode('.', $matches[1]); + $sub_file_type = array_pop($parts); $included_content = $this->render_help_file($matches[1], $sub_file_type); return str_replace($matches[0], $included_content, $matches[0]); }, -- cgit v1.2.3 From ac1e20b1880d57aab2048e670449768d51dbc0b0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 22 May 2024 20:44:27 +0200 Subject: Module\Setup: Don't access static variable as non static. --- Zotlabs/Module/Setup.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index a4204afd7..7ca3f827c 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -46,9 +46,9 @@ class Setup extends \Zotlabs\Web\Controller { } if(x($_POST, 'pass')) { - $this->install_wizard_pass = intval($_POST['pass']); + self::$install_wizard_pass = intval($_POST['pass']); } else { - $this->install_wizard_pass = 1; + self::$install_wizard_pass = 1; } } @@ -239,7 +239,7 @@ class Setup extends \Zotlabs\Web\Controller { )); } - switch ($this->install_wizard_pass){ + switch (self::$install_wizard_pass){ case 1: { // System check $checks = array(); -- cgit v1.2.3