「日本語で9文字以上のユーザー名でユーザー登録すると文字化けする。」と問い合わせがあったので少しHackしてみました。
これは、Joomla!1.0.xの場合です。
これには2つの原因があります。データベースの文字数制限と、ユーザー登録時の文字数制限です。
まず、phpMyAdminでデータベースを開きます。
次にRoot/includes/joomla.phpを開き以下の行を変更します。(2826行目付近)
// check that username is not greater than 25 characters
$username = $this->username;
if ( strlen($username) > 25 ) {
$this->username = substr( $username, 0, 25 );
}
の25の部分をデータベースと同様に51に変更します。
// check that username is not greater than 25 characters
$username = $this->username;
if ( strlen($username) > 51 ) {
$this->username = substr( $username, 0, 51 );
}
以上で日本語17文字のユーザー名まで登録できるようになりました。
今回は、51としましたがお好みで3の倍数になるように変更されても良いのではないでしょうか。
また、Fireboardのコードを変更しちゃいました。
投稿メッセージ中にコードを入力するとうちではSyntaxHighliterプラグインによってHighlightされますが、コード中に改行が入っていても<br />タグに変換されてしまうため見苦しいものになっていました。
そこで・・・。
root/components/com_fireboard/template/default/smile.class.php 内5カ所を変更・追加しました。
if ($break == "\r") $break = "\n"; while (list(, $value) = each($content))
を
if ($break == "\r") $break = "\n"; $textarea = false; while (list(, $value) = each($content))
のように
if ((!count($innbr) && in_array($t[1], $nobr)) || in_array($t[1], $innbr)) $innbr[] = $t[1]; // Otherwise this is a closing tag
を
if ((!count($innbr) && in_array($t[1], $nobr)) || in_array($t[1], $innbr))
$innbr[] = $t[1];
// Otherwise this is a closing tag
if(strpos($value, 'name="code"')){
$textarea = true;
}
のように
if (in_array(substr($value, 1), $innbr)) unset($innbr[count($innbr)]);
を
if (in_array(substr($value, 1), $innbr))
unset($innbr[count($innbr)]);
if(strpos($value, 'textarea')){
$textarea = false;
}
のように
if (!count($innbr) && !$textarea)
$value = str_replace("\r", "<br />\n", $value);
を
if (!count($innbr) && !$textarea)
$value = str_replace("\r", "<br />\n", $value);
のように変更してみました。
この変更は、少し場当たり的と言えるかもしれませんが、一番簡単で私の目的は成し得ていますので十分と言えると思っています。
ついでにホームディレクトリが、デフォルトでは一つ上の階層になっているのを本来のホームに変更してみました。
Root/administrator/components/com_joomlaxplorer/config/conf.php
$dir_above = substr( $mosConfig_absolute_path, 0, strrpos( $mosConfig_absolute_path, $GLOBALS["separator"] ));
if( !@is_readable($dir_above)) {
$GLOBALS["home_dir"] = $mosConfig_absolute_path;
// the url corresponding with the home directory: (no trailing '/')
$GLOBALS["home_url"] = $mosConfig_live_site;
}
else {
$GLOBALS["home_dir"] = $dir_above;
// the url corresponding with the home directory: (no trailing '/')
$GLOBALS["home_url"] = substr( $mosConfig_live_site, 0, strrpos($mosConfig_live_site, '/'));
}
を
// $dir_above = substr( $mosConfig_absolute_path, 0, strrpos( $mosConfig_absolute_path, $GLOBALS["separator"] ));
// if( !@is_readable($dir_above)) {
$GLOBALS["home_dir"] = $mosConfig_absolute_path;
// the url corresponding with the home directory: (no trailing '/')
$GLOBALS["home_url"] = $mosConfig_live_site;
// }
// else {
// $GLOBALS["home_dir"] = $dir_above;
// // the url corresponding with the home directory: (no trailing '/')
// $GLOBALS["home_url"] = substr( $mosConfig_live_site, 0, strrpos($mosConfig_live_site, '/'));
// }
のようにコメントアウトしただけです。
このコード上部に書かれているように1.3.0からサイトの一つ上の階層を表示するように変更されたようです。以前から気になっていたのですが、バグかと思っていました。