Ignore:
Timestamp:
Jul 10, 2012, 5:37:33 PM (12 years ago)
Author:
mistic100
Message:

-menu always displayed if user has unactive collections
-better user status checks
-localizations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/collections.inc.php

    r16591 r16597  
    88switch ($page['sub_section'])
    99{
     10  /* list */
    1011  case 'list':
    1112  {
     13    if (is_a_guest()) access_denied();
     14   
    1215    $template->set_filename('index', dirname(__FILE__) . '/../template/list.tpl');
    1316   
     
    125128    {
    126129      $col['date_creation'] = format_date($col['date_creation'], true);
    127       $col['U_VIEW'] = USER_COLLEC_PUBLIC.'view/'.$col['id'];
    128130      $col['U_EDIT'] = USER_COLLEC_PUBLIC.'edit/'.$col['id'];
    129131      $col['U_ACTIVE'] = USER_COLLEC_PUBLIC.'&action=set_active&col_id='.$col['id'];
     
    133135      {
    134136        $col['name'] = 'temp #'.$col['id'];
     137        $col['U_VIEW'] = $col['U_EDIT'];
    135138        $col['U_SAVE'] = USER_COLLEC_PUBLIC.'&action=save&col_id='.$col['id'];
    136139        $template->append('temp_col', $col);
     
    138141      else
    139142      {
     143        $col['U_VIEW'] = USER_COLLEC_PUBLIC.'view/'.$col['id'];
    140144        $template->append('collections', $col);
    141145      }
     
    145149    break;
    146150  }
    147    
     151 
     152  /* edit */
    148153  case 'edit':
    149154  {
     
    165170    try {
    166171      $UserCollection = new UserCollection($page['col_id']);
     172     
     173      if (!is_admin() and $UserCollection->getParam('user_id') != $user['id'])
     174      {
     175        access_denied();
     176      }
    167177     
    168178      // save properties
     
    199209     
    200210      include(PHPWG_ROOT_PATH . 'include/category_default.inc.php');
     211     
     212      $template->concat('TITLE', $conf['level_separator'].$UserCollection->getParam('name'));
    201213    }
    202214    catch (Exception $e)
     
    208220  }
    209221 
     222  /* view */
    210223  case 'view':
    211224  {
     
    234247     
    235248      $template->assign('collection', $UserCollection->getCollectionInfo());
    236      
    237       include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    238       $template->assign('OWNER', get_username($UserCollection->getParam('user_id')));
    239249     
    240250      $page['start'] = isset($_GET['start']) ? $_GET['start'] : 0;
     
    254264     
    255265      include(PHPWG_ROOT_PATH . 'include/category_default.inc.php');
     266     
     267      include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     268      $template->concat('TITLE',
     269        $conf['level_separator'].$UserCollection->getParam('name').
     270        ' ('.sprintf(l10n('by %s'), get_username($UserCollection->getParam('user_id'))).')'
     271        );
    256272    }
    257273    catch (Exception $e)
    258274    {
    259       array_push($page['errors'], $e->getMessage());
     275      access_denied();
    260276    }
    261277   
    262278    break;
    263279  }
    264    
    265   // case 'send':
    266   // {
    267    
    268     // break;
    269   // }
    270280}
    271281
Note: See TracChangeset for help on using the changeset viewer.