source: extensions/delete_hit_rate/admin.php @ 31763

Last change on this file since 31763 was 31436, checked in by ddtddt, 9 years ago

[extensions] - delete_hit_rate - update design

File size: 3.3 KB
Line 
1<?php
2
3// +-----------------------------------------------------------------------+
4// | Delete Hit/Rate plugin for piwigo                                     |
5// +-----------------------------------------------------------------------+
6// | Copyright(C) 2011-2016 ddtddt               http://temmii.com/piwigo/ |
7// +-----------------------------------------------------------------------+
8// | This program is free software; you can redistribute it and/or modify  |
9// | it under the terms of the GNU General Public License as published by  |
10// | the Free Software Foundation                                          |
11// |                                                                       |
12// | This program is distributed in the hope that it will be useful, but   |
13// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
14// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
15// | General Public License for more details.                              |
16// |                                                                       |
17// | You should have received a copy of the GNU General Public License     |
18// | along with this program; if not, write to the Free Software           |
19// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
20// | USA.                                                                  |
21// +-----------------------------------------------------------------------+
22
23if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
24global $template, $conf, $user;
25include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
26load_language('plugin.lang', PDHR_PATH);
27$my_base_url = get_admin_plugin_menu_link(__FILE__);
28
29// +-----------------------------------------------------------------------+
30// | Check Access and exit when user status is not ok                      |
31// +-----------------------------------------------------------------------+
32check_status(ACCESS_ADMINISTRATOR);
33
34//-------------------------------------------------------- sections definitions
35
36
37
38// Gestion des onglets
39if (!isset($_GET['tab']))
40    $page['tab'] = 'pdhr';
41else
42    $page['tab'] = $_GET['tab'];
43
44    $tabsheet = new tabsheet();
45    $tabsheet->add('pdhr', l10n('Purge All'), PDHR_ADMIN . '-pdhr');
46    $tabsheet->select($page['tab']);
47    $tabsheet->assign();
48
49// Onglet gestion par photo
50switch ($page['tab'])
51{
52 case 'pdhr':
53  $admin_base_url = PDHR_ADMIN . '-pdhr';
54  $template->assign(
55    'gestion',
56    array(
57                'U_DELETEHIT' => $admin_base_url . '&amp;deletehit',
58                'U_DELETERATE' => $admin_base_url . '&amp;deleterate',
59   ));
60
61if (isset($_GET['deletehit'])) {
62        $query = 'UPDATE ' . IMAGES_TABLE . ' SET hit= \'0\';';
63    pwg_query($query);
64        $_SESSION['page_infos'] = array(l10n('Hit purge completed successfully'));
65        redirect($admin_base_url);
66}
67
68if (isset($_GET['deleterate'])) {
69        $query = 'UPDATE ' . IMAGES_TABLE . ' SET rating_score= \'NULL\';';
70        $result = pwg_query($query);
71
72        $query = 'TRUNCATE ' . RATE_TABLE . ';';
73        $result = pwg_query($query);
74    pwg_query($query);
75        $_SESSION['page_infos'] = array(l10n('Rate purge completed successfully'));
76        redirect($admin_base_url);
77} 
78 break;
79} 
80
81$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
82$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
83?>
Note: See TracBrowser for help on using the repository browser.