@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | use Xmf\Request; |
24 | 24 | use Xmf\Module\Admin; |
25 | 25 | use XoopsModules\Songlist\{ |
26 | - Common\Configurator, |
|
27 | - Common\Migrate, |
|
28 | - Helper |
|
26 | + Common\Configurator, |
|
27 | + Common\Migrate, |
|
28 | + Helper |
|
29 | 29 | }; |
30 | 30 | |
31 | 31 | /** @var Admin $adminObject */ |
@@ -68,31 +68,31 @@ discard block |
||
68 | 68 | $message = ''; |
69 | 69 | |
70 | 70 | switch ($op) { |
71 | - case 'show': |
|
72 | - default: |
|
73 | - $queue = $migrator->getSynchronizeDDL(); |
|
74 | - if (!empty($queue)) { |
|
75 | - echo "<pre>\n"; |
|
76 | - foreach ($queue as $line) { |
|
77 | - echo $line . ";\n"; |
|
78 | - } |
|
79 | - echo "</pre>\n"; |
|
80 | - } |
|
81 | - break; |
|
82 | - case 'migrate': |
|
83 | - $migrator->synchronizeSchema(); |
|
84 | - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); |
|
85 | - break; |
|
86 | - case 'schema': |
|
87 | - xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); |
|
88 | - break; |
|
89 | - case 'confirmwrite': |
|
90 | - if ($GLOBALS['xoopsSecurity']->check()) { |
|
91 | - $migrator->saveCurrentSchema(); |
|
92 | - |
|
93 | - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK'); |
|
94 | - } |
|
95 | - break; |
|
71 | + case 'show': |
|
72 | + default: |
|
73 | + $queue = $migrator->getSynchronizeDDL(); |
|
74 | + if (!empty($queue)) { |
|
75 | + echo "<pre>\n"; |
|
76 | + foreach ($queue as $line) { |
|
77 | + echo $line . ";\n"; |
|
78 | + } |
|
79 | + echo "</pre>\n"; |
|
80 | + } |
|
81 | + break; |
|
82 | + case 'migrate': |
|
83 | + $migrator->synchronizeSchema(); |
|
84 | + $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); |
|
85 | + break; |
|
86 | + case 'schema': |
|
87 | + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); |
|
88 | + break; |
|
89 | + case 'confirmwrite': |
|
90 | + if ($GLOBALS['xoopsSecurity']->check()) { |
|
91 | + $migrator->saveCurrentSchema(); |
|
92 | + |
|
93 | + $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK'); |
|
94 | + } |
|
95 | + break; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | echo "<div>$message</div>"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** @var Configurator $configurator */ |
33 | 33 | /** @var Migrate $migrator */ |
34 | 34 | |
35 | -require __DIR__ . '/admin_header.php'; |
|
35 | +require __DIR__.'/admin_header.php'; |
|
36 | 36 | xoops_cp_header(); |
37 | 37 | |
38 | 38 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -74,27 +74,27 @@ discard block |
||
74 | 74 | if (!empty($queue)) { |
75 | 75 | echo "<pre>\n"; |
76 | 76 | foreach ($queue as $line) { |
77 | - echo $line . ";\n"; |
|
77 | + echo $line.";\n"; |
|
78 | 78 | } |
79 | 79 | echo "</pre>\n"; |
80 | 80 | } |
81 | 81 | break; |
82 | 82 | case 'migrate': |
83 | 83 | $migrator->synchronizeSchema(); |
84 | - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); |
|
84 | + $message = constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_OK'); |
|
85 | 85 | break; |
86 | 86 | case 'schema': |
87 | - xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); |
|
87 | + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_WARNING'), constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM')); |
|
88 | 88 | break; |
89 | 89 | case 'confirmwrite': |
90 | 90 | if ($GLOBALS['xoopsSecurity']->check()) { |
91 | 91 | $migrator->saveCurrentSchema(); |
92 | 92 | |
93 | - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK'); |
|
93 | + $message = constant('CO_'.$moduleDirNameUpper.'_'.'MIGRATE_SCHEMA_OK'); |
|
94 | 94 | } |
95 | 95 | break; |
96 | 96 | } |
97 | 97 | |
98 | 98 | echo "<div>$message</div>"; |
99 | 99 | |
100 | -require_once __DIR__ . '/admin_footer.php'; |
|
100 | +require_once __DIR__.'/admin_footer.php'; |
@@ -16,11 +16,11 @@ |
||
16 | 16 | */ |
17 | 17 | /** @var \Xmf\Module\Admin $adminObject */ |
18 | 18 | |
19 | -require_once __DIR__ . '/admin_header.php'; |
|
19 | +require_once __DIR__.'/admin_header.php'; |
|
20 | 20 | xoops_cp_header(); |
21 | 21 | |
22 | 22 | $adminObject->displayNavigation(basename(__FILE__)); |
23 | 23 | $adminObject::setPaypal('[email protected]'); |
24 | 24 | $adminObject->displayAbout(false); |
25 | 25 | |
26 | -require_once __DIR__ . '/admin_footer.php'; |
|
26 | +require_once __DIR__.'/admin_footer.php'; |
@@ -33,68 +33,68 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class forum_XoopsGroupPermForm extends \XoopsGroupPermForm |
35 | 35 | { |
36 | - /** |
|
37 | - * forum_XoopsGroupPermForm constructor. |
|
38 | - * @param $title |
|
39 | - * @param $modid |
|
40 | - * @param $permname |
|
41 | - * @param $permdesc |
|
42 | - * @param string $url |
|
43 | - */ |
|
44 | - public function __construct($title, $modid, $permname, $permdesc, $url = '') |
|
45 | - { |
|
46 | - parent::__construct($title, $modid, $permname, $permdesc, $url); |
|
47 | - } |
|
36 | + /** |
|
37 | + * forum_XoopsGroupPermForm constructor. |
|
38 | + * @param $title |
|
39 | + * @param $modid |
|
40 | + * @param $permname |
|
41 | + * @param $permdesc |
|
42 | + * @param string $url |
|
43 | + */ |
|
44 | + public function __construct($title, $modid, $permname, $permdesc, $url = '') |
|
45 | + { |
|
46 | + parent::__construct($title, $modid, $permname, $permdesc, $url); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - public function render(): string |
|
53 | - { |
|
54 | - // load all child ids for javascript codes |
|
55 | - foreach (array_keys($this->_itemTree) as $item_id) { |
|
56 | - $this->_itemTree[$item_id]['allchild'] = []; |
|
57 | - $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); |
|
58 | - } |
|
59 | - /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
60 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
61 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
62 | - $memberHandler = xoops_getHandler('member'); |
|
63 | - $glist = $memberHandler->getGroupList(); |
|
64 | - foreach (array_keys($glist) as $i) { |
|
65 | - // get selected item id(s) for each group |
|
66 | - $selected = $grouppermHandler->getItemIds($this->_permName, $i, $this->_modid); |
|
67 | - $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
68 | - $ele->setOptionTree($this->_itemTree); |
|
69 | - $this->addElement($ele); |
|
70 | - unset($ele); |
|
71 | - } |
|
72 | - $tray = new \XoopsFormElementTray(''); |
|
73 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
74 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
75 | - $this->addElement($tray); |
|
76 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
77 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
78 | - $elements = $this->getElements(); |
|
79 | - $hidden = ''; |
|
80 | - foreach (array_keys($elements) as $i) { |
|
81 | - if (!is_object($elements[$i])) { |
|
82 | - $ret .= $elements[$i]; |
|
83 | - } elseif ($elements[$i]->isHidden()) { |
|
84 | - $hidden .= $elements[$i]->render(); |
|
85 | - } else { |
|
86 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
87 | - if ('' != $elements[$i]->getDescription()) { |
|
88 | - $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
89 | - } |
|
90 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
91 | - } |
|
92 | - } |
|
93 | - $ret .= "</table>$hidden</form>"; |
|
94 | - $ret .= $this->renderValidationJS(true); |
|
49 | + /** |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + public function render(): string |
|
53 | + { |
|
54 | + // load all child ids for javascript codes |
|
55 | + foreach (array_keys($this->_itemTree) as $item_id) { |
|
56 | + $this->_itemTree[$item_id]['allchild'] = []; |
|
57 | + $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); |
|
58 | + } |
|
59 | + /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
60 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
61 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
62 | + $memberHandler = xoops_getHandler('member'); |
|
63 | + $glist = $memberHandler->getGroupList(); |
|
64 | + foreach (array_keys($glist) as $i) { |
|
65 | + // get selected item id(s) for each group |
|
66 | + $selected = $grouppermHandler->getItemIds($this->_permName, $i, $this->_modid); |
|
67 | + $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
68 | + $ele->setOptionTree($this->_itemTree); |
|
69 | + $this->addElement($ele); |
|
70 | + unset($ele); |
|
71 | + } |
|
72 | + $tray = new \XoopsFormElementTray(''); |
|
73 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
74 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
75 | + $this->addElement($tray); |
|
76 | + $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
77 | + $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
78 | + $elements = $this->getElements(); |
|
79 | + $hidden = ''; |
|
80 | + foreach (array_keys($elements) as $i) { |
|
81 | + if (!is_object($elements[$i])) { |
|
82 | + $ret .= $elements[$i]; |
|
83 | + } elseif ($elements[$i]->isHidden()) { |
|
84 | + $hidden .= $elements[$i]->render(); |
|
85 | + } else { |
|
86 | + $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
87 | + if ('' != $elements[$i]->getDescription()) { |
|
88 | + $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
89 | + } |
|
90 | + $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
91 | + } |
|
92 | + } |
|
93 | + $ret .= "</table>$hidden</form>"; |
|
94 | + $ret .= $this->renderValidationJS(true); |
|
95 | 95 | |
96 | - return $ret; |
|
97 | - } |
|
96 | + return $ret; |
|
97 | + } |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,93 +102,93 @@ discard block |
||
102 | 102 | */ |
103 | 103 | class forum_XoopsGroupFormCheckBox extends \XoopsGroupFormCheckBox |
104 | 104 | { |
105 | - /** |
|
106 | - * forum_XoopsGroupFormCheckBox constructor. |
|
107 | - * @param $caption |
|
108 | - * @param $name |
|
109 | - * @param $groupId |
|
110 | - * @param null $values |
|
111 | - */ |
|
112 | - public function __construct($caption, $name, $groupId, $values = null) |
|
113 | - { |
|
114 | - parent::__construct($caption, $name, $groupId, $values); |
|
115 | - } |
|
105 | + /** |
|
106 | + * forum_XoopsGroupFormCheckBox constructor. |
|
107 | + * @param $caption |
|
108 | + * @param $name |
|
109 | + * @param $groupId |
|
110 | + * @param null $values |
|
111 | + */ |
|
112 | + public function __construct($caption, $name, $groupId, $values = null) |
|
113 | + { |
|
114 | + parent::__construct($caption, $name, $groupId, $values); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Renders checkbox options for this group |
|
119 | - * |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function render(): string |
|
123 | - { |
|
124 | - $ret = '<table class="outer"><tr><td class="odd"><table><tr>'; |
|
125 | - $cols = 1; |
|
126 | - foreach ($this->_optionTree[0]['children'] as $topitem) { |
|
127 | - if ($cols > 4) { |
|
128 | - $ret .= '</tr><tr>'; |
|
129 | - $cols = 1; |
|
130 | - } |
|
131 | - $tree = '<td valign="top">'; |
|
132 | - $prefix = ''; |
|
133 | - $this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
|
134 | - $ret .= $tree . '</td>'; |
|
135 | - ++$cols; |
|
136 | - } |
|
137 | - $ret .= '</tr></table></td><td class="even">'; |
|
138 | - foreach (array_keys($this->_optionTree) as $id) { |
|
139 | - if (!empty($id)) { |
|
140 | - $option_ids[] = "'" . $this->getName() . '[groups][' . $this->_groupId . '][' . $id . ']' . "'"; |
|
141 | - } |
|
142 | - } |
|
143 | - $checkallbtn_id = $this->getName() . '[checkallbtn][' . $this->_groupId . ']'; |
|
144 | - $option_ids_str = implode(', ', $option_ids); |
|
145 | - $ret .= _ALL . ' <input id="' . $checkallbtn_id . '" type="checkbox" value="" onclick="var optionids = new Array(' . $option_ids_str . "); xoopsCheckAllElements(optionids, '" . $checkallbtn_id . "');\">"; |
|
146 | - $ret .= '</td></tr></table>'; |
|
117 | + /** |
|
118 | + * Renders checkbox options for this group |
|
119 | + * |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function render(): string |
|
123 | + { |
|
124 | + $ret = '<table class="outer"><tr><td class="odd"><table><tr>'; |
|
125 | + $cols = 1; |
|
126 | + foreach ($this->_optionTree[0]['children'] as $topitem) { |
|
127 | + if ($cols > 4) { |
|
128 | + $ret .= '</tr><tr>'; |
|
129 | + $cols = 1; |
|
130 | + } |
|
131 | + $tree = '<td valign="top">'; |
|
132 | + $prefix = ''; |
|
133 | + $this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
|
134 | + $ret .= $tree . '</td>'; |
|
135 | + ++$cols; |
|
136 | + } |
|
137 | + $ret .= '</tr></table></td><td class="even">'; |
|
138 | + foreach (array_keys($this->_optionTree) as $id) { |
|
139 | + if (!empty($id)) { |
|
140 | + $option_ids[] = "'" . $this->getName() . '[groups][' . $this->_groupId . '][' . $id . ']' . "'"; |
|
141 | + } |
|
142 | + } |
|
143 | + $checkallbtn_id = $this->getName() . '[checkallbtn][' . $this->_groupId . ']'; |
|
144 | + $option_ids_str = implode(', ', $option_ids); |
|
145 | + $ret .= _ALL . ' <input id="' . $checkallbtn_id . '" type="checkbox" value="" onclick="var optionids = new Array(' . $option_ids_str . "); xoopsCheckAllElements(optionids, '" . $checkallbtn_id . "');\">"; |
|
146 | + $ret .= '</td></tr></table>'; |
|
147 | 147 | |
148 | - return $ret; |
|
149 | - } |
|
148 | + return $ret; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * @param string $tree |
|
153 | - * @param array $option |
|
154 | - * @param string $prefix |
|
155 | - * @param array $parentIds |
|
156 | - */ |
|
157 | - public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []): void |
|
158 | - { |
|
159 | - if ($option['id'] > 0) : |
|
160 | - $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="'; |
|
161 | - foreach ($parentIds as $pid) { |
|
162 | - if ($pid <= 0) { |
|
163 | - continue; |
|
164 | - } |
|
165 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
166 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked !== true) {ele.checked = this.checked;}"; |
|
167 | - } |
|
168 | - foreach ($option['allchild'] as $cid) { |
|
169 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
170 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked !== true) {ele.checked = false;}"; |
|
171 | - } |
|
172 | - $tree .= '" value="1"'; |
|
173 | - if (in_array($option['id'], $this->_value, true)) { |
|
174 | - $tree .= ' checked'; |
|
175 | - } |
|
176 | - $tree .= '>' . $option['name'] . '<input type="hidden" name="' . $this->getName() . '[parents][' . $option['id'] . ']" value="' . implode(':', $parentIds) . '"><input type="hidden" name="' . $this->getName() . '[itemname][' . $option['id'] . ']" value="' . htmlspecialchars( |
|
177 | - $option['name'], |
|
178 | - ENT_QUOTES | ENT_HTML5 |
|
179 | - ) . "\"><br>\n"; |
|
180 | - else : |
|
181 | - $tree .= $prefix . $option['name'] . '<input type="hidden" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\"><br>\n"; |
|
182 | - endif; |
|
183 | - if (isset($option['children'])) { |
|
184 | - foreach ($option['children'] as $child) { |
|
185 | - if ($option['id'] > 0) { |
|
186 | - $parentIds[] = $option['id']; |
|
187 | - } |
|
188 | - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
151 | + /** |
|
152 | + * @param string $tree |
|
153 | + * @param array $option |
|
154 | + * @param string $prefix |
|
155 | + * @param array $parentIds |
|
156 | + */ |
|
157 | + public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []): void |
|
158 | + { |
|
159 | + if ($option['id'] > 0) : |
|
160 | + $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="'; |
|
161 | + foreach ($parentIds as $pid) { |
|
162 | + if ($pid <= 0) { |
|
163 | + continue; |
|
164 | + } |
|
165 | + $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
166 | + $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked !== true) {ele.checked = this.checked;}"; |
|
167 | + } |
|
168 | + foreach ($option['allchild'] as $cid) { |
|
169 | + $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
170 | + $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked !== true) {ele.checked = false;}"; |
|
171 | + } |
|
172 | + $tree .= '" value="1"'; |
|
173 | + if (in_array($option['id'], $this->_value, true)) { |
|
174 | + $tree .= ' checked'; |
|
175 | + } |
|
176 | + $tree .= '>' . $option['name'] . '<input type="hidden" name="' . $this->getName() . '[parents][' . $option['id'] . ']" value="' . implode(':', $parentIds) . '"><input type="hidden" name="' . $this->getName() . '[itemname][' . $option['id'] . ']" value="' . htmlspecialchars( |
|
177 | + $option['name'], |
|
178 | + ENT_QUOTES | ENT_HTML5 |
|
179 | + ) . "\"><br>\n"; |
|
180 | + else : |
|
181 | + $tree .= $prefix . $option['name'] . '<input type="hidden" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\"><br>\n"; |
|
182 | + endif; |
|
183 | + if (isset($option['children'])) { |
|
184 | + foreach ($option['children'] as $child) { |
|
185 | + if ($option['id'] > 0) { |
|
186 | + $parentIds[] = $option['id']; |
|
187 | + } |
|
188 | + $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | xoops_cp_header(); |
@@ -200,204 +200,204 @@ discard block |
||
200 | 200 | $perms = array_map('\trim', explode(',', FORUM_PERM_ITEMS)); |
201 | 201 | |
202 | 202 | switch ($action) { |
203 | - case 'template': |
|
204 | - $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
205 | - $op_select = new \XoopsFormSelect('', 'action'); |
|
206 | - $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
207 | - $op_select->addOptionArray( |
|
208 | - [ |
|
209 | - 'no' => _SELECT, |
|
210 | - 'template' => _AM_SONGLIST_PERM_TEMPLATE, |
|
211 | - 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP, |
|
212 | - 'default' => _AM_SONGLIST_PERM_SETBYGROUP, |
|
213 | - ] |
|
214 | - ); |
|
215 | - $opform->addElement($op_select); |
|
216 | - $opform->display(); |
|
203 | + case 'template': |
|
204 | + $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
205 | + $op_select = new \XoopsFormSelect('', 'action'); |
|
206 | + $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
207 | + $op_select->addOptionArray( |
|
208 | + [ |
|
209 | + 'no' => _SELECT, |
|
210 | + 'template' => _AM_SONGLIST_PERM_TEMPLATE, |
|
211 | + 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP, |
|
212 | + 'default' => _AM_SONGLIST_PERM_SETBYGROUP, |
|
213 | + ] |
|
214 | + ); |
|
215 | + $opform->addElement($op_select); |
|
216 | + $opform->display(); |
|
217 | 217 | |
218 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
219 | - $memberHandler = xoops_getHandler('member'); |
|
220 | - $glist = $memberHandler->getGroupList(); |
|
221 | - $elements = []; |
|
222 | - $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
223 | - $perm_template = $songlistpermHandler->getTemplate($groupid = 0); |
|
224 | - foreach (array_keys($glist) as $i) { |
|
225 | - $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; |
|
226 | - $ret_ele = '<tr align="left" valign="top"><td class="head">' . $glist[$i] . '</td>'; |
|
227 | - $ret_ele .= '<td class="even">'; |
|
228 | - $ret_ele .= '<table class="outer"><tr><td class="odd"><table><tr>'; |
|
229 | - $ii = 0; |
|
230 | - $option_ids = []; |
|
231 | - foreach ($perms as $perm) { |
|
232 | - ++$ii; |
|
233 | - if (0 == $ii % 5) { |
|
234 | - $ret_ele .= '</tr><tr>'; |
|
235 | - } |
|
236 | - $checked = in_array('forum_' . $perm, $selected, true) ? ' checked' : ''; |
|
237 | - $option_id = $perm . '_' . $i; |
|
238 | - $option_ids[] = $option_id; |
|
239 | - $ret_ele .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)) . '<br></td>'; |
|
240 | - } |
|
241 | - $ret_ele .= '</tr></table></td><td class="even">'; |
|
242 | - $ret_ele .= _ALL . ' <input id="checkall[' . $i . ']" type="checkbox" value="" onclick="var optionids = new Array(' . implode(', ', $option_ids) . '); xoopsCheckAllElements(optionids, \'checkall[' . $i . ']\')">'; |
|
243 | - $ret_ele .= '</td></tr></table>'; |
|
244 | - $ret_ele .= '</td></tr>'; |
|
245 | - $elements[] = $ret_ele; |
|
246 | - } |
|
247 | - $tray = new \XoopsFormElementTray(''); |
|
248 | - $tray->addElement(new \XoopsFormHidden('action', 'template_save')); |
|
249 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
250 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
251 | - $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br><br><br>'; |
|
252 | - $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
253 | - $ret .= implode("\n", $elements); |
|
254 | - $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even">'; |
|
255 | - $ret .= $tray->render(); |
|
256 | - $ret .= '</td></tr>'; |
|
257 | - $ret .= '</table></form>'; |
|
258 | - echo $ret; |
|
259 | - break; |
|
260 | - case 'template_save': |
|
261 | - $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
262 | - $res = $songlistpermHandler->setTemplate($_POST['perms'], $groupid = 0); |
|
263 | - if ($res) { |
|
264 | - redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
|
265 | - } else { |
|
266 | - redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
|
267 | - } |
|
268 | - break; |
|
269 | - case 'apply': |
|
270 | - $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
271 | - $perm_template = $songlistpermHandler->getTemplate(); |
|
272 | - if (null === $perm_template) { |
|
273 | - redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE); |
|
274 | - } |
|
218 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
219 | + $memberHandler = xoops_getHandler('member'); |
|
220 | + $glist = $memberHandler->getGroupList(); |
|
221 | + $elements = []; |
|
222 | + $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
223 | + $perm_template = $songlistpermHandler->getTemplate($groupid = 0); |
|
224 | + foreach (array_keys($glist) as $i) { |
|
225 | + $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; |
|
226 | + $ret_ele = '<tr align="left" valign="top"><td class="head">' . $glist[$i] . '</td>'; |
|
227 | + $ret_ele .= '<td class="even">'; |
|
228 | + $ret_ele .= '<table class="outer"><tr><td class="odd"><table><tr>'; |
|
229 | + $ii = 0; |
|
230 | + $option_ids = []; |
|
231 | + foreach ($perms as $perm) { |
|
232 | + ++$ii; |
|
233 | + if (0 == $ii % 5) { |
|
234 | + $ret_ele .= '</tr><tr>'; |
|
235 | + } |
|
236 | + $checked = in_array('forum_' . $perm, $selected, true) ? ' checked' : ''; |
|
237 | + $option_id = $perm . '_' . $i; |
|
238 | + $option_ids[] = $option_id; |
|
239 | + $ret_ele .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)) . '<br></td>'; |
|
240 | + } |
|
241 | + $ret_ele .= '</tr></table></td><td class="even">'; |
|
242 | + $ret_ele .= _ALL . ' <input id="checkall[' . $i . ']" type="checkbox" value="" onclick="var optionids = new Array(' . implode(', ', $option_ids) . '); xoopsCheckAllElements(optionids, \'checkall[' . $i . ']\')">'; |
|
243 | + $ret_ele .= '</td></tr></table>'; |
|
244 | + $ret_ele .= '</td></tr>'; |
|
245 | + $elements[] = $ret_ele; |
|
246 | + } |
|
247 | + $tray = new \XoopsFormElementTray(''); |
|
248 | + $tray->addElement(new \XoopsFormHidden('action', 'template_save')); |
|
249 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
250 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
251 | + $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br><br><br>'; |
|
252 | + $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
253 | + $ret .= implode("\n", $elements); |
|
254 | + $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even">'; |
|
255 | + $ret .= $tray->render(); |
|
256 | + $ret .= '</td></tr>'; |
|
257 | + $ret .= '</table></form>'; |
|
258 | + echo $ret; |
|
259 | + break; |
|
260 | + case 'template_save': |
|
261 | + $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
262 | + $res = $songlistpermHandler->setTemplate($_POST['perms'], $groupid = 0); |
|
263 | + if ($res) { |
|
264 | + redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
|
265 | + } else { |
|
266 | + redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
|
267 | + } |
|
268 | + break; |
|
269 | + case 'apply': |
|
270 | + $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
271 | + $perm_template = $songlistpermHandler->getTemplate(); |
|
272 | + if (null === $perm_template) { |
|
273 | + redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE); |
|
274 | + } |
|
275 | 275 | |
276 | - $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
277 | - $op_select = new \XoopsFormSelect('', 'action'); |
|
278 | - $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
279 | - $op_select->addOptionArray(['no' => _SELECT, 'template' => _AM_SONGLIST_PERM_TEMPLATE, 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP]); |
|
280 | - $opform->addElement($op_select); |
|
281 | - $opform->display(); |
|
276 | + $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
277 | + $op_select = new \XoopsFormSelect('', 'action'); |
|
278 | + $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
279 | + $op_select->addOptionArray(['no' => _SELECT, 'template' => _AM_SONGLIST_PERM_TEMPLATE, 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP]); |
|
280 | + $opform->addElement($op_select); |
|
281 | + $opform->display(); |
|
282 | 282 | |
283 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
284 | - $categories = $categoryHandler->getAllCats('', true, false, true); |
|
283 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
284 | + $categories = $categoryHandler->getAllCats('', true, false, true); |
|
285 | 285 | |
286 | - $GLOBALS['forumHandler'] = Helper::getInstance()->getHandler('Forum'); |
|
287 | - $songlists = $GLOBALS['forumHandler']->getForumsByCategory(0, '', false, false, true); |
|
288 | - $fm_options = []; |
|
289 | - foreach (array_keys($categories) as $c) { |
|
290 | - $fm_options[-1 * $c] = '[' . $categories[$c]->getVar('cat_title') . ']'; |
|
291 | - foreach (array_keys($songlists[$c]) as $f) { |
|
292 | - $fm_options[$f] = $songlists[$c][$f]['title']; |
|
293 | - if (!isset($songlists[$c][$f]['sub'])) { |
|
294 | - continue; |
|
295 | - } |
|
296 | - foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
|
297 | - $fm_options[$s] = '-- ' . $songlists[$c][$f]['sub'][$s]['title']; |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - unset($songlists, $categories); |
|
302 | - $fmform = new \XoopsThemeForm(_AM_SONGLIST_PERM_TEMPLATEAPP, 'fmform', 'permissions.php', 'post', true); |
|
303 | - $fm_select = new \XoopsFormSelect(_AM_SONGLIST_PERM_FORUMS, 'forums', null, 10, true); |
|
304 | - $fm_select->addOptionArray($fm_options); |
|
305 | - $fmform->addElement($fm_select); |
|
306 | - $tray = new \XoopsFormElementTray(''); |
|
307 | - $tray->addElement(new \XoopsFormHidden('action', 'apply_save')); |
|
308 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
309 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
310 | - $fmform->addElement($tray); |
|
311 | - $fmform->display(); |
|
312 | - break; |
|
313 | - case 'apply_save': |
|
314 | - if (empty($_POST['forums'])) { |
|
315 | - break; |
|
316 | - } |
|
317 | - $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
318 | - foreach ($_POST['forums'] as $songlist) { |
|
319 | - if ($songlist < 1) { |
|
320 | - continue; |
|
321 | - } |
|
322 | - $songlistpermHandler->applyTemplate($songlist, $module_id); |
|
323 | - } |
|
324 | - redirect_header('permissions.php', 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
|
325 | - break; |
|
326 | - default: |
|
327 | - $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
328 | - $op_select = new \XoopsFormSelect('', 'action'); |
|
329 | - $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
330 | - $op_select->addOptionArray( |
|
331 | - [ |
|
332 | - 'no' => _SELECT, |
|
333 | - 'template' => _AM_SONGLIST_PERM_TEMPLATE, |
|
334 | - 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP, |
|
335 | - 'default' => _AM_SONGLIST_PERM_SETBYGROUP, |
|
336 | - ] |
|
337 | - ); |
|
338 | - $opform->addElement($op_select); |
|
339 | - $opform->display(); |
|
286 | + $GLOBALS['forumHandler'] = Helper::getInstance()->getHandler('Forum'); |
|
287 | + $songlists = $GLOBALS['forumHandler']->getForumsByCategory(0, '', false, false, true); |
|
288 | + $fm_options = []; |
|
289 | + foreach (array_keys($categories) as $c) { |
|
290 | + $fm_options[-1 * $c] = '[' . $categories[$c]->getVar('cat_title') . ']'; |
|
291 | + foreach (array_keys($songlists[$c]) as $f) { |
|
292 | + $fm_options[$f] = $songlists[$c][$f]['title']; |
|
293 | + if (!isset($songlists[$c][$f]['sub'])) { |
|
294 | + continue; |
|
295 | + } |
|
296 | + foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
|
297 | + $fm_options[$s] = '-- ' . $songlists[$c][$f]['sub'][$s]['title']; |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + unset($songlists, $categories); |
|
302 | + $fmform = new \XoopsThemeForm(_AM_SONGLIST_PERM_TEMPLATEAPP, 'fmform', 'permissions.php', 'post', true); |
|
303 | + $fm_select = new \XoopsFormSelect(_AM_SONGLIST_PERM_FORUMS, 'forums', null, 10, true); |
|
304 | + $fm_select->addOptionArray($fm_options); |
|
305 | + $fmform->addElement($fm_select); |
|
306 | + $tray = new \XoopsFormElementTray(''); |
|
307 | + $tray->addElement(new \XoopsFormHidden('action', 'apply_save')); |
|
308 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
309 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
310 | + $fmform->addElement($tray); |
|
311 | + $fmform->display(); |
|
312 | + break; |
|
313 | + case 'apply_save': |
|
314 | + if (empty($_POST['forums'])) { |
|
315 | + break; |
|
316 | + } |
|
317 | + $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
|
318 | + foreach ($_POST['forums'] as $songlist) { |
|
319 | + if ($songlist < 1) { |
|
320 | + continue; |
|
321 | + } |
|
322 | + $songlistpermHandler->applyTemplate($songlist, $module_id); |
|
323 | + } |
|
324 | + redirect_header('permissions.php', 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
|
325 | + break; |
|
326 | + default: |
|
327 | + $opform = new \XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', 'get'); |
|
328 | + $op_select = new \XoopsFormSelect('', 'action'); |
|
329 | + $op_select->setExtra('onchange="document.forms.actionform.submit()"'); |
|
330 | + $op_select->addOptionArray( |
|
331 | + [ |
|
332 | + 'no' => _SELECT, |
|
333 | + 'template' => _AM_SONGLIST_PERM_TEMPLATE, |
|
334 | + 'apply' => _AM_SONGLIST_PERM_TEMPLATEAPP, |
|
335 | + 'default' => _AM_SONGLIST_PERM_SETBYGROUP, |
|
336 | + ] |
|
337 | + ); |
|
338 | + $opform->addElement($op_select); |
|
339 | + $opform->display(); |
|
340 | 340 | |
341 | - $GLOBALS['forumHandler'] = Helper::getInstance()->getHandler('Forum'); |
|
342 | - $songlists = $GLOBALS['forumHandler']->getForumsByCategory(0, '', false, false, true); |
|
343 | - $op_options = ['category' => _AM_SONGLIST_CAT_ACCESS]; |
|
344 | - $fm_options = ['category' => ['title' => _AM_SONGLIST_CAT_ACCESS, 'item' => 'category_access', 'desc' => '', 'anonymous' => true]]; |
|
345 | - foreach ($perms as $perm) { |
|
346 | - $op_options[$perm] = constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)); |
|
347 | - $fm_options[$perm] = ['title' => constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)), 'item' => 'forum_' . $perm, 'desc' => '', 'anonymous' => true]; |
|
348 | - } |
|
341 | + $GLOBALS['forumHandler'] = Helper::getInstance()->getHandler('Forum'); |
|
342 | + $songlists = $GLOBALS['forumHandler']->getForumsByCategory(0, '', false, false, true); |
|
343 | + $op_options = ['category' => _AM_SONGLIST_CAT_ACCESS]; |
|
344 | + $fm_options = ['category' => ['title' => _AM_SONGLIST_CAT_ACCESS, 'item' => 'category_access', 'desc' => '', 'anonymous' => true]]; |
|
345 | + foreach ($perms as $perm) { |
|
346 | + $op_options[$perm] = constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)); |
|
347 | + $fm_options[$perm] = ['title' => constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)), 'item' => 'forum_' . $perm, 'desc' => '', 'anonymous' => true]; |
|
348 | + } |
|
349 | 349 | |
350 | - $op_keys = array_keys($op_options); |
|
351 | - $op = isset($_GET['op']) ? \mb_strtolower($_GET['op']) : (isset($_COOKIE['op']) ? \mb_strtolower($_COOKIE['op']) : ''); |
|
352 | - if (empty($op)) { |
|
353 | - $op = $op_keys[0]; |
|
354 | - setcookie('op', $op_keys[1] ?? ''); |
|
355 | - } else { |
|
356 | - for ($i = 0, $iMax = count($op_keys); $i < $iMax; ++$i) { |
|
357 | - if ($op_keys[$i] == $op) { |
|
358 | - break; |
|
359 | - } |
|
360 | - } |
|
361 | - setcookie('op', $op_keys[$i + 1] ?? ''); |
|
362 | - } |
|
350 | + $op_keys = array_keys($op_options); |
|
351 | + $op = isset($_GET['op']) ? \mb_strtolower($_GET['op']) : (isset($_COOKIE['op']) ? \mb_strtolower($_COOKIE['op']) : ''); |
|
352 | + if (empty($op)) { |
|
353 | + $op = $op_keys[0]; |
|
354 | + setcookie('op', $op_keys[1] ?? ''); |
|
355 | + } else { |
|
356 | + for ($i = 0, $iMax = count($op_keys); $i < $iMax; ++$i) { |
|
357 | + if ($op_keys[$i] == $op) { |
|
358 | + break; |
|
359 | + } |
|
360 | + } |
|
361 | + setcookie('op', $op_keys[$i + 1] ?? ''); |
|
362 | + } |
|
363 | 363 | |
364 | - $opform = new \XoopsSimpleForm('', 'opform', 'permissions.php', 'get'); |
|
365 | - $op_select = new \XoopsFormSelect('', 'op', $op); |
|
366 | - $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
367 | - $op_select->addOptionArray($op_options); |
|
368 | - $opform->addElement($op_select); |
|
369 | - $opform->display(); |
|
364 | + $opform = new \XoopsSimpleForm('', 'opform', 'permissions.php', 'get'); |
|
365 | + $op_select = new \XoopsFormSelect('', 'op', $op); |
|
366 | + $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
|
367 | + $op_select->addOptionArray($op_options); |
|
368 | + $opform->addElement($op_select); |
|
369 | + $opform->display(); |
|
370 | 370 | |
371 | - $perm_desc = ''; |
|
371 | + $perm_desc = ''; |
|
372 | 372 | |
373 | - $form = new forum_XoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/permissions.php', $fm_options[$op]['anonymous']); |
|
373 | + $form = new forum_XoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/permissions.php', $fm_options[$op]['anonymous']); |
|
374 | 374 | |
375 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
376 | - $categories = $categoryHandler->getObjects(null, true); |
|
377 | - if ('category' === $op) { |
|
378 | - foreach (array_keys($categories) as $c) { |
|
379 | - $form->addItem($c, $categories[$c]->getVar('cat_title')); |
|
380 | - } |
|
381 | - unset($categories); |
|
382 | - } else { |
|
383 | - foreach (array_keys($categories) as $c) { |
|
384 | - $key_c = -1 * $c; |
|
385 | - $form->addItem($key_c, '<strong>[' . $categories[$c]->getVar('cat_title') . ']</strong>'); |
|
386 | - foreach (array_keys($songlists[$c]) as $f) { |
|
387 | - $form->addItem($f, $songlists[$c][$f]['title'], $key_c); |
|
388 | - if (!isset($songlists[$c][$f]['sub'])) { |
|
389 | - continue; |
|
390 | - } |
|
391 | - foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
|
392 | - $form->addItem($s, '→' . $songlists[$c][$f]['sub'][$s]['title'], $f); |
|
393 | - } |
|
394 | - } |
|
395 | - } |
|
396 | - unset($songlists, $categories); |
|
397 | - } |
|
398 | - $form->display(); |
|
375 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
376 | + $categories = $categoryHandler->getObjects(null, true); |
|
377 | + if ('category' === $op) { |
|
378 | + foreach (array_keys($categories) as $c) { |
|
379 | + $form->addItem($c, $categories[$c]->getVar('cat_title')); |
|
380 | + } |
|
381 | + unset($categories); |
|
382 | + } else { |
|
383 | + foreach (array_keys($categories) as $c) { |
|
384 | + $key_c = -1 * $c; |
|
385 | + $form->addItem($key_c, '<strong>[' . $categories[$c]->getVar('cat_title') . ']</strong>'); |
|
386 | + foreach (array_keys($songlists[$c]) as $f) { |
|
387 | + $form->addItem($f, $songlists[$c][$f]['title'], $key_c); |
|
388 | + if (!isset($songlists[$c][$f]['sub'])) { |
|
389 | + continue; |
|
390 | + } |
|
391 | + foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
|
392 | + $form->addItem($s, '→' . $songlists[$c][$f]['sub'][$s]['title'], $f); |
|
393 | + } |
|
394 | + } |
|
395 | + } |
|
396 | + unset($songlists, $categories); |
|
397 | + } |
|
398 | + $form->display(); |
|
399 | 399 | |
400 | - break; |
|
400 | + break; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | echo chronolabs_inline(false); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | use Xmf\Module\Admin; |
19 | 19 | use XoopsModules\Songlist\Helper; |
20 | 20 | |
21 | -require_once __DIR__ . '/header.php'; |
|
22 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/class/xoopsformloader.php'; |
|
23 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
21 | +require_once __DIR__.'/header.php'; |
|
22 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['songlistModule']->getVar('dirname').'/class/xoopsformloader.php'; |
|
23 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Add category navigation to forum casscade structure |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach (array_keys($glist) as $i) { |
65 | 65 | // get selected item id(s) for each group |
66 | 66 | $selected = $grouppermHandler->getItemIds($this->_permName, $i, $this->_modid); |
67 | - $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
67 | + $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
68 | 68 | $ele->setOptionTree($this->_itemTree); |
69 | 69 | $this->addElement($ele); |
70 | 70 | unset($ele); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
74 | 74 | $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
75 | 75 | $this->addElement($tray); |
76 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
77 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
76 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br>'; |
|
77 | + $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
78 | 78 | $elements = $this->getElements(); |
79 | 79 | $hidden = ''; |
80 | 80 | foreach (array_keys($elements) as $i) { |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | } elseif ($elements[$i]->isHidden()) { |
84 | 84 | $hidden .= $elements[$i]->render(); |
85 | 85 | } else { |
86 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
87 | - if ('' != $elements[$i]->getDescription()) { |
|
88 | - $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
86 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
87 | + if (''!=$elements[$i]->getDescription()) { |
|
88 | + $ret .= '<br><br><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
89 | 89 | } |
90 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
90 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | $ret .= "</table>$hidden</form>"; |
@@ -124,25 +124,25 @@ discard block |
||
124 | 124 | $ret = '<table class="outer"><tr><td class="odd"><table><tr>'; |
125 | 125 | $cols = 1; |
126 | 126 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
127 | - if ($cols > 4) { |
|
128 | - $ret .= '</tr><tr>'; |
|
127 | + if ($cols>4) { |
|
128 | + $ret .= '</tr><tr>'; |
|
129 | 129 | $cols = 1; |
130 | 130 | } |
131 | 131 | $tree = '<td valign="top">'; |
132 | 132 | $prefix = ''; |
133 | 133 | $this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
134 | - $ret .= $tree . '</td>'; |
|
134 | + $ret .= $tree.'</td>'; |
|
135 | 135 | ++$cols; |
136 | 136 | } |
137 | 137 | $ret .= '</tr></table></td><td class="even">'; |
138 | 138 | foreach (array_keys($this->_optionTree) as $id) { |
139 | 139 | if (!empty($id)) { |
140 | - $option_ids[] = "'" . $this->getName() . '[groups][' . $this->_groupId . '][' . $id . ']' . "'"; |
|
140 | + $option_ids[] = "'".$this->getName().'[groups]['.$this->_groupId.']['.$id.']'."'"; |
|
141 | 141 | } |
142 | 142 | } |
143 | - $checkallbtn_id = $this->getName() . '[checkallbtn][' . $this->_groupId . ']'; |
|
143 | + $checkallbtn_id = $this->getName().'[checkallbtn]['.$this->_groupId.']'; |
|
144 | 144 | $option_ids_str = implode(', ', $option_ids); |
145 | - $ret .= _ALL . ' <input id="' . $checkallbtn_id . '" type="checkbox" value="" onclick="var optionids = new Array(' . $option_ids_str . "); xoopsCheckAllElements(optionids, '" . $checkallbtn_id . "');\">"; |
|
145 | + $ret .= _ALL.' <input id="'.$checkallbtn_id.'" type="checkbox" value="" onclick="var optionids = new Array('.$option_ids_str."); xoopsCheckAllElements(optionids, '".$checkallbtn_id."');\">"; |
|
146 | 146 | $ret .= '</td></tr></table>'; |
147 | 147 | |
148 | 148 | return $ret; |
@@ -156,36 +156,36 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []): void |
158 | 158 | { |
159 | - if ($option['id'] > 0) : |
|
160 | - $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="'; |
|
159 | + if ($option['id']>0) : |
|
160 | + $tree .= $prefix.'<input type="checkbox" name="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" id="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" onclick="'; |
|
161 | 161 | foreach ($parentIds as $pid) { |
162 | - if ($pid <= 0) { |
|
162 | + if ($pid<=0) { |
|
163 | 163 | continue; |
164 | 164 | } |
165 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
166 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked !== true) {ele.checked = this.checked;}"; |
|
165 | + $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; |
|
166 | + $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if(ele.checked !== true) {ele.checked = this.checked;}"; |
|
167 | 167 | } |
168 | 168 | foreach ($option['allchild'] as $cid) { |
169 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
170 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked !== true) {ele.checked = false;}"; |
|
169 | + $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; |
|
170 | + $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if(this.checked !== true) {ele.checked = false;}"; |
|
171 | 171 | } |
172 | 172 | $tree .= '" value="1"'; |
173 | 173 | if (in_array($option['id'], $this->_value, true)) { |
174 | 174 | $tree .= ' checked'; |
175 | 175 | } |
176 | - $tree .= '>' . $option['name'] . '<input type="hidden" name="' . $this->getName() . '[parents][' . $option['id'] . ']" value="' . implode(':', $parentIds) . '"><input type="hidden" name="' . $this->getName() . '[itemname][' . $option['id'] . ']" value="' . htmlspecialchars( |
|
176 | + $tree .= '>'.$option['name'].'<input type="hidden" name="'.$this->getName().'[parents]['.$option['id'].']" value="'.implode(':', $parentIds).'"><input type="hidden" name="'.$this->getName().'[itemname]['.$option['id'].']" value="'.htmlspecialchars( |
|
177 | 177 | $option['name'], |
178 | 178 | ENT_QUOTES | ENT_HTML5 |
179 | - ) . "\"><br>\n"; |
|
179 | + )."\"><br>\n"; |
|
180 | 180 | else : |
181 | - $tree .= $prefix . $option['name'] . '<input type="hidden" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\"><br>\n"; |
|
181 | + $tree .= $prefix.$option['name'].'<input type="hidden" id="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\"><br>\n"; |
|
182 | 182 | endif; |
183 | 183 | if (isset($option['children'])) { |
184 | 184 | foreach ($option['children'] as $child) { |
185 | - if ($option['id'] > 0) { |
|
185 | + if ($option['id']>0) { |
|
186 | 186 | $parentIds[] = $option['id']; |
187 | 187 | } |
188 | - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
188 | + $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -223,23 +223,23 @@ discard block |
||
223 | 223 | $perm_template = $songlistpermHandler->getTemplate($groupid = 0); |
224 | 224 | foreach (array_keys($glist) as $i) { |
225 | 225 | $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; |
226 | - $ret_ele = '<tr align="left" valign="top"><td class="head">' . $glist[$i] . '</td>'; |
|
226 | + $ret_ele = '<tr align="left" valign="top"><td class="head">'.$glist[$i].'</td>'; |
|
227 | 227 | $ret_ele .= '<td class="even">'; |
228 | 228 | $ret_ele .= '<table class="outer"><tr><td class="odd"><table><tr>'; |
229 | 229 | $ii = 0; |
230 | 230 | $option_ids = []; |
231 | 231 | foreach ($perms as $perm) { |
232 | 232 | ++$ii; |
233 | - if (0 == $ii % 5) { |
|
233 | + if (0==$ii%5) { |
|
234 | 234 | $ret_ele .= '</tr><tr>'; |
235 | 235 | } |
236 | - $checked = in_array('forum_' . $perm, $selected, true) ? ' checked' : ''; |
|
237 | - $option_id = $perm . '_' . $i; |
|
236 | + $checked = in_array('forum_'.$perm, $selected, true) ? ' checked' : ''; |
|
237 | + $option_id = $perm.'_'.$i; |
|
238 | 238 | $option_ids[] = $option_id; |
239 | - $ret_ele .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)) . '<br></td>'; |
|
239 | + $ret_ele .= '<td><input name="perms['.$i.']['.'forum_'.$perm.']" id="'.$option_id.'" onclick="" value="1" type="checkbox"'.$checked.'>'.constant('_AM_SONGLIST_CAN_'.\mb_strtoupper($perm)).'<br></td>'; |
|
240 | 240 | } |
241 | 241 | $ret_ele .= '</tr></table></td><td class="even">'; |
242 | - $ret_ele .= _ALL . ' <input id="checkall[' . $i . ']" type="checkbox" value="" onclick="var optionids = new Array(' . implode(', ', $option_ids) . '); xoopsCheckAllElements(optionids, \'checkall[' . $i . ']\')">'; |
|
242 | + $ret_ele .= _ALL.' <input id="checkall['.$i.']" type="checkbox" value="" onclick="var optionids = new Array('.implode(', ', $option_ids).'); xoopsCheckAllElements(optionids, \'checkall['.$i.']\')">'; |
|
243 | 243 | $ret_ele .= '</td></tr></table>'; |
244 | 244 | $ret_ele .= '</td></tr>'; |
245 | 245 | $elements[] = $ret_ele; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $tray->addElement(new \XoopsFormHidden('action', 'template_save')); |
249 | 249 | $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
250 | 250 | $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
251 | - $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br><br><br>'; |
|
251 | + $ret = '<h4>'._AM_SONGLIST_PERM_TEMPLATE.'</h4>'._AM_SONGLIST_PERM_TEMPLATE_DESC.'<br><br><br>'; |
|
252 | 252 | $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
253 | 253 | $ret .= implode("\n", $elements); |
254 | 254 | $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even">'; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | case 'apply': |
270 | 270 | $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
271 | 271 | $perm_template = $songlistpermHandler->getTemplate(); |
272 | - if (null === $perm_template) { |
|
272 | + if (null===$perm_template) { |
|
273 | 273 | redirect_header('permissions.php?action=template', 2, _AM_SONGLIST_PERM_TEMPLATE); |
274 | 274 | } |
275 | 275 | |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | $songlists = $GLOBALS['forumHandler']->getForumsByCategory(0, '', false, false, true); |
288 | 288 | $fm_options = []; |
289 | 289 | foreach (array_keys($categories) as $c) { |
290 | - $fm_options[-1 * $c] = '[' . $categories[$c]->getVar('cat_title') . ']'; |
|
290 | + $fm_options[-1*$c] = '['.$categories[$c]->getVar('cat_title').']'; |
|
291 | 291 | foreach (array_keys($songlists[$c]) as $f) { |
292 | 292 | $fm_options[$f] = $songlists[$c][$f]['title']; |
293 | 293 | if (!isset($songlists[$c][$f]['sub'])) { |
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
297 | - $fm_options[$s] = '-- ' . $songlists[$c][$f]['sub'][$s]['title']; |
|
297 | + $fm_options[$s] = '-- '.$songlists[$c][$f]['sub'][$s]['title']; |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | $songlistpermHandler = Helper::getInstance()->getHandler('Permission'); |
318 | 318 | foreach ($_POST['forums'] as $songlist) { |
319 | - if ($songlist < 1) { |
|
319 | + if ($songlist<1) { |
|
320 | 320 | continue; |
321 | 321 | } |
322 | 322 | $songlistpermHandler->applyTemplate($songlist, $module_id); |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | $op_options = ['category' => _AM_SONGLIST_CAT_ACCESS]; |
344 | 344 | $fm_options = ['category' => ['title' => _AM_SONGLIST_CAT_ACCESS, 'item' => 'category_access', 'desc' => '', 'anonymous' => true]]; |
345 | 345 | foreach ($perms as $perm) { |
346 | - $op_options[$perm] = constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)); |
|
347 | - $fm_options[$perm] = ['title' => constant('_AM_SONGLIST_CAN_' . \mb_strtoupper($perm)), 'item' => 'forum_' . $perm, 'desc' => '', 'anonymous' => true]; |
|
346 | + $op_options[$perm] = constant('_AM_SONGLIST_CAN_'.\mb_strtoupper($perm)); |
|
347 | + $fm_options[$perm] = ['title' => constant('_AM_SONGLIST_CAN_'.\mb_strtoupper($perm)), 'item' => 'forum_'.$perm, 'desc' => '', 'anonymous' => true]; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $op_keys = array_keys($op_options); |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | $op = $op_keys[0]; |
354 | 354 | setcookie('op', $op_keys[1] ?? ''); |
355 | 355 | } else { |
356 | - for ($i = 0, $iMax = count($op_keys); $i < $iMax; ++$i) { |
|
357 | - if ($op_keys[$i] == $op) { |
|
356 | + for ($i = 0, $iMax = count($op_keys); $i<$iMax; ++$i) { |
|
357 | + if ($op_keys[$i]==$op) { |
|
358 | 358 | break; |
359 | 359 | } |
360 | 360 | } |
361 | - setcookie('op', $op_keys[$i + 1] ?? ''); |
|
361 | + setcookie('op', $op_keys[$i+1] ?? ''); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | $opform = new \XoopsSimpleForm('', 'opform', 'permissions.php', 'get'); |
@@ -374,22 +374,22 @@ discard block |
||
374 | 374 | |
375 | 375 | $categoryHandler = Helper::getInstance()->getHandler('Category'); |
376 | 376 | $categories = $categoryHandler->getObjects(null, true); |
377 | - if ('category' === $op) { |
|
377 | + if ('category'===$op) { |
|
378 | 378 | foreach (array_keys($categories) as $c) { |
379 | 379 | $form->addItem($c, $categories[$c]->getVar('cat_title')); |
380 | 380 | } |
381 | 381 | unset($categories); |
382 | 382 | } else { |
383 | 383 | foreach (array_keys($categories) as $c) { |
384 | - $key_c = -1 * $c; |
|
385 | - $form->addItem($key_c, '<strong>[' . $categories[$c]->getVar('cat_title') . ']</strong>'); |
|
384 | + $key_c = -1*$c; |
|
385 | + $form->addItem($key_c, '<strong>['.$categories[$c]->getVar('cat_title').']</strong>'); |
|
386 | 386 | foreach (array_keys($songlists[$c]) as $f) { |
387 | 387 | $form->addItem($f, $songlists[$c][$f]['title'], $key_c); |
388 | 388 | if (!isset($songlists[$c][$f]['sub'])) { |
389 | 389 | continue; |
390 | 390 | } |
391 | 391 | foreach (array_keys($songlists[$c][$f]['sub']) as $s) { |
392 | - $form->addItem($s, '→' . $songlists[$c][$f]['sub'][$s]['title'], $f); |
|
392 | + $form->addItem($s, '→'.$songlists[$c][$f]['sub'][$s]['title'], $f); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | } |
@@ -177,8 +177,10 @@ |
||
177 | 177 | $option['name'], |
178 | 178 | ENT_QUOTES | ENT_HTML5 |
179 | 179 | ) . "\"><br>\n"; |
180 | - else : |
|
180 | + else { |
|
181 | + : |
|
181 | 182 | $tree .= $prefix . $option['name'] . '<input type="hidden" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\"><br>\n"; |
183 | + } |
|
182 | 184 | endif; |
183 | 185 | if (isset($option['children'])) { |
184 | 186 | foreach ($option['children'] as $child) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $pathIcon32 = Admin::menuIconPath(''); |
16 | 16 | $pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; |
17 | 17 | if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { |
18 | - $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); |
|
18 | + $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** @var \XoopsModuleHandler $moduleHandler */ |
@@ -26,65 +26,65 @@ discard block |
||
26 | 26 | $GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
27 | 27 | |
28 | 28 | $adminmenu[] = [ |
29 | - 'title' => _MI_SONGLIST_ADMENU_DASHBOARD, |
|
30 | - 'icon' => $pathIcon32 . '/home.png', |
|
31 | - 'image' => $pathIcon32 . '/home.png', |
|
32 | - 'link' => 'admin/index.php', |
|
29 | + 'title' => _MI_SONGLIST_ADMENU_DASHBOARD, |
|
30 | + 'icon' => $pathIcon32 . '/home.png', |
|
31 | + 'image' => $pathIcon32 . '/home.png', |
|
32 | + 'link' => 'admin/index.php', |
|
33 | 33 | ]; |
34 | 34 | |
35 | 35 | $adminmenu[] = [ |
36 | - 'title' => _MI_SONGLIST_ADMENU_CATEGORY, |
|
37 | - 'icon' => 'assets/images/icons/32/songlist.category.png', |
|
38 | - 'image' => 'assets/images/icons/32/songlist.category.png', |
|
39 | - 'link' => 'admin/category.php', |
|
36 | + 'title' => _MI_SONGLIST_ADMENU_CATEGORY, |
|
37 | + 'icon' => 'assets/images/icons/32/songlist.category.png', |
|
38 | + 'image' => 'assets/images/icons/32/songlist.category.png', |
|
39 | + 'link' => 'admin/category.php', |
|
40 | 40 | ]; |
41 | 41 | |
42 | 42 | if ($GLOBALS['songlistModuleConfig']['voice']) { |
43 | - $adminmenu[] = [ |
|
44 | - 'title' => _MI_SONGLIST_ADMENU_VOICE, |
|
45 | - 'icon' => 'assets/images/icons/32/songlist.voice.png', |
|
46 | - 'image' => 'assets/images/icons/32/songlist.voice.png', |
|
47 | - 'link' => 'admin/voice.php', |
|
48 | - ]; |
|
43 | + $adminmenu[] = [ |
|
44 | + 'title' => _MI_SONGLIST_ADMENU_VOICE, |
|
45 | + 'icon' => 'assets/images/icons/32/songlist.voice.png', |
|
46 | + 'image' => 'assets/images/icons/32/songlist.voice.png', |
|
47 | + 'link' => 'admin/voice.php', |
|
48 | + ]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($GLOBALS['songlistModuleConfig']['album']) { |
52 | - $adminmenu[] = [ |
|
53 | - 'title' => _MI_SONGLIST_ADMENU_ALBUMS, |
|
54 | - 'icon' => 'assets/images/icons/32/songlist.albums.png', |
|
55 | - 'image' => 'assets/images/icons/32/songlist.albums.png', |
|
56 | - 'link' => 'admin/albums.php', |
|
57 | - ]; |
|
52 | + $adminmenu[] = [ |
|
53 | + 'title' => _MI_SONGLIST_ADMENU_ALBUMS, |
|
54 | + 'icon' => 'assets/images/icons/32/songlist.albums.png', |
|
55 | + 'image' => 'assets/images/icons/32/songlist.albums.png', |
|
56 | + 'link' => 'admin/albums.php', |
|
57 | + ]; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($GLOBALS['songlistModuleConfig']['genre']) { |
61 | - $adminmenu[] = [ |
|
62 | - 'title' => _MI_SONGLIST_ADMENU_GENRE, |
|
63 | - 'icon' => 'assets/images/icons/32/songlist.genre.png', |
|
64 | - 'image' => 'assets/images/icons/32/songlist.genre.png', |
|
65 | - 'link' => 'admin/genre.php', |
|
66 | - ]; |
|
61 | + $adminmenu[] = [ |
|
62 | + 'title' => _MI_SONGLIST_ADMENU_GENRE, |
|
63 | + 'icon' => 'assets/images/icons/32/songlist.genre.png', |
|
64 | + 'image' => 'assets/images/icons/32/songlist.genre.png', |
|
65 | + 'link' => 'admin/genre.php', |
|
66 | + ]; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $adminmenu[] = [ |
70 | - 'title' => _MI_SONGLIST_ADMENU_ARTISTS, |
|
71 | - 'icon' => 'assets/images/icons/32/songlist.artists.png', |
|
72 | - 'image' => 'assets/images/icons/32/songlist.artists.png', |
|
73 | - 'link' => 'admin/artists.php', |
|
70 | + 'title' => _MI_SONGLIST_ADMENU_ARTISTS, |
|
71 | + 'icon' => 'assets/images/icons/32/songlist.artists.png', |
|
72 | + 'image' => 'assets/images/icons/32/songlist.artists.png', |
|
73 | + 'link' => 'admin/artists.php', |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | $adminmenu[] = [ |
77 | - 'title' => _MI_SONGLIST_ADMENU_SONGS, |
|
78 | - 'icon' => 'assets/images/icons/32/songlist.songs.png', |
|
79 | - 'image' => 'assets/images/icons/32/songlist.songs.png', |
|
80 | - 'link' => 'admin/songs.php', |
|
77 | + 'title' => _MI_SONGLIST_ADMENU_SONGS, |
|
78 | + 'icon' => 'assets/images/icons/32/songlist.songs.png', |
|
79 | + 'image' => 'assets/images/icons/32/songlist.songs.png', |
|
80 | + 'link' => 'admin/songs.php', |
|
81 | 81 | ]; |
82 | 82 | |
83 | 83 | $adminmenu[] = [ |
84 | - 'title' => _MI_SONGLIST_ADMENU_VOTE, |
|
85 | - 'icon' => 'assets/images/icons/32/songlist.votes.png', |
|
86 | - 'image' => 'assets/images/icons/32/songlist.votes.png', |
|
87 | - 'link' => 'admin/votes.php', |
|
84 | + 'title' => _MI_SONGLIST_ADMENU_VOTE, |
|
85 | + 'icon' => 'assets/images/icons/32/songlist.votes.png', |
|
86 | + 'image' => 'assets/images/icons/32/songlist.votes.png', |
|
87 | + 'link' => 'admin/votes.php', |
|
88 | 88 | ]; |
89 | 89 | |
90 | 90 | //$adminmenu[] = [ |
@@ -95,57 +95,57 @@ discard block |
||
95 | 95 | //]; |
96 | 96 | |
97 | 97 | $adminmenu[] = [ |
98 | - 'title' => _MI_SONGLIST_ADMENU_REQUESTS, |
|
99 | - 'icon' => 'assets/images/icons/32/songlist.requests.png', |
|
100 | - 'image' => 'assets/images/icons/32/songlist.requests.png', |
|
101 | - 'link' => 'admin/requests.php', |
|
98 | + 'title' => _MI_SONGLIST_ADMENU_REQUESTS, |
|
99 | + 'icon' => 'assets/images/icons/32/songlist.requests.png', |
|
100 | + 'image' => 'assets/images/icons/32/songlist.requests.png', |
|
101 | + 'link' => 'admin/requests.php', |
|
102 | 102 | ]; |
103 | 103 | |
104 | 104 | $adminmenu[] = [ |
105 | - 'title' => _MI_SONGLIST_ADMENU_UTF8MAP, |
|
106 | - 'icon' => 'assets/images/icons/32/songlist.utf8map.png', |
|
107 | - 'image' => 'assets/images/icons/32/songlist.utf8map.png', |
|
108 | - 'link' => 'admin/utf8map.php', |
|
105 | + 'title' => _MI_SONGLIST_ADMENU_UTF8MAP, |
|
106 | + 'icon' => 'assets/images/icons/32/songlist.utf8map.png', |
|
107 | + 'image' => 'assets/images/icons/32/songlist.utf8map.png', |
|
108 | + 'link' => 'admin/utf8map.php', |
|
109 | 109 | ]; |
110 | 110 | |
111 | 111 | $adminmenu[] = [ |
112 | - 'title' => _MI_SONGLIST_ADMENU_IMPORT, |
|
113 | - 'icon' => 'assets/images/icons/32/songlist.import.png', |
|
114 | - 'image' => 'assets/images/icons/32/songlist.import.png', |
|
115 | - 'link' => 'admin/import.php', |
|
112 | + 'title' => _MI_SONGLIST_ADMENU_IMPORT, |
|
113 | + 'icon' => 'assets/images/icons/32/songlist.import.png', |
|
114 | + 'image' => 'assets/images/icons/32/songlist.import.png', |
|
115 | + 'link' => 'admin/import.php', |
|
116 | 116 | ]; |
117 | 117 | |
118 | 118 | $adminmenu[] = [ |
119 | - 'title' => _MI_SONGLIST_ADMENU_FIELDS, |
|
120 | - 'icon' => 'assets/images/icons/32/songlist.fields.png', |
|
121 | - 'image' => 'assets/images/icons/32/songlist.fields.png', |
|
122 | - 'link' => 'admin/field.php', |
|
119 | + 'title' => _MI_SONGLIST_ADMENU_FIELDS, |
|
120 | + 'icon' => 'assets/images/icons/32/songlist.fields.png', |
|
121 | + 'image' => 'assets/images/icons/32/songlist.fields.png', |
|
122 | + 'link' => 'admin/field.php', |
|
123 | 123 | ]; |
124 | 124 | |
125 | 125 | $adminmenu[] = [ |
126 | - 'title' => _MI_SONGLIST_ADMENU_FIELDSPERMS, |
|
127 | - 'icon' => 'assets/images/icons/32/songlist.field.permissions.png', |
|
128 | - 'image' => 'assets/images/icons/32/songlist.field.permissions.png', |
|
129 | - 'link' => 'admin/field_permissions.php', |
|
126 | + 'title' => _MI_SONGLIST_ADMENU_FIELDSPERMS, |
|
127 | + 'icon' => 'assets/images/icons/32/songlist.field.permissions.png', |
|
128 | + 'image' => 'assets/images/icons/32/songlist.field.permissions.png', |
|
129 | + 'link' => 'admin/field_permissions.php', |
|
130 | 130 | ]; |
131 | 131 | |
132 | 132 | // Blocks Admin |
133 | 133 | $adminmenu[] = [ |
134 | - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'), |
|
135 | - 'link' => 'admin/blocksadmin.php', |
|
136 | - 'icon' => $pathIcon32 . '/block.png', |
|
134 | + 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'), |
|
135 | + 'link' => 'admin/blocksadmin.php', |
|
136 | + 'icon' => $pathIcon32 . '/block.png', |
|
137 | 137 | ]; |
138 | 138 | |
139 | 139 | //Clone |
140 | 140 | $adminmenu[] = [ |
141 | - 'title' => _CLONE, |
|
142 | - 'link' => 'admin/clone.php', |
|
143 | - 'icon' => $pathIcon32 . '/page_copy.png', |
|
141 | + 'title' => _CLONE, |
|
142 | + 'link' => 'admin/clone.php', |
|
143 | + 'icon' => $pathIcon32 . '/page_copy.png', |
|
144 | 144 | ]; |
145 | 145 | |
146 | 146 | $adminmenu[] = [ |
147 | - 'title' => _MI_SONGLIST_ADMENU_ABOUT, |
|
148 | - 'icon' => $pathIcon32 . '/about.png', |
|
149 | - 'image' => $pathIcon32 . '/about.png', |
|
150 | - 'link' => 'admin/about.php', |
|
147 | + 'title' => _MI_SONGLIST_ADMENU_ABOUT, |
|
148 | + 'icon' => $pathIcon32 . '/about.png', |
|
149 | + 'image' => $pathIcon32 . '/about.png', |
|
150 | + 'link' => 'admin/about.php', |
|
151 | 151 | ]; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use XoopsModules\Songlist\Helper; |
5 | 5 | |
6 | -require \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
6 | +require \dirname(__DIR__).'/preloads/autoloader.php'; |
|
7 | 7 | |
8 | 8 | $moduleDirName = \basename(\dirname(__DIR__)); |
9 | 9 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | $helper->loadLanguage('feedback'); |
14 | 14 | |
15 | 15 | $pathIcon32 = Admin::menuIconPath(''); |
16 | -$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; |
|
17 | -if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { |
|
16 | +$pathModIcon32 = XOOPS_URL.'/modules/'.$moduleDirName.'/assets/images/icons/32/'; |
|
17 | +if (is_object($helper->getModule()) && false!==$helper->getModule()->getInfo('modicons32')) { |
|
18 | 18 | $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); |
19 | 19 | } |
20 | 20 | |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | $adminmenu[] = [ |
29 | 29 | 'title' => _MI_SONGLIST_ADMENU_DASHBOARD, |
30 | - 'icon' => $pathIcon32 . '/home.png', |
|
31 | - 'image' => $pathIcon32 . '/home.png', |
|
30 | + 'icon' => $pathIcon32.'/home.png', |
|
31 | + 'image' => $pathIcon32.'/home.png', |
|
32 | 32 | 'link' => 'admin/index.php', |
33 | 33 | ]; |
34 | 34 | |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | |
132 | 132 | // Blocks Admin |
133 | 133 | $adminmenu[] = [ |
134 | - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'), |
|
134 | + 'title' => constant('CO_'.$moduleDirNameUpper.'_'.'BLOCKS'), |
|
135 | 135 | 'link' => 'admin/blocksadmin.php', |
136 | - 'icon' => $pathIcon32 . '/block.png', |
|
136 | + 'icon' => $pathIcon32.'/block.png', |
|
137 | 137 | ]; |
138 | 138 | |
139 | 139 | //Clone |
140 | 140 | $adminmenu[] = [ |
141 | 141 | 'title' => _CLONE, |
142 | 142 | 'link' => 'admin/clone.php', |
143 | - 'icon' => $pathIcon32 . '/page_copy.png', |
|
143 | + 'icon' => $pathIcon32.'/page_copy.png', |
|
144 | 144 | ]; |
145 | 145 | |
146 | 146 | $adminmenu[] = [ |
147 | 147 | 'title' => _MI_SONGLIST_ADMENU_ABOUT, |
148 | - 'icon' => $pathIcon32 . '/about.png', |
|
149 | - 'image' => $pathIcon32 . '/about.png', |
|
148 | + 'icon' => $pathIcon32.'/about.png', |
|
149 | + 'image' => $pathIcon32.'/about.png', |
|
150 | 150 | 'link' => 'admin/about.php', |
151 | 151 | ]; |
@@ -19,11 +19,11 @@ |
||
19 | 19 | use Xmf\Module\Admin; |
20 | 20 | use XoopsModules\Songlist\Helper; |
21 | 21 | |
22 | -require \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
22 | +require \dirname(__DIR__).'/preloads/autoloader.php'; |
|
23 | 23 | |
24 | -require \dirname(__DIR__, 3) . '/include/cp_header.php'; |
|
24 | +require \dirname(__DIR__, 3).'/include/cp_header.php'; |
|
25 | 25 | //require $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); |
26 | -require \dirname(__DIR__) . '/include/common.php'; |
|
26 | +require \dirname(__DIR__).'/include/common.php'; |
|
27 | 27 | |
28 | 28 | $moduleDirName = \basename(\dirname(__DIR__)); |
29 | 29 |
@@ -16,6 +16,6 @@ |
||
16 | 16 | */ |
17 | 17 | $pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); |
18 | 18 | |
19 | -echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; |
|
19 | +echo "<div class='adminfooter'>\n"." <div style='text-align: center;'>\n"." <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"." </div>\n".' '._AM_MODULEADMIN_ADMIN_FOOTER."\n".'</div>'; |
|
20 | 20 | |
21 | 21 | xoops_cp_footer(); |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | require \dirname(__DIR__, 3) . '/include/cp_header.php'; |
24 | 24 | |
25 | 25 | if (!defined('_CHARSET')) { |
26 | - define('_CHARSET', 'UTF-8'); |
|
26 | + define('_CHARSET', 'UTF-8'); |
|
27 | 27 | } |
28 | 28 | if (!defined('_CHARSET_ISO')) { |
29 | - define('_CHARSET_ISO', 'ISO-8859-1'); |
|
29 | + define('_CHARSET_ISO', 'ISO-8859-1'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $GLOBALS['songlistAdmin'] = true; |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | $GLOBALS['songlistImageAdmin'] = Admin::iconUrl('', '32'); |
60 | 60 | |
61 | 61 | if ($GLOBALS['xoopsUser']) { |
62 | - /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
63 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
64 | - if (!$grouppermHandler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
65 | - redirect_header(XOOPS_URL, 1, _NOPERM); |
|
66 | - } |
|
62 | + /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
63 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
64 | + if (!$grouppermHandler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
65 | + redirect_header(XOOPS_URL, 1, _NOPERM); |
|
66 | + } |
|
67 | 67 | } else { |
68 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
68 | + redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | xoops_loadLanguage('user'); |
72 | 72 | |
73 | 73 | if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { |
74 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
75 | - $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
74 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
75 | + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $GLOBALS['xoopsTpl']->assign('pathImageIcon', $GLOBALS['songlistImageIcon']); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | use Xmf\Module\Admin; |
19 | 19 | use XoopsModules\Songlist\Helper; |
20 | 20 | |
21 | -require \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
21 | +require \dirname(__DIR__).'/preloads/autoloader.php'; |
|
22 | 22 | |
23 | -require \dirname(__DIR__, 3) . '/include/cp_header.php'; |
|
23 | +require \dirname(__DIR__, 3).'/include/cp_header.php'; |
|
24 | 24 | |
25 | 25 | if (!defined('_CHARSET')) { |
26 | 26 | define('_CHARSET', 'UTF-8'); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | redirect_header(XOOPS_URL, 1, _NOPERM); |
66 | 66 | } |
67 | 67 | } else { |
68 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
68 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | xoops_loadLanguage('user'); |
72 | 72 | |
73 | 73 | if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { |
74 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
74 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
75 | 75 | $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
76 | 76 | } |
77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['xoopsTpl']->assign('pathImageAdmin', $GLOBALS['songlistImageAdmin']); |
80 | 80 | |
81 | 81 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/functions.php'; |
82 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/songlist.object.php'; |
|
82 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['songlistModule']->getVar('dirname').'/include/songlist.object.php'; |
|
83 | 83 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/songlist.form.php'; |
84 | 84 | |
85 | 85 | xoops_loadLanguage('admin', 'songlist'); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $aboutAdmin = Admin::getInstance(); |
30 | 30 | $about = $aboutAdmin->displayAbout($paypalitemno, false); |
31 | 31 | $donationform = [ |
32 | - 0 => '<form name="donation" id="donation" action="https://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
33 | - 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
|
34 | - . constant('_AM_SONGLIST_ABOUT_MAKEDONATE') |
|
35 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
36 | - . _SUBMIT |
|
37 | - . '" title="' |
|
38 | - . _SUBMIT |
|
39 | - . '" type="submit"></td></tr></tbody></table>', |
|
40 | - 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', |
|
41 | - 'D' => '', |
|
42 | - 3 => '', |
|
43 | - 4 => '<!-- Start Form Validation JavaScript //--> |
|
32 | + 0 => '<form name="donation" id="donation" action="https://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
33 | + 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
|
34 | + . constant('_AM_SONGLIST_ABOUT_MAKEDONATE') |
|
35 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
36 | + . _SUBMIT |
|
37 | + . '" title="' |
|
38 | + . _SUBMIT |
|
39 | + . '" type="submit"></td></tr></tbody></table>', |
|
40 | + 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', |
|
41 | + 'D' => '', |
|
42 | + 3 => '', |
|
43 | + 4 => '<!-- Start Form Validation JavaScript //--> |
|
44 | 44 | <script type="text/javascript"> |
45 | 45 | <!--// |
46 | 46 | function xoopsFormValidate_donation() { var myform = window.document.donation; |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | <!-- End Form Validation JavaScript //-->', |
51 | 51 | ]; |
52 | 52 | $paypalform = [ |
53 | - 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
54 | - 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
|
55 | - 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
|
56 | - 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', |
|
57 | - 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
|
58 | - 5 => '</form>', |
|
53 | + 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
54 | + 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
|
55 | + 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
|
56 | + 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', |
|
57 | + 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
|
58 | + 5 => '</form>', |
|
59 | 59 | ]; |
60 | 60 | for ($key = 0; $key <= 4; ++$key) { |
61 | - switch ($key) { |
|
62 | - case 2: |
|
63 | - $donationform[$key] = sprintf( |
|
64 | - $donationform[$key], |
|
65 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | - $GLOBALS['xoopsUser']->getVar('email'), |
|
67 | - XOOPS_LICENSE_KEY, |
|
68 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
|
69 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
70 | - ); |
|
71 | - break; |
|
72 | - } |
|
61 | + switch ($key) { |
|
62 | + case 2: |
|
63 | + $donationform[$key] = sprintf( |
|
64 | + $donationform[$key], |
|
65 | + $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | + $GLOBALS['xoopsUser']->getVar('email'), |
|
67 | + XOOPS_LICENSE_KEY, |
|
68 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
|
69 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
70 | + ); |
|
71 | + break; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $istart = mb_strpos($about, $paypalform[0], 1); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | use Xmf\Module\Admin; |
19 | 19 | |
20 | -require __DIR__ . '/header.php'; |
|
20 | +require __DIR__.'/header.php'; |
|
21 | 21 | xoops_loadLanguage('admin', 'songlist'); |
22 | 22 | |
23 | 23 | xoops_cp_header(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | //--></script> |
50 | 50 | <!-- End Form Validation JavaScript //-->', |
51 | 51 | ]; |
52 | -$paypalform = [ |
|
52 | +$paypalform = [ |
|
53 | 53 | 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
54 | 54 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
55 | 55 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
58 | 58 | 5 => '</form>', |
59 | 59 | ]; |
60 | -for ($key = 0; $key <= 4; ++$key) { |
|
60 | +for ($key = 0; $key<=4; ++$key) { |
|
61 | 61 | switch ($key) { |
62 | 62 | case 2: |
63 | 63 | $donationform[$key] = sprintf( |
64 | 64 | $donationform[$key], |
65 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
65 | + $GLOBALS['xoopsConfig']['sitename'].' - '.(mb_strlen($GLOBALS['xoopsUser']->getVar('name'))>0 ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | 66 | $GLOBALS['xoopsUser']->getVar('email'), |
67 | 67 | XOOPS_LICENSE_KEY, |
68 | 68 | \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
69 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
69 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')).' '.$GLOBALS['songlistModule']->getVar('name') |
|
70 | 70 | ); |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | $istart = mb_strpos($about, $paypalform[0], 1); |
76 | -$iend = mb_strpos($about, $paypalform[5], $istart + 1) + mb_strlen($paypalform[5]) - 1; |
|
77 | -echo(mb_substr($about, 0, $istart - 1)); |
|
76 | +$iend = mb_strpos($about, $paypalform[5], $istart+1)+mb_strlen($paypalform[5])-1; |
|
77 | +echo(mb_substr($about, 0, $istart-1)); |
|
78 | 78 | echo implode("\n", $donationform); |
79 | -echo(mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1)); |
|
79 | +echo(mb_substr($about, $iend+1, mb_strlen($about)-$iend-1)); |
|
80 | 80 | |
81 | 81 | xoops_cp_footer(); |
@@ -34,57 +34,57 @@ |
||
34 | 34 | //check for upload folders, create if needed |
35 | 35 | $configurator = new Configurator(); |
36 | 36 | foreach (array_keys($configurator->uploadFolders) as $i) { |
37 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
38 | - $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
37 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
38 | + $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : 'default')); |
42 | 42 | |
43 | 43 | switch ($op) { |
44 | - case 'default': |
|
45 | - default: |
|
46 | - $adminObject = Admin::getInstance(); |
|
47 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
44 | + case 'default': |
|
45 | + default: |
|
46 | + $adminObject = Admin::getInstance(); |
|
47 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
48 | 48 | |
49 | - $adminObject = Admin::getInstance(); |
|
49 | + $adminObject = Admin::getInstance(); |
|
50 | 50 | |
51 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
52 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
53 | - $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
54 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
55 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
56 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
57 | - $requestsHandler = Helper::getInstance()->getHandler('Requests'); |
|
58 | - $votesHandler = Helper::getInstance()->getHandler('Votes'); |
|
51 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
52 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
53 | + $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
54 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
55 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
56 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
57 | + $requestsHandler = Helper::getInstance()->getHandler('Requests'); |
|
58 | + $votesHandler = Helper::getInstance()->getHandler('Votes'); |
|
59 | 59 | |
60 | - $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
|
61 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
60 | + $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
|
61 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
69 | 69 | |
70 | - //------------- Test Data Buttons ---------------------------- |
|
71 | - if ($helper->getConfig('displaySampleButton')) { |
|
72 | - TestdataButtons::loadButtonConfig($adminObject); |
|
73 | - $adminObject->displayButton('left', ''); |
|
74 | - } |
|
75 | - $op = Request::getString('op', 0, 'GET'); |
|
76 | - switch ($op) { |
|
77 | - case 'hide_buttons': |
|
78 | - TestdataButtons::hideButtons(); |
|
79 | - break; |
|
80 | - case 'show_buttons': |
|
81 | - TestdataButtons::showButtons(); |
|
82 | - break; |
|
83 | - } |
|
84 | - //------------- End Test Data Buttons ---------------------------- |
|
70 | + //------------- Test Data Buttons ---------------------------- |
|
71 | + if ($helper->getConfig('displaySampleButton')) { |
|
72 | + TestdataButtons::loadButtonConfig($adminObject); |
|
73 | + $adminObject->displayButton('left', ''); |
|
74 | + } |
|
75 | + $op = Request::getString('op', 0, 'GET'); |
|
76 | + switch ($op) { |
|
77 | + case 'hide_buttons': |
|
78 | + TestdataButtons::hideButtons(); |
|
79 | + break; |
|
80 | + case 'show_buttons': |
|
81 | + TestdataButtons::showButtons(); |
|
82 | + break; |
|
83 | + } |
|
84 | + //------------- End Test Data Buttons ---------------------------- |
|
85 | 85 | |
86 | - $adminObject->displayIndex(); |
|
86 | + $adminObject->displayIndex(); |
|
87 | 87 | |
88 | - xoops_cp_footer(); |
|
89 | - break; |
|
88 | + xoops_cp_footer(); |
|
89 | + break; |
|
90 | 90 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** @var Helper $helper */ |
27 | 27 | /** @var Utility $utility */ |
28 | 28 | |
29 | -require __DIR__ . '/header.php'; |
|
29 | +require __DIR__.'/header.php'; |
|
30 | 30 | xoops_loadLanguage('admin', 'songlist'); |
31 | 31 | |
32 | 32 | xoops_cp_header(); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | $votesHandler = Helper::getInstance()->getHandler('Votes'); |
59 | 59 | |
60 | 60 | $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
61 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
61 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_CATEGORY.'</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_ARTISTS.'</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_ALBUMS.'</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_GENRE.'</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_VOICE.'</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_SONGS.'</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_REQUESTS.'</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_VOTES.'</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
69 | 69 | |
70 | 70 | //------------- Test Data Buttons ---------------------------- |
71 | 71 | if ($helper->getConfig('displaySampleButton')) { |