SMF1.1.1安装后的一大堆问题修改(2006-12-22晚更新!)

2006-09-25 17:30  Read:

国外的程序总是有这个、那个的问题,最主要的就是对中文支持方面的,这里给大家介绍我在整合SMF+JOOMLA时遇到的一些个问题,暂时发现这么多,以后再发现会及时提供给大家相关解决办法。

这里指的是UTF8编码的SMF1.1.1在整合UTF8编码的JOOMLA1.0.11过程中发现的。

SMF 1.1 Joomla Bridge 1.1.6 还是可以继续用的。

下载地址:http://www.simplemachines.org/download/index.php?thanks;filename=smf_1-1_joomla_1-1-6_bridge.zip

首先安装SMF时,请不要选择那个UTF8编码的选项!!!

---------------------------------------------------------

速度设置: http://www.smf.cn/bbs/index.php/topic,900.0.html

---------------------------------------------------------

smf论坛中需要登陆2次才能进入的修正:

---------------------------------------------------------

打开: ./joomla/Themes/default/index.template.php
找到:

function template_init()
{
..........
}

在"}"前面加入:

 /* Disable login hashing to fix login twice bug */
 $context['disable_login_hashing'] = true;
--------------------------------------------------------- 以上是整合JOOMLA的朋友要注意的地方

文章乱码的修正:

---------------------------------------------------------

打开:Sources/Subs-Post.php

找到:

 // Put it back together!
 if (!$previewing)
  $message = strtr(implode('', $parts), array('  ' => '&nbsp; ', "n" => '<br />', $context['utf8'] ? "xC2xA0" : "xA0" => '&nbsp;'));
 else
  $message = strtr(implode('', $parts), array('  ' => '&nbsp; ', $context['utf8'] ? "xC2xA0" : "xA0" => '&nbsp;'));

改为:

 // Put it back together!
 if (!$previewing)
  $message = strtr(implode('', $parts), array('  ' => '  ', "n" => '<br />'));
 else
  $message = strtr(implode('', $parts), array('  ' => '  '));

---------------------------------------------------------

打开:Sources/Subs.php

找到:

// Switch out quotes really quick because they can cause problems.
      $data = strtr($data, array('&#039;' => ''', '&nbsp;' => $context['utf8'] ? "xC2xA0" : "xA0", '&quot;' => '>">', '"' => '<"<', '&lt;' => '<lt<'));
      $data = preg_replace(array('~(?<=[s>.(;'"]|^)((?:http|https|ftp|ftps)://[w-_%@:|]+(?:.[w-_%]+)*(?::d+)?(?:/[w-_~%.@,?&;=#+:'\]*|[({][w-_~%.@,?&;=#(){}+:'\]*)*[/w-_~%@?;=#}\])~i', '~(?<=[s>('<]|^)(www(?:.[w-_]+)+(?::d+)?(?:/[w-_~%.@,?&;=#+:'\]*|[({][w-_~%.@,?&;=#(){}+:'\]*)*[/w-_~%@?;=#}\])~i'), array('[url]$1[/url]', '[url=http://$1]$1[/url]'), $data);
      $data = strtr($data, array(''' => '&#039;', $context['utf8'] ? "xC2xA0" : "xA0" => '&nbsp;', '>">' => '&quot;', '<"<' => '"', '<lt<' => '&lt;'));
     }

改为:

// Switch out quotes really quick because they can cause problems.
      //$data = strtr($data, array('&#039;' => ''', '&nbsp;' => $context['utf8'] ? "xC2xA0" : "xA0", '&quot;' => '>">', '"' => '<"<', '&lt;' => '<lt<'));
      $data = preg_replace(array('~(?<=[s>.(;'"]|^)((?:http|https|ftp|ftps)://[w-_%@:|]+(?:.[w-_%]+)*(?::d+)?(?:/[w-_~%.@,?&;=#+:'\]*|[({][w-_~%.@,?&;=#(){}+:'\]*)*[/w-_~%@?;=#}\])~i', '~(?<=[s>('<]|^)(www(?:.[w-_]+)+(?::d+)?(?:/[w-_~%.@,?&;=#+:'\]*|[({][w-_~%.@,?&;=#(){}+:'\]*)*[/w-_~%@?;=#}\])~i'), array('[url]$1[/url]', '[url=http://$1]$1[/url]'), $data);
      $data = strtr($data, array(''' => '&#039;', '>">' => '&quot;', '<"<' => '"', '<lt<' => '&lt;'));
     }

找到:

$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "xC2xA0" : "xA0"));
     $data = preg_replace(
      '~(?<=[>;:!? ' . $non_breaking_space . ']()]|^)([w.]{' . $modSettings['fixLongWords'] . ',})~e' . ($context['utf8'] ? 'u' : ''),
      "preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . '})/' . ($context['utf8'] ? 'u' : '') . "', '$1< >', '$1')",
      $data);
     $data = strtr($data, array('< >' => $breaker, $context['utf8'] ? "xC2xA0" : "xA0" => '&nbsp;'));

改为:

//$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "xC2xA0" : "xA0"));
     $data = preg_replace(
      '~(?<=[>;:!? ' . ($context['utf8'] ? 'x{C2A0}' : 'xA0') . ']()]|^)([w.]{' . $modSettings['fixLongWords'] . ',})~/ue' . ($context['utf8'] ? 'u' : ''),
      "preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . '})/' . ($context['utf8'] ? 'u' : '') . "', '$1< >', '$1')",
      $data);
     //$data = strtr($data, array('< >' => $breaker, $context['utf8'] ? "xC2xA0" : "xA0" => '&nbsp;'));

---------------------------------------------------------

特别注意!!在修改Subs.php时一定要用EditPlus编辑(写字板也不行),不然无法运行!!

---------------------------------------------------------

用户名: 密码:
匿名发表
全部评论:0