Changeset 369


Ignore:
Timestamp:
Feb 22, 2004, 3:43:13 AM (20 years ago)
Author:
gweltas
Message:

Template migration

Location:
trunk
Files:
1 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/about.php

    r364 r369  
    3434//
    3535$title= $lang['about_page_title'];
    36 include('include/page_header.php');
     36include(PHPWG_ROOT_PATH.'include/page_header.php');
    3737
    3838$template->set_filenames(array('about'=>'about.tpl'));
     
    4848
    4949$template->pparse('about');
    50 include('include/page_tail.php');
     50include(PHPWG_ROOT_PATH.'include/page_tail.php');
    5151?>
  • trunk/category.php

    r364 r369  
    116116//
    117117$title = $page['title'];
    118 include('include/page_header.php');
     118include(PHPWG_ROOT_PATH.'include/page_header.php');
    119119
    120120$template->set_filenames( array('category'=>'category.tpl') );
     
    483483
    484484$template->pparse('category');
    485 include('include/page_tail.php');
     485include(PHPWG_ROOT_PATH.'include/page_tail.php');
    486486?>
  • trunk/comments.php

    r364 r369  
    4343//
    4444$title= $lang['title_comments'];
    45 include('include/page_header.php');
     45include(PHPWG_ROOT_PATH.'include/page_header.php');
    4646
    4747$template->set_filenames( array('comments'=>'comments.tpl') );
     
    168168//----------------------------------------------------------- html code display
    169169$template->pparse('comments');
    170 include('include/page_tail.php');
     170include(PHPWG_ROOT_PATH.'include/page_tail.php');
    171171?>
  • trunk/identification.php

    r365 r369  
    5858//
    5959$title = $lang['ident_page_title'];
    60 include('include/page_header.php');
     60include(PHPWG_ROOT_PATH.'include/page_header.php');
    6161
    6262$template->set_filenames( array('identification'=>'identification.tpl') );
     
    9696//----------------------------------------------------------- html code display
    9797$template->pparse('identification');
    98 include('include/page_tail.php');
     98include(PHPWG_ROOT_PATH.'include/page_tail.php');
    9999?>
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r367 r369  
    274274$lang['infoimage_removefromall'] = 'remove from all';
    275275$lang['infoimage_associate'] = 'Associate to the category';
    276 $lang['update_wrong_dirname'] = 'The name of directories and files must be composed of letters, figures, "-", "_" or "."';
    277276$lang['stats_pages_seen'] = 'pages seen';
    278277$lang['stats_visitors'] = 'guests';
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r364 r369  
    233233$lang['hint_comments'] = 'See last users comments';
    234234$lang['menu_login'] = 'login';
     235$lang['update_wrong_dirname'] = 'The name of directories and files must be composed of letters, figures, "-", "_" or "."';
    235236
    236237?>
  • trunk/picture.php

    r368 r369  
    233233                                  $user['maxwidth'], $user['maxheight'] );
    234234                                 
    235 include('include/page_header.php');
     235include(PHPWG_ROOT_PATH.'include/page_header.php');
    236236$template->set_filenames(array('picture'=>'picture.tpl'));
    237237initialize_template();
     
    585585
    586586$template->pparse('picture');
    587 include('include/page_tail.php');
     587include(PHPWG_ROOT_PATH.'include/page_tail.php');
    588588?>
  • trunk/profile.php

    r364 r369  
    132132//
    133133$title = $lang['customize_page_title'];
    134 include('include/page_header.php');
     134include(PHPWG_ROOT_PATH.'include/page_header.php');
    135135
    136136$template->set_filenames(array('profile'=>'profile.tpl'));
     
    224224  ));
    225225
    226 //--------------------------------------------------------------- create cookie
    227 if ( $conf['authorize_cookies'] )
    228 {
    229   $vtp->addSession( $handle, 'cookie' );
    230   $options = array(
    231     array( 'message' => '1 '.$lang['customize_day'],
    232            'value' => time() + 24*60*60 ),
    233     array( 'message' => '1 '.$lang['customize_week'],
    234            'value' => time() + 7*24*60*60 ),
    235     array( 'message' => '1 '.$lang['customize_month'],
    236            'value' => time() + 30*24*60*60 ),
    237     array( 'message' => '1 '.$lang['customize_year'],
    238            'value' => time() + 365*24*60*60 )
    239     );
    240   foreach ( $options as $option ) {
    241     $vtp->addSession( $handle, 'expiration_option' );
    242     $vtp->setVar( $handle, 'expiration_option.option', $option['message'] );
    243     $vtp->setVar( $handle, 'expiration_option.value', $option['value'] );
    244     $vtp->closeSession( $handle, 'expiration_option' );
    245   }
    246   $vtp->closeSession( $handle, 'cookie' );
    247 }
    248226//----------------------------------------------------------- html code display
    249227$template->pparse('profile');
    250 include('include/page_tail.php');
     228include(PHPWG_ROOT_PATH.'include/page_tail.php');
    251229?>
  • trunk/register.php

    r365 r369  
    6060//
    6161$title= $lang['register_page_title'];
    62 include('include/page_header.php');
     62include(PHPWG_ROOT_PATH.'include/page_header.php');
    6363
    6464$template->set_filenames( array('register'=>'register.tpl') );
     
    9090
    9191$template->pparse('register');
    92 include('include/page_tail.php');
     92include(PHPWG_ROOT_PATH.'include/page_tail.php');
    9393?>
  • trunk/search.php

    r364 r369  
    6767//
    6868$title= $lang['search_title'];
    69 include('include/page_header.php');
     69include(PHPWG_ROOT_PATH.'include/page_header.php');
    7070
    7171$template->set_filenames( array('search'=>'search.tpl') );
     
    101101mysql_close();
    102102$template->pparse('search');
    103 include('include/page_tail.php');
     103include(PHPWG_ROOT_PATH.'include/page_tail.php');
    104104?>
  • trunk/upload.php

    r364 r369  
    133133}
    134134}
    135 //----------------------------------------------------- template initialization
    136 //
    137 // Start output of page
    138 //
    139 $title= $lang['upload_title'];
    140 include('include/page_header.php');
    141 $handle = $vtp->Open( './template/'.$user['template'].'/upload.vtp' );
    142 initialize_template();
    143 
    144 $tpl = array( 'upload_title', 'upload_username', 'mail_address', 'submit',
    145               'upload_successful', 'search_return_main_page','upload_author',
    146               'upload_name','upload_creation_date','upload_comment',
    147               'mandatory' );
    148 templatize_array( $tpl, 'lang', $handle );
    149135
    150136$error = array();
     
    164150  }
    165151  // test de la présence des champs obligatoires
    166   if ( $_FILES['picture']['name'] == '' )
     152  if ( empty($_FILES['picture']['name']))
    167153  {
    168154    array_push( $error, $lang['upload_filenotfound'] );
     
    173159    array_push( $error, $lang['reg_err_mail_address'] );
    174160  }
    175   if ( $_POST['username'] == '' )
     161  if ( empty($_POST['username']) )
    176162  {
    177163    array_push( $error, $lang['upload_err_username'] );
     
    179165 
    180166  $date_creation = '';
    181   if ( $_POST['date_creation'] != '' )
     167  if ( !empty($_POST['date_creation']) )
    182168  {
    183169    list( $day,$month,$year ) = explode( '/', $_POST['date_creation'] );
     
    206192  if ( !preg_match( '/^[a-zA-Z0-9-_.]+$/', $_FILES['picture']['name'] ) )
    207193  {
    208     // reload language file with administration labels
    209     $isadmin = true;
    210     include( './language/'.$user['language'].'.php' );
    211194    array_push( $error, $lang['update_wrong_dirname'] );
    212195  }
     
    225208  if ( sizeof( $error ) == 0 )
    226209  {
    227     $query = 'insert into '.PREFIX_TABLE.'waiting';
     210    $query = 'insert into '.WAITING_TABLE;
    228211    $query.= ' (storage_category_id,file,username,mail_address,date,infos)';
    229212    $query.= ' values ';
     
    241224  }
    242225}
     226
    243227//------------------------------------------------------------ thumbnail upload
    244228if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
     
    246230  // upload of the thumbnail
    247231  $query = 'select file';
    248   $query.= ' from '.PREFIX_TABLE.'waiting';
     232  $query.= ' from '.WAITING_TABLE;
    249233  $query.= ' where id = '.$_GET['waiting_id'];
    250234  $query.= ';';
     
    264248  if ( sizeof( $error ) == 0 )
    265249  {
    266     $query = 'update '.PREFIX_TABLE.'waiting';
     250    $query = 'update '.WAITING_TABLE;
    267251    $query.= " set tn_ext = '".$extension."'";
    268252    $query.= ' where id = '.$_GET['waiting_id'];
     
    273257}
    274258
     259//
     260// Start output of page
     261//
     262$title= $lang['upload_title'];
     263include(PHPWG_ROOT_PATH.'include/page_header.php');
     264$template->set_filenames(array('upload'=>'upload.tpl'));
     265initialize_template();
     266
     267$u_form = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
     268if ( isset( $page['waiting_id'] ) )
     269{
     270$u_form.= '&waiting_id='.$page['waiting_id'];
     271}
     272
     273if ( isset( $page['waiting_id'] ) )
     274{
     275  $advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
     276}
     277else
     278{
     279  $advise_title = $lang['upload_advise'];
     280  $advise_title.= get_cat_display_name( $page['cat_name'], ' - ', 'font-style:italic;' );
     281}
     282
     283$username = !empty($_POST['username'])?$_POST['username']:$user['username'];
     284$mail_address = !empty($_POST['mail_address'])?$_POST['mail_address']:$user['mail_address'];
     285$name = !empty($_POST['name'])?$_POST['name']:'';
     286$author = !empty($_POST['author'])?$_POST['author']:'';
     287$date_creation = !empty($_POST['date_creation'])?$_POST['date_creation']:'';
     288$comment = !empty($_POST['comment'])?$_POST['comment']:'';
     289
     290$template->assign_vars(array(
     291  'ADVISE_TITLE' => $advise_title,
     292  'NAME' => $username,
     293  'EMAIL' => $mail_address,
     294  'NAME_IMG' => $name,
     295  'AUTHOR_IMG' => $author,
     296  'DATE_IMG' => $date_creation,
     297  'COMMENT_IMG' => $comment,
     298
     299  'L_TITLE' => $lang['upload_title'],
     300  'L_USERNAME' => $lang['upload_username'],
     301  'L_EMAIL' =>  $lang['mail_address'],
     302  'L_NAME_IMG' =>  $lang['upload_name'],
     303  'L_SUBMIT' =>  $lang['submit'],
     304  'L_AUTHOR' =>  $lang['upload_author'],
     305  'L_CREATION_DATE' =>  $lang['upload_creation_date'],
     306  'L_COMMENT' =>  $lang['upload_comment'],
     307  'L_RETURN' =>  $lang['search_return_main_page'],
     308  'L_UPLOAD_DONE' =>  $lang['upload_successful'],
     309  'L_MANDATORY' =>  $lang['mandatory'],
     310       
     311  'F_ACTION' => add_session_id( $u_form ),
     312
     313  'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'])
     314  ));
     315 
    275316if ( !$page['upload_successful'] )
    276317{
    277   $vtp->addSession( $handle, 'upload_not_successful' );
     318  $template->assign_block_vars('upload_not_successful',array());
    278319//-------------------------------------------------------------- errors display
    279   if ( sizeof( $error ) != 0 )
    280   {
    281     $vtp->addSession( $handle, 'errors' );
    282     for ( $i = 0; $i < sizeof( $error ); $i++ )
    283     {
    284       $vtp->addSession( $handle, 'li' );
    285       $vtp->setVar( $handle, 'li.li', $error[$i] );
    286       $vtp->closeSession( $handle, 'li' );
    287     }
    288     $vtp->closeSession( $handle, 'errors' );
    289   }
    290 //----------------------------------------------------------------- form action
    291   $url = './upload.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
    292   if ( isset( $page['waiting_id'] ) )
    293   {
    294     $url.= '&amp;waiting_id='.$page['waiting_id'];
    295   }
    296   $vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
     320if ( sizeof( $error ) != 0 )
     321{
     322  $template->assign_block_vars('upload_not_successful.errors',array());
     323  for ( $i = 0; $i < sizeof( $error ); $i++ )
     324  {
     325    $template->assign_block_vars('upload_not_successful.errors.error',array('ERROR'=>$error[$i]));
     326  }
     327}
     328
    297329//--------------------------------------------------------------------- advises
    298   if ( $conf['upload_maxfilesize'] != '' )
    299   {
    300     $vtp->addSession( $handle, 'advise' );
     330  if ( !empty($conf['upload_maxfilesize']) )
     331  {
    301332    $content = $lang['upload_advise_filesize'];
    302333    $content.= $conf['upload_maxfilesize'].' KB';
    303     $vtp->setVar( $handle, 'advise.content', $content );
    304     $vtp->closeSession( $handle, 'advise' );
    305   }
     334    $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
     335  }
     336
    306337  if ( isset( $page['waiting_id'] ) )
    307338  {
    308     $advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
    309     $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
    310 
    311339    if ( $conf['upload_maxwidth_thumbnail'] != '' )
    312340    {
    313       $vtp->addSession( $handle, 'advise' );
    314       $content = $lang['upload_advise_width'];
     341          $content = $lang['upload_advise_width'];
    315342      $content.= $conf['upload_maxwidth_thumbnail'].' px';
    316       $vtp->setVar( $handle, 'advise.content', $content );
    317       $vtp->closeSession( $handle, 'advise' );
     343          $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
    318344    }
    319345    if ( $conf['upload_maxheight_thumbnail'] != '' )
    320346    {
    321       $vtp->addSession( $handle, 'advise' );
    322347      $content = $lang['upload_advise_height'];
    323348      $content.= $conf['upload_maxheight_thumbnail'].' px';
    324       $vtp->setVar( $handle, 'advise.content', $content );
    325       $vtp->closeSession( $handle, 'advise' );
     349          $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
    326350    }
    327351  }
    328352  else
    329353  {
    330     $advise_title = $lang['upload_advise'];
    331     $advise_title.= get_cat_display_name( $page['cat_name'], ' - ',
    332                                           'font-style:italic;' );
    333     $vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
    334 
    335354    if ( $conf['upload_maxwidth'] != '' )
    336355    {
    337       $vtp->addSession( $handle, 'advise' );
    338356      $content = $lang['upload_advise_width'];
    339357      $content.= $conf['upload_maxwidth'].' px';
    340       $vtp->setVar( $handle, 'advise.content', $content );
    341       $vtp->closeSession( $handle, 'advise' );
     358          $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
    342359    }
    343360    if ( $conf['upload_maxheight'] != '' )
    344361    {
    345       $vtp->addSession( $handle, 'advise' );
    346362      $content = $lang['upload_advise_height'];
    347363      $content.= $conf['upload_maxheight'].' px';
    348       $vtp->setVar( $handle, 'advise.content', $content );
    349       $vtp->closeSession( $handle, 'advise' );
    350     }
    351   }
    352   $vtp->addSession( $handle, 'advise' );
    353   $content = $lang['upload_advise_filetype'];
    354   $vtp->setVar( $handle, 'advise.content', $content );
    355   $vtp->closeSession( $handle, 'advise' );
     364          $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
     365    }
     366  }
     367  $template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$lang['upload_advise_filetype']));
     368 
    356369//----------------------------------------- optionnal username and mail address
    357370  if ( !isset( $page['waiting_id'] ) )
    358371  {
    359     $vtp->addSession( $handle, 'fields' );
    360     // username
    361     if ( isset( $_POST['username'] ) ) $username = $_POST['username'];
    362     else                               $username = $user['username'];
    363     $vtp->setVar( $handle, 'fields.username',  $username );
    364     // mail address
    365     if ( isset( $_POST['mail_address'] ) )$mail_address=$_POST['mail_address'];
    366     else                                  $mail_address=$user['mail_address'];
    367     $vtp->setGlobalVar( $handle, 'user_mail_address',$user['mail_address'] );
    368     // name of the picture
    369         if (isset($_POST['name']))
    370     $vtp->setVar( $handle, 'fields.name', $_POST['name'] );
    371     // author
    372         if (isset($_POST['author']))
    373     $vtp->setVar( $handle, 'fields.author', $_POST['author'] );
    374     // date of creation
    375         if (isset($_POST['date_creation']))
    376     $vtp->setVar( $handle, 'fields.date_creation', $_POST['date_creation'] );
    377     // comment
    378         if (isset($_POST['comment']))
    379     $vtp->setVar( $handle, 'fields.comment', $_POST['comment'] );
    380 
    381     $vtp->closeSession( $handle, 'fields' );
    382 
    383     $vtp->addSession( $handle, 'note' );
    384     $vtp->closeSession( $handle, 'note' );
    385   }
    386   $vtp->closeSession( $handle, 'upload_not_successful' );
     372    $template->assign_block_vars('upload_not_successful.fields',array());
     373        $template->assign_block_vars('note',array());
     374  }
    387375}
    388376else
    389377{
    390   $vtp->addSession( $handle, 'upload_successful' );
    391   $vtp->closeSession( $handle, 'upload_successful' );
    392 }
    393 //----------------------------------------------------- return to main page url
    394 $url = './category.php?cat='.$page['cat'].'&amp;expand='.$_GET['expand'];
    395 $vtp->setGlobalVar( $handle, 'return_url', add_session_id( $url ) );
     378  $template->assign_block_vars('upload_successful',array());
     379}
    396380//----------------------------------------------------------- html code display
    397 $code = $vtp->Display( $handle, 0 );
    398 echo $code;
    399 include('include/page_tail.php');
     381$template->pparse('upload');
     382include(PHPWG_ROOT_PATH.'include/page_tail.php');
    400383?>
Note: See TracChangeset for help on using the changeset viewer.