function parseTemplate_unlock($error = null) { include_once dirname(__FILE__) . "/ressources/class.sockets.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php"; include_once dirname(__FILE__) . "/ressources/class.tcpip.inc"; $sock = new sockets(); $ARRAY = unserialize(base64_decode($_REQUEST["serialize"])); $sock->BuildTemplatesConfig($ARRAY); $SquidGuardIPWeb = null; $url = $_REQUEST["url"]; $IPADDR = $_REQUEST["ipaddr"]; if (isset($_GET["SquidGuardIPWeb"])) { $SquidGuardIPWeb = $_GET["SquidGuardIPWeb"]; } if ($SquidGuardIPWeb == null) { $SquidGuardIPWeb = CurrentPageName(); } if ($GLOBALS["VERBOSE"]) { echo "<H1>SquidGuardIPWeb={$SquidGuardIPWeb}</H1>"; } $UfdbGuardHTTPAllowNoCreds = intval($sock->GET_INFO("UfdbGuardHTTPAllowNoCreds")); $q = new mysql_squid_builder(); $parse_url = parse_url($url); $host = $parse_url["host"]; if (preg_match("#(.+?):[0-9]+#", $host, $re)) { $host = $re[1]; } $FinalHost = $q->GetFamilySites($host); if (!isset($GLOBALS["UfdbGuardHTTP"]["FOOTER"])) { $GLOBALS["UfdbGuardHTTP"]["FOOTER"] = null; } $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"]; $MAX = $GLOBALS["UfdbGuardHTTP"]["UnbblockMaxTime"]; $Timez[5] = "5 {minutes}"; $Timez[10] = "10 {minutes}"; $Timez[15] = "15 {minutes}"; $Timez[30] = "30 {minutes}"; $Timez[60] = "1 {hour}"; $Timez[120] = "2 {hours}"; $Timez[240] = "4 {hours}"; $Timez[720] = "12 {hours}"; $Timez[2880] = "2 {days}"; $TEXT_TIME = $Timez[$MAX]; $UnbblockText2 = $GLOBALS["UfdbGuardHTTP"]["UnbblockText2"]; $page = CurrentPageName(); $UnbblockText2 = str_replace("%WEBSITE%", $url, $UnbblockText2); $UnbblockText2 = str_replace("%TIME%", $TEXT_TIME, $UnbblockText2); $fontfamily = "font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $fontfamily = str_replace('"', "", $fontfamily); $wifidog_build_uri = wifidog_build_uri(); $uriext = $wifidog_build_uri[0]; $HiddenFields = $wifidog_build_uri[1]; $client_username = $ARRAY["clientname"]; if ($client_username != null) { $_REQUEST["clientname"] = $client_username; } if ($q->COUNT_ROWS("ufdb_page_rules") > 0) { include_once dirname(__FILE__) . "/ressources/class.ufdb.parsetemplate.inc"; $unlock = new parse_template_ufdb(); $noauth = $unlock->parseTemplate_unlock_privs($ARRAY, $pattern = "noauth=1", 0, true); $UfdbGuardHTTPAllowNoCreds = $noauth; } $UFDBGUARD_UNLOCK_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_UNLOCK_LINK"]; $unlock_web_site_text = "{unlock_web_site}"; if ($UFDBGUARD_UNLOCK_LINK != null) { $unlock_web_site_text = $UFDBGUARD_UNLOCK_LINK; } if ($noauth == 1) { $f[] = parseTemplate_headers("{$unlock_web_site_text}", null, $SquidGuardIPWeb); $f[] = $f[] = "<form id='unlockform' action=\"{$SquidGuardIPWeb}\" method=\"post\">\n\t\t<input type='hidden' id='unlock-www' name='unlock-www' value='yes'>\n\t\t<input type='hidden' id='finalhost' name='finalhost' value='{$FinalHost}'>\n\t\t<input type='hidden' id='ipaddr' name='ipaddr' value='{$IPADDR}'>\n\t\t<input type='hidden' id='SquidGuardIPWeb' name='SquidGuardIPWeb' value='{$SquidGuardIPWeb}'>\n\t\t<input type='hidden' id='serialize' name='serialize' value='{$_REQUEST["serialize"]}'>\n\t\t<input type='hidden' id='url' name='url' value='{$url}'>"; $f[] = "<input type='hidden' id='username' name='username' value='{$_REQUEST["clientname"]}'>"; $f[] = "<input type='hidden' id='nocreds' name='nocreds' value='1'>"; $f[] = "<script>\t"; $f[] = "function CheckTheForm(){\t"; $f[] = "document.forms['unlockform'].submit();"; $f[] = "}\t"; $f[] = "CheckTheForm();"; $f[] = "</script>\t"; $f[] = "</body>"; $f[] = "</html>"; echo @implode("\n", $f); return; } $UFDBGUARD_UNLOCK_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_UNLOCK_LINK"]; $unlock_web_site_text = "{unlock_web_site}"; if ($UFDBGUARD_UNLOCK_LINK != null) { $unlock_web_site_text = $UFDBGUARD_UNLOCK_LINK; } $f[] = parseTemplate_headers($unlock_web_site_text, null, $SquidGuardIPWeb); $f[] = " <h2>{$unlock_web_site_text} {$FinalHost} {for} {$IPADDR} {$_REQUEST["clientname"]}</h2>"; if ($error != null) { $f[] = " <h2>{$error}</h2>"; } $f[] = " <div id=\"info\">"; $f[] = "<p style='margin-bottom:30px'>{$UnbblockText2}</p>"; $f[] = "<form id='unlockform' action=\"{$SquidGuardIPWeb}\" method=\"post\">\n\t<input type='hidden' id='unlock-www' name='unlock-www' value='yes'>\n\t<input type='hidden' id='finalhost' name='finalhost' value='{$FinalHost}'>\n\t<input type='hidden' id='ipaddr' name='ipaddr' value='{$IPADDR}'>\n\t<input type='hidden' id='serialize' name='serialize' value='{$_REQUEST["serialize"]}'>\n\t<input type='hidden' id='url' name='url' value='{$url}'>"; $f[] = "<input type='hidden' id='username' name='username' value='{$_REQUEST["clientname"]}'>"; if ($UfdbGuardHTTPAllowNoCreds == 1) { $f[] = "<input type='hidden' id='username' name='username' value='{$_REQUEST["clientname"]}'>"; $f[] = "<input type='hidden' id='password' name='password' value='{$_REQUEST["password"]}'>"; } $f[] = "<table width='100%;'>"; if ($UfdbGuardHTTPAllowNoCreds == 0) { $f[] = " <tr>\n\t\t\t\t<td class=\"info_title\">{username}:</td>\n\t\t\t\t<td class=\"info_content\">" . Field_text("username", $_REQUEST["username"], "{$fontfamily};width:80%;font-size:35px;padding:5px") . "</td>\n\t\t\t</tr> \n\t\t\t<tr>\n\t\t\t\t<td class=\"info_title\">{password}:</td>\n\t\t\t\t<td class=\"info_content\">" . Field_password("nolock:password", $_REQUEST["password"], "{$fontfamily};width:80%;font-size:35px;padding:5px", null, null, null, false, "CheckTheForm(event)") . "</td>\n\t\t\t</tr>"; } $f[] = " <tr><td colspan=2 align='right'><hr>" . button("{submit}", "document.forms['unlockform'].submit();") . "</td></tr>\n\t</table>\n\t</form>\n\t<script>\n\tfunction CheckTheForm(e){\n\t\tif(!checkEnter(e)){return;}\n\t\tdocument.forms['unlockform'].submit();\n\t\t}\n\t\t\t\n\t</script>\t\t\n\t"; $f[] = " </div> {$FOOTER}"; $f[] = "</div>"; $f[] = "</body>"; $f[] = "</html>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body(@implode("\n", $f)); }
function parseTemplate_ticket($error = null) { include_once dirname(__FILE__) . "/ressources/class.sockets.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php"; include_once dirname(__FILE__) . "/ressources/class.tcpip.inc"; $sock = new sockets(); $ARRAY = unserialize(base64_decode($_REQUEST["serialize"])); $sock->BuildTemplatesConfig($ARRAY); $SquidGuardIPWeb = null; $url = $_REQUEST["url"]; $IPADDR = $_REQUEST["ipaddr"]; if (isset($_GET["SquidGuardIPWeb"])) { $SquidGuardIPWeb = $_GET["SquidGuardIPWeb"]; } if ($SquidGuardIPWeb == null) { $SquidGuardIPWeb = CurrentPageName(); } if ($GLOBALS["VERBOSE"]) { echo "<H1>SquidGuardIPWeb={$SquidGuardIPWeb}</H1>"; } $UfdbGuardHTTPAllowNoCreds = intval($sock->GET_INFO("UfdbGuardHTTPAllowNoCreds")); $q = new mysql_squid_builder(); $parse_url = parse_url($url); $host = $parse_url["host"]; if (preg_match("#(.+?):[0-9]+#", $host, $re)) { $host = $re[1]; } $FinalHost = $q->GetFamilySites($host); if (!isset($GLOBALS["UfdbGuardHTTP"]["FOOTER"])) { $GLOBALS["UfdbGuardHTTP"]["FOOTER"] = null; } $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"]; $ticket_web_site_text = "{submit_a_ticket}"; $UFDBGUARD_TICKET_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_UNLOCK_LINK"]; if ($UFDBGUARD_TICKET_LINK != null) { $ticket_web_site_text = $UFDBGUARD_TICKET_LINK; } $f[] = parseTemplate_headers("{$UFDBGUARD_TICKET_LINK}", null, $SquidGuardIPWeb); $f[] = $f[] = "<form id='unlockform' action=\"{$SquidGuardIPWeb}\" method=\"post\">\n\t<input type='hidden' id='unlock-ticket' name='unlock-ticket' value='yes'>\n\t<input type='hidden' id='finalhost' name='finalhost' value='{$FinalHost}'>\n\t<input type='hidden' id='ipaddr' name='ipaddr' value='{$IPADDR}'>\n\t<input type='hidden' id='SquidGuardIPWeb' name='SquidGuardIPWeb' value='{$SquidGuardIPWeb}'>\n\t<input type='hidden' id='serialize' name='serialize' value='{$_REQUEST["serialize"]}'>\n\t<input type='hidden' id='url' name='url' value='{$url}'>"; $f[] = "<input type='hidden' id='username' name='username' value='{$_REQUEST["clientname"]}'>"; $f[] = "<script>\t"; $f[] = "function CheckTheForm(){\t"; $f[] = "document.forms['unlockform'].submit();"; $f[] = "}\t"; $f[] = "CheckTheForm();"; $f[] = "</script>\t"; $f[] = "</body>"; $f[] = "</html>"; echo @implode("\n", $f); }