Changeset 345 for trunk/profile.php


Ignore:
Timestamp:
Feb 2, 2004, 1:55:18 AM (20 years ago)
Author:
gweltas
Message:

Merge of the 1.3.1 release
Creation of an unique include file (common.php)
Creation of an unique define file (include/constants.php)
Modification of the installation procedure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/profile.php

    r60 r345  
    1818 ***************************************************************************/
    1919// customize appearance of the site for a user
    20 //----------------------------------------------------------- personnal include
    21 include_once( './include/init.inc.php' );
     20//----------------------------------------------------------- include
     21$phpwg_root_path = './';
     22include_once( $phpwg_root_path.'common.php' );
    2223//-------------------------------------------------- access authorization check
    2324check_login_authorization();
     
    2829  exit();
    2930}
    30 //-------------------------------------------------------------- initialization
    31 check_cat_id( $_GET['cat'] );
    3231//------------------------------------------------------ update & customization
    3332$infos = array( 'nb_image_line', 'nb_line_page', 'language',
     
    7069  }
    7170  $mail_error = validate_mail_address( $_POST['mail_address'] );
    72   if ( $mail_error != '' )
    73   {
    74     array_push( $errors, $mail_error );
    75   }
    76   if ( $_POST['use_new_pwd'] == 1 )
    77   {
    78     // password must be the same as its confirmation
    79     if ( $_POST['password'] != $_POST['passwordConf'] )
    80     {
    81       array_push( $errors, $lang['reg_err_pass'] );
    82     }
    83   }
    84 
     71  if ( $mail_error != '' ) array_push( $errors, $mail_error );
     72  // password must be the same as its confirmation
     73  if ( isset( $_POST['use_new_pwd'] )
     74       and $_POST['password'] != $_POST['passwordConf'] )
     75    array_push( $errors, $lang['reg_err_pass'] );
     76 
    8577  if ( count( $errors ) == 0 )
    8678  {
     
    9890    mysql_query( $query );
    9991
    100     if ( $_POST['use_new_pwd'] == 1 )
     92    if ( isset( $_POST['use_new_pwd'] ) )
    10193    {
    10294      $query = 'UPDATE '.PREFIX_TABLE.'users';
     
    10698      mysql_query( $query );
    10799    }
    108     if ( $_POST['create_cookie'] == 1 )
     100    if ( isset( $_POST['create_cookie'] ) )
    109101    {
    110102      setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
     
    118110    }
    119111    // redirection
    120     $url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
    121     if ( $page['cat'] == 'search' )
    122     {
    123       $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
    124     }
    125     if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true );
     112    $url = 'category.php';
     113    if ( !isset($_POST['create_cookie']) ) $url = add_session_id( $url,true );
    126114    header( 'Request-URI: '.$url ); 
    127115    header( 'Content-Location: '.$url ); 
     
    131119}
    132120//----------------------------------------------------- template initialization
    133 $vtp = new VTemplate;
     121//
     122// Start output of page
     123//
     124$title = $lang['customize_page_title'];
     125include('include/page_header.php');
     126
    134127$handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp' );
    135128initialize_template();
    136 $tpl = array( 'customize_page_title','customize_title','password','new',
     129$tpl = array( 'customize_title','password','new',
    137130              'reg_confirm','submit','create_cookie' );
    138131templatize_array( $tpl, 'lang', $handle );
    139132//----------------------------------------------------------------- form action
    140 $url = './profile.php?cat='.$page['cat'].'&expand='.$page['expand'];
    141 if ( $page['cat'] == 'search' )
    142 {
    143   $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
    144 }
     133$url = './profile.php';
    145134$vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
    146135//-------------------------------------------------------------- errors display
     
    202191  $vtp->addSession( $handle, 'select' );
    203192  $vtp->setVar( $handle, 'select.name', 'template' );
    204   $option = get_dirs( './template/' );
     193  $option = get_dirs( './template' );
    205194  for ( $i = 0; $i < sizeof( $option ); $i++ )
    206195  {
     
    379368$code = $vtp->Display( $handle, 0 );
    380369echo $code;
     370include('include/page_tail.php');
    381371?>
Note: See TracChangeset for help on using the changeset viewer.