Changeset 1082 for trunk/admin/include


Ignore:
Timestamp:
Mar 15, 2006, 11:44:35 PM (19 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/admin/include/functions.php

    r1070 r1082  
    781781    $query = '
    782782UPDATE '.$tablename.' AS t1, '.$temporary_tablename.' AS t2
    783   SET '.implode("\n    , ",
    784                 array_map(
    785                   create_function('$s', 'return "t1.$s = t2.$s";')
    786                   , $dbfields['update'])).'
    787   WHERE '.implode("\n    AND ",
    788                 array_map(
    789                   create_function('$s', 'return "t1.$s = t2.$s";')
    790                   , $dbfields['primary'])).'
     783  SET '.
     784      implode(
     785        "\n    , ",
     786        array_map(
     787          create_function('$s', 'return "t1.$s = t2.$s";'),
     788          $dbfields['update']
     789          )
     790        ).'
     791  WHERE '.
     792      implode(
     793        "\n    AND ",
     794        array_map(
     795          create_function('$s', 'return "t1.$s = t2.$s";'),
     796          $dbfields['primary']
     797          )
     798        ).'
    791799;';
    792800    pwg_query($query);
     
    841849  foreach ($uppercats_array as $id => $uppercats)
    842850  {
    843     $data = array();
    844     $data['id'] = $id;
    845     $global_rank = preg_replace('/(\d+)/e',
    846                                 "\$ranks_array['$1']",
    847                                 str_replace(',', '.', $uppercats));
    848     $data['global_rank'] = $global_rank;
    849     array_push($datas, $data);
    850   }
    851 
    852   $fields = array('primary' => array('id'), 'update' => array('global_rank'));
    853   mass_updates(CATEGORIES_TABLE, $fields, $datas);
     851    array_push(
     852      $datas,
     853      array(
     854        'id'          => $id,
     855        'global_rank' => preg_replace(
     856          '/(\d+)/e',
     857          "\$ranks_array['$1']",
     858          str_replace(',', '.', $uppercats)
     859          ),
     860        )
     861      );
     862  }
     863
     864  mass_updates(
     865    CATEGORIES_TABLE,
     866    array(
     867      'primary' => array('id'),
     868      'update'  => array('global_rank')
     869      ),
     870    $datas
     871    );
    854872}
    855873
     
    12541272  // users present in user related tables must be present in the base user
    12551273  // table
    1256   $tables =
    1257     array(
    1258       USER_MAIL_NOTIFICATION_TABLE,
    1259       USER_FEED_TABLE,
    1260       USER_INFOS_TABLE,
    1261       USER_ACCESS_TABLE,
    1262       USER_CACHE_TABLE,
    1263       USER_GROUP_TABLE
    1264       );
     1274  $tables = array(
     1275    USER_MAIL_NOTIFICATION_TABLE,
     1276    USER_FEED_TABLE,
     1277    USER_INFOS_TABLE,
     1278    USER_ACCESS_TABLE,
     1279    USER_CACHE_TABLE,
     1280    USER_GROUP_TABLE
     1281    );
     1282 
    12651283  foreach ($tables as $table)
    12661284  {
     
    12691287  FROM '.$table.'
    12701288;';
    1271     $to_delete =
    1272       array_diff(
    1273         array_from_query($query, 'user_id'),
    1274         $base_users
    1275         );
     1289    $to_delete = array_diff(
     1290      array_from_query($query, 'user_id'),
     1291      $base_users
     1292      );
    12761293
    12771294    if (count($to_delete) > 0)
Note: See TracChangeset for help on using the changeset viewer.