Changeset 4173
- Timestamp:
- Nov 2, 2009, 10:46:10 PM (15 years ago)
- Location:
- extensions/event_cats
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/autolog_new.inc.php
r4171 r4173 110 110 $template->assign('ec_ap_ok', $ec_ap_ok); 111 111 $template->assign('ec_lists', $ec_lists); 112 $template->assign('cat_display', (read_ec_conf('cat_display') == '0'));113 112 $template->assign('ec_default_entry', $ec_default_entry); 114 113 $template->assign('ec_default_action', $ec_default_action); -
extensions/event_cats/admin/template/autolog_new.js
r4171 r4173 7 7 var ec_flag1 = false; 8 8 var ec_flag2 = false; 9 var cat_display = false;10 9 var ec_dont_check = false; 11 10 var ec_selected_old_group = false; … … 445 444 d.ec_new_code.ec_in_up_cat.selectedIndex 446 445 ].label; 447 if (cat_display) ec_new_user_text =446 /* if (cat_display) ec_new_user_text = 448 447 (ec_reg_cat2.test(ec_cat_sel)) ? 449 448 ec_reg_cat1.exec(ec_cat_sel)[1] : ec_cat_sel; 450 else ec_new_user_text = ec_reg_cat3.exec(ec_cat_sel)[1];449 else */ ec_new_user_text = ec_reg_cat3.exec(ec_cat_sel)[1]; 451 450 ec_new_user_text = ec_new_user_text.replace(/\s/g, '_'); 452 451 ec_new_user_text = ec_new_user_text.substr(0, 32); -
extensions/event_cats/admin/template/autolog_new.tpl
r4171 r4173 267 267 <script type = "text/javascript"><!-- 268 268 ec_is_creation = {if $ec_is_creation}true{else}false{/if}; 269 cat_display = {if $cat_display}true{else}false{/if};270 269 ec_up_code_lbl_forced_txt = "{'ec_up_code_lbl_forced'|@translate}"; 271 270 ec_JS_message['ec_gen_user_act_miss'] = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}"; -
extensions/event_cats/include/ec_conf.inc.php
r4171 r4173 33 33 _ the number of digits when creating a new code automatically 34 34 ($ec_conf[2] <=> read_ec_conf('auto_code_dg_nb')) ; 35 _ whether categories are displayed "cat / under_cat / ..." or36 "cat <CR LF> - under_cat <CR LF> - ..." ($ec_conf[3] <=>37 read_ec_conf(' cat_display')) ;35 _ ----------------------------------------------------------- 36 --------------------------------------- ( $ec_conf[3] <=> 37 read_ec_conf('') ) ; 38 38 _ whether the "how to" banner has already been displayed or not 39 39 ($ec_conf[4] <=> read_ec_conf('howto')) ; … … 47 47 *****************************************************************************/ 48 48 49 global $ec_conf ;49 global $ec_conf, $page; 50 50 51 51 // $ec_conf initalization / check … … 54 54 FROM `".CONFIG_TABLE."` 55 55 WHERE `param` = 'event_cats'; 56 "))) { 57 $ec_conf = explode(',' , $t[0]); 58 } 56 "))) $ec_conf = explode(',' , $t[0]); 59 57 else { 60 58 $ec_conf = explode(',' , '0,1,10,0,0,0,0'); 61 change_ec_conf('activated', 0); 59 if (!change_ec_conf('activated', 0)) 60 $page['errors'][] = 'Error updating $ec_conf'; 62 61 } 63 62 … … 74 73 */ 75 74 function change_ec_conf($c, $v) { 76 global $ec_conf ;75 global $ec_conf, $page; 77 76 switch ($c) { 78 77 case 'activated': … … 84 83 case 'auto_code_dg_nb': 85 84 $ec_conf[2] = $v; 86 break; 85 break; /* 87 86 case 'cat_display': 88 87 $ec_conf[3] = $v; 89 break; 88 break; */ 90 89 case 'howto': 91 90 $ec_conf[4] = $v; … … 97 96 $ec_conf[6] = $v; 98 97 break; 99 default: return false; 98 default: 99 $page['errors'][] = 'Bad change_ec_conf argument'; 100 return false; 100 101 } 101 return pwg_query("102 return (pwg_query(" 102 103 UPDATE `".CONFIG_TABLE."` 103 104 SET `value` = '".implode(',', $ec_conf)."' 104 105 WHERE `param` = 'event_cats'; 105 ") ;106 ") !== false); 106 107 } 107 108 … … 116 117 */ 117 118 function read_ec_conf($c) { 118 global $ec_conf ;119 global $ec_conf, $page; 119 120 switch ($c) { 120 121 case 'activated' : return $ec_conf[0]; 121 122 case 'dup_allow' : return $ec_conf[1]; 122 case 'auto_code_dg_nb' : return $ec_conf[2]; 123 case 'cat_display' : return $ec_conf[3]; 123 case 'auto_code_dg_nb' : return $ec_conf[2]; /* 124 case 'cat_display' : return $ec_conf[3]; */ 124 125 case 'howto' : return $ec_conf[4]; 125 126 case 'unknown_code' : return $ec_conf[5]; 126 127 case 'unknown_code_ap_id': return $ec_conf[6]; 127 default : return false; 128 default: 129 $page['errors'][] = 'Bad read_ec_conf argument'; 130 return false; 128 131 } 129 132 } -
extensions/event_cats/include/evntcats_admin_funcs.inc.php
r4169 r4173 92 92 */ 93 93 function build_ec_duplicable_codes() { 94 global $ec_lists ;94 global $ec_lists, $template; 95 95 $ec_lists['duplicable_codes'] = array(); 96 96 $t = array(); … … 111 111 $ec_lists['duplicable_codes']['codes'][$ec_code]['id']; 112 112 } 113 114 // Builds a category list displayed a best way 115 build_ec_categories(false); 113 116 } 114 117 … … 148 151 ) 149 152 153 ( 154 [ec_act1] => create 155 [ec_entry_sel] => -1 156 [ec_sel_code] => new 157 [ec_in_up_auto_code_length] => 10 158 [ec_in_up_code] => NU1pah0qVJ 159 [ec_in_up_usr_txt] => 160 [ec_in_up_psd_txt] => 161 [ec_in_up_grp_txt] => 162 [ec_sel_user] => old 163 [ec_in_up_usr_list] => 9 164 [ec_input_action] => cat 165 [ec_in_up_cat] => 6 166 [ec_in_up_img] => 167 ) 168 150 169 */ 151 /* foreach ($ec_lists['ec_table'] as $ec_entry) { 152 if ($_POST['ec_in_up_code'] == $ec_entry['code']) 153 return ec_end1('ec_in_up_code', 'ec_bad_argument2'); 154 } 155 if ($t1 = (in_array($_POST['ec_in_up_usr_txt'], $ec_lists['user_ids']))) 156 $ec_user_id = $_POST['ec_in_up_usr_txt']; 170 // $_POST validity checks : creation prevented in case of bad arguments 171 /* if ( 172 !isset($_POST['ec_in_up_code']) or 173 !ereg('^[a-zA-Z0-9_-]{4,32}$', $_POST['ec_in_up_code']) 174 ) return ec_end1('ec_in_up_code', 'ec_bad_argument7'); 175 176 foreach ($ec_lists['ec_table'] as $ec_entry) 177 if ($_POST['ec_in_up_code'] == $ec_entry['code']) 178 return ec_end1('ec_in_up_code', 'ec_bad_argument2'); 179 180 if ( 181 !isset($_POST['ec_sel_user']) or ( 182 $_POST['ec_sel_user'] != 'new' and 183 $_POST['ec_sel_user'] != 'old' 184 ) 185 ) return ec_end1('ec_sel_user', 'ec_bad_argument1'); 186 157 187 if ($_POST['ec_sel_user'] == 'new') { 188 if ( 189 !isset($_POST['ec_in_up_usr_txt']) or 190 $_POST['ec_in_up_usr_txt'] == '' 191 ) return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument1'); 192 $t1 = (in_array($_POST['ec_in_up_usr_txt'], $ec_lists['user_ids'])); 158 193 if ($t1) return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument3'); 159 else { // New user account creation 160 $page['errors'] = register_user( 161 $_POST['ec_in_up_usr_txt'], $_POST['ec_in_up_psd_txt'], '', false 162 ); 194 } 195 else { 196 if (!isset($_POST['ec_in_up_usr_list'])) 197 return ec_end1('ec_in_up_usr_txt', 'ec_bad_argument1'); 198 $ec_user_id = $_POST['ec_in_up_usr_list']; 199 $t1 = (array_key_exists($ec_user_id, $ec_lists['user_ids'])); 200 if (!$t1) return ec_end1('ec_in_up_usr_list', 'ec_bad_argument6'); 201 } 202 203 // code and user_id (if needed) are OK, creation can be done 204 if ($_POST['ec_sel_user'] == 'new') { 205 $page['errors'] = register_user( 206 $_POST['ec_in_up_usr_txt'], $_POST['ec_in_up_psd_txt'], '', false 207 ); 208 if ( 209 count($page['errors']) != 0 or 210 !($ec_user_id = get_userid($_POST['ec_in_up_usr_txt'])) or 211 !pwg_query(" 212 UPDATE `".USER_INFOS_TABLE."` 213 SET `status` = 'generic' 214 WHERE `user_id` = ".$ec_user_id."; 215 ") 216 ) { 217 array_unshift($page['errors'], l10n('ec_user_create_pb')); 218 return false; 219 } 220 else $page['infos'][] = l10n('ec_user_create_OK').$ec_user_id; 221 if ( 222 isset($_POST['ec_in_up_newgroup']) and 223 isset($_POST['ec_in_up_grp_txt']) and 224 $_POST['ec_in_up_grp_txt'] != '' 225 ) { // New group creation, and association with user_id at the same time 163 226 if ( 164 count($page['errors']) != 0 or 165 !($ec_user_id = get_userid($_POST['ec_in_up_usr_txt'])) or 166 !pwg_query(" 167 UPDATE `".USER_INFOS_TABLE."` 168 SET `status` = 'generic' 169 WHERE `user_id` = ".$ec_user_id."; 170 ") 227 !($t = mysql_fetch_row(pwg_query(" 228 SELECT `id` 229 FROM `".GROUPS_TABLE."` 230 WHERE `name` = '".$_POST['ec_in_up_grp_txt']."'; 231 "))) 171 232 ) { 172 array_unshift($page['errors'], l10n('ec_user_create_pb')); 173 return false; 174 } 175 if ( 176 isset($_POST['ec_in_up_newgroup']) and 177 isset($_POST['ec_in_up_grp_txt']) and 178 $_POST['ec_in_up_grp_txt'] != '' 179 ) { // New group creation, and association with user_id at the same time 233 if ( 234 !pwg_query(" 235 INSERT INTO `".GROUPS_TABLE."` (`name`, `is_default`) 236 VALUES ('".$_POST['ec_in_up_grp_txt']."', 'false'); 237 ") 238 ) return ec_end2('ec_group_create_pb', '1'); 180 239 if ( 181 240 !($t = mysql_fetch_row(pwg_query(" … … 184 243 WHERE `name` = '".$_POST['ec_in_up_grp_txt']."'; 185 244 "))) 186 ) { 187 if ( 188 !pwg_query(" 189 INSERT INTO `".GROUPS_TABLE."` (`name`, `is_default`) 190 VALUES ('".$_POST['ec_in_up_grp_txt']."', 'false'); 191 ") 192 ) return ec_end2('ec_group_create_pb', '1'); 193 if ( 194 !($t = mysql_fetch_row(pwg_query(" 195 SELECT `id` 196 FROM `".GROUPS_TABLE."` 197 WHERE `name` = '".$_POST['ec_in_up_grp_txt']."'; 198 "))) 199 ) return ec_end2('ec_group_create_pb', '2'); 200 } 201 if ( 202 !(pwg_query(" 203 INSERT INTO `".USER_GROUP_TABLE."` (`user_id `, `group_id`) 204 VALUES ('".$ec_user_id."', '".$t['id']."'); 205 ")) 206 ) return ec_end2('ec_group_create_pb', '3'); 245 ) return ec_end2('ec_group_create_pb', '2'); 207 246 } 247 if ( 248 !(pwg_query(" 249 INSERT INTO `".USER_GROUP_TABLE."` (`user_id `, `group_id`) 250 VALUES ('".$ec_user_id."', '".$t['id']."'); 251 ")) 252 ) return ec_end2('ec_group_create_pb', '3'); 208 253 } 209 254 } 210 255 else { 211 256 if ($t1) { 212 if (ereg('^[a-zA-Z0-9_-]{4,32}$',$_POST['ec_in_up_code'])) { 213 $arg1 = ''; $arg2 = ''; 214 switch ($_POST['ec_input_action']) { 215 // case 'home': // Home : nothing to do : "arg"s are '' 216 case 'add_p': // Additional Page 217 break; 218 case 'cat': // Category 219 case 'img': // Image 220 break; 221 default : return ec_end1('ec_input_action', 'ec_bad_argument1'); 222 } 257 258 $arg1 = ''; $arg2 = ''; 259 switch ($_POST['ec_input_action']) { 260 // case 'home': // Home : nothing to do : "arg"s are '' 261 case 'add_p': // Additional Page 262 break; 263 case 'cat': // Category 264 case 'img': // Image 265 break; 266 default : return ec_end1('ec_input_action', 'ec_bad_argument1'); 223 267 } 268 224 269 else return ec_end1('ec_in_up_code', 'ec_bad_argument7'); 225 270 } -
extensions/event_cats/include/evntcats_main_funcs.inc.php
r4171 r4173 162 162 163 163 /* 164 * build_ec_categories($dsp) 165 * builds $ec_lists['categories']. 166 * 167 * @param 168 * whether $ec_lists['categories'] must be of type "cat / sub-cat" or 169 * or "cat <CR LF> - sub-cat". 170 * @return 171 * (no return value) 172 */ 173 function build_ec_categories($dsp) { 174 global $template, $ec_lists; 175 $c = array(); 176 display_select_cat_wrapper(' 177 SELECT id,name,uppercats,global_rank 178 FROM '.CATEGORIES_TABLE, 179 $c, 'category_options', $dsp); 180 $ec_lists['categories'] = $template->smarty->_tpl_vars['category_options']; 181 } 182 183 /* 164 184 * build_ec_table() 165 185 * builds a table showing the content of the <pwg>_event_cats database table, … … 326 346 327 347 // Construction of $ec_lists['categories'] array var 328 $c = array(); 329 display_select_cat_wrapper(' 330 SELECT id,name,uppercats,global_rank 331 FROM '.CATEGORIES_TABLE, 332 $c, 'category_options', (read_ec_conf('cat_display') == '0')); 333 $ec_lists['categories'] = $template->smarty->_tpl_vars['category_options']; 348 build_ec_categories(true); 334 349 335 350 // Construction of $ec_lists['user_ids'] array var -
extensions/event_cats/language/fr_FR/plugin.lang.php
r4171 r4173 113 113 $lang['ec_entry_dis_nok_end3'] = ' (arg1 = NULL)'; 114 114 $lang['ec_user_create_pb'] = 'Création nouvel utilisateur impossible'; 115 $lang['ec_user_create_OK'] = 'Création utilisateur '; 115 116 $lang['ec_group_create_pb'] = 'Création nouveau groupe impossible : '; 116 117 $lang['ec_bad_argument1'] = 'Mauvais argument : ';
Note: See TracChangeset
for help on using the changeset viewer.