[4002] | 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 | // +-----------------------------------------------------------------------+ |
---|
[3999] | 15 | |
---|
[4002] | 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 | // +-----------------------------------------------------------------------+ |
---|
[3999] | 37 | |
---|
[4421] | 38 | // Keeps file coded in UTF-8 without BOM : é |
---|
| 39 | |
---|
[4002] | 40 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
[3999] | 41 | |
---|
[4329] | 42 | global $template, $conf, $page, $ec_lists, $ec_conf_possible_values; |
---|
[3999] | 43 | |
---|
[4002] | 44 | /****************************************************************************/ |
---|
[3999] | 45 | |
---|
[4115] | 46 | build_ec_duplicable_codes(); |
---|
[3999] | 47 | |
---|
[4157] | 48 | $ec_default_action = ($page['tab'] == 'autolog_modif') ? |
---|
| 49 | 'modify_entry_ask' : 'create_ask'; |
---|
[4058] | 50 | $ec_default_entry = '-1'; |
---|
[4048] | 51 | $ec_def_auto_code_dg_nb = read_ec_conf('auto_code_dg_nb'); |
---|
[4027] | 52 | |
---|
[4002] | 53 | /***************************************************************************** |
---|
| 54 | * $_GET and $_POST analysis. * |
---|
| 55 | *****************************************************************************/ |
---|
[3999] | 56 | |
---|
[4058] | 57 | if (isset($_POST['ec_act1']) and isset($_POST['ec_entry_sel'])) { |
---|
| 58 | if ( |
---|
| 59 | array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table']) or |
---|
[4436] | 60 | $_POST['ec_entry_sel'] == '-1' or |
---|
| 61 | $_POST['ec_act1'] == 'delete' // occurs when last entry is deleted |
---|
[4058] | 62 | ) { |
---|
| 63 | switch ($_POST['ec_act1']) { |
---|
[4092] | 64 | case 'duplicate_entry_submit': // submit failed |
---|
| 65 | case 'modify_entry_submit': // submit failed |
---|
[4058] | 66 | case 'duplicate_entry_ask': |
---|
| 67 | case 'modify_entry_ask': |
---|
[4092] | 68 | case 'create_ask': |
---|
[4058] | 69 | case 'disable': |
---|
| 70 | case 'create': |
---|
| 71 | $ec_default_action = $_POST['ec_act1']; |
---|
[4436] | 72 | $ec_default_entry = $_POST['ec_entry_sel']; |
---|
[4058] | 73 | break; |
---|
[4436] | 74 | case 'delete': |
---|
| 75 | $ec_default_action = 'create'; |
---|
| 76 | $ec_default_entry = '-1'; |
---|
| 77 | break; |
---|
[4058] | 78 | default: |
---|
[4329] | 79 | $page['errors'][] = |
---|
| 80 | 'Bad argument : $_POST[\'ec_act1\'] = '.$_POST['ec_act1']; |
---|
[4058] | 81 | } |
---|
[4011] | 82 | } |
---|
[4058] | 83 | else |
---|
[4329] | 84 | $page['errors'][] = |
---|
| 85 | 'Entry doesn\'t exist ($_POST[\'ec_entry_sel\'] = '. |
---|
| 86 | $_POST['ec_entry_sel'].')'; |
---|
[4011] | 87 | } |
---|
| 88 | |
---|
[4002] | 89 | /****************************************************************************/ |
---|
[3999] | 90 | |
---|
[4440] | 91 | $template->assign('ec_is_creation', $ec_is_creation = ( |
---|
[4336] | 92 | $ec_default_action == 'duplicate_entry_submit' or |
---|
| 93 | $ec_default_action == 'duplicate_entry_ask' or |
---|
| 94 | $ec_default_action == 'create_ask' or |
---|
| 95 | $ec_default_action == 'create' |
---|
[4375] | 96 | )); |
---|
[4336] | 97 | |
---|
[4440] | 98 | if ($ec_is_creation) { |
---|
| 99 | $template->assign('ec_help_banner1', l10n('ec_help_banner1_new_c')); |
---|
| 100 | $template->assign('ec_help_banner2', l10n('ec_help_banner2_new_c')); |
---|
| 101 | } |
---|
| 102 | else { |
---|
| 103 | $template->assign('ec_help_banner1', l10n('ec_help_banner1_new_m')); |
---|
| 104 | $template->assign('ec_help_banner2', l10n('ec_help_banner2_new_m')); |
---|
| 105 | } |
---|
| 106 | |
---|
[4048] | 107 | $template->assign('ec_hidden_when_no_code', |
---|
| 108 | (count($ec_lists['duplicable_codes']) == 0) ? 'style = "display:none;"' : '' |
---|
| 109 | ); |
---|
| 110 | $template->assign('ec_hidden_when_no_user', |
---|
| 111 | (count($ec_lists['user_ids']) == 0) ? 'style = "display:none;"' : '' |
---|
| 112 | ); |
---|
[4329] | 113 | $template->assign('ec_no_assoc', ((mysql_num_rows(pwg_query(" |
---|
[4157] | 114 | SELECT * |
---|
[4329] | 115 | FROM `".IMAGE_CATEGORY_TABLE."` |
---|
| 116 | "))) == 0)); |
---|
[4342] | 117 | $template->assign('ec_ap_ok', defined('ADD_PAGES_TABLE')); |
---|
[4157] | 118 | $template->assign('ec_lists', $ec_lists); |
---|
| 119 | $template->assign('ec_default_entry', $ec_default_entry); |
---|
| 120 | $template->assign('ec_default_action', $ec_default_action); |
---|
| 121 | $template->assign('ec_def_auto_code_dg_nb', $ec_def_auto_code_dg_nb); |
---|
[4329] | 122 | $template->assign('ec_auto_code_dg_nb', |
---|
| 123 | $ec_conf_possible_values['auto_code_dg_nb']); |
---|
[3999] | 124 | |
---|
[4002] | 125 | ?> |
---|