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 | |
---|
38 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
39 | |
---|
40 | global $template, $conf, $page, $ec_lists, $ec_conf_possible_values; |
---|
41 | |
---|
42 | /****************************************************************************/ |
---|
43 | |
---|
44 | build_ec_duplicable_codes(); |
---|
45 | |
---|
46 | $ec_default_action = ($page['tab'] == 'autolog_modif') ? |
---|
47 | 'modify_entry_ask' : 'create_ask'; |
---|
48 | $ec_default_entry = '-1'; |
---|
49 | $ec_def_auto_code_dg_nb = read_ec_conf('auto_code_dg_nb'); |
---|
50 | |
---|
51 | /***************************************************************************** |
---|
52 | * $_GET and $_POST analysis. * |
---|
53 | *****************************************************************************/ |
---|
54 | |
---|
55 | if (isset($_POST['ec_act1']) and isset($_POST['ec_entry_sel'])) { |
---|
56 | if ( |
---|
57 | array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table']) or |
---|
58 | $_POST['ec_entry_sel'] == '-1' |
---|
59 | ) { |
---|
60 | switch ($_POST['ec_act1']) { |
---|
61 | case 'duplicate_entry_submit': // submit failed |
---|
62 | case 'modify_entry_submit': // submit failed |
---|
63 | case 'duplicate_entry_ask': |
---|
64 | case 'modify_entry_ask': |
---|
65 | case 'create_ask': |
---|
66 | case 'disable': |
---|
67 | case 'create': |
---|
68 | $ec_default_action = $_POST['ec_act1']; |
---|
69 | $ec_default_entry = $_POST['ec_entry_sel']; |
---|
70 | break; |
---|
71 | default: |
---|
72 | $page['errors'][] = |
---|
73 | 'Bad argument : $_POST[\'ec_act1\'] = '.$_POST['ec_act1']; |
---|
74 | } |
---|
75 | } |
---|
76 | else |
---|
77 | $page['errors'][] = |
---|
78 | 'Entry doesn\'t exist ($_POST[\'ec_entry_sel\'] = '. |
---|
79 | $_POST['ec_entry_sel'].')'; |
---|
80 | } |
---|
81 | |
---|
82 | /****************************************************************************/ |
---|
83 | |
---|
84 | if ($ec_is_creation = ( |
---|
85 | $ec_default_action == 'duplicate_entry_submit' or |
---|
86 | $ec_default_action == 'duplicate_entry_ask' or |
---|
87 | $ec_default_action == 'create_ask' or |
---|
88 | $ec_default_action == 'create' |
---|
89 | )) |
---|
90 | $template->assign('U_HELP', get_root_url().'popuphelp.php?page=ec_help_new'); |
---|
91 | else |
---|
92 | $template->assign('U_HELP', get_root_url().'popuphelp.php?page=ec_help_mod'); |
---|
93 | |
---|
94 | $template->assign('ec_hidden_when_no_code', |
---|
95 | (count($ec_lists['duplicable_codes']) == 0) ? 'style = "display:none;"' : '' |
---|
96 | ); |
---|
97 | $template->assign('ec_hidden_when_no_user', |
---|
98 | (count($ec_lists['user_ids']) == 0) ? 'style = "display:none;"' : '' |
---|
99 | ); |
---|
100 | $template->assign('ec_no_assoc', ((mysql_num_rows(pwg_query(" |
---|
101 | SELECT * |
---|
102 | FROM `".IMAGE_CATEGORY_TABLE."` |
---|
103 | "))) == 0)); |
---|
104 | $template->assign('ec_is_creation', $ec_is_creation); |
---|
105 | $template->assign('ec_ap_ok', EC_AP_OK); |
---|
106 | $template->assign('ec_lists', $ec_lists); |
---|
107 | $template->assign('ec_default_entry', $ec_default_entry); |
---|
108 | $template->assign('ec_default_action', $ec_default_action); |
---|
109 | $template->assign('ec_def_auto_code_dg_nb', $ec_def_auto_code_dg_nb); |
---|
110 | $template->assign('ec_auto_code_dg_nb', |
---|
111 | $ec_conf_possible_values['auto_code_dg_nb']); |
---|
112 | |
---|
113 | ?> |
---|