Changeset 1508 for trunk/include


Ignore:
Timestamp:
Jul 27, 2006, 8:51:54 PM (18 years ago)
Author:
nikrou
Message:

Feature 492: first step
Simple redirect.tpl in template-common
Simplification of function redirect()

Location:
trunk/include
Files:
2 edited

Legend:

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

    r1487 r1508  
    557557 * @return void
    558558 */
    559 function redirect( $url , $msg = '', $refreh_time = 0)
    560 {
    561   global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug;
    562 
    563   unset($template);
    564   $template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
    565   if (!isset($page['body_id']))
    566   {
    567     $page['body_id'] = 'adminPage';
    568   }
    569 
    570   // $redirect_msg, $refresh, $url_link and $title are required for creating an automated
    571   // refresh page in header.tpl
    572   if (!isset($msg) or ($msg == ''))
     559function redirect( $url , $msg = '', $refresh_time = 0)
     560{
     561  global $lang_info;
     562
     563  if (!isset($lang_info)) {
     564    include_once(get_language_filepath('common.lang.php'));
     565  }
     566
     567  $template = new Template(PHPWG_ROOT_PATH.'template-common');
     568  $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
     569  if (empty($msg))
    573570  {
    574571    $redirect_msg = l10n('redirect_msg');
     
    579576  }
    580577  $redirect_msg = nl2br($redirect_msg);
    581   $refresh = $refreh_time;
    582   $url_link = $url;
    583   $title = 'redirection';
    584 
    585   include( PHPWG_ROOT_PATH.'include/page_header.php' );
    586 
    587   $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
     578
     579  $template->assign_vars(
     580    array(
     581      'CONTENT_ENCODING' => $lang_info['charset'],
     582      'LANG'=>$lang_info['code'],
     583      'DIR'=>$lang_info['direction'],
     584      'CONTENT' => print_r($user,true),
     585      'LANG_INFO' => print_r($lang_info,true)
     586      )
     587    );
     588
     589  $template->assign_vars(
     590    array(
     591      'U_REDIRECT_MSG' => $redirect_msg,
     592      'REFRESH_TIME' => $refresh_time,
     593      'U_REFRESH' => $url
     594      )
     595    );
     596  $template->assign_block_vars('refresh', array());
    588597  $template->parse('redirect');
    589 
    590   include( PHPWG_ROOT_PATH.'include/page_tail.php' );
    591 
     598  $template->p();
    592599  exit();
    593600}
  • trunk/include/page_header.php

    r1376 r1508  
    5353    ));
    5454
    55 // refresh
    56 if ( isset( $refresh ) and intval($refresh) >= 0 and isset( $url_link ) and isset( $redirect_msg ) )
    57 {
    58   $template->assign_vars(
    59     array(
    60       'U_REDIRECT_MSG' => $redirect_msg,
    61       'REFRESH_TIME' => $refresh,
    62       'U_REFRESH' => $url_link
    63       ));
    64   $template->assign_block_vars('refresh', array());
    65 }
    66 
    6755header('Content-Type: text/html; charset='.$lang_info['charset']);
    6856$template->parse('header');
Note: See TracChangeset for help on using the changeset viewer.