aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2006-07-27 18:51:54 +0000
committernikrou <nikrou@piwigo.org>2006-07-27 18:51:54 +0000
commitbc65a0d6cd718ecbaa70ea699c6ec482a3e3af65 (patch)
treee9e799267e61c437b7ffda598c477e94bcdfb9e0
parenteb6d08ead24523ef1bf237508e3f2798af96c3b9 (diff)
Feature 492: first step
Simple redirect.tpl in template-common Simplification of function redirect() git-svn-id: http://piwigo.org/svn/trunk@1508 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php43
-rw-r--r--include/page_header.php12
-rw-r--r--template-common/redirect.tpl17
-rw-r--r--template/yoga/redirect.tpl2
4 files changed, 42 insertions, 32 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index dae437a0d..9d8ea914f 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -556,20 +556,17 @@ function pwg_debug( $string )
* @param integer $refreh_time
* @return void
*/
-function redirect( $url , $msg = '', $refreh_time = 0)
+function redirect( $url , $msg = '', $refresh_time = 0)
{
- global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug;
+ global $lang_info;
- unset($template);
- $template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
- if (!isset($page['body_id']))
- {
- $page['body_id'] = 'adminPage';
+ if (!isset($lang_info)) {
+ include_once(get_language_filepath('common.lang.php'));
}
- // $redirect_msg, $refresh, $url_link and $title are required for creating an automated
- // refresh page in header.tpl
- if (!isset($msg) or ($msg == ''))
+ $template = new Template(PHPWG_ROOT_PATH.'template-common');
+ $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
+ if (empty($msg))
{
$redirect_msg = l10n('redirect_msg');
}
@@ -578,17 +575,27 @@ function redirect( $url , $msg = '', $refreh_time = 0)
$redirect_msg = $msg;
}
$redirect_msg = nl2br($redirect_msg);
- $refresh = $refreh_time;
- $url_link = $url;
- $title = 'redirection';
- include( PHPWG_ROOT_PATH.'include/page_header.php' );
+ $template->assign_vars(
+ array(
+ 'CONTENT_ENCODING' => $lang_info['charset'],
+ 'LANG'=>$lang_info['code'],
+ 'DIR'=>$lang_info['direction'],
+ 'CONTENT' => print_r($user,true),
+ 'LANG_INFO' => print_r($lang_info,true)
+ )
+ );
- $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
+ $template->assign_vars(
+ array(
+ 'U_REDIRECT_MSG' => $redirect_msg,
+ 'REFRESH_TIME' => $refresh_time,
+ 'U_REFRESH' => $url
+ )
+ );
+ $template->assign_block_vars('refresh', array());
$template->parse('redirect');
-
- include( PHPWG_ROOT_PATH.'include/page_tail.php' );
-
+ $template->p();
exit();
}
diff --git a/include/page_header.php b/include/page_header.php
index 6a48b4b81..38b1da0be 100644
--- a/include/page_header.php
+++ b/include/page_header.php
@@ -52,18 +52,6 @@ $template->assign_vars(
'TAG_INPUT_ENABLED' => ((is_adviser()) ? 'disabled onclick="return false;"' : '')
));
-// refresh
-if ( isset( $refresh ) and intval($refresh) >= 0 and isset( $url_link ) and isset( $redirect_msg ) )
-{
- $template->assign_vars(
- array(
- 'U_REDIRECT_MSG' => $redirect_msg,
- 'REFRESH_TIME' => $refresh,
- 'U_REFRESH' => $url_link
- ));
- $template->assign_block_vars('refresh', array());
-}
-
header('Content-Type: text/html; charset='.$lang_info['charset']);
$template->parse('header');
?>
diff --git a/template-common/redirect.tpl b/template-common/redirect.tpl
new file mode 100644
index 000000000..43db09122
--- /dev/null
+++ b/template-common/redirect.tpl
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="{LANG}" dir="{DIR}">
+ <head>
+ <title>{U_REDIRECT_MSG}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}">
+ <!-- BEGIN refresh -->
+ <meta http-equiv="refresh" content="{REFRESH_TIME};url={U_REFRESH}">
+ <!-- END refresh -->
+ </head>
+ <body>
+ <div id="the_page">
+ <p>{U_REDIRECT_MSG}</p>
+ <p><a href="{U_REFRESH}">{lang:click_to_redirect}</a></p>
+ </div>
+ </body>
+</html>
diff --git a/template/yoga/redirect.tpl b/template/yoga/redirect.tpl
deleted file mode 100644
index 446f187a3..000000000
--- a/template/yoga/redirect.tpl
+++ /dev/null
@@ -1,2 +0,0 @@
-<p>{U_REDIRECT_MSG}</p>
-<p><a href="{U_REFRESH}">{lang:click_to_redirect}</a></p>