From: kkalev Date: Sat, 1 Feb 2003 16:06:05 +0000 (+0000) Subject: * Do an eval on the attribute description strings in the user_edit page. That will... X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=c90f5adf4563344d110dd84c0047ce3e60364fa6;p=freeradius-dialup-admin.git * Do an eval on the attribute description strings in the user_edit page. That will allow the login-time creation page to work properly. * Add a login-time creation page which will allow the administrator to create the login-time string through a gui instead of writing it directly in UUCP format. --- diff --git a/Changelog b/Changelog index a89d108..1cb60ce 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,8 @@ +Ver 1.63: +* Do an eval on the attribute description strings in the user_edit page. That will allow the login-time creation + page to work properly. +* Add a login-time creation page which will allow the administrator to create the login-time string through a gui + instead of writing it directly in UUCP format. Ver 1.62: * Remove one sql query from user_admin which was not needed. * Instead of a query like "LIKE 'YYYY-MM-DD%'" use "AcctStopTime >= 'YYYY-MM-DD 00:00:00 AND AcctStopTime diff --git a/conf/user_edit.attrs b/conf/user_edit.attrs index e5e5648..ff5193e 100644 --- a/conf/user_edit.attrs +++ b/conf/user_edit.attrs @@ -37,7 +37,7 @@ Dialup-Lock-Msg (UUCP Format) +#Login-Time User Login Period (UUCP Format) #Expiration User Expiration Date # # Uncomment this if you are using ldap and you are using user regular profiles. diff --git a/htdocs/login_time_create.php3 b/htdocs/login_time_create.php3 new file mode 100644 index 0000000..cc28aa8 --- /dev/null +++ b/htdocs/login_time_create.php3 @@ -0,0 +1,280 @@ + + +Login-Time Creation Page + + + + 'Monday', + 'Tu' => 'Tusday', + 'We' => 'Wednesday', + 'Th' => 'Thursday', + 'Fr' => 'Friday', + 'Sa' => 'Saturday', + 'Su' => 'Sunday', + 'Al' => 'All Days', + 'Any' => 'All Days', + 'Wk' => 'Weekdays'); + +$rules = array(); + +if ($add == 1){ + if ($use == 'double' && $start_day != $stop_day){ + $new = $start_day; + if ($stop_day != '') + $new .= "-$stop_day"; + if ($Dstart_time != '' && $Dstop_time != '') + $new .= "$Dstart_time-$Dstop_time"; + } + else if ($use == 'one'){ + $new = $day; + if ($Mstart_time != '' && $Mstop_time != '') + $new .= "$Mstart_time-$Mstop_time"; + } + if ($new != ''){ + if ($rulestr == '') + $rulestr = $new; + else + $rulestr .= ",$new"; + } +} +$Mstart_time = $Mstop_time = $Dstart_time = $Dstop_time = ''; + + +if ($rulestr != '') + $rules1 = preg_split('/[,|]/',$rulestr); + +if ($rules1){ + foreach ($rules1 as $rule){ + if ($delete1 == 1 && $sel_rule == $rule) + continue; + $matches = array(); + if (preg_match('/^\w{2,3}$/',$rule)){ + if (!check_day($rule)){ + $err_msg .= "Rule '$rule' is invalid
\n"; + continue; + } + if ($sel_rule == $rule || $sel_rule == ''){ + $checked[one] = 'checked'; + $selected_more[$rule] = 'selected'; + } + $msg = $mapping[$rule]; + } + else if (preg_match('/^(\w{2,3})(\d{4})-(\d{4})$/',$rule,$matches)){ + if (!check_day($matches[1])){ + $err_msg .= "Rule '$rule' is invalid
\n"; + continue; + } + if ($sel_rule == $rule || $sel_rule == ''){ + $checked[one] = 'checked'; + $selected_more[$matches[1]] = 'selected'; + $Mstart_time = $matches[2]; + $Mstop_time = $matches[3]; + } + $msg = $mapping[$matches[1]] . " $matches[2] - $matches[3]"; + } + else if (preg_match('/^(\w{2,3})-(\w{2,3})$/',$rule,$matches)){ + if (!check_day($matches[1]) || !check_day($matches[2])){ + $err_msg .= "Rule '$rule' is invalid
\n"; + continue; + } + if ($sel_rule == $rule || $sel_rule == ''){ + $checked[double] = 'checked'; + $selected_start[$matches[1]] = 'selected'; + $selected_stop[$matches[2]] = 'selected'; + } + $msg = $mapping[$matches[1]] . " - " . $mapping[$matches[2]]; + } + else if (preg_match('/^(\w{2,3})-(\w{2,3})(\d{4})-(\d{4})$/',$rule,$matches)){ + if (!check_day($matches[1]) || !check_day($matches[2])){ + $err_msg .= "Rule '$rule' is invalid
\n"; + continue; + } + if ($sel_rule == $rule || $sel_rule == ''){ + $checked[double] = 'checked'; + $selected_start[$matches[1]] = 'selected'; + $selected_stop[$matches[2]] = 'selected'; + $Dstart_time = $matches[3]; + $Dstop_time = $matches[4]; + } + $msg = $mapping[$matches[1]] . " - " . $mapping[$matches[2]] . " $matches[3] - $matches[4]"; + } + else{ + $err_msg .= "Rule $rule is invalid
\n"; + continue; + } + array_push($rules,$rule); + $rule_msgs[$rule] = $msg; + } +} +if ($sel_rule != '') + $selected_rule[$sel_rule] = 'selected'; +else + $Mstart_time = $Mstop_time = $Dstart_time = $Dstop_time = ''; + +$rulestr = ''; +foreach ($rules as $rule){ + if ($rulestr == '') + $rulestr = "$rule"; + else + $rulestr .= ",$rule"; +} +if ($update == 1 && $val != '') + echo << +window.opener.document.edituser.$val.value = "$rulestr"; +window.close(); + +EOM; + +if ($checked[double] == '' && $checked[one] == '') + $checked[double] = 'checked'; + +?> +
+ + + + + + + + + + +
+ + +
Login-Time Create Page 
+
+ + + + +
+ + + + + + + + + + Range + + + + + + + + + +EOM; +?> + + + + + + + + + + + +
 Start DayStop DayTime (HHMM)
+ -  +
 Specific + -  +
 
+ +    + +
+
+Rule Set +
+\n"; + foreach ($rules as $rule) + echo "
 
Rule string (UUCP Format)
+ +
 
+ +
+ +window.document.ruleform.rulestr.value=window.opener.document.edituser.$val.value; +window.document.ruleform.submit(); + +EOM; +?> + +
+Close Window +
+
+ + diff --git a/htdocs/user_edit.php3 b/htdocs/user_edit.php3 index 1c18c6a..f4cd8df 100644 --- a/htdocs/user_edit.php3 +++ b/htdocs/user_edit.php3 @@ -92,7 +92,7 @@ else if ($badusers == 1){ } ?> -
+ > > @@ -177,6 +177,9 @@ EOM; EOM; + $desc = addslashes($desc); + eval("\$desc = \"$desc\";"); + $desc = stripslashes($desc); if ($i == 1) echo "$desc\n"; else