| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | �Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/stats.php,v $ 14 | $Revision: 1.38 $ 15 | $Date: 2007/02/10 15:54:31 $ 16 | $Author: e107steved $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("../../class2.php"); 20 21 @include_once(e_PLUGIN."log/languages/".e_LANGUAGE.".php"); 22 @include_once(e_PLUGIN."log/languages/English.php"); 23 24 $stat = new siteStats(); 25 26 function core_head() { 27 $bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_IMAGE."generic/bar.png"); 28 return "<style type='text/css'> 29 <!-- 30 .b { background-image: url(".$bar."); border: 1px solid #999; height: 10px; font: 0px } 31 --> 32 </style>"; 33 } 34 35 require_once(HEADERF); 36 37 if(!check_class($pref['statUserclass'])) { 38 $text = "<div style='text-align: center;'>".ADSTAT_L4."</div>"; 39 $ns->tablerender(ADSTAT_L6, $text); 40 require_once(FOOTERF); 41 exit; 42 } 43 44 if (!$pref['statActivate']) { 45 $text = (ADMIN ? "<div style='text-align:center'>".ADSTAT_L41."</div>" : "<div style='text-align:center'>".ADSTAT_L5."</div>"); 46 $ns->tablerender(ADSTAT_L6, $text); 47 require_once(FOOTERF); 48 exit; 49 } 50 51 if(strstr(e_QUERY, ".")) { 52 list($action, $order) = explode(".", e_QUERY); 53 } else { 54 $action = e_QUERY; 55 $order = FALSE; 56 } 57 58 $action = intval($action); 59 $toremove = $order; 60 $order = intval($order); 61 62 if($stat -> error) { 63 $ns->tablerender(ADSTAT_L6, $stat -> error); 64 require_once(FOOTERF); 65 exit; 66 } 67 68 $browser_map = array ( 69 'Netcaptor' => "netcaptor", 70 'Internet Explorer' => "explorer", 71 'Firefox' => "firefox", 72 'Opera' => "opera", 73 'AOL' => "aol", 74 'Netscape' => "netscape", 75 'Mozilla' => "mozilla", 76 'Mosaic' => "mosaic", 77 'K-Meleon' => "k-meleon", 78 'Konqueror' => "konqueror", 79 'Avant Browser' => "avantbrowser", 80 'AvantGo' => "avantgo", 81 'Proxomitron' => "proxomitron", 82 'Safari' => "safari", 83 'Lynx' => "lynx", 84 'Links' => "links", 85 'Galeon' => "galeon", 86 'ABrowse' => "abrowse", 87 'Amaya' => "amaya", 88 'ANTFresco' => "ant", 89 'Aweb' => "aweb", 90 'Beonex' => "beonex", 91 'Blazer' => "blazer", 92 'Camino' => "camino", 93 'Chimera' => "chimera", 94 'Columbus' => "columbus", 95 'Crazy Browser' => "crazybrowser", 96 'Curl' => "curl", 97 'Deepnet Explorer' => "deepnet", 98 'Dillo' => "dillo", 99 'Doris' => "doris", 100 'ELinks' => "elinks", 101 'Epiphany' => "epiphany", 102 'Firebird' => "firebird", 103 'IBrowse' => "ibrowse", 104 'iCab' => "icab", 105 'ICEbrowser' => "ice", 106 'iSiloX' => "isilox", 107 'Lotus Notes' => "lotus", 108 'Lunascape' => "lunascape", 109 'Maxthon' => "maxthon", 110 'mBrowser' => "mbrowser", 111 'Multi-Browser' => "multibrowser", 112 'Nautilus' => "nautilus", 113 'NetFront' => "netfront", 114 'NetPositive' => "netpositive", 115 'OmniWeb' => "omniweb", 116 'Oregano' => "oregano", 117 'PhaseOut' => "phaseout", 118 'PLink' => "plink", 119 'Phoenix' => "phoenix", 120 'Proxomitron' => "proxomitron", 121 'Shiira' => "shiira", 122 'Sleipnir' => "sleipnir", 123 'SlimBrowser' => "slimbrowser", 124 'StarOffice' => "staroffice", 125 'Sunrise' => "sunrise", 126 'Voyager' => "voyager", 127 'w3m' => "w3m", 128 'Webtv' => "webtv", 129 'Xiino' => "xiino", 130 ); 131 132 $country["arpa"] = "ARPANet"; 133 $country["com"] = "Commercial Users"; 134 $country["edu"] = "Education"; 135 $country["gov"] = "Government"; 136 $country["int"] = "Organisation established by an International Treaty"; 137 $country["mil"] = "Military"; 138 $country["net"] = "Network"; 139 $country["org"] = "Organisation"; 140 $country["ad"] = "Andorra"; 141 $country["ae"] = "United Arab Emirates"; 142 $country["af"] = "Afghanistan"; 143 $country["ag"] = "Antigua & Barbuda"; 144 $country["ai"] = "Anguilla"; 145 $country["al"] = "Albania"; 146 $country["am"] = "Armenia"; 147 $country["an"] = "Netherland Antilles"; 148 $country["ao"] = "Angola"; 149 $country["aq"] = "Antarctica"; 150 $country["ar"] = "Argentina"; 151 $country["as"] = "American Samoa"; 152 $country["at"] = "Austria"; 153 $country["au"] = "Australia"; 154 $country["aw"] = "Aruba"; 155 $country["az"] = "Azerbaijan"; 156 $country["ba"] = "Bosnia-Herzegovina"; 157 $country["bb"] = "Barbados"; 158 $country["bd"] = "Bangladesh"; 159 $country["be"] = "Belgium"; 160 $country["bf"] = "Burkina Faso"; 161 $country["bg"] = "Bulgaria"; 162 $country["bh"] = "Bahrain"; 163 $country["bi"] = "Burundi"; 164 $country["bj"] = "Benin"; 165 $country["bm"] = "Bermuda"; 166 $country["bn"] = "Brunei Darussalam"; 167 $country["bo"] = "Bolivia"; 168 $country["br"] = "Brasil"; 169 $country["bs"] = "Bahamas"; 170 $country["bt"] = "Bhutan"; 171 $country["bv"] = "Bouvet Island"; 172 $country["bw"] = "Botswana"; 173 $country["by"] = "Belarus"; 174 $country["bz"] = "Belize"; 175 $country["ca"] = "Canada"; 176 $country["cc"] = "Cocos (Keeling) Islands"; 177 $country["cf"] = "Central African Republic"; 178 $country["cg"] = "Congo"; 179 $country["ch"] = "Switzerland"; 180 $country["ci"] = "Ivory Coast"; 181 $country["ck"] = "Cook Islands"; 182 $country["cl"] = "Chile"; 183 $country["cm"] = "Cameroon"; 184 $country["cn"] = "China"; 185 $country["co"] = "Colombia"; 186 $country["cr"] = "Costa Rica"; 187 $country["cs"] = "Czechoslovakia"; 188 $country["cu"] = "Cuba"; 189 $country["cv"] = "Cape Verde"; 190 $country["cx"] = "Christmas Island"; 191 $country["cy"] = "Cyprus"; 192 $country["cz"] = "Czech Republic"; 193 $country["de"] = "Germany"; 194 $country["dj"] = "Djibouti"; 195 $country["dk"] = "Denmark"; 196 $country["dm"] = "Dominica"; 197 $country["do"] = "Dominican Republic"; 198 $country["dz"] = "Algeria"; 199 $country["ec"] = "Ecuador"; 200 $country["ee"] = "Estonia"; 201 $country["eg"] = "Egypt"; 202 $country["eh"] = "Western Sahara"; 203 $country["er"] = "Eritrea"; 204 $country["es"] = "Spain"; 205 $country["et"] = "Ethiopia"; 206 $country["fi"] = "Finland"; 207 $country["fj"] = "Fiji"; 208 $country["fk"] = "Falkland Islands (Malvibas)"; 209 $country["fm"] = "Micronesia"; 210 $country["fo"] = "Faroe Islands"; 211 $country["fr"] = "France"; 212 $country["fx"] = "France (European Territory)"; 213 $country["ga"] = "Gabon"; 214 $country["gb"] = "Great Britain"; 215 $country["gd"] = "Grenada"; 216 $country["ge"] = "Georgia"; 217 $country["gf"] = "Guyana (French)"; 218 $country["gh"] = "Ghana"; 219 $country["gi"] = "Gibralta"; 220 $country["gl"] = "Greenland"; 221 $country["gm"] = "Gambia"; 222 $country["gn"] = "Guinea"; 223 $country["gp"] = "Guadeloupe (French)"; 224 $country["gq"] = "Equatorial Guinea"; 225 $country["gr"] = "Greece"; 226 $country["gs"] = "South Georgia & South Sandwich Islands"; 227 $country["gt"] = "Guatemala"; 228 $country["gu"] = "Guam (US)"; 229 $country["gw"] = "Guinea Bissau"; 230 $country["gy"] = "Guyana"; 231 $country["hk"] = "Hong Kong"; 232 $country["hm"] = "Heard & McDonald Islands"; 233 $country["hn"] = "Honduras"; 234 $country["hr"] = "Croatia"; 235 $country["ht"] = "Haiti"; 236 $country["hu"] = "Hungary"; 237 $country["id"] = "Indonesia"; 238 $country["ie"] = "Ireland"; 239 $country["il"] = "Israel"; 240 $country["in"] = "India"; 241 $country["io"] = "British Indian Ocean Territories"; 242 $country["iq"] = "Iraq"; 243 $country["ir"] = "Iran"; 244 $country["is"] = "Iceland"; 245 $country["it"] = "Italy"; 246 $country["jm"] = "Jamaica"; 247 $country["jo"] = "Jordan"; 248 $country["jp"] = "Japan"; 249 $country["ke"] = "Kenya"; 250 $country["kg"] = "Kyrgyz Republic"; 251 $country["kh"] = "Cambodia"; 252 $country["ki"] = "Kiribati"; 253 $country["km"] = "Comoros"; 254 $country["kn"] = "Saint Kitts Nevis Anguilla"; 255 $country["kp"] = "Korea (North)"; 256 $country["kr"] = "Korea (South)"; 257 $country["kw"] = "Kuwait"; 258 $country["ky"] = "Cayman Islands"; 259 $country["kz"] = "Kazachstan"; 260 $country["la"] = "Laos"; 261 $country["lb"] = "Lebanon"; 262 $country["lc"] = "Saint Lucia"; 263 $country["li"] = "Liechtenstein"; 264 $country["lk"] = "Sri Lanka"; 265 $country["lr"] = "Liberia"; 266 $country["ls"] = "Lesotho"; 267 $country["lt"] = "Lithuania"; 268 $country["lu"] = "Luxembourg"; 269 $country["lv"] = "Latvia"; 270 $country["ly"] = "Libya"; 271 $country["ma"] = "Morocco"; 272 $country["mc"] = "Monaco"; 273 $country["md"] = "Moldova"; 274 $country["mg"] = "Madagascar"; 275 $country["mh"] = "Marshall Islands"; 276 $country["mk"] = "Macedonia"; 277 $country["ml"] = "Mali"; 278 $country["mm"] = "Myanmar"; 279 $country["mn"] = "Mongolia"; 280 $country["mo"] = "Macau"; 281 $country["mp"] = "Northern Mariana Islands"; 282 $country["mq"] = "Martinique (French)"; 283 $country["mr"] = "Mauretania"; 284 $country["ms"] = "Montserrat"; 285 $country["mt"] = "Malta"; 286 $country["mu"] = "Mauritius"; 287 $country["mv"] = "Maldives"; 288 $country["mw"] = "Malawi"; 289 $country["mx"] = "Mexico"; 290 $country["my"] = "Malaysia"; 291 $country["mz"] = "Mozambique"; 292 $country["na"] = "Namibia"; 293 $country["nc"] = "New Caledonia (French)"; 294 $country["ne"] = "Niger"; 295 $country["nf"] = "Norfolk Island"; 296 $country["ng"] = "Nigeria"; 297 $country["ni"] = "Nicaragua"; 298 $country["nl"] = "Netherlands"; 299 $country["no"] = "Norway"; 300 $country["np"] = "Nepal"; 301 $country["nr"] = "Nauru"; 302 $country["nt"] = "Saudiarab. Irak)"; 303 $country["nu"] = "Niue"; 304 $country["nz"] = "New Zealand"; 305 $country["om"] = "Oman"; 306 $country["pa"] = "Panama"; 307 $country["pe"] = "Peru"; 308 $country["pf"] = "Polynesia (French)"; 309 $country["pg"] = "Papua New Guinea"; 310 $country["ph"] = "Philippines"; 311 $country["pk"] = "Pakistan"; 312 $country["pl"] = "Poland"; 313 $country["pm"] = "Saint Pierre & Miquelon"; 314 $country["pn"] = "Pitcairn"; 315 $country["pr"] = "Puerto Rico (US)"; 316 $country["pt"] = "Portugal"; 317 $country["pw"] = "Palau"; 318 $country["py"] = "Paraguay"; 319 $country["qa"] = "Qatar"; 320 $country["re"] = "Reunion (French)"; 321 $country["ro"] = "Romania"; 322 $country["ru"] = "Russian Federation"; 323 $country["rw"] = "Rwanda"; 324 $country["sa"] = "Saudi Arabia"; 325 $country["sb"] = "Salomon Islands"; 326 $country["sc"] = "Seychelles"; 327 $country["sd"] = "Sudan"; 328 $country["se"] = "Sweden"; 329 $country["sg"] = "Singapore"; 330 $country["sh"] = "Saint Helena"; 331 $country["si"] = "Slovenia"; 332 $country["sj"] = "Svalbard & Jan Mayen"; 333 $country["sk"] = "Slovakia"; 334 $country["sl"] = "Sierra Leone"; 335 $country["sm"] = "San Marino"; 336 $country["sn"] = "Senegal"; 337 $country["so"] = "Somalia"; 338 $country["sr"] = "Suriname"; 339 $country["st"] = "Sao Tome & Principe"; 340 $country["su"] = "Soviet Union"; 341 $country["sv"] = "El Salvador"; 342 $country["sy"] = "Syria"; 343 $country["sz"] = "Swaziland"; 344 $country["tc"] = "Turks & Caicos Islands"; 345 $country["td"] = "Chad"; 346 $country["tf"] = "French Southern Territories"; 347 $country["tg"] = "Togo"; 348 $country["th"] = "Thailand"; 349 $country["tj"] = "Tadjikistan"; 350 $country["tk"] = "Tokelau"; 351 $country["tm"] = "Turkmenistan"; 352 $country["tn"] = "Tunisia"; 353 $country["to"] = "Tonga"; 354 $country["tp"] = "East Timor"; 355 $country["tr"] = "Turkey"; 356 $country["tt"] = "Trinidad & Tobago"; 357 $country["tv"] = "Tuvalu"; 358 $country["tw"] = "Taiwan"; 359 $country["tz"] = "Tanzania"; 360 $country["ua"] = "Ukraine"; 361 $country["ug"] = "Uganda"; 362 $country["uk"] = "United Kingdom"; 363 $country["um"] = "US Minor outlying Islands"; 364 $country["us"] = "United States"; 365 $country["uy"] = "Uruguay"; 366 $country["uz"] = "Uzbekistan"; 367 $country["va"] = "Vatican City State"; 368 $country["vc"] = "St Vincent & Grenadines"; 369 $country["ve"] = "Venezuela"; 370 $country["vg"] = "Virgin Islands (British)"; 371 $country["vi"] = "Virgin Islands (US)"; 372 $country["vn"] = "Vietnam"; 373 $country["vu"] = "Vanuatu"; 374 $country["wf"] = "Wallis & Futuna Islands"; 375 $country["ws"] = "Samoa"; 376 $country["ye"] = "Yemen"; 377 $country["yt"] = "Mayotte"; 378 $country["yu"] = "Yugoslavia"; 379 $country["za"] = "South Africa"; 380 $country["zm"] = "Zambia"; 381 $country["zr"] = "Zaire"; 382 $country["zw"] = "Zimbabwe"; 383 384 /* stats displayed will depend on the query string. For example, ?1.2.4 will render today's stats, all time stats and browser stats */ 385 /* 386 1: today's stats 387 2: all time total and unique 388 3: browsers 389 4: operating systems 390 5: domains 391 6: screen resolution/colour depth 392 7: referers 393 8: search engine strings 394 */ 395 396 switch($action) { 397 case 1: 398 $text = $stat -> renderTodaysVisits(); 399 break; 400 case 2: 401 $text = $stat -> renderAlltimeVisits(); 402 break; 403 case 3: 404 if($pref['statBrowser']) { 405 $text = $stat -> renderBrowsers(); 406 } else { 407 $text = ADSTAT_L7; 408 } 409 break; 410 case 4: 411 if($pref['statOs']) { 412 $text = $stat -> renderOses(); 413 } else { 414 $text = ADSTAT_L7; 415 } 416 break; 417 case 5: 418 if($pref['statDomain']) { 419 $text = $stat -> renderDomains(); 420 } else { 421 $text = ADSTAT_L7; 422 } 423 break; 424 case 6: 425 if($pref['statScreen']) { 426 $text = $stat -> renderScreens(); 427 } else { 428 $text = ADSTAT_L7; 429 } 430 break; 431 case 7: 432 if($pref['statRefer']) { 433 $text = $stat -> renderRefers(); 434 } else { 435 $text = ADSTAT_L7; 436 } 437 break; 438 case 8: 439 if($pref['statQuery']) { 440 $text = $stat -> renderQueries(); 441 } else { 442 $text = ADSTAT_L7; 443 } 444 break; 445 case 9: 446 if($pref['statRecent']) { 447 $text = $stat -> recentVisitors(); 448 } else { 449 $text = ADSTAT_L7; 450 } 451 break; 452 case 10: 453 $text = $stat -> renderDaily(); 454 break; 455 case 11: 456 $text = $stat -> renderMonthly(); 457 break; 458 case "rem": 459 $stat -> remove_entry($toremove); 460 break; 461 } 462 463 464 /* render links */ 465 $path = e_PLUGIN."log/stats.php"; 466 $links = " 467 <div style='text-align: center;'>". 468 (e_QUERY != 1 ? "<a href='$path?1'>".ADSTAT_L8."</a>" : "<b>".ADSTAT_L8."</b>")." | ". 469 (e_QUERY != 2 ? "<a href='$path?2'>".ADSTAT_L9."</a>" : "<b>".ADSTAT_L9."</b>")." | ". 470 (e_QUERY != 10 ? "<a href='$path?10'>".ADSTAT_L10."</a>" : "<b>".ADSTAT_L10."</b>")." | ". 471 (e_QUERY != 11 ? "<a href='$path?11'>".ADSTAT_L11."</a>" : "<b>".ADSTAT_L11."</b>")." | ". 472 (e_QUERY != 3 && $pref['statBrowser'] ? "<a href='$path?3'>".ADSTAT_L12."</a> | " : ($pref['statBrowser'] ? "<b>".ADSTAT_L12."</b> | " : "")). 473 (e_QUERY != 4 && $pref['statOs'] ? "<a href='$path?4'>".ADSTAT_L13."</a> | " : ($pref['statOs'] ? "<b>".ADSTAT_L13."</b> | " : "")). 474 (e_QUERY != 5 && $pref['statDomain'] ? "<a href='$path?5'>".ADSTAT_L14."</a> | " : ($pref['statDomain'] ? "<b>".ADSTAT_L14."</b> | " : "")). 475 (e_QUERY != 6 && $pref['statScreen'] ? "<a href='$path?6'>".ADSTAT_L15."</a> | " : ($pref['statScreen'] ? "<b>".ADSTAT_L15."</b> | " : "")). 476 (e_QUERY != 7 && $pref['statRefer'] ? "<a href='$path?7'>".ADSTAT_L16."</a> | " : ($pref['statRefer'] ? "<b>".ADSTAT_L16."</b> | " : "")). 477 (e_QUERY != 8 && $pref['statQuery'] ? "<a href='$path?8'>".ADSTAT_L17."</a> | " : ($pref['statQuery'] ? "<b>".ADSTAT_L17."</b> | " : "")). 478 (e_QUERY != 9 && $pref['statRecent'] ? "<a href='$path?9'>".ADSTAT_L18."</a>" : ($pref['statRecent'] ? "<b>".ADSTAT_L18."</b>" : "")). 479 "</div><br /><br />"; 480 481 482 483 $ns->tablerender(ADSTAT_L6, $links.$text); 484 require_once(FOOTERF); 485 486 class siteStats { 487 488 var $dbPageInfo; 489 var $fileInfo; 490 var $fileBrowserInfo; 491 var $fileOsInfo; 492 var $fileScreenInfo; 493 var $fileDomainInfo; 494 var $fileReferInfo; 495 var $fileQueryInfo; 496 var $fileRecent; 497 var $error; 498 var $order; 499 var $bar; 500 501 var $filesiteTotal; 502 var $filesiteUnique; 503 504 function siteStats() { 505 /* constructor */ 506 global $sql; 507 508 /* get today's logfile ... */ 509 $logfile = e_PLUGIN."log/logs/logp_".date("z.Y", time()).".php"; 510 if(is_readable($logfile)) { 511 require($logfile); 512 } 513 $logfile = e_PLUGIN."log/logs/logi_".date("z.Y", time()).".php"; 514 if(is_readable($logfile)) { 515 require($logfile); 516 } 517 518 $this -> filesiteTotal = $siteTotal; 519 $this -> filesiteUnique = $siteUnique; 520 521 /* set order var */ 522 global $order; 523 $this -> order = $order; 524 525 $this -> fileInfo = $pageInfo; 526 $this -> fileBrowserInfo = $browserInfo; 527 $this -> fileOsInfo = $osInfo; 528 $this -> fileScreenInfo = $screenInfo; 529 $this -> fileDomainInfo = $domainInfo; 530 $this -> fileReferInfo = $refInfo; 531 $this -> fileQueryInfo = $searchInfo; 532 $this -> fileRecent = $visitInfo; 533 534 /* get main stat info from database */ 535 if($sql -> db_Select("logstats", "*", "log_id='pageTotal'")){ 536 $row = $sql -> db_Fetch(); 537 $this -> dbPageInfo = unserialize($row[2]); 538 } else { 539 $this -> dbPageInfo = array(); 540 } 541 542 /* temp consolidate today's info (if it exists)... */ 543 if(is_array($pageInfo)) { 544 foreach($pageInfo as $key => $info) { 545 $key = preg_replace("/\?.*/", "", $key); 546 if(array_key_exists($key, $this -> dbPageInfo)) { 547 $this -> dbPageInfo[$key]['ttlv'] += $info['ttl']; 548 $this -> dbPageInfo[$key]['unqv'] += $info['unq']; 549 } else { 550 $this -> dbPageInfo[$key]['url'] = $info['url']; 551 $this -> dbPageInfo[$key]['ttlv'] = $info['ttl']; 552 $this -> dbPageInfo[$key]['unqv'] = $info['unq']; 553 } 554 } 555 } 556 557 $this -> bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_IMAGE."generic/bar.png"); 558 559 560 /* end constructor */ 561 } 562 563 function arraySort($array, $column, $order = SORT_DESC){ 564 /* sorts multi-dimentional array based on which field is passed */ 565 $i=0; 566 foreach($array as $info) { 567 $sortarr[]=$info[$column]; 568 $i++; 569 } 570 array_multisort($sortarr, $order, $array, $order); 571 return($array); 572 /* end method */ 573 } 574 575 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 576 577 function renderTodaysVisits() { 578 /* renders information for today only */ 579 $totalArray = $this -> arraySort($this -> fileInfo, "ttl"); 580 581 foreach($totalArray as $key => $info) { 582 $totalv += $info['ttl']; 583 $totalu += $info['unq']; 584 } 585 586 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 587 foreach($totalArray as $key => $info) { 588 if($info['ttl']){ 589 $percentage = round(($info['ttl']/$totalv) * 100, 2); 590 $text .= "<tr>\n<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a> 591 </td>\n<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['ttl']." [".$info['unq']."]")."</td>\n<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>\n</tr>\n"; 592 } 593 } 594 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>$totalv [$totalu]</td><td class='forumheader'></td></tr></table>"; 595 return $text; 596 } 597 598 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 599 600 function renderAlltimeVisits() { 601 /* renders information for alltime, total and unique */ 602 603 global $sql; 604 605 $sql -> db_Select("logstats", "*", "log_id='pageTotal' "); 606 $row = $sql -> db_Fetch(); 607 $pageTotal = unserialize($row['log_data']); 608 609 foreach($this -> fileInfo as $url => $tmpcon) { 610 $pageTotal[$url]['url'] = $tmpcon['url']; 611 $pageTotal[$url]['ttlv'] += $tmpcon['ttl']; 612 $pageTotal[$url]['unqv'] += $tmpcon['unq']; 613 } 614 615 $totalArray = $this -> arraySort($pageTotal, "ttlv"); 616 617 foreach($totalArray as $key => $info) { 618 $total += $info['ttlv']; 619 } 620 $text .= "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 621 foreach($totalArray as $key => $info) { 622 if($info['ttlv']){ 623 $percentage = round(($info['ttlv']/$total) * 100, 2); 624 $text .= "<tr> 625 <td class='forumheader3' style='width: 20%;'> 626 ".(ADMIN && getperms("P") ? "<a href='".e_SELF."?rem.".$key."'><img src='".e_PLUGIN."log/images/remove.png' alt='".ADSTAT_L39."' title='".ADSTAT_L39."' style='vertical-align: middle; border: 0;' /></a> " : "")." 627 <img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a> 628 "; 629 $text .= "</td> 630 <td class='forumheader3' style='width: 70%;'>".$this->bar($percentage, $info['ttlv'])."</td> 631 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 632 </tr>\n"; 633 } 634 } 635 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 636 637 $uniqueArray = $this -> arraySort($this -> dbPageInfo, "unqv"); 638 foreach($uniqueArray as $key => $info) { 639 $totalv += $info['unqv']; 640 } 641 $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>Page</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L24."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 642 foreach($uniqueArray as $key => $info) { 643 if($info['ttlv']){ 644 $percentage = round(($info['unqv']/$total) * 100, 2); 645 $text .= "<tr> 646 <td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a></td> 647 <td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['unqv'])."</td> 648 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 649 </tr>\n"; 650 } 651 } 652 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$totalv</td><td class='forumheader'></td></tr>\n</table>"; 653 return $text; 654 } 655 656 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 657 658 function renderBrowsers() { 659 global $sql, $browser_map; 660 661 if($entries = $sql -> db_Select("logstats", "*", "log_id='statBrowser'")) { 662 $row = $sql -> db_Fetch(); 663 $statBrowser = unserialize($row['log_data']); 664 } 665 666 /* temp consolidate today's data ... */ 667 foreach($this -> fileBrowserInfo as $name => $count) { 668 $statBrowser[$name] += $count; 669 } 670 671 if(!is_array($statBrowser)) { 672 return "<div style='text-align: center;'>".ADSTAT_L25."</div>"; 673 } 674 675 if(is_array($statBrowser)) { 676 if($this -> order) { 677 ksort($statBrowser); 678 reset ($statBrowser); 679 $browserArray = $statBrowser; 680 } else { 681 $browserArray = $this -> arraySort($statBrowser, 0); 682 } 683 $total = array_sum($browserArray); 684 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?3".($this -> order ? "" : ".1" )."'>".ADSTAT_L26."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 685 686 foreach($browserArray as $key => $info) { 687 $image = ""; 688 foreach ($browser_map as $name => $file) { 689 if(strstr($key, $name)) { 690 $image = "{$file}.png"; 691 break; 692 } 693 } 694 if($image == "") { 695 $image = "unknown.png"; 696 } 697 $percentage = round(($info/$total) * 100, 2); 698 $text .= "<tr> 699 <td class='forumheader3' style='width: 20%;'>".($image ? "<img src='".e_PLUGIN."log/images/$image' alt='' style='vertical-align: middle;' /> " : "").$key."</td>". 700 ($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")." 701 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 702 </tr>\n"; 703 } 704 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 705 } 706 return $text; 707 } 708 709 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 710 711 function renderOses() { 712 global $sql; 713 714 if($entries = $sql -> db_Select("logstats", "*", "log_id='statOs'")) { 715 $row = $sql -> db_Fetch(); 716 $statOs = unserialize($row['log_data']); 717 } 718 719 /* temp consolidate today's data ... */ 720 foreach($this -> fileOsInfo as $name => $count) { 721 $statOs[$name] += $count; 722 } 723 724 if(!is_array($statOs)) { 725 return "<div style='text-align: center;'>".ADSTAT_L25.".</div>"; 726 } 727 728 if($this -> order) { 729 ksort($statOs); 730 reset ($statOs); 731 $osArray = $statOs; 732 } else { 733 $osArray = $this -> arraySort($statOs, 0); 734 } 735 736 $total = array_sum($osArray); 737 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?4".($this -> order ? "" : ".1" )."'>".ADSTAT_L27."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 738 foreach($osArray as $key => $info) { 739 740 $image = ""; 741 if(strstr($key, "Windows")) { $image = "windows.png"; } 742 if(strstr($key, "Mac")) { $image = "mac.png"; } 743 if(strstr($key, "Linux")) { $image = "linux.png"; } 744 if(strstr($key, "BeOS")) { $image = "beos.png"; } 745 if(strstr($key, "FreeBSD")) { $image = "freebsd.png"; } 746 if(strstr($key, "NetBSD")) { $image = "netbsd.png"; } 747 if(strstr($key, "Unspecified")) { $image = "unspecified.png"; } 748 if(strstr($key, "OpenBSD")) { $image = "openbsd.png"; } 749 if(strstr($key, "Unix")) { $image = "unix.png"; } 750 if(strstr($key, "Spiders")) { $image = "spiders.png"; } 751 752 $percentage = round(($info/$total) * 100, 2); 753 $text .= "<tr> 754 <td class='forumheader3' style='width: 20%;'>".($image ? "<img src='".e_PLUGIN."log/images/$image' alt='' style='vertical-align: middle;' /> " : "").$key."</td>". 755 ($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")." 756 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 757 </tr>\n"; 758 } 759 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></tr></tr>\n</table>"; 760 return $text; 761 } 762 763 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 764 765 function renderDomains() { 766 global $sql; 767 768 if($sql -> db_Select("logstats", "*", "log_id='statDomain'")) { 769 $row = $sql -> db_Fetch(); 770 $statDom = unserialize($row['log_data']); 771 } 772 773 /* temp consolidate today's data ... */ 774 foreach($this -> fileDomainInfo as $name => $count) { 775 $statDom[$name] += $count; 776 } 777 778 if(!count($statDom)) { 779 return "<div style='text-align: center;'>".ADSTAT_L25.".</div>"; 780 } 781 782 if($this -> order) { 783 ksort($statDom); 784 reset ($statDom); 785 $domArray = $statDom; 786 } else { 787 $domArray = $this -> arraySort($statDom, 0); 788 } 789 790 $total = array_sum($domArray); 791 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?5".($this -> order ? "" : ".1" )."'>".ADSTAT_L28."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 792 foreach($domArray as $key => $info) { 793 if($key = $this -> getcountry($key)) { 794 $percentage = round(($info/$total) * 100, 2); 795 $text .= "<tr> 796 <td class='forumheader3' style='width: 20%;'>".$key."</td> 797 <td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td> 798 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 799 </tr>\n"; 800 } 801 } 802 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 803 return $text; 804 } 805 806 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 807 808 function renderScreens() { 809 global $sql; 810 811 if($entries = $sql -> db_Select("logstats", "*", "log_id='statScreen'")) { 812 $row = $sql -> db_Fetch(); 813 $statScreen = unserialize($row['log_data']); 814 } 815 816 /* temp consolidate today's data ... */ 817 foreach($this -> fileScreenInfo as $name => $count) { 818 $statScreen[$name] += $count; 819 } 820 821 if(!is_array($statScreen)) { 822 return "<div style='text-align: center;'>".ADSTAT_L25."</div>"; 823 } 824 825 if($this -> order) { 826 $nsarray = array(); 827 foreach($statScreen as $key => $info) { 828 if(preg_match("/(\d+)x/", $key, $match)) { 829 $nsarray[$key] = array('width' => $match[1], 'info' => $info); 830 } 831 } 832 $nsarray = $this -> arraySort($nsarray, 'width', SORT_ASC); 833 reset($nsarray); 834 $screenArray = array(); 835 foreach($nsarray as $key => $info) { 836 $screenArray[$key] = $info['info']; 837 } 838 839 } else { 840 $screenArray = $this -> arraySort($statScreen, 0); 841 } 842 843 $total = array_sum($screenArray); 844 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?6".($this -> order ? "" : ".1" )."'>".ADSTAT_L29."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 845 foreach($screenArray as $key => $info) { 846 if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key)) { 847 $percentage = round(($info/$total) * 100, 2); 848 $text .= "<tr> 849 <td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/screen.png' alt='' style='vertical-align: middle;' /> ".$key."</td>". 850 ($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")." 851 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 852 </tr>\n"; 853 } 854 } 855 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 856 return $text; 857 } 858 859 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 860 861 function renderRefers() { 862 global $sql, $pref; 863 864 if($sql -> db_Select("logstats", "*", "log_id='statReferer'")) { 865 $row = $sql -> db_Fetch(); 866 $statRefer = unserialize($row['log_data']); 867 } 868 869 /* temp consolidate today's data ... */ 870 foreach($this -> fileReferInfo as $name => $count) { 871 $statRefer[$name]['url'] = $count['url']; 872 $statRefer[$name]['ttl'] += $count['ttl']; 873 } 874 875 //echo "<pre>"; print_r($statRefer); echo "</pre>"; exit; 876 877 if(!is_array($statRefer) || !count($statRefer)) { 878 return "<div style='text-align: center;'>".ADSTAT_L25.".</div>"; 879 } 880 881 $statArray = $this -> arraySort($statRefer, 'ttl'); 882 883 $total = 0; 884 foreach($statArray as $key => $info) { 885 $total += $info['ttl']; 886 } 887 888 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 40%;'><a title='".($this -> order ? "show cropped url" : "show full url")."'href='".e_SELF."?7".($this -> order ? "" : ".1" )."'>".ADSTAT_L30."</a></td>\n<td class='fcaption' style='width: 50%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 889 $count = 0; 890 foreach($statArray as $key => $info) { 891 $percentage = round(($info['ttl']/$total) * 100, 2); 892 if (!$this -> order && strlen($key) > 50) { 893 $key = substr($key, 0, 50)." ..."; 894 } 895 $text .= "<tr> 896 <td class='forumheader3'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."' rel='external'>".$key."</a></td> 897 <td class='forumheader3'>".$this -> bar($percentage, $info['ttl'])."</td> 898 <td class='forumheader3' style='text-align: center;'>".$percentage."%</td> 899 </tr>\n"; 900 $count++; 901 if($count == $pref['statDisplayNumber']) { 902 break; 903 } 904 } 905 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 906 return $text; 907 } 908 909 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 910 911 function renderQueries() { 912 global $sql; 913 914 if($sql -> db_Select("logstats", "*", "log_id='statQuery'")) { 915 $row = $sql -> db_Fetch(); 916 $statQuery = unserialize($row['log_data']); 917 } 918 919 /* temp consolidate today's data ... */ 920 foreach($this -> fileQueryInfo as $name => $count) { 921 $statQuery[$name] += $count; 922 } 923 924 if(!is_array($statQuery) || !count($statQuery)) { 925 return "<div style='text-align: center;'>".ADSTAT_L25."</div>"; 926 } 927 928 $queryArray = $this -> arraySort($statQuery, 0); 929 $total = array_sum($queryArray); 930 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 60%;'>".ADSTAT_L31."</td>\n<td class='fcaption' style='width: 30%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; 931 $count = 1; 932 foreach($queryArray as $key => $info) { 933 $percentage = round(($info/$total) * 100, 2); 934 $key = str_replace("%20", " ", $key); 935 $text .= "<tr> 936 <td class='forumheader3' style='width: 60%;'><img src='".e_PLUGIN."log/images/screen.png' alt='' style='vertical-align: middle;' /> ".$key."</td> 937 <td class='forumheader3' style='width: 30%;'>".$this -> bar($percentage, $info)."</td> 938 <td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 939 </tr>\n"; 940 $count ++; 941 if($count == $pref['statDisplayNumber']) { 942 break; 943 } 944 } 945 $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; 946 return $text; 947 } 948 949 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 950 951 function recentVisitors() { 952 if(!is_array($this -> fileRecent) || !count($this -> fileRecent)) { 953 return "<div style='text-align: center;'>".ADSTAT_L25.".</div>"; 954 } 955 956 $gen = new convert; 957 $recentArray = array_reverse($this -> fileRecent, TRUE); 958 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L18."</td>\n<td class='fcaption' style='width: 70%;'>Information</td>\n</tr>\n"; 959 960 foreach($recentArray as $key => $info) { 961 if(is_array($info)) { 962 $host = $info['host']; 963 $datestamp = $info['date']; 964 $os = $info['os']; 965 $browser = $info['browser']; 966 $screen = $info['screen']; 967 $referer = $info['referer']; 968 } else { 969 list($host, $datestamp, $os, $browser, $screen, $referer) = explode(chr(1), $info); 970 } 971 $datestamp = $gen -> convert_date($datestamp, "long"); 972 973 $text .= "<tr> 974 <td class='forumheader3' style='width: 30%;'>$datestamp</td> 975 <td class='forumheader3' style='width: 70%;'>Host: $host<br />".ADSTAT_L26.": $browser<br />".ADSTAT_L27.": $os<br />".ADSTAT_L29.": $screen".($referer ? "<br />".ADSTAT_L32.": <a href='$referer' rel='external'>$referer</a>" : "")."</td> 976 </tr>\n"; 977 } 978 979 $text .= "</table>"; 980 return $text; 981 } 982 983 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 984 985 function renderDaily() { 986 global $sql, $siteTotal, $siteUnique; 987 988 $td = date("Y-m-j", time()); 989 $dayarray[$td] = array(); 990 $pagearray = array(); 991 992 $qry = " 993 SELECT * from #logstats WHERE log_id REGEXP('[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+') 994 ORDER BY CONCAT(LEFT(log_id,4), SUBSTRING(log_id, 6, 2), LPAD(SUBSTRING(log_id, 9), 2, '0')) 995 DESC LIMIT 0,14 996 "; 997 998 if($amount = $sql -> db_Select_gen($qry)) { 999 $array = $sql -> db_getList(); 1000 1001 $ttotal = 0; 1002 $utotal = 0; 1003 1004 foreach($array as $key => $value) { 1005 extract($value); 1006 if(is_array($log_data)) { 1007 $entries[0] = $log_data['host']; 1008 $entries[1] = $log_data['date']; 1009 $entries[2] = $log_data['os']; 1010 $entries[3] = $log_data['browser']; 1011 $entries[4] = $log_data['screen']; 1012 $entries[5] = $log_data['referer']; 1013 } else { 1014 $entries = explode(chr(1), $log_data); 1015 } 1016 1017 $dayarray[$log_id]['daytotal'] = $entries[0]; 1018 $dayarray[$log_id]['dayunique'] = $entries[1]; 1019 1020 unset($entries[0]); 1021 unset($entries[1]); 1022 1023 foreach($entries as $entry) { 1024 if($entry) { 1025 list($url, $total, $unique) = explode("|", $entry); 1026 if(strstr($url, "/")) { 1027 $urlname = preg_replace("/\.php|\?.*/", "", substr($url, (strrpos($url, "/")+1))); 1028 } else { 1029 $urlname = preg_replace("/\.php|\?.*/", "", $url); 1030 } 1031 $dayarray[$log_id][$urlname] = array('url' => $url, 'total' => $total, 'unique' => $unique); 1032 $pagearray[$urlname]['total'] += $total; 1033 $pagearray[$urlname]['unique'] += $unique; 1034 $ttotal += $total; 1035 $utotal += $unique; 1036 } 1037 } 1038 } 1039 } 1040 1041 foreach($this -> fileInfo as $fkey => $fvalue) 1042 { 1043 $dayarray[$td][$fkey]['total'] += $fvalue['ttl']; 1044 $dayarray[$td][$fkey]['unique'] += $fvalue['unq']; 1045 $dayarray[$td]['daytotal'] += $fvalue['ttl']; 1046 $dayarray[$td]['dayunique'] += $fvalue['unq']; 1047 $pagearray[$fkey]['total'] += $fvalue['ttl']; 1048 $pagearray[$fkey]['unique'] += $fvalue['unq']; 1049 $ttotal += $fvalue['ttl']; 1050 $utotal += $fvalue['unq']; 1051 } 1052 1053 $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L33." ".($amount+1)." ".ADSTAT_L40."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1054 1055 foreach($dayarray as $date => $total) { 1056 1057 list($year, $month, $day) = explode("-", $date); 1058 $date = strftime ("%A, %B %d", mktime (0,0,0,$month,$day,$year)); 1059 $barWidth = round(($total['daytotal']/$ttotal) * 100, 2); 1060 $text .= "<tr> 1061 <td class='forumheader3' style='width: 30%;'>$date</td> 1062 <td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['daytotal'])."</td> 1063 </tr>\n"; 1064 } 1065 1066 $text .= "</table>"; 1067 $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L35." ".($amount+1)." ".ADSTAT_L40."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1068 1069 1070 foreach($dayarray as $date => $total) { 1071 list($year, $month, $day) = explode("-", $date); 1072 $date = strftime ("%A, %B %d", mktime (0,0,0,$month,$day,$year)); 1073 $barWidth = round(($total['dayunique']/$utotal) * 100, 2); 1074 $text .= "<tr> 1075 <td class='forumheader3' style='width: 30%;'>$date</td> 1076 <td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['dayunique'])."</td> 1077 </tr>\n"; 1078 } 1079 $text .= "</table>"; 1080 1081 $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L33." ".($amount+1)." ".ADSTAT_L36."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1082 1083 $newArray = $this -> arraySort($pagearray, "total"); 1084 foreach($newArray as $key => $total) { 1085 $barWidth = round(($total['total']/$ttotal) * 100, 2); 1086 $text .= "<tr> 1087 <td class='forumheader3' style='width: 30%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> $key</td> 1088 <td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['total'])."</td> 1089 </tr>\n"; 1090 1091 } 1092 $text .= "</table>"; 1093 $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L35." ".($amount+1)." ".ADSTAT_L36."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1094 $newArray = $this -> arraySort($pagearray, "unique"); 1095 1096 foreach($newArray as $key => $total) { 1097 $barWidth = round(($total['unique']/$utotal) * 100, 2); 1098 $text .= "<tr> 1099 <td class='forumheader3' style='width: 30%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> $key</td> 1100 <td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['unique'])."</td> 1101 </tr>\n"; 1102 } 1103 $text .= "</table>"; 1104 return $text; 1105 } 1106 1107 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 1108 1109 function renderMonthly() { 1110 global $sql; 1111 1112 if(!$entries = $sql -> db_Select("logstats", "*", "log_id REGEXP('^[[:digit:]]+\-[[:digit:]]+$') ORDER BY CONCAT(LEFT(log_id,4), RIGHT(log_id,2)) DESC")) { 1113 return "No monthly stats yet."; 1114 } 1115 1116 $array = $sql -> db_getList(); 1117 1118 $monthTotal = array(); 1119 $mtotal = 0; 1120 $utotal = 0; 1121 foreach($array as $info) { 1122 $date = $info['log_id']; 1123 $stats = unserialize($info['log_data']); 1124 1125 foreach($stats as $key => $total) { 1126 $monthTotal[$date]['totalv'] += $total['ttlv']; 1127 $monthTotal[$date]['uniquev'] += $total['unqv']; 1128 $mtotal += $total['ttlv']; 1129 $utotal += $total['unqv']; 1130 } 1131 } 1132 1133 $tmpArray = $this -> arraySort($monthTotal, "totalv"); 1134 1135 $text .= "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L37."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1136 1137 foreach($monthTotal as $date => $total) { 1138 1139 list($year, $month) = explode("-", $date); 1140 $date = strftime ("%B %Y", mktime (0,0,0,$month,1,$year)); 1141 $barWidth = round(($total['totalv']/$mtotal) * 100, 2); 1142 $text .= "<tr> 1143 <td class='forumheader3' style='width: 30%;'>$date</td>". 1144 ($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['totalv'])."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['totalv'])."</td>")." 1145 </tr>\n"; 1146 } 1147 $text .= "</table>"; 1148 1149 $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 30%;'>".ADSTAT_L38."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</td>\n</tr>\n"; 1150 1151 foreach($monthTotal as $date => $total) { 1152 $barWidth = round(($total['uniquev']/$utotal) * 100, 2); 1153 list($year, $month) = explode("-", $date); 1154 $date = strftime ("%B %Y", mktime (0,0,0,$month,1,$year)); 1155 $text .= "<tr> 1156 <td class='forumheader3' style='width: 30%;'>$date</td>". 1157 ($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['uniquev'])."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($barWidth, $total['uniquev'])."</td>")." 1158 </tr>\n"; 1159 } 1160 $text .= "</table>"; 1161 1162 1163 return $text; 1164 } 1165 1166 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ 1167 1168 function getWidthRatio ($array, $column) { 1169 $tmpArray = $this -> arraySort($array, $column); 1170 $data = each($tmpArray); 1171 $maxValue = $data[1]['totalv']; 1172 echo "<b>maxValue</b> ".$maxValue." <br />"; 1173 $ratio = 0; 1174 while($maxValue > 100) { 1175 $maxValue = ($maxValue / 2); 1176 $ratio ++; 1177 } 1178 if(!$ratio) 1179 { 1180 return 1; 1181 } 1182 echo "<b>ratio</b> ".$ratio." <br />"; 1183 return $ratio; 1184 } 1185 1186 function getcountry($dom) { 1187 global $country; 1188 return $country[$dom]; 1189 } 1190 1191 function bar($percen, $val) 1192 { 1193 return "<div class='b' style='width: ".intval($percen)."%'></div> 1194 </td> 1195 <td style='width:10%; text-align:center' class='forumheader3'>".$val; 1196 } 1197 1198 function remove_entry($toremove) { 1199 global $sql; 1200 $sql -> db_Select("logstats", "*", "log_id='pageTotal'"); 1201 $row = $sql -> db_Fetch(); 1202 $dbPageInfo = unserialize($row[2]); 1203 unset($dbPageInfo[$toremove]); 1204 $dbPageDone = serialize($dbPageInfo); 1205 $sql -> db_Update("logstats", "log_data='$dbPageDone' WHERE log_id='pageTotal' "); 1206 $this -> renderAlltimeVisits(); 1207 } 1208 } 1209 1210 1211 1212 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |