Passed
Push — master ( 565d4a...492cc7 )
by Michael
07:40
created
include/functions.forum.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -17,198 +17,198 @@
 block discarded – undo
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>&nbsp;</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 &lt; 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>&nbsp;</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 &lt; 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
 }
Please login to merge, or discard this patch.
include/config.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 $moduleDirName = basename(dirname(__DIR__));
23 23
 $uploadFolders = [
24
-    NEWBB_UPLOAD_PATH,
25
-    NEWBB_UPLOAD_PATH . '/thumbs'
24
+	NEWBB_UPLOAD_PATH,
25
+	NEWBB_UPLOAD_PATH . '/thumbs'
26 26
 ];
27 27
 
28 28
 /**
@@ -30,83 +30,83 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function getConfig()
32 32
 {
33
-    $moduleDirName      = basename(dirname(__DIR__));
34
-    $moduleDirNameUpper = strtoupper($moduleDirName);
35
-    return (object)[
36
-        'name'           => strtoupper($moduleDirName) . ' Module Configurator',
37
-        'paths'          => [
38
-            'dirname'    => $moduleDirName,
39
-            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
40
-            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
41
-            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
42
-            'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
43
-            'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
44
-        ],
45
-        'uploadFolders'  => [
46
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
47
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
33
+	$moduleDirName      = basename(dirname(__DIR__));
34
+	$moduleDirNameUpper = strtoupper($moduleDirName);
35
+	return (object)[
36
+		'name'           => strtoupper($moduleDirName) . ' Module Configurator',
37
+		'paths'          => [
38
+			'dirname'    => $moduleDirName,
39
+			'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
40
+			'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
41
+			'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
42
+			'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
43
+			'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
44
+		],
45
+		'uploadFolders'  => [
46
+			constant($moduleDirNameUpper . '_UPLOAD_PATH'),
47
+			constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
48 48
 
49
-            //XOOPS_UPLOAD_PATH . '/flags'
50
-        ],
51
-        'copyBlankFiles' => [
52
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
53
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
54
-            //XOOPS_UPLOAD_PATH . '/flags'
55
-        ],
49
+			//XOOPS_UPLOAD_PATH . '/flags'
50
+		],
51
+		'copyBlankFiles' => [
52
+			constant($moduleDirNameUpper . '_UPLOAD_PATH'),
53
+			constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
54
+			//XOOPS_UPLOAD_PATH . '/flags'
55
+		],
56 56
 
57
-        'copyTestFolders' => [
58
-            //        constant($moduleDirNameUpper . '_UPLOAD_PATH'),
59
-            //[
60
-            //    constant($moduleDirNameUpper . '_PATH') . '/testdata/images',
61
-            //    constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images',
62
-            //]
63
-        ],
57
+		'copyTestFolders' => [
58
+			//        constant($moduleDirNameUpper . '_UPLOAD_PATH'),
59
+			//[
60
+			//    constant($moduleDirNameUpper . '_PATH') . '/testdata/images',
61
+			//    constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images',
62
+			//]
63
+		],
64 64
 
65
-        'templateFolders' => [
66
-            '/templates/',
67
-            '/templates/blocks/',
68
-            '/templates/admin/'
65
+		'templateFolders' => [
66
+			'/templates/',
67
+			'/templates/blocks/',
68
+			'/templates/admin/'
69 69
 
70
-        ],
71
-        'oldFiles'        => [
72
-            '/class/request.php',
73
-            '/class/registry.php',
74
-            '/class/utilities.php',
75
-            '/class/util.php',
76
-            // '/include/constants.php',
77
-            // '/include/functions.php',
78
-            '/ajaxrating.txt',
79
-        ],
80
-        'oldFolders'      => [
81
-            '/images',
82
-            '/css',
83
-            '/js',
84
-            '/tcpdf',
85
-            '/images',
86
-        ],
70
+		],
71
+		'oldFiles'        => [
72
+			'/class/request.php',
73
+			'/class/registry.php',
74
+			'/class/utilities.php',
75
+			'/class/util.php',
76
+			// '/include/constants.php',
77
+			// '/include/functions.php',
78
+			'/ajaxrating.txt',
79
+		],
80
+		'oldFolders'      => [
81
+			'/images',
82
+			'/css',
83
+			'/js',
84
+			'/tcpdf',
85
+			'/images',
86
+		],
87 87
 
88
-        'renameTables' => [
89
-            'bb_archive'     => 'newbb_archive',
90
-            'bb_categories'  => 'newbb_categories',
91
-            'bb_votedata'    => 'newbb_votedata',
92
-            'bb_forums'      => 'newbb_forums',
93
-            'bb_posts'       => 'newbb_posts',
94
-            'bb_posts_text'  => 'newbb_posts_text',
95
-            'bb_topics'      => 'newbb_topics',
96
-            'bb_online'      => 'newbb_online',
97
-            'bb_digest'      => 'newbb_digest',
98
-            'bb_report'      => 'newbb_report',
99
-            'bb_attachments' => 'newbb_attachments',
100
-            'bb_moderates'   => 'newbb_moderates',
101
-            'bb_reads_forum' => 'newbb_reads_forum',
102
-            'bb_reads_topic' => 'newbb_reads_topic',
103
-            'bb_type'        => 'newbb_type',
104
-            'bb_type_forum'  => 'newbb_type_forum',
105
-            'bb_stats'       => 'newbb_stats',
106
-            'bb_user_stats'  => 'newbb_user_stats',
107
-        ],
88
+		'renameTables' => [
89
+			'bb_archive'     => 'newbb_archive',
90
+			'bb_categories'  => 'newbb_categories',
91
+			'bb_votedata'    => 'newbb_votedata',
92
+			'bb_forums'      => 'newbb_forums',
93
+			'bb_posts'       => 'newbb_posts',
94
+			'bb_posts_text'  => 'newbb_posts_text',
95
+			'bb_topics'      => 'newbb_topics',
96
+			'bb_online'      => 'newbb_online',
97
+			'bb_digest'      => 'newbb_digest',
98
+			'bb_report'      => 'newbb_report',
99
+			'bb_attachments' => 'newbb_attachments',
100
+			'bb_moderates'   => 'newbb_moderates',
101
+			'bb_reads_forum' => 'newbb_reads_forum',
102
+			'bb_reads_topic' => 'newbb_reads_topic',
103
+			'bb_type'        => 'newbb_type',
104
+			'bb_type_forum'  => 'newbb_type_forum',
105
+			'bb_stats'       => 'newbb_stats',
106
+			'bb_user_stats'  => 'newbb_user_stats',
107
+		],
108 108
 
109
-        'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
109
+		'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
110 110
                      <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>',
111
-    ];
111
+	];
112 112
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $moduleDirName = basename(dirname(__DIR__));
23 23
 $uploadFolders = [
24 24
     NEWBB_UPLOAD_PATH,
25
-    NEWBB_UPLOAD_PATH . '/thumbs'
25
+    NEWBB_UPLOAD_PATH.'/thumbs'
26 26
 ];
27 27
 
28 28
 /**
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
     $moduleDirName      = basename(dirname(__DIR__));
34 34
     $moduleDirNameUpper = strtoupper($moduleDirName);
35 35
     return (object)[
36
-        'name'           => strtoupper($moduleDirName) . ' Module Configurator',
36
+        'name'           => strtoupper($moduleDirName).' Module Configurator',
37 37
         'paths'          => [
38 38
             'dirname'    => $moduleDirName,
39
-            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
40
-            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
41
-            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
42
-            'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
43
-            'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
39
+            'admin'      => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/admin',
40
+            'modPath'    => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName,
41
+            'modUrl'     => XOOPS_URL.'/modules/'.$moduleDirName,
42
+            'uploadPath' => XOOPS_UPLOAD_PATH.'/'.$moduleDirName,
43
+            'uploadUrl'  => XOOPS_UPLOAD_URL.'/'.$moduleDirName,
44 44
         ],
45 45
         'uploadFolders'  => [
46
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
47
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
46
+            constant($moduleDirNameUpper.'_UPLOAD_PATH'),
47
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/thumbs',
48 48
 
49 49
             //XOOPS_UPLOAD_PATH . '/flags'
50 50
         ],
51 51
         'copyBlankFiles' => [
52
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
53
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
52
+            constant($moduleDirNameUpper.'_UPLOAD_PATH'),
53
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/thumbs',
54 54
             //XOOPS_UPLOAD_PATH . '/flags'
55 55
         ],
56 56
 
@@ -107,6 +107,6 @@  discard block
 block discarded – undo
107 107
         ],
108 108
 
109 109
         'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
110
-                     <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>',
110
+                     <img src='" . constant($moduleDirNameUpper.'_AUTHOR_LOGOIMG').'\' alt=\'XOOPS Project\' /></a>',
111 111
     ];
112 112
 }
Please login to merge, or discard this patch.
include/search.inc.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -28,119 +28,119 @@
 block discarded – undo
28 28
  * @return array
29 29
  */
