-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Scrutinizer] Fix issues in mod/ (_well_known to contactgroup) #4171
[Scrutinizer] Fix issues in mod/ (_well_known to contactgroup) #4171
Conversation
- Remove unused variables and parameter - Updated function documentation - Fix formatting - Add back uninitialized variables - Simplify nested conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at the change in functionality that I described.
include/datetime.php
Outdated
if (($dow == $f) && (! $started)) { | ||
$started = true; | ||
} | ||
$started = (($dow == $f) && (!$started)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a difference in functionality. The original code would never set $started
back to "false". This code is able to do so. Is it intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, good catch, I went too fast on my formatting spree.
mod/admin.php
Outdated
@@ -720,7 +709,7 @@ function admin_page_summary(App $a) | |||
if (Config::get('system', 'check_new_version_url', 'none') != 'none') { | |||
$gitversion = Config::get('system', 'git_friendica_version'); | |||
if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) { | |||
$warningtext[] = sprintf(t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s'), $FRIENDICA_VERSION, $gitversion); | |||
$warningtext[] = sprintf(t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s'), FRIENDICA_VERSION, $gitversion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t()
includes sprintf()
doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'll simplify the call. I'm not concentrating on it because it isn't a code error per se.
uninstall_theme($th['name']); | ||
install_theme($th['name']); | ||
} | ||
foreach ($themes as $th) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked: Can we be sure that $themes
is always an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defined as such on line 1963, populated on line 1982.
$remote_contact = true; | ||
} | ||
} | ||
if(! $remote_contact) { | ||
if(local_user()) { | ||
$contact_id = $_SESSION['cid']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this variable unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After line 129, no. If you think this call should be moved up let me know. However $remote_contact
will always be false so I don't think it's warranted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the assignment of the variable with the content of $_SESSION['cid'];
which now doesn't happen in the code any more if I see it right.
- Replaced sizeof by count - Used DBM::is_result()
- Use defaults for request parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the reason for one change.
mod/admin.php
Outdated
@@ -1266,7 +1266,7 @@ function admin_page_site(App $a) | |||
'$banner' => array('banner', t("Banner/Logo"), $banner, ""), | |||
'$shortcut_icon' => array('shortcut_icon', t("Shortcut icon"), Config::get('system','shortcut_icon'), t("Link to an icon that will be used for browsers.")), | |||
'$touch_icon' => array('touch_icon', t("Touch icon"), Config::get('system','touch_icon'), t("Link to an icon that will be used for tablets and mobiles.")), | |||
'$info' => array('info', t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/servers.'), get_server())), | |||
'$info' => array('info', t('Additional Info'), $info, t('For public servers: you can add additional information here that will be listed at %s/servers.', System::baseUrl()), get_server()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why had you added System::baseUrl())
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the translation string, there is a %s
but no interpolation variable was provided. I just filled in the blank.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The %s
belongs to get_server()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
mod/admin.php
Outdated
@@ -2121,7 +2123,7 @@ function admin_page_themes(App $a) | |||
'$function' => 'themes', | |||
'$plugins' => $plugins, | |||
'$pcount' => count($themes), | |||
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'), | |||
'$noplugshint' => t('No themes found on the system. They should be paced in %1$s', '<code>/view/themes</code>'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placed
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : ''); | ||
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : ''); | ||
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : ''); | ||
$pending = defaults($_POST, 'pending' , array()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a style question: Wouldn't it be preferable to set the comma directly after the parameter and not with much space before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the followingdefaults()
calls default values.
/// @todo : Initialize $profile_uid | ||
$r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1", | ||
dbesc(normalise_link(get_my_url())), | ||
intval($profile_uid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@annando Any idea how to properly initialize $profile_uid
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the local_user() in most cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but this is the module showing the common friends between two users/contacts, so there are many possibilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common friends is done differently. But for a deeper look I'm too tired now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's okay, it's been broken like this for a while, it can wait a little longer.
Part of #4176
Follow-up to #4166