assign('EVNTCATS_VERSION', EVNTCATS_INFO_VERSION); $me = get_plugin_data($plugin_id); $template->clear_assign('ec_infos'); $template->append('head_elements', '' ); if (!isset($ec_debug)) $ec_debug = array(); // +-----------------------------------------------------------------------+ // | $_POST analysis, to determine which tab to display (tabsheet prep.) // +-----------------------------------------------------------------------+ // If needed, stores in the DB the new value of the number of digits of // automatically created codes if ( isset($_POST['ec_in_up_auto_code_length']) and $_POST['ec_in_up_auto_code_length'] != read_ec_conf('auto_code_dg_nb') ) change_ec_conf('auto_code_dg_nb', $_POST['ec_in_up_auto_code_length']); // If needed, stores in the DB that acknowledgement message has been displayed if ($ec_howto = (read_ec_conf('howto') == '0')) change_ec_conf('howto', '1'); // If needed, stores in the DB whether help banner must be displayed or not if ( isset($_POST['ec_help_banner_onoff2']) and $_POST['ec_help_banner_onoff2'] != read_ec_conf('in_help_display') ) change_ec_conf('in_help_display', $_POST['ec_help_banner_onoff2']); build_ec_lists(); // in evntcats_main_funcs.php $dup_types_exist = false; $dup_entries_exist = false; $ec_exist_entries = false; function check_DB() { global $dup_types_exist, $dup_entries_exist, $ec_exist_entries, $ec_lists; $dup_types_exist = build_dup_groups(); // build_dup_groups() returns // true if an entry exists for duplication management for types // both arrays below are built when executing build_dup_groups() function $dup_entries_exist = ( $dup_types_exist or count($ec_lists['groups_granted_ids']) > 0 or count($ec_lists['users_granted_direct_ids']) > 0 ); $ec_exist_entries = (mysql_num_rows(pwg_query(" SELECT * FROM `".EVNTCATS_TABLE."` WHERE `code` IS NOT NULL ; ")) != 0); } check_DB(); // If no entry exist, default tab is 'autolog_new'. $page['tab'] = (!$ec_exist_entries) ? 'autolog_new' : 'autolog_entries'; // If no entry exist, but some duplication management entries exist, and // duplication setting is "managed per groups", default tab is 'duplication' if ( !$ec_exist_entries and read_ec_conf('dup_allow') == '2' and $dup_entries_exist ) $page['tab'] = 'duplication'; // If a modification of duplication management has been posted, default tab // is 'duplication'. if ( count($_POST) > 0 and count(array_intersect(array( 'ec_duplic_conf_submit', 'deny_groups_submit', 'grant_groups_submit', 'deny_types_submit', 'grant_types_submit', 'deny_users_submit', 'grant_users_submit', ), array_keys($_POST))) > 0 ) $page['tab'] = 'duplication'; if (isset($_POST['ec_conf_submit'])) { if (isset($_POST['ec_dup_conf'])) if (!change_ec_conf('dup_allow', $_POST['ec_dup_conf'])) ec_end2(7); if (isset($_POST['ec_dup_disp'])) if (!change_ec_conf('duplic_display', $_POST['ec_dup_disp'])) ec_end2(8); if (isset($_POST['ec_unknown'])) if (!change_ec_conf('unknown_code', $_POST['ec_unknown'])) ec_end2(9); if (isset($_POST['ec_in_up_aps'])) if (!change_ec_conf('unknown_code_ap_id', $_POST['ec_in_up_aps'])) ec_end2(10); if (isset($_POST['ec_comments'])) if (!change_ec_conf('comment_display', $_POST['ec_comments'])) ec_end2(11); if (isset($_POST['ec_connection'])) if (!change_ec_conf('display_connection', $_POST['ec_connection'])) ec_end2(12); $page['tab'] = 'config'; $page['infos'][] = l10n('ec_config_saved'); } elseif (isset($_POST['ec_duplic_conf_submit'])) { if (isset($_POST['ec_dup_conf'])) { if ( read_ec_conf('dup_allow') == '2' and $_POST['ec_dup_conf'] != '2' ) $page['tab'] = 'config'; if (!change_ec_conf('dup_allow', $_POST['ec_dup_conf'])) ec_end2(5); } if (isset($_POST['ec_dup_disp'])) if (!change_ec_conf('duplic_display', $_POST['ec_dup_disp'])) ec_end2(6); $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['deny_groups_submit']) and isset($_POST['deny_groups']) and count($_POST['deny_groups']) > 0 ) { if (pwg_query(" DELETE FROM `".EVNTCATS_TABLE."` WHERE `arg1` = 1 AND `arg2` IN (".implode(',', $_POST['deny_groups'])."); ") === false) ec_end2(1); else $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['grant_groups_submit']) and isset($_POST['grant_groups']) and count($_POST['grant_groups']) > 0 ) { $inserts = array(); foreach ($_POST['grant_groups'] as $v) $inserts[] = array( 'arg1' => 1, 'arg2' => intval($v) ); mass_inserts(EVNTCATS_TABLE, array('arg1', 'arg2'), $inserts); $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['deny_types_submit']) and ( isset($_POST['deny_types']) and count($_POST['deny_types']) > 0 or isset($_POST['deny_generic']) ) ) { $c = $ec_lists['types_granted']; if (isset($_POST['deny_types'])) foreach ($_POST['deny_types'] as $v) $c = $c & ~intval($v); if (isset($_POST['deny_generic'])) $c = $c & 7; $q = ($dup_types_exist) ? " UPDATE `".EVNTCATS_TABLE."` SET `arg2` = $c WHERE `arg1` = 3 AND `code` IS NULL LIMIT 1 ; " : " INSERT INTO `".EVNTCATS_TABLE."` (`arg1`, `arg2`) VALUES (3, $c); "; if (pwg_query($q) === false) ec_end2(3); else $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['grant_types_submit']) and ( isset($_POST['grant_types']) and count($_POST['grant_types']) > 0 or isset($_POST['grant_generic']) ) ) { $c = $ec_lists['types_granted']; if (isset($_POST['grant_types'])) foreach ($_POST['grant_types'] as $v) $c = $c | intval($v); if (isset($_POST['grant_generic'])) $c = $c | 8; $q = ($dup_types_exist) ? " UPDATE `".EVNTCATS_TABLE."` SET `arg2` = $c WHERE `arg1` = 3 AND `code` IS NULL LIMIT 1 ; " : " INSERT INTO `".EVNTCATS_TABLE."` (`arg1`, `arg2`) VALUES (3, $c); "; if (pwg_query($q) === false) ec_end2(4); else $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['deny_users_submit']) and isset($_POST['deny_users']) and count($_POST['deny_users']) > 0 ) { if (pwg_query(" DELETE FROM `".EVNTCATS_TABLE."` WHERE `arg1` = 2 AND `arg2` IN (".implode(',', $_POST['deny_users'])."); ") === false) ec_end2(2); else $page['infos'][] = l10n('ec_config_saved'); } elseif ( isset($_POST['grant_users_submit']) and isset($_POST['grant_users']) and count($_POST['grant_users']) > 0 ) { $inserts = array(); foreach ($_POST['grant_users'] as $v) $inserts[] = array( 'arg1' => 2, 'arg2' => intval($v) ); mass_inserts(EVNTCATS_TABLE, array('arg1', 'arg2'), $inserts); $page['infos'][] = l10n('ec_config_saved'); } elseif (isset($_POST['ec_act1'])) { if ( $_POST['ec_act1'] == 'disable' and count($ec_lists['add_pages']) == 0 ) { $_POST['ec_act1'] = 'modify_entry_submit'; $_POST['ec_input_action'] = 'refused'; } if ( $_POST['ec_act1'] == 'duplicate_entry_ask' or $_POST['ec_act1'] == 'create_ask' ) $page['tab'] = 'autolog_new'; elseif ( $_POST['ec_act1'] == 'disable' or $_POST['ec_act1'] == 'modify_entry_ask' ) $page['tab'] = 'autolog_modif'; elseif ($_POST['ec_act1'] == 'create') $page['tab'] = (ec_create_modify_entry_OK()) ? 'autolog_entries' : 'autolog_new'; elseif ( isset($_POST['ec_entry_sel']) and is_numeric($_POST['ec_entry_sel']) ) { if ($_POST['ec_act1'] == 'duplicate_entry_submit') $page['tab'] = (ec_create_modify_entry_OK()) ? 'autolog_entries' : 'autolog_new'; elseif ($_POST['ec_act1'] == 'modify_entry_submit') $page['tab'] = (ec_create_modify_entry_OK()) ? 'autolog_entries' : 'autolog_modif'; else { $page['tab'] = 'autolog_entries'; if ($_POST['ec_act1'] == 'delete') { if (isset($_POST['ec_entry_sel'])) { ec_delete_entry_OK($_POST['ec_entry_sel']); build_ec_table(); } else ec_end1('ec_entry_sel', 'Bad argument : '); } else if ($_POST['ec_act1'] == 'toggle_forced') ec_create_modify_entry_OK(); } } } else { if (isset($_GET['tab'])) switch ($_GET['tab']) { case 'autolog_modif': if ($ec_exist_entries) $page['tab'] = $_GET['tab']; break; case 'duplication': if (read_ec_conf('dup_allow') == '2') $page['tab'] = $_GET['tab']; break; case 'autolog_new': case 'config': $page['tab'] = $_GET['tab']; break; } } // +-----------------------------------------------------------------------+ // | Tabsheet // +-----------------------------------------------------------------------+ check_DB(); if ( $page['tab'] == 'duplication' and read_ec_conf('dup_allow') != '2' ) $page['tab'] = 'config'; if (!$ec_exist_entries and $page['tab'] == 'autolog_entries') $page['tab'] = (read_ec_conf('dup_allow') == '2' and $dup_entries_exist) ? 'duplication' : 'autolog_new'; $tabsheet = new tabsheet(); if ($ec_exist_entries) { $tabsheet->add('autolog_entries', l10n('ec_tab_autoid_entries'), $my_base_url.'&tab=autolog_entries'); $tabsheet->add('autolog_modif', l10n('ec_tab_autoid_modif'), $my_base_url.'&tab=autolog_modif'); } $tabsheet->add('autolog_new', l10n('ec_tab_autoid_new'), $my_base_url.'&tab=autolog_new'); if (read_ec_conf('dup_allow') == '2') $tabsheet->add('duplication', l10n('ec_tab_duplication'), $my_base_url.'&tab=duplication'); $tabsheet->add('config', l10n('ec_tab_config'), $my_base_url.'&tab=config'); $template->assign('EVNTCATS_URLS', array( 'ROOT' => EVNTCATS_PATH, )); /****************************************************************************/ $ec_file = ($page['tab'] == 'autolog_modif') ? 'autolog_new' : $page['tab']; include(EVNTCATS_PATH.'admin/'.$ec_file.'.inc.php'); $tabsheet->select($page['tab']); $tabsheet->assign(); /* print '
'; //print_r('ROOT_URL : '.ROOT_URL.''; */ $template->assign( 'HeaderIncTPL', realpath('plugins/event_cats/admin/template/header.inc.tpl') ); $template->assign( 'FooterIncTPL', realpath('plugins/event_cats/admin/template/footer.inc.tpl') ); $template->assign( 'ec_howto', ($ec_howto and (count($page['errors']) == 0 and count($page['infos']) == 0)) ); $template->assign( 'ec_help_banner_OK', (read_ec_conf('in_help_display') == '1') ); $template->assign('EVNTCATS_PATH', EVNTCATS_PATH); $template->assign('RACINE_URL', ROOT_URL); $template->assign('U_HELP', get_root_url().'popuphelp.php?page=help'); if (isset($conf['ec_debug1']) and $conf['ec_debug1']) $template->assign('ec_debug1', array( 'POST' => str_from_var($_POST), 'ec_debug' => (isset($ec_debug)) ? str_from_var($ec_debug) : '(unset)', 'GET' => str_from_var($_GET), 'page' => str_from_var($page), 'ec_conf' => str_from_var($ec_conf), 'ec_lists' => (isset($ec_lists)) ? str_from_var($ec_lists) : '(unset)', 'code_list' => (isset($code_list)) ? str_from_var($code_list) : '(unset)', )); $template->set_filenames(array( 'evntcats_admin_content' => dirname(__FILE__).'/template/'.$ec_file.'.tpl' )); $template->assign_var_from_handle('ADMIN_CONTENT','evntcats_admin_content'); ?>
EVNTCATS_PATH : '.EVNTCATS_PATH); print('ROOT_URL + ... : '.preg_match('/(\d+\.\d+)\.(\d+)/', PHPWG_VERSION, $matches)); print('
'); print_r($matches); print '