[xoops-cvslog 3451] CVS update: xoops2jp/html/modules/base/kernel

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 7月 10日 (月) 13:49:05 JST


Index: xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php
diff -u xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.45 xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.46
--- xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.45	Fri Jul  7 11:54:05 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php	Mon Jul 10 13:49:04 2006
@@ -801,6 +801,95 @@
 		
 		return $count;
 	}
+
+	/**
+	 * This member function works to redirect as well as redirect_header().
+	 * But, this member function handles raw values which hasn't been converted
+	 * by htmlspecialchars(). Therefore, if user calls this function with the
+	 * wrong value, some problems may be raised. If you can't understand the
+	 * difference, use not this function but redirect_header().
+	 * 
+	 * @param string $url     redirect URL. Don't use user's variables or request.
+	 * @param int    $time    waiting time (sec)
+	 * @param string $message This string doesn't include tags.
+	 * 
+	 * @todo We'll change this function to delegate.
+	 */
+	function executeRedirect($url, $time = 1, $message = null)
+	{
+		global $xoopsConfig, $xoopsRequestUri;
+
+		//
+		// Check the following by way of caution.
+		//
+		if (preg_match("/(javascript|vbscript):/si", $url)) {
+			$url = XOOPS_URL;
+		}
+		
+		$displayMessage = "";
+		if (is_array($message)) {
+			foreach (array_keys($message) as $id) {
+				$message[$id] = htmlspecialchars($message, ENT_QUOTES);
+			}
+			$displayMessage = implode("<br/>", $message);
+		}
+		else {
+			$displayMessage = $message;
+		}
+		
+		$url = htmlspecialchars($url, ENT_QUOTES);
+		if (defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
+			if (!strstr($url, '?')) {
+				$url .= '?' . SID;
+			}
+			else {
+				$url .= '&amp;' . SID;
+			}
+		}
+
+		if (!defined('XOOPS_CPFUNC_LOADED')) {
+			require_once XOOPS_ROOT_PATH.'/class/template.php';
+			$xoopsTpl = new XoopsTpl();
+			$xoopsTpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
+			$xoopsTpl->assign('langcode', _LANGCODE);
+			$xoopsTpl->assign('charset', _CHARSET);
+			$xoopsTpl->assign('time', $time);
+
+			$xoopsTpl->assign('url', $url);
+			$xoopsTpl->assign('message', $displayMessage);
+			$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
+			$GLOBALS['xoopsModuleUpdate'] = 1;
+			$xoopsTpl->display('db:system_redirect.html');
+		} else {
+			$url = preg_replace("/&amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
+			echo '
+			<html>
+			<head>
+			<title>'.htmlspecialchars($xoopsConfig['sitename']).'</title>
+			<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET.'" />
+			<meta http-equiv="Refresh" content="'.$time.'; url='.$url.'" />
+			<style type="text/css">
+					body {background-color : #fcfcfc; font-size: 12px; font-family: Trebuchet MS,Verdana, Arial, Helvetica, sans-serif; margin: 0px;}
+					.redirect {width: 70%; margin: 110px; text-align: center; padding: 15px; border: #e0e0e0 1px solid; color: #666666; background-color: #f6f6f6;}
+					.redirect a:link {color: #666666; text-decoration: none; font-weight: bold;}
+					.redirect a:visited {color: #666666; text-decoration: none; font-weight: bold;}
+					.redirect a:hover {color: #999999; text-decoration: underline; font-weight: bold;}
+			</style>
+			</head>
+			<body>
+			<div align="center">
+			<div class="redirect">
+			<span style="font-size: 16px; font-weight: bold;">'.$displayMessage.'</span>
+			<hr style="height: 3px; border: 3px #E18A00 solid; width: 95%;" />
+			<p>'.sprintf(_IFNOTRELOAD, $url).'</p>
+			</div>
+			</div>
+			</body>
+			</html>';
+		}
+		
+		exit();
+	}
 }
 
 /**


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る