diff options
Diffstat (limited to 'Zotlabs/Module/Admin')
-rw-r--r-- | Zotlabs/Module/Admin/Accounts.php | 28 | ||||
-rw-r--r-- | Zotlabs/Module/Admin/Channels.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 162 |
3 files changed, 93 insertions, 99 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 32029eb00..1c1911b3a 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -206,14 +206,20 @@ class Accounts { $tao = 'tao.zar.zarax = ' . "'" . '<img src="' . z_root() . '/images/zapax16.gif">' . "';\n"; - $pending = get_pending_accounts(); + + // by default we will only return verified results. if reg_all is set we will return everything'' + $get_all = isset($_REQUEST['get_all']); + $pending = get_pending_accounts($get_all); unset($_SESSION[self::MYP]); + if ($pending) { // collect and group all ip - $atips = q("SELECT reg_atip AS atip, COUNT(reg_atip) AS atips FROM register " - ." WHERE reg_vital = 1 GROUP BY reg_atip "); - $atips ? $atipn = array_column($atips, 'atips', 'atip') : $atipn = array('' => 0); + $atips = dbq("SELECT reg_atip AS atip, COUNT(reg_atip) AS atips FROM register + WHERE reg_vital = 1 GROUP BY reg_atip" + ); + + (($atips) ? $atipn = array_column($atips, 'atips', 'atip') : $atipn = ['' => 0]); $tao .= 'tao.zar.zarar = {'; foreach ($pending as $n => $v) { @@ -229,6 +235,13 @@ class Accounts { $pending[$n]['reg_atip_n'] = $atipn[$v['reg_atip']]; } + $pending[$n]['status'] = ''; + if($pending[$n]['reg_flags'] & ACCOUNT_UNVERIFIED > 0) + $pending[$n]['status'] = [t('Unverified'), 'bg-warning']; + + if($pending[$n]['status'] && $pending[$n]['reg_expires'] < datetime_convert()) + $pending[$n]['status'] = [t('Expired'), 'bg-danger text-white']; + // timezone adjust date_time for display $pending[$n]['reg_created'] = datetime_convert('UTC', date_default_timezone_get(), $pending[$n]['reg_created']); $pending[$n]['reg_startup'] = datetime_convert('UTC', date_default_timezone_get(), $pending[$n]['reg_startup']); @@ -294,13 +307,14 @@ class Accounts { '$title' => t('Administration'), '$page' => t('Accounts'), '$submit' => t('Submit'), - '$select_all' => t('select all'), + '$get_all' => (($get_all) ? t('Show verified registrations') : t('Show all registrations')), + '$get_all_link' => (($get_all) ? z_root() .'/admin/accounts' : z_root() .'/admin/accounts?get_all'), '$sel_tall' => t('Select toggle'), '$sel_deny' => t('Deny selected'), '$sel_aprv' => t('Approve selected'), - '$h_pending' => t('Verified registrations waiting for approval'), + '$h_pending' => (($get_all) ? t('All registrations') : t('Verified registrations waiting for approval')), '$th_pending' => array(t('Request date'), 'dId2', t('Email'), 'IP', t('Requests')), - '$no_pending' => t('No verified registrations.'), + '$no_pending' => (($get_all) ? t('No registrations available') : t('No verified registrations available')), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), diff --git a/Zotlabs/Module/Admin/Channels.php b/Zotlabs/Module/Admin/Channels.php index e0f26112d..09769a166 100644 --- a/Zotlabs/Module/Admin/Channels.php +++ b/Zotlabs/Module/Admin/Channels.php @@ -173,4 +173,4 @@ class Channels { return $o; } -}
\ No newline at end of file +} diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 8a7bb1180..76e117a84 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -5,9 +5,6 @@ namespace Zotlabs\Module\Admin; class Site { - // system cfgs - const ivo = 'invitation_only'; - const iva = 'invitation_also'; /** * @brief POST handler for Admin Site Page. @@ -129,7 +126,7 @@ class Site { //logger( print_r( $this->msgbg, true) ); //logger( print_r( $this->joo, true) ); if ($this->error === 0) { - set_config('system', 'register_duty', $this->register_duty); + set_config('system', 'register_duty', $this->register_duty); set_config('system', 'register_duty_jso', $this->joo); } else { notice('ZAR0130E,'.t('Errors') . ': ' . $this->error) . EOL . $this->msgfg; @@ -198,8 +195,8 @@ class Site { set_config('system','register_wo_email', $register_wo_email); set_config('system','minimum_age', $minimum_age); set_config('system','auto_channel_create', $reg_autochannel); - set_config('system',self::ivo, $invitation_only); - set_config('system',self::iva, $invitation_also); + set_config('system', 'invitation_only', $invitation_only); + set_config('system', 'invitation_also', $invitation_also); set_config('system','access_policy', $access_policy); set_config('system','account_abandon_days', $abandon_days); set_config('system','register_text', $register_text); @@ -323,9 +320,8 @@ class Site { REGISTER_APPROVE => t("Yes - with approval"), REGISTER_OPEN => t("Yes") ); - $this->register_duty ? get_config('system', 'register_duty') : ''; - $register_perday = get_config('system','max_daily_registrations'); - $register_perday ? '' : $register_perday = 50; + $this->register_duty = get_config('system', 'register_duty', '-:-'); + $register_perday = get_config('system','max_daily_registrations', 50); /* Acess policy */ $access_choices = Array( @@ -367,11 +363,10 @@ class Site { list($regdelay_n, $regdelay_u) = array(substr($regdelay,0,-1),substr($regdelay,-1)); $reg_delay = replace_macros(get_markup_template('field_duration.qmc.tpl'), array( - 'label' => t('Account registration delay'), + 'label' => t('Register verification delay'), 'qmc' => 'zar', - 'qmcid' => 'ZAR0860C', - 'help' => t('How long a registration request has to wait before validation can perform.' - . ' No delay if zero or no value.'), + 'qmcid' => '', + 'help' => t('Time to wait before a registration can be verified'), 'field' => array( 'name' => 'delay', 'title' => t('duration up from now'), @@ -390,25 +385,22 @@ class Site { list($regexpire_n, $regexpire_u) = array(substr($regexpire,0,-1),substr($regexpire,-1)); $reg_expire = replace_macros(get_markup_template('field_duration.qmc.tpl'), array( - 'label' => t('Account registration expiration'), + 'label' => t('Register verification expiration time'), 'qmc' => 'zar', - 'qmcid' => 'ZAR0862C', - 'help' => t('How long a registration to confirm remains valid.' - . ' Not expire if zero or no value.'), + 'qmcid' => '', + 'help' => t('Time before an unverified registration will expire'), 'field' => array( 'name' => 'expire', 'title' => t('duration up from now'), - 'value' => ($regexpire_n === false ? 99 : $regexpire_n), + 'value' => ($regexpire_n === false ? 3 : $regexpire_n), 'min' => '0', 'max' => '99', 'size' => '2', - 'default' => ($regexpire_u === false ? 'y' : $regexpire_u) + 'default' => ($regexpire_u === false ? 'd' : $regexpire_u) ), 'rabot' => $reg_rabots ) ); - $invitation_only = get_config('system',self::ivo); - $invitation_also = get_config('system',self::iva); $tao = ''; $t = get_markup_template("admin_site.tpl"); @@ -441,81 +433,72 @@ class Site { // Register // [hilmar-> - '$register_text' => array('register_text', + '$register_text' => [ + 'register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), - t("Will be displayed prominently on the registration page.") . ' ' - . t('If you operate with register duties (see ZAR0830C), best practise is to tell cleartext about here'), - 'ZAR0810C'), - '$register_policy' => array('register_policy', + t("This text will be displayed prominently at the registration page") + ], + '$register_policy' => [ + 'register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices, - 'ZAR0820C'), - '$register_wo_email' => array('register_wo_email', - t("Registration is also possible without having to enter an email address."), - get_config('system','register_wo_email'), - t("Registration is also supported without requiring an email address from the applicant. Instead of the email address an artificial identification is generated, which has to be confirmed in a separate dialog. The default value is (Off) and corresponds to the registration procedure up to version 5.4.x."), - "", "", 'ZAR0824C'), - - '$register_duty' => array('register_duty', - t('Registration office on duty'), - $this->register_duty = get_config('system', 'register_duty'), - t('The weekdays and hours the register office is open for registrations') . '. ' - . t('Split weekdays and hours per `:`') . '. ' - . t('Separate weekday(s):hour(s) pairs with blank(s)') . '. ' - . t('Several values or ranges are to split by comma') . '. ' - . t('From-To ranges are joined with `-`') . '. ' - . t('ie') . ' `1-5:0900-1200,1300-1700 6:900-1230` ' . t('or') .' `1-2,4-5:800-1800` ' - . EOL . ' <a id="zar083a" class="zuia btn">' . t('Parse and test your input') . '</a>'. EOL - . t('If left empty, defaults to 24h open everyday the week (-:-).') . ' ' - . t('Note, ranges are specified as open-close pairs and in case of') - . ' 0900-1200 ' - . t('results to: opens 9h and closes 12h. If meant open 9h to 12h exactly, say `0900-1201`'), - 'ZAR0830C'), - '$register_perday' => array('register_perday', - t('Account registrations max per day'), - (x(get_config('system', 'max_daily_registrations'))) - ? get_config('system', 'max_daily_registrations') : 50, - t('How many registration requests the site accepts during one day. Unlimited if zero or no value. Default 50'), - 'ZAR0840C'), - '$register_sameip' => array('register_sameip', - t('Account registrations from same ip'), - (x(get_config('system', 'register_sameip'))) - ? get_config('system', 'register_sameip') : 3, - t('How many pending registration requests the site accepts from a same ip address.'), - 'ZAR0850C'), - '$reg_delay'=>$reg_delay, - '$reg_expire'=>$reg_expire, - '$reg_autochannel' => array('auto_channel_create', + ], + '$register_duty' => [ + 'register_duty', + t('Configure the registration open days/hours'), + get_config('system', 'register_duty', '-:-'), + t('Empty or \'-:-\' value will keep registration open 24/7 (default)') . EOL . + t('Weekdays and hours must be separated by colon \':\', From-To ranges with a dash `-` example: 1:800-1200') . EOL . + t('Weekday:Hour pairs must be separated by space \' \' example: 1:900-1700 2:900-1700') . EOL . + t('From-To ranges must be separated by comma \',\' example: 1:800-1200,1300-1700 or 1-2,4-5:900-1700') . EOL . + t('Advanced examples:') . ' 1-5:0900-1200,1300-1700 6:900-1230 ' . t('or') . ' 1-2,4-5:800-1800<br>' . EOL . + '<a id="zar083a" class="btn btn-sm btn-outline-secondary zuia">' . t('Check your configuration') . '</a>'. EOL + ], + '$register_perday' => [ + 'register_perday', + t('Max account registrations per day'), + get_config('system', 'max_daily_registrations', 50), + t('Unlimited if zero or no value - default 50') + ], + '$register_sameip' => [ + 'register_sameip', + t('Max account registrations from same IP'), + get_config('system', 'register_sameip', 3), + t('Unlimited if zero or no value - default 3') + ], + '$reg_delay' => $reg_delay, + '$reg_expire' => $reg_expire, + '$reg_autochannel' => [ + 'auto_channel_create', t("Auto channel create"), get_config('system','auto_channel_create', 1), - t("Auto create a channel when register a new account. When On, the register form will show additional fields for the channel-name and the nickname."), - "", "", 'ZAR0870C'), - - '$invitation_only' => array(self::ivo, - ($invitation_only === false ? '✗' : '✓') . ' ' . t("Invitation only"), - $invitation_only, - t("Only allow new member registrations with an invitation code. Above register policy must be set to Yes."), - "", "", 'ZAR0880C'), - - '$invitation_also' => array(self::iva, - ($invitation_also === false ? '✗' : '✓') . ' ' . t("Invitation also"), - $invitation_also, - t("Also allow new member registrations with an invitation code. Above register policy must be set to Yes."), - "", "", 'ZAR0881C'), - - '$verify_email' => array('verify_email', - t("Verify Email Addresses"), + t("If disabled the channel will be created in a separate step during the registration process") + ], + '$invitation_only' => [ + 'invitation_only', + t("Require invite code"), + get_config('system', 'invitation_only', 0) + ], + '$invitation_also' => [ + 'invitation_also', + t("Allow invite code"), + get_config('system', 'invitation_also', 0) + ], + '$verify_email' => [ + 'verify_email', + t("Require email address"), get_config('system','verify_email'), - t("Check to verify email addresses used in account registration (recommended)."), - "", "", 'ZAR0890C'), - '$abandon_days' => array('abandon_days', - t('Accounts abandoned after x days'), + t("The provided email address will be verified (recommended)") + ], + '$abandon_days' => [ + 'abandon_days', + t('Abandon account after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.') - ), + ], // <-hilmar] '$role' => $role, @@ -598,16 +581,13 @@ class Site { if ($this->isajax) { $op = (preg_match('/[a-z]{2,4}/', $_REQUEST['zarop'])) ? $_REQUEST['zarop'] : ''; if ($op == 'zar083') { - $this->msgbg = 'ZAR0130I Testmode:' . $this->eol . $this->msgbg; + $this->msgbg = 'Testmode:' . $this->eol . $this->msgbg; } else { killme(); exit; } } - if (! $this->register_duty) - $this->register_duty = '-:-'; - $ranges = preg_split('/\s+/', $this->register_duty); $this->msgbg .= '..ranges: ' . print_r(count($ranges),true) . $this->eol; @@ -696,11 +676,11 @@ class Site { $cdow = $this->wdconst[$adow]; // below is the essential algo to verify a date (of format Hi) meets an open or closed condition $t = date('Hi', ( rand(time(), 60*60*24+time()) ) ); - $how='closed'; + $how='close'; foreach ($aro[$adow] as $o => $v) { // $this->msgbg .= 'debug: ' . $o . ' gt ' . $t . ' / ' . $v . $this->eol; // 4devels if ($o > $t) { - $how = ($v ? 'open' : 'closed'); + $how = ($v ? 'open' : 'close'); break; } } |