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 | |
---|
21 | defined('FACEBOOKPLUG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR); |
---|
22 | |
---|
23 | $view_version = (isset($_GET['v']) ? $_GET['v'] : FBP_VERSION); |
---|
24 | $max_group_rows = (isset($_GET['mgr']) ? $_GET['mgr'] : 10); |
---|
25 | |
---|
26 | $max_history_rows = (isset($_GET['mhr']) ? $_GET['mhr'] : 1000); |
---|
27 | $history_filter = (isset($_GET['hf']) ? $_GET['hf'] : 'do_upload_photo'); |
---|
28 | |
---|
29 | ?> |
---|
30 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
---|
31 | <html> |
---|
32 | <head> |
---|
33 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
34 | <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script> |
---|
35 | </head> |
---|
36 | <body> |
---|
37 | <h1>Stats</h1> |
---|
38 | <table> |
---|
39 | <tr> |
---|
40 | <th>Caption</th> |
---|
41 | <th>Count</th> |
---|
42 | </tr> |
---|
43 | <?php |
---|
44 | |
---|
45 | $queries = array( |
---|
46 | "select 'Uploaded photos' Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'do_upload_photo';", |
---|
47 | "select 'Upload photo requests' Caption, count(*) C from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = 'upload_photo';", |
---|
48 | "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).";", |
---|
49 | "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).";", |
---|
50 | ); |
---|
51 | |
---|
52 | foreach ($queries as $query) |
---|
53 | { |
---|
54 | $result = fbp_db_query($query); |
---|
55 | |
---|
56 | while ($row = mysql_fetch_assoc($result)) |
---|
57 | { |
---|
58 | echo ' |
---|
59 | <tr> |
---|
60 | <td>'.$row['Caption'].'</td> |
---|
61 | <td>'.$row['C'].'</td> |
---|
62 | </tr> |
---|
63 | '; |
---|
64 | } |
---|
65 | } |
---|
66 | ?> |
---|
67 | </table> |
---|
68 | <h1>History</h1> |
---|
69 | <table> |
---|
70 | <tr> |
---|
71 | <th>ID</th> |
---|
72 | <th>Date/Time</th> |
---|
73 | <th>Image</th> |
---|
74 | <th>Gallery</th> |
---|
75 | </tr> |
---|
76 | <?php |
---|
77 | $result = fbp_db_query("select * from FBP_HISTORY where VERSION = '".mysql_real_escape_string($view_version)."' and SCRIPT_NAME = '".mysql_real_escape_string($history_filter)."' order by ID desc limit 0 , ".mysql_real_escape_string($max_history_rows).";"); |
---|
78 | |
---|
79 | // Mettre le count et le titre de l'image |
---|
80 | //~ echo mysql_num_rows($result).' uploaded photos'; |
---|
81 | |
---|
82 | while ($row = mysql_fetch_assoc($result)) |
---|
83 | { |
---|
84 | echo ' |
---|
85 | <tr> |
---|
86 | <td>'.$row['ID'].'</td> |
---|
87 | <td>'.$row['TIMESTAMP'].'</td> |
---|
88 | <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> |
---|
89 | <td>'.$row['GALLERY_TITLE'].'</td> |
---|
90 | </tr> |
---|
91 | '; |
---|
92 | } |
---|
93 | ?> |
---|
94 | </table> |
---|
95 | </center> |
---|
96 | </body> |
---|
97 | </html> |
---|