本文整理汇总了PHP中mysql_squid_builder::TIME_FROM_HOUR_TABLE方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::TIME_FROM_HOUR_TABLE方法的具体用法?PHP mysql_squid_builder::TIME_FROM_HOUR_TABLE怎么用?PHP mysql_squid_builder::TIME_FROM_HOUR_TABLE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::TIME_FROM_HOUR_TABLE方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visited
function visited()
{
$q = new mysql_squid_builder();
$page = CurrentPageName();
$tpl = new templates();
$titleW = "{day}";
$t = time();
$websites = $tpl->_ENGINE_parse_body("{websites}");
$size = $tpl->_ENGINE_parse_body("{size}");
$hitsTitl = $tpl->_ENGINE_parse_body("{hits}");
if (preg_match("#^[0-9]+#", $_GET["table"])) {
$timeT = $q->TIME_FROM_HOUR_TABLE($_GET["table"]);
$DayTime = date("Y {l} {F} d", $timeT);
}
$TITLE_PAGE = "{$_GET["field"]}:{$_GET["user"]} {$titleW}";
if ($_GET["field"] == "MAC") {
$userText = $q->UID_FROM_MAC($_GET["user"]);
if ($userText != null) {
$TITLE_PAGE = "{$userText} ({$_GET["user"]})";
}
}
$html = "\n\t<table class='events-table-{$t}' style='display: none' id='events-table-{$t}' style='width:99%'></table>\n<script>\n\n\$(document).ready(function(){\n\$('#events-table-{$t}').flexigrid({\n\turl: '{$page}?websites-search=yes&user={$_GET["user"]}&field={$_GET["field"]}&table={$_GET["table"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$hitsTitl}', name : 'hits', width :160, sortable : false, align: 'left'},\n\t\t{display: '{$size}', name : 'size', width :184, sortable : true, align: 'left'},\n\t\t{display: '{$websites}', name : 'sitename', width :425, sortable : true, align: 'left'},\n\t],\n\n\tsearchitems : [\n\t\t{display: '{$websites}', name : 'sitename'},\n\t\t\n\t\t],\n\tsortname: 'hits',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:16px>{$titleW} {$DayTime} {$TITLE_PAGE}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: 833,\n\theight: 503,\n\tsingleSelect: true\n\t\n\t}); \n});\n\n</script>";
echo $tpl->_ENGINE_parse_body($html);
}
示例2: REPAIR_WORKING_TABLES
function REPAIR_WORKING_TABLES()
{
$q = new mysql_squid_builder();
$LIST_TABLES_DAYS = $q->LIST_TABLES_HOURS();
events(count($LIST_TABLES_DAYS) . " daily tables");
while (list($tablename, $ligne) = each($LIST_TABLES_DAYS)) {
$xtime = $q->TIME_FROM_HOUR_TABLE($tablename);
$xdate = date("Y-m-d", $xtime);
$danstable = "dansguardian_events_" . date("Ymd", $xtime);
if ($GLOBALS["VERBOSE"]) {
echo "{$tablename}: {$danstable} = {$xdate}\n";
}
$q->QUERY_SQL("INSERT IGNORE INTO tables_day (tablename,zDate) VALUES ('{$tablename}','{$xdate}')");
}
$currentTABLE = date("Ymd") . "_hour";
$LIST_TABLES_dansguardian_events = $q->LIST_TABLES_dansguardian_events();
while (list($tablename, $ligne) = each($LIST_TABLES_dansguardian_events)) {
$xtime = $q->TIME_FROM_DANSGUARDIAN_EVENTS_TABLE($tablename);
$hour_table = date("Ymd", $xtime) . "_hour";
if ($currentTABLE == $hour_table) {
continue;
}
if (!$q->TABLE_EXISTS($hour_table)) {
events(" ####### WARNING - NO TABLE {$hour_table} #############");
}
}
}
示例3: ScanDays
function ScanDays($onlyTable = false)
{
$q = new mysql_squid_builder(true);
$ARRAY_DAYS = array();
$tables = $q->LIST_TABLES_dansguardian_events();
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_DANSGUARDIAN_EVENTS_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$tables = $q->LIST_TABLES_HOURS();
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_HOUR_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$tables = $q->LIST_TABLES_YOUTUBE_DAYS();
//youtubeday_
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_YOUTUBE_DAY_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$tables = $q->LIST_TABLES_USERSIZED();
//youtubeday_
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_USERSIZED_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$tables = $q->LIST_TABLES_QUOTADAY();
//youtubeday_
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_QUOTADAY_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$tables = $q->LIST_CAT_FAMDAY();
//youtubeday_
while (list($tablename, $line) = each($tables)) {
$dayTime = $q->TIME_FROM_CAT_FAMDAY_TABLE($tablename);
$day = date("Y-m-d", $dayTime);
$ARRAY_DAYS[$day] = $dayTime;
$TABLES[$tablename] = true;
}
$prefix = "INSERT IGNORE INTO tables_day (tablename,zDate) VALUES ";
while (list($day, $dayTime) = each($ARRAY_DAYS)) {
$tablename = "dansguardian_events_" . date("Ymd", $dayTime);
$f[] = "('{$tablename}','{$day}')";
}
if (count($f) > 0) {
$q->QUERY_SQL($prefix . @implode(",", $f));
if (!$q->ok) {
if ($GLOBALS["VERBOSE"]) {
echo "Fatal {$q->mysql_error}\n";
}
squid_admin_purge(0, "Fatal {$q->mysql_error}", "Backup process cannot be performed", __FILE__, __LINE__);
ufdbguard_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "backup");
return false;
}
}
if ($onlyTable) {
return $TABLES;
}
return true;
}
示例4: repair_table_days_hours
function repair_table_days_hours()
{
$q = new mysql_squid_builder();
$array = $q->LIST_TABLES_HOURS();
while (list($tablename, $none) = each($array)) {
$time = $q->TIME_FROM_HOUR_TABLE($tablename);
$date = date("Y-m-d", $time);
$tablename = "dansguardian_events_" . date("Ymd", $time);
echo "{$tablename} -> {$date}\n";
$q->QUERY_SQL("INSERT IGNORE INTO tables_day (tablename,zDate) VALUES ('{$tablename}','{$date}')");
}
}
示例5: process_all_tables
function process_all_tables()
{
if ($GLOBALS["VERBOSE"]) {
echo "Loading...\n";
}
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
if ($GLOBALS["VERBOSE"]) {
"echo Loading done...\n";
}
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = @file_get_contents($pidfile);
if (!$GLOBALS["FORCE"]) {
if ($pid < 100) {
$pid = null;
}
$unix = new unix();
if ($unix->process_exists($pid, basename(__FILE__))) {
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid}\n";
}
return;
}
$timeexec = $unix->file_time_min($timefile);
if ($timeexec < 720) {
if ($GLOBALS["VERBOSE"]) {
echo "{$timeexec} <>720...\n";
}
return;
}
$mypid = getmypid();
@file_put_contents($pidfile, $mypid);
}
@file_put_contents($timefile, time());
$q = new mysql_squid_builder();
$tables = $q->LIST_TABLES_HOURS();
$current_table = date("Ymd") . "_hour";
$BIGARRAY = array();
$d = 0;
while (list($tablename, $ligne) = each($tables)) {
if ($current_table == $tablename) {
if ($GLOBALS["VERBOSE"]) {
echo "{$tablename} SKIP...\n";
}
continue;
}
$d++;
$sql = "SELECT sitename,familysite,category,SUM(size) as size,SUM(hits) as hits,country \n\t\tFROM {$tablename} GROUP BY sitename,familysite,category HAVING LENGTH(category)=0";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
categorize_tables_events("MySQL error (after {$d} tables)", "{$q->mysql_error}", $tablename);
return;
}
$count = mysql_num_rows($results);
if ($count == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "{$tablename} no row...\n";
}
continue;
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$tablename} {$count} rows...\n";
}
}
$TIME_FROM_HOUR_TABLE = $q->TIME_FROM_HOUR_TABLE($tablename);
while ($ligne = mysql_fetch_assoc($results)) {
$sitename = trim($ligne["sitename"]);
$familysite = trim($ligne["familysite"]);
process_all_tables_percentage($sitename);
if ($sitename == null) {
if ($GLOBALS["VERBOSE"]) {
echo "Null value for {$sitename},{$familysite} aborting\n";
}
$q->QUERY_SQL("DELETE FROM {$tablename} WHERE `sitename`='{$ligne["sitename"]}'");
continue;
}
if ($sitename == '.') {
if ($GLOBALS["VERBOSE"]) {
echo "'.' value for {$sitename},{$familysite} aborting\n";
}
$q->QUERY_SQL("DELETE FROM {$tablename} WHERE `sitename`='{$ligne["sitename"]}'");
continue;
}
if (strpos($sitename, ',') > 0) {
$sitename = str_replace(",", "", $sitename);
$q->QUERY_SQL("UPDATE {$tablename} SET `sitename`='{$sitename}' WHERE `sitename`='{$ligne["sitename"]}'");
}
if (is_numeric($sitename)) {
if ($GLOBALS["VERBOSE"]) {
echo "Numeric value for {$sitename},{$familysite} aborting\n";
}
$q->QUERY_SQL("DELETE FROM {$tablename} WHERE `sitename`='{$ligne["sitename"]}'");
continue;
}
if (strpos($sitename, ".") == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "Seems to be a local domain for {$sitename},{$familysite} aborting\n";
}
//.........这里部分代码省略.........
示例6: items
function items(){
$t=$_GET["t"];
$tpl=new templates();
$MyPage=CurrentPageName();
$q=new mysql_squid_builder();
$users=new usersMenus();
$sock=new sockets();
$database="squidlogs";
$search='%';
$table=$_GET["hour_table"];
$time=$q->TIME_FROM_HOUR_TABLE($table);
$_GET["day"]=date("Y-m-d",$time);
$page=1;
$FORCE_FILTER=null;
if($_GET["field"]<>null){
$FORCE_FILTER=" AND `{$_GET["field"]}`='{$_GET["value"]}'";
}
if(!$q->TABLE_EXISTS($table, $database)){json_error_show("$table doesn't exists...");}
if($q->COUNT_ROWS($table, $database)==0){json_error_show("No data");}
$field_query=$_GET["field_query"];
$hour_table=$_GET["hour_table"];
$table="(SELECT SUM($field_query) as totalsize,familysite FROM $hour_table GROUP BY familysite) as t";
if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}}
if(isset($_POST['page'])) {$page = $_POST['page'];}
$searchstring=string_to_flexquery();
if($searchstring<>null){
$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $FORCE_FILTER $searchstring";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database));
$total = $ligne["TCOUNT"];
}else{
$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $FORCE_FILTER";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database));
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
$sql="SELECT * FROM $table WHERE 1 $searchstring $FORCE_FILTER $ORDER $limitSql";
$results = $q->QUERY_SQL($sql,$database);
if(mysql_num_rows($results)==0){
json_error_show("$sql<hr>No row",1);
}
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if(!$q->ok){json_error_show($q->mysql_error);}
while ($ligne = mysql_fetch_assoc($results)) {
$zmd5=md5(serialize($ligne));
$color="black";
$date=strtotime($ligne["zDate"]);
$Hour=date("H:i",$date);
$day=$_GET["day"];
//familysite size hits
$urljsSIT="<a href=\"javascript:blur();\"
OnClick=\"javascript:Loadjs('squid.traffic.statistics.days.php?today-zoom=yes&type={$_GET["type"]}&familysite={$ligne["familysite"]}&day=$day')\"
style='font-size:16px;font-weight:bold;text-decoration:underline'>";
$urijs="s_PopUpFull('{$ligne["uri"]}','1024','900');";
$ligne["totalsize"]=FormatBytes($ligne["totalsize"]/1024);
$addcache=imgsimple("net-disk-add-32.png","null","Loadjs('squid.caches32.caches-www.php?addjs-silent=yes&website={$ligne["familysite"]}')");
$sql="SELECT sitename FROM websites_caches_params WHERE sitename='{$ligne["familysite"]}'";
$ligne2=mysql_fetch_array($q->QUERY_SQL($sql));
if($ligne2<>null){
$select="Loadjs('squid.miniwebsite.tasks.php?cache-params-js=yes&sitename={$ligne["familysite"]}');";
$addcache=imgsimple("disk_share_enable-32.png","null",$select);
}
$data['rows'][] = array(
'id' => "$zmd5",
'cell' => array(
"<span style='font-size:16px;color:$color'>{$ligne["totalsize"]}</a></span>",
"<span style='font-size:12px;color:$color'>$urljsSIT{$ligne["familysite"]}</a></span>",
"<span style='font-size:12px;color:$color'>$addcache</span>",
)
//.........这里部分代码省略.........
示例7: repair
function repair()
{
$q = new mysql_squid_builder();
$C = 0;
$currentDay = date("Ymd");
$LIST_TABLES_HOURS = $q->LIST_TABLES_HOURS();
while (list($tablename, $value) = each($LIST_TABLES_HOURS)) {
$xtime = $q->TIME_FROM_HOUR_TABLE($tablename);
if (date("Ymd", $xtime) == $currentDay) {
continue;
}
$DayTable = date("Ymd", $xtime) . "_hour";
if (!$q->TABLE_EXISTS($DayTable)) {
continue;
}
$tablenameS = "dansguardian_events_" . date("Ymd", $xtime);
$sql = "SELECT COUNT(`sitename`) as tcount FROM {$DayTable} WHERE LENGTH(`category`)=0";
$ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
$max = $ligne2["tcount"];
if ($GLOBALS["VERBOSE"]) {
echo "{$DayTable}/{$tablenameS} = {$max} no categorized\n";
}
$sql = "UPDATE tables_day SET `not_categorized`={$max} WHERE tablename='{$tablenameS}'";
$q->QUERY_SQL($sql);
}
}
示例8: UserSizeD
function UserSizeD()
{
$q = new mysql_squid_builder();
$TABLES = $q->LIST_TABLES_HOURS();
$Current = date("Ymd") . "_hour";
$COUNTOF = count($TABLES);
$pe = 0;
while (list($table_hour, $val) = each($TABLES)) {
$pe++;
if ($table_hour == $Current) {
continue;
}
$CountDeSource = $q->COUNT_ROWS($table_hour);
if ($CountDeSource == 0) {
continue;
}
$xtime = $q->TIME_FROM_HOUR_TABLE($table_hour);
$DestTable = "UserSizeD_" . date("Ymd", $xtime);
$zDate = date("Y-m-d", $xtime);
events_tail("{$zDate}: {$DestTable} {$pe}/{$COUNTOF}");
if (!$q->TABLE_EXISTS($DestTable)) {
UserSizeD_REPAIR($zDate);
continue;
}
if ($q->COUNT_ROWS($DestTable) == 0) {
UserSizeD_REPAIR($zDate);
continue;
}
}
}
示例9: MONTH_TABLE_FROM_MEMBER_DAY
function MONTH_TABLE_FROM_MEMBER_DAY($tablesource)
{
$q = new mysql_squid_builder();
$time = $q->TIME_FROM_HOUR_TABLE($tablesource);
$DAY = date("d", $time);
$YEAR = date("Y", $time);
$MONTH = date("m", $time);
$month_table = date("Ym", $time) . "_members";
$CurrentTable = date("Ymd") . "_members";
if ($CurrentTable == $tablesource) {
return;
}
$q->CreateMembersMonthTable($month_table);
$results = $q->QUERY_SQL("SELECT SUM(hits) as hits,SUM(size) as size, MAC,client,hostname,uid FROM {$tablesource} GROUP BY MAC,client,hostname,uid");
if (!$q->ok) {
echo $q->mysql_error . "\n";
return;
}
$sum = mysql_num_rows($results);
if ($sum == 0) {
echo "{$tablesource} Nothing!\n";
return;
}
echo "Month table:{$month_table} Day {$DAY} {$sum} rows\n";
$prefix = "INSERT IGNORE INTO `{$month_table}` (zMD5,client,`day`,size,hits,uid,MAC,hostname) VALUES ";
$IP = new IP();
$d = 0;
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$zMD5 = md5(serialize($ligne));
$client = mysql_escape_string2($ligne["client"]);
$uid = mysql_escape_string2($ligne["uid"]);
$MAC = mysql_escape_string2($ligne["MAC"]);
$hostname = mysql_escape_string2($ligne["hostname"]);
$size = $ligne["size"];
$hits = $ligne["hits"];
if ($IP->isValid($uid)) {
$uid = null;
}
$row[] = "('{$zMD5}','{$client}','{$DAY}','{$size}','{$hits}','{$uid}','{$MAC}','{$hostname}')";
$d++;
if (count($row) > 500) {
$q->QUERY_SQL($prefix . @implode(",", $row));
build_progress("Insterting " . count($row) . " elements", 20);
echo "Added {$d} rows\n";
$row = array();
}
}
if (count($row) > 0) {
$q->QUERY_SQL($prefix . @implode(",", $row));
build_progress("Insterting " . count($row) . " elements", 20);
echo "Added {$d} rows\n";
$row = array();
}
}
示例10: members_repair
function members_repair()
{
$unix = new unix();
$q = new mysql_squid_builder();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if (!$GLOBALS["FORCE"]) {
if ($pid < 100) {
$pid = null;
}
$unix = new unix();
if ($unix->process_exists($pid, basename(__FILE__))) {
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid}\n";
}
return;
}
$mypid = getmypid();
@file_put_contents($pidfile, $mypid);
}
$C = 0;
$currentDay = date("Ymd");
$LIST_TABLES_HOURS = $q->LIST_TABLES_HOURS();
while (list($tablename, $value) = each($LIST_TABLES_HOURS)) {
$xtime = $q->TIME_FROM_HOUR_TABLE($tablename);
if (date("Ymd", $xtime) == $currentDay) {
continue;
}
$member_table = date("Ymd", $xtime) . "_members";
$users_table = date("Ymd", $xtime) . "_users";
$source_table = "dansguardian_events_" . date("Ymd", $xtime);
if (!$q->TABLE_EXISTS($member_table)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$source_table} -> {$member_table} -> BUILD\n";
}
stats_admin_events(1, "Repair: Members {$source_table} -> {$member_table}", null, __FILE__, __LINE__);
if (members_hours_perfom($source_table, $member_table)) {
users_day_perfom($member_table, $users_table);
$C++;
}
continue;
}
if ($q->COUNT_ROWS($tablename) > 0) {
if ($q->COUNT_ROWS($member_table) == 0) {
if (members_hours_perfom($source_table, $member_table)) {
stats_admin_events(2, "Repair: Members Success from \"{$source_table}\" to \"{$member_table}\"", null, __FILE__, __LINE__);
users_day_perfom($member_table, $users_table);
$C++;
}
continue;
}
}
if ($GLOBALS["VERBOSE"]) {
echo "{$source_table} -> {$member_table} OK\n";
}
}
$php = $unix->LOCATE_PHP5_BIN();
if ($C > 0) {
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.stats.totals.php --repair-members --byschedule");
}
}