source: extensions/FacebookPlug/Server/trunk/admin/view_list.php @ 8548

Last change on this file since 8548 was 8548, checked in by rub, 13 years ago

Add info on wiew_list

  • Property svn:eol-style set to LF
File size: 4.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | FacebookPlug - a Piwigo Plugin                                        |
4// | Copyright (C) 2010-2011 Ruben ARNAUD - rub@piwigo.org                 |
5// +-----------------------------------------------------------------------+
6// | This program is free software; you can redistribute it and/or modify  |
7// | it under the terms of the GNU General Public License as published by  |
8// | the Free Software Foundation                                          |
9// |                                                                       |
10// | This program is distributed in the hope that it will be useful, but   |
11// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13// | General Public License for more details.                              |
14// |                                                                       |
15// | You should have received a copy of the GNU General Public License     |
16// | along with this program; if not, write to the Free Software           |
17// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18// | USA.                                                                  |
19// +-----------------------------------------------------------------------+
20
21defined('FACEBOOKPLUG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR);
22
23$view_version = (isset($_GET['v']) ? $_GET['v'] : FBP_VERSION);
24$max_rows = (isset($_GET['r']) ? $_GET['mr'] : 1000);
25$max_group_rows = (isset($_GET['r']) ? $_GET['mgr'] : 10);
26
27?>
28<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
29<html>
30<head>
31  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
32  <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
33</head>
34<body>
35  <h1>Stats</h1>
36  <table>
37    <tr>
38      <th>Caption</th>
39      <th>Count</th>
40    </tr>
41<?php
42
43$queries =  array(
44  "select 'Uploaded photos' Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'do_upload_photo';",
45  "select 'Upload photo requests' Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'upload_photo';",
46  "select concat('Uploaded photos ', date_format(TIMESTAMP, '%Y%m%d')) Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'do_upload_photo' group by date_format(TIMESTAMP, '%Y%m%d') order by date_format(TIMESTAMP, '%Y%m%d') desc limit 0 , ".mysql_real_escape_string($max_group_rows).";",
47  "select concat('Upload photo requests ', date_format(TIMESTAMP, '%Y%m%d')) Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'upload_photo' group by date_format(TIMESTAMP, '%Y%m%d') desc limit 0 , ".mysql_real_escape_string($max_group_rows).";",
48);
49
50foreach ($queries as $query)
51{
52  $result = fbp_db_query($query);
53
54  while ($row = mysql_fetch_assoc($result))
55  {
56    echo '
57        <tr>
58          <td>'.$row['Caption'].'</td>
59          <td>'.$row['C'].'</td>
60        </tr>
61  ';
62  }
63}
64?>
65  </table>
66  <h1>History</h1>
67  <table>
68    <tr>
69      <th>ID</th>
70      <th>Date/Time</th>
71      <th>Image</th>
72      <th>Gallery</th>
73    </tr>
74<?php
75$result = fbp_db_query("select * from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'do_upload_photo' order by ID desc limit 0 , ".mysql_real_escape_string($max_rows).";");
76
77// Mettre le count et le titre de l'image
78//~ echo  mysql_num_rows($result).' uploaded photos';
79
80while ($row = mysql_fetch_assoc($result))
81{
82  echo '
83    <tr>
84      <td>'.$row['ID'].'</td>
85      <td>'.$row['TIMESTAMP'].'</td>
86      <td><a href="'.$row['PICTURE_URL'].'" onclick="window.open(this.href); return false;"><img src="'.$row['IMAGE_URL'].'" title="'.$row['PICTURE_TITLE'].'" style="height:75px"></a></td>
87      <td>'.$row['GALLERY_TITLE'].'</td>
88    </tr>
89';
90}
91?>
92    </table>
93  </center>
94</body>
95</html>
Note: See TracBrowser for help on using the repository browser.