Changeset 1070


Ignore:
Timestamp:
Mar 9, 2006, 12:14:53 AM (18 years ago)
Author:
rub
Message:

Step 1 improvement issue 0000301:

o Change status of table #_user_infos
o Don't send password to webmaster, guest, generic

Next Step:

o Functions Check of status
o Restricted Access for user generic

Location:
trunk
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r1068 r1070  
    12311231      $insert = array();
    12321232      $insert['user_id'] = $user_id;
    1233       $insert['status'] = 'guest';
     1233      $insert['status'] = 'normal';
    12341234      $insert['template'] = $conf['default_template'];
    12351235      $insert['nb_image_line'] = $conf['nb_image_line'];
  • trunk/admin/include/isadmin.inc.php

    r675 r1070  
    2828include( PHPWG_ROOT_PATH.'admin/include/functions.php' );
    2929
    30 if ($user['status'] != 'admin')
     30if (!is_admin())
    3131{
    3232  echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />';
  • trunk/admin/mailtousers.php

    r1049 r1070  
    7878function update_data_user_mail_notification()
    7979{
    80 /*  $query = '
    81 insert into '.USER_MAIL_NOTIFICATION_TABLE.'
    82   (user_id, enabled)
    83   (select id, \'false\' from '.USERS_TABLE.'
    84   where mail_address is not null and id not in (select user_id from '.USER_MAIL_NOTIFICATION_TABLE.'))
    85 ;';
    86   pwg_query($query);*/
    87 
    8880  global $conf, $page;
     81
     82  // Set null mail_address empty
     83  $query = '
     84update
     85  '.USERS_TABLE.'
     86set
     87  mail_address = null
     88where
     89  trim(mail_address) = \'\';';
     90  pwg_query($query);
    8991
    9092  $query = '
  • trunk/admin/user_list.php

    r1048 r1070  
    378378      if ($conf['webmaster_id'] == $user_id and isset($data['status']))
    379379      {
    380         $data['status'] = 'admin';
     380        $data['status'] = 'webmaster';
    381381      }
    382382     
     
    650650    $selected = $_POST['status'] == $status ? 'selected="selected"' : '';
    651651  }
    652   else if ('guest' == $status)
     652  else if ('normal' == $status)
    653653  {
    654654    $selected = 'selected="selected"';
  • trunk/category.php

    r1059 r1070  
    369369  }
    370370
    371   if ('admin' == $user['status'])
     371  if (is_admin())
    372372  {
    373373    $template->assign_block_vars('admin', array());
     
    409409if (isset($page['cat'])
    410410    and is_numeric($page['cat'])
    411     and 'admin' == $user['status'])
     411    and is_admin())
    412412{
    413413  $template->assign_block_vars(
  • trunk/include/common.inc.php

    r1052 r1070  
    209209
    210210  if ( basename($_SERVER["PHP_SELF"]) != 'identification.php'
    211       and $user['status'] != 'admin' )
     211      and !is_admin() )
    212212  {
    213213    exit();
  • trunk/include/functions.inc.php

    r1048 r1070  
    356356  if ($conf['log'])
    357357  {
    358    if ( ($conf['history_admin'] ) or  ( (! $conf['history_admin'])  and ($user['status'] != 'admin')  ) )
     358   if ( ($conf['history_admin'] ) or  ( (! $conf['history_admin'])  and (!is_admin())  ) )
    359359          {
    360360    $login = ($user['id'] == $conf['guest_id'])
  • trunk/include/functions_notification.inc.php

    r1021 r1070  
    193193  }
    194194 
    195   if ('admin' == $user['status'])
     195  if (is_admin())
    196196  {
    197197    $nb_unvalidated_comments = count(unvalidated_comments($end));
  • trunk/include/functions_user.inc.php

    r1068 r1070  
    293293
    294294  // if user is not an admin, locked categories can be considered as private$
    295   if ($user_status != 'admin')
     295  if (!is_admin())
    296296  {
    297297    $query = '
     
    440440    array(
    441441      'user_id' => $user_id,
    442       'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'guest',
     442      'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'normal',
    443443      'template' => $conf['default_template'],
    444444      'nb_image_line' => $conf['nb_image_line'],
     
    537537}
    538538
     539/*
     540 * Return if current is an administrator
     541 * @return bool
     542*/
     543function is_admin()
     544{
     545  global $user;
     546 
     547  return ($user['status'] == 'webmaster' or $user['status'] == 'admin') ? true : false;
     548}
     549
    539550?>
  • trunk/install/phpwebgallery_structure.sql

    r1064 r1070  
     1-- MySQL dump 9.11
    12-- MySQL dump 9.11
    23--
     
    295296  `nb_image_line` tinyint(1) unsigned NOT NULL default '5',
    296297  `nb_line_page` tinyint(3) unsigned NOT NULL default '3',
    297   `status` enum('admin','guest') NOT NULL default 'guest',
     298  `status` enum('webmaster', 'admin', 'normal', 'generic', 'guest') NOT NULL default 'guest',
    298299  `language` varchar(50) NOT NULL default 'english',
    299300  `maxwidth` smallint(6) default NULL,
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r1066 r1070  
    393393$lang['user_id URL parameter is missing'] = 'user_id URL parameter is missing';
    394394$lang['user_status'] = 'User status';
     395$lang['user_status_webmaster'] = 'Webmaster';
    395396$lang['user_status_admin'] = 'Administrator';
    396 $lang['user_status_guest'] = 'User';
     397$lang['user_status_normal'] = 'User';
     398$lang['user_status_generic'] = 'Generic';
     399$lang['user_status_guest'] = 'Guest';
    397400$lang['username'] = 'username';
    398401$lang['users'] = 'Users';
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r1066 r1070  
    393393$lang['user_id URL parameter is missing'] = 'le paramètre d\'URL "user_id" manque';
    394394$lang['user_status'] = 'Statut de l\'utilisateur';
     395$lang['user_status_webmaster'] = 'Webmestre';
    395396$lang['user_status_admin'] = 'Administrateur';
    396 $lang['user_status_guest'] = 'Visiteur';
     397$lang['user_status_normal'] = 'Visiteur';
     398$lang['user_status_generic'] = 'Générique';
     399$lang['user_status_guest'] = 'Invité';
    397400$lang['username'] = 'nom utilisateur';
    398401$lang['users'] = 'Utilisateurs';
  • trunk/password.php

    r1018 r1070  
    7070     , '.$conf['user_fields']['username'].' AS username
    7171     , '.$conf['user_fields']['email'].' AS email
    72   FROM '.USERS_TABLE.'
    73   WHERE '.$conf['user_fields']['email'].' = \''.$mail_address.'\'
     72FROM '.USERS_TABLE.' as u
     73  INNER JOIN '.USER_INFOS_TABLE.' AS ui
     74      ON u.'.$conf['user_fields']['id'].' = ui.user_id
     75WHERE '
     76  .$conf['user_fields']['email'].' = \''.$mail_address.'\' AND
     77  ui.status not in (\'guest\', \'generic\', \'webmaster\')
    7478;';
    7579    $result = pwg_query($query);
  • trunk/picture.php

    r1059 r1070  
    115115
    116116//-------------------------------------------------------------- representative
    117 if ('admin' == $user['status'] and isset($_GET['representative']))
     117if (is_admin() and isset($_GET['representative']))
    118118{
    119119  $query = '
     
    481481      $data{'content'} = htmlspecialchars( $_POST['content'], ENT_QUOTES);
    482482
    483       if (!$conf['comments_validation'] or $user['status'] == 'admin')
     483      if (!$conf['comments_validation'] or is_admin())
    484484      {
    485485        $data{'validated'} = 'true';
     
    499499      $message = $lang['comment_added'];
    500500
    501       if (!$conf['comments_validation'] or $user['status'] == 'admin')
    502 
    503       if ( $conf['comments_validation'] and $user['status'] != 'admin' )
     501      if (!$conf['comments_validation'] or is_admin())
     502
     503      if ( $conf['comments_validation'] and !is_admin() )
    504504      {
    505505        $message.= '<br />'.$lang['comment_to_validate'];
     
    520520if ( isset( $_GET['del'] )
    521521     and is_numeric( $_GET['del'] )
    522      and $user['status'] == 'admin' )
     522     and is_admin() )
    523523{
    524524  $query = 'DELETE FROM '.COMMENTS_TABLE;
     
    687687}
    688688// button to set the current picture as representative
    689 if ('admin' == $user['status'] and
     689if (is_admin() and
    690690    isset($page['cat']) and is_numeric($page['cat']))
    691691{
     
    701701}
    702702
    703 if ('admin' == $user['status'])
     703if (is_admin())
    704704{
    705705  $template->assign_block_vars(
     
    753753}
    754754//------------------------------------ admin link for information modifications
    755 if ( $user['status'] == 'admin' )
     755if ( is_admin() )
    756756{
    757757  $template->assign_block_vars('admin', array());
     
    11531153    ));
    11541154
    1155       if ( $user['status'] == 'admin' )
     1155      if ( is_admin() )
    11561156      {
    11571157        $template->assign_block_vars(
Note: See TracChangeset for help on using the changeset viewer.