forked from poppyred/1.6.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
squid.browse.www.php
executable file
·123 lines (91 loc) · 3.59 KB
/
squid.browse.www.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
include_once('ressources/class.templates.inc');
include_once('ressources/class.users.menus.inc');
$users=new usersMenus();
if(!$users->AsWebStatisticsAdministrator){die();}
if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["wwwBrowse-search"])){search();exit;}
js();
function js(){
$page=CurrentPageName();
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body("{browse}::{websites}");
$html="
$('wwwBrowse-search-list').remove();
YahooWin4('550','$page?popup=yes&field={$_GET["field"]}&callback={$_GET["callback"]}&day={$_GET["day"]}&user-field={$_GET["user-field"]}&user={$_GET["user"]}','$title');";
echo $html;
}
//http://flexigrid.info/
function popup(){
$page=CurrentPageName();
$tpl=new templates();
if($_GET["callback"]<>null){$callback="{$_GET["callback"]}()";}
$html="
<table style='width:99%' class=form>
<tr>
<td class=legend>{search}:</td>
<td>". Field_text("wwwBrowse-search",null,"font-size:16px;font-weight:bold;width:80%",null,null,null,false,"wwwBrowseCheck(event)")."</td>
</tr>
</table>
<div id='wwwBrowse-search-list' style='width:100%;height:450px;overflow:auto'></div>
<script>
function wwwBrowseCheck(e){
if(!checkEnter(e)){return;}
var se=escape(document.getElementById('wwwBrowse-search').value);
LoadAjax('wwwBrowse-search-list','$page?wwwBrowse-search=yes&field={$_GET["field"]}&callback={$_GET["callback"]}&search='+se);
}
function BrowseWWWSelect(www){
document.getElementById('{$_GET["field"]}').value=www;
YahooWin4Hide();
$callback;
}
var se=escape(document.getElementById('wwwBrowse-search').value);
LoadAjax('wwwBrowse-search-list','$page?wwwBrowse-search=yes&field={$_GET["field"]}&callback={$_GET["callback"]}&search='+se);
</script>
";
echo $tpl->_ENGINE_parse_body($html);
}
function search(){
$search=$_GET["search"];
$search="*$search*";
$search=str_replace("**", "*", $search);
$search=str_replace("**", "*", $search);
$search=str_replace("*", "%", $search);
if(CACHE_SESSION_GET(__FILE__.__FUNCTION__.$search,__FILE__,2)){return;}
$page=CurrentPageName();
$tpl=new templates();
$q=new mysql_squid_builder();
$table="visited_sites";
if($q->COUNT_ROWS($table)==0){echo "<H2>".$tpl->_ENGINE_parse_body("TABLE:$table<br>{error_no_datas}")."</H2>";return;}
$sql="SELECT familysite,SUM(HitsNumber) as HitsNumber FROM `$table`
GROUP BY familysite HAVING (`familysite` LIKE '$search')
ORDER BY HitsNumber DESC LIMIT 0,100";
$html="<center>
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
<thead class='thead'>
<tr>
<th width=50% nowrap colspan=2>{websites}</th>
<th width=50% nowrap>{hits}</th>
<th width=1% nowrap> </th>
</tr>
</thead>
<tbody class='tbody'>";
$results=$q->QUERY_SQL($sql);
if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";}
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
$js="BrowseWWWSelect('{$ligne["familysite"]}');";
$siteTool=imgtootltip("website-add-32.png","{select}:{$ligne["familysite"]}",$js);
$sitname=texttooltip($ligne["familysite"],"{select}",$js,null,0,"font-size:14px;text-decoration:underline");
$html=$html."
<tr class=$classtr>
<td width=1% style='font-size:14px'>$siteTool</td>
<td style='font-size:14px' width=99%>$sitname</td>
<td style='font-size:14px' width=1%>{$ligne["HitsNumber"]}</td>
</tr>
";
}
$html=$html."</tbody></table>
";
CACHE_SESSION_SET(__FILE__.__FUNCTION__.$search, __FILE__,$tpl->_ENGINE_parse_body($html));
}