Changeset 1860
- Timestamp:
- Feb 27, 2007, 12:52:22 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/filter.inc.php
r1723 r1860 4 4 // | Copyright (C) 2006-2007 PhpWebGallery Team - http://phpwebgallery.net | 5 5 // +-----------------------------------------------------------------------+ 6 // | branch : BSF (Best So Far)7 6 // | file : $Id$ 8 7 // | last update : $Date$ … … 76 75 // Need to compute dats 77 76 $filter['check_key'] = get_filter_check_key(); 78 $filter['categories'] = get_computed_categories($user ['id'], $user['forbidden_categories'], true,$filter['recent_period']);77 $filter['categories'] = get_computed_categories($user, (int)$filter['recent_period']); 79 78 80 79 $filter['visible_categories'] = implode(',', array_keys($filter['categories'])); -
trunk/include/functions_user.inc.php
r1854 r1860 273 273 calculate_permissions($userdata['id'], $userdata['status']); 274 274 275 update_user_cache_categories($userdata ['id'], $userdata['forbidden_categories']);275 update_user_cache_categories($userdata); 276 276 277 277 // Set need update are done … … 534 534 * get computed array of categories 535 535 * 536 * @param int user_id 537 * @param list user_forbidden_categories 538 * @param bool filter_enabled 539 * @param int recent_period 536 * @param array userdata 537 * @param int filter_days number of recent days to filter on or null 540 538 * @return array 541 539 */ 542 function get_computed_categories($user_id, $user_forbidden_categories, $filter_enabled, $recent_period = 0) 543 { 544 $query = ' 545 SELECT 546 c.id cat_id, 547 date_last max_date_last, 548 nb_images count_images, 549 global_rank'; 550 551 if (!$filter_enabled) 552 { 553 $query.= ' 554 FROM '.CATEGORIES_TABLE.' as c'; 540 function get_computed_categories($userdata, $filter_days=null) 541 { 542 $group_by = ''; 543 544 $query = 'SELECT c.id cat_id, global_rank'; 545 if ( !isset($filter_days) ) 546 { 547 $query .= ', 548 date_last cat_date_last, 549 nb_images cat_nb_images 550 FROM '.CATEGORIES_TABLE.' as c'; 555 551 } 556 552 else 557 553 { 558 554 // Count by date_available to avoid count null 559 $query .= ',560 count(date_available) filtered_count_images,561 max(date_available) max_date_available562 FROM '.CATEGORIES_TABLE.' as c555 $query .= ', 556 MAX(date_available) cat_date_last, 557 COUNT(date_available) cat_nb_images 558 FROM '.CATEGORIES_TABLE.' as c 563 559 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 564 560 LEFT JOIN '.IMAGES_TABLE.' AS i 565 ON ic.image_id = i.id AND 566 i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$recent_period.' DAY)'; 567 } 568 569 if ($user_forbidden_categories != '') 561 ON ic.image_id = i.id AND 562 i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$filter_days.' DAY)'; 563 $group_by = 'c.id'; 564 } 565 566 if ( !empty($userdata['forbidden_categories']) ) 570 567 { 571 568 $query.= ' 572 WHERE 573 c.id NOT IN ('.$user_forbidden_categories.')'; 574 } 575 576 if ($filter_enabled) 569 WHERE c.id NOT IN ('.$userdata['forbidden_categories'].')'; 570 } 571 572 if ( !empty($group_by) ) 577 573 { 578 574 $query.= ' 579 GROUP BY 580 c.id'; 581 } 582 $query.= ';'; 575 GROUP BY '.$group_by; 576 } 583 577 584 578 $result = pwg_query($query); … … 587 581 while ($row = mysql_fetch_assoc($result)) 588 582 { 589 $row['user_id'] = $user _id;583 $row['user_id'] = $userdata['id']; 590 584 $row['count_categories'] = 0; 591 if ($filter_enabled) 592 { 593 $row['nb_images'] = $row['filtered_count_images']; 594 $row['count_images'] = $row['filtered_count_images']; 595 $row['max_date_last'] = $row['max_date_available']; 596 } 585 $row['count_images'] = $row['cat_nb_images']; 586 $row['max_date_last'] = $row['cat_date_last']; 587 597 588 $cats += array($row['cat_id'] => $row); 598 589 } … … 601 592 compute_categories_data($cats); 602 593 603 if ( $filter_enabled)594 if ( isset($filter_days) ) 604 595 { 605 596 $cat_tmp = $cats; 606 597 $cats = array(); 607 598 608 599 foreach ($cat_tmp as $category) 609 600 { … … 612 603 // Re-init counters 613 604 $category['count_categories'] = 0; 614 $category['nb_images'] = $category['filtered_count_images']; 615 $category['count_images'] = $category['filtered_count_images']; 605 $category['count_images'] = $category['cat_nb_images']; 606 // next line for update_cats_with_filtered_data 607 $category['nb_images'] = $category['cat_nb_images']; 616 608 // Keep category 617 609 $cats[$category['cat_id']] = $category; 618 619 610 } 620 611 } … … 622 613 compute_categories_data($cats); 623 614 } 624 625 615 return $cats; 626 616 } … … 629 619 * update data of user_cache_categories 630 620 * 631 * @param int user_id 632 * @param list user_forbidden_categories 633 * @param bool filter_enabled 621 * @param array userdata 634 622 * @return null 635 623 */ 636 function update_user_cache_categories($user _id, $user_forbidden_categories)624 function update_user_cache_categories($userdata) 637 625 { 638 626 // delete user cache 639 627 $query = ' 640 628 DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.' 641 WHERE user_id = '.$user _id.'629 WHERE user_id = '.$userdata['id'].' 642 630 ;'; 643 631 pwg_query($query); 644 632 645 $cats = get_computed_categories($user _id, $user_forbidden_categories, false);633 $cats = get_computed_categories($userdata, null); 646 634 647 635 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); -
trunk/include/picture_comment.inc.php
r1849 r1860 57 57 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 58 58 59 $comment_action = insert_user_comment( 60 $comm, @$_POST['key'], $page['image_id'], $infos 61 ); 59 $comment_action = insert_user_comment($comm, @$_POST['key'], $infos ); 62 60 63 61 switch ($comment_action) -
trunk/language/en_UK.iso-8859-1/common.lang.php
r1840 r1860 490 490 $lang['maxwidth'] = 'Maximum width of the pictures'; 491 491 $lang['maxwidth_error'] = 'Maximum width must be a number superior to 50'; 492 $lang['flat_hint'] = 'flat display elements of categories and sub-categories';493 $lang['start_filter_hint'] = 'displays only recent elements';494 $lang['stop_filter_hint'] = 'return to display all elements';495 492 $lang['mode_created_hint'] = 'displays a calendar by creation date'; 493 $lang['mode_flat_hint'] = 'displays all elements in all sub-categories'; 496 494 $lang['mode_normal_hint'] = 'return to normal view mode'; 497 $lang['mode_posted_hint'] = 'displays a calendar by date posted';495 $lang['mode_posted_hint'] = 'displays a calendar by posted date'; 498 496 $lang['month'][10] = 'October'; 499 497 $lang['month'][11] = 'November'; … … 521 519 $lang['no_category'] = 'Home'; 522 520 $lang['no_rate'] = 'no rate'; 521 $lang['note_filter_day'] = 'Only displays elements posted within the last %s day.'; 522 $lang['note_filter_days'] = 'Only displays elements posted within the last %s days.'; 523 523 $lang['password updated'] = 'password updated'; 524 524 $lang['periods_error'] = 'Recent period must be a positive integer value'; … … 580 580 $lang['special_categories'] = 'Specials'; 581 581 $lang['sql_queries_in'] = 'SQL queries in'; 582 $lang['start_filter_hint'] = 'displays only recently posted elements'; 583 $lang['stop_filter_hint'] = 'return to the display of all elements'; 582 584 $lang['submit'] = 'Submit'; 583 585 $lang['the beginning'] = 'the beginning'; … … 612 614 $lang['w_month'] = 'Month'; 613 615 $lang['yes'] = 'Yes'; 614 $lang['note_filter_day'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s day.';615 $lang['note_filter_days'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s days.';616 616 $lang['page_end'] = 'Page bottom'; 617 618 617 ?> -
trunk/language/fr_FR.iso-8859-1/common.lang.php
r1840 r1860 490 490 $lang['maxwidth'] = 'Largeur maximum des images'; 491 491 $lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50'; 492 $lang['flat_hint'] = 'affiche à plat les éléments des catégories et des sous-catégories';493 $lang['start_filter_hint'] = 'afficher que les éléments récents';494 $lang['stop_filter_hint'] = 'retourner à l\'affichage de tous les éléments';495 492 $lang['mode_created_hint'] = 'afficher un calendrier par date de création'; 493 $lang['mode_flat_hint'] = 'afficher à plat les éléments des catégories et des sous-catégories'; 496 494 $lang['mode_normal_hint'] = 'retourner à la vue normale'; 497 495 $lang['mode_posted_hint'] = 'afficher un calendrier par date d\'ajout'; … … 521 519 $lang['no_category'] = 'Accueil'; 522 520 $lang['no_rate'] = 'pas de note'; 521 $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.'; 522 $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.'; 523 523 $lang['password updated'] = 'mot de passe mis à jour'; 524 524 $lang['periods_error'] = 'La période de nouveauté doit être un entier positif'; … … 558 558 $lang['search_categories'] = 'Rechercher dans les catégories'; 559 559 $lang['search_date'] = 'Recherche par date'; 560 $lang['search_date_creation'] = 'Création';561 560 $lang['search_date_from'] = 'Date'; 562 561 $lang['search_date_to'] = 'Date de fin'; … … 564 563 $lang['search_descending'] = 'Décroissant'; 565 564 $lang['search_keywords'] = 'Recherche de mot'; 566 $lang['sear 565 $lang['search_mode_and'] = 'Rechercher tous les mots'; 567 566 $lang['search_mode_or'] = 'Rechercher un des mots'; 568 567 $lang['search_one_clause_at_least'] = 'Requête vide. Aucun critère fourni.'; … … 581 580 $lang['special_categories'] = 'Spéciales'; 582 581 $lang['sql_queries_in'] = 'requêtes SQL en'; 582 $lang['start_filter_hint'] = 'afficher que les éléments récents'; 583 $lang['stop_filter_hint'] = 'retourner à l\'affichage de tous les éléments'; 583 584 $lang['submit'] = 'Valider'; 584 585 $lang['the beginning'] = 'le début'; … … 613 614 $lang['w_month'] = 'Mois'; 614 615 $lang['yes'] = 'Oui'; 615 $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.';616 $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 616 $lang['page_end'] = 'Bas de page'; 618 619 617 ?> -
trunk/plugins/admin_multi_view/is_admin.inc.php
r1821 r1860 14 14 } 15 15 $lang = pwg_get_session_var( 'multiview_lang', '' ); 16 if ( !empty($ theme) )16 if ( !empty($lang) ) 17 17 { 18 18 $user['language'] = $lang; -
trunk/template/yoga/index.tpl
r1820 r1860 33 33 34 34 <!-- BEGIN flat --> 35 <li><a href="{flat.URL}" title="{lang: flat_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/flat.png" class="button" alt="{lang:flat_hint}"></a></li>35 <li><a href="{flat.URL}" title="{lang:mode_flat_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/flat.png" class="button" alt="{lang:flat_hint}"></a></li> 36 36 <!-- END flat --> 37 37
Note: See TracChangeset
for help on using the changeset viewer.