Ignore:
Timestamp:
Dec 10, 2006, 11:48:32 PM (17 years ago)
Author:
rub
Message:

Feature Issue ID 0000601: Filter all public pages with only recent elements

It's a draft of the feature witch allows to show only recent elements.
Development are not finished.
Queries and special pages (best rates, tags, etc.) are not modified.
Only main php files about images and categories are ok.

Before to continue, I prefer to determinate a solution between modify cache implementation or hide counters.

Go to http://forum.phpwebgallery.net/viewtopic.php?pid=50015#p50015

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_cats.inc.php

    r1643 r1648  
    5555  ON id = cat_id and user_id = '.$user['id'].'
    5656  WHERE id_uppercat '.
    57   (!isset($page['category']) ? 'is NULL' : '= '.$page['category']).'
     57  (!isset($page['category']) ? 'is NULL' : '= '.$page['category']);
     58  if ($page['filter_mode'])
     59  {
     60    $query.= '
     61    AND max_date_last > SUBDATE(
     62      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
     63  }
     64  $query.= '
    5865  ORDER BY rank
    5966;';
     
    7885SELECT image_id
    7986  FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
    80     ON ic.category_id = c.id
     87    ON ic.category_id = c.id';
     88    if ($page['filter_mode'])
     89    {
     90      $query.= '
     91    INNER JOIN '.IMAGES_TABLE.' AS i on ic.image_id = i.id ';
     92    }
     93    $query.= '
    8194  WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
    82     AND c.id NOT IN ('.$user['forbidden_categories'].')
     95    AND c.id NOT IN ('.$user['forbidden_categories'].')';
     96    if ($page['filter_mode'])
     97    {
     98      $query.= '
     99    AND i.date_available  > SUBDATE(
     100      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
     101    }
     102    $query.= '
    83103  ORDER BY RAND()
    84104  LIMIT 0,1
     
    94114    $query = '
    95115SELECT representative_picture_id
    96   FROM '.CATEGORIES_TABLE.'
     116  FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
     117  ON id = cat_id and user_id = '.$user['id'].'
    97118  WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
    98     AND id NOT IN ('.$user['forbidden_categories'].')
    99     AND representative_picture_id IS NOT NULL
     119    AND representative_picture_id IS NOT NULL';
     120    if ($page['filter_mode'])
     121    {
     122      $query.= '
     123      AND max_date_last > SUBDATE(
     124        CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
     125    }
     126    $query.= '
    100127  ORDER BY RAND()
    101128  LIMIT 0,1
Note: See TracChangeset for help on using the changeset viewer.