Changeset 1677
- Timestamp:
- Dec 21, 2006, 10:38:20 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 34 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r1643 r1677 82 82 } 83 83 84 // $filter['visible_categories'] and $filter['visible_images'] 85 // are not used because it's not necessary (filter <> restriction) 84 86 $query=' 85 87 SELECT id FROM '.CATEGORIES_TABLE.' … … 87 89 ON category_id=id 88 90 WHERE image_id='.$id.' 89 AND category_id NOT IN ('.$user['forbidden_categories'].') 91 .'get_sql_condition_FandF(array('forbidden_categories' => 'category_id'), 'AND').' 90 92 LIMIT 1 91 93 ;'; -
trunk/comments.php
r1647 r1677 217 217 $query = ' 218 218 SELECT id,name,uppercats,global_rank 219 FROM '.CATEGORIES_TABLE; 220 if ($user['forbidden_categories'] != '') 221 { 222 $query.= ' 223 WHERE id NOT IN ('.$user['forbidden_categories'].')'; 224 } 225 $query.= ' 219 FROM '.CATEGORIES_TABLE.' 220 '.get_sql_condition_FandF 221 ( 222 array 223 ( 224 'forbidden_categories' => 'id', 225 'visible_categories' => 'id' 226 ), 227 'WHERE' 228 ).' 226 229 ;'; 227 230 display_select_cat_wrapper($query, array(@$_GET['cat']), $blockname, true); … … 309 312 AND '.$page['author_clause'].' 310 313 AND '.$page['keyword_clause'].' 311 AND '.$page['status_clause']; 312 if ($user['forbidden_categories'] != '') 313 { 314 $query.= ' 315 AND category_id NOT IN ('.$user['forbidden_categories'].')'; 316 } 317 $query.= ' 314 AND '.$page['status_clause'].' 315 '.get_sql_condition_FandF 316 ( 317 array 318 ( 319 'forbidden_categories' => 'category_id', 320 'visible_categories' => 'category_id', 321 'visible_images' => 'ic.image_id' 322 ), 323 'AND' 324 ).' 318 325 ;'; 319 326 list($counter) = mysql_fetch_row(pwg_query($query)); … … 355 362 AND '.$page['author_clause'].' 356 363 AND '.$page['keyword_clause'].' 357 AND '.$page['status_clause']; 358 if ($user['forbidden_categories'] != '') 359 { 360 $query.= ' 361 AND category_id NOT IN ('.$user['forbidden_categories'].')'; 362 } 363 $query.= ' 364 AND '.$page['status_clause'].' 365 '.get_sql_condition_FandF 366 ( 367 array 368 ( 369 'forbidden_categories' => 'category_id', 370 'visible_categories' => 'category_id', 371 'visible_images' => 'ic.image_id' 372 ), 373 'AND' 374 ).' 364 375 GROUP BY comment_id 365 376 ORDER BY '.$page['sort_by'].' '.$page['sort_order']; -
trunk/include/category_cats.inc.php
r1651 r1677 43 43 WHERE date_last > SUBDATE( 44 44 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY 45 );'; 45 ) 46 '.get_sql_condition_FandF 47 ( 48 array 49 ( 50 'visible_categories' => 'id', 51 ), 52 'AND' 53 ).' 54 ;'; 46 55 } 47 56 else … … 55 64 ON id = cat_id and user_id = '.$user['id'].' 56 65 WHERE id_uppercat '. 57 (!isset($page['category']) ? 'is NULL' : '= '.$page['category']); 58 if ($page['filter_local_mode']) 59 { 60 $query.= ' 61 AND max_date_last > SUBDATE( 62 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 63 } 64 $query.= ' 66 (!isset($page['category']) ? 'is NULL' : '= '.$page['category']).' 67 '.get_sql_condition_FandF 68 ( 69 array 70 ( 71 'visible_categories' => 'id', 72 ), 73 'AND' 74 ).' 65 75 ORDER BY rank 66 76 ;'; … … 86 96 FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic 87 97 ON ic.category_id = c.id'; 88 if ($page['filter_local_mode'] or $user['filter_global_mode'])89 {90 $query.= '91 INNER JOIN '.IMAGES_TABLE.' AS i on ic.image_id = i.id ';92 }93 98 $query.= ' 94 99 WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\' 95 AND c.id NOT IN ('.$user['forbidden_categories'].')'; 96 if ($page['filter_local_mode'] or $user['filter_global_mode']) 97 { 98 $query.= ' 99 AND i.date_available > SUBDATE( 100 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 101 } 102 $query.= ' 100 '.get_sql_condition_FandF 101 ( 102 array 103 ( 104 'forbidden_categories' => 'c.id', 105 'visible_categories' => 'c.id', 106 'visible_images' => 'image_id' 107 ), 108 'AND' 109 ).' 103 110 ORDER BY RAND() 104 111 LIMIT 0,1 … … 117 124 ON id = cat_id and user_id = '.$user['id'].' 118 125 WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\' 119 AND representative_picture_id IS NOT NULL'; 120 if ($page['filter_local_mode'] or $user['filter_global_mode']) 121 { 122 $query.= ' 123 AND max_date_last > SUBDATE( 124 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 125 } 126 $query.= ' 126 AND representative_picture_id IS NOT NULL 127 '.get_sql_condition_FandF 128 ( 129 array 130 ( 131 'visible_categories' => 'id', 132 ), 133 'AND' 134 ).' 127 135 ORDER BY RAND() 128 136 LIMIT 0,1 … … 162 170 if (count($categories) > 0) 163 171 { 172 // Update filtered data 173 update_cats_with_filtered_data($categories); 174 164 175 if ($conf['subcatify']) 165 176 { -
trunk/include/category_default.inc.php
r1651 r1677 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 47 47 SELECT * 48 48 FROM '.IMAGES_TABLE.' 49 WHERE id IN ('.implode(',', $selection).')'; 50 if ($page['filter_local_mode'] or $user['filter_global_mode']) 51 { 52 $query.= ' 53 AND date_available > SUBDATE( 54 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 55 } 56 $query.= ';'; 49 WHERE id IN ('.implode(',', $selection).') 50 ;'; 57 51 $result = pwg_query($query); 58 52 while ($row = mysql_fetch_assoc($result)) -
trunk/include/common.inc.php
r1655 r1677 113 113 $lang = array(); 114 114 $header_msgs = array(); 115 $header_notes = array(); 115 116 116 117 @include(PHPWG_ROOT_PATH .'include/mysql.inc.php'); … … 229 230 } 230 231 232 if (!defined('IN_ADMIN') or !IN_ADMIN) 233 { 234 include(PHPWG_ROOT_PATH.'include/functions_filter.inc.php'); 235 include(PHPWG_ROOT_PATH.'include/filter.inc.php'); 236 } 237 238 if (isset($conf['header_notes'])) 239 { 240 $header_notes = array_merge($header_notes, $conf['header_notes']); 241 } 242 231 243 // default event handlers 232 244 add_event_handler('render_comment_content', 'parse_comment_content'); -
trunk/include/config_default.inc.php
r1660 r1677 175 175 $conf['links'] = array(); 176 176 177 // List of notes to display on all header page 178 // example $conf['header_notes'] = array('Test', 'Hello'); 179 $conf['header_notes'] = array(); 180 177 181 // show_thumbnail_caption : on thumbnails page, show thumbnail captions ? 178 182 $conf['show_thumbnail_caption'] = true; … … 544 548 545 549 // +-----------------------------------------------------------------------+ 546 // | Set default for Web Service 550 // | Set default for Web Service | 547 551 // +-----------------------------------------------------------------------+ 548 552 … … 562 566 $conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0); 563 567 568 // +-----------------------------------------------------------------------+ 569 // | Filter | 570 // +-----------------------------------------------------------------------+ 571 // Pages where filter is enabled 572 // Other pages cancel current filter 573 $conf['filter_pages'] = array 574 ( 575 'about.php', 'action.php', 'admin.php', 'comments.php', 576 'index.php', 'picture.php', 'popuphelp.php', 'profile.php', 577 'qsearch.php', 'random.php', 'register.php', 'search.php', 578 'search_rules.php', 'tags.php', 'upload.php' 579 ); 580 564 581 ?> -
trunk/include/functions_calendar.inc.php
r1163 r1677 30 30 function initialize_calendar() 31 31 { 32 global $page, $conf, $user, $template ;32 global $page, $conf, $user, $template, $filter; 33 33 34 34 //------------------ initialize the condition on items to take into account --- … … 59 59 { 60 60 $inner_sql .= ' 61 WHERE category_id NOT IN ('.$user['forbidden_categories'].')'; 61 '.get_sql_condition_FandF 62 ( 63 array 64 ( 65 'forbidden_categories' => 'category_id', 66 'visible_categories' => 'category_id', 67 'visible_images' => 'image_id' 68 ), 69 'WHERE', true 70 ); 62 71 } 63 72 } -
trunk/include/functions_category.inc.php
r1651 r1677 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 45 45 global $user; 46 46 47 // $filter['visible_categories'] and $filter['visible_images'] 48 // are not used because it's not necessary (filter <> restriction) 47 49 if (in_array($category_id, explode(',', $user['forbidden_categories']))) 48 50 { … … 53 55 function get_categories_menu() 54 56 { 55 global $page, $user ;57 global $page, $user, $filter; 56 58 57 59 $query = ' … … 66 68 // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE 67 69 $query.= ' 68 70 FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' 69 71 ON id = cat_id and user_id = '.$user['id']; 70 if ($page['filter_local_mode']) 72 73 // Always expand when filter is activated 74 if (!$user['expand'] and !$filter['enabled']) 71 75 { 72 76 $query.= ' 73 where max_date_last > SUBDATE( 74 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 77 WHERE 78 (id_uppercat is NULL'; 79 if (isset($page['category'])) 80 { 81 $query.= ' OR id_uppercat IN ('.$page['uppercats'].')'; 82 } 83 $query.= ')'; 75 84 } 76 85 else 77 86 { 78 // Always expand when filter_local_mode is activated 79 if (!$user['expand'] and !$user['filter_global_mode']) 80 { 81 $query.= ' 82 WHERE (id_uppercat is NULL'; 83 if (isset($page['category'])) 84 { 85 $query.= ' OR id_uppercat IN ('.$page['uppercats'].')'; 86 } 87 $query.= ')'; 88 } 89 } 87 $query.= ' 88 '.get_sql_condition_FandF 89 ( 90 array 91 ( 92 'visible_categories' => 'id', 93 ), 94 'WHERE' 95 ); 96 } 97 90 98 $query.= ' 91 99 ;'; … … 98 106 } 99 107 usort($cats, 'global_rank_compare'); 108 109 // Update filtered data 110 update_cats_with_filtered_data($cats); 100 111 101 112 return get_html_menu_category($cats); -
trunk/include/functions_html.inc.php
r1652 r1677 289 289 $output.= '<a class=""'; 290 290 $output.= ' href="' 291 . make_index_url(291 .duplicate_index_url( 292 292 array( 293 293 'category'=>$id, 294 294 'cat_name'=>$name 295 ) 295 ), 296 array('start') 296 297 ) 297 298 .'">'; -
trunk/include/functions_notification.inc.php
r1639 r1677 31 31 32 32 /* 33 * get standard sql where in order to 34 * restict an filter caregories and images 35 * 36 * IMAGE_CATEGORY_TABLE muste named ic in the query 37 * 38 * @param none 39 * 40 * @return string sql where 41 */ 42 function get_std_sql_where_restrict_filter($prefix_condition, $force_one_condition = false) 43 { 44 return get_sql_condition_FandF 45 ( 46 array 47 ( 48 'forbidden_categories' => 'ic.category_id', 49 'visible_categories' => 'ic.category_id', 50 'visible_images' => 'ic.image_id' 51 ), 52 $prefix_condition, 53 $force_one_condition 54 ); 55 } 56 57 /* 33 58 * Execute custom notification query 34 59 * … … 54 79 AND c.validation_date > \''.$start.'\' 55 80 AND c.validation_date <= \''.$end.'\' 56 AND category_id NOT IN ('.$user['forbidden_categories'].')81 '.get_std_sql_where_restrict_filter('AND').' 57 82 ;'; 58 83 break; … … 67 92 case 'new_elements': 68 93 $query = ' 69 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id94 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id 70 95 WHERE date_available > \''.$start.'\' 71 96 AND date_available <= \''.$end.'\' 72 AND category_id NOT IN ('.$user['forbidden_categories'].')97 '.get_std_sql_where_restrict_filter('AND').' 73 98 ;'; 74 99 break; 75 100 case 'updated_categories': 76 101 $query = ' 77 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id102 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id 78 103 WHERE date_available > \''.$start.'\' 79 104 AND date_available <= \''.$end.'\' 80 AND category_id NOT IN ('.$user['forbidden_categories'].')105 '.get_std_sql_where_restrict_filter('AND').' 81 106 ;'; 82 107 break; … … 424 449 global $conf, $user; 425 450 426 $where_sql = 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')';451 $where_sql = get_std_sql_where_restrict_filter('WHERE', true); 427 452 428 453 $query = ' … … 430 455 COUNT(DISTINCT id) nb_elements, 431 456 COUNT(DISTINCT category_id) nb_cats 432 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id457 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id 433 458 '.$where_sql.' 434 459 GROUP BY date_available … … 449 474 $query = ' 450 475 SELECT DISTINCT id, path, name, tn_ext 451 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id476 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id 452 477 '.$where_sql.' 453 478 AND date_available="'.$dates[$i]['date_available'].'" … … 467 492 $query = ' 468 493 SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count 469 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id494 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id=image_id 470 495 INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id 471 496 '.$where_sql.' -
trunk/include/functions_search.inc.php
r1619 r1677 336 336 function get_quick_search_results($q) 337 337 { 338 global $user, $page ;338 global $user, $page, $filter; 339 339 $search_results = array(); 340 340 … … 385 385 INNER JOIN 386 386 '.CATEGORIES_TABLE.' c on c.id=ic.category_id 387 WHERE category_id NOT IN ('.$user['forbidden_categories'].') 387 '.get_sql_condition_FandF 388 ( 389 array 390 ( 391 'forbidden_categories' => 'category_id', 392 'visible_categories' => 'category_id', 393 'visible_images' => 'ic.image_id' 394 ), 395 'WHERE' 396 ).' 388 397 GROUP BY i.id'; 389 398 … … 428 437 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 429 438 WHERE id IN ('.implode(',', array_keys($by_tag_weights) ).') 430 AND category_id NOT IN ('.$user['forbidden_categories'].')'; 431 439 '.get_sql_condition_FandF 440 ( 441 array 442 ( 443 'forbidden_categories' => 'category_id', 444 'visible_categories' => 'category_id', 445 'visible_images' => 'ic.image_id' 446 ), 447 'AND' 448 ); 432 449 $allowed_image_ids = array_from_query( $query, 'id'); 433 450 $by_tag_weights = array_intersect_key($by_tag_weights, array_flip($allowed_image_ids)); -
trunk/include/functions_tag.inc.php
r1537 r1677 38 38 * @return array 39 39 */ 40 function get_available_tags( $forbidden_categories = null)40 function get_available_tags() 41 41 { 42 42 // we can find top fatter tags among reachable images … … 46 46 INNER JOIN '.TAGS_TABLE.' ON tag_id = id'; 47 47 48 if (!is_null($forbidden_categories)) 48 $where_tag_img = 49 get_sql_condition_FandF 50 ( 51 array 52 ( 53 'forbidden_categories' => 'category_id', 54 'visible_categories' => 'category_id', 55 'visible_images' => 'image_id' 56 ), 57 'WHERE' 58 ); 59 60 if (!is_null($where_tag_img)) 49 61 { 50 62 // first we need all reachable image ids … … 52 64 SELECT DISTINCT image_id 53 65 FROM '.IMAGE_CATEGORY_TABLE.' 54 WHERE category_id NOT IN ('.implode(',', $forbidden_categories).')66 '.$where_tag_img.' 55 67 ;'; 56 68 $image_ids = array_from_query($images_query, 'image_id'); -
trunk/include/functions_url.inc.php
r1676 r1677 265 265 } 266 266 267 if (isset($params['flat_recent_cat']) and $params['flat_recent_cat'] > 0) 268 { 269 $url.= '/flat_recent_cat-'.$params['flat_recent_cat']; 270 } 271 267 272 if (isset($params['start']) and $params['start'] > 0) 268 273 { -
trunk/include/functions_user.inc.php
r1651 r1677 144 144 } 145 145 146 function build_user( $user_id, $use_cache , $filter_global_mode = false)146 function build_user( $user_id, $use_cache ) 147 147 { 148 148 global $conf; 149 150 149 $user['id'] = $user_id; 151 $user = array_merge( $user, getuserdata($user_id, $use_cache , $filter_global_mode) );150 $user = array_merge( $user, getuserdata($user_id, $use_cache) ); 152 151 if ( $user['id'] == $conf['guest_id']) 153 152 { … … 168 167 $user['is_the_guest']=false; 169 168 } 170 171 169 // calculation of the number of picture to display per page 172 170 $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; … … 199 197 * @param array 200 198 */ 201 function getuserdata($user_id, $use_cache , $filter_global_mode = false)199 function getuserdata($user_id, $use_cache) 202 200 { 203 201 global $conf; … … 268 266 if ($use_cache) 269 267 { 270 $userdata['filter_global_mode'] = $filter_global_mode;271 272 268 if (!isset($userdata['need_update']) 273 269 or !is_bool($userdata['need_update']) 274 or $userdata['need_update'] == true 275 or $filter_global_mode // not optimize condition RubTag 276 ) 270 or $userdata['need_update'] == true) 277 271 { 278 272 $userdata['forbidden_categories'] = 279 273 calculate_permissions($userdata['id'], $userdata['status']); 280 274 281 update_user_cache_categories($userdata );275 update_user_cache_categories($userdata['id'], $userdata['forbidden_categories']); 282 276 283 277 // Set need update are done 284 $userdata['need_update'] = $userdata['filter_global_mode']; // for draft always update RubTag 278 $userdata['need_update'] = false; 279 280 // Indicate update done 281 $userdata['need_update_done'] = true; 285 282 286 283 $query = ' … … 307 304 pwg_query($query); 308 305 } 309 310 { 306 else 307 { 308 // Indicate update not done 309 $userdata['need_update_done'] = false; 311 310 } 312 311 } … … 329 328 } 330 329 330 // $filter['visible_categories'] and $filter['visible_images'] 331 // must be not used because filter <> restriction 331 332 // retrieving images allowed : belonging to at least one authorized 332 333 // category … … 336 337 ON f.image_id = ic.image_id 337 338 WHERE f.user_id = '.$user['id'].' 338 AND ic.category_id NOT IN ('.$user['forbidden_categories'].') 339 '.get_sql_condition_FandF 340 ( 341 array 342 ( 343 'forbidden_categories' => 'ic.category_id', 344 ), 345 'AND' 346 ).' 339 347 ;'; 340 348 $result = pwg_query($query); … … 455 463 456 464 /** 457 * compute data of categories branches 465 * compute data of categories branches (one branch only) 458 466 */ 459 467 function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) … … 497 505 498 506 /** 507 * compute data of categories branches 508 */ 509 function compute_categories_data(&$cats) 510 { 511 $ref_level = 0; 512 $level = 0; 513 $list_cat_id = array(); 514 515 foreach ($cats as $id => $category) 516 { 517 // Compute 518 $level = substr_count($category['global_rank'], '.') + 1; 519 if ($level > $ref_level) 520 { 521 array_push($list_cat_id, $id); 522 } 523 else 524 { 525 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 526 array_push($list_cat_id, $id); 527 } 528 $ref_level = $level; 529 } 530 531 $level = 1; 532 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 533 } 534 535 /** 536 * get computed array of categories 537 * 538 * @param int user_id 539 * @param list user_forbidden_categories 540 * @param bool filter_enabled 541 * @param int recent_period 542 * @return array 543 */ 544 function get_computed_categories($user_id, $user_forbidden_categories, $filter_enabled, $recent_period = 0) 545 { 546 $query = ' 547 SELECT 548 c.id cat_id, 549 date_last max_date_last, 550 nb_images count_images, 551 global_rank'; 552 553 if (!$filter_enabled) 554 { 555 $query.= ' 556 FROM '.CATEGORIES_TABLE.' as c'; 557 } 558 else 559 { 560 // Count by date_available to avoid count null 561 $query.= ', 562 count(date_available) filtered_count_images, 563 max(date_available) max_date_available 564 FROM '.CATEGORIES_TABLE.' as c 565 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 566 LEFT JOIN '.IMAGES_TABLE.' AS i 567 ON ic.image_id = i.id AND 568 i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$recent_period.' DAY)'; 569 } 570 571 if ($user_forbidden_categories != '') 572 { 573 $query.= ' 574 WHERE 575 c.id NOT IN ('.$user_forbidden_categories.')'; 576 } 577 578 if ($filter_enabled) 579 { 580 $query.= ' 581 GROUP BY 582 c.id'; 583 } 584 $query.= ';'; 585 586 $result = pwg_query($query); 587 588 $cats = array(); 589 while ($row = mysql_fetch_assoc($result)) 590 { 591 $row['user_id'] = $user_id; 592 $row['count_categories'] = 0; 593 if ($filter_enabled) 594 { 595 $row['nb_images'] = $row['filtered_count_images']; 596 $row['count_images'] = $row['filtered_count_images']; 597 $row['max_date_last'] = $row['max_date_available']; 598 } 599 $cats += array($row['cat_id'] => $row); 600 } 601 usort($cats, 'global_rank_compare'); 602 603 compute_categories_data($cats); 604 605 if ($filter_enabled) 606 { 607 $cat_tmp = $cats; 608 $cats = array(); 609 610 foreach ($cat_tmp as $category) 611 { 612 if (!empty($category['max_date_last'])) 613 { 614 // Re-init counters 615 $category['count_categories'] = 0; 616 $category['nb_images'] = $category['filtered_count_images']; 617 $category['count_images'] = $category['filtered_count_images']; 618 // Keep category 619 $cats[$category['cat_id']] = $category; 620 621 } 622 } 623 // Compute a second time 624 compute_categories_data($cats); 625 } 626 627 return $cats; 628 } 629 630 /** 499 631 * update data of user_cache_categories 500 632 * 501 * @param array userdata 633 * @param int user_id 634 * @param list user_forbidden_categories 635 * @param bool filter_enabled 502 636 * @return null 503 637 */ 504 function update_user_cache_categories( &$userdata)638 function update_user_cache_categories($user_id, $user_forbidden_categories) 505 639 { 506 640 // delete user cache 507 641 $query = ' 508 642 DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.' 509 WHERE user_id = '.$user data['id'].'643 WHERE user_id = '.$user_id.' 510 644 ;'; 511 645 pwg_query($query); 512 646 513 /*$query = ' 514 SELECT id cat_id, date_last max_date_last, nb_images count_images, global_rank 515 FROM '.CATEGORIES_TABLE; 516 if ($userdata['forbidden_categories'] != '') 517 { 518 $query.= ' 519 WHERE id NOT IN ('.$userdata['forbidden_categories'].')'; 520 } 521 $query.= ';';*/ 522 523 524 $query = ' 525 SELECT c.id cat_id, date_last max_date_last, nb_images count_images, global_rank'; 526 527 if (!$userdata['filter_global_mode']) 528 { 529 $query.= ' 530 FROM '.CATEGORIES_TABLE.' as C'; 531 } 532 else 533 { 534 // Count by date_available to avoid count null 535 $query.= ', count(date_available) filtered_count_images, max(date_available) max_date_available 536 FROM '.CATEGORIES_TABLE.' as C 537 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic 538 ON ic.category_id = c.id LEFT JOIN '.IMAGES_TABLE.' AS i 539 ON ic.image_id = i.id AND i.date_available > SUBDATE( 540 CURRENT_DATE,INTERVAL '.$userdata['recent_period'].' DAY)'; 541 } 542 543 if ($userdata['forbidden_categories'] != '') 544 { 545 $query.= ' 546 WHERE C.id NOT IN ('.$userdata['forbidden_categories'].')'; 547 } 548 549 if ($userdata['filter_global_mode']) 550 { 551 $query.= ' 552 GROUP BY c.id'; 553 } 554 $query.= ';'; 555 556 $result = pwg_query($query); 557 558 $cats = array(); 559 while ($row = mysql_fetch_assoc($result)) 560 { 561 $row['user_id'] = $userdata['id']; 562 $row['count_categories'] = 0; 563 if ($userdata['filter_global_mode']) 564 { 565 $row['count_images'] = $row['filtered_count_images']; 566 $row['max_date_last'] = $row['max_date_available']; 567 } 568 $cats += array($row['cat_id'] => $row); 569 } 570 usort($cats, 'global_rank_compare'); 571 572 $ref_level = 0; 573 $level = 0; 574 $list_cat_id = array(); 575 576 foreach ($cats as $id => $category) 577 { 578 // Compute 579 $level = substr_count($category['global_rank'], '.') + 1; 580 if ($level > $ref_level) 581 { 582 array_push($list_cat_id, $id); 583 } 584 else 585 { 586 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 587 array_push($list_cat_id, $id); 588 } 589 $ref_level = $level; 590 } 591 592 $level = 1; 593 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 594 595 if ($userdata['filter_global_mode']) 596 { 597 $forbidden_cats = array(); 598 $forbidden_cats = explode(',', $userdata['forbidden_categories']); 599 $cat_tmp = $cats; 600 $cats = array(); 601 602 foreach ($cat_tmp as $cat_id => $category) 603 { 604 if (empty($category['max_date_last'])) 605 { 606 array_push($forbidden_cats, $category['cat_id']); 607 } 608 else 609 { 610 array_push($cats, $category); 611 } 612 } 613 $userdata['forbidden_categories'] = implode(',', array_unique($forbidden_cats)); 614 } 647 $cats = get_computed_categories($user_id, $user_forbidden_categories, false); 615 648 616 649 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); … … 1015 1048 } 1016 1049 1050 /* 1051 * Compute sql where condition with restrict and filter data 1052 * 1053 * FandF: Forbidden and Filters 1054 * 1055 * @param $condition_fields array: 1056 * keys are condition to aply and 1057 * values are sql field to use 1058 * array('forbidden_categories' => 'ic.category_id') 1059 * $prefix_condition string: 1060 * this value are concatenated if sql is not empty 1061 * $force_one_condition: 1062 * if there are not condition , use this condition "1 = 1" 1063 * 1064 * @return string sql where/conditions 1065 */ 1066 function get_sql_condition_FandF($condition_fields, $prefix_condition = null, $force_one_condition = false) 1067 { 1068 global $user, $filter; 1069 1070 $sql_list = array(); 1071 1072 foreach ($condition_fields as $condition => $field_name) 1073 { 1074 switch($condition) 1075 { 1076 case 'forbidden_categories': 1077 if (!empty($user['forbidden_categories'])) 1078 { 1079 $sql_list[] = $field_name.' NOT IN ('.$user['forbidden_categories'].')'; 1080 } 1081 break; 1082 1083 case 'visible_categories': 1084 if (!empty($filter['visible_categories'])) 1085 { 1086 $sql_list[] = $field_name.' IN ('.$filter['visible_categories'].')'; 1087 } 1088 break; 1089 1090 case 'visible_images': 1091 if (!empty($filter['visible_images'])) 1092 { 1093 $sql_list[] = $field_name.' IN ('.$filter['visible_images'].')'; 1094 } 1095 break; 1096 1097 default: 1098 die('Unknow condition'); 1099 break; 1100 1101 } 1102 } 1103 1104 if (count($sql_list) > 0) 1105 { 1106 $sql = '('.implode(' AND ', $sql_list).')'; 1107 } 1108 else 1109 { 1110 if ($force_one_condition) 1111 { 1112 $sql = '1 = 1'; 1113 } 1114 else 1115 { 1116 $sql = ''; 1117 } 1118 } 1119 1120 if (isset($prefix_condition) and !empty($sql)) 1121 { 1122 $sql = $prefix_condition.' '.$sql; 1123 } 1124 1125 return $sql; 1126 } 1127 1017 1128 ?> -
trunk/include/menubar.inc.php
r1652 r1677 64 64 ); 65 65 } 66 67 //------------------------------------------------------------------------ filter 68 if ($filter['enabled']) 69 { 70 $template->assign_block_vars( 71 'stop_filter', 72 array( 73 'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop')) 74 ) 75 ); 76 } 77 else 78 { 79 $template->assign_block_vars( 80 'start_filter', 81 array( 82 'URL' => add_url_params(make_index_url(array()), array('filter' => 'start')) 83 ) 84 ); 85 } 86 87 66 88 //------------------------------------------------------------------------ tags 67 89 if ('tags' == $page['section']) -
trunk/include/page_header.php
r1627 r1677 61 61 $template->assign_block_vars( 'header_meta', $header_infos); 62 62 } 63 64 // Header notes 65 if (count($header_notes) > 0) 66 { 67 $template->assign_block_vars('header_notes', array()); 68 foreach ($header_notes as $header_note) 69 { 70 $template->assign_block_vars('header_notes.header_note', 71 array('HEADER_NOTE' => $header_note)); 72 } 73 } 74 63 75 // refresh 64 76 if ( isset( $refresh ) and intval($refresh) >= 0 -
trunk/include/section_init.inc.php
r1623 r1677 268 268 } 269 269 270 if (preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches)) 271 { 272 // indicate a special list of images 273 $page['flat_recent_cat'] = $matches[1]; 274 } 275 270 276 if (preg_match('/^(posted|created)/', $tokens[$i] )) 271 277 { … … 326 332 $page, 327 333 array( 328 'comment' => $result['comment'], 329 'cat_dir' => $result['dir'], 330 'cat_name' => $result['name'], 331 'cat_site_id' => $result['site_id'], 332 'cat_uploadable' => $result['uploadable'], 333 'cat_commentable' => $result['commentable'], 334 'cat_id_uppercat' => $result['id_uppercat'], 335 'uppercats' => $result['uppercats'], 336 337 'title' => get_cat_display_name($result['name'], '', false), 338 ) 339 ); 340 341 if (!isset($page['chronology_field'])) 342 { 343 if ( !empty($result['image_order']) and !isset($page['super_order_by']) ) 334 'comment' => $result['comment'], 335 'cat_dir' => $result['dir'], 336 'cat_name' => $result['name'], 337 'cat_site_id' => $result['site_id'], 338 'cat_uploadable' => $result['uploadable'], 339 'cat_commentable' => $result['commentable'], 340 'cat_id_uppercat' => $result['id_uppercat'], 341 'uppercats' => $result['uppercats'], 342 'title' => 343 get_cat_display_name($result['name'], '', false), 344 'thumbnails_include' => 345 (($result['nb_images'] > 0) or (isset($page['flat_recent_cat']))) 346 ? 'include/category_default.inc.php' 347 : 'include/category_cats.inc.php' 348 ) 349 ); 350 } 351 else 352 { 353 $page['title'] = $lang['no_category']; 354 $page['thumbnails_include'] = 355 (isset($page['flat_recent_cat'])) 356 ? 'include/category_default.inc.php' 357 : 'include/category_cats.inc.php'; 358 } 359 360 if (isset($page['flat_recent_cat'])) 361 { 362 $page['title'] = $lang['recent_pics_cat'].' : '.$page['title'] ; 363 } 364 365 if 366 ( 367 (!isset($page['chronology_field'])) and 368 ( 369 (isset($page['category'])) or 370 (isset($page['flat_recent_cat'])) 371 ) 372 ) 373 { 374 if ( !empty($result['image_order']) and !isset($page['super_order_by']) ) 375 { 376 $conf[ 'order_by' ] = ' ORDER BY '.$result['image_order']; 377 } 378 379 if (isset($page['flat_recent_cat'])) 380 { 381 // flat recent categories mode 382 $query = ' 383 SELECT 384 DISTINCT(ic.image_id) 385 FROM '.IMAGES_TABLE.' AS i 386 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 387 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 388 WHERE 389 date_available > SUBDATE( 390 CURRENT_DATE,INTERVAL '.$page['flat_recent_cat'].' DAY)'. 391 (isset($page['category']) ? ' 392 AND uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '' ).' 393 '.get_sql_condition_FandF 394 ( 395 array 396 ( 397 'forbidden_categories' => 'category_id', 398 'visible_categories' => 'category_id', 399 'visible_images' => 'image_id' 400 ), 401 'AND' 402 ).' 403 ;'; 404 405 $where_sql = array_from_query($query, 'image_id'); 406 if (!empty($where_sql)) 344 407 { 345 $conf[ 'order_by' ] = ' ORDER BY '.$result['image_order'];408 $where_sql = 'image_id in ('.implode(',', $where_sql).')'; 346 409 } 347 410 } 411 else 412 { 413 // Normal mode 414 $where_sql = 'category_id = '.$page['category']; 415 } 416 417 if (!empty($where_sql)) 418 { 419 // Main query 348 420 $query = ' 349 421 SELECT image_id 350 422 FROM '.IMAGE_CATEGORY_TABLE.' 351 423 INNER JOIN '.IMAGES_TABLE.' ON id = image_id 352 WHERE category_id = '.$page['category'].' 424 WHERE 425 '.$where_sql.' 426 '.get_sql_condition_FandF 427 ( 428 array 429 ( 430 'forbidden_categories' => 'category_id', 431 'visible_categories' => 'category_id', 432 'visible_images' => 'image_id' 433 ), 434 'AND' 435 ).' 353 436 '.$conf['order_by'].' 354 437 ;'; 438 355 439 $page['items'] = array_from_query($query, 'image_id'); 356 357 $page['thumbnails_include'] = 358 $result['nb_images'] > 0 359 ? 'include/category_default.inc.php' 360 : 'include/category_cats.inc.php'; 361 } //otherwise the calendar will requery all subitems 362 } 363 else 364 { 365 $page['title'] = $lang['no_category']; 366 $page['thumbnails_include'] = 'include/category_cats.inc.php'; 367 } 440 } 441 else 442 { 443 $page['items'] = array(); 444 } 445 } //otherwise the calendar will requery all subitems 368 446 } 369 447 // special sections 370 448 else 371 449 { 372 if (!empty($user['forbidden_categories'])) 373 { 374 $forbidden = 375 ' category_id NOT IN ('.$user['forbidden_categories'].')'; 376 } 377 else 378 { 379 $forbidden = ' 1 = 1'; 380 } 450 $forbidden = 451 get_sql_condition_FandF 452 ( 453 array 454 ( 455 'forbidden_categories' => 'category_id', 456 'visible_categories' => 'category_id', 457 'visible_images' => 'image_id' 458 ), 459 'AND' 460 ); 461 381 462 // +-----------------------------------------------------------------------+ 382 463 // | tags section | … … 401 482 FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id 402 483 WHERE image_id IN ('.implode(',', $items).') 403 AND'.$forbidden.484 '.$forbidden. 404 485 $conf['order_by'].' 405 486 ;'; … … 435 516 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 436 517 WHERE id IN ('.implode(',', $search_result['items']).') 437 AND'.$forbidden.'518 '.$forbidden.' 438 519 '.$conf['order_by'].' 439 520 ;'; … … 465 546 INNER JOIN '.IMAGES_TABLE.' ON image_id = id 466 547 WHERE user_id = '.$user['id'].' 548 '.get_sql_condition_FandF 549 ( 550 array 551 ( 552 'visible_images' => 'image_id' 553 ), 554 'AND' 555 ).' 467 556 '.$conf['order_by'].' 468 557 ;'; … … 488 577 WHERE date_available > \''. 489 578 date('Y-m-d', time() - 60*60*24*$user['recent_period']).'\' 490 AND'.$forbidden.'579 '.$forbidden.' 491 580 '.$conf['order_by'].' 492 581 ;'; … … 527 616 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 528 617 WHERE hit > 0 529 AND'.$forbidden.'618 '.$forbidden.' 530 619 '.$conf['order_by'].' 531 620 LIMIT 0, '.$conf['top_number'].' … … 555 644 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 556 645 WHERE average_rate IS NOT NULL 557 AND'.$forbidden.'646 '.$forbidden.' 558 647 '.$conf['order_by'].' 559 648 LIMIT 0, '.$conf['top_number'].' … … 579 668 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 580 669 WHERE image_id IN ('.implode(',', $page['list']).') 581 AND'.$forbidden.'670 '.$forbidden.' 582 671 '.$conf['order_by'].' 583 672 ;'; -
trunk/include/user.inc.php
r1651 r1677 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 71 71 } 72 72 73 if (isset($_GET['filter_global_mode']))74 {75 $user['filter_global_mode'] = ($_GET['filter_global_mode'] == 'start');76 pwg_set_session_var('filter_global_mode', $user['filter_global_mode']);77 }78 else79 {80 $user['filter_global_mode'] = pwg_get_session_var('filter_global_mode', false);81 }82 83 73 $user = build_user( $user['id'], 84 ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true, // use cache ? 85 $user['filter_global_mode'] // filter_global_mode ? 74 ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true // use cache ? 86 75 ); 87 76 -
trunk/index.php
r1655 r1677 107 107 } 108 108 109 if (isset($_GET['filter_local_mode'])) 110 { 111 $page['filter_local_mode'] = ($_GET['filter_local_mode'] == 'start'); 112 } 113 else 114 { 115 $page['filter_local_mode'] = pwg_get_session_var('filter_local_mode', false); 116 } 117 118 $page['filter_local_mode'] = (($page['filter_local_mode']) and 119 ($page['section'] == 'categories') and 120 (!isset($page['chronology_field']))); 121 pwg_set_session_var('filter_local_mode', $page['filter_local_mode']); 122 123 if ($page['filter_local_mode']) 124 { 125 $template->assign_block_vars( 126 'stop_filter_local_mode', 127 array( 128 'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_local_mode' => 'stop')) 129 ) 130 ); 131 } 132 else 133 { 134 $template->assign_block_vars( 135 'start_filter_local_mode', 136 array( 137 'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_local_mode' => 'start')) 138 ) 139 ); 140 } 141 142 if (isset($_GET['filter_global_mode'])) 143 { 144 $user['filter_global_mode'] = ($_GET['filter_global_mode'] == 'start'); 145 pwg_set_session_var('filter_global_mode', $user['filter_global_mode']); 146 } 147 else 148 { 149 $user['filter_global_mode'] = pwg_get_session_var('filter_global_mode', false); 150 } 151 152 if ($user['filter_global_mode']) 153 { 154 $template->assign_block_vars( 155 'stop_filter_global_mode', 156 array( 157 'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_global_mode' => 'stop')) 158 ) 159 ); 160 } 161 else 162 { 163 $template->assign_block_vars( 164 'start_filter_global_mode', 165 array( 166 'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_global_mode' => 'start')) 109 if (isset($page['flat_recent_cat']) or isset($page['chronology_field'])) 110 { 111 $template->assign_block_vars( 112 'mode_normal', 113 array( 114 'URL' => duplicate_index_url( array(), array('chronology_field', 'start', 'flat_recent_cat') ) 115 ) 116 ); 117 } 118 119 if (!isset($page['flat_recent_cat'])) 120 { 121 $template->assign_block_vars( 122 'flat_recent_cat', 123 array( 124 'URL' => duplicate_index_url(array('flat_recent_cat' => $user['recent_period']), array('start', 'chronology_field')) 167 125 ) 168 126 ); … … 180 138 'mode_created', 181 139 array( 182 'URL' => duplicate_index_url( $chronology_params, array('start' ) )140 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_recent_cat') ) 183 141 ) 184 142 ); … … 188 146 'mode_posted', 189 147 array( 190 'URL' => duplicate_index_url( $chronology_params, array('start' ) )148 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_recent_cat') ) 191 149 ) 192 150 ); … … 194 152 else 195 153 { 196 $template->assign_block_vars(197 'mode_normal',198 array(199 'URL' => duplicate_index_url( array(), array('chronology_field','start') )200 )201 );202 203 154 if ($page['chronology_field'] == 'created') 204 155 { … … 211 162 $url = duplicate_index_url( 212 163 array('chronology_field'=>$chronology_field ), 213 array('chronology_date', 'start' )164 array('chronology_date', 'start', 'flat_recent_cat') 214 165 ); 215 166 $template->assign_block_vars( -
trunk/language/en_UK.iso-8859-1/common.lang.php
r1651 r1677 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 491 491 $lang['maxwidth'] = 'Maximum width of the pictures'; 492 492 $lang['maxwidth_error'] = 'Maximum width must be a number superior to 50'; 493 $lang['start_filter_local_mode_hint'] = '[local] displays only recent elements'; 494 $lang['stop_filter_local_mode_hint'] = '[local] return to display all elements'; 495 $lang['start_filter_global_mode_hint'] = '[global] displays only recent elements'; 496 $lang['stop_filter_global_mode_hint'] = '[global] return to display all elements'; 493 $lang['flat_recent_cat_hint'] = 'display recent elements of categories and sub-categories'; 494 $lang['start_filter_hint'] = 'displays only recent elements'; 495 $lang['stop_filter_hint'] = 'return to display all elements'; 497 496 $lang['mode_created_hint'] = 'displays a calendar by creation date'; 498 497 $lang['mode_normal_hint'] = 'return to normal view mode'; … … 614 613 $lang['w_month'] = 'Month'; 615 614 $lang['yes'] = 'Yes'; 615 $lang['note_filter_day'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s day.'; 616 $lang['note_filter_days'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s days.'; 616 617 ?> -
trunk/language/fr_FR.iso-8859-1/common.lang.php
r1651 r1677 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 491 491 $lang['maxwidth'] = 'Largeur maximum des images'; 492 492 $lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50'; 493 $lang['start_filter_local_mode_hint'] = '[local] afficher que les éléments récents'; 494 $lang['stop_filter_local_mode_hint'] = '[local] retourner à l\'affichage de tous les éléments'; 495 $lang['start_filter_global_mode_hint'] = '[global] afficher que les éléments récents'; 496 $lang['stop_filter_global_mode_hint'] = '[global] retourner à l\'affichage de tous les éléments'; 493 $lang['flat_recent_cat_hint'] = 'affiche les éléments récents des catégories et des sous-catégories'; 494 $lang['start_filter_hint'] = 'afficher que les éléments récents'; 495 $lang['stop_filter_hint'] = 'retourner à l\'affichage de tous les éléments'; 497 496 $lang['mode_created_hint'] = 'afficher un calendrier par date de création'; 498 497 $lang['mode_normal_hint'] = 'retourner à la vue normale'; … … 615 614 $lang['w_month'] = 'Mois'; 616 615 $lang['yes'] = 'Oui'; 616 $lang['note_filter_day'] = 'L\'ensemble des éléments est filtré pour n\'afficher que les éléments récents de moins de %d jour.'; 617 $lang['note_filter_days'] = 'L\'ensemble des éléments est filtré pour n\'afficher que les éléments récents de moins de %d jours.'; 617 618 ?> -
trunk/picture.php
r1627 r1677 249 249 INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id 250 250 WHERE image_id = '.$page['image_id'].' 251 AND category_id NOT IN ('.$user['forbidden_categories'].') 251 '.get_sql_condition_FandF 252 ( 253 array 254 ( 255 'forbidden_categories' => 'category_id', 256 'visible_categories' => 'category_id' 257 ), 258 'AND' 259 ).' 252 260 ;'; 253 261 $result = pwg_query($query); -
trunk/random.php
r1503 r1677 46 46 FROM '.IMAGES_TABLE.' 47 47 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 48 '.( 49 $user['forbidden_categories'] != '' 50 ? 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')' 51 : '' 52 ).' 48 '.get_sql_condition_FandF 49 ( 50 array 51 ( 52 'forbidden_categories' => 'category_id', 53 'visible_categories' => 'category_id', 54 'visible_images' => 'id' 55 ), 56 'WHERE' 57 ).' 53 58 ORDER BY RAND(NOW()) 54 59 LIMIT 0, '.$conf['top_number'].' -
trunk/search.php
r1627 r1677 188 188 ); 189 189 190 $available_tags = get_available_tags( 191 isset($user['forbidden_categories']) 192 ? explode(',', $user['forbidden_categories']) 193 : null 194 ); 190 $available_tags = get_available_tags(); 195 191 196 192 if (count($available_tags) > 0) … … 214 210 $query = ' 215 211 SELECT name,id,date_last,nb_images,global_rank,uppercats 216 FROM '.CATEGORIES_TABLE; 217 if ($user['forbidden_categories'] != '') 218 { 219 $query.= ' 220 WHERE id NOT IN ('.$user['forbidden_categories'].')'; 221 } 222 $query.= ' 212 FROM '.CATEGORIES_TABLE.' 213 '.get_sql_condition_FandF 214 ( 215 array 216 ( 217 'forbidden_categories' => 'id', 218 'visible_categories' => 'id' 219 ), 220 'WHERE' 221 ).' 223 222 ;'; 224 223 -
trunk/services/recent.php
r1675 r1677 1 1 <?php 2 2 3 $where = ( $user['forbidden_categories'] == '') ? '' : 4 'ic.`category_id` NOT IN ('.$user['forbidden_categories'].')'; 3 $where = 4 get_sql_condition_FandF 5 ( 6 array 7 ( 8 'forbidden_categories' => 'ic.category_id', 9 'visible_categories' => 'ic.category_id', 10 'visible_images' => 'i.id' 11 ), 12 '' 13 ); 5 14 $list = implode(',', $final); 6 15 if ( $where !== '' and $list !== '' ) -
trunk/tags.php
r1120 r1677 74 74 75 75 // find all tags available for the current user 76 $tags = get_available_tags( explode(',', $user['forbidden_categories']));76 $tags = get_available_tags(); 77 77 78 78 // we want only the first most represented tags, so we sort them by counter -
trunk/template/yoga/default-colors.css
r1657 r1677 101 101 } 102 102 103 /** 104 * Header notes box in public/administration 105 */ 106 .header_notes { 107 border: 1px solid #aaaaaa; /* border color and style */ 108 text-align: center; 109 background-image: url(icon/note.png); 110 background-repeat: no-repeat; 111 background-position: top left; 112 font-weight: bold; 113 margin: 14px; 114 padding: 5px 00px 0px 0px; 115 } 116 103 117 LEGEND { 104 118 font-style: italic; -
trunk/template/yoga/header.tpl
r1636 r1677 73 73 <!-- END header_msgs --> 74 74 <div id="theHeader">{PAGE_BANNER}</div> 75 <!-- BEGIN header_notes --> 76 <div class="header_notes"> 77 <!-- BEGIN header_note --> 78 <P>{header_notes.header_note.HEADER_NOTE}</p> 79 <!-- END header_note --> 80 </div> 81 <!-- END header_notes --> -
trunk/template/yoga/index.tpl
r1651 r1677 28 28 <!-- END search_rules --> 29 29 30 <!-- BEGIN start_filter_local_mode -->31 <li><a href="{start_filter_local_mode.URL}" title="{lang:start_filter_local_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter_mode.png" class="button" alt="{lang:start_filter_local_mode_hint}"></a></li>32 <!-- END start_filter_local_mode -->33 <!-- BEGIN stop_filter_local_mode -->34 <li><a href="{stop_filter_local_mode.URL}" title="{lang:stop_filter_local_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter_mode.png" class="button" alt="{lang:stop_filter_local_mode_hint}"></a></li>35 <!-- END stop_filter_local_mode -->36 37 30 <!-- BEGIN mode_normal --> 38 31 <li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{pwg_root}{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li> 39 32 <!-- END mode_normal --> 33 34 <!-- BEGIN flat_recent_cat --> 35 <li><a href="{flat_recent_cat.URL}" title="{lang:flat_recent_cat_hint}"><img src="{pwg_root}{themeconf:icon_dir}/flat_recent_cat.png" class="button" alt="{lang:flat_recent_cat_hint}"></a></li> 36 <!-- END flat_recent_cat --> 37 40 38 <!-- BEGIN mode_posted --> 41 39 <li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li> -
trunk/template/yoga/menubar.tpl
r1652 r1677 14 14 <!-- END links --> 15 15 <dl id="mbCategories"> 16 <!-- BEGIN start_filter _global_mode-->17 <a href="{start_filter _global_mode.URL}" title="{lang:start_filter_global_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter_mode.png" class="buttonmenu" alt="{lang:start_filter_global_mode_hint}"></a>18 <!-- END start_filter _global_mode-->19 <!-- BEGIN stop_filter _global_mode-->20 <a href="{stop_filter _global_mode.URL}" title="{lang:stop_filter_global_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter_mode.png" class="buttonmenu" alt="{lang:stop_filter_global_mode_hint}"></a>21 <!-- END stop_filter _global_mode-->16 <!-- BEGIN start_filter --> 17 <a href="{start_filter.URL}" title="{lang:start_filter_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter.png" class="buttonmenu" alt="{lang:start_filter_hint}"></a> 18 <!-- END start_filter --> 19 <!-- BEGIN stop_filter --> 20 <a href="{stop_filter.URL}" title="{lang:stop_filter_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter.png" class="buttonmenu" alt="{lang:stop_filter_hint}"></a> 21 <!-- END stop_filter --> 22 22 <dt><a href="{U_HOME}">{lang:Categories}</a></dt> 23 23 <dd> -
trunk/template/yoga/theme/clear/theme.css
r1515 r1677 16 16 } 17 17 18 #menubar DL, #content, #imageToolBar {18 #menubar DL, #content, #imageToolBar, .header_notes { 19 19 background-color: #eeeeee; 20 20 } -
trunk/template/yoga/theme/dark/theme.css
r1515 r1677 27 27 } 28 28 29 #menubar DL, #content, #imageToolBar {29 #menubar DL, #content, #imageToolBar, .header_notes { 30 30 background-color: #5f5f5f; 31 31 } -
trunk/web_service.php
r1675 r1677 171 171 SELECT DISTINCT image_id 172 172 FROM '.IMAGE_CATEGORY_TABLE.' 173 WHERE category_id NOT IN ('.$user['forbidden_categories'].') 173 WHERE 174 '.get_sql_condition_FandF 175 ( 176 array 177 ( 178 'forbidden_categories' => 'category_id', 179 'visible_categories' => 'category_id', 180 'visible_images' => 'image_id' 181 ), 182 '', true 183 ).' 174 184 AND image_id IN ('.$list.') 175 185 ;'; … … 390 400 AND i.`representative_ext` IS NULL 391 401 '.$cat_criterion.' 392 AND c.`id` NOT IN ('.$user['forbidden_categories'].') '; 402 '.get_sql_condition_FandF 403 ( 404 array 405 ( 406 'forbidden_categories' => 'c.id', 407 'visible_categories' => 'c.id', 408 'visible_images' => 'i.id' 409 ), 410 'AND' 411 ); 393 412 394 413 // AND c.`agreed_ws` = \'true\' (Obsolete specification replaced by force)
Note: See TracChangeset
for help on using the changeset viewer.