Changeset 1926 for trunk/profile.php


Ignore:
Timestamp:
Mar 28, 2007, 9:57:00 PM (17 years ago)
Author:
rub
Message:

Issue 578
User guest must be real user

Step 1: guest is a real user

On next commit, I finish installation and use of guest of user list and group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/profile.php

    r1900 r1926  
    8080  if (!isset($_POST['validate']))
    8181  {
    82     return;
     82    return false;
    8383  }
    8484
     
    115115  }
    116116
    117   $mail_error = validate_mail_address($_POST['mail_address']);
    118   if (!empty($mail_error))
    119   {
    120     $errors[] = $mail_error;
     117  if (isset($_POST['mail_address']))
     118  {
     119    $mail_error = validate_mail_address($_POST['mail_address']);
     120    if (!empty($mail_error))
     121    {
     122      $errors[] = $mail_error;
     123    }
    121124  }
    122125
     
    150153    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    151154
    152     // update common user informations
    153     $fields = array($conf['user_fields']['email']);
    154 
    155     $data = array();
    156     $data{$conf['user_fields']['id']} = $_POST['userid'];
    157     $data{$conf['user_fields']['email']} = $_POST['mail_address'];
    158 
    159     // password is updated only if filled
    160     if (!empty($_POST['use_new_pwd']))
    161     {
    162       array_push($fields, $conf['user_fields']['password']);
    163       // password is encrpyted with function $conf['pass_convert']
    164       $data{$conf['user_fields']['password']} =
    165         $conf['pass_convert']($_POST['use_new_pwd']);
    166     }
    167     mass_updates(USERS_TABLE,
    168                  array('primary' => array($conf['user_fields']['id']),
    169                        'update' => $fields),
    170                  array($data));
     155    if (isset($_POST['mail_address']))
     156    {
     157      // update common user informations
     158      $fields = array($conf['user_fields']['email']);
     159
     160      $data = array();
     161      $data{$conf['user_fields']['id']} = $_POST['userid'];
     162      $data{$conf['user_fields']['email']} = $_POST['mail_address'];
     163
     164      // password is updated only if filled
     165      if (!empty($_POST['use_new_pwd']))
     166      {
     167        array_push($fields, $conf['user_fields']['password']);
     168        // password is encrpyted with function $conf['pass_convert']
     169        $data{$conf['user_fields']['password']} =
     170          $conf['pass_convert']($_POST['use_new_pwd']);
     171      }
     172      mass_updates(USERS_TABLE,
     173                   array('primary' => array($conf['user_fields']['id']),
     174                         'update' => $fields),
     175                   array($data));
     176    }
    171177
    172178    // update user "additional" informations (specific to PhpWebGallery)
     
    191197
    192198    // redirection
    193     redirect($_POST['redirect']);
    194   }
     199    if (!empty($_POST['redirect']))
     200    {
     201      redirect($_POST['redirect']);
     202    }
     203  }
     204  return true;
    195205}
    196206
     
    284294        ));
    285295  }
    286   if ( !defined('IN_ADMIN') )
    287   {
    288     $template->assign_block_vars( 'not_admin', array() );
    289   }
     296
     297  if (!($userdata['is_the_guest'] or $userdata['is_the_default']))
     298  {
     299    $template->assign_block_vars('not_special_user', array());
     300    if ( !defined('IN_ADMIN') )
     301    {
     302      $template->assign_block_vars( 'not_special_user.not_admin', array() );
     303    }
     304  }
     305
    290306  $template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content');
    291307}
Note: See TracChangeset for help on using the changeset viewer.