From c676689df039ac62ed7eda3daba7efda1929b312 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 23 Mar 2019 20:32:15 +0100 Subject: fix 48 hours timeframe check and remove unused var in mod changeaddr --- Zotlabs/Module/Admin/Features.php | 74 --------------------------------------- Zotlabs/Module/Changeaddr.php | 4 +-- Zotlabs/Module/Features.php | 74 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 Zotlabs/Module/Admin/Features.php create mode 100644 Zotlabs/Module/Features.php (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Admin/Features.php b/Zotlabs/Module/Admin/Features.php deleted file mode 100644 index 504caae79..000000000 --- a/Zotlabs/Module/Admin/Features.php +++ /dev/null @@ -1,74 +0,0 @@ - $fdata) { - foreach(array_slice($fdata,1) as $f) { - $feature = $f[0]; - - if(array_key_exists('feature_' . $feature,$_POST)) - $val = intval($_POST['feature_' . $feature]); - else - $val = 0; - set_config('feature',$feature,$val); - - if(array_key_exists('featurelock_' . $feature,$_POST)) - set_config('feature_lock',$feature,$val); - else - del_config('feature_lock',$feature); - } - } - - goaway(z_root() . '/admin/features' ); - - } - - function get() { - - if((argc() > 1) && (argv(1) === 'features')) { - $arr = array(); - $features = get_features(false); - - foreach($features as $fname => $fdata) { - $arr[$fname] = array(); - $arr[$fname][0] = $fdata[0]; - foreach(array_slice($fdata,1) as $f) { - - $set = get_config('feature',$f[0]); - if($set === false) - $set = $f[3]; - $arr[$fname][1][] = array( - array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))), - array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On'))) - ); - } - } - - $tpl = get_markup_template("admin_settings_features.tpl"); - $o .= 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; - } - } - - -} \ No newline at end of file diff --git a/Zotlabs/Module/Changeaddr.php b/Zotlabs/Module/Changeaddr.php index 5cd236394..ed139c9f9 100644 --- a/Zotlabs/Module/Changeaddr.php +++ b/Zotlabs/Module/Changeaddr.php @@ -31,7 +31,7 @@ class Changeaddr extends \Zotlabs\Web\Controller { if($account['account_password_changed'] > NULL_DATE) { $d1 = datetime_convert('UTC','UTC','now - 48 hours'); - if($account['account_password_changed'] > d1) { + if($account['account_password_changed'] > $d1) { notice( t('Channel name changes are not allowed within 48 hours of changing the account password.') . EOL); return; } @@ -49,7 +49,7 @@ class Changeaddr extends \Zotlabs\Web\Controller { if(check_webbie(array($new_address)) !== $new_address) { notice( t('Nickname has unsupported characters or is already being used on this site.') . EOL); - return $ret; + return; } channel_change_address($channel,$new_address); diff --git a/Zotlabs/Module/Features.php b/Zotlabs/Module/Features.php new file mode 100644 index 000000000..504caae79 --- /dev/null +++ b/Zotlabs/Module/Features.php @@ -0,0 +1,74 @@ + $fdata) { + foreach(array_slice($fdata,1) as $f) { + $feature = $f[0]; + + if(array_key_exists('feature_' . $feature,$_POST)) + $val = intval($_POST['feature_' . $feature]); + else + $val = 0; + set_config('feature',$feature,$val); + + if(array_key_exists('featurelock_' . $feature,$_POST)) + set_config('feature_lock',$feature,$val); + else + del_config('feature_lock',$feature); + } + } + + goaway(z_root() . '/admin/features' ); + + } + + function get() { + + if((argc() > 1) && (argv(1) === 'features')) { + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + $arr[$fname] = array(); + $arr[$fname][0] = $fdata[0]; + foreach(array_slice($fdata,1) as $f) { + + $set = get_config('feature',$f[0]); + if($set === false) + $set = $f[3]; + $arr[$fname][1][] = array( + array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))), + array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On'))) + ); + } + } + + $tpl = get_markup_template("admin_settings_features.tpl"); + $o .= 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; + } + } + + +} \ No newline at end of file -- cgit v1.2.3