source: extensions/event_cats/admin/autolog_new.inc.php @ 4048

Last change on this file since 4048 was 4048, checked in by LucMorizur, 15 years ago

[Event Cats] Mainly add header & footer, add choose new/old code

File size: 5.3 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,
41 $ec_lists,   // array of following arrays :
42              //   $ec_lists['ec_table'] :
43              //     Event Cats table, in function of each entry id
44              //   $ec_lists['ec_codes'] : // Used ?
45              //     array of useful data, in function of entries codes
46              //   $ec_lists['add_pages'] :
47              //     array of Add. Pages names in function of their id
48              //   $ec_lists['categories'] :
49              //     array of category names in function of their id
50              //   $ec_lists['user_ids'] :
51              //     array of usernames in function of their id
52 $ec_ap_ok;   // whether Additional Pages is installed and activated
53
54/****************************************************************************/
55
56build_ec_lists(); // in evntcats_funcs.php
57
58$ec_lists['duplicable_codes'] = array();
59$t = array();
60
61foreach ($ec_lists['ec_table'] as $ec_entry) {
62  if (
63    is_in($ec_entry['action'], 'ec_ok') and
64    !is_in($ec_entry['action'], '_f_pb') and
65    $ec_entry['forced'] == 'false'
66  ) {
67    $t[$ec_entry['id']] = $ec_entry['code'];
68    $ec_lists['duplicable_codes'][$ec_entry['code']]['id'] =
69     $ec_entry['id'];
70    $ec_lists['duplicable_codes'][$ec_entry['code']]['user_id'] =
71     $ec_entry['user_id'];
72  }
73}
74foreach ($t as $ec_id => $ec_code) {
75  $ec_lists['duplicable_codes']['ids'][$ec_id] =
76   $ec_lists['duplicable_codes'][$ec_code]['id'];
77}
78
79$ec_def_vals = array();
80
81$ec_default_action = 'create';
82$ec_def_auto_code_dg_nb = read_ec_conf('auto_code_dg_nb');
83
84/*****************************************************************************
85* $_GET and $_POST analysis.                                                 *
86*****************************************************************************/
87
88if (isset($_POST['ec_act1']) and $_POST['ec_act1'] == 'duplicate_entry') {
89  if (isset($_POST['ec_entry_sel'])) {
90    if (array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table']))
91     $ec_default_action = $_POST['ec_entry_sel'];
92    else
93     $page['errors'][] = 'Tentative de duplication d\'une entrée inexistante';
94  }
95  else {
96    $page['errors'][] = 'Tentative de duplication sans entrée';
97  }
98}
99
100/****************************************************************************/
101
102$template->assign('ec_ap_ok',$ec_ap_ok);
103$template->assign('ec_lists',$ec_lists);
104$template->assign('ec_hidden_when_no_code',
105  (count($ec_lists['duplicable_codes']) == 0) ? 'style = "display:none;"' : ''
106);
107$template->assign('ec_hidden_when_no_user',
108  (count($ec_lists['user_ids']) == 0) ? 'style = "display:none;"' : ''
109);
110$template->assign('ec_default_action',$ec_default_action);
111$template->assign('ec_def_auto_code_dg_nb',$ec_def_auto_code_dg_nb);
112
113?>
Note: See TracBrowser for help on using the repository browser.