Changeset 1082 for trunk/random.php


Ignore:
Timestamp:
Mar 15, 2006, 11:44:35 PM (18 years ago)
Author:
plg
Message:

new: cleaner URL. Instead of category.php?cat=search&search=123&start=42,
you now have category.php?/search/123/start-42. Functions make_index_url and
make_picture_url build these new URLs. Functions duplicate_picture_url and
duplicate_index_url provide shortcuts to URL creation. The current main page
page is still category.php but this can be modified easily in make_index_url
function. In this first version, no backward compatibility. Calendar
definition in URL must be discussed with rvelices.

improvement: picture.php redesigned. First actions like "set as
representative" or "delete a comment" which all lead to a redirection. Then
the page (the big mess) and includes of new sub pages to manage specific
parts of the page (metadata, user comments, rates).

new: with the cleaner URL comes a new terminology. $pagecat doesn't
exist anymore. $pagesection is among 'categories', 'tags' (TODO),
'list', 'most_seen'... And sub parameters are set : $pagecategory if
$pagesection is "categories". See URL analyse in
include/section_init.inc.php for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/random.php

    r1072 r1082  
    2929// |                          define and include                           |
    3030// +-----------------------------------------------------------------------+
     31
    3132define('PHPWG_ROOT_PATH','./');
    3233include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     
    4142// +-----------------------------------------------------------------------+
    4243
    43 // we must not show pictures of a forbidden category
    44 $where = '';
    45 if ( $user['forbidden_categories'] != '' )
    46 {
    47   $where = 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')';
    48 }
    49 
    5044$query = '
    5145SELECT DISTINCT(id)
    5246  FROM '.IMAGES_TABLE.'
    5347    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
    54   '.$where.'
     48  '.(
     49    $user['forbidden_categories'] != ''
     50      ? 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')'
     51      : ''
     52    ).'
    5553  ORDER BY RAND(NOW())
    5654  LIMIT 0, '.$conf['top_number'].'
    5755;';
    58 $result = pwg_query($query);
    59 $ids = array();
    60 while ($row = mysql_fetch_array($result))
    61 {
    62   array_push($ids, $row['id']);
    63 }
     56
    6457// +-----------------------------------------------------------------------+
    6558// |                                redirect                               |
    6659// +-----------------------------------------------------------------------+
    67 $url = PHPWG_ROOT_PATH.'category.php?cat=list&list='.implode(',', $ids);
    68 redirect($url);
     60
     61redirect(make_index_URL(array('list' => array_from_query($query, 'id'))));
    6962?>
Note: See TracChangeset for help on using the changeset viewer.