source: extensions/event_cats/admin/evntcats_admin.php @ 4026

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

[Event Cats] Continue $_POST analysis

File size: 6.6 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, $lang, $test1, $prefixeTable, $ec_err, $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
54load_language('plugin.lang', EVNTCATS_PATH);
55
56include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
57include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
58include_once(PHPWG_ROOT_PATH.'include/functions_url.inc.php');
59include_once(EVNTCATS_PATH.'include/evntcats_funcs.inc.php');
60$my_base_url = get_admin_plugin_menu_link(__FILE__);
61
62$template->assign('EVNTCATS_VERSION', EVNTCATS_INFO_VERSION);
63$me = get_plugin_data($plugin_id);
64$template->clear_assign('ec_infos');
65$template->append('head_elements',
66  '<link rel="stylesheet" type="text/css" href="'.
67  EVNTCATS_PATH.'admin/evntcats_theme.css">'
68);
69
70// +-----------------------------------------------------------------------+
71// |                            Tabsheet
72// +-----------------------------------------------------------------------+
73
74$page['tab'] = (!($ec_exist_entries = (mysql_fetch_row(pwg_query('
75  SELECT * FROM `'.EVNTCATS_TABLE.'`
76  WHERE `code` IS NOT NULL
77'))))) ? 'autolog_new' : 'autolog_entries';
78if (isset($_POST['ec_act1'])) {
79  if (
80    $_POST['ec_act1'] == 'autolog_new' or
81    $_POST['ec_act1'] == 'duplicate_entry'
82  )
83   $page['tab'] = 'autolog_new';
84  elseif ($_POST['ec_act1'] == 'create')
85   $page['tab'] = (ec_create_entry_OK()) ? 'autolog_entries' : 'autolog_new';
86  elseif (is_numeric($_POST['ec_act1'])) // Entry duplication : $_POST['ec_act1'] is entry #
87   $page['tab'] = (ec_duplicate_entry_OK()) ? 'autolog_entries' : 'autolog_new';
88}
89else if (isset($_GET['tab'])) switch ($_GET['tab']) {
90  case 'autolog_new':
91  case 'duplication':
92  case 'config':
93   $page['tab'] = $_GET['tab'];
94}
95
96$tabsheet = new tabsheet();
97if ($ec_exist_entries) $tabsheet->add('autolog_entries',
98               l10n('ec_tab_autoid_entries'),
99               $my_base_url.'&amp;tab=autolog_entries');
100$tabsheet->add('autolog_new',
101               l10n('ec_tab_autoid_new'),
102               $my_base_url.'&amp;tab=autolog_new');
103$tabsheet->add('duplication',
104               l10n('ec_tab_duplication'),
105               $my_base_url.'&amp;tab=duplication');
106$tabsheet->add('config',
107               l10n('ec_tab_config'),
108               $my_base_url.'&amp;tab=config');
109
110$template->assign(
111 array('U_HELP' => get_root_url().'popuphelp.php?page=event_cats'));
112
113$template->assign('EVNTCATS_URLS', array (
114 'ROOT'     => EVNTCATS_PATH,
115));
116
117/****************************************************************************/
118
119include(EVNTCATS_PATH.'admin/'.$page['tab'].'.inc.php');
120
121$tabsheet->select($page['tab']);
122$tabsheet->assign();
123
124/*
125print '<pre>';
126//print_r('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
127print('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
128print '</pre>';
129*/
130
131$template->assign('ec_howto', (count($page['errors']) == 0 and count($page['infos']) == 0));
132
133$template->assign('EVNTCATS_PATH',EVNTCATS_PATH);
134$template->assign('RACINE_URL',ROOT_URL);
135
136$template->assign('GET',str_from_var($_GET));
137$template->assign('POST',str_from_var($_POST));
138$template->assign('test1tpl',str_from_var($ec_lists));
139$template->assign('test2tpl',str_from_var($page['errors']));
140if (isset($code_list)) $template->assign('test3tpl',str_from_var($code_list));
141
142$template->set_filenames(array('evntcats_admin_content' => dirname(__FILE__).'/template/'.$page['tab'].'.tpl'));
143$template->assign_var_from_handle('ADMIN_CONTENT','evntcats_admin_content');
144?>
Note: See TracBrowser for help on using the repository browser.