Jelajahi Sumber

Moved base url in the configuration file.

Visman 8 tahun lalu
induk
melakukan
7ba2287c71

+ 0 - 21
admin_options.php

@@ -27,7 +27,6 @@ if (isset($_POST['form_sent']))
 	$form = array(
 	$form = array(
 		'board_title'			=> pun_trim($_POST['form']['board_title']),
 		'board_title'			=> pun_trim($_POST['form']['board_title']),
 		'board_desc'			=> pun_trim($_POST['form']['board_desc']),
 		'board_desc'			=> pun_trim($_POST['form']['board_desc']),
-		'base_url'				=> pun_trim($_POST['form']['base_url']),
 		'default_timezone'		=> floatval($_POST['form']['default_timezone']),
 		'default_timezone'		=> floatval($_POST['form']['default_timezone']),
 		'default_dst'			=> $_POST['form']['default_dst'] != '1' ? '0' : '1',
 		'default_dst'			=> $_POST['form']['default_dst'] != '1' ? '0' : '1',
 		'default_lang'			=> pun_trim($_POST['form']['default_lang']),
 		'default_lang'			=> pun_trim($_POST['form']['default_lang']),
@@ -89,19 +88,6 @@ if (isset($_POST['form_sent']))
 	if ($form['board_title'] == '')
 	if ($form['board_title'] == '')
 		message($lang_admin_options['Must enter title message']);
 		message($lang_admin_options['Must enter title message']);
 
 
-	// Make sure base_url doesn't end with a slash
-	if (substr($form['base_url'], -1) == '/')
-		$form['base_url'] = substr($form['base_url'], 0, -1);
-/**
-	// Convert IDN to Punycode if needed
-	if (preg_match('/[^\x00-\x7F]/', $form['base_url']))
-	{
-		if (!function_exists('idn_to_ascii'))
-			message($lang_admin_options['Base URL problem']);
-		else
-			$form['base_url'] = idn_to_ascii($form['base_url']);
-	}
-**/
 	$languages = forum_list_langs();
 	$languages = forum_list_langs();
 	if (!in_array($form['default_lang'], $languages))
 	if (!in_array($form['default_lang'], $languages))
 		message($lang_common['Bad request'], false, '404 Not Found');
 		message($lang_common['Bad request'], false, '404 Not Found');
@@ -254,13 +240,6 @@ generate_admin_menu('options');
 										<span><?php echo $lang_admin_options['Board desc help'] ?></span>
 										<span><?php echo $lang_admin_options['Board desc help'] ?></span>
 									</td>
 									</td>
 								</tr>
 								</tr>
-								<tr>
-									<th scope="row"><?php echo $lang_admin_options['Base URL label'] ?></th>
-									<td>
-										<input type="text" name="form[base_url]" size="50" maxlength="100" value="<?php echo pun_htmlspecialchars($pun_config['o_base_url']) ?>" />
-										<span><?php echo $lang_admin_options['Base URL help'] ?></span>
-									</td>
-								</tr>
 								<tr>
 								<tr>
 									<th scope="row"><?php echo $lang_admin_options['Timezone label'] ?></th>
 									<th scope="row"><?php echo $lang_admin_options['Timezone label'] ?></th>
 									<td>
 									<td>

+ 0 - 1
app/Core/Install.php

@@ -1953,7 +1953,6 @@ foreach ($styles as $temp)
                 'o_avatars_height'        => 60,
                 'o_avatars_height'        => 60,
                 'o_avatars_size'          => 10240,
                 'o_avatars_size'          => 10240,
                 'o_search_all_forums'     => 1,
                 'o_search_all_forums'     => 1,
-                'o_base_url'              => $base_url,
                 'o_admin_email'           => $email,
                 'o_admin_email'           => $email,
                 'o_webmaster_email'       => $email,
                 'o_webmaster_email'       => $email,
                 'o_forum_subscriptions'   => 1,
                 'o_forum_subscriptions'   => 1,

+ 4 - 2
db_update.php

@@ -660,6 +660,7 @@ switch ($stage)
 	case 'start':
 	case 'start':
 		$query_str = '?stage=preparse_posts';
 		$query_str = '?stage=preparse_posts';
 
 
+        // For FluxBB by Visman 1.5.10.75
         if (! isset($pun_config['i_fork_revision']) || $pun_config['i_fork_revision'] < 1) {
         if (! isset($pun_config['i_fork_revision']) || $pun_config['i_fork_revision'] < 1) {
             if (! isset($pun_config['i_fork_revision'])) {
             if (! isset($pun_config['i_fork_revision'])) {
                 $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'i_fork_revision\', \'0\')') or error('Unable to insert config value \'i_fork_revision\'', __FILE__, __LINE__, $db->error());
                 $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'i_fork_revision\', \'0\')') or error('Unable to insert config value \'i_fork_revision\'', __FILE__, __LINE__, $db->error());
@@ -668,8 +669,9 @@ switch ($stage)
                 $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'s_fork_version\', \'0\')') or error('Unable to insert config value \'s_fork_version\'', __FILE__, __LINE__, $db->error());
                 $db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES (\'s_fork_version\', \'0\')') or error('Unable to insert config value \'s_fork_version\'', __FILE__, __LINE__, $db->error());
             }
             }
 
 
-            $db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name = \'o_cur_version\'') or error('Unable to delete config value \'o_cur_version\'', __FILE__, __LINE__, $db->error());
-            $db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name = \'o_cur_ver_revision\'') or error('Unable to delete config value \'o_cur_ver_revision\'', __FILE__, __LINE__, $db->error());
+            $db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_version\'') or error('Unable to delete config value \'o_cur_version\'', __FILE__, __LINE__, $db->error());
+            $db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_ver_revision\'') or error('Unable to delete config value \'o_cur_ver_revision\'', __FILE__, __LINE__, $db->error());
+            $db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name=\'o_base_url\'') or error('Unable to delete config value \'o_base_url\'', __FILE__, __LINE__, $db->error());
 
 
             $db->alter_field('users', 'password', 'VARCHAR(255)', false, '') or error('Unable to alter password field', __FILE__, __LINE__, $db->error());
             $db->alter_field('users', 'password', 'VARCHAR(255)', false, '') or error('Unable to alter password field', __FILE__, __LINE__, $db->error());
 
 

