@@ -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 | } |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | use XoopsModules\Newbb; |
24 | 24 | |
25 | 25 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
26 | -require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
|
26 | +require_once dirname(__DIR__).'/preloads/autoloader.php'; |
|
27 | 27 | |
28 | 28 | $moduleDirName = basename(dirname(__DIR__)); |
29 | -$moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName |
|
29 | +$moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName |
|
30 | 30 | |
31 | 31 | /** @var \XoopsDatabase $db */ |
32 | 32 | /** @var Newbb\Helper $helper */ |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | //define('NEWBB_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash |
50 | 50 | //define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash |
51 | 51 | |
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); |
|
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); |
|
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; |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
155 | 155 | } |
156 | 156 | |
157 | -$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
|
157 | +$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL.'/modules/'.$moduleDirName); |
|
158 | 158 | // Local icons path |
159 | 159 | if (is_object($helper->getModule())) { |
160 | 160 | $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); |
161 | 161 | $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
162 | 162 | |
163 | - $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); |
|
163 | + $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL.'/modules/'.$moduleDirName.'/'.$pathModIcon16); |
|
164 | 164 | $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); |
165 | 165 | } |
@@ -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 | } |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function xoops_module_pre_install_newbb(\XoopsModule $module) |
32 | 32 | { |
33 | - require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
|
33 | + require_once dirname(__DIR__).'/preloads/autoloader.php'; |
|
34 | 34 | /** @var Newbb\Utility $utility */ |
35 | 35 | $utility = new \XoopsModules\Newbb\Utility(); |
36 | 36 | $xoopsSuccess = $utility::checkVerXoops($module); |
37 | 37 | $phpSuccess = $utility::checkVerPhp($module); |
38 | 38 | |
39 | 39 | if (false !== $xoopsSuccess && false !== $phpSuccess) { |
40 | - $moduleTables =& $module->getInfo('tables'); |
|
40 | + $moduleTables = & $module->getInfo('tables'); |
|
41 | 41 | foreach ($moduleTables as $table) { |
42 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
|
42 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS '.$GLOBALS['xoopsDB']->prefix($table).';'); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -55,8 +55,8 @@ 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 | 61 | $moduleDirName = basename(dirname(__DIR__)); |
62 | 62 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | $moduleId2 = $helper->getModule()->mid(); |
75 | 75 | $grouppermHandler = xoops_getHandler('groupperm'); |
76 | 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); |
|
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 | 83 | // --- CREATE FOLDERS --------------- |
84 | 84 | if (count($configurator->uploadFolders) > 0) { |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | |
91 | 91 | // --- COPY blank.png FILES --------------- |
92 | 92 | if (count($configurator->copyBlankFiles) > 0) { |
93 | - $file = dirname(__DIR__) . '/assets/images/blank.png'; |
|
93 | + $file = dirname(__DIR__).'/assets/images/blank.png'; |
|
94 | 94 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
95 | - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
95 | + $dest = $configurator->copyBlankFiles[$i].'/blank.png'; |
|
96 | 96 | $utility::copyFile($file, $dest); |
97 | 97 | } |
98 | 98 | } |
99 | 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%'"; |
|
100 | + $sql = 'DELETE FROM '.$xoopsDB->prefix('tplfile')." WHERE `tpl_module` = '".$xoopsModule->getVar('dirname', 'n')."' AND `tpl_file` LIKE '%.html%'"; |
|
101 | 101 | $xoopsDB->queryF($sql); |
102 | 102 | |
103 | 103 | return true; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15 | 15 | |
16 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
16 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
17 | 17 | define('NEWBB_FUNCTIONS_RENDER_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_RENDER')) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if (0 !== $br) { |
68 | 68 | $text = $myts->nl2Br($text); |
69 | 69 | } |
70 | - $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18) |
|
70 | + $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18) |
|
71 | 71 | |
72 | 72 | return $text; |
73 | 73 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}' />"; |
100 | 100 | if (empty($asImage)) { |
101 | - $button = "<a href='{$link}' title='{$alt}' {$extra}>" . newbbDisplayImage($button, $alt, true) . '</a>'; |
|
101 | + $button = "<a href='{$link}' title='{$alt}' {$extra}>".newbbDisplayImage($button, $alt, true).'</a>'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $button; |
@@ -17,146 +17,146 @@ |
||
17 | 17 | define('NEWBB_FUNCTIONS_RENDER_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_RENDER')) { |
20 | - define('NEWBB_FUNCTIONS_RENDER', 1); |
|
20 | + define('NEWBB_FUNCTIONS_RENDER', 1); |
|
21 | 21 | |
22 | - /* |
|
22 | + /* |
|
23 | 23 | * Sorry, we have to use the stupid solution unless there is an option in MyTextSanitizer:: htmlspecialchars(); |
24 | 24 | */ |
25 | - /** |
|
26 | - * @param $text |
|
27 | - * @return mixed |
|
28 | - */ |
|
29 | - function newbbHtmlspecialchars(&$text) |
|
30 | - { |
|
31 | - return preg_replace(['/&/i', '/ /i'], ['&', '&nbsp;'], htmlspecialchars($text, ENT_QUOTES | ENT_HTML5)); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @param $text |
|
36 | - * @param int $html |
|
37 | - * @param int $smiley |
|
38 | - * @param int $xcode |
|
39 | - * @param int $image |
|
40 | - * @param int $br |
|
41 | - * @return mixed |
|
42 | - */ |
|
43 | - function &newbbDisplayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) |
|
44 | - { |
|
45 | - global $myts; |
|
46 | - |
|
47 | - if (1 !== $html) { |
|
48 | - // html not allowed |
|
49 | - $text = newbbHtmlspecialchars($text); |
|
50 | - } |
|
51 | - $text = $myts->codePreConv($text, $xcode); // Ryuji_edit(2003-11-18) |
|
52 | - $text = $myts->makeClickable($text); |
|
53 | - if (0 !== $smiley) { |
|
54 | - // process smiley |
|
55 | - $text = $myts->smiley($text); |
|
56 | - } |
|
57 | - if (0 !== $xcode) { |
|
58 | - // decode xcode |
|
59 | - if (0 !== $image) { |
|
60 | - // image allowed |
|
61 | - $text = $myts->xoopsCodeDecode($text); |
|
62 | - } else { |
|
63 | - // image not allowed |
|
64 | - $text = $myts->xoopsCodeDecode($text, 0); |
|
65 | - } |
|
66 | - } |
|
67 | - if (0 !== $br) { |
|
68 | - $text = $myts->nl2Br($text); |
|
69 | - } |
|
70 | - $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18) |
|
71 | - |
|
72 | - return $text; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @param $document |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - function newbbHtml2text($document) |
|
80 | - { |
|
81 | - $text = strip_tags($document); |
|
82 | - |
|
83 | - return $text; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * Display forrum button |
|
88 | - * |
|
89 | - * @param $link |
|
90 | - * @param $button |
|
91 | - * @param string $alt alt message |
|
92 | - * @param boolean $asImage true for image mode; false for text mode |
|
93 | - * @param string $extra extra attribute for the button |
|
94 | - * @return mixed |
|
95 | - * @internal param string $image image/button name, without extension |
|
96 | - */ |
|
97 | - function newbbGetButton($link, $button, $alt = '', $asImage = true, $extra = "class='forum_button'") |
|
98 | - { |
|
99 | - $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}' />"; |
|
100 | - if (empty($asImage)) { |
|
101 | - $button = "<a href='{$link}' title='{$alt}' {$extra}>" . newbbDisplayImage($button, $alt, true) . '</a>'; |
|
102 | - } |
|
103 | - |
|
104 | - return $button; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Display forrum images |
|
109 | - * |
|
110 | - * @param string $image image name, without extension |
|
111 | - * @param string $alt alt message |
|
112 | - * @param boolean $display true for return image anchor; faulse for assign to $xoopsTpl |
|
113 | - * @param string $extra extra attribute for the image |
|
114 | - * @return mixed |
|
115 | - */ |
|
116 | - function newbbDisplayImage($image, $alt = '', $display = true, $extra = "class='forum_icon'") |
|
117 | - { |
|
118 | - $iconHandler = newbbGetIconHandler(); |
|
119 | - // START hacked by irmtfan |
|
120 | - // to show text links instead of buttons - func_num_args()==2 => only when $image, $alt is set and optional $display not set |
|
121 | - |
|
122 | - if (2 == func_num_args()) { |
|
123 | - // overall setting |
|
124 | - if (!empty($GLOBALS['xoopsModuleConfig']['display_text_links'])) { |
|
125 | - $display = false; |
|
126 | - } |
|
127 | - // if set for each link => overwrite $display |
|
128 | - if (isset($GLOBALS['xoopsModuleConfig']['display_text_each_link'][$image])) { |
|
129 | - $display = empty($GLOBALS['xoopsModuleConfig']['display_text_each_link'][$image]); |
|
130 | - } |
|
131 | - } |
|
132 | - // END hacked by irmtfan |
|
133 | - if (empty($display)) { |
|
134 | - return $iconHandler->assignImage($image, $alt, $extra); |
|
135 | - } else { |
|
136 | - return $iconHandler->getImage($image, $alt, $extra); |
|
137 | - } |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * @return Newbb\IconHandler |
|
142 | - */ |
|
143 | - function newbbGetIconHandler() |
|
144 | - { |
|
145 | - global $xoTheme; |
|
146 | - static $iconHandler; |
|
147 | - |
|
148 | - if (null !== $iconHandler) { |
|
149 | - return $iconHandler; |
|
150 | - } |
|
25 | + /** |
|
26 | + * @param $text |
|
27 | + * @return mixed |
|
28 | + */ |
|
29 | + function newbbHtmlspecialchars(&$text) |
|
30 | + { |
|
31 | + return preg_replace(['/&/i', '/ /i'], ['&', '&nbsp;'], htmlspecialchars($text, ENT_QUOTES | ENT_HTML5)); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @param $text |
|
36 | + * @param int $html |
|
37 | + * @param int $smiley |
|
38 | + * @param int $xcode |
|
39 | + * @param int $image |
|
40 | + * @param int $br |
|
41 | + * @return mixed |
|
42 | + */ |
|
43 | + function &newbbDisplayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) |
|
44 | + { |
|
45 | + global $myts; |
|
46 | + |
|
47 | + if (1 !== $html) { |
|
48 | + // html not allowed |
|
49 | + $text = newbbHtmlspecialchars($text); |
|
50 | + } |
|
51 | + $text = $myts->codePreConv($text, $xcode); // Ryuji_edit(2003-11-18) |
|
52 | + $text = $myts->makeClickable($text); |
|
53 | + if (0 !== $smiley) { |
|
54 | + // process smiley |
|
55 | + $text = $myts->smiley($text); |
|
56 | + } |
|
57 | + if (0 !== $xcode) { |
|
58 | + // decode xcode |
|
59 | + if (0 !== $image) { |
|
60 | + // image allowed |
|
61 | + $text = $myts->xoopsCodeDecode($text); |
|
62 | + } else { |
|
63 | + // image not allowed |
|
64 | + $text = $myts->xoopsCodeDecode($text, 0); |
|
65 | + } |
|
66 | + } |
|
67 | + if (0 !== $br) { |
|
68 | + $text = $myts->nl2Br($text); |
|
69 | + } |
|
70 | + $text = $myts->codeConv($text, $xcode, $image); // Ryuji_edit(2003-11-18) |
|
71 | + |
|
72 | + return $text; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @param $document |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + function newbbHtml2text($document) |
|
80 | + { |
|
81 | + $text = strip_tags($document); |
|
82 | + |
|
83 | + return $text; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * Display forrum button |
|
88 | + * |
|
89 | + * @param $link |
|
90 | + * @param $button |
|
91 | + * @param string $alt alt message |
|
92 | + * @param boolean $asImage true for image mode; false for text mode |
|
93 | + * @param string $extra extra attribute for the button |
|
94 | + * @return mixed |
|
95 | + * @internal param string $image image/button name, without extension |
|
96 | + */ |
|
97 | + function newbbGetButton($link, $button, $alt = '', $asImage = true, $extra = "class='forum_button'") |
|
98 | + { |
|
99 | + $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}' />"; |
|
100 | + if (empty($asImage)) { |
|
101 | + $button = "<a href='{$link}' title='{$alt}' {$extra}>" . newbbDisplayImage($button, $alt, true) . '</a>'; |
|
102 | + } |
|
103 | + |
|
104 | + return $button; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Display forrum images |
|
109 | + * |
|
110 | + * @param string $image image name, without extension |
|
111 | + * @param string $alt alt message |
|
112 | + * @param boolean $display true for return image anchor; faulse for assign to $xoopsTpl |
|
113 | + * @param string $extra extra attribute for the image |
|
114 | + * @return mixed |
|
115 | + */ |
|
116 | + function newbbDisplayImage($image, $alt = '', $display = true, $extra = "class='forum_icon'") |
|
117 | + { |
|
118 | + $iconHandler = newbbGetIconHandler(); |
|
119 | + // START hacked by irmtfan |
|
120 | + // to show text links instead of buttons - func_num_args()==2 => only when $image, $alt is set and optional $display not set |
|
121 | + |
|
122 | + if (2 == func_num_args()) { |
|
123 | + // overall setting |
|
124 | + if (!empty($GLOBALS['xoopsModuleConfig']['display_text_links'])) { |
|
125 | + $display = false; |
|
126 | + } |
|
127 | + // if set for each link => overwrite $display |
|
128 | + if (isset($GLOBALS['xoopsModuleConfig']['display_text_each_link'][$image])) { |
|
129 | + $display = empty($GLOBALS['xoopsModuleConfig']['display_text_each_link'][$image]); |
|
130 | + } |
|
131 | + } |
|
132 | + // END hacked by irmtfan |
|
133 | + if (empty($display)) { |
|
134 | + return $iconHandler->assignImage($image, $alt, $extra); |
|
135 | + } else { |
|
136 | + return $iconHandler->getImage($image, $alt, $extra); |
|
137 | + } |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * @return Newbb\IconHandler |
|
142 | + */ |
|
143 | + function newbbGetIconHandler() |
|
144 | + { |
|
145 | + global $xoTheme; |
|
146 | + static $iconHandler; |
|
147 | + |
|
148 | + if (null !== $iconHandler) { |
|
149 | + return $iconHandler; |
|
150 | + } |
|
151 | 151 | |
152 | 152 | // if (!class_exists('IconHandler')) { |
153 | 153 | // require_once dirname(__DIR__) . '/class/icon.php'; |
154 | 154 | // } |
155 | 155 | |
156 | - $iconHandler = Newbb\IconHandler::getInstance(); |
|
157 | - $iconHandler->template = $xoTheme->template; |
|
158 | - $iconHandler->init($GLOBALS['xoopsConfig']['language']); |
|
156 | + $iconHandler = Newbb\IconHandler::getInstance(); |
|
157 | + $iconHandler->template = $xoTheme->template; |
|
158 | + $iconHandler->init($GLOBALS['xoopsConfig']['language']); |
|
159 | 159 | |
160 | - return $iconHandler; |
|
161 | - } |
|
160 | + return $iconHandler; |
|
161 | + } |
|
162 | 162 | } |
@@ -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 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15 | 15 | |
16 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
16 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
17 | 17 | define('NEWBB_FUNCTIONS_WELCOME_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_WELCOME')) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - require_once __DIR__ . '/functions.welcome.inc.php'; |
|
43 | + require_once __DIR__.'/functions.welcome.inc.php'; |
|
44 | 44 | unset($forumObject); |
45 | 45 | |
46 | 46 | return $ret; |
@@ -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 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | { |
35 | 35 | // return true; |
36 | 36 | |
37 | - $moduleDirName = basename(dirname(__DIR__)); |
|
38 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
37 | + $moduleDirName = basename(dirname(__DIR__)); |
|
38 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
39 | 39 | /** @var \XoopsModules\Newbb\Helper $helper */ |
40 | 40 | $helper = \XoopsModules\Newbb\Helper::getInstance(); |
41 | 41 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | if ($dirInfo->isDir()) { |
56 | 56 | // The directory exists so delete it |
57 | 57 | if (false === $utility::rrmdir($old_dir)) { |
58 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); |
|
58 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH'), $old_dir)); |
|
59 | 59 | $success = false; |
60 | 60 | } |
61 | 61 | } |
@@ -17,101 +17,101 @@ |
||
17 | 17 | define('NEWBB_FUNCTIONS_SESSION_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_SESSION')) { |
20 | - define('NEWBB_FUNCTIONS_SESSION', 1); |
|
20 | + define('NEWBB_FUNCTIONS_SESSION', 1); |
|
21 | 21 | |
22 | - /* |
|
22 | + /* |
|
23 | 23 | * Currently the newbb session/cookie handlers are limited to: |
24 | 24 | * -- one dimension |
25 | 25 | * -- "," and "|" are preserved |
26 | 26 | * |
27 | 27 | */ |
28 | - /** |
|
29 | - * @param $name |
|
30 | - * @param string|array $string |
|
31 | - */ |
|
32 | - function newbbSetSession($name, $string = '') |
|
33 | - { |
|
34 | - if (is_array($string)) { |
|
35 | - $value = []; |
|
36 | - foreach ($string as $key => $val) { |
|
37 | - $value[] = $key . '|' . $val; |
|
38 | - } |
|
39 | - $string = implode(',', $value); |
|
40 | - } |
|
41 | - $_SESSION['newbb_' . $name] = $string; |
|
42 | - } |
|
28 | + /** |
|
29 | + * @param $name |
|
30 | + * @param string|array $string |
|
31 | + */ |
|
32 | + function newbbSetSession($name, $string = '') |
|
33 | + { |
|
34 | + if (is_array($string)) { |
|
35 | + $value = []; |
|
36 | + foreach ($string as $key => $val) { |
|
37 | + $value[] = $key . '|' . $val; |
|
38 | + } |
|
39 | + $string = implode(',', $value); |
|
40 | + } |
|
41 | + $_SESSION['newbb_' . $name] = $string; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param $name |
|
46 | - * @param bool $isArray |
|
47 | - * @return array|bool |
|
48 | - */ |
|
49 | - function newbbGetSession($name, $isArray = false) |
|
50 | - { |
|
51 | - $value = !empty($_SESSION['newbb_' . $name]) ? $_SESSION['newbb_' . $name] : false; |
|
52 | - if ($isArray) { |
|
53 | - $_value = $value ? explode(',', $value) : []; |
|
54 | - $value = []; |
|
55 | - if (count($_value) > 0) { |
|
56 | - foreach ($_value as $string) { |
|
57 | - $key = substr($string, 0, strpos($string, '|')); |
|
58 | - $val = substr($string, strpos($string, '|') + 1); |
|
59 | - $value[$key] = $val; |
|
60 | - } |
|
61 | - } |
|
62 | - unset($_value); |
|
63 | - } |
|
44 | + /** |
|
45 | + * @param $name |
|
46 | + * @param bool $isArray |
|
47 | + * @return array|bool |
|
48 | + */ |
|
49 | + function newbbGetSession($name, $isArray = false) |
|
50 | + { |
|
51 | + $value = !empty($_SESSION['newbb_' . $name]) ? $_SESSION['newbb_' . $name] : false; |
|
52 | + if ($isArray) { |
|
53 | + $_value = $value ? explode(',', $value) : []; |
|
54 | + $value = []; |
|
55 | + if (count($_value) > 0) { |
|
56 | + foreach ($_value as $string) { |
|
57 | + $key = substr($string, 0, strpos($string, '|')); |
|
58 | + $val = substr($string, strpos($string, '|') + 1); |
|
59 | + $value[$key] = $val; |
|
60 | + } |
|
61 | + } |
|
62 | + unset($_value); |
|
63 | + } |
|
64 | 64 | |
65 | - return $value; |
|
66 | - } |
|
65 | + return $value; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @param $name |
|
70 | - * @param string|array $string |
|
71 | - * @param int $expire |
|
72 | - */ |
|
73 | - function newbbSetCookie($name, $string = '', $expire = 0) |
|
74 | - { |
|
75 | - global $forumCookie; |
|
76 | - if (is_array($string)) { |
|
77 | - $value = []; |
|
78 | - foreach ($string as $key => $val) { |
|
79 | - $value[] = $key . '|' . $val; |
|
80 | - } |
|
81 | - $string = implode(',', $value); |
|
82 | - } |
|
83 | - setcookie($forumCookie['prefix'] . $name, $string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); |
|
84 | - } |
|
68 | + /** |
|
69 | + * @param $name |
|
70 | + * @param string|array $string |
|
71 | + * @param int $expire |
|
72 | + */ |
|
73 | + function newbbSetCookie($name, $string = '', $expire = 0) |
|
74 | + { |
|
75 | + global $forumCookie; |
|
76 | + if (is_array($string)) { |
|
77 | + $value = []; |
|
78 | + foreach ($string as $key => $val) { |
|
79 | + $value[] = $key . '|' . $val; |
|
80 | + } |
|
81 | + $string = implode(',', $value); |
|
82 | + } |
|
83 | + setcookie($forumCookie['prefix'] . $name, $string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param $name |
|
88 | - * @param bool $isArray |
|
89 | - * @return array|null |
|
90 | - */ |
|
91 | - function newbbGetCookie($name, $isArray = false) |
|
92 | - { |
|
93 | - global $forumCookie; |
|
94 | - // $value = !empty($_COOKIE[$forumCookie['prefix'] . $name]) ? $_COOKIE[$forumCookie['prefix'] . $name] : null; |
|
95 | - $value = Request::getString($forumCookie['prefix'] . $name, null, 'COOKIE'); |
|
86 | + /** |
|
87 | + * @param $name |
|
88 | + * @param bool $isArray |
|
89 | + * @return array|null |
|
90 | + */ |
|
91 | + function newbbGetCookie($name, $isArray = false) |
|
92 | + { |
|
93 | + global $forumCookie; |
|
94 | + // $value = !empty($_COOKIE[$forumCookie['prefix'] . $name]) ? $_COOKIE[$forumCookie['prefix'] . $name] : null; |
|
95 | + $value = Request::getString($forumCookie['prefix'] . $name, null, 'COOKIE'); |
|
96 | 96 | |
97 | - if ($isArray) { |
|
98 | - $_value = $value ? explode(',', $value) : []; |
|
99 | - $value = []; |
|
100 | - if (count($_value) > 0) { |
|
101 | - foreach ($_value as $string) { |
|
102 | - $sep = strpos($string, '|'); |
|
103 | - if (false === $sep) { |
|
104 | - $value[] = $string; |
|
105 | - } else { |
|
106 | - $key = substr($string, 0, $sep); |
|
107 | - $val = substr($string, $sep + 1); |
|
108 | - $value[$key] = $val; |
|
109 | - } |
|
110 | - } |
|
111 | - } |
|
112 | - unset($_value); |
|
113 | - } |
|
97 | + if ($isArray) { |
|
98 | + $_value = $value ? explode(',', $value) : []; |
|
99 | + $value = []; |
|
100 | + if (count($_value) > 0) { |
|
101 | + foreach ($_value as $string) { |
|
102 | + $sep = strpos($string, '|'); |
|
103 | + if (false === $sep) { |
|
104 | + $value[] = $string; |
|
105 | + } else { |
|
106 | + $key = substr($string, 0, $sep); |
|
107 | + $val = substr($string, $sep + 1); |
|
108 | + $value[$key] = $val; |
|
109 | + } |
|
110 | + } |
|
111 | + } |
|
112 | + unset($_value); |
|
113 | + } |
|
114 | 114 | |
115 | - return $value; |
|
116 | - } |
|
115 | + return $value; |
|
116 | + } |
|
117 | 117 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15 | 15 | |
16 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
16 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
17 | 17 | define('NEWBB_FUNCTIONS_SESSION_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_SESSION')) { |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | if (is_array($string)) { |
35 | 35 | $value = []; |
36 | 36 | foreach ($string as $key => $val) { |
37 | - $value[] = $key . '|' . $val; |
|
37 | + $value[] = $key.'|'.$val; |
|
38 | 38 | } |
39 | 39 | $string = implode(',', $value); |
40 | 40 | } |
41 | - $_SESSION['newbb_' . $name] = $string; |
|
41 | + $_SESSION['newbb_'.$name] = $string; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function newbbGetSession($name, $isArray = false) |
50 | 50 | { |
51 | - $value = !empty($_SESSION['newbb_' . $name]) ? $_SESSION['newbb_' . $name] : false; |
|
51 | + $value = !empty($_SESSION['newbb_'.$name]) ? $_SESSION['newbb_'.$name] : false; |
|
52 | 52 | if ($isArray) { |
53 | 53 | $_value = $value ? explode(',', $value) : []; |
54 | 54 | $value = []; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | if (is_array($string)) { |
77 | 77 | $value = []; |
78 | 78 | foreach ($string as $key => $val) { |
79 | - $value[] = $key . '|' . $val; |
|
79 | + $value[] = $key.'|'.$val; |
|
80 | 80 | } |
81 | 81 | $string = implode(',', $value); |
82 | 82 | } |
83 | - setcookie($forumCookie['prefix'] . $name, $string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); |
|
83 | + setcookie($forumCookie['prefix'].$name, $string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | global $forumCookie; |
94 | 94 | // $value = !empty($_COOKIE[$forumCookie['prefix'] . $name]) ? $_COOKIE[$forumCookie['prefix'] . $name] : null; |
95 | - $value = Request::getString($forumCookie['prefix'] . $name, null, 'COOKIE'); |
|
95 | + $value = Request::getString($forumCookie['prefix'].$name, null, 'COOKIE'); |
|
96 | 96 | |
97 | 97 | if ($isArray) { |
98 | 98 | $_value = $value ? explode(',', $value) : []; |
@@ -69,161 +69,161 @@ |
||
69 | 69 | // uncomment to show text link instead of images (set to true) |
70 | 70 | $displayText[''] = //$displayText['blank'] = |
71 | 71 | |
72 | - //$displayText['attachment'] = |
|
73 | - //$displayText['whosonline'] = |
|
74 | - //$displayText['statistik'] = |
|
75 | - //$displayText['lastposticon'] = |
|
76 | - |
|
77 | - //$displayText['plus'] = |
|
78 | - //$displayText['minus'] = |
|
79 | - |
|
80 | - //$displayText['forum'] = |
|
81 | - //$displayText['forum_new'] = |
|
82 | - |
|
83 | - //$displayText['topic'] = |
|
84 | - //$displayText['topic_hot'] = |
|
85 | - //$displayText['topic_sticky'] = |
|
86 | - //$displayText['topic_digest'] = |
|
87 | - //$displayText['topic_locked'] = |
|
88 | - //$displayText['topic_new'] = |
|
89 | - //$displayText['topic_hot_new'] = |
|
90 | - //$displayText['topic_my'] = |
|
91 | - |
|
92 | - //$displayText['post'] = |
|
93 | - |
|
94 | - //$displayText['poll'] = |
|
95 | - //$displayText['rss'] = |
|
96 | - //$displayText['pdf'] = |
|
97 | - //$displayText['subforum'] = |
|
98 | - |
|
99 | - //$displayText['admin_move'] = |
|
100 | - //$displayText['admin_merge'] = |
|
101 | - //$displayText['admin_edit'] = |
|
102 | - //$displayText['admin_delete'] = |
|
103 | - |
|
104 | - //$displayText['document'] = |
|
105 | - |
|
106 | - //$displayText['previous'] = |
|
107 | - //$displayText['next'] = |
|
108 | - //$displayText['right'] = |
|
109 | - //$displayText['down'] = |
|
110 | - //$displayText['up'] = |
|
111 | - //$displayText['printer'] = |
|
112 | - //$displayText['new_forum'] = |
|
113 | - |
|
114 | - //$displayText['facebook'] = |
|
115 | - //$displayText['twitter'] = |
|
116 | - //$displayText['linkedin'] = |
|
117 | - //$displayText['googleplus'] = |
|
118 | - //$displayText['stumbleupon'] = |
|
119 | - //$displayText['friendfeed'] = |
|
120 | - //$displayText['digg'] = |
|
121 | - //$displayText['reddit'] = |
|
122 | - //$displayText['delicious'] = |
|
123 | - //$displayText['technorati'] = |
|
124 | - //$displayText['wong'] = |
|
125 | - //$displayText['anonym'] = |
|
126 | - //$displayText['more'] = |
|
127 | - //$displayText['less'] = |
|
72 | + //$displayText['attachment'] = |
|
73 | + //$displayText['whosonline'] = |
|
74 | + //$displayText['statistik'] = |
|
75 | + //$displayText['lastposticon'] = |
|
76 | + |
|
77 | + //$displayText['plus'] = |
|
78 | + //$displayText['minus'] = |
|
79 | + |
|
80 | + //$displayText['forum'] = |
|
81 | + //$displayText['forum_new'] = |
|
82 | + |
|
83 | + //$displayText['topic'] = |
|
84 | + //$displayText['topic_hot'] = |
|
85 | + //$displayText['topic_sticky'] = |
|
86 | + //$displayText['topic_digest'] = |
|
87 | + //$displayText['topic_locked'] = |
|
88 | + //$displayText['topic_new'] = |
|
89 | + //$displayText['topic_hot_new'] = |
|
90 | + //$displayText['topic_my'] = |
|
91 | + |
|
92 | + //$displayText['post'] = |
|
93 | + |
|
94 | + //$displayText['poll'] = |
|
95 | + //$displayText['rss'] = |
|
96 | + //$displayText['pdf'] = |
|
97 | + //$displayText['subforum'] = |
|
98 | + |
|
99 | + //$displayText['admin_move'] = |
|
100 | + //$displayText['admin_merge'] = |
|
101 | + //$displayText['admin_edit'] = |
|
102 | + //$displayText['admin_delete'] = |
|
103 | + |
|
104 | + //$displayText['document'] = |
|
105 | + |
|
106 | + //$displayText['previous'] = |
|
107 | + //$displayText['next'] = |
|
108 | + //$displayText['right'] = |
|
109 | + //$displayText['down'] = |
|
110 | + //$displayText['up'] = |
|
111 | + //$displayText['printer'] = |
|
112 | + //$displayText['new_forum'] = |
|
113 | + |
|
114 | + //$displayText['facebook'] = |
|
115 | + //$displayText['twitter'] = |
|
116 | + //$displayText['linkedin'] = |
|
117 | + //$displayText['googleplus'] = |
|
118 | + //$displayText['stumbleupon'] = |
|
119 | + //$displayText['friendfeed'] = |
|
120 | + //$displayText['digg'] = |
|
121 | + //$displayText['reddit'] = |
|
122 | + //$displayText['delicious'] = |
|
123 | + //$displayText['technorati'] = |
|
124 | + //$displayText['wong'] = |
|
125 | + //$displayText['anonym'] = |
|
126 | + //$displayText['more'] = |
|
127 | + //$displayText['less'] = |
|
128 | 128 | |
129 | 129 | $displayText['p_delete'] = $displayText['p_reply'] = $displayText['p_quote'] = $displayText['p_edit'] = $displayText['p_report'] = $displayText['t_new'] = $displayText['t_poll'] = $displayText['t_qr'] = $displayText['t_qr_expand'] = $displayText['t_reply'] = |
130 | 130 | |
131 | - //$displayText['online'] = |
|
132 | - //$displayText['offline'] = |
|
131 | + //$displayText['online'] = |
|
132 | + //$displayText['offline'] = |
|
133 | 133 | |
134 | - //$displayText['new_subforum'] = |
|
134 | + //$displayText['new_subforum'] = |
|
135 | 135 | |
136 | 136 | $displayText['p_bann'] = |
137 | 137 | |
138 | - true; |
|
138 | + true; |
|
139 | 139 | |
140 | 140 | for ($i = 1; $i <= 5; ++$i) { |
141 | - //$displayText['rate'.$i] = true; |
|
141 | + //$displayText['rate'.$i] = true; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // uncomment to show images instead of text links (set to false) |
145 | 145 | $displayText[''] = //$displayText['blank'] = |
146 | 146 | |
147 | - //$displayText['attachment'] = |
|
148 | - //$displayText['whosonline'] = |
|
149 | - //$displayText['statistik'] = |
|
150 | - //$displayText['lastposticon'] = |
|
151 | - |
|
152 | - //$displayText['plus'] = |
|
153 | - //$displayText['minus'] = |
|
154 | - |
|
155 | - //$displayText['forum'] = |
|
156 | - //$displayText['forum_new'] = |
|
157 | - |
|
158 | - //$displayText['topic'] = |
|
159 | - //$displayText['topic_hot'] = |
|
160 | - //$displayText['topic_sticky'] = |
|
161 | - //$displayText['topic_digest'] = |
|
162 | - //$displayText['topic_locked'] = |
|
163 | - //$displayText['topic_new'] = |
|
164 | - //$displayText['topic_hot_new'] = |
|
165 | - //$displayText['topic_my'] = |
|
166 | - |
|
167 | - //$displayText['post'] = |
|
168 | - |
|
169 | - //$displayText['poll'] = |
|
170 | - //$displayText['rss'] = |
|
171 | - //$displayText['pdf'] = |
|
172 | - //$displayText['subforum'] = |
|
173 | - |
|
174 | - //$displayText['admin_move'] = |
|
175 | - //$displayText['admin_merge'] = |
|
176 | - //$displayText['admin_edit'] = |
|
177 | - //$displayText['admin_delete'] = |
|
178 | - |
|
179 | - //$displayText['document'] = |
|
180 | - |
|
181 | - //$displayText['previous'] = |
|
182 | - //$displayText['next'] = |
|
183 | - //$displayText['right'] = |
|
184 | - //$displayText['down'] = |
|
185 | - //$displayText['up'] = |
|
186 | - //$displayText['printer'] = |
|
187 | - //$displayText['new_forum'] = |
|
188 | - |
|
189 | - //$displayText['facebook'] = |
|
190 | - //$displayText['twitter'] = |
|
191 | - //$displayText['linkedin'] = |
|
192 | - //$displayText['googleplus'] = |
|
193 | - //$displayText['stumbleupon'] = |
|
194 | - //$displayText['friendfeed'] = |
|
195 | - //$displayText['digg'] = |
|
196 | - //$displayText['reddit'] = |
|
197 | - //$displayText['delicious'] = |
|
198 | - //$displayText['technorati'] = |
|
199 | - //$displayText['wong'] = |
|
200 | - //$displayText['anonym'] = |
|
201 | - //$displayText['more'] = |
|
202 | - //$displayText['less'] = |
|
203 | - |
|
204 | - //$displayText['p_delete'] = |
|
205 | - //$displayText['p_reply'] = |
|
206 | - //$displayText['p_quote'] = |
|
207 | - //$displayText['p_edit'] = |
|
208 | - //$displayText['p_report'] = |
|
209 | - |
|
210 | - //$displayText['t_new'] = |
|
211 | - //$displayText['t_poll'] = |
|
212 | - //$displayText['t_qr'] = |
|
213 | - //$displayText['t_qr_expand'] = |
|
214 | - //$displayText['t_reply'] = |
|
215 | - |
|
216 | - //$displayText['online'] = |
|
217 | - //$displayText['offline'] = |
|
218 | - |
|
219 | - //$displayText['new_subforum'] = |
|
220 | - |
|
221 | - //$displayText['p_bann'] = |
|
222 | - |
|
223 | - false; |
|
147 | + //$displayText['attachment'] = |
|
148 | + //$displayText['whosonline'] = |
|
149 | + //$displayText['statistik'] = |
|
150 | + //$displayText['lastposticon'] = |
|
151 | + |
|
152 | + //$displayText['plus'] = |
|
153 | + //$displayText['minus'] = |
|
154 | + |
|
155 | + //$displayText['forum'] = |
|
156 | + //$displayText['forum_new'] = |
|
157 | + |
|
158 | + //$displayText['topic'] = |
|
159 | + //$displayText['topic_hot'] = |
|
160 | + //$displayText['topic_sticky'] = |
|
161 | + //$displayText['topic_digest'] = |
|
162 | + //$displayText['topic_locked'] = |
|
163 | + //$displayText['topic_new'] = |
|
164 | + //$displayText['topic_hot_new'] = |
|
165 | + //$displayText['topic_my'] = |
|
166 | + |
|
167 | + //$displayText['post'] = |
|
168 | + |
|
169 | + //$displayText['poll'] = |
|
170 | + //$displayText['rss'] = |
|
171 | + //$displayText['pdf'] = |
|
172 | + //$displayText['subforum'] = |
|
173 | + |
|
174 | + //$displayText['admin_move'] = |
|
175 | + //$displayText['admin_merge'] = |
|
176 | + //$displayText['admin_edit'] = |
|
177 | + //$displayText['admin_delete'] = |
|
178 | + |
|
179 | + //$displayText['document'] = |
|
180 | + |
|
181 | + //$displayText['previous'] = |
|
182 | + //$displayText['next'] = |
|
183 | + //$displayText['right'] = |
|
184 | + //$displayText['down'] = |
|
185 | + //$displayText['up'] = |
|
186 | + //$displayText['printer'] = |
|
187 | + //$displayText['new_forum'] = |
|
188 | + |
|
189 | + //$displayText['facebook'] = |
|
190 | + //$displayText['twitter'] = |
|
191 | + //$displayText['linkedin'] = |
|
192 | + //$displayText['googleplus'] = |
|
193 | + //$displayText['stumbleupon'] = |
|
194 | + //$displayText['friendfeed'] = |
|
195 | + //$displayText['digg'] = |
|
196 | + //$displayText['reddit'] = |
|
197 | + //$displayText['delicious'] = |
|
198 | + //$displayText['technorati'] = |
|
199 | + //$displayText['wong'] = |
|
200 | + //$displayText['anonym'] = |
|
201 | + //$displayText['more'] = |
|
202 | + //$displayText['less'] = |
|
203 | + |
|
204 | + //$displayText['p_delete'] = |
|
205 | + //$displayText['p_reply'] = |
|
206 | + //$displayText['p_quote'] = |
|
207 | + //$displayText['p_edit'] = |
|
208 | + //$displayText['p_report'] = |
|
209 | + |
|
210 | + //$displayText['t_new'] = |
|
211 | + //$displayText['t_poll'] = |
|
212 | + //$displayText['t_qr'] = |
|
213 | + //$displayText['t_qr_expand'] = |
|
214 | + //$displayText['t_reply'] = |
|
215 | + |
|
216 | + //$displayText['online'] = |
|
217 | + //$displayText['offline'] = |
|
218 | + |
|
219 | + //$displayText['new_subforum'] = |
|
220 | + |
|
221 | + //$displayText['p_bann'] = |
|
222 | + |
|
223 | + false; |
|
224 | 224 | |
225 | 225 | for ($i = 1; $i <= 5; ++$i) { |
226 | - //$displayText['rate'.$i] = false; |
|
226 | + //$displayText['rate'.$i] = false; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | return $displayText; |
@@ -15,35 +15,35 @@ |
||
15 | 15 | define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); |
16 | 16 | |
17 | 17 | if (!defined('NEWBB_FUNCTIONS_TOPIC')) { |
18 | - define('NEWBB_FUNCTIONS_TOPIC', 1); |
|
18 | + define('NEWBB_FUNCTIONS_TOPIC', 1); |
|
19 | 19 | |
20 | - /** |
|
21 | - * Create full title of a topic |
|
22 | - * |
|
23 | - * the title is composed of [type_name] if type_id is greater than 0 plus topic Title |
|
24 | - * @param $topicTitle |
|
25 | - * @param null $prefixName |
|
26 | - * @param null $prefixColor |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - function newbbGetTopicTitle($topicTitle, $prefixName = null, $prefixColor = null) |
|
30 | - { |
|
31 | - return getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null); |
|
32 | - } |
|
20 | + /** |
|
21 | + * Create full title of a topic |
|
22 | + * |
|
23 | + * the title is composed of [type_name] if type_id is greater than 0 plus topic Title |
|
24 | + * @param $topicTitle |
|
25 | + * @param null $prefixName |
|
26 | + * @param null $prefixColor |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + function newbbGetTopicTitle($topicTitle, $prefixName = null, $prefixColor = null) |
|
30 | + { |
|
31 | + return getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param $topicTitle |
|
36 | - * @param null $prefixName |
|
37 | - * @param null $prefixColor |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - function getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null) |
|
41 | - { |
|
42 | - if (empty($prefixName)) { |
|
43 | - return $topicTitle; |
|
44 | - } |
|
45 | - $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: ' . $prefixColor . ';">[' . $prefixName . ']</em> ' : '[' . $prefixName . '] '; |
|
34 | + /** |
|
35 | + * @param $topicTitle |
|
36 | + * @param null $prefixName |
|
37 | + * @param null $prefixColor |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + function getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null) |
|
41 | + { |
|
42 | + if (empty($prefixName)) { |
|
43 | + return $topicTitle; |
|
44 | + } |
|
45 | + $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: ' . $prefixColor . ';">[' . $prefixName . ']</em> ' : '[' . $prefixName . '] '; |
|
46 | 46 | |
47 | - return $topicPrefix . $topicTitle; |
|
48 | - } |
|
47 | + return $topicPrefix . $topicTitle; |
|
48 | + } |
|
49 | 49 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
13 | 13 | |
14 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
14 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
15 | 15 | define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); |
16 | 16 | |
17 | 17 | if (!defined('NEWBB_FUNCTIONS_TOPIC')) { |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | if (empty($prefixName)) { |
43 | 43 | return $topicTitle; |
44 | 44 | } |
45 | - $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: ' . $prefixColor . ';">[' . $prefixName . ']</em> ' : '[' . $prefixName . '] '; |
|
45 | + $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: '.$prefixColor.';">['.$prefixName.']</em> ' : '['.$prefixName.'] '; |
|
46 | 46 | |
47 | - return $topicPrefix . $topicTitle; |
|
47 | + return $topicPrefix.$topicTitle; |
|
48 | 48 | } |
49 | 49 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15 | 15 | |
16 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
16 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
17 | 17 | define('NEWBB_FUNCTIONS_FORUM_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_FORUM')) { |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $groups = $xoopsUser->getGroups(); |
41 | 41 | } |
42 | 42 | sort($groups); |
43 | - $groupKey = 'forumselect_' . $permission . '_' . md5(implode(',', $groups)); |
|
44 | - $forums = $cacheHelper->cacheRead($groupKey, function () use ($categories, $permission) { |
|
43 | + $groupKey = 'forumselect_'.$permission.'_'.md5(implode(',', $groups)); |
|
44 | + $forums = $cacheHelper->cacheRead($groupKey, function() use ($categories, $permission) { |
|
45 | 45 | /** @var Newbb\CategoryHandler $categoryHandler */ |
46 | 46 | $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
47 | 47 | $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($categoryDelimiter) { |
62 | 62 | $box .= "<option value=0> </option>\n"; |
63 | 63 | } |
64 | - $box .= "<option value='" . (-1 * $key) . "'>[" . $categories[$key]['cat_title'] . "]</option>\n"; |
|
64 | + $box .= "<option value='".(-1 * $key)."'>[".$categories[$key]['cat_title']."]</option>\n"; |
|
65 | 65 | if (empty($forums[$key])) { |
66 | 66 | continue; |
67 | 67 | } |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | if ($see && in_array($f, $value)) { |
70 | 70 | continue; |
71 | 71 | } |
72 | - $box .= "<option value='{$f}' " . (in_array($f, $value) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n"; |
|
72 | + $box .= "<option value='{$f}' ".(in_array($f, $value) ? ' selected' : '').'>'.$forum['prefix'].$forum['forum_name']."</option>\n"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } else { |
76 | - $box .= '<option value=0>' . _MD_NEWBB_NOFORUMINDB . "</option>\n"; |
|
76 | + $box .= '<option value=0>'._MD_NEWBB_NOFORUMINDB."</option>\n"; |
|
77 | 77 | } |
78 | 78 | unset($forums, $categories); |
79 | 79 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function newbbMakeJumpbox($forum_id = 0) |
88 | 88 | { |
89 | - $box = '<form name="forum_jumpbox" method="get" action="' . XOOPS_URL . '/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
89 | + $box = '<form name="forum_jumpbox" method="get" action="'.XOOPS_URL.'/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
90 | 90 | $box .= '<select class="select" name="forum" onchange="if (this.options[this.selectedIndex].value >0) { document.forms.forum_jumpbox.submit();}">'; |
91 | - $box .= '<option value=0>-- ' . _MD_NEWBB_SELFORUM . ' --</option>'; |
|
91 | + $box .= '<option value=0>-- '._MD_NEWBB_SELFORUM.' --</option>'; |
|
92 | 92 | $box .= newbbForumSelectBox($forum_id); |
93 | - $box .= "</select> <input type='submit' class='button' value='" . _GO . "' /></form>"; |
|
93 | + $box .= "</select> <input type='submit' class='button' value='"._GO."' /></form>"; |
|
94 | 94 | unset($forums, $categories); |
95 | 95 | |
96 | 96 | return $box; |
@@ -17,198 +17,198 @@ |
||
17 | 17 | define('NEWBB_FUNCTIONS_FORUM_LOADED', true); |
18 | 18 | |
19 | 19 | if (!defined('NEWBB_FUNCTIONS_FORUM')) { |
20 | - define('NEWBB_FUNCTIONS_FORUM', 1); |
|
21 | - |
|
22 | - /** |
|
23 | - * @param null|array $value selected forum id |
|
24 | - * @param string $permission permission (access, all, etc.) |
|
25 | - * @param bool $categoryDelimiter show delimiter between categories |
|
26 | - * @param bool $see |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - function newbbForumSelectBox($value = null, $permission = 'access', $categoryDelimiter = true, $see = false) |
|
30 | - { |
|
31 | - global $xoopsUser; |
|
32 | - /** @var Newbb\CategoryHandler $categoryHandler */ |
|
33 | - $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
34 | - $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
|
35 | - |
|
36 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
37 | - |
|
38 | - $groups = [XOOPS_GROUP_ANONYMOUS]; |
|
39 | - if (is_object($xoopsUser)) { |
|
40 | - $groups = $xoopsUser->getGroups(); |
|
41 | - } |
|
42 | - sort($groups); |
|
43 | - $groupKey = 'forumselect_' . $permission . '_' . md5(implode(',', $groups)); |
|
44 | - $forums = $cacheHelper->cacheRead($groupKey, function () use ($categories, $permission) { |
|
45 | - /** @var Newbb\CategoryHandler $categoryHandler */ |
|
46 | - $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
47 | - $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
|
48 | - |
|
49 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
50 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
51 | - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
52 | - |
|
53 | - return $forums; |
|
54 | - }, 300); |
|
55 | - |
|
56 | - $value = is_array($value) ? $value : [$value]; |
|
57 | - //$see = is_array($see) ? $see : array($see); |
|
58 | - $box = ''; |
|
59 | - if (count($forums) > 0) { |
|
60 | - foreach (array_keys($categories) as $key) { |
|
61 | - if ($categoryDelimiter) { |
|
62 | - $box .= "<option value=0> </option>\n"; |
|
63 | - } |
|
64 | - $box .= "<option value='" . (-1 * $key) . "'>[" . $categories[$key]['cat_title'] . "]</option>\n"; |
|
65 | - if (empty($forums[$key])) { |
|
66 | - continue; |
|
67 | - } |
|
68 | - foreach ($forums[$key] as $f => $forum) { |
|
69 | - if ($see && in_array($f, $value)) { |
|
70 | - continue; |
|
71 | - } |
|
72 | - $box .= "<option value='{$f}' " . (in_array($f, $value) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n"; |
|
73 | - } |
|
74 | - } |
|
75 | - } else { |
|
76 | - $box .= '<option value=0>' . _MD_NEWBB_NOFORUMINDB . "</option>\n"; |
|
77 | - } |
|
78 | - unset($forums, $categories); |
|
79 | - |
|
80 | - return $box; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @param int $forum_id |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - function newbbMakeJumpbox($forum_id = 0) |
|
88 | - { |
|
89 | - $box = '<form name="forum_jumpbox" method="get" action="' . XOOPS_URL . '/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
90 | - $box .= '<select class="select" name="forum" onchange="if (this.options[this.selectedIndex].value >0) { document.forms.forum_jumpbox.submit();}">'; |
|
91 | - $box .= '<option value=0>-- ' . _MD_NEWBB_SELFORUM . ' --</option>'; |
|
92 | - $box .= newbbForumSelectBox($forum_id); |
|
93 | - $box .= "</select> <input type='submit' class='button' value='" . _GO . "' /></form>"; |
|
94 | - unset($forums, $categories); |
|
95 | - |
|
96 | - return $box; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Get structured forums |
|
101 | - * |
|
102 | - * This is a temporary solution |
|
103 | - * To be substituted with a new tree handler |
|
104 | - * |
|
105 | - * @int integer $pid parent forum ID |
|
106 | - * |
|
107 | - * @param int $pid |
|
108 | - * @param bool $refresh |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - function newbbGetSubForum($pid = 0, $refresh = false) |
|
112 | - { |
|
113 | - static $list; |
|
114 | - if (null === $list) { |
|
115 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
116 | - $list = $cacheHelper->read('forum_sub'); |
|
117 | - } |
|
118 | - |
|
119 | - if (!is_array($list) || $refresh) { |
|
120 | - $list = newbbCreateSubForumList(); |
|
121 | - } |
|
122 | - if (0 == $pid) { |
|
123 | - return $list; |
|
124 | - } else { |
|
125 | - return @$list[$pid]; |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @return array |
|
131 | - */ |
|
132 | - function newbbCreateSubForumList() |
|
133 | - { |
|
134 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
20 | + define('NEWBB_FUNCTIONS_FORUM', 1); |
|
21 | + |
|
22 | + /** |
|
23 | + * @param null|array $value selected forum id |
|
24 | + * @param string $permission permission (access, all, etc.) |
|
25 | + * @param bool $categoryDelimiter show delimiter between categories |
|
26 | + * @param bool $see |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + function newbbForumSelectBox($value = null, $permission = 'access', $categoryDelimiter = true, $see = false) |
|
30 | + { |
|
31 | + global $xoopsUser; |
|
32 | + /** @var Newbb\CategoryHandler $categoryHandler */ |
|
33 | + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
34 | + $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
|
35 | + |
|
36 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
37 | + |
|
38 | + $groups = [XOOPS_GROUP_ANONYMOUS]; |
|
39 | + if (is_object($xoopsUser)) { |
|
40 | + $groups = $xoopsUser->getGroups(); |
|
41 | + } |
|
42 | + sort($groups); |
|
43 | + $groupKey = 'forumselect_' . $permission . '_' . md5(implode(',', $groups)); |
|
44 | + $forums = $cacheHelper->cacheRead($groupKey, function () use ($categories, $permission) { |
|
45 | + /** @var Newbb\CategoryHandler $categoryHandler */ |
|
46 | + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
47 | + $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); |
|
48 | + |
|
49 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
50 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
51 | + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
52 | + |
|
53 | + return $forums; |
|
54 | + }, 300); |
|
55 | + |
|
56 | + $value = is_array($value) ? $value : [$value]; |
|
57 | + //$see = is_array($see) ? $see : array($see); |
|
58 | + $box = ''; |
|
59 | + if (count($forums) > 0) { |
|
60 | + foreach (array_keys($categories) as $key) { |
|
61 | + if ($categoryDelimiter) { |
|
62 | + $box .= "<option value=0> </option>\n"; |
|
63 | + } |
|
64 | + $box .= "<option value='" . (-1 * $key) . "'>[" . $categories[$key]['cat_title'] . "]</option>\n"; |
|
65 | + if (empty($forums[$key])) { |
|
66 | + continue; |
|
67 | + } |
|
68 | + foreach ($forums[$key] as $f => $forum) { |
|
69 | + if ($see && in_array($f, $value)) { |
|
70 | + continue; |
|
71 | + } |
|
72 | + $box .= "<option value='{$f}' " . (in_array($f, $value) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n"; |
|
73 | + } |
|
74 | + } |
|
75 | + } else { |
|
76 | + $box .= '<option value=0>' . _MD_NEWBB_NOFORUMINDB . "</option>\n"; |
|
77 | + } |
|
78 | + unset($forums, $categories); |
|
79 | + |
|
80 | + return $box; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @param int $forum_id |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + function newbbMakeJumpbox($forum_id = 0) |
|
88 | + { |
|
89 | + $box = '<form name="forum_jumpbox" method="get" action="' . XOOPS_URL . '/modules/newbb/viewforum.php" onsubmit="javascript: if (document.forum_jumpbox.forum.value < 1) {return false;}">'; |
|
90 | + $box .= '<select class="select" name="forum" onchange="if (this.options[this.selectedIndex].value >0) { document.forms.forum_jumpbox.submit();}">'; |
|
91 | + $box .= '<option value=0>-- ' . _MD_NEWBB_SELFORUM . ' --</option>'; |
|
92 | + $box .= newbbForumSelectBox($forum_id); |
|
93 | + $box .= "</select> <input type='submit' class='button' value='" . _GO . "' /></form>"; |
|
94 | + unset($forums, $categories); |
|
95 | + |
|
96 | + return $box; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Get structured forums |
|
101 | + * |
|
102 | + * This is a temporary solution |
|
103 | + * To be substituted with a new tree handler |
|
104 | + * |
|
105 | + * @int integer $pid parent forum ID |
|
106 | + * |
|
107 | + * @param int $pid |
|
108 | + * @param bool $refresh |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + function newbbGetSubForum($pid = 0, $refresh = false) |
|
112 | + { |
|
113 | + static $list; |
|
114 | + if (null === $list) { |
|
115 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
116 | + $list = $cacheHelper->read('forum_sub'); |
|
117 | + } |
|
118 | + |
|
119 | + if (!is_array($list) || $refresh) { |
|
120 | + $list = newbbCreateSubForumList(); |
|
121 | + } |
|
122 | + if (0 == $pid) { |
|
123 | + return $list; |
|
124 | + } else { |
|
125 | + return @$list[$pid]; |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @return array |
|
131 | + */ |
|
132 | + function newbbCreateSubForumList() |
|
133 | + { |
|
134 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
135 | 135 | // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
136 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
137 | - $criteria = new \CriteriaCompo(null, 1); |
|
138 | - $criteria->setSort('cat_id ASC, parent_forum ASC, forum_order'); |
|
139 | - $criteria->setOrder('ASC'); |
|
140 | - $forumsObject = $forumHandler->getObjects($criteria); |
|
136 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
137 | + $criteria = new \CriteriaCompo(null, 1); |
|
138 | + $criteria->setSort('cat_id ASC, parent_forum ASC, forum_order'); |
|
139 | + $criteria->setOrder('ASC'); |
|
140 | + $forumsObject = $forumHandler->getObjects($criteria); |
|
141 | 141 | // require_once $GLOBALS['xoops']->path('modules/newbb/class/Tree.php'); |
142 | - $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); |
|
143 | - $forum_array = []; |
|
144 | - foreach (array_keys($forumsObject) as $key) { |
|
145 | - if (!$child = array_keys($tree->getAllChild($forumsObject[$key]->getVar('forum_id')))) { |
|
146 | - continue; |
|
147 | - } |
|
148 | - $forum_array[$forumsObject[$key]->getVar('forum_id')] = $child; |
|
149 | - } |
|
150 | - unset($forumsObject, $tree, $criteria); |
|
151 | - |
|
152 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
153 | - $cacheHelper->write('forum_sub', $forum_array); |
|
154 | - |
|
155 | - return $forum_array; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @param int $forum_id |
|
160 | - * @param bool $refresh |
|
161 | - * @return array|mixed|null |
|
162 | - */ |
|
163 | - function newbbGetParentForum($forum_id = 0, $refresh = false) |
|
164 | - { |
|
165 | - static $list = null; |
|
166 | - |
|
167 | - if (null === $list) { |
|
168 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
169 | - $list = $cacheHelper->read('forum_parent'); |
|
170 | - } |
|
171 | - if (!is_array($list) || $refresh) { |
|
172 | - $list = newbbCreateParentForumList(); |
|
173 | - } |
|
174 | - if (0 == $forum_id) { |
|
175 | - return $list; |
|
176 | - } else { |
|
177 | - return @$list[$forum_id]; |
|
178 | - } |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * @return array |
|
183 | - */ |
|
184 | - function newbbCreateParentForumList() |
|
185 | - { |
|
186 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
187 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
188 | - $criteria = new \Criteria('1', 1); |
|
189 | - $criteria->setSort('parent_forum'); |
|
190 | - $criteria->setOrder('ASC'); |
|
191 | - $forumsObject = $forumHandler->getObjects($criteria); |
|
142 | + $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); |
|
143 | + $forum_array = []; |
|
144 | + foreach (array_keys($forumsObject) as $key) { |
|
145 | + if (!$child = array_keys($tree->getAllChild($forumsObject[$key]->getVar('forum_id')))) { |
|
146 | + continue; |
|
147 | + } |
|
148 | + $forum_array[$forumsObject[$key]->getVar('forum_id')] = $child; |
|
149 | + } |
|
150 | + unset($forumsObject, $tree, $criteria); |
|
151 | + |
|
152 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
153 | + $cacheHelper->write('forum_sub', $forum_array); |
|
154 | + |
|
155 | + return $forum_array; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @param int $forum_id |
|
160 | + * @param bool $refresh |
|
161 | + * @return array|mixed|null |
|
162 | + */ |
|
163 | + function newbbGetParentForum($forum_id = 0, $refresh = false) |
|
164 | + { |
|
165 | + static $list = null; |
|
166 | + |
|
167 | + if (null === $list) { |
|
168 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
169 | + $list = $cacheHelper->read('forum_parent'); |
|
170 | + } |
|
171 | + if (!is_array($list) || $refresh) { |
|
172 | + $list = newbbCreateParentForumList(); |
|
173 | + } |
|
174 | + if (0 == $forum_id) { |
|
175 | + return $list; |
|
176 | + } else { |
|
177 | + return @$list[$forum_id]; |
|
178 | + } |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * @return array |
|
183 | + */ |
|
184 | + function newbbCreateParentForumList() |
|
185 | + { |
|
186 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
187 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
188 | + $criteria = new \Criteria('1', 1); |
|
189 | + $criteria->setSort('parent_forum'); |
|
190 | + $criteria->setOrder('ASC'); |
|
191 | + $forumsObject = $forumHandler->getObjects($criteria); |
|
192 | 192 | // require_once $GLOBALS['xoops']->path('modules/newbb/class/Tree.php'); |
193 | - $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); |
|
194 | - $forum_array = []; |
|
195 | - foreach (array_keys($forumsObject) as $key) { |
|
196 | - $parent_forum = $forumsObject[$key]->getVar('parent_forum'); |
|
197 | - if (!$parent_forum) { |
|
198 | - continue; |
|
199 | - } |
|
200 | - if (isset($forum_array[$parent_forum])) { |
|
201 | - $forum_array[$forumsObject[$key]->getVar('forum_id')] = $forum_array[$parent_forum]; |
|
202 | - $forum_array[$forumsObject[$key]->getVar('forum_id')][] = $parent_forum; |
|
203 | - } else { |
|
204 | - $forum_array[$forumsObject[$key]->getVar('forum_id')] = $tree->getParentForums($forumsObject[$key]->getVar('forum_id')); |
|
205 | - } |
|
206 | - } |
|
207 | - unset($forumsObject, $tree, $criteria); |
|
208 | - |
|
209 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
210 | - $cacheHelper->write('forum_parent', $forum_array); |
|
211 | - |
|
212 | - return $forum_array; |
|
213 | - } |
|
193 | + $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); |
|
194 | + $forum_array = []; |
|
195 | + foreach (array_keys($forumsObject) as $key) { |
|
196 | + $parent_forum = $forumsObject[$key]->getVar('parent_forum'); |
|
197 | + if (!$parent_forum) { |
|
198 | + continue; |
|
199 | + } |
|
200 | + if (isset($forum_array[$parent_forum])) { |
|
201 | + $forum_array[$forumsObject[$key]->getVar('forum_id')] = $forum_array[$parent_forum]; |
|
202 | + $forum_array[$forumsObject[$key]->getVar('forum_id')][] = $parent_forum; |
|
203 | + } else { |
|
204 | + $forum_array[$forumsObject[$key]->getVar('forum_id')] = $tree->getParentForums($forumsObject[$key]->getVar('forum_id')); |
|
205 | + } |
|
206 | + } |
|
207 | + unset($forumsObject, $tree, $criteria); |
|
208 | + |
|
209 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
210 | + $cacheHelper->write('forum_parent', $forum_array); |
|
211 | + |
|
212 | + return $forum_array; |
|
213 | + } |
|
214 | 214 | } |