30 30
 function newbb_search(
31
-    $queryarray,
32
-    $andor,
33
-    $limit,
34
-    $offset,
35
-    $userid,
36
-    $forums = 0,
37
-    $sortby = 0,
38
-    $searchin = 'both',
39
-    CriteriaCompo $criteriaExtra = null
31
+	$queryarray,
32
+	$andor,
33
+	$limit,
34
+	$offset,
35
+	$userid,
36
+	$forums = 0,
37
+	$sortby = 0,
38
+	$searchin = 'both',
39
+	CriteriaCompo $criteriaExtra = null
40 40
 ) {
41
-    global $myts, $xoopsDB;
42
-    // irmtfan - in XOOPSCORE/search.php $GLOBALS['xoopsModuleConfig'] is not set
43
-    if (!isset($GLOBALS['xoopsModuleConfig'])) {
44
-        $GLOBALS['xoopsModuleConfig'] = newbbLoadConfig();
45
-    }
46
-    // irmtfan - in XOOPSCORE/search.php $xoopsModule is not set
47
-    if (!is_object($GLOBALS['xoopsModule']) && is_object($GLOBALS['module'])
48
-        && 'newbb' === $GLOBALS['module']->getVar('dirname')) {
49
-        $GLOBALS['xoopsModule'] = $GLOBALS['module'];
50
-    }
51
-    /** @var Newbb\ForumHandler $forumHandler */
52
-    $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
53
-    $validForums  = $forumHandler->getIdsByValues($forums); // can we use view permission? $forumHandler->getIdsByValues($forums, "view")
41
+	global $myts, $xoopsDB;
42
+	// irmtfan - in XOOPSCORE/search.php $GLOBALS['xoopsModuleConfig'] is not set
43
+	if (!isset($GLOBALS['xoopsModuleConfig'])) {
44
+		$GLOBALS['xoopsModuleConfig'] = newbbLoadConfig();
45
+	}
46
+	// irmtfan - in XOOPSCORE/search.php $xoopsModule is not set
47
+	if (!is_object($GLOBALS['xoopsModule']) && is_object($GLOBALS['module'])
48
+		&& 'newbb' === $GLOBALS['module']->getVar('dirname')) {
49
+		$GLOBALS['xoopsModule'] = $GLOBALS['module'];
50
+	}
51
+	/** @var Newbb\ForumHandler $forumHandler */
52
+	$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum');
53
+	$validForums  = $forumHandler->getIdsByValues($forums); // can we use view permission? $forumHandler->getIdsByValues($forums, "view")
54 54
 
55
-    $criteriaPost = new \CriteriaCompo();
56
-    $criteriaPost->add(new \Criteria('p.approved', 1), 'AND'); // only active posts
55
+	$criteriaPost = new \CriteriaCompo();
56
+	$criteriaPost->add(new \Criteria('p.approved', 1), 'AND'); // only active posts
57 57
 
58
-    $forum_list = [];// get forum lists just for forum names
59
-    if (count($validForums) > 0) {
60
-        $criteriaPermissions = new \CriteriaCompo();
61
-        $criteriaPermissions->add(new \Criteria('p.forum_id', '(' . implode(',', $validForums) . ')', 'IN'), 'AND');
62
-        $forum_list = $forumHandler->getAll(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN'), 'forum_name', false);
63
-    }
58
+	$forum_list = [];// get forum lists just for forum names
59
+	if (count($validForums) > 0) {
60
+		$criteriaPermissions = new \CriteriaCompo();
61
+		$criteriaPermissions->add(new \Criteria('p.forum_id', '(' . implode(',', $validForums) . ')', 'IN'), 'AND');
62
+		$forum_list = $forumHandler->getAll(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN'), 'forum_name', false);
63
+	}
64 64
 
65
-    if (is_numeric($userid) && 0 !== $userid) {
66
-        $criteriaUser = new \CriteriaCompo();
67
-        $criteriaUser->add(new \Criteria('p.uid', $userid), 'OR');
68
-    } elseif (is_array($userid) && count($userid) > 0) {
69
-        $userid       = array_map('intval', $userid);
70
-        $criteriaUser = new \CriteriaCompo();
71
-        $criteriaUser->add(new \Criteria('p.uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR');
72
-    }
65
+	if (is_numeric($userid) && 0 !== $userid) {
66
+		$criteriaUser = new \CriteriaCompo();
67
+		$criteriaUser->add(new \Criteria('p.uid', $userid), 'OR');
68
+	} elseif (is_array($userid) && count($userid) > 0) {
69
+		$userid       = array_map('intval', $userid);
70
+		$criteriaUser = new \CriteriaCompo();
71
+		$criteriaUser->add(new \Criteria('p.uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR');
72
+	}
73 73
 
74
-    $count = 0;
75
-    if (is_array($queryarray)) {
76
-        $count = count($queryarray);
77
-    }
78
-    $highlightKey = '';
79
-    if ($count > 0) {
80
-        $criteriaKeywords = new \CriteriaCompo();
81
-        foreach ($queryarray as $queryTerm) {
82
-            $termCriteria  = new \CriteriaCompo();
83
-            $queryTermLike = '%' . $xoopsDB->escape($queryTerm) . '%';
84
-            if ('title' === $searchin || 'both' === $searchin) {
85
-                $termCriteria->add(new \Criteria('p.subject', $queryTermLike, 'LIKE'), 'OR');
86
-            }
87
-            if ('text' === $searchin || 'both' === $searchin) {
88
-                $termCriteria->add(new \Criteria('t.post_text', $queryTermLike, 'LIKE'), 'OR');
89
-            }
90
-            $criteriaKeywords->add($termCriteria, $andor);
91
-        }
92
-        // add highlight keywords to post links
93
-        $highlightKey = '&amp;keywords=' . implode(' ', $queryarray);
94
-        $highlightKey = str_replace(' ', '+', $highlightKey);
95
-    }
96
-    $criteria = new \CriteriaCompo();
97
-    $criteria->add($criteriaPost, 'AND');
98
-    if (null !== $criteriaPermissions) {
99
-        $criteria->add($criteriaPermissions, 'AND');
100
-    }
101
-    if (isset($criteriaUser)) {
102
-        $criteria->add($criteriaUser, 'AND');
103
-    }
104
-    if (isset($criteriaKeywords)) {
105
-        $criteria->add($criteriaKeywords, 'AND');
106
-    }
107
-    if (isset($criteriaExtra)) {
108
-        $criteria->add($criteriaExtra, 'AND');
109
-    }
110
-    //$criteria->setLimit($limit); // no need for this
111
-    //$criteria->setStart($offset); // no need for this
74
+	$count = 0;
75
+	if (is_array($queryarray)) {
76
+		$count = count($queryarray);
77
+	}
78
+	$highlightKey = '';
79
+	if ($count > 0) {
80
+		$criteriaKeywords = new \CriteriaCompo();
81
+		foreach ($queryarray as $queryTerm) {
82
+			$termCriteria  = new \CriteriaCompo();
83
+			$queryTermLike = '%' . $xoopsDB->escape($queryTerm) . '%';
84
+			if ('title' === $searchin || 'both' === $searchin) {
85
+				$termCriteria->add(new \Criteria('p.subject', $queryTermLike, 'LIKE'), 'OR');
86
+			}
87
+			if ('text' === $searchin || 'both' === $searchin) {
88
+				$termCriteria->add(new \Criteria('t.post_text', $queryTermLike, 'LIKE'), 'OR');
89
+			}
90
+			$criteriaKeywords->add($termCriteria, $andor);
91
+		}
92
+		// add highlight keywords to post links
93
+		$highlightKey = '&amp;keywords=' . implode(' ', $queryarray);
94
+		$highlightKey = str_replace(' ', '+', $highlightKey);
95
+	}
96
+	$criteria = new \CriteriaCompo();
97
+	$criteria->add($criteriaPost, 'AND');
98
+	if (null !== $criteriaPermissions) {
99
+		$criteria->add($criteriaPermissions, 'AND');
100
+	}
101
+	if (isset($criteriaUser)) {
102
+		$criteria->add($criteriaUser, 'AND');
103
+	}
104
+	if (isset($criteriaKeywords)) {
105
+		$criteria->add($criteriaKeywords, 'AND');
106
+	}
107
+	if (isset($criteriaExtra)) {
108
+		$criteria->add($criteriaExtra, 'AND');
109
+	}
110
+	//$criteria->setLimit($limit); // no need for this
111
+	//$criteria->setStart($offset); // no need for this
112 112
 
113
-    if (empty($sortby)) {
114
-        $sortby = 'p.post_time';
115
-    }
116
-    $criteria->setSort($sortby);
117
-    $order = 'ASC';
118
-    if ('p.post_time' === $sortby) {
119
-        $order = 'DESC';
120
-    }
121
-    $criteria->setOrder($order);
113
+	if (empty($sortby)) {
114
+		$sortby = 'p.post_time';
115
+	}
116
+	$criteria->setSort($sortby);
117
+	$order = 'ASC';
118
+	if ('p.post_time' === $sortby) {
119
+		$order = 'DESC';
120
+	}
121
+	$criteria->setOrder($order);
122 122
 
123
-    /** @var Newbb\PostHandler $postHandler */
124
-    $postHandler = Newbb\Helper::getInstance()->getHandler('Post');
125
-    $posts       = $postHandler->getPostsByLimit($criteria, $limit, $offset);
123
+	/** @var Newbb\PostHandler $postHandler */
124
+	$postHandler = Newbb\Helper::getInstance()->getHandler('Post');
125
+	$posts       = $postHandler->getPostsByLimit($criteria, $limit, $offset);
126 126
 
127
-    $ret = [];
128
-    $i   = 0;
129
-    foreach (array_keys($posts) as $id) {
130
-        /** @var Newbb\Post $post */
131
-        $post                  = $posts[$id];
132
-        $post_data             = $post->getPostBody();
133
-        $ret[$i]['topic_id']   = $post->getVar('topic_id');
134
-        $ret[$i]['link']       = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post->getVar('post_id') . $highlightKey; // add highlight key
135
-        $ret[$i]['title']      = $post_data['subject'];
136
-        $ret[$i]['time']       = $post_data['date'];
137
-        $ret[$i]['forum_name'] = $myts->htmlSpecialChars($forum_list[$post->getVar('forum_id')]['forum_name']);
138
-        $ret[$i]['forum_link'] = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $post->getVar('forum_id');
139
-        $ret[$i]['post_text']  = $post_data['text'];
140
-        $ret[$i]['uid']        = $post->getVar('uid');
141
-        $ret[$i]['poster']     = $post->getVar('uid') ? '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $ret[$i]['uid'] . '">' . $post_data['author'] . '</a>' : $post_data['author'];
142
-        ++$i;
143
-    }
127
+	$ret = [];
128
+	$i   = 0;
129
+	foreach (array_keys($posts) as $id) {
130
+		/** @var Newbb\Post $post */
131
+		$post                  = $posts[$id];
132
+		$post_data             = $post->getPostBody();
133
+		$ret[$i]['topic_id']   = $post->getVar('topic_id');
134
+		$ret[$i]['link']       = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post->getVar('post_id') . $highlightKey; // add highlight key
135
+		$ret[$i]['title']      = $post_data['subject'];
136
+		$ret[$i]['time']       = $post_data['date'];
137
+		$ret[$i]['forum_name'] = $myts->htmlSpecialChars($forum_list[$post->getVar('forum_id')]['forum_name']);
138
+		$ret[$i]['forum_link'] = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $post->getVar('forum_id');
139
+		$ret[$i]['post_text']  = $post_data['text'];
140
+		$ret[$i]['uid']        = $post->getVar('uid');
141
+		$ret[$i]['poster']     = $post->getVar('uid') ? '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $ret[$i]['uid'] . '">' . $post_data['author'] . '</a>' : $post_data['author'];
142
+		++$i;
143
+	}
144 144
 
145
-    return $ret;
145
+	return $ret;
146 146
 }
Please login to merge, or discard this patch.
include/functions.render.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -17,146 +17,146 @@
 block discarded – undo
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(['/&amp;/i', '/&nbsp;/i'], ['&', '&amp;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(['/&amp;/i', '/&nbsp;/i'], ['&', '&amp;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
 }
Please login to merge, or discard this patch.