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); }
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 TemplatesDesign($title, $content) { $title = utf8_decode($title); $content = utf8_decode($content); if (!isset($GLOBALS["CORP_LICENSE"])) { $users = new usersMenus(); $GLOBALS["CORP_LICENSE"] = $users->CORP_LICENSE; } $sock = new sockets(); $sock->BuildTemplatesConfig(); $UfdbGuardHTTPEnablePostmaster = 1; $SquidHTTPTemplateSmiley = $sock->GET_INFO("SquidHTTPTemplateSmiley"); if ($SquidHTTPTemplateSmiley == null) { $SquidHTTPTemplateSmiley = 2639; } if (!$GLOBALS["CORP_LICENSE"]) { $FOOTER = "\n\t\t<table style='width:75%;border-top:1px solid {$GLOBALS["UfdbGuardHTTP"]["FontColor"]};margin-top:15px'>\n\t\t<tr><td colspan=2> </td></tr>\n\t\t<tr>\n\t\t<td width=64px><img src='/squid-internal-static/icons/silk/logo-artica-64.png'></td>\n\t\t<td style='font-size:14px;padding-left:10px' width=99%>\n\t\tYou using Artica Proxy Appliance v{$GLOBALS["ARTICA_VERSION"]} in Community mode.<br>\n\t\t<i>Visit our <a href=\"http://artica-proxy.com\">website</a> for technical informations or to purchase an Entreprise Edition License</i>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>"; } $f[] = "<!DOCTYPE HTML>"; $f[] = "<html>"; $f[] = "<head>"; $f[] = "<title>{$title}</title>"; $f[] = "<script type=\"text/javascript\">"; $f[] = " function checkIfTopMostWindow()"; $f[] = " {"; $f[] = " if (window.top != window.self) "; $f[] = " { "; $f[] = " document.body.style.opacity = \"0.0\";"; $f[] = " document.body.style.background = \"#FFFFFF\";"; $f[] = " }"; $f[] = " else"; $f[] = " {"; $f[] = " document.body.style.opacity = \"1.0\";"; $f[] = " document.body.style.background = \"{$GLOBALS["UfdbGuardHTTP"]["BackgroundColor"]}\";"; $f[] = " } "; $f[] = " }"; $f[] = "</script>"; $f[] = "<style type=\"text/css\">"; $f[] = " body {"; $f[] = " color: {$GLOBALS["UfdbGuardHTTP"]["FontColor"]}; "; $f[] = " background-color: #FFFFFF; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]}; "; $f[] = " font-weight: lighter;"; $f[] = " font-size: 14pt; "; $f[] = " "; $f[] = " opacity: 0.0;"; $f[] = " transition: opacity 2s;"; $f[] = " -webkit-transition: opacity 2s;"; $f[] = " -moz-transition: opacity 2s;"; $f[] = " -o-transition: opacity 2s;"; $f[] = " -ms-transition: opacity 2s; "; $f[] = " }"; $f[] = " center {"; $f[] = " color: {$GLOBALS["UfdbGuardHTTP"]["FontColor"]}; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]}; "; $f[] = " font-weight: lighter;"; $f[] = " font-size: 12pt; "; $f[] = "}"; $f[] = " h1 {"; $f[] = " font-size: 72pt; "; $f[] = " margin-bottom: 0; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $f[] = " margin-top: 0 ;"; $f[] = " } "; $f[] = " h2 {"; $f[] = " font-size: 22pt; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]}; "; $f[] = " font-weight: lighter;"; $f[] = " } "; $f[] = " h3 {"; $f[] = " font-size: 18pt; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]}; "; $f[] = " font-weight: lighter;"; $f[] = " margin-bottom: 0 ;"; $f[] = " } "; $f[] = " #wrapper {"; $f[] = " width: 700px ;"; $f[] = " margin-left: auto ;"; $f[] = " margin-right: auto ;"; $f[] = " } "; $f[] = " #info {"; $f[] = " width: 600px ;"; $f[] = " margin-left: auto ;"; $f[] = " margin-right: auto ;"; $f[] = " } "; $f[] = " #titles h1 {"; $f[] = " font-size: 72pt; "; $f[] = " margin-bottom: 0; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $f[] = " margin-top: 0 ;"; $f[] = " } "; $f[] = "hr {\n border-top: 1px dotted #f00;\n color: #fff;\n background-color: #fff;\n height: 1px;\n width:50%;\n}\n"; $f[] = " #content p {"; $f[] = " font-size: 11pt; "; $f[] = " margin-bottom: 0; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $f[] = " margin-top: 0 ;"; $f[] = " } "; $f[] = " #footer p {"; $f[] = " font-size: 12pt; "; $f[] = " margin-bottom: 0; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $f[] = " margin-top: 0 ;"; $f[] = " } "; $f[] = " #data pre{"; $f[] = " font-size: 12pt; "; $f[] = " margin-bottom: 0; "; $f[] = " font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};"; $f[] = " font-weight: bold;"; $f[] = " margin-top: 0 ;"; $f[] = " } "; $f[] = " #data pre:before{content: \"\\275D\";margin-right:5px;font-size:22pt}"; $f[] = " #data pre:after{content: \"\\275E\";margin-left:5px;font-size:22pt}"; $f[] = ".bad{ font-size: 110px; float:left; margin-right:30px; }"; $f[] = ".bad:before{ content: \"\\{$SquidHTTPTemplateSmiley}\";}"; $f[] = " td.info_title { "; $f[] = " text-align: right;"; $f[] = " font-size: 12pt; "; $f[] = " min-width: 100px;"; $f[] = " }"; $f[] = " td.info_content {"; $f[] = " text-align: left;"; $f[] = " padding-left: 10pt ;"; $f[] = " font-size: 12pt; "; $f[] = " }"; $f[] = " .break-word {"; $f[] = " width: 500px;"; $f[] = " word-wrap: break-word;"; $f[] = " } "; $f[] = " a {"; $f[] = " text-decoration: underline;"; $f[] = " color: {$GLOBALS["UfdbGuardHTTP"]["FontColor"]}; "; $f[] = " }"; $f[] = " a:visited{"; $f[] = " text-decoration: underline;"; $f[] = " color: {$GLOBALS["UfdbGuardHTTP"]["FontColor"]}; "; $f[] = " }"; $f[] = "</style>"; $f[] = "</head>"; $f[] = "<body onLoad='checkIfTopMostWindow()'>"; $f[] = "<div id=\"wrapper\">"; $f[] = " <h1 class=bad></h1>"; $f[] = " <div id=\"info\">"; $f[] = "{$content}"; if ($GLOBALS["UfdbGuardHTTP"]["NoVersion"] == 0) { $f[] = "<center>Artica Proxy, version {$GLOBALS["ARTICA_VERSION"]}</center>"; } $f[] = " </div> {$FOOTER}"; $f[] = "</div>"; $f[] = "</body>"; $f[] = "<!-- "; $f[] = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $f[] = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $f[] = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $f[] = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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