|
-
+
|
diff --git a/bbs/write.php b/bbs/write.php
index 7722f3456..94cece956 100644
--- a/bbs/write.php
+++ b/bbs/write.php
@@ -362,7 +362,7 @@ if (isset($write['wr_subject'])) {
$content = '';
if ($w == '') {
- $content = $board['bo_insert_content'];
+ $content = html_purifier($board['bo_insert_content']);
} else if ($w == 'r') {
if (!strstr($write['wr_option'], 'html')) {
$content = "\n\n\n > "
diff --git a/common.php b/common.php
index c24c56e07..542a80dae 100644
--- a/common.php
+++ b/common.php
@@ -29,20 +29,22 @@ for ($i=0; $i<$ext_cnt; $i++) {
function g5_path()
{
- $chroot = substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], dirname(__FILE__)));
- $result['path'] = str_replace('\\', '/', $chroot.dirname(__FILE__));
- $tilde_remove = preg_replace('/^\/\~[^\/]+(.*)$/', '$1', $_SERVER['SCRIPT_NAME']);
- $document_root = str_replace($tilde_remove, '', $_SERVER['SCRIPT_FILENAME']);
- $pattern = '/' . preg_quote($document_root, '/') . '/i';
- $root = preg_replace($pattern, '', $result['path']);
- $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
- $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
- $user = str_replace(preg_replace($pattern, '', $_SERVER['SCRIPT_FILENAME']), '', $_SERVER['SCRIPT_NAME']);
- $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
- if(isset($_SERVER['HTTP_HOST']) && preg_match('/:[0-9]+$/', $host))
- $host = preg_replace('/:[0-9]+$/', '', $host);
- $host = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", '', $host);
- $result['url'] = $http.$host.$port.$user.$root;
+ $chroot = substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], dirname(__FILE__)));
+ $result['path'] = str_replace('\\', '/', $chroot.dirname(__FILE__));
+ $server_script_name = preg_replace('/\/+/', '/', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']));
+ $server_script_filename = preg_replace('/\/+/', '/', str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']));
+ $tilde_remove = preg_replace('/^\/\~[^\/]+(.*)$/', '$1', $server_script_name);
+ $document_root = str_replace($tilde_remove, '', $server_script_filename);
+ $pattern = '/' . preg_quote($document_root, '/') . '/i';
+ $root = preg_replace($pattern, '', $result['path']);
+ $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
+ $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
+ $user = str_replace(preg_replace($pattern, '', $server_script_filename), '', $server_script_name);
+ $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
+ if(isset($_SERVER['HTTP_HOST']) && preg_match('/:[0-9]+$/', $host))
+ $host = preg_replace('/:[0-9]+$/', '', $host);
+ $host = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", '', $host);
+ $result['url'] = $http.$host.$port.$user.$root;
return $result;
}
|