XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
AdminPreload.class.php
1<?php
8
9if (!defined('XOOPS_ROOT_PATH')) {
10 exit();
11}
12
14{
15 public function preBlockFilter()
16 {
17 $this->mRoot->mDelegateManager->add('Legacy.Event.ThemeSettingChanged', [$this, 'doThemeSettingChanged']);
18 }
19
20 public function doThemeSettingChanged($mainTheme, $selectableThemes)
21 {
22 $root = XCube_Root::getSingleton();
23 $db = $root->mController->mDB;
24 $table = $db->prefix('users');
25
26 $mainTheme = $db->quoteString($mainTheme);
27
28 $t_conds = [];
29 $t_conds[] = 'theme <> ' . $db->quoteString('');
30 foreach ($selectableThemes as $theme) {
31 $t_conds[] = 'theme <> ' . $db->quoteString($theme);
32 }
33
34 $sql = "UPDATE {$table} SET theme={$mainTheme} WHERE " . implode(' AND ', $t_conds);
35
36 $db->query($sql);
37 }
38}
preBlockFilter()
[Abstract] Executes the logic, when the controller executes preBlockFilter().