Changeset 1711
- Timestamp:
- Jan 11, 2007, 6:10:16 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/config_default.inc.php
r1690 r1711 574 574 $conf['filter_pages'] = array 575 575 ( 576 'about', 'action', 'admin', 'comments', 577 'index', 'picture', 'popuphelp', 'profile', 578 'qsearch', 'random', 'register', 'search', 579 'search_rules', 'tags', 'upload' 576 'comments', 'index', 'picture', 'qsearch', 577 'random', 'search', 'tags', 'upload' 580 578 ); 581 579 -
trunk/include/filter.inc.php
-
Property
svn:eol-style
set to
native
-
Property
svn:keywords
set to
Author Date Id Rev Revision URL
r1687 r1711 5 5 // +-----------------------------------------------------------------------+ 6 6 // | branch : BSF (Best So Far) 7 // | file : $Id : filter.inc.php 1651 2006-12-13 00:05:16Z rub$8 // | last update : $Date : 2006-12-13 01:05:16 +0100 (mer., 13 déc. 2006)$9 // | last modifier : $Author : rub$10 // | revision : $Revision : 1651$7 // | file : $Id$ 8 // | last update : $Date$ 9 // | last modifier : $Author$ 10 // | revision : $Revision$ 11 11 // +-----------------------------------------------------------------------+ 12 12 // | This program is free software; you can redistribute it and/or modify | … … 33 33 // $filter['visible_images']: List of visible images 34 34 35 36 $filter['enabled'] = 37 (in_array(script_basename(), $conf['filter_pages'])) and 38 ( 39 (isset($_GET['filter']) and ($_GET['filter'] == 'start')) or 40 pwg_get_session_var('filter_enabled', false) 41 ); 35 $filter['enabled'] = false; 42 36 43 37 if (in_array(script_basename(), $conf['filter_pages'])) 44 { 38 { // valid only on certain pages 45 39 if (isset($_GET['filter'])) 46 40 { 47 41 $filter['enabled'] = ($_GET['filter'] == 'start'); 42 if ( !$filter['enabled'] ) 43 { 44 pwg_unset_session_var('filter_enabled'); 45 pwg_unset_session_var('filter_check_key'); 46 pwg_unset_session_var('filter_categories'); 47 pwg_unset_session_var('filter_visible_categories'); 48 pwg_unset_session_var('filter_visible_images'); 49 } 48 50 } 49 51 else … … 51 53 $filter['enabled'] = pwg_get_session_var('filter_enabled', false); 52 54 } 53 }54 else55 {56 $filter['enabled'] = false;57 }58 55 59 if ($filter['enabled']) 60 { 61 if ( 62 // New filter 63 !pwg_get_session_var('filter_enabled', false) or 64 // Cache data updated 65 $user['need_update_done'] or 66 // Date, period, user are changed 67 (pwg_get_session_var('filter_check_key', '') != get_filter_check_key()) 68 ) 56 if ($filter['enabled']) 69 57 { 70 // Need to compute dats 71 $filter['check_key'] = get_filter_check_key(); 72 $filter['categories'] = get_computed_categories($user['id'], $user['forbidden_categories'], true, $user['recent_period']); 58 if ( 59 // New filter 60 !pwg_get_session_var('filter_enabled', false) or 61 // Cache data updated 62 $user['need_update_done'] or 63 // Date, period, user are changed 64 (pwg_get_session_var('filter_check_key', '') != get_filter_check_key()) 65 ) 66 { 67 // Need to compute dats 68 $filter['check_key'] = get_filter_check_key(); 69 $filter['categories'] = get_computed_categories($user['id'], $user['forbidden_categories'], true, $user['recent_period']); 73 70 74 $filter['visible_categories'] = implode(',', array_keys($filter['categories'])); 75 if (empty($filter['visible_categories'])) 71 $filter['visible_categories'] = implode(',', array_keys($filter['categories'])); 72 if (empty($filter['visible_categories'])) 73 { 74 // Must be not empty 75 $filter['visible_categories'] = -1; 76 } 77 78 $query =' 79 SELECT DISTINCT(image_id) 80 FROM '. 81 IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id = id 82 WHERE '; 83 if (!empty($filter['visible_categories'])) 84 { 85 $query.= ' 86 category_id IN ('.$filter['visible_categories'].') AND'; 87 } 88 $query.= ' 89 date_available > SUBDATE( 90 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 91 92 $filter['visible_images'] = implode(',', array_from_query($query, 'image_id')); 93 94 if (empty($filter['visible_images'])) 95 { 96 // Must be not empty 97 $filter['visible_images'] = -1; 98 } 99 100 pwg_set_session_var('filter_enabled', $filter['enabled']); 101 pwg_set_session_var('filter_check_key', $filter['check_key']); 102 pwg_set_session_var('filter_categories', serialize($filter['categories'])); 103 pwg_set_session_var('filter_visible_categories', $filter['visible_categories']); 104 pwg_set_session_var('filter_visible_images', $filter['visible_images']); 105 } 106 else 76 107 { 77 // Must be not empty 78 $filter['visible_categories'] = -1; 108 // Read only data 109 $filter['check_key'] = pwg_get_session_var('filter_check_key', ''); 110 $filter['categories'] = unserialize(pwg_get_session_var('filter_categories', serialize(array()))); 111 $filter['visible_categories'] = pwg_get_session_var('filter_visible_categories', ''); 112 $filter['visible_images'] = pwg_get_session_var('filter_visible_images', ''); 79 113 } 80 81 $query =' 82 SELECT 83 distinct image_id 84 FROM '. 85 IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id = id 86 WHERE '; 87 if (!empty($filter['visible_categories'])) 88 { 89 $query.= ' 90 category_id IN ('.$filter['visible_categories'].') and'; 91 } 92 $query.= ' 93 date_available > SUBDATE( 94 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 95 96 $filter['visible_images'] = implode(',', array_from_query($query, 'image_id')); 97 98 if (empty($filter['visible_images'])) 99 { 100 // Must be not empty 101 $filter['visible_images'] = -1; 102 } 103 104 } 105 else 106 { 107 // Read only data 108 $filter['check_key'] = pwg_get_session_var('filter_check_key', ''); 109 $filter['categories'] = unserialize(pwg_get_session_var('filter_categories', serialize(array()))); 110 $filter['visible_categories'] = pwg_get_session_var('filter_visible_categories', ''); 111 $filter['visible_images'] = pwg_get_session_var('filter_visible_images', ''); 112 } 113 114 $header_notes[] = l10n_dec('note_filter_day', 'note_filter_days', $user['recent_period']); 115 } 116 else 117 { 118 $filter['check_key'] = ''; 119 $filter['categories'] = array(); 120 $filter['visible_categories'] = ''; 121 $filter['visible_images'] = ''; 122 } 123 124 pwg_set_session_var('filter_enabled', $filter['enabled']); 125 pwg_set_session_var('filter_check_key', $filter['check_key']); 126 pwg_set_session_var('filter_categories', serialize($filter['categories'])); 127 pwg_set_session_var('filter_visible_categories', $filter['visible_categories']); 128 pwg_set_session_var('filter_visible_images', $filter['visible_images']); 129 114 $header_notes[] = l10n_dec('note_filter_day', 'note_filter_days', $user['recent_period']); 115 } // end if filter enabled 116 } // end if script_basename ... 130 117 ?> -
Property
svn:eol-style
set to
-
trunk/include/functions_metadata.inc.php
r1113 r1711 37 37 $result = array(); 38 38 39 // Read IPTC data40 $iptc = array();41 42 39 $imginfo = array(); 43 getimagesize($filename, $imginfo); 40 if (false == @getimagesize($filename, $imginfo) ) 41 { 42 return $result; 43 } 44 44 45 45 if (isset($imginfo['APP13'])) -
trunk/include/section_init.inc.php
r1703 r1711 279 279 } 280 280 281 if (preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches)) 281 if ('categories'==$page['section'] and 282 preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches)) 282 283 { 283 284 // indicate a special list of images … … 326 327 $page['super_order_by'] = true; 327 328 } 329 330 $forbidden = get_sql_condition_FandF( 331 array 332 ( 333 'forbidden_categories' => 'category_id', 334 'visible_categories' => 'category_id', 335 'visible_images' => 'image_id' 336 ), 337 'AND' 338 ); 328 339 329 340 // +-----------------------------------------------------------------------+ … … 402 413 (isset($page['category']) ? ' 403 414 AND uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '' ).' 404 '.get_sql_condition_FandF 405 ( 406 array 407 ( 408 'forbidden_categories' => 'category_id', 409 'visible_categories' => 'category_id', 410 'visible_images' => 'image_id' 411 ), 412 'AND' 413 ).' 415 '.$forbidden.' 414 416 ;'; 415 417 … … 430 432 // Main query 431 433 $query = ' 432 SELECT distinct image_id434 SELECT DISTINCT(image_id) 433 435 FROM '.IMAGE_CATEGORY_TABLE.' 434 436 INNER JOIN '.IMAGES_TABLE.' ON id = image_id 435 437 WHERE 436 438 '.$where_sql.' 437 '.get_sql_condition_FandF 438 ( 439 array 440 ( 441 'forbidden_categories' => 'category_id', 442 'visible_categories' => 'category_id', 443 'visible_images' => 'image_id' 444 ), 445 'AND' 446 ).' 439 '.$forbidden.' 447 440 '.$conf['order_by'].' 448 441 ;'; … … 459 452 else 460 453 { 461 $forbidden =462 get_sql_condition_FandF463 (464 array465 (466 'forbidden_categories' => 'category_id',467 'visible_categories' => 'category_id',468 'visible_images' => 'image_id'469 ),470 'AND'471 );472 473 454 // +-----------------------------------------------------------------------+ 474 455 // | tags section | -
trunk/include/ws_functions.inc.php
-
Property
svn:keywords
set to
Author Date Id Rev URL
r1698 r1711 5 5 // +-----------------------------------------------------------------------+ 6 6 // | branch : BSF (Best So Far) 7 // | file : $ URL: svn+ssh://rvelices@svn.gna.org/svn/phpwebgallery/trunk/action.php$8 // | last update : $Date : 2006-12-21 18:49:12 -0500 (Thu, 21 Dec 2006)$9 // | last modifier : $Author : rvelices$10 // | revision : $Rev : 1678$7 // | file : $Id$ 8 // | last update : $Date$ 9 // | last modifier : $Author$ 10 // | revision : $Rev$ 11 11 // +-----------------------------------------------------------------------+ 12 12 // | This program is free software; you can redistribute it and/or modify | … … 29 29 /** 30 30 * returns a "standard" (for our web service) array of sql where clauses that 31 * filters the images (images table only) 32 */ 31 * filters the images (images table only) 32 */ 33 33 function ws_std_image_sql_filter( $params, $tbl_name='' ) 34 34 { … … 83 83 /** 84 84 * returns a "standard" (for our web service) ORDER BY sql clause for images 85 */ 85 */ 86 86 function ws_std_image_sql_order( $params, $tbl_name='' ) 87 87 { … … 105 105 $matches[1][$i] = 'RAND()'; break; 106 106 } 107 $sortable_fields = array('id', 'file', 'name', 'hit', 'average_rate', 107 $sortable_fields = array('id', 'file', 'name', 'hit', 'average_rate', 108 108 'date_creation', 'date_available', 'RAND()' ); 109 109 if ( in_array($matches[1][$i], $sortable_fields) ) … … 125 125 * returns an array map of urls (thumb/element) for image_row - to be returned 126 126 * in a standard way by different web service methods 127 */ 127 */ 128 128 function ws_std_get_urls($image_row) 129 129 { 130 130 $ret = array( 131 'tn_url' => get_thumbnail_url($image_row), 131 'tn_url' => get_thumbnail_url($image_row), 132 132 'element_url' => get_element_url($image_row) 133 133 ); … … 148 148 /** 149 149 * returns images per category (wb service method) 150 */ 150 */ 151 151 function ws_categories_getImages($params, &$service) 152 152 { … … 279 279 'count' => count($images) 280 280 ), 281 WS_XML_CONTENT => new PwgNamedArray($images, 'image', 281 WS_XML_CONTENT => new PwgNamedArray($images, 'image', 282 282 array('id', 'tn_url', 'element_url', 'file','width','height','hit') ) 283 283 ) … … 291 291 { 292 292 global $user; 293 294 $query = '295 SELECT id, name, uppercats, global_rank,296 max_date_last, count_images AS nb_images, count_categories AS nb_categories297 FROM '.CATEGORIES_TABLE.'298 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id';299 293 300 294 $where = array(); … … 318 312 { 319 313 $where[] = 'status = "public"'; 314 $where[] = 'visible = "true"'; 320 315 } 321 316 else … … 324 319 } 325 320 326 $query .= ' 321 $query = ' 322 SELECT id, name, uppercats, global_rank, 323 max_date_last, count_images AS nb_images, count_categories AS nb_categories 324 FROM '.CATEGORIES_TABLE.' 325 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id 327 326 WHERE '. implode(' 328 327 AND ', $where); … … 350 349 return array( 351 350 'categories' => 352 new PwgNamedArray($cats,'category', 351 new PwgNamedArray($cats,'category', 353 352 array('id','url','nb_images','nb_categories','max_date_last') 354 353 ) … … 367 366 $query=' 368 367 SELECT * FROM '.IMAGES_TABLE.' 369 WHERE id='.$params['image_id'].' 368 WHERE id='.$params['image_id']. 369 get_sql_condition_FandF( 370 array('visible_images' => 'id'), 371 ' AND' 372 ).' 370 373 LIMIT 1'; 374 371 375 $image_row = mysql_fetch_assoc(pwg_query($query)); 372 376 if ($image_row==null) … … 540 544 { 541 545 global $user; 542 $tags = get_available_tags( explode(',', $user['forbidden_categories']));546 $tags = get_available_tags(); 543 547 if ($params['sort_by_counter']) 544 548 { … … 632 636 { 633 637 $where_clauses = ws_std_image_sql_filter($params); 634 $where_clauses[] = 'category_id NOT IN ('.$user['forbidden_categories'].')'; 638 $where_clauses[] = get_sql_condition_FandF( 639 array 640 ( 641 'forbidden_categories' => 'category_id', 642 'visible_categories' => 'category_id', 643 'visible_images' => 'i.id' 644 ), 645 '', true 646 ); 635 647 $where_clauses[] = 'id IN ('.implode(',',$image_ids).')'; 636 648 $order_by = ws_std_image_sql_order($params); … … 693 705 ); 694 706 } 695 $image['tags'] = new PwgNamedArray($image_tags, 'tag', 696 array('id','url_name','url','page_url') 707 $image['tags'] = new PwgNamedArray($image_tags, 'tag', 708 array('id','url_name','url','page_url') 697 709 ); 698 710 array_push($images, $image); … … 708 720 'count' => count($images) 709 721 ), 710 WS_XML_CONTENT => new PwgNamedArray($images, 'image', 722 WS_XML_CONTENT => new PwgNamedArray($images, 'image', 711 723 array('id', 'tn_url', 'element_url', 'file','width','height','hit') ) 712 724 ) -
Property
svn:keywords
set to
-
trunk/index.php
r1677 r1711 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 6PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) 8 // | file : $ RCSfile$8 // | file : $Id$ 9 9 // | last update : $Date$ 10 10 // | last modifier : $Author$ … … 117 117 } 118 118 119 if (!isset($page['flat_recent_cat']) )119 if (!isset($page['flat_recent_cat']) and 'categories'==$page['section']) 120 120 { 121 121 $template->assign_block_vars( -
trunk/picture.php
r1703 r1711 785 785 include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php'); 786 786 include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php'); 787 //if ($metadata_showable and isset($_GET['metadata']))787 if ($metadata_showable and isset($_GET['metadata'])) 788 788 { 789 789 include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
Note: See TracChangeset
for help on using the changeset viewer.