1<?php 2/** 3 * Detailed Gallery Statistics 4 * 5 * This plugin shows statistical graphs and info about your gallery\'s images and albums 6 * 7 * @package admin 8 */ 9define('OFFSET_PATH', 3); 10 11require_once(dirname(dirname(__FILE__)) . '/admin-globals.php'); 12require_once(dirname(dirname(__FILE__)) . '/' . PLUGIN_FOLDER . '/image_album_statistics.php'); 13 14if (extensionEnabled('zenpage')) { 15 require_once(dirname(dirname(__FILE__)) . '/' . PLUGIN_FOLDER . '/zenpage/zenpage-admin-functions.php'); 16} 17 18$buttonlist[] = array( 19 'category' => gettext('Info'), 20 'enable' => true, 21 'button_text' => gettext('Gallery Statistics'), 22 'formname' => 'gallery_statistics.php', 23 'action' => FULLWEBPATH . '/' . ZENFOLDER . '/' . UTILITIES_FOLDER . '/gallery_statistics.php', 24 'icon' => FULLWEBPATH . '/' . ZENFOLDER . '/images/bar_graph.png', 25 'title' => gettext('Shows statistical graphs and info about your gallery’s images and albums.'), 26 'alt' => '', 27 'hidden' => '', 28 'rights' => ADMIN_RIGHTS 29); 30 31admin_securityChecks(OVERVIEW_RIGHTS, currentRelativeURL()); 32 33$_zp_gallery->garbageCollect(); 34$webpath = WEBPATH . '/' . ZENFOLDER . '/'; 35 36$zenphoto_tabs['overview']['subtabs'] = array(gettext('Statistics') => FULLWEBPATH . '/' . ZENFOLDER . '/' . UTILITIES_FOLDER . '/gallery_statistics.php'); 37printAdminHeader('overview', 'statistics'); 38 39?> 40<link rel="stylesheet" href="../admin-statistics.css" type="text/css" media="screen" /> 41<?php 42/* 43 * http://php.net/manual/de/function.filesize.php 44 * 45 * @author Jonas Sweden 46 */ 47 48function gallerystats_filesize_r($path) { 49 if (!file_exists($path)) 50 return 0; 51 if (is_file($path)) 52 return filesize($path); 53 $ret = 0; 54 foreach (safe_glob($path . "/*") as $fn) { 55 $ret += gallerystats_filesize_r($fn); 56 } 57 return $ret; 58} 59 60/** 61 * Prints a table with a bar graph of the values. 62 * 63 * @param string $sortorder "popular", "mostrated","toprated","mostcommented" or - only if $type = "albums"! - "mostimages" 64 * @param string_type $type "albums", "images", "pages", "news", "tags" 65 * @param int $limit Number of entries to show 66 */ 67function printBarGraph($sortorder = "mostimages", $type = "albums", $from_number = 0, $to_number = 10) { 68 global $webpath; 69 $limit = $from_number . "," . $to_number; 70 $bargraphmaxsize = 90; 71 switch ($type) { 72 case "albums": 73 $typename = gettext("Albums"); 74 $dbquery = "SELECT * FROM " . prefix('albums'); 75 break; 76 case "images": 77 $typename = gettext("Images"); 78 $dbquery = "SELECT * FROM " . prefix('images'); 79 break; 80 case "pages": 81 $typename = gettext("Pages"); 82 $dbquery = "SELECT * FROM " . prefix('pages'); 83 break; 84 case "news": 85 $typename = gettext("News Articles"); 86 $dbquery = "SELECT * FROM " . prefix('news'); 87 break; 88 case "newscategories": 89 $typename = gettext("News Categories"); 90 $dbquery = "SELECT * FROM " . prefix('news_categories'); 91 break; 92 case "tags": 93 $typename = gettext("Tags"); 94 break; 95 case "rss": 96 $typename = gettext("rss"); 97 break; 98 } 99 switch ($sortorder) { 100 case "mostused": 101 switch ($type) { 102 case "tags": 103 $itemssorted = query_full_array("SELECT tagobj.tagid, count(*) as tagcount, tags.* FROM " . prefix('obj_to_tag') . " AS tagobj, " . prefix('tags') . " AS tags WHERE tags.id=tagobj.tagid GROUP BY tags.id ORDER BY tagcount DESC LIMIT " . $limit); 104 if (empty($itemssorted)) { 105 $maxvalue = 0; 106 } else { 107 $maxvalue = $itemssorted[0]['tagcount']; 108 } 109 break; 110 case"newscategories": 111 $itemssorted = query_full_array("SELECT news2cat.cat_id, count(*) as catcount, cats.* FROM " . prefix('news2cat') . " AS news2cat, " . prefix('news_categories') . " AS cats WHERE cats.id=news2cat.cat_id GROUP BY news2cat.cat_id ORDER BY catcount DESC LIMIT " . $limit); 112 if (empty($itemssorted)) { 113 $maxvalue = 0; 114 } else { 115 $maxvalue = $itemssorted[0]['catcount']; 116 } 117 break; 118 } 119 $headline = $typename . " - " . gettext("most used"); 120 break; 121 case "popular": 122 switch ($type) { 123 case 'rss': 124 $itemssorted = query_full_array("SELECT `type`,`aux`, `data` FROM " . prefix('plugin_storage') . " WHERE `type` = 'rsshitcounter' ORDER BY CONVERT(data,UNSIGNED) DESC LIMIT " . $limit); 125 if (empty($itemssorted)) { 126 $maxvalue = 0; 127 } else { 128 $maxvalue = $itemssorted[0]['data']; 129 } 130 break; 131 default: 132 $itemssorted = query_full_array($dbquery . " ORDER BY hitcounter DESC LIMIT " . $limit); 133 if (empty($itemssorted)) { 134 $maxvalue = 0; 135 } else { 136 $maxvalue = $itemssorted[0]['hitcounter']; 137 } 138 break; 139 } 140 $headline = $typename . " - " . gettext("most viewed"); 141 break; 142 case "popularimages": 143 $dbquery = "SELECT a.*, ROUND(AVG( i.hitcounter ), 0) AS average FROM " . prefix('albums') . " a INNER JOIN " . prefix('images') . " i ON i.albumid = a.id "; 144 $itemssorted = query_full_array($dbquery . " GROUP BY i.albumid ORDER BY average DESC LIMIT " . $limit); 145 if (empty($itemssorted)) { 146 $maxvalue = 0; 147 } else { 148 $maxvalue = $itemssorted[0]['average']; 149 } 150 $headline = $typename . " - " . gettext("most viewed images"); 151 break; 152 case "mostrated": 153 $itemssorted = query_full_array($dbquery . " ORDER BY total_votes DESC LIMIT " . $limit); 154 if (empty($itemssorted)) { 155 $maxvalue = 0; 156 } else { 157 $maxvalue = $itemssorted[0]['total_votes']; 158 } 159 $headline = $typename . " - " . gettext("most rated"); 160 break; 161 case "toprated": 162 $itemssorted = query_full_array($dbquery . " ORDER BY (total_value/total_votes) DESC, total_value DESC LIMIT $limit"); 163 if (empty($itemssorted)) { 164 $maxvalue = 0; 165 } else { 166 if ($itemssorted[0]['total_votes'] != 0) { 167 $maxvalue = ($itemssorted[0]['total_value'] / $itemssorted[0]['total_votes']); 168 } else { 169 $maxvalue = 0; 170 } 171 } 172 $headline = $typename . " - " . gettext("top rated"); 173 break; 174 case "mostcommented": 175 switch ($type) { 176 case "albums": 177 $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, albums.* FROM " . prefix('comments') . " AS comments, " . prefix('albums') . " AS albums WHERE albums.id=comments.ownerid AND type = 'albums' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit); 178 break; 179 case "images": 180 $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, images.* FROM " . prefix('comments') . " AS comments, " . prefix('images') . " AS images WHERE images.id=comments.ownerid AND type = 'images' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit); 181 break; 182 case "pages": 183 $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, pages.* FROM " . prefix('comments') . " AS comments, " . prefix('pages') . " AS pages WHERE pages.id=comments.ownerid AND type = 'pages' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit); 184 break; 185 case "news": 186 $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, news.* FROM " . prefix('comments') . " AS comments, " . prefix('news') . " AS news WHERE news.id=comments.ownerid AND type = 'news' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit); 187 break; 188 } 189 if (empty($itemssorted)) { 190 $maxvalue = 0; 191 } else { 192 $maxvalue = $itemssorted[0]['commentcount']; 193 } 194 $headline = $typename . " - " . gettext("most commented"); 195 break; 196 case "mostimages": 197 $itemssorted = query_full_array("SELECT images.albumid, count(*) as imagenumber, albums.* FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums WHERE albums.id=images.albumid GROUP BY images.albumid ORDER BY imagenumber DESC LIMIT " . $limit); 198 if (empty($itemssorted)) { 199 $maxvalue = 0; 200 } else { 201 $maxvalue = $itemssorted[0]['imagenumber']; 202 } 203 $headline = $typename . " - " . gettext("most images"); 204 break; 205 case "latest": 206 switch ($type) { 207 case "albums": 208 $allalbums = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit); 209 $albums = array(); 210 foreach ($allalbums as $album) { 211 $albumobj = newAlbum($album['folder']); 212 if ($albumobj->loaded) { 213 $albumentry = array("id" => $albumobj->getID(), "title" => $albumobj->getTitle(), "folder" => $albumobj->name, "imagenumber" => $albumobj->getNumImages(), "show" => $albumobj->isPublished()); 214 array_unshift($albums, $albumentry); 215 } 216 } 217 $maxvalue = 1; 218 $itemssorted = sortMultiArray($albums, 'id', true, true); // The items are originally sorted by id; 219 $headline = $typename . " - " . gettext("latest"); 220 break; 221 case "images": 222 $itemssorted = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit); 223 $barsize = 0; 224 $maxvalue = 1; 225 $headline = $typename . " - " . gettext("latest"); 226 break; 227 } 228 break; 229 case "latestupdated": 230 $albums = getAlbumStatistic($to_number, 'latestupdated', ''); 231 $maxvalue = 1; 232 if (!empty($albums)) { 233 $stats_albums = array(); 234 foreach ($albums as $key => $albumobj) { 235 if ($albumobj->loaded) { 236 $stats_albums[$key]['title'] = $albumobj->getTitle(); 237 $stats_albums[$key]['folder'] = $albumobj->name; 238 $stats_albums[$key]['imagenumber'] = $albumobj->getNumImages(); 239 } 240 } 241 } 242 $itemssorted = $stats_albums; 243 $headline = $typename . " - " . gettext("latest updated"); 244 break; 245 } 246 247 if ($maxvalue == 0 || empty($itemssorted)) { 248 $maxvalue = 1; 249 $no_hitcount_enabled_msg = ''; 250 if ($sortorder == 'popular' && $type != 'rss' && !extensionEnabled('hitcounter')) { 251 $no_hitcount_enabled_msg = gettext("(The hitcounter plugin is not enabled.)"); 252 } 253 $no_statistic_message = "<tr><td><em>" . gettext("No statistic available.") . $no_hitcount_enabled_msg . "</em></td><td></td><td></td><td></td></tr>"; 254 } else { 255 $no_statistic_message = ""; 256 if (($sortorder == 'popular' || $sortorder == 'popularimages') && $type != 'rss' && !extensionEnabled('hitcounter')) { 257 $no_statistic_message = "<tr><td colspan='4'><em>" . gettext("Note: The hitcounter plugin is not enabled, therefore any existing values will not get updated.") . "</em></td><td></td><td></td><td></td></tr>"; 258 } 259 } 260 if ($from_number <= 1) { 261 $count = 1; 262 } else { 263 $count = $from_number; 264 } 265 $countlines = 0; 266 echo "<table class='bordered'>"; 267 echo "<tr><th colspan='4'><strong>" . $headline . "</strong>"; 268 269 if (isset($_GET['stats'])) { 270 echo "<a href='gallery_statistics.php'> | " . gettext("Back to the top 10 lists") . "</a>"; 271 } else { 272 if (empty($no_statistic_message)) { 273 echo "<a href='gallery_statistics.php?stats=" . $sortorder . "&type=" . $type . "'> | " . gettext("View more") . "</a>"; 274 } 275 echo "<a href='#top'> | " . gettext("top") . "</a>"; 276 } 277 echo "</th></tr>"; 278 echo $no_statistic_message; 279 foreach ($itemssorted as $item) { 280 if (array_key_exists("filename", $item)) { 281 $name = $item['filename']; 282 } else if (array_key_exists("folder", $item)) { 283 $name = $item['folder']; 284 } else if ($type === "pages" OR $type === "news") { 285 $name = $item['titlelink']; 286 } else if ($type === "newscategories") { 287 $name = $item['titlelink']; 288 } else if ($type === "tags") { 289 $name = ""; 290 } 291 switch ($sortorder) { 292 case "popular": 293 switch ($type) { 294 case 'rss': 295 $barsize = round($item['data'] / $maxvalue * $bargraphmaxsize); 296 $value = $item['data']; 297 break; 298 default: 299 $barsize = round($item['hitcounter'] / $maxvalue * $bargraphmaxsize); 300 $value = $item['hitcounter']; 301 break; 302 } 303 break; 304 case 'popularimages': 305 $barsize = round($item['average'] / $maxvalue * $bargraphmaxsize); 306 $value = $item['average'] . " views / image"; 307 break; 308 case "mostrated": 309 if ($item['total_votes'] != 0) { 310 $barsize = round($item['total_votes'] / $maxvalue * $bargraphmaxsize); 311 } else { 312 $barsize = 0; 313 } 314 $value = $item['total_votes']; 315 break; 316 case "toprated": 317 if ($item['total_votes'] != 0) { 318 $barsize = round(($item['total_value'] / $item['total_votes']) / $maxvalue * $bargraphmaxsize); 319 $value = round($item['total_value'] / $item['total_votes']); 320 } else { 321 $barsize = 0; 322 $value = 0; 323 } 324 break; 325 case "mostcommented": 326 if ($maxvalue != 0) { 327 $barsize = round($item['commentcount'] / $maxvalue * $bargraphmaxsize); 328 } else { 329 $barsize = 0; 330 } 331 $value = $item['commentcount']; 332 break; 333 case "mostimages": 334 $barsize = round($item['imagenumber'] / $maxvalue * $bargraphmaxsize); 335 $value = $item['imagenumber']; 336 break; 337 case "latest": 338 switch ($type) { 339 case "albums": 340 $barsize = 0; //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize); 341 $value = sprintf(gettext("%s images"), $item['imagenumber']); 342 break; 343 case "images": 344 $barsize = 0; 345 $value = ""; 346 break; 347 } 348 break; 349 case "latestupdated": 350 $barsize = 0; //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize); 351 $value = sprintf(gettext("%s images"), $item['imagenumber']); 352 break; 353 case "mostused": 354 switch ($type) { 355 case "tags": 356 if ($maxvalue != 0) { 357 $barsize = round($item['tagcount'] / $maxvalue * $bargraphmaxsize); 358 } else { 359 $barsize = 0; 360 } 361 $value = $item['tagcount']; 362 break; 363 case "newscategories": 364 if ($maxvalue != 0) { 365 $barsize = round($item['catcount'] / $maxvalue * $bargraphmaxsize); 366 } else { 367 $barsize = 0; 368 } 369 $value = $item['catcount']; 370 break; 371 } 372 break; 373 } 374 // counter to have a gray background of every second line 375 if ($countlines === 1) { 376 $style = " style='background-color: #f4f4f4'"; // a little ugly but the already attached class for the table is so easiest overriden... 377 $countlines = 0; 378 } else { 379 $style = ""; 380 $countlines++; 381 } 382 switch ($type) { 383 case "albums": 384 $editurl = $webpath . "/admin-edit.php?page=edit&album=" . $name; 385 $viewurl = WEBPATH . "/index.php?album=" . $name; 386 $title = get_language_string($item['title']); 387 break; 388 case "images": 389 if ($item['albumid']) { 390 $getalbumfolder = query_single_row("SELECT title, folder, `show` from " . prefix("albums") . " WHERE id = " . $item['albumid']); 391 if ($sortorder === "latest") { 392 $value = "<span"; 393 if ($getalbumfolder['show'] != "1") { 394 $value = $value . " class='unpublished_item'"; 395 } 396 $value = $value . ">" . get_language_string($getalbumfolder['title']) . "</span> (" . $getalbumfolder['folder'] . ")"; 397 } 398 $editurl = $webpath . "/admin-edit.php?page=edit&album=" . $getalbumfolder['folder'] . "&image=" . $item['filename'] . "&tab=imageinfo#IT"; 399 $viewurl = WEBPATH . "/index.php?album=" . $getalbumfolder['folder'] . "&image=" . $name; 400 $title = get_language_string($item['title']); 401 } 402 break; 403 case "pages": 404 $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&titlelink=" . $name; 405 $viewurl = WEBPATH . "/index.php?p=pages&title=" . $name; 406 $title = get_language_string($item['title']); 407 break; 408 case "news": 409 $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?news&titlelink=" . $name; 410 $viewurl = WEBPATH . "/index.php?p=news&title=" . $name; 411 $title = get_language_string($item['title']); 412 break; 413 case "newscategories": 414 $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-categories.php?edit&id=" . $item['id']; 415 $viewurl = WEBPATH . "/index.php?p=news&category=" . $name; 416 $title = get_language_string($item['title']); 417 break; 418 case "tags": 419 $editurl = $webpath . "/admin-tags.php"; 420 $viewurl = WEBPATH . "/index.php?p=search&searchfields=tags&words=" . $item['name']; 421 $title = $item['name']; 422 break; 423 case "rss": 424 $editurl = ''; 425 $viewurl = WEBPATH . "/index.php?" . html_encode(strrchr($item['aux'], 'rss')); 426 $title = html_encode(strrchr($item['aux'], 'rss')); 427 break; 428 } 429 if (isset($item['show'])) { 430 if ($item['show'] != "1") { 431 $show = " class='unpublished_item'"; 432 } else { 433 $show = ""; 434 } 435 } else { 436 $show = ""; 437 } 438 if ($value != 0 OR $sortorder === "latest") { 439 if (empty($name)) { 440 $name = ""; 441 } else { 442 $name = "(" . $name . ")"; 443 } 444 ?> 445 <tr class="statistic_wrapper"> 446 <td class="statistic_counter" <?php echo $style; ?>> 447 <?php echo $count; ?> 448 </td> 449 <td class="statistic_title" <?php echo $style; ?>> 450 <strong<?php echo $show; ?>><?php echo $title; ?></strong> <?php echo $name; ?> 451 </td> 452 <td class="statistic_graphwrap" <?php echo $style; ?>> 453 <div class="statistic_bargraph" style="width: <?php echo $barsize; ?>%"></div> 454 <div class="statistic_value"><?php echo $value; ?></div> 455 </td> 456 <td class="statistic_link" <?php echo $style; ?>> 457 <?php 458 switch ($type) { 459 case 'rss': 460 echo "<a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>"; 461 break; 462 default: 463 echo "<a href='" . $editurl . "' title='" . $name . "'>" . gettext("Edit") . "</a> | <a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>"; 464 break; 465 } 466 echo "</tr>"; 467 $count++; 468 if ($count === $limit) { 469 break; 470 } 471 } 472 } // foreach end 473 echo "</table>"; 474 } 475 476 echo '</head>'; 477 ?> 478 479<body> 480 <?php 481 printLogoAndLinks(); 482 ?> 483 <div id="main"> 484 <span id="top"></span> 485 <?php 486 printTabs(); 487 488 489 490// getting the counts 491 $albumcount = $_zp_gallery->getNumAlbums(true); 492 $albumscount_unpub = $albumcount - $_zp_gallery->getNumAlbums(true, true); 493 $imagecount = $_zp_gallery->getNumImages(); 494 $imagecount_unpub = $imagecount - $_zp_gallery->getNumImages(true); 495 ?> 496 <div id="content"> 497 <?php printSubtabs() ?> 498 <div class="tabbox"> 499 <?php zp_apply_filter('admin_note', 'statistics', ''); ?> 500 <h1><?php echo gettext("Gallery Statistics"); ?></h1> 501 <p><?php echo gettext("This page shows more detailed statistics of your gallery. For album statistics the bar graph always shows the total number of images in that album. For image statistics always the album the image is in is shown.<br />Un-published items are marked in dark red. Images are marked un-published if their (direct) album is, too."); ?></p> 502 503 <ul class="statistics_general"><li> 504 <?php 505 if ($imagecount_unpub > 0) { 506 printf(gettext('<strong>%1$u</strong> images (%2$u un-published)'), $imagecount, $imagecount_unpub); 507 } else { 508 printf(gettext('<strong>%u</strong> images'), $imagecount); 509 } 510 ?> 511 </li><li> 512 <?php 513 if ($albumscount_unpub > 0) { 514 printf(gettext('<strong>%1$u</strong> albums (%2$u un-published)'), $albumcount, $albumscount_unpub); 515 } else { 516 printf(gettext('<strong>%u</strong> albums'), $albumcount); 517 } 518 ?> 519 </li> 520 <li> 521 <?php 522 $commentcount = $_zp_gallery->getNumComments(true); 523 $commentcount_mod = $commentcount - $_zp_gallery->getNumComments(false); 524 if ($commentcount_mod > 0) { 525 if ($commentcount != 1) { 526 printf(gettext('<strong>%1$u</strong> comments (%2$u in moderation)'), $commentcount, $commentcount_mod); 527 } else { 528 printf(gettext('<strong>1</strong> comment (%u in moderation)'), $commentcount_mod); 529 } 530 } else { 531 if ($commentcount != 1) { 532 printf(gettext('<strong>%u</strong> comments'), $commentcount); 533 } else { 534 echo gettext('<strong>1</strong> comment'); 535 } 536 } 537 ?> 538 </li> 539 <?php if (extensionEnabled('zenpage')) { ?> 540 <li> 541 <?php 542 list($total, $type, $unpub) = getNewsPagesStatistic("pages"); 543 if (empty($unpub)) { 544 printf(gettext('<strong>%1$u</strong> Pages'), $total, $type); 545 } else { 546 printf(gettext('<strong>%1$u</strong> Pages (%2$u un-published)'), $total, $unpub); 547 } 548 ?> 549 </li> 550 <li> 551 <?php 552 list($total, $type, $unpub) = getNewsPagesStatistic("news"); 553 if (empty($unpub)) { 554 printf(gettext('<strong>%1$u</strong> News articles'), $total); 555 } else { 556 printf(gettext('<strong>%1$u</strong> News articles (%2$u un-published)'), $total, $unpub); 557 } 558 ?> 559 </li> 560 <li> 561 <?php 562 list($total, $type, $unpub) = getNewsPagesStatistic("categories"); 563 printf(gettext('<strong>%1$u</strong> Categories'), $total); 564 ?> 565 </li> 566 <?php } 567 ?> 568 <li><nobr><?php printf(gettext("Albums folder size: <strong>%s</strong>"), byteConvert(gallerystats_filesize_r(ALBUM_FOLDER_SERVERPATH))); ?></nobr></li> 569 <li><nobr><?php printf(gettext("Image cache size: <strong>%s</strong>"), byteConvert(gallerystats_filesize_r(SERVERPATH . '/' . CACHEFOLDER))); ?></nobr></li> 570 <li><nobr><?php printf(gettext("HTML cache size: <strong>%s</strong>"), byteConvert(gallerystats_filesize_r(SERVERPATH . '/' . STATIC_CACHE_FOLDER))); ?></nobr></li> 571 <li><nobr><?php printf(gettext("Uploaded folder size: <strong>%s</strong>"), byteConvert(gallerystats_filesize_r(SERVERPATH . '/' . UPLOAD_FOLDER))); ?></nobr></li> 572 <li><nobr><?php printf(gettext("Zenphoto scripts size: <strong>%s</strong>"), byteConvert(gallerystats_filesize_r(SERVERPATH . '/' . ZENFOLDER))); ?></nobr></li> 573 574 </ul> 575 576 <?php 577 if (!isset($_GET['stats']) AND ! isset($_GET['fulllist'])) { 578 ?> 579 <ul class="statistic_navlist"> 580 <li><strong><?php echo gettext("Images"); ?></strong> 581 <ul> 582 <li><a href="#images-latest"><?php echo gettext("latest"); ?></a> | </li> 583 <li><a href="#images-popular"><?php echo gettext("most viewed"); ?></a> | </li> 584 <li><a href="#images-mostrated"><?php echo gettext("most rated"); ?></a> | </li> 585 <li><a href="#images-toprated"><?php echo gettext("top rated"); ?></a> | </li> 586 <li><a href="#images-mostcommented"><?php echo gettext("most commented"); ?></a></li> 587 </ul> 588 </li> 589 <li><strong><?php echo gettext("Albums"); ?></strong> 590 <ul> 591 <li><a href="#albums-latest"><?php echo gettext("latest"); ?></a> | </li> 592 <li><a href="#albums-latestupdated"><?php echo gettext("latest updated"); ?></a> | </li> 593 <li><a href="#albums-mostimages"><?php echo gettext("most images"); ?></a> | </li> 594 <li><a href="#albums-popular"><?php echo gettext("most viewed"); ?></a> | </li> 595 <li><a href="#albums-popularimages"><?php echo gettext("most viewed images"); ?></a> | </li> 596 <li><a href="#albums-mostrated"><?php echo gettext("most rated"); ?></a> | </li> 597 <li><a href="#albums-toprated"><?php echo gettext("top rated"); ?></a> | </li> 598 <li><a href="#albums-mostcommented"><?php echo gettext("most commented"); ?></a></li> 599 </ul> 600 </li> 601 <li><strong><?php echo gettext("Tags"); ?></strong> 602 <ul> 603 <li><a href="#tags-mostused"><?php echo gettext("most used"); ?></a></li> 604 </ul> 605 </li> 606 <?php if (extensionEnabled('zenpage')) { ?> 607 <li><strong><?php echo gettext("Pages"); ?></strong> 608 <ul> 609 <li><a href="#pages-popular"><?php echo gettext("most viewed"); ?></a> | </li> 610 <li><a href="#pages-mostcommented"><?php echo gettext("most commented"); ?></a> | </li> 611 <li><a href="#pages-mostrated"><?php echo gettext("most rated"); ?></a> | </li> 612 <li><a href="#pages-toprated"><?php echo gettext("top rated"); ?></a></li> 613 </ul> 614 </li> 615 <li><strong><?php echo gettext("News articles"); ?></strong> 616 <ul> 617 <li><a href="#news-popular"><?php echo gettext("most viewed"); ?></a> | </li> 618 <li><a href="#news-mostcommented"><?php echo gettext("most commented"); ?></a> | </li> 619 <li><a href="#news-mostrated"><?php echo gettext("most rated"); ?></a> | </li> 620 <li><a href="#news-toprated"><?php echo gettext("top rated"); ?></a></li> 621 </ul> 622 </li> 623 <li><strong><?php echo gettext("News categories"); ?></strong> 624 <ul> 625 <li><a href="#newscategories-popular"><?php echo gettext("most viewed"); ?></a> | </li> 626 <li><a href="#newscategories-mostused"><?php echo gettext("most used"); ?></a></li> 627 </ul> 628 </li> 629 <li><strong><?php echo gettext("RSS feeds"); ?></strong> 630 <ul> 631 <li><a href="#rss-popular"><?php echo gettext("most viewed"); ?></a></li> 632 </ul> 633 </li> 634 <?php } ?> 635 </ul> 636 <br style="clear:both" /> 637 638 <!-- images --> 639 <span id="images-latest"></span> 640 <?php printBarGraph("latest", "images"); ?> 641 642 <span id="images-popular"></span> 643 <?php printBarGraph("popular", "images"); ?> 644 645 <span id="images-mostrated"></span> 646 <?php printBarGraph("mostrated", "images"); ?> 647 648 <span id="images-toprated"></span> 649 <?php printBarGraph("toprated", "images"); ?> 650 651 <span id="images-mostcommented"></span> 652 <?php printBarGraph("mostcommented", "images"); ?> 653 654 <hr /> 655 656 <!-- albums --> 657 <span id="albums-latest"></a> 658 <?php printBarGraph("latest", "albums"); ?> 659 660 <span id="albums-latestupdated"></span> 661 <?php printBarGraph("latestupdated", "albums"); ?> 662 663 <span id="albums-mostimages"></span> 664 <?php printBarGraph("mostimages", "albums"); ?> 665 666 <span id="albums-popular"></span> 667 <?php printBarGraph("popular", "albums"); ?> 668 669 <span id="albums-popularimages"></span> 670 <?php printBarGraph("popularimages", "albums"); ?> 671 672 <span id="albums-mostrated"></span> 673 <?php printBarGraph("mostrated", "albums"); ?> 674 675 <span id="albums-toprated"></span> 676 <?php printBarGraph("toprated", "albums"); ?> 677 678 <span id="albums-mostcommented"></span> 679 <?php printBarGraph("mostcommented", "albums"); ?> 680 681 <hr /> 682 683 <span id="tags-mostused"></span> 684 <?php printBarGraph("mostused", "tags"); ?> 685 686 <?php if (extensionEnabled('zenpage')) { ?> 687 <hr /> 688 <!-- Zenpage pages --> 689 <span id="pages-popular"></span> 690 <?php printBarGraph("popular", "pages"); ?> 691 692 <span id="pages-mostcommented"></span> 693 <?php printBarGraph("mostcommented", "pages"); ?> 694 695 <span id="pages-mostrated"></span> 696 <?php printBarGraph("mostrated", "pages"); ?> 697 698 <span id="pages-toprated"></span> 699 <?php printBarGraph("toprated", "pages"); ?> 700 701 <hr /> 702 703 <!-- Zenpage news articles --> 704 <span id="news-popular"></a> 705 <?php printBarGraph("popular", "news"); ?> 706 707 <span id="news-mostcommented"></span> 708 <?php printBarGraph("mostcommented", "news"); ?> 709 710 <span id="news-mostrated"></span> 711 <?php printBarGraph("mostrated", "news"); ?> 712 713 <span id="news-toprated"></span> 714 <?php printBarGraph("toprated", "news"); ?> 715 <hr /> 716 717 <h2><?php echo gettext('Statistics for news categories'); ?></h2> 718 <span id="newscategories-popular"></span> 719 <?php printBarGraph("popular", "newscategories"); ?> 720 721 <span id="newscategories-mostarticles"></span> 722 <?php printBarGraph("mostused", "newscategories"); ?> 723 724 <h2><?php echo gettext('Statistics for RSS feeds'); ?></h2> 725 <span id="rss-popular"></span> 726 <?php printBarGraph("popular", "rss"); ?> 727 728 <?php } ?> 729 <?php 730 } 731 732// If a single list is requested 733 if (isset($_GET['type'])) { 734 if (!isset($_GET['from_number'])) { 735 $from_number = 0; 736 $from_number_display = 1; 737 } else { 738 $from_number = sanitize_numeric($_GET['from_number']) - 1; 739 $from_number_display = sanitize_numeric($_GET['from_number']); 740 } 741 if (!isset($_GET['to_number'])) { 742 $to_number = 50; 743 if ($_GET['type'] === "images" AND $to_number > $imagecount) { 744 $to_number = $imagecount; 745 } 746 if ($_GET['type'] === "albums" AND $to_number > $albumcount) { 747 $to_number = $albumcount; 748 } 749 $to_number_display = $to_number; 750 } else { 751 $to_number = sanitize_numeric($_GET['to_number']); 752 $to_number_display = $to_number; 753 if ($from_number < $to_number) { 754 $to_number_display = $to_number; 755 $to_number = $to_number - $from_number; 756 } 757 } 758 ?> 759 <form name="limit" id="limit" action="gallery_statistics.php"> 760 <label for="from_number"><?php echo gettext("From "); ?></label> 761 <input type ="text" size="10" id="from_number" name="from_number" value="<?php echo $from_number_display; ?>" /> 762 <label for="to_number"><?php echo gettext("to "); ?></label> 763 <input type ="text" size="10" id="to_number" name="to_number" value="<?php echo $to_number_display; ?>" /> 764 <input type="hidden" name="stats" value="<?php echo html_encode(sanitize($_GET['stats'])); ?>" /> 765 <input type="hidden" name="type" value="<?php echo html_encode(sanitize($_GET['type'])); ?>" /> 766 <input type="submit" value="<?php echo gettext("Show"); ?>" /> 767 </form> 768 <br /> 769 <?php 770 switch ($_GET['type']) { 771 case "albums": 772 switch ($_GET['stats']) { 773 case "latest": 774 printBarGraph("latest", "albums", $from_number, $to_number); 775 break; 776 case "latestupdated": 777 printBarGraph("latestupdated", "albums", $from_number, $to_number); 778 break; 779 case "popular": 780 printBarGraph("popular", "albums", $from_number, $to_number); 781 break; 782 case "popularimages": 783 printBarGraph("popularimages", "albums", $from_number, $to_number); 784 break; 785 case "mostrated": 786 printBarGraph("mostrated", "albums", $from_number, $to_number); 787 break; 788 case "toprated": 789 printBarGraph("toprated", "albums", $from_number, $to_number); 790 break; 791 case "mostcommented": 792 printBarGraph("mostcommented", "albums", $from_number, $to_number); 793 break; 794 case "mostimages": 795 printBarGraph("mostimages", "albums", $from_number, $to_number); 796 break; 797 } 798 break; 799 case "images": 800 switch ($_GET['stats']) { 801 case "latest": 802 printBarGraph("latest", "images", $from_number, $to_number); 803 break; 804 case "popular": 805 printBarGraph("popular", "images", $from_number, $to_number); 806 break; 807 case "mostrated": 808 printBarGraph("mostrated", "images", $from_number, $to_number); 809 break; 810 case "toprated": 811 printBarGraph("toprated", "images", $from_number, $to_number); 812 break; 813 case "mostcommented": 814 printBarGraph("mostcommented", "images", $from_number, $to_number); 815 break; 816 } 817 break; 818 case "tags": 819 printBarGraph("mostused", "tags", $from_number, $to_number); 820 break; 821 case "rss": 822 printBarGraph("popular", "rss", $from_number, $to_number); 823 break; 824 case "pages": 825 if (extensionEnabled('zenpage')) { 826 switch ($_GET['stats']) { 827 case "popular": 828 printBarGraph("popular", "pages", $from_number, $to_number); 829 break; 830 case "mostcommented": 831 printBarGraph("mostcommented", "pages", $from_number, $to_number); 832 break; 833 case "mostrated": 834 printBarGraph("mostrated", "pages", $from_number, $to_number); 835 break; 836 case "toprated": 837 printBarGraph("toprated", "pages", $from_number, $to_number); 838 break; 839 } 840 } 841 break; 842 case "news": 843 if (extensionEnabled('zenpage')) { 844 switch ($_GET['stats']) { 845 case "popular": 846 printBarGraph("popular", "news", $from_number, $to_number); 847 break; 848 case "mostcommented": 849 printBarGraph("mostcommented", "news", $from_number, $to_number); 850 break; 851 case "mostrated": 852 printBarGraph("mostrated", "news", $from_number, $to_number); 853 break; 854 case "toprated": 855 printBarGraph("toprated", "news", $from_number, $to_number); 856 break; 857 } 858 } 859 break; 860 case "newscategories": 861 if (extensionEnabled('zenpage')) { 862 switch ($_GET['stats']) { 863 case "popular": 864 printBarGraph("popular", "newscategories", $from_number, $to_number); 865 break; 866 case "mostused": 867 printBarGraph("mostused", "newscategories", $from_number, $to_number); 868 break; 869 } 870 } 871 break; 872 } // main switch end 873 echo "<a href='#top'>" . gettext("Back to top") . "</a>"; 874 } // main if end 875 ?> 876 </div> 877 </div><!-- content --> 878 <?php printAdminFooter(); ?> 879 </div><!-- main --> 880 </body> 881 <?php echo "</html>"; ?> 882