Changeset 1052


Ignore:
Timestamp:
Feb 23, 2006, 6:12:32 AM (18 years ago)
Author:
rvelices
Message:

fix: permissioning not working (2 bugs)

fix: locked gallery cannot be unlocked (impossible to login)

improvement: nicer display in redirect.tpl

improvement: when a page is not accessible because of permissions (accessed
through bookmark or email), redirect to identification.php and after
identification to the initially requested page

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/identification.php

    r1029 r1052  
    3232//-------------------------------------------------------------- identification
    3333$errors = array();
     34
     35$redirect_to = '';
     36if ( !empty($_GET['redirect']) )
     37{
     38  $redirect_to = $_GET['redirect'];
     39  if ( $user['is_the_guest'] )
     40  {
     41    array_push($errors, $lang['access_forbiden']);
     42  }
     43}
     44
    3445if (isset($_POST['login']))
    3546{
     47  $redirect_to = $_POST['redirect'];
    3648  $username = mysql_escape_string($_POST['username']);
    3749  // retrieving the encrypted password of the login submitted
     
    5567    session_start();
    5668    $_SESSION['id'] = $row['id'];
    57     redirect('category.php');
     69    redirect(empty($redirect_to) ? 'category.php' : $redirect_to);
    5870  }
    5971  else
     
    8698    'U_LOST_PASSWORD' => PHPWG_ROOT_PATH.'password.php',
    8799    'U_HOME' => PHPWG_ROOT_PATH.'category.php',
     100    'U_REDIRECT' => $redirect_to,
    88101   
    89102    'F_LOGIN_ACTION' => PHPWG_ROOT_PATH.'identification.php'
  • trunk/include/common.inc.php

    r1036 r1052  
    201201if ($conf['gallery_locked'])
    202202{
     203  ob_start(); // make sure we can send cookies
    203204  echo
    204205    '<div style="text-align:center;">'
    205     .$lang['gallery_locked_message']
    206     .'</div>';
    207 
    208   if ($user['status'] != 'admin')
     206    .$lang['gallery_locked_message'];
     207  echo '<a href="'.PHPWG_ROOT_PATH.'identification.php">.</a>';
     208  echo '</div>';
     209
     210  if ( basename($_SERVER["PHP_SELF"]) != 'identification.php'
     211      and $user['status'] != 'admin' )
    209212  {
    210213    exit();
  • trunk/include/functions_category.inc.php

    r1046 r1052  
    4747  if (in_array($category_id, explode(',', $user['forbidden_categories'])))
    4848  {
    49     echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
    50     echo '<a href="./category.php">';
    51     echo $lang['thumbnails'].'</a></div>';
    52     exit();
     49    $login_url = './identification.php?redirect='.
     50                  htmlentities(htmlentities($_SERVER['REQUEST_URI']));
     51    if ( ! $user['is_the_guest'] )
     52    {
     53      echo '<div style="text-align:center;">';
     54      echo $lang['hello'].' '.$user['username'].'! ';
     55      echo $lang['access_forbiden'].'<br />';
     56      echo '<a href="./category.php">'.$lang['thumbnails'].'</a> ';
     57      echo '</div>';
     58      exit();
     59    }
     60    else
     61    {
     62      redirect($login_url);
     63    }
    5364  }
    5465}
  • trunk/include/user.inc.php

    r1036 r1052  
    5959  $user['is_the_guest'] = false;
    6060}
    61 
    6261$user = array_merge(
    6362  $user,
    6463  getuserdata(
    6564    $user['id'],
    66     defined('IN_ADMIN') and IN_ADMIN ? false : true // use cache ?
     65    ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true // use cache ?
    6766    )
    6867  );
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r1050 r1052  
    114114$lang['Weekly'] = 'Weekly';
    115115$lang['about_page_title'] = 'About PhpWebGallery';
    116 $lang['access_forbiden'] = 'You are not authorized to access this page';
     116$lang['access_forbiden'] = 'You are not authorized to access the requested page';
    117117$lang['add to caddie'] = 'add to caddie';
    118118$lang['add_favorites_alt'] = 'Add to favorites';
     
    137137$lang['calendar_picture_hint'] = 'displays pictures added on ';
    138138$lang['categories'] = 'Categories';
     139$lang['click_to_redirect'] = 'Click here if your browser does not automatically forward you';
    139140$lang['comment date'] = 'comment date';
    140141$lang['comment'] = 'Comment';
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r1050 r1052  
    113113$lang['Weekly'] = 'Hebdomadaire';
    114114$lang['about_page_title'] = 'À propos de PhpWebGallery';
    115 $lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur cette page';
     115$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
    116116$lang['add to caddie'] = 'ajouter au panier';
    117117$lang['add_favorites_alt'] = 'Ajouter aux favoris';
     
    136136$lang['calendar_picture_hint'] = 'affiche les images du ';
    137137$lang['categories'] = 'Catégories';
     138$lang['click_to_redirect'] = 'Cliquez ici si votre navigateur ne vous redirige pas.';
    138139$lang['comment date'] = 'date du commentaire';
    139140$lang['comment'] = 'Commentaire';
  • trunk/picture.php

    r1051 r1052  
    3030define('PHPWG_ROOT_PATH','./');
    3131include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     32
     33include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
    3234//-------------------------------------------------- access authorization check
    3335if (isset($page['cat']) and is_numeric($page['cat']))
     
    3638}
    3739//-------------------------------------------------------------- initialization
    38 include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
    39 
    4040// if this image_id doesn't correspond to this category, an error message is
    4141// displayed, and execution is stopped
  • trunk/template/yoga/identification.tpl

    r960 r1052  
    2424  <fieldset>
    2525    <legend>{lang:Connection settings}</legend>
    26 
     26     <input type="hidden" name="redirect" value="{U_REDIRECT}">
    2727    <ul>
    2828      <li>
  • trunk/template/yoga/redirect.tpl

    r1041 r1052  
    1 redirection<br/>
    2 <a href="{U_REFRESH}">{U_REFRESH}</a>
     1<p>Redirection...</p>
     2<p><a href="{U_REFRESH}">{lang:click_to_redirect}</a></p>
Note: See TracChangeset for help on using the changeset viewer.