Skip to content

Commit

Permalink
IDNA disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkalinux committed Jul 25, 2011
1 parent 1133e3b commit 1b72939
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ function generate_config_file()
// Add forum options
$config_body .= "\n\n// Enable DEBUG mode by removing // from the following line\n//define('FORUM_DEBUG', 1);";
$config_body .= "\n\n// Enable show DB Queries mode by removing // from the following line\n//define('FORUM_SHOW_QUERIES', 1);";
$config_body .= "\n\n// Enable forum IDNA support by removing // from the following line\n//define('FORUM_ENABLE_IDNA', 1);";
$config_body .= "\n\n// Disable forum CSRF checking by removing // from the following line\n//define('FORUM_DISABLE_CSRF_CONFIRM', 1);";
$config_body .= "\n\n// Disable forum hooks (extensions) by removing // from the following line\n//define('FORUM_DISABLE_HOOKS', 1);";
$config_body .= "\n\n// Disable forum output buffering by removing // from the following line\n//define('FORUM_DISABLE_BUFFERING', 1);";
$config_body .= "\n\n// Disable forum async JS loader by removing // from the following line\n//define('FORUM_DISABLE_ASYNC_JS_LOADER', 1);";
$config_body .= "\n\n// Disable forum IDNA support by removing // from the following line\n//define('FORUM_DISABLE_IDNA', 1);";

return $config_body;
}
Expand Down
11 changes: 7 additions & 4 deletions include/parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
exit;

// Load the IDNA class for international url handling
require FORUM_ROOT.'include/idna/idna_convert.class.php';
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
require FORUM_ROOT.'include/idna/idna_convert.class.php';
}


// Here you can add additional smilies if you like (please note that you must escape singlequote and backslash)
Expand Down Expand Up @@ -597,7 +600,7 @@ function handle_url_tag($url, $link = '', $bbcode = false)
else if (!preg_match('#^([a-z0-9]{3,6})://#', $url)) // Else if it doesn't start with abcdef://, we add http://
$full_url = 'http://'.$full_url;

if (defined('FORUM_SUPPORT_PCRE_UNICODE') && !defined('FORUM_DISABLE_IDNA'))
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
$idn = new idna_convert();
$idn->set_parameter('encoding', 'utf8');
Expand All @@ -609,7 +612,7 @@ function handle_url_tag($url, $link = '', $bbcode = false)
// Ok, not very pretty :-)
if (!$bbcode)
{
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && !defined('FORUM_DISABLE_IDNA'))
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
$link_name = ($link == '' || $link == $url) ? $url : $link;
if (preg_match('!^(https?|ftp|news){1}'.preg_quote('://xn--', '!').'!', $link_name))
Expand All @@ -627,7 +630,7 @@ function handle_url_tag($url, $link = '', $bbcode = false)

if ($bbcode)
{
if (defined('FORUM_SUPPORT_PCRE_UNICODE'))
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
if (preg_match('!^(https?|ftp|news){1}'.preg_quote('://xn--', '!').'!', $link))
{
Expand Down
4 changes: 2 additions & 2 deletions profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ function extract_elements($allowed_elements)
$url_source = $user['url'];

// IDNA url handling
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && !defined('FORUM_DISABLE_IDNA'))
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
// Load the IDNA class for international url handling
require_once FORUM_ROOT.'include/idna/idna_convert.class.php';
Expand Down Expand Up @@ -1640,7 +1640,7 @@ function extract_elements($allowed_elements)
$url_source = $user['url'];

// IDNA url handling
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && !defined('FORUM_DISABLE_IDNA'))
if (defined('FORUM_SUPPORT_PCRE_UNICODE') && defined('FORUM_ENABLE_IDNA'))
{
// Load the IDNA class for international url handling
require_once FORUM_ROOT.'include/idna/idna_convert.class.php';
Expand Down

0 comments on commit 1b72939

Please sign in to comment.