Changeset 345 for trunk/upload.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/upload.php

    r150 r345  
    1717 *                                                                         *
    1818 ***************************************************************************/
     19
     20//----------------------------------------------------------- include
     21$phpwg_root_path = './';
     22include_once( $phpwg_root_path.'common.php' );
    1923
    2024//------------------------------------------------------------------- functions
     
    9599    @unlink( $temp_name );
    96100  }
     101  else
     102  {
     103        @chmod( $temp_name, 0644);
     104  }
    97105  return $result;
    98106}       
    99 //----------------------------------------------------------- personnal include
    100 include_once( './include/init.inc.php' );
     107
    101108//-------------------------------------------------- access authorization check
    102109check_login_authorization();
     
    110117  $page['cat_name']       = $result['name'];
    111118  $page['cat_uploadable'] = $result['uploadable'];
    112 }
    113 else
    114 {
    115   $access_forbidden = true;
    116 }
    117 if ( $access_forbidden == true
    118      or $page['cat_site_id'] != 1
     119if ( $page['cat_site_id'] != 1
    119120     or !$conf['upload_available']
    120121     or !$page['cat_uploadable'] )
     
    125126  exit();
    126127}
     128}
    127129//----------------------------------------------------- template initialization
    128 $vtp = new VTemplate;
     130//
     131// Start output of page
     132//
     133$title= $lang['upload_title'];
     134include('include/page_header.php');
    129135$handle = $vtp->Open( './template/'.$user['template'].'/upload.vtp' );
    130136initialize_template();
     
    165171    array_push( $error, $lang['upload_err_username'] );
    166172  }
    167 
     173 
     174  $date_creation = '';
    168175  if ( $_POST['date_creation'] != '' )
    169176  {
     
    190197  $xml_infos.= ' name="'.htmlspecialchars( $_POST['name'], ENT_QUOTES).'"';
    191198  $xml_infos.= ' />';
     199
     200  if ( !preg_match( '/^[a-zA-Z0-9-_.]+$/', $_FILES['picture']['name'] ) )
     201  {
     202    // reload language file with administration labels
     203    $isadmin = true;
     204    include( './language/'.$user['language'].'.php' );
     205    array_push( $error, $lang['update_wrong_dirname'] );
     206  }
    192207 
    193208  if ( sizeof( $error ) == 0 )
     
    196211                               $conf['upload_maxwidth'],
    197212                               $conf['upload_maxheight']  );
    198     $upload_type = $result['type'];
    199213    for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
    200214    {
     
    238252                             $conf['upload_maxwidth_thumbnail'],
    239253                             $conf['upload_maxheight_thumbnail']  );
    240   $upload_type = $result['type'];
    241254  for ( $j = 0; $j < sizeof( $result['error'] ); $j++ )
    242255  {
     
    348361    $vtp->setGlobalVar( $handle, 'user_mail_address',$user['mail_address'] );
    349362    // name of the picture
     363        if (isset($_POST['name']))
    350364    $vtp->setVar( $handle, 'fields.name', $_POST['name'] );
    351365    // author
     366        if (isset($_POST['author']))
    352367    $vtp->setVar( $handle, 'fields.author', $_POST['author'] );
    353368    // date of creation
     369        if (isset($_POST['date_creation']))
    354370    $vtp->setVar( $handle, 'fields.date_creation', $_POST['date_creation'] );
    355371    // comment
     372        if (isset($_POST['comment']))
    356373    $vtp->setVar( $handle, 'fields.comment', $_POST['comment'] );
    357374
     
    374391$code = $vtp->Display( $handle, 0 );
    375392echo $code;
     393include('include/page_tail.php');
    376394?>
Note: See TracChangeset for help on using the changeset viewer.