Changeset 4276 for extensions/event_cats/include
- Timestamp:
- Nov 16, 2009, 1:26:06 AM (14 years ago)
- Location:
- extensions/event_cats/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/include/evntcats_admin_funcs.inc.php
r4221 r4276 376 376 " 377 377 SELECT `id` 378 FROM `".EVNTCATS_ TABLE."`378 FROM `".EVNTCATS_AUTOLOG_TABLE."` 379 379 WHERE `code` = '".$ec_code."' 380 380 AND `user_id` ".$ec_user_idp." … … 393 393 $t1 = mysql_fetch_row(pwg_query(" 394 394 SELECT `code` 395 FROM `".EVNTCATS_ TABLE."`395 FROM `".EVNTCATS_AUTOLOG_TABLE."` 396 396 WHERE `id` = ".$_POST['ec_entry_sel'] 397 397 ))) === false … … 399 399 $r = pwg_query(" 400 400 SELECT `id` 401 FROM `".EVNTCATS_ TABLE."`401 FROM `".EVNTCATS_AUTOLOG_TABLE."` 402 402 WHERE `code` = '".$t1[0]."' 403 403 AND `id` <> ".$_POST['ec_entry_sel'] … … 425 425 if ( 426 426 pwg_query(" 427 INSERT INTO `".EVNTCATS_ TABLE."` (427 INSERT INTO `".EVNTCATS_AUTOLOG_TABLE."` ( 428 428 `code`, 429 429 `user_id`, … … 459 459 if ( 460 460 pwg_query(" 461 UPDATE `".EVNTCATS_ TABLE."`461 UPDATE `".EVNTCATS_AUTOLOG_TABLE."` 462 462 SET 463 463 `user_id` = ".$ec_user_id.", … … 493 493 global $page; 494 494 if (!pwg_query(" 495 DELETE FROM `".EVNTCATS_ TABLE."`495 DELETE FROM `".EVNTCATS_AUTOLOG_TABLE."` 496 496 WHERE `id` = ".$ec_id 497 497 )) { -
extensions/event_cats/include/evntcats_main_funcs.inc.php
r4263 r4276 155 155 if ($new_action == '') { 156 156 if (!pwg_query(" 157 UPDATE `".EVNTCATS_ TABLE."`157 UPDATE `".EVNTCATS_AUTOLOG_TABLE."` 158 158 SET `forced` = 'false' 159 159 WHERE `id` = ".$ec_entry['id'] … … 247 247 248 248 $q = pwg_query(" 249 SELECT * FROM `".EVNTCATS_ TABLE."`249 SELECT * FROM `".EVNTCATS_AUTOLOG_TABLE."` 250 250 WHERE `code` IS NOT NULL 251 251 ORDER BY `id` … … 352 352 */ 353 353 function build_dup_arrays($append_tpl = false) { 354 global $template, $ec_lists, $conf , $ec_debug;354 global $template, $ec_lists, $conf; 355 355 356 356 if (count($ec_lists['user_ids']) == 0) build_ec_userids(); … … 368 368 369 369 // groups granted to duplication 370 $group _granted_ids = order_by_name(370 $groups_granted_ids = order_by_name( 371 371 array_from_query(" 372 SELECT `arg2` 373 FROM ".EVNTCATS_TABLE." 374 WHERE `code` IS NULL 375 AND `arg1` = '1' 376 AND `arg2` IS NOT NULL 372 SELECT `val` 373 FROM ".EVNTCATS_DUPLIC_TABLE." 374 WHERE `item` = 'grp' 377 375 ;", 378 ' arg2'376 'val' 379 377 ), 380 378 $groups … … 384 382 $users_granted_direct_ids = order_by_name( 385 383 array_from_query(" 386 SELECT `arg2` 387 FROM ".EVNTCATS_TABLE." 388 WHERE `code` IS NULL 389 AND `arg1` = '2' 390 AND `arg2` IS NOT NULL 384 SELECT `val` 385 FROM ".EVNTCATS_DUPLIC_TABLE." 386 WHERE `item` = 'usr' 391 387 ;", 392 ' arg2'388 'val' 393 389 ), 394 390 $ec_lists['user_ids'] … … 398 394 // certain group (in groups, level (friends, family, contacts), 399 395 // or user status (generic)) 400 $user _granted_ids = array();401 396 $users_granted_ids = array(); 397 402 398 $users_granted_thks_gen_ids = array(); 403 if ( read_ec_conf('duplic_gen') != '0') {399 if ($ec_gen_granted = (read_ec_conf('duplic_gen') != '0')) { 404 400 $users_granted_thks_gen_ids = order_by_name( 405 401 array_diff( … … 415 411 ); 416 412 foreach ($users_granted_thks_gen_ids as $user_id) 417 $user_granted_ids[$user_id] = l10n('user_status_generic'); 418 } global $ec_debug; $ec_debug['1'] = $user_granted_ids; 419 413 $users_granted_ids[$user_id] = l10n('user_status_generic'); 414 } 415 416 $types = array( 417 '1' => l10n('Level 1'), 418 '2' => l10n('Level 2'), 419 '4' => l10n('Level 4'), 420 ); 421 $types_granted_ids = array(); 420 422 $users_granted_thks_types_ids = array(); 421 423 $c = intval(read_ec_conf('duplic_type')); 422 424 if ($c != 0) { 423 $t = array(); 424 if (($c & 1) != 0) $t[] = '1'; 425 if (($c & 2) != 0) $t[] = '2'; 426 if (($c & 4) != 0) $t[] = '4'; 427 if (count($t) > 0) { 428 $types = array( 429 '1' => l10n('Level 1'), 430 '2' => l10n('Level 2'), 431 '4' => l10n('Level 4'), 432 ); 425 if (($c & 1) != 0) $types_granted_ids[] = '1'; 426 if (($c & 2) != 0) $types_granted_ids[] = '2'; 427 if (($c & 4) != 0) $types_granted_ids[] = '4'; 428 if (count($types_granted_ids) > 0) { 433 429 $user_granted_from_type = array(); 434 430 $result = pwg_query(" 435 431 SELECT `user_id`, `level` 436 432 FROM `".USER_INFOS_TABLE."` 437 WHERE `level` IN (".implode(',', $t ).");433 WHERE `level` IN (".implode(',', $types_granted_ids)."); 438 434 "); 439 435 while ($row = mysql_fetch_array($result)) { … … 459 455 foreach ($user_granted_from_type as $type_id => $type_users) { 460 456 if (in_array($user_id, $type_users)) { 461 $user _granted_ids[$user_id]= $types[$type_id];457 $users_granted_ids[$user_id]= $types[$type_id]; 462 458 break; 463 459 } 464 460 } 465 461 } 466 } $ec_debug['2'] = $user_granted_ids;462 } 467 463 468 464 $users_granted_thks_groups_ids = array(); 469 if (count($group _granted_ids) > 0) {465 if (count($groups_granted_ids) > 0) { 470 466 $granted_groups = array(); 471 467 … … 473 469 SELECT `user_id`, `group_id` 474 470 FROM `".USER_GROUP_TABLE."` 475 WHERE `group_id` IN (".implode(',', $group _granted_ids).");471 WHERE `group_id` IN (".implode(',', $groups_granted_ids)."); 476 472 "); 477 473 while ($row = mysql_fetch_array($result)) { … … 499 495 foreach ($granted_groups as $group_id => $group_users) 500 496 if (in_array($user_id, $group_users)) { 501 $user _granted_ids[$user_id]= $groups[$group_id];497 $users_granted_ids[$user_id]= $groups[$group_id]; 502 498 break; 503 499 } 504 500 505 } $ec_debug['3'] = $user_granted_ids;501 } 506 502 507 503 if ($append_tpl) { 508 $user _denied_ids = order_by_name(504 $users_denied_ids = order_by_name( 509 505 array_diff( 510 506 array_keys($ec_lists['user_ids']), … … 517 513 ); 518 514 519 foreach ($user _granted_ids as $u => $g) $template->append(515 foreach ($users_granted_ids as $u => $g) $template->append( 520 516 'user_granted_indirects', 521 517 array( … … 525 521 ); 526 522 527 $ec_debug['4'] = $user_granted_ids;528 523 $template->assign('all_groups', $groups); 529 $template->assign('group_granted_ids', $group_granted_ids); 530 $template->assign('group_denied_ids',order_by_name( 531 array_diff(array_keys($groups), $group_granted_ids), $groups 524 $template->assign('groups_granted_ids', $groups_granted_ids); 525 $template->assign('groups_denied_ids', order_by_name( 526 array_diff(array_keys($groups), $groups_granted_ids), $groups 527 )); 528 $template->assign('ec_gen_granted', $ec_gen_granted); 529 $template->assign('all_types', $types); 530 $template->assign('types_granted_ids', $types_granted_ids); 531 $template->assign('types_denied_ids', order_by_name( 532 array_diff(array_keys($types), $types_granted_ids), $types 532 533 )); 533 534 $template->assign('all_users', $ec_lists['user_ids']); 534 535 $template->assign('users_granted_direct_ids', $users_granted_direct_ids); 535 $template->assign('user _denied_ids', $user_denied_ids);536 } 537 $user_granted_ids = array_merge(538 $user_granted_ids,536 $template->assign('users_denied_ids', $users_denied_ids); 537 } 538 $users_granted_ids = array_merge( 539 array_keys($users_granted_ids), 539 540 $users_granted_direct_ids 540 ); 541 return $user_granted_ids; 541 ); 542 543 // Returns an array which values are all the user_ids allowed to display a 544 // "duplicate" link. The keys of this array are strange (for direct allowed 545 // users, keys are usernames), but normally not used 546 return $users_granted_ids; 542 547 } 543 548
Note: See TracChangeset
for help on using the changeset viewer.