管理画面表示をテーマprofessional固定にする
出典: GeeklogJpWiki
目次 |
[編集]
Geeklog1.5、1.6の場合
以下のハックにより,管理画面表示が自動的にテーマprofessionalに切り替わります。テーマをおもいっきり個性的なレイアウトにしたときなどでも,管理画面のレイアウトで困ることがありません。
[編集]
lib-common.phpを修正する
Set themeを探して編集してください。
修正前:
// Set theme
// Need to modify this code to check if theme was cached in user cookie. That
// way if user logged in and set theme and then logged out we would still know
// which theme to show them.
$usetheme = '';
if( isset( $_POST['usetheme'] ))
{
$usetheme = COM_sanitizeFilename($_POST['usetheme'], true);
}
if( !empty( $usetheme ) && is_dir( $_CONF['path_themes'] . $usetheme ))
{
$_CONF['theme'] = $usetheme;
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
else if( $_CONF['allow_user_themes'] == 1 )
{
if( isset( $_COOKIE[$_CONF['cookie_theme']] ) && empty( $_USER['theme'] ))
{
$theme = COM_sanitizeFilename($_COOKIE[$_CONF['cookie_theme']], true);
if( is_dir( $_CONF['path_themes'] . $theme ))
{
$_USER['theme'] = $theme;
}
}
if( !empty( $_USER['theme'] ))
{
if( is_dir( $_CONF['path_themes'] . $_USER['theme'] ))
{
$_CONF['theme'] = $_USER['theme'];
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
else
{
$_USER['theme'] = $_CONF['theme'];
}
}
}
修正後:
// Set theme
// Need to modify this code to check if theme was cached in user cookie. That
// way if user logged in and set theme and then logged out we would still know
// which theme to show them.
$usetheme = '';
if( isset( $_POST['usetheme'] ))
{
$usetheme = COM_sanitizeFilename($_POST['usetheme'], true);
}
if( !empty( $usetheme ) && is_dir( $_CONF['path_themes'] . $usetheme ))
{
$_CONF['theme'] = $usetheme;
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
else if( $_CONF['allow_user_themes'] == 1 )
{
if( isset( $_COOKIE[$_CONF['cookie_theme']] ) && empty( $_USER['theme'] ))
{
$theme = COM_sanitizeFilename($_COOKIE[$_CONF['cookie_theme']], true);
if( is_dir( $_CONF['path_themes'] . $theme ))
{
$_USER['theme'] = $theme;
}
}
if( !empty( $_USER['theme'] ))
{
if( is_dir( $_CONF['path_themes'] . $_USER['theme'] ))
{
$_CONF['theme'] = $_USER['theme'];
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
else
{
$_USER['theme'] = $_CONF['theme'];
}
}
}
// 管理画面ならprofessionalテーマに ---->
if( strpos( $_SERVER['PHP_SELF'], '/admin/' ) !== false ){
$_CONF['theme'] = 'professional';
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
// 管理画面ならprofessionalテーマに <----
[編集]
Geeklog1.4.1の場合
以下のハックにより,テーマのadminディレクトリが無ければ,管理画面表示が自動的にテーマprofessionalに切り替わります。テーマをおもいっきり個性的なレイアウトにしたときなどでも,管理画面のレイアウトで困ることがありません。
以下1,2,3の手順でハックします。
[編集]
1.lib-common.phpを修正する
lib-common.php 284行目あたりに,Set themeという,テーマを設定する関数がおかれています。設定が終了した329行目あたりで,もし管理画面ならテーマprofessionalに設定するよう,以下のようにコードを追加します。
// Geeklog Japanese Ivy changed by kinoshita 管理画面テンプレートがなければprofessionalテーマに 2007/07/23 ---->
if( strpos( $_SERVER['PHP_SELF'], '/admin/' ) !== false ){
if( is_dir($_CONF['path_layout'] . 'admin' ) === false ){
$_CONF['theme'] = 'professional';
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
}
// Geeklog Japanese Ivy changed by kinoshita 管理画面テンプレートがなければprofessionalテーマに 2007/07/23 <----
[編集]
2.lib-admin.phpを修正する
lib-admin.php287行目と,80行目付近の2箇所で$admin_templatesがセットされています。それを以下のようにそれぞれ修正します。
修正前:
$admin_templates = new Template($_CONF['path_layout'] . 'admin/lists');
修正後:
// Geeklog Japanese Ivy changed by kinoshita 管理画面テンプレートがなければprofessionalテーマに 2007/07/23 ---->
if( is_dir($_CONF['path_layout'] . 'admin/lists' ) === false ){
$admin_templates = new Template($_CONF['path_themes'] . 'professional/admin/lists');
} else {
$admin_templates = new Template($_CONF['path_layout'] . 'admin/lists');
}
// Geeklog Japanese Ivy changed by kinoshita 管理画面テンプレートがなければprofessionalテーマに 2007/07/23 <----
[編集]
3.テーマの管理画面ディレクトリを削除する
テーマのadminディレクトリ /layout/admin/以下を削除,あるいは/layout/admin/を/layout/_admin/等へ変更します。




