本文整理汇总了PHP中mysql_squid_builder::GetFamilySites方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::GetFamilySites方法的具体用法?PHP mysql_squid_builder::GetFamilySites怎么用?PHP mysql_squid_builder::GetFamilySites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::GetFamilySites方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tabs
function tabs()
{
$tpl = new templates();
$page = CurrentPageName();
$q = new mysql_squid_builder();
$familysite = $q->GetFamilySites($_GET["sitename"]);
$_GET["xtime"] = strtotime("{$_GET["day"]} 00:00:00");
if (is_numeric($_GET["xtime"])) {
$dateT = " " . date("{l} {F} d", $_GET["xtime"]);
if ($tpl->language == "fr") {
$dateT = date("{l} d {F} ", $_GET["xtime"]);
}
}
$tablesource = "dansguardian_events_" . date("Ymd", $_GET["xtime"]);
$array["popup"] = "{status} {$dateT}";
if ($q->TABLE_EXISTS($tablesource)) {
$array["uris"] = "{urls}";
}
while (list($num, $ligne) = each($array)) {
$html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&field={$_GET["field"]}&value=" . urlencode($_GET["value"]) . "&familysite={$_GET["familysite"]}&day={$_GET["day"]}\"><span style='font-size:14px'>{$ligne}</span></a></li>\n");
}
echo "\n\t<div id=main_config_zoomwebsiteAndUser>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#main_config_zoomwebsiteAndUser').tabs();\n\t\t\n\t\t\n\t\t\t});\n\t\t</script>";
}
示例2: popup
function popup()
{
$tpl = new templates();
$tpl = new templates();
$q = new mysql_squid_builder();
$t = time();
$sql = "SELECT category FROM personal_categories ORDER BY category";
$results = $q->QUERY_SQL($sql);
$CountDecat = mysql_num_rows($results);
$array[null] = "{select}";
while ($ligne = mysql_fetch_assoc($results)) {
$array[$ligne["category"]] = $ligne["category"];
}
$familysite = $q->GetFamilySites($_GET["www-popup"]);
$html = "<div style='font-size:26px;margin-bottom:15px'>{$_GET["www-popup"]}</div>\n\t\n\t<div style='width:98%' class=form>\n\t<table style='width:99%'>\n\t\t<tr>\n\t\t\t<td><strong style='font-size:16px'>{unblock}: {$_GET["www-popup"]}</strong></td>\n\t\t\t<td> </td>\n\t\t\t<td width=1% nowrap>" . button("Go", "Save{$t}('{$_GET["www-popup"]}')", 16) . "</td>\n\t\t</tR>\n\t";
if ($familysite != $_GET["www-popup"]) {
$html = $html . "<tr><td colspan=2> </td></tr>\n\t\t<tr>\n\t\t\t<td><strong style='font-size:16px'>{or} {unblock}: {$familysite}</strong></td>\n\t\t\t<td> </td>\n\t\t\t<td width=1% nowrap>" . button("Go", "Save{$t}('{$familysite}')", 16) . "</td>\n\t\t</tR>";
}
if ($CountDecat > 0) {
$html = $html . "\n\t\t\t<tr>\n\t\t\t<td><strong style='font-size:16px'>{or} {move_to_category}:</strong></td>\n\t\t\t<td>" . Field_array_Hash($array, "categories-{$t}", null, "style:font-size:16px") . "</td>\n\t\t\t<td width=1% nowrap>" . button("Go", "Move{$t}('{$familysite}')", 16) . "</td>\n\t\t\t</tR>\n";
}
$html = $html . "\t\n</table>\t\t\n</div>\n<script>\nfunction xSave{$t}(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tYahooWinBrowseHide();\n\tLoadjs('squid.compile.whiteblack.progress.php?ask=yes');\n\t\n}\t\t\t\n\t\t\t\nfunction Save{$t}(www){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('whitelist-single',www);\n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',xSave{$t});\t\n}\nfunction xMove{$t}(obj){\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tvar category=document.getElementById('categories-{$t}').value;\n\tYahooWinBrowseHide();\n\tLoadjs('ufdbguard.compile.category.php?category='+category);\n\t\n}\t\n\nfunction Move{$t}(www){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('textToParseCats',www);\n\tXHR.appendData('category',document.getElementById('categories-{$t}').value);\n\tXHR.appendData('ForceCat',1);\n\tXHR.appendData('ForceExt',1);\n\tXHR.sendAndLoad('squid.visited.php', 'POST',xMove{$t});\t\n}\n\n\n\n</script>\n";
echo $tpl->_ENGINE_parse_body($html);
}
示例3: visited_list
function visited_list()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql_squid_builder();
$family = $q->GetFamilySites($_GET["www"]);
$search = '%';
$table = "visited_sites";
$page = 1;
$COUNT_ROWS = $q->COUNT_ROWS($table);
$FORCE_FILTER = "familysite='{$family}'";
if ($COUNT_ROWS == 0) {
json_error_show("No data...");
}
if (isset($_POST["sortname"])) {
if ($_POST["sortname"] != null) {
$ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
}
}
if (isset($_POST['page'])) {
$page = $_POST['page'];
}
$_POST["query"] = trim($_POST["query"]);
if ($_POST["query"] != null) {
$_POST["query"] = "*{$_POST["query"]}*";
$_POST["query"] = str_replace("**", "*", $_POST["query"]);
$_POST["query"] = str_replace("**", "*", $_POST["query"]);
$_POST["query"] = str_replace("*", "%", $_POST["query"]);
$search = $_POST["query"];
$searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
$sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}";
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$total = $ligne["TCOUNT"];
} else {
$sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER}";
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
$sql = "SELECT * FROM `{$table}` WHERE {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
$results = $q->QUERY_SQL($sql);
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if (mysql_num_rows($results) == 0) {
$data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", ""));
}
while ($ligne = mysql_fetch_assoc($results)) {
$categories = $q->GET_CATEGORIES($ligne['sitename']);
$FamilySite = $q->GetFamilySites($ligne['sitename']);
$categorize = imgtootltip("add-database-32.png", $ligne['sitename'], "javascript:Loadjs('squid.categorize.php?www={$ligne['sitename']}&day={$_GET["day"]}&week={$_GET["week"]}&month={$_GET["month"]}');");
$thumbs = $q->GET_THUMBNAIL($ligne['sitename'], 48);
$ahref = "Loadjs('squid.traffic.statistics.days.php?today-zoom=yes&type=req&familysite={$FamilySite}&day={$_GET["day"]}')";
$data['rows'][] = array('id' => $ligne['sitename'], 'cell' => array($thumbs, "<div style='margin-top:10px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$ahref}\" style='font-size:14px;text-decoration:underline'>{$ligne['sitename']}</a></div>", "<div style='font-size:14px;margin-top:10px'>{$categories}</span>", $categorize));
}
echo json_encode($data);
}
示例4: parseTemplate_unlock
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"]}'>";
//.........这里部分代码省略.........
示例5: WordScanners
function WordScanners()
{
if (isset($GLOBALS["WordScanners_executed"])) {
return;
}
$GLOBALS["WordScanners_executed"] = true;
$workdir = "/var/log/artica-postfix/searchwords";
@mkdir($workdir, 0755, true);
if ($GLOBALS["VERBOSE"]) {
echo "Open {$workdir}\n";
}
$handle = opendir($workdir);
if (!$handle) {
if ($GLOBALS["VERBOSE"]) {
echo "Fatal unable to opendir {$workdir}\n";
}
events("Fatal unable to opendir {$workdir}", __FUNCTION__, __FILE__, __LINE__);
return;
}
if ($GLOBALS["VERBOSE"]) {
events("WordScanners(" . __LINE__ . "):Open {$workdir} done.. instanciate mysql_squid_builder()");
}
$q = new mysql_squid_builder();
if ($GLOBALS["VERBOSE"]) {
events("WordScanners(" . __LINE__ . "):Start looping()");
}
$FF = array();
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$workdir}/{$filename}";
if ($GLOBALS["VERBOSE"]) {
echo "Scanning {$targetFile}\n";
}
$searchWords = unserialize(@file_get_contents($targetFile));
while (list($key, $val) = each($searchWords)) {
$searchWords[$key] = addslashes(str_replace("'", "`", $val));
}
$zmd5 = md5(serialize($searchWords));
$ipaddr = $searchWords["ipaddr"];
$date = $searchWords["date"];
$Time = strtotime($date);
$uid = $searchWords["uid"];
if (strlen($uid) < 3) {
$uid = null;
}
$mac = trim($searchWords["mac"]);
if ($mac == null) {
$mac = GetMacFromIP($ipaddr);
}
$hostname = $searchWords["hostname"];
$words = $searchWords["WORDS"];
if (trim($words) == null) {
@unlink($targetFile);
continue;
}
$sitename = $searchWords["SITENAME"];
$sitename = addslashes($sitename);
if (!isset($GLOBALS["familysite"][$sitename])) {
$GLOBALS["familysite"][$sitename] = $q->GetFamilySites($sitename);
}
$familysite = $GLOBALS["familysite"][$sitename];
if ($mac != null) {
if ($uid == null) {
$uid = $q->UID_FROM_MAC($mac);
}
}
if ($ipaddr != null) {
if ($uid == null) {
$uid = $q->UID_FROM_IP($ipaddr);
}
}
$FF[date("Ymdh", $Time)][] = "('{$zmd5}','{$sitename}','{$date}','{$ipaddr}','{$hostname}','{$uid}','{$mac}','0','{$familysite}','{$words}')";
@unlink($targetFile);
}
events("WordScanners(" . __LINE__ . "): End looping...\n");
$q = new mysql_squid_builder();
while (list($tablePrefix, $f) = each($FF)) {
if (count($f) > 0) {
if ($q->check_SearchWords_hour($tablePrefix)) {
$tablename = "searchwords_{$tablePrefix}";
$prefix = "INSERT IGNORE INTO {$tablename} (`zmd5`,`sitename`,`zDate`,`ipaddr`,`hostname`,`uid`,`MAC`,`account`,`familysite`,`words`) VALUES " . @implode(",", $f);
$q->QUERY_SQL($prefix);
if (!$q->ok) {
writelogs_squid("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats");
@mkdir("/var/log/artica-postfix/searchwords-sql-errors", 0755, true);
@file_put_contents("/var/log/artica-postfix/searchwords-sql-errors/" . md5($prefix), $prefix);
}
}
}
}
}
示例6: thumbnail
function thumbnail($zmd5 = null)
{
$sitename = $_GET["thumbnail"];
$width = $_GET["width"];
$q = new mysql_squid_builder();
$familySite = $q->GetFamilySites($sitename);
$md = md5($sitename);
$md_family = md5($familySite);
if ($zmd5 != null) {
$md = $zmd5;
}
if (isset($_GET["zmd5"])) {
$md = $_GET["zmd5"];
}
if (!is_numeric($width)) {
$width = 400;
}
$imagepath = "ressources/logs/thumbnails.{$md}.{$width}.gif";
$imageSourcePath = "ressources/logs/thumbnails.{$md}.400.gif";
if ($GLOBALS["VERBOSE"]) {
echo "<H1>VERBOSES {$sitename}/{$familySite} - {$md} -</H1>";
if (is_file($imageSourcePath)) {
echo "<li>{$md} {$imageSourcePath} exists on disk</li>";
echo "<li>{$imageSourcePath} file_md5=" . md5_file($imageSourcePath) . "</li>";
}
}
$badThumbs["ee1e683b39c902e5ee69fadcff54b6b9"] = true;
$badThumbs["45ec39db5951e8e11be11f5148bd707a"] = true;
if (is_file($imageSourcePath)) {
$md5_file = md5_file($imageSourcePath);
}
if ($badThumbs[$md5_file]) {
if ($GLOBALS["VERBOSE"]) {
echo "<li style=color:#d32d2d>Deleting {$md}</li>";
}
@unlink($imageSourcePath);
@unlink($imagepath);
$q->QUERY_SQL("DELETE FROM webfilters_thumbnails WHERE zmd5='{$md}'");
$q->QUERY_SQL("DELETE FROM webfilters_thumbnails WHERE LinkTo='{$md}'");
}
if (is_file($imagepath)) {
if (!$GLOBALS["VERBOSE"]) {
header("Content-type: image/gif");
ob_clean();
flush();
readfile($imagepath);
}
return;
} else {
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$imagepath} no such file</li>";
}
}
if (!is_file($imageSourcePath)) {
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT savedate,filemd5,picture,LinkTo FROM webfilters_thumbnails WHERE zmd5='{$md}'"));
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$md} LinkTo={$ligne["LinkTo"]} - " . strlen($ligne["picture"]) . " bytes</li>";
}
if (trim($ligne["LinkTo"]) != null) {
thumbnail($ligne["LinkTo"]);
return;
}
if ($ligne["picture"] == null) {
if ($md_family != $md) {
thumbnail($md_family);
return;
}
}
if ($ligne["picture"] != null) {
@file_put_contents($imageSourcePath, $ligne["picture"]);
}
} else {
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$md} {$imageSourcePath} exists on disk</li>";
}
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$imageSourcePath} file_md5=" . md5_file($imageSourcePath) . "</li>";
}
}
if (is_file($imageSourcePath)) {
if ($width < 400) {
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$md} ->SimpleImage({$imageSourcePath})</li>";
}
$image = new SimpleImage();
$image->load($imageSourcePath);
if ($GLOBALS["VERBOSE"]) {
echo "<li>{$md} ->resize({$width},{$width})</li>";
}
$image->resize($width, $width);
$image->save($imagepath);
if (!$GLOBALS["VERBOSE"]) {
header("Content-type: image/gif");
ob_clean();
flush();
readfile($imagepath);
}
return;
}
if (!$GLOBALS["VERBOSE"]) {
//.........这里部分代码省略.........
示例7: trim
$c++;
$pattern = trim(fgets($handle, 4096));
if ($pattern == null) {
continue;
}
if (strpos($pattern, "NONE/400") > 0) {
continue;
}
if (!preg_match("#^([0-9\\.]+)\\s+([0-9]+)\\s+([0-9\\.]+)\\s+([A-Z\\/0-9_]+)\\s+([0-9]+)\\s+([A-Z]+)\\s+(.*?)\\s+(.*?)\\s+([A-Z]+)#", $pattern, $re)) {
echo "*** `{$pattern}` ****\n";
continue;
}
$time = $re[1];
$xdate = date("Y-m-d H:i:s", $time);
$times = $re[2];
$ipaddr = $re[3];
$Code = $re[4];
$Size = $re[5];
$PROTO = $re[6];
$URI = $re[7];
$user = trim(strtolower($re[8]));
if ($user_req != $user) {
continue;
}
$arrayURI = parse_url($URI);
$hostname = $arrayURI["host"];
$familysite = $q->GetFamilySites($hostname);
@fwrite($d, "\"{$xdate}\";\"{$URI}\",\"{$familysite}\",\"{$Size}\",\"{$user}\"\n");
}
@fclose($d);
@fclose($handle);
示例8: ParseSubDir
function ParseSubDir($dir)
{
$unix = new unix();
$q = new mysql_squid_builder();
$countDefile = $unix->COUNT_FILES($dir);
events("{$dir} -> {$countDefile} files on Line: ", __LINE__);
if ($countDefile == 0) {
events("ParseSubDir():: {$dir}: no files... remove... ", __LINE__);
@rmdir($dir);
return;
}
$FINAL = array();
if (!($handle = opendir($dir))) {
events("ParseSubDir():: Fatal: {$dir} no such directory", __LINE__);
return;
}
$DUSTBIN["mx.yahoo.com"] = true;
$DUSTBIN["row.bc.yahoo.com"] = true;
$DUSTBIN["us.bc.yahoo.com"] = true;
$DUSTBIN["xiti.com"] = true;
$c = 0;
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$dir}/{$filename}";
$arrayFile = unserialize(@file_get_contents($targetFile));
if (!is_array($arrayFile)) {
@unlink($targetFile);
continue;
}
if ($GLOBALS["VERBOSE"]) {
echo "{$targetFile}\n";
}
while (list($index, $array) = each($arrayFile)) {
$words = mysql_escape_string2(trim($array["WORDS"]));
if ($words == null) {
continue;
}
$sitename = $array["SITENAME"];
$familysite = $q->GetFamilySites($sitename);
if (isset($DUSTBIN[$sitename])) {
continue;
}
if (isset($DUSTBIN[$familysite])) {
continue;
}
$ipaddr = $array["ipaddr"];
$zDate = $array["date"];
$uid = mysql_escape_string2($array["uid"]);
$MAC = mysql_escape_string2($array["mac"]);
$hostname = mysql_escape_string2($array["hostname"]);
$time = strtotime($zDate);
$prefix = date("YmdH", $time);
$zmd5 = md5(serialize($array));
$account = 0;
$line = "('{$zmd5}','{$sitename}','{$zDate}','{$ipaddr}','{$hostname}','{$uid}','{$MAC}','{$account}','{$familysite}','{$words}')";
if ($GLOBALS["VERBOSE"]) {
echo "{$prefix} -> {$line}\n";
}
$f[$prefix][] = $line;
}
@unlink($targetFile);
}
if (count($f) > 0) {
inject_array($f);
}
}
示例9: today_zoom_popup_history_list
function today_zoom_popup_history_list(){
$Mypage=CurrentPageName();
$tpl=new templates();
$q=new mysql_squid_builder();
$t=time();
$fontsize=13;
$type=$_GET["type"];
$field_query="size";
$field_query2="SUM(size)";
$table_field="{size}";
$category=$tpl->_ENGINE_parse_body("{category}");
if($_GET["day"]==date('Y-m-d')){$_GET["day"]=$q->HIER();}
$hour_table=date('Ymd',strtotime($_GET["day"]))."_hour";
$member=$tpl->_ENGINE_parse_body("{member}");
$sitename=$tpl->_ENGINE_parse_body("{website}");
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}}
if (isset($_POST['page'])) {$page = $_POST['page'];}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
if($type=="req"){
$field_query="hits";
$field_query2="SUM(hits)";
$table_field="{hits}";
}
$table="(SELECT $field_query2 as thits, uid,client,MAC,sitename,category,familysite FROM $hour_table
GROUP BY uid,client,sitename,MAC,category,familysite HAVING familysite='{$_GET["familysite"]}' ) as t";
$searchstring=string_to_flexquery();
if($searchstring<>null){
$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $searchstring";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
}else{
$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"]+1;
}
$sql="SELECT * FROM $table WHERE 1 $searchstring $ORDER $limitSql";
$results=$q->QUERY_SQL($sql);
$data = array();
$data['page'] = 0;
$data['total'] = $total;
$data['rows'] = array();
if(!$q->ok){json_error_show($q->mysql_error);};
if(mysql_num_rows($results)==0){json_error_show("No data");}
$data['total'] = mysql_num_rows($results);
$style="style='font-size:{$fontsize}px'";
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if($type<>"req"){$ligne["thits"]=FormatBytes($ligne["thits"]/1024);}
$categorize="Loadjs('squid.categorize.php?www={$ligne["sitename"]}')";
if(trim($ligne["category"])==null){$ligne["category"]="<span style='color:#D70707'>{categorize_this_website}</span>";}
$id=md5(@implode("", $ligne));
if(trim($ligne["uid"])=="-"){$ligne["uid"]=null;}
if(trim($ligne["uid"])==null){$ligne["uid"]=$q->UID_FROM_MAC($ligne["MAC"]);}
$categorize="<a href=\"javascript:blur()\"
OnClick=\"javascript:$categorize\"
style='font-size:{$fontsize}px;text-decoration:underline'>";
$familysite=$q->GetFamilySites($ligne["sitename"]);
$TrafficHour="<a href=\"javascript:blur()\"
OnClick=\"javascript:Loadjs('squid.traffic.statistics.hours.php?familysite={$ligne["sitename"]}&day={$_GET["day"]}')\"
style='font-size:{$fontsize}px;text-decoration:underline'>";
$data['rows'][] = array(
'id' => $id,
'cell' => array(
"<span $style>{$ligne["uid"]}</span>",
"<span $style>{$ligne["MAC"]}</span>",
"<span $style>{$ligne["client"]}</span>",
"<span $style>$TrafficHour{$ligne["sitename"]}</a></span>",
"<span $style>{$ligne["thits"]}</span>",
"<span $style>$categorize{$ligne["category"]}</a></span>"
//.........这里部分代码省略.........
示例10: proxypac
function proxypac()
{
include_once 'ressources/class.proxypac.inc';
include_once 'ressources/class.templates.inc';
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.user.inc';
include_once 'ressources/class.langages.inc';
include_once 'ressources/class.sockets.inc';
include_once 'ressources/class.mysql.inc';
include_once 'ressources/class.privileges.inc';
include_once 'ressources/class.squid.inc';
$hostname = $_SERVER["REMOTE_ADDR"];
$md5 = $_GET["proxypac"];
$sql = "SELECT userid,email,ProxyPacCompiled,ProxyPacDatas FROM usersisp WHERE zmd5='{$md5}' AND enabled=0";
error_log("[{$_SESSION["uid"]}]::{$hostname}: {$ligne["email"]}" . __FUNCTION__ . " file " . basename(__FILE__) . " line " . __LINE__);
$q = new mysql_squid_builder();
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql));
$sock = new sockets();
$Array = unserialize(base64_decode($ligne["ProxyPacDatas"]));
if ($ligne["ProxyPacCompiled"] == null) {
$defaultDomain = $q->GetFamilySites($_SERVER["SERVER_NAME"]);
$Array["localHostOrDomainIs"][] = "dnsDomainIs:{$defaultDomain}";
if (!is_array($Array["PROXYS"])) {
$Array["PROXYS"] = array();
}
$squid = new squidbee();
$SquidISPProxyServerAddress = $sock->GET_INFO("SquidISPProxyServerAddress");
if ($SquidISPProxyServerAddress == null) {
$SquidISPProxyServerAddress = $sock->GET_INFO("SquidBinIpaddr");
}
$SquidISPProxyServerAddress = $SquidISPProxyServerAddress . ":" . $squid->listen_port;
array_unshift($Array["PROXYS"], $SquidISPProxyServerAddress);
$ppac = new proxypacrules($Array);
$ppacFinal = $ppac->ProxyPacFinal;
$sql = "UPDATE usersisp SET ProxyPacCompiled='" . addslashes($ppacFinal) . "' WHERE zmd5='{$md5}'";
$q = new mysql_squid_builder();
$q->QUERY_SQL($sql);
} else {
$ppacFinal = $ligne["ProxyPacCompiled"];
}
header("Content-type: application/x-ns-proxy-autoconfig");
header('Content-Disposition: attachment; filename="proxy.pac"');
header("Date: " . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
header("Last-Modified: " . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
header("Expires: " . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 60 * 30));
echo $ppacFinal;
}
示例11: graphs
function graphs()
{
include_once 'ressources/class.artica.graphs.inc';
$q = new mysql_squid_builder();
$page = CurrentPageName();
$tpl = new templates();
$t = $_GET["t"];
$ff = time();
$graph1 = null;
$graph2 = null;
$day = $_GET["day"];
$ttime = strtotime("{$day} 00:00:00");
$table = date("Ymd", $ttime) . "_hour";
$familysite = $_GET["familysite"];
if ($familysite != null) {
$familysite2 = $q->GetFamilySites($familysite);
}
$F = array();
if ($_GET["filterby"] != null) {
$OP = "=";
$field_site0 = "`{$_GET["filterby"]}`,";
if ($_GET["filterby"] == "ipaddr") {
$_GET["filterby"] = "client";
$field_site0 = "`client`,";
}
$titleadd = " »{$_GET["filterby"]} »{$_GET["filterdata"]} »";
if (strpos(" {$_GET["filterdata"]}", "*") > 0) {
$OP = " LIKE ";
$_GET["filterdata"] = str_replace("*", "%", $_GET["filterdata"]);
}
$display = null;
$F[] = "AND {$_GET["filterby"]}{$OP}'{$_GET["filterdata"]}'";
}
if ($familysite != null) {
if ($familysite2 == $familysite) {
$field_site = "familysite,";
$F[] = "AND familysite ='{$familysite}'";
} else {
$field_site = "sitename,";
$F[] = "AND sitename ='{$familysite}'";
}
}
if (count($F) > 0) {
$HAVING = "HAVING thits>0 " . @implode(" ", $F);
}
$sql = "SELECT SUM(hits) as thits, {$field_site}{$field_site0} `hour` FROM `{$table}` GROUP BY {$field_site}{$field_site0},`hour` {$HAVING} ORDER BY `hour`";
$sql = str_replace(", ,", ",", $sql);
$sql = str_replace(",,", ",", $sql);
$unknown = $tpl->_ENGINE_parse_body("{unknown}");
$c = 0;
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
}
if (mysql_num_rows($results) > 1) {
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$ydata[] = $ligne["thits"];
$xdata[] = $ligne["hour"];
$c++;
}
$t = time();
$targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . ".{$sql}.1{$tablename}") . ".png";
$gp = new artica_graphs();
$gp->width = 900;
$gp->height = 350;
$gp->filename = "{$targetedfile}";
$gp->xdata = $xdata;
$gp->ydata = $ydata;
$gp->y_title = null;
$gp->x_title = $tpl->_ENGINE_parse_body("{hits}/{hours}");
$gp->title = null;
$gp->margin0 = true;
$gp->Fillcolor = "blue@0.9";
$gp->color = "146497";
$gp->line_green();
if (is_file("{$targetedfile}")) {
$graph1 = "\n\t\t\t\t<center style='font-size:18px;margin:10px'>{$gp->x_title}</center>\n\t\t\t\t<img src='{$targetedfile}'>";
} else {
$graph1 = "{$targetedfile} no such file<hr>{$sql}<hr>";
}
} else {
$graph1 = $tpl->_ENGINE_parse_body("{only_one_value_no_graph}<hr><span style='font-size:11px'>{$sql}</span>");
}
$xdata = array();
$ydata = array();
$sql = "SELECT SUM(size) as thits, {$field_site}{$field_site0} `hour` FROM `{$table}` GROUP BY {$field_site}{$field_site0},`hour` {$HAVING} ORDER BY `hour`";
$sql = str_replace(", ,", ",", $sql);
$sql = str_replace(",,", ",", $sql);
$unknown = $tpl->_ENGINE_parse_body("{unknown}");
$c = 0;
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
}
if (mysql_num_rows($results) > 1) {
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$ydata[] = $ligne["thits"];
$xdata[] = $ligne["hour"];
$c++;
}
//.........这里部分代码省略.........
示例12: parseTemplate_ticket
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);
}
示例13: _repair_from_sources_tables
function _repair_from_sources_tables($sourcetable, $daytable)
{
percentage("Repair {$daytable} FROM {$sourcetable}", 2);
//zMD5 | sitename | familysite | client | hostname | account | hour | remote_ip | MAC | country | size | hits | uid | category | cached
$f = array();
$sql = "SELECT HOUR(zDate) as `hour`,SUM(QuerySize) as size, SUM(hits) as hits, \n\tsitename,uid,CLIENT,hostname,MAC,account,cached FROM {$sourcetable} \n\tGROUP BY `hour`,sitename,uid,CLIENT,hostname,MAC,account,cached";
$prefix = "INSERT IGNORE INTO {$daytable} \n\t(`zMD5`,`sitename`,`familysite`,`client`,`hostname`,`uid`,`account`,`hour`,`MAC`,`size`,`hits`) VALUES";
$q = new mysql_squid_builder();
$results = $q->QUERY_SQL($sql);
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$zMD5 = md5(serialize($ligne));
$familysite = $q->GetFamilySites($ligne["sitename"]);
while (list($key, $val) = each($ligne)) {
$ligne[$key] = mysql_escape_string2($val);
}
$f[] = "('{$zMD5}','{$ligne["sitename"]}','{$familysite}','{$ligne["CLIENT"]}','{$ligne["hostname"]}','{$ligne["uid"]}','{$ligne["account"]}','{$ligne["hour"]}','{$ligne["MAC"]}','{$ligne["size"]}','{$ligne["hits"]}')";
if (count($f) > 0) {
$q->QUERY_SQL($prefix . @implode(",", $f));
$f = array();
}
}
if (count($f) > 0) {
$q->QUERY_SQL($prefix . @implode(",", $f));
$f = array();
}
$sql = "SELECT COUNT(`sitename`) as tcount FROM {$daytable} WHERE LENGTH(`category`)=0";
if ($GLOBALS["VERBOSE"]) {
echo $sql . "\n";
}
$ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
$max = $ligne2["tcount"];
$sql = "UPDATE tables_day SET `not_categorized`={$max} WHERE tablename='{$sourcetable}'";
$q->QUERY_SQL($sql);
}
示例14: elephantlist_Redirected
function elephantlist_Redirected($data)
{
$CACHE = unserialize(@file_get_contents("/root/porn-cache.db"));
$q = new mysql_squid_builder();
if (preg_match_all("#elephantlist\\.com\\/tp\\/out\\.php\\?to=(.+?)&#is", $data, $re)) {
while (list($num, $ligne) = each($re[1])) {
$sitename = $ligne;
$familysite = $q->GetFamilySites($ligne);
if (!isset($CACHE[$sitename])) {
$q->categorize($sitename, "porn");
$CACHE[$sitename] = true;
}
if (!isset($CACHE[$familysite])) {
$q->categorize($familysite, "porn");
$CACHE[$familysite] = true;
}
$f[] = "http://{$sitename}";
}
} else {
echo "elephantlist_Redirected - nothing found\n";
return array();
}
@file_put_contents("/root/porn-cache.db", serialize($CACHE));
return $f;
}
示例15: today_zoom_popup_history_list
function today_zoom_popup_history_list(){
$Mypage=CurrentPageName();
$tpl=new templates();
$q=new mysql_squid_builder();
$t=time();
$fontsize=13;
$type=$_GET["type"];
$field_query="size";
$field_query2="SUM(size)";
$table_field="{size}";
$category=$tpl->_ENGINE_parse_body("{category}");
$hour_table=date('Ymd',strtotime($_GET["day"]))."_hour";
$member=$tpl->_ENGINE_parse_body("{member}");
$sitename=$tpl->_ENGINE_parse_body("{website}");
if($type=="req"){
$field_query="hits";
$field_query2="SUM(hits)";
$table_field="{hits}";
}
$sql="SELECT $field_query2 as thits, uid,client,MAC,sitename,category,familysite FROM $hour_table
GROUP BY uid,client,sitename,MAC,category,familysite HAVING familysite='{$_GET["familysite"]}' ORDER BY thits DESC LIMIT 0,100";
$results=$q->QUERY_SQL($sql);
$data = array();
$data['page'] = 0;
$data['total'] = $total;
$data['rows'] = array();
if(!$q->ok){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"$q->mysql_error", "",""));echo json_encode($data);return;}
if(mysql_num_rows($results)==0){array('id' => $ligne[time()],'cell' => array(null,"", "",""));echo json_encode($data);return;}
$data['total'] = mysql_num_rows($results);
$style="style='font-size:{$fontsize}px'";
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if($type<>"req"){$ligne["thits"]=FormatBytes($ligne["thits"]/1024);}
$categorize="Loadjs('squid.categorize.php?www={$ligne["sitename"]}')";
if(trim($ligne["category"])==null){$ligne["category"]="<span style='color:#D70707'>{categorize_this_website}</span>";}
$id=md5(@implode("", $ligne));
if(trim($ligne["uid"])=="-"){$ligne["uid"]=null;}
if(trim($ligne["uid"])==null){$ligne["uid"]=$q->UID_FROM_MAC($ligne["MAC"]);}
$categorize="<a href=\"javascript:blur()\"
OnClick=\"javascript:$categorize\"
style='font-size:{$fontsize}px;text-decoration:underline'>";
$familysite=$q->GetFamilySites($ligne["sitename"]);
$TrafficHour="<a href=\"javascript:blur()\"
OnClick=\"javascript:Loadjs('squid.traffic.statistics.hours.php?familysite={$ligne["sitename"]}&day={$_GET["day"]}')\"
style='font-size:{$fontsize}px;text-decoration:underline'>";
$data['rows'][] = array(
'id' => $id,
'cell' => array(
"<span $style>{$ligne["uid"]}</span>",
"<span $style>{$ligne["MAC"]}</span>",
"<span $style>{$ligne["client"]}</span>",
"<span $style>$TrafficHour{$ligne["sitename"]}</a></span>",
"<span $style>{$ligne["thits"]}</span>",
"<span $style>$categorize{$ligne["category"]}</a></span>"
)
);
}
echo json_encode($data);
}