- Timestamp:
- Nov 2, 2009, 10:46:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.