source: extensions/event_cats/admin/autolog_entries.inc.php @ 4336

Last change on this file since 4336 was 4336, checked in by LucMorizur, 14 years ago

[Event Cats] Head to different help files from different tabs

File size: 8.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Plugin Name : Event Cats                                              |
4// | Plugin Version : 1.0                                                  |
5// | File Version : 1.0                                                    |
6// | Plugin Version author : LucMorizur                                    |
7// | Plugin description : (plugin for Piwigo, http://piwigo.org )          |
8// | This plugin allows an account to be automatically logged in ; and to  |
9// | let users duplicate the account they are logged with, to get benefits |
10// | of the groups of the previous account, immediately on their new acc.  |
11// | Ce plugin permet d'identifier automatiquement un compte ; et permet à |
12// | un utilisateur de dupliquer un compte, pour que le nouveau compte     |
13// | bénéficie immédiatement de l'affectation aux groupes de l'ancien cpte |
14// +-----------------------------------------------------------------------+
15
16// +-----------------------------------------------------------------------+
17// | Piwigo - a PHP based picture gallery                                  |
18// +-----------------------------------------------------------------------+
19// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
20// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
21// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
22// +-----------------------------------------------------------------------+
23// | This program is free software; you can redistribute it and/or modify  |
24// | it under the terms of the GNU General Public License as published by  |
25// | the Free Software Foundation                                          |
26// |                                                                       |
27// | This program is distributed in the hope that it will be useful, but   |
28// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
29// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
30// | General Public License for more details.                              |
31// |                                                                       |
32// | You should have received a copy of the GNU General Public License     |
33// | along with this program; if not, write to the Free Software           |
34// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
35// | USA.                                                                  |
36// +-----------------------------------------------------------------------+
37
38if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
39
40global $template, $conf, $page, $ec_lists;
41
42/****************************************************************************/
43
44$code_list = array();
45
46/****************************************************************
47* Construction of array var to be transmitted to tpl file,      *
48* containing all infos to be displayed in the code array table. *
49****************************************************************/
50
51$span_err_pre = '<span style = "color: red; font-weight: bold;">';
52$span_err_end = '</span>';
53
54foreach ($ec_lists['ec_table'] as $ec_entry) {
55   
56  $a = NULL;
57  $dspl     = '';
58  $url_end  = '';
59  $i        = intval($ec_entry['id']);
60  $arg1     = $ec_entry['arg1'];
61  $arg1_int = intval($arg1);
62  $arg2     = $ec_entry['arg2'];
63  $arg2_int = intval($arg2);
64  $log_OK   = is_in($ec_entry['action'], 'ec_ok');
65 
66  // No specific need for "code" displaying
67 
68  // "username" displaying
69  $username = ($log_OK) ?
70   $ec_lists['user_ids'][intval($ec_entry['user_id'])] : '';
71 
72  // No specific need for "action" displaying
73 
74  // "displayed page" : # of the AP, or of the category...
75  switch ($ec_entry['action']) {
76   
77    case 'ec_ok' :
78    case 'ec_ok_img_pb' :
79      $a = 0;
80      if (!empty($ec_entry['arg1'])) $a++;
81      if (!empty($ec_entry['arg2'])) $a+= 2;
82      switch ($a) {
83        case 0: // Home
84          $dspl = l10n('Home');
85        break;
86        case 1: // Category
87        case 3: // Image
88          $url_end = ($ec_entry['forced'] == 'true') ? '' : '&amp;cat='.$arg1;
89          $dspl = sprintf(
90            l10n('ec_dspl_ok_cat'), $arg1, $ec_lists['categories'][$arg1_int]
91          );
92          if (is_in($ec_entry['action'], '_img_pb')) {
93            $url_end.= ($url_end == '') ? '' : '&amp;img='.$arg2;
94            $page['errors'][] = 
95             $ec_entry['code'].' : '.l10n('ec_image_miss');
96            $dspl.=
97             '<br>'.$span_err_pre.
98             sprintf(l10n('ec_dspl_nok_img2'), $arg2, $arg1).
99             $span_err_end
100            ;
101          }
102          elseif ($a == 3) { // Image
103            $url_end.= ($url_end == '') ? '' : '&amp;img='.$arg2;
104            $t = mysql_fetch_row(pwg_query("
105             SELECT `name`, `file`
106             FROM `".IMAGES_TABLE."`
107             WHERE `id` = $arg2
108            "));
109            $dspl.= '<br>'.
110             sprintf(l10n('ec_dspl_ok_img2'), $arg2, $t[0], $t[1]);
111          }
112        break;
113        case 2: // Additional Page
114          $url_end = ($ec_entry['forced'] == 'true') ? '' : '&amp;ap='.$arg2;
115          $dspl = (EC_AP_OK) ? sprintf(
116            l10n('ec_dspl_ok_ap'),
117            $arg2, $ec_lists['add_pages'][$arg2_int]
118          ) : l10n('Home');
119        break;
120      }
121    break;
122   
123    case 'ec_nok' :
124      if (empty($ec_entry['arg2'])) {
125        $dspl = l10n('Access denied');
126      }
127      else {
128        $dspl = (EC_AP_OK) ? sprintf(
129            l10n('ec_dspl_ok_ap'),
130            $arg2, $ec_lists['add_pages'][$arg2_int]
131          ) : l10n('Access denied');
132      }
133    break;
134   
135    case 'ec_nok_ap_pb' : // No need to check here if Additional Pages is
136    case 'ec_ok_ap_pb' :  // active : we can arrive here only when it is.
137      $page['errors'][] = 
138       $ec_entry['code'].' : '.l10n('ec_add_page_miss');
139      if (is_in($ec_entry['action'], 'ec_ok')) {
140        $url_end = ($ec_entry['forced'] == 'true') ? '' : '&amp;ap='.$arg2;
141        $dspl = l10n('Home');
142      }
143      else {
144        $dspl = l10n('Access denied');
145      }
146      $dspl.=
147       $span_err_pre.
148       sprintf(l10n('ec_dspl_nok_ap'), $arg2).
149       $span_err_end
150      ;
151    break;
152   
153    case 'ec_ok_cat_pb' :
154      $url_end = ($ec_entry['forced'] == 'true') ? '' : '&amp;cat='.$arg1;
155      $page['errors'][] = 
156       $ec_entry['code'].' : '.l10n('ec_category_miss');
157      $dspl =
158       l10n('Home').
159       $span_err_pre.
160       sprintf(l10n('ec_dspl_nok_cat'), $arg1).
161       $span_err_end
162      ;
163    break;
164   
165    case 'ec_nok_action_pb' :
166      $page['errors'][$ec_entry['code']] = 
167       $ec_entry['code'].' : '.l10n('ec_action_pb');
168      $username =
169       $span_err_pre.
170       l10n('ec_dspl_nok_actn').
171       $span_err_end
172      ;
173      $dspl = l10n('Home');
174    break;
175   
176    case 'ec_nok_userid_pb' :
177      $page['errors'][$ec_entry['code']] = 
178       $ec_entry['code'].' : '.l10n('ec_username_pb');
179      $username =
180       $span_err_pre.
181       l10n('ec_dspl_usr_pb').
182       $span_err_end
183      ;
184      $dspl = l10n('Home');
185    break;
186   
187    case 'ec_nok_userid_miss' :
188      $page['errors'][$ec_entry['code']] = 
189       $ec_entry['code'].' : '.l10n('ec_username_miss');
190      $username =
191       $span_err_pre.
192       sprintf(l10n('ec_dspl_nok_usr'), $ec_entry['user_id']).
193       $span_err_end
194      ;
195      $dspl = l10n('Home');
196    break;
197  }
198 
199  // construction of $code_URL
200  $code_URL =
201   ROOT_URL.
202   'index.php?autolog='.
203   $ec_entry['code'].
204   $url_end
205  ;
206 
207  $code_list[$i] = array(
208   'id'       => $i,
209   'Code'     => (isset($page['errors'][$ec_entry['code']])) ?
210    $span_err_pre.$ec_entry['code'].$span_err_end : $ec_entry['code'],
211   'Username' => $username,
212   'Action'   => (is_in($ec_entry['action'], 'ec_nok_')) ?
213    $span_err_pre.l10n($ec_entry['action']).$span_err_end :
214    l10n($ec_entry['action']),
215   'Arg1'     => $dspl,
216   'Forced'   => $ec_entry['forced'],
217   'code_URL' => $code_URL,
218   'log_OK'   => $log_OK,
219  );
220}
221
222$template->assign('ec_ap_ok',  EC_AP_OK);
223$template->assign('ec_ap_ok2', (count($ec_lists['add_pages']) > 0));
224$template->assign('code_list', $code_list);
225$template->assign('U_HELP', get_root_url().'popuphelp.php?page=ec_help_ent');
226
227?>
Note: See TracBrowser for help on using the repository browser.