@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | //define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash |
51 | 51 | |
52 | 52 | if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { |
53 | - define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
|
54 | - define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
|
55 | - define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
|
56 | - define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); |
|
57 | - define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
|
58 | - define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
|
59 | - define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
|
60 | - define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
|
61 | - define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
|
62 | - define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
|
63 | - define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
64 | - define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
65 | - define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
|
53 | + define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); |
|
54 | + define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
|
55 | + define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); |
|
56 | + define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); |
|
57 | + define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); |
|
58 | + define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); |
|
59 | + define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); |
|
60 | + define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); |
|
61 | + define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); |
|
62 | + define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); |
|
63 | + define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
64 | + define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
65 | + define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | //$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
134 | 134 | |
135 | 135 | $icons = [ |
136 | - 'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
|
137 | - 'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
|
138 | - 'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
|
139 | - 'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
|
140 | - 'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
|
141 | - 'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
|
142 | - 'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
|
143 | - '0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
|
144 | - '1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
|
136 | + 'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>", |
|
137 | + 'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>", |
|
138 | + 'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>", |
|
139 | + 'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>", |
|
140 | + 'print' => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>", |
|
141 | + 'pdf' => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>", |
|
142 | + 'add' => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>", |
|
143 | + '0' => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>", |
|
144 | + '1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>", |
|
145 | 145 | ]; |
146 | 146 | |
147 | 147 | $debug = false; |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | $myts = \MyTextSanitizer::getInstance(); |
151 | 151 | |
152 | 152 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
153 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
154 | - $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
153 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
154 | + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | $GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
158 | 158 | // Local icons path |
159 | 159 | if (is_object($helper->getModule())) { |
160 | - $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
|
161 | - $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
|
160 | + $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
|
161 | + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
|
162 | 162 | |
163 | - $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
164 | - $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
|
163 | + $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
164 | + $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
|
165 | 165 | } |
@@ -72,9 +72,9 @@ |
||
72 | 72 | // MENU handler |
73 | 73 | /* You could remove anyone by commenting out in order to disable it */ |
74 | 74 | $valid_menumodes = [ |
75 | - 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
76 | - 1 => _MD_NEWBB_MENU_CLICK, // for 'click to expand' |
|
77 | - 2 => _MD_NEWBB_MENU_HOVER // for 'mouse hover to expand' |
|
75 | + 0 => _MD_NEWBB_MENU_SELECT, // for selectbox |
|
76 | + 1 => _MD_NEWBB_MENU_CLICK, // for 'click to expand' |
|
77 | + 2 => _MD_NEWBB_MENU_HOVER // for 'mouse hover to expand' |
|
78 | 78 | ]; |
79 | 79 | |
80 | 80 | return $customConfig; |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function xoops_module_pre_install_newbb(\XoopsModule $module) |
32 | 32 | { |
33 | - require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
|
34 | - /** @var Newbb\Utility $utility */ |
|
35 | - $utility = new \XoopsModules\Newbb\Utility(); |
|
36 | - $xoopsSuccess = $utility::checkVerXoops($module); |
|
37 | - $phpSuccess = $utility::checkVerPhp($module); |
|
33 | + require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
|
34 | + /** @var Newbb\Utility $utility */ |
|
35 | + $utility = new \XoopsModules\Newbb\Utility(); |
|
36 | + $xoopsSuccess = $utility::checkVerXoops($module); |
|
37 | + $phpSuccess = $utility::checkVerPhp($module); |
|
38 | 38 | |
39 | - if (false !== $xoopsSuccess && false !== $phpSuccess) { |
|
40 | - $moduleTables =& $module->getInfo('tables'); |
|
41 | - foreach ($moduleTables as $table) { |
|
42 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
|
43 | - } |
|
44 | - } |
|
39 | + if (false !== $xoopsSuccess && false !== $phpSuccess) { |
|
40 | + $moduleTables =& $module->getInfo('tables'); |
|
41 | + foreach ($moduleTables as $table) { |
|
42 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
|
43 | + } |
|
44 | + } |
|
45 | 45 | |
46 | - return $xoopsSuccess && $phpSuccess; |
|
46 | + return $xoopsSuccess && $phpSuccess; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -55,50 +55,50 @@ discard block |
||
55 | 55 | */ |
56 | 56 | function xoops_module_install_newbb(\XoopsModule $module) |
57 | 57 | { |
58 | - require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; |
|
59 | - require_once dirname(__DIR__) . '/include/config.php'; |
|
58 | + require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; |
|
59 | + require_once dirname(__DIR__) . '/include/config.php'; |
|
60 | 60 | |
61 | - $moduleDirName = basename(dirname(__DIR__)); |
|
61 | + $moduleDirName = basename(dirname(__DIR__)); |
|
62 | 62 | |
63 | - /** @var Newbb\Helper $helper */ |
|
64 | - $helper = Newbb\Helper::getInstance(); |
|
65 | - $utility = new Newbb\Utility(); |
|
66 | - $configurator = new Newbb\Common\Configurator(); |
|
67 | - // Load language files |
|
68 | - $helper->loadLanguage('admin'); |
|
69 | - $helper->loadLanguage('modinfo'); |
|
63 | + /** @var Newbb\Helper $helper */ |
|
64 | + $helper = Newbb\Helper::getInstance(); |
|
65 | + $utility = new Newbb\Utility(); |
|
66 | + $configurator = new Newbb\Common\Configurator(); |
|
67 | + // Load language files |
|
68 | + $helper->loadLanguage('admin'); |
|
69 | + $helper->loadLanguage('modinfo'); |
|
70 | 70 | |
71 | - // default Permission Settings ---------------------- |
|
72 | - global $xoopsModule, $xoopsDB; |
|
73 | - $moduleId = $xoopsModule->getVar('mid'); |
|
74 | - $moduleId2 = $helper->getModule()->mid(); |
|
75 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
76 | - // access rights ------------------------------------------ |
|
77 | - $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
78 | - $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
79 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
80 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
|
81 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
|
71 | + // default Permission Settings ---------------------- |
|
72 | + global $xoopsModule, $xoopsDB; |
|
73 | + $moduleId = $xoopsModule->getVar('mid'); |
|
74 | + $moduleId2 = $helper->getModule()->mid(); |
|
75 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
76 | + // access rights ------------------------------------------ |
|
77 | + $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
78 | + $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
79 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
80 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
|
81 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
|
82 | 82 | |
83 | - // --- CREATE FOLDERS --------------- |
|
84 | - if (count($configurator->uploadFolders) > 0) { |
|
85 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
86 | - foreach (array_keys($configurator->uploadFolders) as $i) { |
|
87 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
88 | - } |
|
89 | - } |
|
83 | + // --- CREATE FOLDERS --------------- |
|
84 | + if (count($configurator->uploadFolders) > 0) { |
|
85 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
86 | + foreach (array_keys($configurator->uploadFolders) as $i) { |
|
87 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - // --- COPY blank.png FILES --------------- |
|
92 | - if (count($configurator->copyBlankFiles) > 0) { |
|
93 | - $file = dirname(__DIR__) . '/assets/images/blank.png'; |
|
94 | - foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
95 | - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
96 | - $utility::copyFile($file, $dest); |
|
97 | - } |
|
98 | - } |
|
99 | - //delete .html entries from the tpl table |
|
100 | - $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
|
101 | - $xoopsDB->queryF($sql); |
|
91 | + // --- COPY blank.png FILES --------------- |
|
92 | + if (count($configurator->copyBlankFiles) > 0) { |
|
93 | + $file = dirname(__DIR__) . '/assets/images/blank.png'; |
|
94 | + foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
95 | + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
96 | + $utility::copyFile($file, $dest); |
|
97 | + } |
|
98 | + } |
|
99 | + //delete .html entries from the tpl table |
|
100 | + $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
|
101 | + $xoopsDB->queryF($sql); |
|
102 | 102 | |
103 | - return true; |
|
103 | + return true; |
|
104 | 104 | } |
@@ -19,9 +19,9 @@ |
||
19 | 19 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
20 | 20 | |
21 | 21 | if (!is_object($forumObject)) { |
22 | - xoops_error('forum object IS null'); |
|
22 | + xoops_error('forum object IS null'); |
|
23 | 23 | |
24 | - return; |
|
24 | + return; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
@@ -15,106 +15,106 @@ |
||
15 | 15 | define('NEWBB_FUNCTIONS_TIME_LOADED', true); |
16 | 16 | |
17 | 17 | if (!defined('NEWBB_FUNCTIONS_TIME')) { |
18 | - define('NEWBB_FUNCTIONS_TIME', 1); |
|
18 | + define('NEWBB_FUNCTIONS_TIME', 1); |
|
19 | 19 | |
20 | - /** |
|
21 | - * Function to convert UNIX time to formatted time string |
|
22 | - * @param $time |
|
23 | - * @param string $format |
|
24 | - * @param string $timeoffset |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - function newbbFormatTimestamp($time, $format = 'c', $timeoffset = '') |
|
28 | - { |
|
29 | - xoops_loadLanguage('locale'); |
|
30 | - $newbbConfig = newbbLoadConfig(); |
|
20 | + /** |
|
21 | + * Function to convert UNIX time to formatted time string |
|
22 | + * @param $time |
|
23 | + * @param string $format |
|
24 | + * @param string $timeoffset |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + function newbbFormatTimestamp($time, $format = 'c', $timeoffset = '') |
|
28 | + { |
|
29 | + xoops_loadLanguage('locale'); |
|
30 | + $newbbConfig = newbbLoadConfig(); |
|
31 | 31 | |
32 | - $format = strtolower($format); |
|
33 | - if ('reg' === $format || '' === $format) { |
|
34 | - $format = 'c'; |
|
35 | - } |
|
36 | - if (('custom' === $format || 'c' === $format) && !empty($newbbConfig['formatTimestamp_custom'])) { |
|
37 | - $format = $newbbConfig['formatTimestamp_custom']; |
|
38 | - } |
|
32 | + $format = strtolower($format); |
|
33 | + if ('reg' === $format || '' === $format) { |
|
34 | + $format = 'c'; |
|
35 | + } |
|
36 | + if (('custom' === $format || 'c' === $format) && !empty($newbbConfig['formatTimestamp_custom'])) { |
|
37 | + $format = $newbbConfig['formatTimestamp_custom']; |
|
38 | + } |
|
39 | 39 | |
40 | - return XoopsLocal::formatTimestamp($time, $format, $timeoffset); |
|
41 | - } |
|
40 | + return XoopsLocal::formatTimestamp($time, $format, $timeoffset); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param int $selected |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - function newbbSinceSelectBox($selected = 100) |
|
48 | - { |
|
49 | - $newbbConfig = newbbLoadConfig(); |
|
50 | - // irmtfan - new method to get user inputs |
|
51 | - preg_match_all('/-?\d+/', $newbbConfig['since_options'], $match); |
|
52 | - $select_array = array_unique($match[0]); |
|
53 | - //$select_array = explode(',', $newbbConfig['since_options']); |
|
54 | - //$select_array = array_map('trim', $select_array); |
|
55 | - // irmtfan - if the array is empty do not show selection box |
|
56 | - if (!(bool)$select_array) { |
|
57 | - $since = $newbbConfig['since_default']; |
|
58 | - switch ($since) { |
|
59 | - case 0: |
|
60 | - $forum_since = _MD_NEWBB_BEGINNING; |
|
61 | - break; |
|
62 | - case 365: |
|
63 | - $forum_since = _MD_NEWBB_THELASTYEAR; |
|
64 | - break; |
|
65 | - default: |
|
66 | - if ($since > 0) { |
|
67 | - $forum_since = sprintf(_MD_NEWBB_FROMLASTDAYS, $since); |
|
68 | - } else { |
|
69 | - $forum_since = sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since)); |
|
70 | - } |
|
71 | - } |
|
43 | + /** |
|
44 | + * @param int $selected |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + function newbbSinceSelectBox($selected = 100) |
|
48 | + { |
|
49 | + $newbbConfig = newbbLoadConfig(); |
|
50 | + // irmtfan - new method to get user inputs |
|
51 | + preg_match_all('/-?\d+/', $newbbConfig['since_options'], $match); |
|
52 | + $select_array = array_unique($match[0]); |
|
53 | + //$select_array = explode(',', $newbbConfig['since_options']); |
|
54 | + //$select_array = array_map('trim', $select_array); |
|
55 | + // irmtfan - if the array is empty do not show selection box |
|
56 | + if (!(bool)$select_array) { |
|
57 | + $since = $newbbConfig['since_default']; |
|
58 | + switch ($since) { |
|
59 | + case 0: |
|
60 | + $forum_since = _MD_NEWBB_BEGINNING; |
|
61 | + break; |
|
62 | + case 365: |
|
63 | + $forum_since = _MD_NEWBB_THELASTYEAR; |
|
64 | + break; |
|
65 | + default: |
|
66 | + if ($since > 0) { |
|
67 | + $forum_since = sprintf(_MD_NEWBB_FROMLASTDAYS, $since); |
|
68 | + } else { |
|
69 | + $forum_since = sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since)); |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - return $forum_since; |
|
74 | - } |
|
75 | - $forum_selection_since = '<select class="form-control" name="since" id="since">'; |
|
76 | - // irmtfan no option when no selected value |
|
77 | - $forum_selection_since .= '<option value="">--------</option>'; |
|
78 | - foreach ($select_array as $since) { |
|
79 | - $forum_selection_since .= '<option value="' . $since . '"' . (($selected == $since) ? ' selected="selected"' : '') . '>'; |
|
80 | - // START irmtfan functional since 0 and 365 |
|
81 | - switch ($since) { |
|
82 | - case 0: |
|
83 | - $forum_selection_since .= _MD_NEWBB_BEGINNING; |
|
84 | - break; |
|
85 | - case 365: |
|
86 | - $forum_selection_since .= _MD_NEWBB_THELASTYEAR; |
|
87 | - break; |
|
88 | - default: |
|
89 | - if ($since > 0) { |
|
90 | - $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTDAYS, $since); |
|
91 | - } else { |
|
92 | - $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since)); |
|
93 | - } |
|
94 | - } |
|
95 | - // END irmtfan functional since 0 and 365 |
|
96 | - $forum_selection_since .= '</option>'; |
|
97 | - } |
|
98 | - // irmtfan remove hardcodes |
|
99 | - //$forum_selection_since .= '<option value="365"'.(($selected === 365) ? ' selected="selected"' : '').'>'._MD_NEWBB_THELASTYEAR.'</option>'; |
|
100 | - //$forum_selection_since .= '<option value="0"'.(($selected === 0) ? ' selected="selected"' : '').'>'._MD_NEWBB_BEGINNING.'</option>'; |
|
101 | - $forum_selection_since .= '</select>'; |
|
73 | + return $forum_since; |
|
74 | + } |
|
75 | + $forum_selection_since = '<select class="form-control" name="since" id="since">'; |
|
76 | + // irmtfan no option when no selected value |
|
77 | + $forum_selection_since .= '<option value="">--------</option>'; |
|
78 | + foreach ($select_array as $since) { |
|
79 | + $forum_selection_since .= '<option value="' . $since . '"' . (($selected == $since) ? ' selected="selected"' : '') . '>'; |
|
80 | + // START irmtfan functional since 0 and 365 |
|
81 | + switch ($since) { |
|
82 | + case 0: |
|
83 | + $forum_selection_since .= _MD_NEWBB_BEGINNING; |
|
84 | + break; |
|
85 | + case 365: |
|
86 | + $forum_selection_since .= _MD_NEWBB_THELASTYEAR; |
|
87 | + break; |
|
88 | + default: |
|
89 | + if ($since > 0) { |
|
90 | + $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTDAYS, $since); |
|
91 | + } else { |
|
92 | + $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since)); |
|
93 | + } |
|
94 | + } |
|
95 | + // END irmtfan functional since 0 and 365 |
|
96 | + $forum_selection_since .= '</option>'; |
|
97 | + } |
|
98 | + // irmtfan remove hardcodes |
|
99 | + //$forum_selection_since .= '<option value="365"'.(($selected === 365) ? ' selected="selected"' : '').'>'._MD_NEWBB_THELASTYEAR.'</option>'; |
|
100 | + //$forum_selection_since .= '<option value="0"'.(($selected === 0) ? ' selected="selected"' : '').'>'._MD_NEWBB_BEGINNING.'</option>'; |
|
101 | + $forum_selection_since .= '</select>'; |
|
102 | 102 | |
103 | - return $forum_selection_since; |
|
104 | - } |
|
103 | + return $forum_selection_since; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * @param int $since |
|
108 | - * @return int |
|
109 | - */ |
|
110 | - function newbbGetSinceTime($since = 100) |
|
111 | - { |
|
112 | - // irmtfan bad coding |
|
113 | - //if ($since==1000) return 0; |
|
114 | - if ($since > 0) { |
|
115 | - return (int)$since * 24 * 3600; |
|
116 | - } else { |
|
117 | - return (int)abs($since) * 3600; |
|
118 | - } |
|
119 | - } |
|
106 | + /** |
|
107 | + * @param int $since |
|
108 | + * @return int |
|
109 | + */ |
|
110 | + function newbbGetSinceTime($since = 100) |
|
111 | + { |
|
112 | + // irmtfan bad coding |
|
113 | + //if ($since==1000) return 0; |
|
114 | + if ($since > 0) { |
|
115 | + return (int)$since * 24 * 3600; |
|
116 | + } else { |
|
117 | + return (int)abs($since) * 3600; |
|
118 | + } |
|
119 | + } |
|
120 | 120 | } |
@@ -30,69 +30,69 @@ discard block |
||
30 | 30 | |
31 | 31 | //check banning |
32 | 32 | $moderated_id = (is_object($GLOBALS['xoopsUser']) |
33 | - && $GLOBALS['xoopsUser']->uid() > 0) ? $GLOBALS['xoopsUser']->uid() : 0; |
|
33 | + && $GLOBALS['xoopsUser']->uid() > 0) ? $GLOBALS['xoopsUser']->uid() : 0; |
|
34 | 34 | $moderated_ip = Request::getString('REMOTE_ADDR', '', 'SERVER'); |
35 | 35 | $moderated_forum = $forumObject->getVar('forum_id'); |
36 | 36 | /** @var Newbb\ModerateHandler $moderateHandler */ |
37 | 37 | $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); |
38 | 38 | if (!$moderateHandler->verifyUser($moderated_id, '', $moderated_forum)) { |
39 | - $criteria = new \CriteriaCompo(); |
|
40 | - $criteria->add(new \Criteria('uid', $moderated_id, '=')); |
|
41 | - $criteria->setSort('mod_end'); |
|
42 | - $criteria->setOrder('DESC'); |
|
43 | - $mod = $moderateHandler->getObjects($criteria, false, false); |
|
44 | - $tage = ($mod[0]['mod_end'] - $mod[0]['mod_start']) / 60 / 60 / 24; |
|
45 | - $msg = $myts->displayTarea(sprintf(_MD_NEWBB_SUSPEND_TEXT, newbbGetUnameFromId($moderated_id), (int)$tage, $mod[0]['mod_desc'], formatTimestamp($mod[0]['mod_end'])), 1); |
|
46 | - xoops_error($msg, _MD_NEWBB_SUSPEND_NOACCESS); |
|
47 | - require_once $GLOBALS['xoops']->path('footer.php'); |
|
48 | - exit(); |
|
39 | + $criteria = new \CriteriaCompo(); |
|
40 | + $criteria->add(new \Criteria('uid', $moderated_id, '=')); |
|
41 | + $criteria->setSort('mod_end'); |
|
42 | + $criteria->setOrder('DESC'); |
|
43 | + $mod = $moderateHandler->getObjects($criteria, false, false); |
|
44 | + $tage = ($mod[0]['mod_end'] - $mod[0]['mod_start']) / 60 / 60 / 24; |
|
45 | + $msg = $myts->displayTarea(sprintf(_MD_NEWBB_SUSPEND_TEXT, newbbGetUnameFromId($moderated_id), (int)$tage, $mod[0]['mod_desc'], formatTimestamp($mod[0]['mod_end'])), 1); |
|
46 | + xoops_error($msg, _MD_NEWBB_SUSPEND_NOACCESS); |
|
47 | + require_once $GLOBALS['xoops']->path('footer.php'); |
|
48 | + exit(); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $xoopsTpl->assign('category', ['id' => $forumObject->getVar('cat_id'), 'title' => $categoryObject->getVar('cat_title')]); |
52 | 52 | $xoopsTpl->assign('parentforum', $forumHandler->getParents($forumObject)); |
53 | 53 | $xoopsTpl->assign([ |
54 | - 'forum_id' => $forumObject->getVar('forum_id'), |
|
55 | - 'forum_name' => $forumObject->getVar('forum_name') |
|
56 | - ]); |
|
54 | + 'forum_id' => $forumObject->getVar('forum_id'), |
|
55 | + 'forum_name' => $forumObject->getVar('forum_name') |
|
56 | + ]); |
|
57 | 57 | |
58 | 58 | if (!is_object($topicObject)) { |
59 | - $topicObject = $topicHandler->create(); |
|
59 | + $topicObject = $topicHandler->create(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $editby = false; |
63 | 63 | if ($topicObject->isNew()) { |
64 | - $form_title = _MD_NEWBB_POSTNEW; |
|
64 | + $form_title = _MD_NEWBB_POSTNEW; |
|
65 | 65 | } elseif ($postObject->isNew()) { |
66 | - if (empty($postParentObject)) { |
|
67 | - $postParentObject = $postHandler->get($pid); |
|
68 | - } |
|
69 | - $form_title = _MD_NEWBB_REPLY . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}&post_id={$pid}\" rel=\"external\">" . $postParentObject->getVar('subject') . '</a>'; |
|
66 | + if (empty($postParentObject)) { |
|
67 | + $postParentObject = $postHandler->get($pid); |
|
68 | + } |
|
69 | + $form_title = _MD_NEWBB_REPLY . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}&post_id={$pid}\" rel=\"external\">" . $postParentObject->getVar('subject') . '</a>'; |
|
70 | 70 | } else { |
71 | - $form_title = _EDIT . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id={$post_id}\" rel=\"external\">" . $postObject->getVar('subject') . '</a>'; |
|
72 | - $editby = true; |
|
71 | + $form_title = _EDIT . ': <a href="' . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id={$post_id}\" rel=\"external\">" . $postObject->getVar('subject') . '</a>'; |
|
72 | + $editby = true; |
|
73 | 73 | } |
74 | 74 | $xoopsTpl->assign('form_title', $form_title); |
75 | 75 | |
76 | 76 | foreach ([ |
77 | - 'start', |
|
78 | - 'topic_id', |
|
79 | - 'post_id', |
|
80 | - 'pid', |
|
81 | - 'isreply', |
|
82 | - 'isedit', |
|
83 | - 'contents_preview' |
|
84 | - ] as $getint) { |
|
85 | - ${$getint} = Request::getInt($getint, (!empty(${$getint}) ? ${$getint} : 0), 'GET'); // isset($_GET[$getint]) ? (int)($_GET[$getint]) : ((!empty(${$getint})) ? ${$getint} : 0); |
|
77 | + 'start', |
|
78 | + 'topic_id', |
|
79 | + 'post_id', |
|
80 | + 'pid', |
|
81 | + 'isreply', |
|
82 | + 'isedit', |
|
83 | + 'contents_preview' |
|
84 | + ] as $getint) { |
|
85 | + ${$getint} = Request::getInt($getint, (!empty(${$getint}) ? ${$getint} : 0), 'GET'); // isset($_GET[$getint]) ? (int)($_GET[$getint]) : ((!empty(${$getint})) ? ${$getint} : 0); |
|
86 | 86 | } |
87 | 87 | foreach ([ |
88 | - 'order', |
|
89 | - 'viewmode', |
|
90 | - 'hidden', |
|
91 | - 'newbb_form', |
|
92 | - 'icon', |
|
93 | - 'op' |
|
94 | - ] as $getstr) { |
|
95 | - ${$getstr} = Request::getString($getstr, (!empty(${$getstr}) ? ${$getstr} : ''), 'GET'); //isset($_GET[$getstr]) ? $_GET[$getstr] : ((!empty(${$getstr})) ? ${$getstr} : ''); |
|
88 | + 'order', |
|
89 | + 'viewmode', |
|
90 | + 'hidden', |
|
91 | + 'newbb_form', |
|
92 | + 'icon', |
|
93 | + 'op' |
|
94 | + ] as $getstr) { |
|
95 | + ${$getstr} = Request::getString($getstr, (!empty(${$getstr}) ? ${$getstr} : ''), 'GET'); //isset($_GET[$getstr]) ? $_GET[$getstr] : ((!empty(${$getstr})) ? ${$getstr} : ''); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** @var Newbb\TopicHandler $topicHandler */ |
@@ -105,30 +105,30 @@ discard block |
||
105 | 105 | $forum_form->setExtra('enctype="multipart/form-data"'); |
106 | 106 | |
107 | 107 | if ($editby) { |
108 | - $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_EDITEDMSG, 'editwhy', 60, 100, '')); |
|
108 | + $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_EDITEDMSG, 'editwhy', 60, 100, '')); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
112 | 112 | if (newbbIsAdmin($forumObject) |
113 | - || ($topicHandler->getPermission($forumObject, $topic_status, 'type') |
|
114 | - && (0 == $topic_id |
|
115 | - || $uid == $topicHandler->get(@$topic_id, 'topic_poster')))) { |
|
116 | - $type_id = $topicHandler->get(@$topic_id, 'type_id'); |
|
117 | - /** @var Newbb\TypeHandler $typeHandler */ |
|
118 | - $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
119 | - $types = $typeHandler->getByForum($forumObject->getVar('forum_id')); |
|
120 | - if (!empty($types)) { |
|
121 | - $type_element = new \XoopsFormSelect(_MD_NEWBB_TYPE, 'type_id', $type_id); |
|
122 | - //$type_element = new \XoopsFormRadio(_MD_NEWBB_TYPE, 'type_id', $type_id); |
|
123 | - $type_element->addOption(0, _NONE); |
|
124 | - foreach ($types as $key => $type) { |
|
125 | - //$value = empty($type["type_color"]) ? $type["type_name"] : "<em style=\"font-style: normal; color: " . $type["type_color"] . ";\">" . $type["type_name"] . "</em>"; |
|
126 | - $type_element->addOption($key, $type['type_name']); |
|
127 | - } |
|
128 | - $forum_form->addElement($type_element); |
|
129 | - } else { |
|
130 | - $forum_form->addElement(new \XoopsFormHidden('type_id', 0)); |
|
131 | - } |
|
113 | + || ($topicHandler->getPermission($forumObject, $topic_status, 'type') |
|
114 | + && (0 == $topic_id |
|
115 | + || $uid == $topicHandler->get(@$topic_id, 'topic_poster')))) { |
|
116 | + $type_id = $topicHandler->get(@$topic_id, 'type_id'); |
|
117 | + /** @var Newbb\TypeHandler $typeHandler */ |
|
118 | + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
119 | + $types = $typeHandler->getByForum($forumObject->getVar('forum_id')); |
|
120 | + if (!empty($types)) { |
|
121 | + $type_element = new \XoopsFormSelect(_MD_NEWBB_TYPE, 'type_id', $type_id); |
|
122 | + //$type_element = new \XoopsFormRadio(_MD_NEWBB_TYPE, 'type_id', $type_id); |
|
123 | + $type_element->addOption(0, _NONE); |
|
124 | + foreach ($types as $key => $type) { |
|
125 | + //$value = empty($type["type_color"]) ? $type["type_name"] : "<em style=\"font-style: normal; color: " . $type["type_color"] . ";\">" . $type["type_name"] . "</em>"; |
|
126 | + $type_element->addOption($key, $type['type_name']); |
|
127 | + } |
|
128 | + $forum_form->addElement($type_element); |
|
129 | + } else { |
|
130 | + $forum_form->addElement(new \XoopsFormHidden('type_id', 0)); |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $subject_form = new \XoopsFormText(_MD_NEWBB_SUBJECTC, 'subject', 60, 100, $subject); |
@@ -136,32 +136,32 @@ discard block |
||
136 | 136 | $forum_form->addElement($subject_form, true); |
137 | 137 | |
138 | 138 | if (!is_object($GLOBALS['xoopsUser'])) { |
139 | - $required = !empty($GLOBALS['xoopsModuleConfig']['require_name']); |
|
140 | - $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_NAMEMAIL, 'poster_name', 60, 255, (!empty($isedit) && !empty($poster_name)) ? $poster_name : ''), $required); |
|
139 | + $required = !empty($GLOBALS['xoopsModuleConfig']['require_name']); |
|
140 | + $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_NAMEMAIL, 'poster_name', 60, 255, (!empty($isedit) && !empty($poster_name)) ? $poster_name : ''), $required); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $icons_radio = new \XoopsFormRadio(_MD_NEWBB_MESSAGEICON, 'icon', $icon); |
144 | 144 | $subject_icons = \XoopsLists::getSubjectsList(); |
145 | 145 | foreach ($subject_icons as $iconfile) { |
146 | - $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />'); |
|
146 | + $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />'); |
|
147 | 147 | } |
148 | 148 | $forum_form->addElement($icons_radio); |
149 | 149 | |
150 | 150 | $nohtml = !$topicHandler->getPermission($forumObject, $topic_status, 'html'); |
151 | 151 | |
152 | 152 | if (Request::getString('editor', '', 'POST')) { |
153 | - $editor = trim(Request::getString('editor', '', 'POST')); |
|
154 | - newbbSetCookie('editor', $editor); |
|
153 | + $editor = trim(Request::getString('editor', '', 'POST')); |
|
154 | + newbbSetCookie('editor', $editor); |
|
155 | 155 | } elseif (!$editor = newbbGetCookie('editor')) { |
156 | - if (empty($editor)) { |
|
157 | - $editor = @ $GLOBALS['xoopsModuleConfig']['editor_default']; |
|
158 | - } |
|
156 | + if (empty($editor)) { |
|
157 | + $editor = @ $GLOBALS['xoopsModuleConfig']['editor_default']; |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | if (count(@$GLOBALS['xoopsModuleConfig']['editor_allowed']) > 0) { |
161 | - if (!in_array($editor, $GLOBALS['xoopsModuleConfig']['editor_allowed'])) { |
|
162 | - $editor = $GLOBALS['xoopsModuleConfig']['editor_allowed'][0]; |
|
163 | - newbbSetCookie('editor', $editor); |
|
164 | - } |
|
161 | + if (!in_array($editor, $GLOBALS['xoopsModuleConfig']['editor_allowed'])) { |
|
162 | + $editor = $GLOBALS['xoopsModuleConfig']['editor_allowed'][0]; |
|
163 | + newbbSetCookie('editor', $editor); |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $forum_form->addElement(new \XoopsFormSelectEditor($forum_form, 'editor', $editor, $nohtml, @$GLOBALS['xoopsModuleConfig']['editor_allowed'][0])); |
@@ -178,31 +178,31 @@ discard block |
||
178 | 178 | $forum_form->addElement($_editor, true); |
179 | 179 | |
180 | 180 | if (!empty($GLOBALS['xoopsModuleConfig']['do_tag']) && (empty($postObject) || $postObject->isTopic())) { |
181 | - $topic_tags = ''; |
|
182 | - if (Request::getString('topic_tags', '', 'POST')) { |
|
183 | - $topic_tags = $myts->htmlSpecialChars(Request::getString('topic_tags', '', 'POST')); |
|
184 | - } elseif (!empty($topic_id)) { |
|
185 | - $topic_tags = $topicHandler->get($topic_id, 'topic_tags'); |
|
186 | - } |
|
187 | - if (xoops_load('formtag', 'tag') && class_exists('TagFormTag')) { |
|
188 | - $forum_form->addElement(new TagFormTag('topic_tags', 60, 255, $topic_tags)); |
|
189 | - } |
|
181 | + $topic_tags = ''; |
|
182 | + if (Request::getString('topic_tags', '', 'POST')) { |
|
183 | + $topic_tags = $myts->htmlSpecialChars(Request::getString('topic_tags', '', 'POST')); |
|
184 | + } elseif (!empty($topic_id)) { |
|
185 | + $topic_tags = $topicHandler->get($topic_id, 'topic_tags'); |
|
186 | + } |
|
187 | + if (xoops_load('formtag', 'tag') && class_exists('TagFormTag')) { |
|
188 | + $forum_form->addElement(new TagFormTag('topic_tags', 60, 255, $topic_tags)); |
|
189 | + } |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $options_tray = new \XoopsFormElementTray(_MD_NEWBB_OPTIONS, '<br>'); |
193 | 193 | if (is_object($GLOBALS['xoopsUser']) && 1 == $GLOBALS['xoopsModuleConfig']['allow_user_anonymous']) { |
194 | - $noname = (!empty($isedit) && is_object($postObject) && 0 == $postObject->getVar('uid')) ? 1 : 0; |
|
195 | - $noname_checkbox = new \XoopsFormCheckBox('', 'noname', $noname); |
|
196 | - $noname_checkbox->addOption(1, _MD_NEWBB_POSTANONLY); |
|
197 | - $options_tray->addElement($noname_checkbox); |
|
194 | + $noname = (!empty($isedit) && is_object($postObject) && 0 == $postObject->getVar('uid')) ? 1 : 0; |
|
195 | + $noname_checkbox = new \XoopsFormCheckBox('', 'noname', $noname); |
|
196 | + $noname_checkbox->addOption(1, _MD_NEWBB_POSTANONLY); |
|
197 | + $options_tray->addElement($noname_checkbox); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | if (!$nohtml) { |
201 | - $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $dohtml); |
|
202 | - $html_checkbox->addOption(1, _MD_NEWBB_DOHTML); |
|
203 | - $options_tray->addElement($html_checkbox); |
|
201 | + $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $dohtml); |
|
202 | + $html_checkbox->addOption(1, _MD_NEWBB_DOHTML); |
|
203 | + $options_tray->addElement($html_checkbox); |
|
204 | 204 | } else { |
205 | - $forum_form->addElement(new \XoopsFormHidden('dohtml', 0)); |
|
205 | + $forum_form->addElement(new \XoopsFormHidden('dohtml', 0)); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $smiley_checkbox = new \XoopsFormCheckBox('', 'dosmiley', $dosmiley); |
@@ -214,99 +214,99 @@ discard block |
||
214 | 214 | $options_tray->addElement($xcode_checkbox); |
215 | 215 | |
216 | 216 | if (!$nohtml) { |
217 | - $br_checkbox = new \XoopsFormCheckBox('', 'dobr', $dobr); |
|
218 | - $br_checkbox->addOption(1, _MD_NEWBB_DOBR); |
|
219 | - $options_tray->addElement($br_checkbox); |
|
217 | + $br_checkbox = new \XoopsFormCheckBox('', 'dobr', $dobr); |
|
218 | + $br_checkbox->addOption(1, _MD_NEWBB_DOBR); |
|
219 | + $options_tray->addElement($br_checkbox); |
|
220 | 220 | } else { |
221 | - $forum_form->addElement(new \XoopsFormHidden('dobr', 1)); |
|
221 | + $forum_form->addElement(new \XoopsFormHidden('dobr', 1)); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | if (is_object($GLOBALS['xoopsUser']) && $topicHandler->getPermission($forumObject, $topic_status, 'signature')) { |
225 | - $attachsig_checkbox = new \XoopsFormCheckBox('', 'attachsig', $attachsig); |
|
226 | - $attachsig_checkbox->addOption(1, _MD_NEWBB_ATTACHSIG); |
|
227 | - $options_tray->addElement($attachsig_checkbox); |
|
225 | + $attachsig_checkbox = new \XoopsFormCheckBox('', 'attachsig', $attachsig); |
|
226 | + $attachsig_checkbox->addOption(1, _MD_NEWBB_ATTACHSIG); |
|
227 | + $options_tray->addElement($attachsig_checkbox); |
|
228 | 228 | } |
229 | 229 | $notify = 0; |
230 | 230 | if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsModuleConfig']['notification_enabled']) { |
231 | - if (!empty($notify)) { |
|
232 | - // If 'notify' set, use that value (e.g. preview or upload) |
|
233 | - //$notify = 1; |
|
234 | - } else { |
|
235 | - // Otherwise, check previous subscribed status... |
|
236 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
237 | - $notificationHandler = xoops_getHandler('notification'); |
|
238 | - if (!empty($topic_id) |
|
239 | - && $notificationHandler->isSubscribed('thread', $topic_id, 'new_post', $xoopsModule->getVar('mid'), $GLOBALS['xoopsUser']->getVar('uid'))) { |
|
240 | - $notify = 1; |
|
241 | - } |
|
242 | - } |
|
243 | - |
|
244 | - $notify_checkbox = new \XoopsFormCheckBox('', 'notify', $notify); |
|
245 | - $notify_checkbox->addOption(1, _MD_NEWBB_NEWPOSTNOTIFY); |
|
246 | - $options_tray->addElement($notify_checkbox); |
|
231 | + if (!empty($notify)) { |
|
232 | + // If 'notify' set, use that value (e.g. preview or upload) |
|
233 | + //$notify = 1; |
|
234 | + } else { |
|
235 | + // Otherwise, check previous subscribed status... |
|
236 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
237 | + $notificationHandler = xoops_getHandler('notification'); |
|
238 | + if (!empty($topic_id) |
|
239 | + && $notificationHandler->isSubscribed('thread', $topic_id, 'new_post', $xoopsModule->getVar('mid'), $GLOBALS['xoopsUser']->getVar('uid'))) { |
|
240 | + $notify = 1; |
|
241 | + } |
|
242 | + } |
|
243 | + |
|
244 | + $notify_checkbox = new \XoopsFormCheckBox('', 'notify', $notify); |
|
245 | + $notify_checkbox->addOption(1, _MD_NEWBB_NEWPOSTNOTIFY); |
|
246 | + $options_tray->addElement($notify_checkbox); |
|
247 | 247 | } |
248 | 248 | $forum_form->addElement($options_tray); |
249 | 249 | |
250 | 250 | if ($topicHandler->getPermission($forumObject, $topic_status, 'attach')) { |
251 | - $upload_tray = new \XoopsFormElementTray(_MD_NEWBB_ATTACHMENT); |
|
252 | - $upload_tray->addElement(new \XoopsFormFile('', 'userfile', $forumObject->getVar('attach_maxkb') * 1024)); |
|
253 | - $upload_tray->addElement(new \XoopsFormButton('', 'contents_upload', _MD_NEWBB_UPLOAD, 'submit')); |
|
254 | - $upload_tray->addElement(new \XoopsFormLabel('<br><br>' . _MD_NEWBB_MAX_FILESIZE . ':', $forumObject->getVar('attach_maxkb') . 'Kb; ')); |
|
255 | - $extensions = trim(str_replace('|', ' ', $forumObject->getVar('attach_ext'))); |
|
256 | - $extensions = (empty($extensions) || '*' === $extensions) ? _ALL : $extensions; |
|
257 | - $upload_tray->addElement(new \XoopsFormLabel(_MD_NEWBB_ALLOWED_EXTENSIONS . ':', $extensions)); |
|
258 | - $upload_tray->addElement(new \XoopsFormLabel('<br>' . sprintf(_MD_NEWBB_MAXPIC, $GLOBALS['xoopsModuleConfig']['max_img_height'], $GLOBALS['xoopsModuleConfig']['max_img_width']))); |
|
259 | - $forum_form->addElement($upload_tray); |
|
251 | + $upload_tray = new \XoopsFormElementTray(_MD_NEWBB_ATTACHMENT); |
|
252 | + $upload_tray->addElement(new \XoopsFormFile('', 'userfile', $forumObject->getVar('attach_maxkb') * 1024)); |
|
253 | + $upload_tray->addElement(new \XoopsFormButton('', 'contents_upload', _MD_NEWBB_UPLOAD, 'submit')); |
|
254 | + $upload_tray->addElement(new \XoopsFormLabel('<br><br>' . _MD_NEWBB_MAX_FILESIZE . ':', $forumObject->getVar('attach_maxkb') . 'Kb; ')); |
|
255 | + $extensions = trim(str_replace('|', ' ', $forumObject->getVar('attach_ext'))); |
|
256 | + $extensions = (empty($extensions) || '*' === $extensions) ? _ALL : $extensions; |
|
257 | + $upload_tray->addElement(new \XoopsFormLabel(_MD_NEWBB_ALLOWED_EXTENSIONS . ':', $extensions)); |
|
258 | + $upload_tray->addElement(new \XoopsFormLabel('<br>' . sprintf(_MD_NEWBB_MAXPIC, $GLOBALS['xoopsModuleConfig']['max_img_height'], $GLOBALS['xoopsModuleConfig']['max_img_width']))); |
|
259 | + $forum_form->addElement($upload_tray); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | if (!empty($attachments) && is_array($attachments) && count($attachments)) { |
263 | - $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_THIS_FILE_WAS_ATTACHED_TO_THIS_POST, 'delete_attach[]'); |
|
264 | - foreach ($attachments as $key => $attachment) { |
|
265 | - $attach = ' ' . _DELETE . ' <a href=' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachment['name_saved'] . ' rel="external">' . $attachment['nameDisplay'] . '</a><br>'; |
|
266 | - $delete_attach_checkbox->addOption($key, $attach); |
|
267 | - } |
|
268 | - $forum_form->addElement($delete_attach_checkbox); |
|
269 | - unset($delete_attach_checkbox); |
|
263 | + $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_THIS_FILE_WAS_ATTACHED_TO_THIS_POST, 'delete_attach[]'); |
|
264 | + foreach ($attachments as $key => $attachment) { |
|
265 | + $attach = ' ' . _DELETE . ' <a href=' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachment['name_saved'] . ' rel="external">' . $attachment['nameDisplay'] . '</a><br>'; |
|
266 | + $delete_attach_checkbox->addOption($key, $attach); |
|
267 | + } |
|
268 | + $forum_form->addElement($delete_attach_checkbox); |
|
269 | + unset($delete_attach_checkbox); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if (!empty($attachments_tmp) && is_array($attachments_tmp) && count($attachments_tmp)) { |
273 | - $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_REMOVE, 'delete_tmp[]'); |
|
274 | - $url_prefix = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, XOOPS_CACHE_PATH); |
|
275 | - foreach ($attachments_tmp as $key => $attachment) { |
|
276 | - $attach = ' <a href="' . $url_prefix . '/' . $attachment[0] . '" rel="external">' . $attachment[1] . '</a><br>'; |
|
277 | - $delete_attach_checkbox->addOption($key, $attach); |
|
278 | - } |
|
279 | - $forum_form->addElement($delete_attach_checkbox); |
|
280 | - unset($delete_attach_checkbox); |
|
281 | - $attachments_tmp = base64_encode(serialize($attachments_tmp)); |
|
282 | - $forum_form->addElement(new \XoopsFormHidden('attachments_tmp', $attachments_tmp)); |
|
273 | + $delete_attach_checkbox = new \XoopsFormCheckBox(_MD_NEWBB_REMOVE, 'delete_tmp[]'); |
|
274 | + $url_prefix = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, XOOPS_CACHE_PATH); |
|
275 | + foreach ($attachments_tmp as $key => $attachment) { |
|
276 | + $attach = ' <a href="' . $url_prefix . '/' . $attachment[0] . '" rel="external">' . $attachment[1] . '</a><br>'; |
|
277 | + $delete_attach_checkbox->addOption($key, $attach); |
|
278 | + } |
|
279 | + $forum_form->addElement($delete_attach_checkbox); |
|
280 | + unset($delete_attach_checkbox); |
|
281 | + $attachments_tmp = base64_encode(serialize($attachments_tmp)); |
|
282 | + $forum_form->addElement(new \XoopsFormHidden('attachments_tmp', $attachments_tmp)); |
|
283 | 283 | } |
284 | 284 | $radiobox = null; |
285 | 285 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] || $GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
286 | - $view_require = $require_reply ? 'require_reply' : ($post_karma ? 'require_karma' : 'require_null'); |
|
287 | - $radiobox = new \XoopsFormRadio(_MD_NEWBB_VIEW_REQUIRE, 'view_require', $view_require); |
|
288 | - if ($GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
|
289 | - $radiobox->addOption('require_reply', _MD_NEWBB_REQUIRE_REPLY); |
|
290 | - } |
|
291 | - if ($GLOBALS['xoopsModuleConfig']['enable_karma']) { |
|
292 | - $karmas = array_map('trim', explode(',', $GLOBALS['xoopsModuleConfig']['karma_options'])); |
|
293 | - if (count($karmas) > 1) { |
|
294 | - foreach ($karmas as $karma) { |
|
295 | - $karma_array[(string)$karma] = (int)$karma; |
|
296 | - } |
|
297 | - $karma_select = new \XoopsFormSelect('', 'post_karma', $post_karma); |
|
298 | - $karma_select->addOptionArray($karma_array); |
|
299 | - $radiobox->addOption('require_karma', _MD_NEWBB_REQUIRE_KARMA . $karma_select->render()); |
|
300 | - } |
|
301 | - } |
|
302 | - $radiobox->addOption('require_null', _MD_NEWBB_REQUIRE_NULL); |
|
286 | + $view_require = $require_reply ? 'require_reply' : ($post_karma ? 'require_karma' : 'require_null'); |
|
287 | + $radiobox = new \XoopsFormRadio(_MD_NEWBB_VIEW_REQUIRE, 'view_require', $view_require); |
|
288 | + if ($GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
|
289 | + $radiobox->addOption('require_reply', _MD_NEWBB_REQUIRE_REPLY); |
|
290 | + } |
|
291 | + if ($GLOBALS['xoopsModuleConfig']['enable_karma']) { |
|
292 | + $karmas = array_map('trim', explode(',', $GLOBALS['xoopsModuleConfig']['karma_options'])); |
|
293 | + if (count($karmas) > 1) { |
|
294 | + foreach ($karmas as $karma) { |
|
295 | + $karma_array[(string)$karma] = (int)$karma; |
|
296 | + } |
|
297 | + $karma_select = new \XoopsFormSelect('', 'post_karma', $post_karma); |
|
298 | + $karma_select->addOptionArray($karma_array); |
|
299 | + $radiobox->addOption('require_karma', _MD_NEWBB_REQUIRE_KARMA . $karma_select->render()); |
|
300 | + } |
|
301 | + } |
|
302 | + $radiobox->addOption('require_null', _MD_NEWBB_REQUIRE_NULL); |
|
303 | 303 | } |
304 | 304 | if (null !== $radiobox) { |
305 | - $forum_form->addElement($radiobox); |
|
305 | + $forum_form->addElement($radiobox); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | if (empty($uid)) { |
309 | - $forum_form->addElement(new \XoopsFormCaptcha()); |
|
309 | + $forum_form->addElement(new \XoopsFormCaptcha()); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | $forum_form->addElement(new \XoopsFormHidden('pid', @$pid)); |
@@ -327,20 +327,20 @@ discard block |
||
327 | 327 | |
328 | 328 | $cancel_button = new \XoopsFormButton('', 'cancel', _CANCEL, 'button'); |
329 | 329 | if (!empty($topic_id)) { |
330 | - $extra = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . (int)$topic_id; |
|
330 | + $extra = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . (int)$topic_id; |
|
331 | 331 | } else { |
332 | - $extra = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $forumObject->getVar('forum_id'); |
|
332 | + $extra = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $forumObject->getVar('forum_id'); |
|
333 | 333 | } |
334 | 334 | $cancel_button->setExtra("onclick='location=\"" . $extra . "\"'"); |
335 | 335 | $cancel_button->setExtra("tabindex='6'"); |
336 | 336 | |
337 | 337 | if (!empty($isreply) && !empty($hidden)) { |
338 | - $forum_form->addElement(new \XoopsFormHidden('hidden', $hidden)); |
|
338 | + $forum_form->addElement(new \XoopsFormHidden('hidden', $hidden)); |
|
339 | 339 | |
340 | - $quote_button = new \XoopsFormButton('', 'quote', _MD_NEWBB_QUOTE, 'button'); |
|
341 | - $quote_button->setExtra("onclick='xoopsGetElementById(\"message\").value=xoopsGetElementById(\"message\").value+ xoopsGetElementById(\"hidden\").value;xoopsGetElementById(\"hidden\").value=\"\";'"); |
|
342 | - $quote_button->setExtra("tabindex='4'"); |
|
343 | - $button_tray->addElement($quote_button); |
|
340 | + $quote_button = new \XoopsFormButton('', 'quote', _MD_NEWBB_QUOTE, 'button'); |
|
341 | + $quote_button->setExtra("onclick='xoopsGetElementById(\"message\").value=xoopsGetElementById(\"message\").value+ xoopsGetElementById(\"hidden\").value;xoopsGetElementById(\"hidden\").value=\"\";'"); |
|
342 | + $quote_button->setExtra("tabindex='4'"); |
|
343 | + $button_tray->addElement($quote_button); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | $preview_button = new \XoopsFormButton('', 'btn_preview', _PREVIEW, 'button'); |
@@ -31,67 +31,67 @@ |
||
31 | 31 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
32 | 32 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.php'); |
33 | 33 | if (!defined('NEWBB_NOTIFY_ITEMINFO')) { |
34 | - define('NEWBB_NOTIFY_ITEMINFO', 1); |
|
34 | + define('NEWBB_NOTIFY_ITEMINFO', 1); |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param $category |
|
38 | - * @param $item_id |
|
39 | - * @return mixed |
|
40 | - */ |
|
41 | - function newbb_notify_iteminfo($category, $item_id) |
|
42 | - { |
|
43 | - /** @var \XoopsModuleHandler $moduleHandler */ |
|
44 | - $moduleHandler = xoops_getHandler('module'); |
|
45 | - $module = $moduleHandler->getByDirname('newbb'); |
|
36 | + /** |
|
37 | + * @param $category |
|
38 | + * @param $item_id |
|
39 | + * @return mixed |
|
40 | + */ |
|
41 | + function newbb_notify_iteminfo($category, $item_id) |
|
42 | + { |
|
43 | + /** @var \XoopsModuleHandler $moduleHandler */ |
|
44 | + $moduleHandler = xoops_getHandler('module'); |
|
45 | + $module = $moduleHandler->getByDirname('newbb'); |
|
46 | 46 | |
47 | - if ('global' === $category) { |
|
48 | - $item['name'] = ''; |
|
49 | - $item['url'] = ''; |
|
47 | + if ('global' === $category) { |
|
48 | + $item['name'] = ''; |
|
49 | + $item['url'] = ''; |
|
50 | 50 | |
51 | - return $item; |
|
52 | - } |
|
53 | - $item_id = (int)$item_id; |
|
51 | + return $item; |
|
52 | + } |
|
53 | + $item_id = (int)$item_id; |
|
54 | 54 | |
55 | - if ('forum' === $category) { |
|
56 | - // Assume we have a valid forum id |
|
57 | - $sql = 'SELECT forum_name FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' WHERE forum_id = ' . $item_id; |
|
58 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
59 | - // irmtfan full URL |
|
60 | - redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
61 | - } |
|
62 | - $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
63 | - $item['name'] = $result_array['forum_name']; |
|
64 | - $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewforum.php?forum=' . $item_id; |
|
55 | + if ('forum' === $category) { |
|
56 | + // Assume we have a valid forum id |
|
57 | + $sql = 'SELECT forum_name FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' WHERE forum_id = ' . $item_id; |
|
58 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
59 | + // irmtfan full URL |
|
60 | + redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
61 | + } |
|
62 | + $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
63 | + $item['name'] = $result_array['forum_name']; |
|
64 | + $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewforum.php?forum=' . $item_id; |
|
65 | 65 | |
66 | - return $item; |
|
67 | - } |
|
66 | + return $item; |
|
67 | + } |
|
68 | 68 | |
69 | - if ('thread' === $category) { |
|
70 | - // Assume we have a valid topid id |
|
71 | - $sql = 'SELECT t.topic_title,f.forum_id,f.forum_name FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' f WHERE t.forum_id = f.forum_id AND t.topic_id = ' . $item_id . ' LIMIT 1'; |
|
72 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
73 | - // irmtfan full URL |
|
74 | - redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERROROCCURED); |
|
75 | - } |
|
76 | - $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
77 | - $item['name'] = $result_array['topic_title']; |
|
78 | - $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum=' . $result_array['forum_id'] . '&topic_id=' . $item_id; |
|
69 | + if ('thread' === $category) { |
|
70 | + // Assume we have a valid topid id |
|
71 | + $sql = 'SELECT t.topic_title,f.forum_id,f.forum_name FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' f WHERE t.forum_id = f.forum_id AND t.topic_id = ' . $item_id . ' LIMIT 1'; |
|
72 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
73 | + // irmtfan full URL |
|
74 | + redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERROROCCURED); |
|
75 | + } |
|
76 | + $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
77 | + $item['name'] = $result_array['topic_title']; |
|
78 | + $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum=' . $result_array['forum_id'] . '&topic_id=' . $item_id; |
|
79 | 79 | |
80 | - return $item; |
|
81 | - } |
|
80 | + return $item; |
|
81 | + } |
|
82 | 82 | |
83 | - if ('post' === $category) { |
|
84 | - // Assume we have a valid post id |
|
85 | - $sql = 'SELECT subject,topic_id,forum_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE post_id = ' . $item_id . ' LIMIT 1'; |
|
86 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
87 | - // irmtfan full URL |
|
88 | - redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERROROCCURED); |
|
89 | - } |
|
90 | - $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
91 | - $item['name'] = $result_array['subject']; |
|
92 | - $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum= ' . $result_array['forum_id'] . '&topic_id=' . $result_array['topic_id'] . '#forumpost' . $item_id; |
|
83 | + if ('post' === $category) { |
|
84 | + // Assume we have a valid post id |
|
85 | + $sql = 'SELECT subject,topic_id,forum_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE post_id = ' . $item_id . ' LIMIT 1'; |
|
86 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
87 | + // irmtfan full URL |
|
88 | + redirect_header(XOOPS_URL . '/modules/' . $module->getVar('dirname') . 'index.php', 2, _MD_NEWBB_ERROROCCURED); |
|
89 | + } |
|
90 | + $result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
|
91 | + $item['name'] = $result_array['subject']; |
|
92 | + $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum= ' . $result_array['forum_id'] . '&topic_id=' . $result_array['topic_id'] . '#forumpost' . $item_id; |
|
93 | 93 | |
94 | - return $item; |
|
95 | - } |
|
96 | - } |
|
94 | + return $item; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
@@ -17,34 +17,34 @@ |
||
17 | 17 | define('NEWBB_FUNCTIONS_WELCOME_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_WELCOME')) { |
20 | - define('NEWBB_FUNCTIONS_WELCOME', true); |
|
21 | - |
|
22 | - /** |
|
23 | - * @return bool |
|
24 | - */ |
|
25 | - function newbbWelcome() |
|
26 | - { |
|
27 | - global $forumObject; |
|
28 | - $ret = ''; |
|
29 | - |
|
30 | - $forumId = @$GLOBALS['xoopsModuleConfig']['welcome_forum']; |
|
31 | - if (!$forumId) { |
|
32 | - return false; |
|
33 | - } |
|
34 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
35 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
36 | - $forumObject = $forumHandler->get($forumId); |
|
37 | - if (!$forumObject || !$forumHandler->getPermission($forumObject)) { |
|
38 | - unset($forumObject); |
|
39 | - |
|
40 | - return false; |
|
41 | - } |
|
42 | - |
|
43 | - require_once __DIR__ . '/functions.welcome.inc.php'; |
|
44 | - unset($forumObject); |
|
45 | - |
|
46 | - return $ret; |
|
47 | - } |
|
48 | - |
|
49 | - newbbWelcome(); |
|
20 | + define('NEWBB_FUNCTIONS_WELCOME', true); |
|
21 | + |
|
22 | + /** |
|
23 | + * @return bool |
|
24 | + */ |
|
25 | + function newbbWelcome() |
|
26 | + { |
|
27 | + global $forumObject; |
|
28 | + $ret = ''; |
|
29 | + |
|
30 | + $forumId = @$GLOBALS['xoopsModuleConfig']['welcome_forum']; |
|
31 | + if (!$forumId) { |
|
32 | + return false; |
|
33 | + } |
|
34 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
35 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
36 | + $forumObject = $forumHandler->get($forumId); |
|
37 | + if (!$forumObject || !$forumHandler->getPermission($forumObject)) { |
|
38 | + unset($forumObject); |
|
39 | + |
|
40 | + return false; |
|
41 | + } |
|
42 | + |
|
43 | + require_once __DIR__ . '/functions.welcome.inc.php'; |
|
44 | + unset($forumObject); |
|
45 | + |
|
46 | + return $ret; |
|
47 | + } |
|
48 | + |
|
49 | + newbbWelcome(); |
|
50 | 50 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | function xoops_module_pre_uninstall_newbb(\XoopsModule $module) |
21 | 21 | { |
22 | - // Do some synchronization |
|
23 | - return true; |
|
22 | + // Do some synchronization |
|
23 | + return true; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -32,36 +32,36 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function xoops_module_uninstall_newbb(\XoopsModule $module) |
34 | 34 | { |
35 | - // return true; |
|
35 | + // return true; |
|
36 | 36 | |
37 | - $moduleDirName = basename(dirname(__DIR__)); |
|
38 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
39 | - /** @var \XoopsModules\Newbb\Helper $helper */ |
|
40 | - $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
37 | + $moduleDirName = basename(dirname(__DIR__)); |
|
38 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
39 | + /** @var \XoopsModules\Newbb\Helper $helper */ |
|
40 | + $helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
41 | 41 | |
42 | - /** @var Newbb\Utility $utility */ |
|
43 | - $utility = new \XoopsModules\Newbb\Utility(); |
|
42 | + /** @var Newbb\Utility $utility */ |
|
43 | + $utility = new \XoopsModules\Newbb\Utility(); |
|
44 | 44 | |
45 | - $success = true; |
|
46 | - $helper->loadLanguage('admin'); |
|
45 | + $success = true; |
|
46 | + $helper->loadLanguage('admin'); |
|
47 | 47 | |
48 | - //------------------------------------------------------------------ |
|
49 | - // Remove uploads folder (and all subfolders) if they exist |
|
50 | - //------------------------------------------------------------------ |
|
48 | + //------------------------------------------------------------------ |
|
49 | + // Remove uploads folder (and all subfolders) if they exist |
|
50 | + //------------------------------------------------------------------ |
|
51 | 51 | |
52 | - $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; |
|
53 | - foreach ($old_directories as $old_dir) { |
|
54 | - $dirInfo = new \SplFileInfo($old_dir); |
|
55 | - if ($dirInfo->isDir()) { |
|
56 | - // The directory exists so delete it |
|
57 | - if (false === $utility::rrmdir($old_dir)) { |
|
58 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); |
|
59 | - $success = false; |
|
60 | - } |
|
61 | - } |
|
62 | - unset($dirInfo); |
|
63 | - } |
|
64 | - /* |
|
52 | + $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; |
|
53 | + foreach ($old_directories as $old_dir) { |
|
54 | + $dirInfo = new \SplFileInfo($old_dir); |
|
55 | + if ($dirInfo->isDir()) { |
|
56 | + // The directory exists so delete it |
|
57 | + if (false === $utility::rrmdir($old_dir)) { |
|
58 | + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); |
|
59 | + $success = false; |
|
60 | + } |
|
61 | + } |
|
62 | + unset($dirInfo); |
|
63 | + } |
|
64 | + /* |
|
65 | 65 | //------------ START ---------------- |
66 | 66 | //------------------------------------------------------------------ |
67 | 67 | // Remove xsitemap.xml from XOOPS root folder if it exists |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | // return $success && $delOk; // use this if you're using this routine |
76 | 76 | */ |
77 | 77 | |
78 | - return $success; |
|
79 | - //------------ END ---------------- |
|
78 | + return $success; |
|
79 | + //------------ END ---------------- |
|
80 | 80 | } |