Exemplo n.º 1
0
function parseTemplate_ticket_save()
{
    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";
    include_once dirname(__FILE__) . "/ressources/class.templates.inc";
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $ARRAY = unserialize(base64_decode($_REQUEST["serialize"]));
    $sock->BuildTemplatesConfig($ARRAY);
    $finalhost = $_POST["finalhost"];
    $IPADDR = $_REQUEST["ipaddr"];
    $user = $_REQUEST["username"];
    $SquidGuardIPWeb = $_REQUEST["SquidGuardIPWeb"];
    $familysite = $q->GetFamilySites($finalhost);
    $_RULE_K = $ARRAY["RULE"];
    $IPADDR = $ARRAY["IPADDR"];
    $targetgroup = $ARRAY["targetgroup"];
    $IpToUid = $ARRAY["IpToUid"];
    $URL = $ARRAY["URL"];
    $HOST = $ARRAY["HOST"];
    $members[] = $IPADDR;
    if ($HOST != null) {
        $members[] = $HOST;
    }
    if (trim($IpToUid) != null) {
        $members[] = $IpToUid;
    }
    if (count($members) > 0) {
        while (list($num, $ligne) = each($members)) {
            $AAAA[$ligne] = true;
        }
        $members = array();
        while (list($num, $ligne) = each($AAAA)) {
            $members[] = $num;
        }
    }
    $membersTX = @implode(", ", $members);
    if (!isset($GLOBALS["UfdbGuardHTTP"]["FOOTER"])) {
        $GLOBALS["UfdbGuardHTTP"]["FOOTER"] = null;
    }
    $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"];
    $notify_your_administrator = $tpl->_ENGINE_parse_body("{notify_your_administrator}");
    $ticket_web_site_text = "{submit_a_ticket}";
    $UFDBGUARD_TICKET_LINK = $GLOBALS["UfdbGuardHTTP"]["UFDBGUARD_UNLOCK_LINK"];
    $TICKET_TEXT_SUCCESS = $GLOBALS["UfdbGuardHTTP"]["TICKET_TEXT_SUCCESS"];
    if ($TICKET_TEXT_SUCCESS == null) {
        $TICKET_TEXT_SUCCESS = "{ufdb_ticket_text_success}";
    }
    if ($UFDBGUARD_TICKET_LINK != null) {
        $ticket_web_site_text = $UFDBGUARD_TICKET_LINK;
    }
    $cssform = "  -moz-border-radius: 5px;\n  border-radius: 5px;\n  border:1px solid #DDDDDD;\n  background:url(\"/img/gr-greybox.gif\") repeat-x scroll 0 0 #FBFBFA;\n  background:-moz-linear-gradient(center top , #F1F1F1 0px, #FFFFFF 45px) repeat scroll 0 0 transparent;\n  background: rgb(255,255,255); /* Old browsers */\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(47%,rgba(246,246,246,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* IE10+ */\n  background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */\n\t\t\t\t\t\t\n  margin:5px;padding:5px;\n  -webkit-border-radius: 5px;\n  -o-border-radius: 5px;\n -moz-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n -webkit-box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);\n box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);";
    $MAX = intval($GLOBALS["UfdbGuardHTTP"]["UnbblockMaxTime"]);
    $url = $_REQUEST["url"];
    $md5 = md5($finalhost . $IPADDR . $user);
    $q->QUERY_SQL("INSERT IGNORE INTO webfilters_usersasks (zmd5,ipaddr,sitename,uid) VALUES ('{$md5}','{$IPADDR}','{$familysite}','{$user}')");
    $function = __FUNCTION__;
    $file = basename(__FILE__);
    $line = __LINE__;
    $subject = "Unlock website ticket {$finalhost}/{$familysite} from {$user}/{$IPADDR}";
    $q = new mysql();
    $q->QUERY_SQL("INSERT IGNORE INTO `squid_admin_mysql`\n\t\t\t(`zDate`,`content`,`subject`,`function`,`filename`,`line`,`severity`,`hostname`) VALUES\n\t\t\t(NOW(),'','{$subject}','{$function}','{$file}','{$line}','1','{$_SERVER["SERVER_NAME"]}')", "artica_events");
    if (!$q->ok) {
        $redirect = null;
        $MAIN_BODY = "<center style='margin:20px;padding:20px;{$cssform};color:black;width:80%'>\n\t\t<H1>Oups!</H1><hr>" . $q->mysql_error_html() . "</center>";
    }
    $error = parseTemplate_sendemail_perform(null, $ARRAY, true, $SquidGuardIPWeb);
    $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"];
    $notify_your_administrator = $tpl->_ENGINE_parse_body("{notify_your_administrator}");
    $fontfamily = "font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};";
    $fontfamily = str_replace('"', "", $fontfamily);
    $f[] = parseTemplate_headers($ticket_web_site_text, null, $SquidGuardIPWeb);
    $f[] = "    <h2>{notify_your_administrator}</h2>";
    if ($error != null) {
        $f[] = "    <h2>{$error}</h2>";
    }
    $f[] = "<h3>{$TICKET_TEXT_SUCCESS}</h3>";
    $f[] = "<div id=\"info\" style='margin-top:20px'>";
    $f[] = "<form id='send-email-form' action=\"{$SquidGuardIPWeb}\" method=\"post\">";
    $f[] = "<table width='100%;'>";
    $f[] = "        <tr><td class=\"info_title\">{member}:</td><td class=\"info_content\">{$membersTX}</td></tr>";
    $f[] = "        <tr><td class=\"info_title\">{policy}:</td><td class=\"info_content\">{$_RULE_K}, {$targetgroup}</td></tr>";
    $f[] = "        <tr>";
    $f[] = "            <td class=\"info_title\" nowrap>{requested_uri}:</td>";
    $f[] = "            <td class=\"info_content\">";
    $f[] = "                <div class=\"break-word\">{$URL}</div>";
    $f[] = "            </td>";
    $f[] = "        </tr>";
    $f[] = "    </table>\n\t<p style='margin-top:50px'>&nbsp;</p>";
    $f[] = "\n\t</form>\n\t<script>\n\tfunction CheckTheForm(e){\n\t\tif(!checkEnter(e)){return;}\n\t\tdocument.forms['send-email-form'].submit();\n\t\t}\n\t\n\t</script>\n\t";
    $f[] = "</div>    {$FOOTER}";
    $f[] = "</div>";
    $f[] = "</body>";
    $f[] = "</html>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body(@implode("\n", $f));
}
Exemplo n.º 2
0
function parseTemplate_smtp_post()
{
    include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
    include_once dirname(__FILE__) . "/ressources/class.user.inc";
    include_once dirname(__FILE__) . "/ressources/class.external_acl_squid_ldap.inc";
    include_once dirname(__FILE__) . "/ressources/class.templates.inc";
    $tpl = new templates();
    $sock = new sockets();
    $ARRAY = unserialize(base64_decode($_POST["serialize"]));
    $sock->BuildTemplatesConfig($ARRAY);
    $serialize_array = $_POST["serialize"];
    $_RULE_K = $ARRAY["RULE"];
    $IPADDR = $ARRAY["IPADDR"];
    $targetgroup = $ARRAY["targetgroup"];
    $IpToUid = $ARRAY["IpToUid"];
    $URL = $ARRAY["URL"];
    $HOST = $ARRAY["HOST"];
    $members[] = $IPADDR;
    if ($HOST != null) {
        $members[] = $HOST;
    }
    if (trim($IpToUid) != null) {
        $members[] = $IpToUid;
    }
    if (count($members) > 0) {
        while (list($num, $ligne) = each($members)) {
            $AAAA[$ligne] = true;
        }
        $members = array();
        while (list($num, $ligne) = each($AAAA)) {
            $members[] = $num;
        }
    }
    $membersTX = @implode(", ", $members);
    $email = $_POST["email"];
    $SquidGuardIPWeb = $ARRAY["SquidGuardIPWeb"];
    $error = parseTemplate_sendemail_perform($email, $ARRAY);
    $FOOTER = $GLOBALS["UfdbGuardHTTP"]["FOOTER"];
    $notify_your_administrator = $tpl->_ENGINE_parse_body("{notify_your_administrator}");
    $fontfamily = "font-family: {$GLOBALS["UfdbGuardHTTP"]["Family"]};";
    $fontfamily = str_replace('"', "", $fontfamily);
    $f[] = parseTemplate_headers($notify_your_administrator, null, $SquidGuardIPWeb);
    $f[] = "    <h2>{notify_your_administrator}</h2>";
    if ($error != null) {
        $f[] = "    <h2>{$error}</h2>";
    }
    $f[] = "<div id=\"info\">";
    $f[] = "";
    $f[] = "<form id='send-email-form' action=\"{$SquidGuardIPWeb}\" method=\"post\">\n\t\t<input type='hidden' name='smtp-send-email' value='yes'>\n\t\t<input type='hidden' name='email' value='{$email}'>\n\t\t<input type='hidden' name='serialize' value='{$serialize_array}'>";
    $f[] = "<table width='100%;'>";
    $f[] = "        <tr><td class=\"info_title\">{member}:</td><td class=\"info_content\">{$membersTX}</td></tr>";
    $f[] = "        <tr><td class=\"info_title\">{policy}:</td><td class=\"info_content\">{$_RULE_K}, {$targetgroup}</td></tr>";
    $f[] = "        <tr>";
    $f[] = "            <td class=\"info_title\" nowrap>{requested_uri}:</td>";
    $f[] = "            <td class=\"info_content\">";
    $f[] = "                <div class=\"break-word\">{$URL}</div>";
    $f[] = "            </td>";
    $f[] = "        </tr>";
    $f[] = "    </table>\n\t<p style='margin-top:50px'>&nbsp;</p>";
    if ($email == null) {
        $f[] = "<table width='100%;'>";
        $f[] = "\n\t<tr>\n\t\t<td class=\"info_title\">{email}:</td>\n\t\t<td class=\"info_content\">" . Field_text("email", $_REQUEST["email"], "{$fontfamily};width:80%;font-size:35px;padding:5px", null, null, null, false, "CheckTheForm(event)") . "</td>\n\t</tr>\n\t";
        $f[] = " <tr><td colspan=2 align='right'><p style='margin-top:50px'>&nbsp;</p></td></tr>";
        $f[] = " <tr><td colspan=2 align='right'><hr>" . button("{submit}", "document.forms['send-email-form'].submit();") . "</td></tr>\n\t</table>";
    }
    $f[] = "\n\t</form>\n\t<script>\n\tfunction CheckTheForm(e){\n\t\tif(!checkEnter(e)){return;}\n\t\tdocument.forms['send-email-form'].submit();\n\t\t}\n\t\t\n\t</script>\n\t";
    $f[] = "</div>    {$FOOTER}";
    $f[] = "</div>";
    $f[] = "</body>";
    $f[] = "</html>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body(@implode("\n", $f));
}