Minahito
minah****@users*****
2006年 11月 17日 (金) 19:39:51 JST
Index: xoops2jp/html/modules/user/admin/preload/AdminPreload.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/preload/AdminPreload.class.php:1.1.2.1 --- /dev/null Fri Nov 17 19:39:51 2006 +++ xoops2jp/html/modules/user/admin/preload/AdminPreload.class.php Fri Nov 17 19:39:51 2006 @@ -0,0 +1,33 @@ +<?php +/** + * @package user + * @version $Id: AdminPreload.class.php,v 1.1.2.1 2006/11/17 10:39:51 minahito Exp $ + */ + +class User_AdminPreload extends XCube_ActionFilter +{ + function preBlockFilter() + { + $this->mRoot->mDelegateManager->add('Legacy.Event.ThemeSettingChanged', 'User_AdminPreload::doThemeSettingChanged'); + } + + function doThemeSettingChanged($mainTheme, $selectableThemes) + { + $root =& XCube_Root::getSingleton(); + $db =& $root->mController->mDB; + $table = $db->prefix('users'); + + $mainTheme = $db->quoteString($mainTheme); + + $t_conds = array(); + foreach ($selectableThemes as $theme) { + $t_conds[] = "theme <> " . $db->quoteString($theme); + } + + $sql = "UPDATE ${table} SET theme=${mainTheme} WHERE " . join(' AND ' , $t_conds); + + $db->query($sql); + } +} + +?> \ No newline at end of file