if (!$usersmenus->AsDansGuardianAdministrator) { $tpl = new templates(); $alert = $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}'); echo "<H2>{$alert}</H2>"; die; } if (isset($_GET["timerules-list"])) { timerules_list(); exit; } if (isset($_GET["EditTimeRule-js"])) { EditTimeRule_js(); exit; } if (isset($_GET["EditTimeRule-popup"])) { EditTimeRule_tabs(); exit; } if (isset($_GET["EditTimeRule-time"])) { EditTimeRule_popup(); exit; } if (isset($_POST["EditTimeRule"])) { EditTimeRule_save(); exit; } if (isset($_POST["DeleteTimeRule"])) { EditTimeRule_delete(); exit; } if (isset($_POST["EnbleTimeRule"])) {
function EditTimeRule_popup(){ $ID=$_GET["ID"]; if($ID>0){if(!isset($_GET["tab"])){EditTimeRule_tabs();return;}} $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_sqtimes_rules WHERE ID='$ID'")); $TimeSpace=unserialize($ligne["TimeCode"]); $days=array("0"=>"Monday","1"=>"Tuesday","2"=>"Wednesday","3"=>"Thursday","4"=>"Friday","5"=>"Saturday","6"=>"Sunday"); $cron=new cron_macros(); $buttonname="{apply}"; if($ID<1){$buttonname="{add}";} $RuleAl[0]="{block}"; $RuleAl[1]="{allow}"; $t=time(); while (list ($num, $val) = each ($days) ){ $jsjs[]="if(document.getElementById('day_{$num}').checked){ XHR.appendData('day_{$num}',1);}else{ XHR.appendData('day_{$num}',0);}"; $dd=$dd." <tr> <td width=1%>". Field_checkbox("day_{$num}",1,$TimeSpace["DAYS"][$num])."</td> <td width=99% class=legend style='font-size:14px' align='left'>{{$val}}</td> </tr> "; } $html=" <div id='$t'> <table style='width:99%' class=form> <tbody> <tr> <td class=legend style='font-size:14px' nowrap width=99%>{rulename}:</td> <td>". Field_text("TimeName",utf8_encode($ligne["TimeName"]),"font-size:14px;width:350px")."</td> </tr> <tr> <td class=legend style='font-size:14px' nowrap width=99%>{type}:</td> <td style='font-size:14px' nowrap width=99%>". Field_array_Hash($RuleAl,"Allow",$ligne["Allow"],null,null,0,"font-size:14px")."</td> </tr> <tr> <td style='width:50%' valign='top'> <table style='width:99%'> <tbody> $dd </tbody> </table> </td> <td style='width:50%' valign='top'> <table style='width:99%' class=form> <tbody> <tr> <td class=legend style='font-size:14px' nowrap width=99%>{hourBegin}:</td> <td style='font-size:14px' nowrap width=1%>". Field_array_Hash($cron->cron_hours,"BEGINH",$TimeSpace["BEGINH"],null,null,0,"font-size:14px")."H</td> <td style='font-size:14px' nowrap width=99%>". Field_array_Hash($cron->cron_mins,"BEGINM",$TimeSpace["BEGINH"],null,null,0,"font-size:14px")."M</td> </tr> <tr><td colspan=3> </td></tr> <tr> <td class=legend style='font-size:14px' nowrap width=99%>{hourEnd}:</td> <td style='font-size:14px' nowrap width=1%>". Field_array_Hash($cron->cron_hours,"ENDH",$TimeSpace["ENDH"],null,null,0,"font-size:14px")."H</td> <td style='font-size:14px' nowrap width=99%>". Field_array_Hash($cron->cron_mins,"ENDM",$TimeSpace["ENDM"],null,null,0,"font-size:14px")."M</td> </tr> </tbody> </table> </td> </tr> <tr> <td colspan=2 align='right'><hr>". button($buttonname, "TimeSpaceDansTimes()",16)."</td> </tr> </table> </div> <script> var x_TimeSpaceDansTimes= function (obj) { var res=obj.responseText; var ID=$ID; if(res.length>3){alert(res);} RefreshSquidConnectionTable(); if(ID==-1){YahooWin2Hide();return;} RefreshTab('main_content_rule_editTtimerule'); } function TimeSpaceDansTimes(){ var XHR = new XHRConnection(); XHR.appendData('TimeName', document.getElementById('TimeName').value); XHR.appendData('EditTimeRule', 'yes'); XHR.appendData('ID', '$ID'); ". @implode("\n", $jsjs)." XHR.appendData('BEGINH', document.getElementById('BEGINH').value); XHR.appendData('BEGINM', document.getElementById('BEGINM').value); XHR.appendData('ENDH', document.getElementById('ENDH').value); XHR.appendData('ENDM', document.getElementById('ENDM').value); XHR.appendData('Allow', document.getElementById('Allow').value); AnimateDiv('$t'); XHR.sendAndLoad('$page', 'POST',x_TimeSpaceDansTimes); } </script> "; echo $tpl->_ENGINE_parse_body($html); }