Changeset 4436
- Timestamp:
- Dec 7, 2009, 12:20:39 AM (14 years ago)
- Location:
- extensions/event_cats
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/autolog_new.inc.php
r4421 r4436 58 58 if ( 59 59 array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table']) or 60 $_POST['ec_entry_sel'] == '-1' 60 $_POST['ec_entry_sel'] == '-1' or 61 $_POST['ec_act1'] == 'delete' // occurs when last entry is deleted 61 62 ) { 62 63 switch ($_POST['ec_act1']) { … … 69 70 case 'create': 70 71 $ec_default_action = $_POST['ec_act1']; 71 $ec_default_entry = $_POST['ec_entry_sel']; 72 $ec_default_entry = $_POST['ec_entry_sel']; 73 break; 74 case 'delete': 75 $ec_default_action = 'create'; 76 $ec_default_entry = '-1'; 72 77 break; 73 78 default: -
extensions/event_cats/admin/evntcats_admin.php
r4421 r4436 325 325 // +-----------------------------------------------------------------------+ 326 326 327 check_DB(); 327 check_DB(); $ec_debug['ec_exist_entries'] = $ec_exist_entries; 328 328 329 329 if ( … … 331 331 read_ec_conf('dup_allow') != '2' 332 332 ) $page['tab'] = 'config'; 333 334 if (!$ec_exist_entries and $page['tab'] == 'autolog_entries') $page['tab'] = 335 (read_ec_conf('dup_allow') == '2' and $dup_entries_exist) ? 336 'duplication' : 'autolog_new'; 333 337 334 338 $tabsheet = new tabsheet(); -
extensions/event_cats/include/evntcats_admin_funcs.inc.php
r4421 r4436 100 100 // $_POST it uses, have already been checked. 101 101 102 // Check if a category id has been posted, and if yes if this category is103 // private.104 /* $cat_assoc_needed = (105 ); */106 107 // Check if an add. p. id has been posted, and if yes if this add. p. is108 // private.109 /* $ap_assoc_needed = (110 ); */111 112 102 // User creation, as generic 113 103 $ec_user_id = false; 114 104 $page['errors'] = register_user( 115 $_POST['login'], $_POST['password'], '', false105 $_POST['login'], $_POST['password'], '', false 116 106 ); 117 107 if ( … … 135 125 $page['errors'][] = sprintf(l10n('ec_user_generic_pb'), $_POST['login']); 136 126 137 // New group creation if required, 138 // and association with user_idat the same time127 // New group creation if required, and association with user_id, and if 128 // needed category or add. p., at the same time 139 129 if ( 140 130 isset($_POST['ec_in_up_newgroup']) and … … 153 143 "))) and 154 144 $t2++ == 0 // The check is executed twice at maximum 155 ) // Cannot be executed twice145 ) 156 146 $t4 = pwg_query(" 157 147 INSERT INTO `".GROUPS_TABLE."` (`name`, `is_default`) 158 148 VALUES ('".$_POST['groupname']."', 'false'); 159 "); 149 "); // Cannot be executed twice 160 150 if ($t4) 161 151 $page['infos'][] = … … 180 170 // If a category id has been posted, the newly created group must be 181 171 // allowed to navigate in this category 182 if (isset($_POST['ec_in_up_cat'])) { 172 // We are in the group creation block, thus the we know this group cannot 173 // be associated to any category 174 if ( 175 isset($_POST['ec_in_up_cat']) and 176 array_key_exists($_POST['ec_in_up_cat'], $ec_lists['categories']) 177 ) { 183 178 if (mysql_num_rows(pwg_query(" 184 179 SELECT `id` … … 208 203 ); 209 204 else 210 $page['errors'][] = 211 sprintf(l10n('ec_group_create_pb'), $_POST['groupname']).' (3) : '. 212 'MySQL error '.mysql_errno().', "'.mysql_error().'"'; 205 $page['errors'][] = sprintf( 206 l10n('ec_assoc_pb'), 207 $_POST['groupname'],$ec_lists['categories'][$_POST['ec_in_up_cat']] 208 ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"'; 213 209 } 214 210 } … … 216 212 // If an add. p. id has been posted, the newly created group must be 217 213 // allowed to navigate in this additional page 218 219 /* 220 221 222 223 224 */ 214 if ( 215 isset($_POST['ec_in_up_aps']) and 216 array_key_exists($_POST['ec_in_up_aps'], $ec_lists['add_pages']) 217 ) { 218 $granted_groups = array(); 219 $title_arr = array_from_query(" 220 SELECT `title` 221 FROM `".ADD_PAGES_TABLE."` 222 WHERE `id` = ".$_POST['ec_in_up_aps']."; 223 ", 'title'); 224 $t_user = (is_in($title_arr[0], '/user_id=')) ? 225 explode('/user_id=', $title_arr[0]) : array($title_arr[0]); 226 if (is_in($t_user[0], '/group_id=')) { 227 $t_group = explode('/group_id=', $t_user[0]); 228 $granted_groups = explode(',', $t_group[1]); 229 } 230 else $t_group[0] = $t_user[0]; 231 if (!in_array($t3[0], $granted_groups)) { 232 $granted_groups[] = $t3[0]; 233 $t_group[1] = implode(',', $granted_groups); 234 $t_user[0] = implode('/group_id=', $t_group); 235 if (pwg_query(" 236 UPDATE `".ADD_PAGES_TABLE."` 237 SET `title` = '".implode('/user_id=', $t_user)."' 238 WHERE `id` = ".$_POST['ec_in_up_aps']."; 239 ") === false) 240 $page['errors'][] = sprintf( 241 l10n('ec_assoc_pb'), 242 $_POST['groupname'],$ec_lists['add_pages'][$_POST['ec_in_up_aps']] 243 ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"'; 244 else $page['infos'][] = sprintf( 245 l10n('ec_group_create_OK2'), 246 $_POST['groupname'],$ec_lists['add_pages'][$_POST['ec_in_up_aps']] 247 ); 248 } 249 } 225 250 } 226 251 else { 227 252 // If a category id has been posted, the newly created user must be 228 // allowed to navigate in this category 229 230 // If an add. p. id has been posted, the newly created user must be 231 // allowed to navigate in this additional page => not possible to 232 // allow individually => must give a warning message ? 233 253 // allowed to navigate in this category, if it is not the case yet 254 if ( 255 isset($_POST['ec_in_up_cat']) and 256 array_key_exists($_POST['ec_in_up_cat'], $ec_lists['categories']) 257 ) { 258 $private_uppercats = array_from_query(" 259 SELECT `id` 260 FROM `".CATEGORIES_TABLE."` 261 WHERE `id` IN (". 262 implode(',', get_uppercat_ids(array($_POST['ec_in_up_cat']))). 263 ") 264 AND `status` = 'private'; 265 ", 'id'); 266 // We must not reinsert already existing lines in user_access table 267 $granteds = array(); 268 foreach ($private_uppercats as $cat_id) 269 $granteds[$cat_id] = array(); 270 $result = pwg_query(" 271 SELECT `user_id`, `cat_id` 272 FROM `".USER_ACCESS_TABLE."` 273 WHERE `cat_id` IN (".implode(',', $private_uppercats).") 274 AND `user_id` = '$ec_user_id'; 275 "); 276 while ($row = mysql_fetch_array($result)) 277 $granteds[$row['cat_id']][] = $row['user_id']; 278 $inserts = array(); 279 foreach ($private_uppercats as $cat_id) 280 if (!in_array($ec_user_id, $granteds[$cat_id])) 281 $inserts[] = array( 282 'user_id' => $ec_user_id, 283 'cat_id' => $cat_id 284 ); 285 if (count($inserts) != 0) { 286 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $inserts); 287 if (mysql_errno() == 0) 288 $page['infos'][] = sprintf( 289 l10n('ec_group_create_OK2'), 290 $_POST['login'], $ec_lists['categories'][$_POST['ec_in_up_cat']] 291 ); 292 else 293 $page['errors'][] = sprintf( 294 l10n('ec_assoc_pb'), 295 $_POST['login'], $ec_lists['categories'][$_POST['ec_in_up_cat']] 296 ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"'; 297 } 298 } 299 300 // If an add. p. id has been posted, the newly created user should be 301 // allowed to navigate in this additional page => give a warning message 302 if ( 303 isset($_POST['ec_in_up_aps']) and 304 array_key_exists($_POST['ec_in_up_aps'], $ec_lists['add_pages']) 305 ) $page['errors'][] = sprintf( 306 l10n('ec_user_access_AP'), 307 $ec_lists['add_pages'][$_POST['ec_in_up_aps']], 308 $_POST['login'] 309 ); 234 310 } 235 311 return $ec_user_id; … … 294 370 */ 295 371 function ec_create_modify_entry_OK() { 296 global $page, $ec_lists , $ec_debug;372 global $page, $ec_lists; 297 373 298 374 // $_POST validity checks : action prevented in case of bad arguments … … 476 552 $arg2p = ($arg2 == 'NULL') ? 'IS NULL' : ' = '.$arg2; 477 553 $ec_user_idp = ($ec_user_id == 'NULL') ? 'IS NULL' : ' = '.$ec_user_id; 478 if (($t1 = mysql_fetch_row(pwg_query(// $q = 479 " 554 if (($t1 = mysql_fetch_row(pwg_query(" 480 555 SELECT `id` 481 556 FROM `".EVNTCATS_TABLE."` … … 510 585 return false; 511 586 } 512 513 $ec_debug[] = array(514 'del_other' => $del_other,515 'code' => $ec_code,516 'user_id' => $ec_user_id,517 'user_idp' => $ec_user_idp,518 'action' => $action,519 'arg1' => $arg1,520 'arg2' => $arg2,521 'arg1p' => $arg1p,522 'arg2p' => $arg2p,523 'forced' => $forced,524 'comment' => $comment,525 );526 587 527 588 // Action ! … … 554 615 $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced'); 555 616 $page['infos'][] = 556 sprintf(l10n('ec_entry_create_OK'), mysql_insert_id()). ' : '.617 sprintf(l10n('ec_entry_create_OK'), mysql_insert_id()). 557 618 $ec_code.' => '. 558 619 $ec_lists['user_ids'][$ec_user_id].$forced … … 600 661 function ec_delete_entry_OK($ec_id) { 601 662 global $page; 663 if (count($t = mysql_fetch_row(pwg_query(" 664 SELECT `code` 665 FROM `".EVNTCATS_TABLE."` 666 WHERE `id` = $ec_id; 667 "))) == 0) { 668 $page['errors'][] = sprintf(l10n('ec_entry_dont_exist'), $ec_id); 669 return false; 670 } 602 671 if (pwg_query(" 603 672 DELETE FROM `".EVNTCATS_TABLE."` … … 610 679 return false; 611 680 } 612 else $page['infos'][] = sprintf(l10n('ec_entry_del_ok'), $ec_id);681 $page['infos'][] = sprintf(l10n('ec_entry_del_ok'), $ec_id, $t[0]); 613 682 return true; 614 683 } -
extensions/event_cats/include/evntcats_main_funcs.inc.php
r4421 r4436 187 187 function build_ec_addp() { 188 188 global $ec_lists; 189 $ec_lists['add_pages'] = array(); 189 190 if (defined('ADD_PAGES_TABLE')) { 190 $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`"); 191 while ($r = mysql_fetch_assoc($res)) { 192 $c = (is_in($r['title'], '/user_id=')) ? '/user_id=' : '/group_id='; 193 $a = explode($c ,$r['title']); 194 $ec_lists['add_pages'][$r['id']] = $a[0]; 191 $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`;"); 192 while ($r = mysql_fetch_array($res)) { 193 $a = (is_in($r['title'], '/user_id=')) ? 194 explode('/user_id=' , $r['title']) : array($r['title']); 195 $b = (is_in($a[0], '/group_id=')) ? 196 explode('/group_id=' , $a[0]) : $a; 197 $ec_lists['add_pages'][$r['id']] = $b[0]; 195 198 } 196 199 } … … 209 212 function build_ec_categories($dsp) { 210 213 global $template, $ec_lists; 214 $ec_lists['categories'] = array(); 211 215 $c = array(); 212 216 display_select_cat_wrapper(" … … 228 232 function build_ec_userids() { 229 233 global $ec_lists, $conf; 234 $ec_lists['user_ids'] = array(); 230 235 $ec_lists['user_ids'] = simple_hash_from_query(" 231 236 SELECT … … 252 257 global $ec_lists; 253 258 259 $ec_lists['ec_table'] = array(); 254 260 $q = pwg_query(" 255 SELECT * FROM `".EVNTCATS_TABLE."` 261 SELECT * 262 FROM `".EVNTCATS_TABLE."` 256 263 WHERE `code` IS NOT NULL 257 264 ORDER BY `id` -
extensions/event_cats/language/fr_FR/plugin.lang.php
r4421 r4436 142 142 143 143 // Infos 144 $lang['ec_user_create_OK'] = 'Création utilisateur %s';144 $lang['ec_user_create_OK'] = 'Création utilisateur "%s"'; 145 145 $lang['ec_user_generic_OK'] = 'Utilisateur "%s" générique'; 146 $lang['ec_group_create_OK'] = 'Création groupe %s'; 147 $lang['ec_group_create_OK2'] = '%1$s associé à %2$s'; 148 // %1$s : username ; %2$s : group 149 $lang['ec_entry_create_OK'] = 'Création entrée %s'; 146 $lang['ec_group_create_OK'] = 'Création groupe "%s"'; 147 $lang['ec_group_create_OK2'] = '"%1$s" associé à "%2$s"'; 148 $lang['ec_entry_create_OK'] = 'Création entrée : %s'; 150 149 $lang['ec_cnfrm_forced'] = ' (affichage forcé)'; 151 $lang['ec_entry_modify_OK'] = 'Modification entrée %s';152 $lang['ec_entry_del_ok'] = 'Entrée % ssupprimée.';150 $lang['ec_entry_modify_OK'] = 'Modification entrée "%s"'; 151 $lang['ec_entry_del_ok'] = 'Entrée %1$s ("%2$s") supprimée.'; 153 152 $lang['ec_config_saved'] = 'Configuration sauvegardée'; 154 153 // Errors … … 159 158 $lang['ec_image_miss'] = 'image inexistante (probablement supprimée)'; 160 159 $lang['ec_add_page_miss'] = 'page Additional Pages inexistante (probablement supprimée)'; 161 $lang['ec_entry_del_nok'] = 'Problème avec suppression entrée %s: ';160 $lang['ec_entry_del_nok'] = 'Problème avec suppression entrée "%s" : '; 162 161 $lang['ec_user_create_pb'] = 'Création nouvel utilisateur impossible'; 163 $lang['ec_user_generic_pb'] = 'Problème passage générique utilisateur %s'; 164 $lang['ec_group_create_pb'] = 'Création groupe %s impossible'; 162 $lang['ec_user_generic_pb'] = 'Problème passage générique utilisateur "%s"'; 163 $lang['ec_group_create_pb'] = 'Création groupe "%s" impossible'; 164 $lang['ec_user_access_AP'] = 'Attention à ce que la page "%1$s" soit autorisée pour l\'utilisateur "%2$s".'; 165 165 $lang['ec_entry_create_pb'] = 'Création entrée impossible'; 166 $lang['ec_entry_already_exists'] = 'Entrée %s déjà existante'; 167 $lang['ec_DB_problem'] = 'Problème d\'accès à la base (n°%s) : '; 166 $lang['ec_entry_already_exists'] = 'Entrée "%s" existe déjà avec exactement la même configuration'; 167 $lang['ec_entry_dont_exist'] = 'Entrée %s inexistante'; 168 $lang['ec_assoc_pb'] = 'Association "%1$s" à "%2$s" impossible'; 169 $lang['ec_DB_problem'] = 'Problème d\'accès à la base (position %s) : '; 168 170 169 171 // Entries table -
extensions/event_cats/maintain.inc.php
r4421 r4436 68 68 ) 69 69 DEFAULT CHARACTER SET utf8 70 TYPE=MyISAM;70 ENGINE=MyISAM; 71 71 ") !== false); 72 72
Note: See TracChangeset
for help on using the changeset viewer.