+ 3 - 3
include/functions.php

@@ -228,16 +228,16 @@ function get_current_protocol()
 //
 //
 function get_base_url($support_https = false)
 function get_base_url($support_https = false)
 {
 {
-	global $pun_config;
+	global $container;
 	static $base_url;
 	static $base_url;
 
 
 	if (!$support_https)
 	if (!$support_https)
-		return $pun_config['o_base_url'];
+		return $container->getParameter('BASE_URL');
 
 
 	if (!isset($base_url))
 	if (!isset($base_url))
 	{
 	{
 		// Make sure we are using the correct protocol
 		// Make sure we are using the correct protocol
-		$base_url = str_replace(array('http://', 'https://'), get_current_protocol().'://', $pun_config['o_base_url']);
+		$base_url = str_replace(array('http://', 'https://'), get_current_protocol().'://', $container->getParameter('BASE_URL'));
 	}
 	}
 
 
 	return $base_url;
 	return $base_url;

+ 2 - 2
include/parser.php

@@ -59,9 +59,9 @@ if (!isset($smilies))
 //
 //
 function preparse_bbcode($text, &$errors, $is_signature = false)
 function preparse_bbcode($text, &$errors, $is_signature = false)
 {
 {
-	global $pun_config, $lang_common, $lang_post, $re_list;
+	global $pun_config, $lang_common, $lang_post, $re_list, $container;
 
 
-	$text = preg_replace('%('.str_replace(array('http://', 'https://', '.'), array('https?://', 'https?://', '\.'), $pun_config['o_base_url']).'/viewtopic\.php[^\[\]\s]+)(&search_hl=\d+)%ui', '$1', $text); // search HL - Visman
+	$text = preg_replace('%('.str_replace(array('http://', 'https://', '.'), array('https?://', 'https?://', '\.'), $container->getParameter('BASE_URL')).'/viewtopic\.php[^\[\]\s]+)(&search_hl=\d+)%ui', '$1', $text); // search HL - Visman
 
 
 	// Remove empty tags
 	// Remove empty tags
 	while (($new_text = strip_empty_bbcode($text)) !== false)
 	while (($new_text = strip_empty_bbcode($text)) !== false)

+ 1 - 4
lang/English/admin_options.php

@@ -3,7 +3,7 @@
 // Language definitions used in admin_options.php
 // Language definitions used in admin_options.php
 $lang_admin_options = array(
 $lang_admin_options = array(
 
 
-'Bad HTTP Referer message'			=>	'Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.',
+'Bad HTTP Referer message'			=>	'Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the BASE_URL manually in the /app/config/main.php configuration file.',
 'Must enter title message'			=>	'You must enter a board title.',
 'Must enter title message'			=>	'You must enter a board title.',
 'Invalid e-mail message'			=>	'The admin email address you entered is invalid.',
 'Invalid e-mail message'			=>	'The admin email address you entered is invalid.',
 'Invalid webmaster e-mail message'	=>	'The webmaster email address you entered is invalid.',
 'Invalid webmaster e-mail message'	=>	'The webmaster email address you entered is invalid.',
@@ -21,9 +21,6 @@ $lang_admin_options = array(
 'Board title help'					=>	'The title of this bulletin board (shown at the top of every page). This field may <strong>not</strong> contain HTML.',
 'Board title help'					=>	'The title of this bulletin board (shown at the top of every page). This field may <strong>not</strong> contain HTML.',
 'Board desc label'					=>	'Board description',
 'Board desc label'					=>	'Board description',
 'Board desc help'					=>	'A short description of this bulletin board (shown at the top of every page). This field may contain HTML.',
 'Board desc help'					=>	'A short description of this bulletin board (shown at the top of every page). This field may contain HTML.',
-'Base URL label'					=>	'Base URL',
-'Base URL help'						=>	'The complete URL of the board without trailing slash (i.e. http://www.mydomain.com/forums). This <strong>must</strong> be correct in order for all admin and moderator features to work. If you get "Bad referer" errors, it\'s probably incorrect.',
-'Base URL problem'          =>  'Your installation does not support automatic conversion of internationalized domain names. As your base URL contains special characters, you <strong>must</strong> use an online converter in order to avoid "Bad referer" errors.',
 'Timezone label'					=>	'Default time zone',
 'Timezone label'					=>	'Default time zone',
 'Timezone help'						=>	'The default time zone for guests and users attempting to register for the board.',
 'Timezone help'						=>	'The default time zone for guests and users attempting to register for the board.',
 'DST label'							=>	'Adjust for DST',
 'DST label'							=>	'Adjust for DST',

+ 1 - 4
lang/Russian/admin_options.php

@@ -3,7 +3,7 @@
 // Language definitions used in admin_options.php
 // Language definitions used in admin_options.php
 $lang_admin_options = array(
 $lang_admin_options = array(
 
 
-'Bad HTTP Referer message'			=>	'Плохой HTTP_REFERER. Если вы передвинули форум в другую папку или на другой домен, необходимо поправить Base URL вручную в базе данных (см. параметр o_base_url в таблице config) после чего очистите кеш, удалив все .php файлы в папке /cache.',
+'Bad HTTP Referer message'			=>	'Плохой HTTP_REFERER. Если вы перенесли форум в другую папку или на другой домен, необходимо поправить BASE_URL вручную в файле конфигурации /app/config/main.php.',
 'Must enter title message'			=>	'Вы должны ввести заголовок форума.',
 'Must enter title message'			=>	'Вы должны ввести заголовок форума.',
 'Invalid e-mail message'			=>	'Email админа введен неверно.',
 'Invalid e-mail message'			=>	'Email админа введен неверно.',
 'Invalid webmaster e-mail message'	=>	'Email вебмастера введен неверно.',
 'Invalid webmaster e-mail message'	=>	'Email вебмастера введен неверно.',
@@ -21,9 +21,6 @@ $lang_admin_options = array(
 'Board title help'					=>	'Заголовок этого форума (выводится в шапке каждой страницы). Это поле <strong>не может</strong> содержать HTML.',
 'Board title help'					=>	'Заголовок этого форума (выводится в шапке каждой страницы). Это поле <strong>не может</strong> содержать HTML.',
 'Board desc label'					=>	'Описание',
 'Board desc label'					=>	'Описание',
 'Board desc help'					=>	'Краткое описание этого форума (выводится в шапке каждой страницы). Это поле может содержать HTML.',
 'Board desc help'					=>	'Краткое описание этого форума (выводится в шапке каждой страницы). Это поле может содержать HTML.',
-'Base URL label'					=>	'Base URL',
-'Base URL help'						=>	'Полный URL форума без завершающей черты (т.е. http://www.mydomain.com/forums). <strong>Необходимо</strong> заполнить его правильно. Если вы получаете ошибку "Плохой HTTP_REFERER", вероятно здесь ошибка.',
-'Base URL problem'          =>  'Your installation does not support automatic conversion of internationalized domain names. As your base URL contains special characters, you <strong>must</strong> use an online converter in order to avoid "Bad referer" errors.',
 'Timezone label'					=>	'Временная зона по умолчанию',
 'Timezone label'					=>	'Временная зона по умолчанию',
 'Timezone help'						=>	'Временная зона  для гостей и новых пользователей.',
 'Timezone help'						=>	'Временная зона  для гостей и новых пользователей.',
 'DST label'							=>	'Поправка на Л.В.',
 'DST label'							=>	'Поправка на Л.В.',