@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | global $myts; |
68 | 68 | |
69 | 69 | $clean = stripslashes($text); |
70 | - $clean =& $myts->displayTarea($clean, 1, 0, 1); |
|
70 | + $clean = & $myts->displayTarea($clean, 1, 0, 1); |
|
71 | 71 | $clean = strip_tags($clean); |
72 | 72 | $clean = htmlspecialchars($clean, ENT_QUOTES); |
73 | 73 | |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | $linebreak = $isHtml ? '<br>' : "\n"; |
88 | 88 | for ($i = 0; $i < $digest_count; ++$i) { |
89 | 89 | if ($isHtml) { |
90 | - $content .= ($i + 1) . '. <a href=' . $this->items[$i]['link'] . '>' . $this->items[$i]['title'] . '</a>'; |
|
90 | + $content .= ($i + 1).'. <a href='.$this->items[$i]['link'].'>'.$this->items[$i]['title'].'</a>'; |
|
91 | 91 | } else { |
92 | - $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; |
|
92 | + $content .= ($i + 1).'. '.$this->items[$i]['title'].$linebreak.$this->items[$i]['link']; |
|
93 | 93 | } |
94 | 94 | |
95 | - $content .= $linebreak . $this->items[$i]['author']; |
|
95 | + $content .= $linebreak.$this->items[$i]['author']; |
|
96 | 96 | if ($isSummary) { |
97 | - $content .= $linebreak . $this->items[$i]['summary']; |
|
97 | + $content .= $linebreak.$this->items[$i]['summary']; |
|
98 | 98 | } |
99 | - $content .= $linebreak . $linebreak; |
|
99 | + $content .= $linebreak.$linebreak; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | $this->setVar('digest_content', $content); |
@@ -12,96 +12,96 @@ |
||
12 | 12 | |
13 | 13 | class Digest extends \XoopsObject |
14 | 14 | { |
15 | - public $digest_id; |
|
16 | - public $digest_time; |
|
17 | - public $digest_content; |
|
15 | + public $digest_id; |
|
16 | + public $digest_time; |
|
17 | + public $digest_content; |
|
18 | 18 | |
19 | - public $items; |
|
20 | - public $isHtml = false; |
|
21 | - public $isSummary = true; |
|
19 | + public $items; |
|
20 | + public $isHtml = false; |
|
21 | + public $isSummary = true; |
|
22 | 22 | |
23 | - /** |
|
24 | - * |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - parent::__construct(); |
|
29 | - $this->initVar('digest_id', XOBJ_DTYPE_INT); |
|
30 | - $this->initVar('digest_time', XOBJ_DTYPE_INT); |
|
31 | - $this->initVar('digest_content', XOBJ_DTYPE_TXTAREA); |
|
32 | - $this->items = []; |
|
33 | - } |
|
23 | + /** |
|
24 | + * |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + parent::__construct(); |
|
29 | + $this->initVar('digest_id', XOBJ_DTYPE_INT); |
|
30 | + $this->initVar('digest_time', XOBJ_DTYPE_INT); |
|
31 | + $this->initVar('digest_content', XOBJ_DTYPE_TXTAREA); |
|
32 | + $this->items = []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function setHtml() |
|
36 | - { |
|
37 | - $this->isHtml = true; |
|
38 | - } |
|
35 | + public function setHtml() |
|
36 | + { |
|
37 | + $this->isHtml = true; |
|
38 | + } |
|
39 | 39 | |
40 | - public function setSummary() |
|
41 | - { |
|
42 | - $this->isSummary = true; |
|
43 | - } |
|
40 | + public function setSummary() |
|
41 | + { |
|
42 | + $this->isSummary = true; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param $title |
|
47 | - * @param $link |
|
48 | - * @param $author |
|
49 | - * @param string $summary |
|
50 | - */ |
|
51 | - public function addItem($title, $link, $author, $summary = '') |
|
52 | - { |
|
53 | - $title = $this->cleanup($title); |
|
54 | - $author = $this->cleanup($author); |
|
55 | - if (!empty($summary)) { |
|
56 | - $summary = $this->cleanup($summary); |
|
57 | - } |
|
58 | - $this->items[] = ['title' => $title, 'link' => $link, 'author' => $author, 'summary' => $summary]; |
|
59 | - } |
|
45 | + /** |
|
46 | + * @param $title |
|
47 | + * @param $link |
|
48 | + * @param $author |
|
49 | + * @param string $summary |
|
50 | + */ |
|
51 | + public function addItem($title, $link, $author, $summary = '') |
|
52 | + { |
|
53 | + $title = $this->cleanup($title); |
|
54 | + $author = $this->cleanup($author); |
|
55 | + if (!empty($summary)) { |
|
56 | + $summary = $this->cleanup($summary); |
|
57 | + } |
|
58 | + $this->items[] = ['title' => $title, 'link' => $link, 'author' => $author, 'summary' => $summary]; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param $text |
|
63 | - * @return mixed|string |
|
64 | - */ |
|
65 | - public function cleanup($text) |
|
66 | - { |
|
67 | - global $myts; |
|
61 | + /** |
|
62 | + * @param $text |
|
63 | + * @return mixed|string |
|
64 | + */ |
|
65 | + public function cleanup($text) |
|
66 | + { |
|
67 | + global $myts; |
|
68 | 68 | |
69 | - $clean = stripslashes($text); |
|
70 | - $clean =& $myts->displayTarea($clean, 1, 0, 1); |
|
71 | - $clean = strip_tags($clean); |
|
72 | - $clean = htmlspecialchars($clean, ENT_QUOTES); |
|
69 | + $clean = stripslashes($text); |
|
70 | + $clean =& $myts->displayTarea($clean, 1, 0, 1); |
|
71 | + $clean = strip_tags($clean); |
|
72 | + $clean = htmlspecialchars($clean, ENT_QUOTES); |
|
73 | 73 | |
74 | 74 | |
75 | - return $clean; |
|
76 | - } |
|
75 | + return $clean; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param bool $isSummary |
|
80 | - * @param bool $isHtml |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function buildContent($isSummary = true, $isHtml = false) |
|
84 | - { |
|
85 | - $digest_count = count($this->items); |
|
86 | - $content = ''; |
|
87 | - if ($digest_count > 0) { |
|
88 | - $linebreak = $isHtml ? '<br>' : "\n"; |
|
89 | - for ($i = 0; $i < $digest_count; ++$i) { |
|
90 | - if ($isHtml) { |
|
91 | - $content .= ($i + 1) . '. <a href=' . $this->items[$i]['link'] . '>' . $this->items[$i]['title'] . '</a>'; |
|
92 | - } else { |
|
93 | - $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; |
|
94 | - } |
|
78 | + /** |
|
79 | + * @param bool $isSummary |
|
80 | + * @param bool $isHtml |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function buildContent($isSummary = true, $isHtml = false) |
|
84 | + { |
|
85 | + $digest_count = count($this->items); |
|
86 | + $content = ''; |
|
87 | + if ($digest_count > 0) { |
|
88 | + $linebreak = $isHtml ? '<br>' : "\n"; |
|
89 | + for ($i = 0; $i < $digest_count; ++$i) { |
|
90 | + if ($isHtml) { |
|
91 | + $content .= ($i + 1) . '. <a href=' . $this->items[$i]['link'] . '>' . $this->items[$i]['title'] . '</a>'; |
|
92 | + } else { |
|
93 | + $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; |
|
94 | + } |
|
95 | 95 | |
96 | - $content .= $linebreak . $this->items[$i]['author']; |
|
97 | - if ($isSummary) { |
|
98 | - $content .= $linebreak . $this->items[$i]['summary']; |
|
99 | - } |
|
100 | - $content .= $linebreak . $linebreak; |
|
101 | - } |
|
102 | - } |
|
103 | - $this->setVar('digest_content', $content); |
|
96 | + $content .= $linebreak . $this->items[$i]['author']; |
|
97 | + if ($isSummary) { |
|
98 | + $content .= $linebreak . $this->items[$i]['summary']; |
|
99 | + } |
|
100 | + $content .= $linebreak . $linebreak; |
|
101 | + } |
|
102 | + } |
|
103 | + $this->setVar('digest_content', $content); |
|
104 | 104 | |
105 | - return true; |
|
106 | - } |
|
105 | + return true; |
|
106 | + } |
|
107 | 107 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function addField($field, $table) |
66 | 66 | { |
67 | 67 | global $xoopsDB; |
68 | - $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field"); |
|
68 | + $result = $xoopsDB->queryF('ALTER TABLE '.$table." ADD $field"); |
|
69 | 69 | |
70 | 70 | return $result; |
71 | 71 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if (!@mkdir($folder) && !is_dir($folder)) { |
84 | 84 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
85 | 85 | } else { |
86 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
86 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
87 | 87 | } |
88 | 88 | } catch (\Exception $e) { |
89 | 89 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return; |
99 | 99 | } |
100 | 100 | // for 2.5 systems, clear everything |
101 | - require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; |
|
101 | + require_once XOOPS_ROOT_PATH.'/modules/system/class/maintenance.php'; |
|
102 | 102 | $maintenance = new \SystemMaintenance(); |
103 | 103 | $cacheList = [ |
104 | 104 | 3, // xoops_cache |
@@ -8,127 +8,127 @@ |
||
8 | 8 | */ |
9 | 9 | class Utility |
10 | 10 | { |
11 | - use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
12 | - |
|
13 | - use Common\ServerStats; // getServerStats Trait |
|
14 | - |
|
15 | - use Common\FilesManagement; // Files Management Trait |
|
16 | - |
|
17 | - //--------------- Custom module methods ----------------------------- |
|
18 | - |
|
19 | - /** |
|
20 | - * Verify that a mysql table exists |
|
21 | - * |
|
22 | - * @package News |
|
23 | - * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
24 | - * @copyright (c) Hervé Thouzard |
|
25 | - * @param $tablename |
|
26 | - * @return bool |
|
27 | - */ |
|
28 | - public function tableExists($tablename) |
|
29 | - { |
|
30 | - global $xoopsDB; |
|
31 | - /** @var \XoopsMySQLDatabase $xoopsDB */ |
|
32 | - $result = $xoopsDB->queryF("SHOW TABLES LIKE '$tablename'"); |
|
33 | - |
|
34 | - return ($xoopsDB->getRowsNum($result) > 0); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Verify that a field exists inside a mysql table |
|
39 | - * |
|
40 | - * @package News |
|
41 | - * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
42 | - * @copyright (c) Hervé Thouzard |
|
43 | - * @param $fieldname |
|
44 | - * @param $table |
|
45 | - * @return bool |
|
46 | - */ |
|
47 | - public function fieldExists($fieldname, $table) |
|
48 | - { |
|
49 | - global $xoopsDB; |
|
50 | - $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
51 | - |
|
52 | - return ($xoopsDB->getRowsNum($result) > 0); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Add a field to a mysql table |
|
57 | - * |
|
58 | - * @package News |
|
59 | - * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
60 | - * @copyright (c) Hervé Thouzard |
|
61 | - * @param $field |
|
62 | - * @param $table |
|
63 | - * @return bool|\mysqli_result |
|
64 | - */ |
|
65 | - public function addField($field, $table) |
|
66 | - { |
|
67 | - global $xoopsDB; |
|
68 | - $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field"); |
|
69 | - |
|
70 | - return $result; |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
75 | - * |
|
76 | - * @param string $folder Le chemin complet du répertoire à vérifier |
|
77 | - * |
|
78 | - * @return void |
|
79 | - */ |
|
80 | - public static function prepareFolder($folder) |
|
81 | - { |
|
82 | - try { |
|
83 | - if (!@mkdir($folder) && !is_dir($folder)) { |
|
84 | - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
85 | - } else { |
|
86 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
87 | - } |
|
88 | - } catch (\Exception $e) { |
|
89 | - echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
90 | - } |
|
91 | - } |
|
92 | - |
|
93 | - public static function cleanCache() |
|
94 | - { |
|
95 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
96 | - if (method_exists($cacheHelper, 'clear')) { |
|
97 | - $cacheHelper->clear(); |
|
98 | - return; |
|
99 | - } |
|
100 | - // for 2.5 systems, clear everything |
|
101 | - require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; |
|
102 | - $maintenance = new \SystemMaintenance(); |
|
103 | - $cacheList = [ |
|
104 | - 3, // xoops_cache |
|
105 | - ]; |
|
106 | - $maintenance->CleanCache($cacheList); |
|
107 | - xoops_setActiveModules(); |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * Checks if a user is admin of NewBB |
|
112 | - * |
|
113 | - * @return boolean |
|
114 | - */ |
|
115 | - public static function userIsAdmin() |
|
116 | - { |
|
117 | - /** @var Newbb\Helper $helper */ |
|
118 | - $helper = Newbb\Helper::getInstance(); |
|
119 | - |
|
120 | - static $newbbIsAdmin; |
|
121 | - |
|
122 | - if (isset($newbbIsAdmin)) { |
|
123 | - return $newbbIsAdmin; |
|
124 | - } |
|
125 | - |
|
126 | - if (!$GLOBALS['xoopsUser']) { |
|
127 | - $newbbIsAdmin = false; |
|
128 | - } else { |
|
129 | - $newbbIsAdmin = $GLOBALS['xoopsUser']->isAdmin($helper->getModule()->getVar('mid')); |
|
130 | - } |
|
131 | - |
|
132 | - return $newbbIsAdmin; |
|
133 | - } |
|
11 | + use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
12 | + |
|
13 | + use Common\ServerStats; // getServerStats Trait |
|
14 | + |
|
15 | + use Common\FilesManagement; // Files Management Trait |
|
16 | + |
|
17 | + //--------------- Custom module methods ----------------------------- |
|
18 | + |
|
19 | + /** |
|
20 | + * Verify that a mysql table exists |
|
21 | + * |
|
22 | + * @package News |
|
23 | + * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
24 | + * @copyright (c) Hervé Thouzard |
|
25 | + * @param $tablename |
|
26 | + * @return bool |
|
27 | + */ |
|
28 | + public function tableExists($tablename) |
|
29 | + { |
|
30 | + global $xoopsDB; |
|
31 | + /** @var \XoopsMySQLDatabase $xoopsDB */ |
|
32 | + $result = $xoopsDB->queryF("SHOW TABLES LIKE '$tablename'"); |
|
33 | + |
|
34 | + return ($xoopsDB->getRowsNum($result) > 0); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Verify that a field exists inside a mysql table |
|
39 | + * |
|
40 | + * @package News |
|
41 | + * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
42 | + * @copyright (c) Hervé Thouzard |
|
43 | + * @param $fieldname |
|
44 | + * @param $table |
|
45 | + * @return bool |
|
46 | + */ |
|
47 | + public function fieldExists($fieldname, $table) |
|
48 | + { |
|
49 | + global $xoopsDB; |
|
50 | + $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
51 | + |
|
52 | + return ($xoopsDB->getRowsNum($result) > 0); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Add a field to a mysql table |
|
57 | + * |
|
58 | + * @package News |
|
59 | + * @author Hervé Thouzard (http://www.herve-thouzard.com) |
|
60 | + * @copyright (c) Hervé Thouzard |
|
61 | + * @param $field |
|
62 | + * @param $table |
|
63 | + * @return bool|\mysqli_result |
|
64 | + */ |
|
65 | + public function addField($field, $table) |
|
66 | + { |
|
67 | + global $xoopsDB; |
|
68 | + $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field"); |
|
69 | + |
|
70 | + return $result; |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
75 | + * |
|
76 | + * @param string $folder Le chemin complet du répertoire à vérifier |
|
77 | + * |
|
78 | + * @return void |
|
79 | + */ |
|
80 | + public static function prepareFolder($folder) |
|
81 | + { |
|
82 | + try { |
|
83 | + if (!@mkdir($folder) && !is_dir($folder)) { |
|
84 | + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
85 | + } else { |
|
86 | + file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
87 | + } |
|
88 | + } catch (\Exception $e) { |
|
89 | + echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
90 | + } |
|
91 | + } |
|
92 | + |
|
93 | + public static function cleanCache() |
|
94 | + { |
|
95 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
96 | + if (method_exists($cacheHelper, 'clear')) { |
|
97 | + $cacheHelper->clear(); |
|
98 | + return; |
|
99 | + } |
|
100 | + // for 2.5 systems, clear everything |
|
101 | + require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; |
|
102 | + $maintenance = new \SystemMaintenance(); |
|
103 | + $cacheList = [ |
|
104 | + 3, // xoops_cache |
|
105 | + ]; |
|
106 | + $maintenance->CleanCache($cacheList); |
|
107 | + xoops_setActiveModules(); |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * Checks if a user is admin of NewBB |
|
112 | + * |
|
113 | + * @return boolean |
|
114 | + */ |
|
115 | + public static function userIsAdmin() |
|
116 | + { |
|
117 | + /** @var Newbb\Helper $helper */ |
|
118 | + $helper = Newbb\Helper::getInstance(); |
|
119 | + |
|
120 | + static $newbbIsAdmin; |
|
121 | + |
|
122 | + if (isset($newbbIsAdmin)) { |
|
123 | + return $newbbIsAdmin; |
|
124 | + } |
|
125 | + |
|
126 | + if (!$GLOBALS['xoopsUser']) { |
|
127 | + $newbbIsAdmin = false; |
|
128 | + } else { |
|
129 | + $newbbIsAdmin = $GLOBALS['xoopsUser']->isAdmin($helper->getModule()->getVar('mid')); |
|
130 | + } |
|
131 | + |
|
132 | + return $newbbIsAdmin; |
|
133 | + } |
|
134 | 134 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | $newPostArray = []; |
96 | - $prefix .= $this->increment; |
|
96 | + $prefix .= $this->increment; |
|
97 | 97 | foreach ($this->postArray as $post) { |
98 | 98 | if ($post->getVar('pid') == $pid) { |
99 | 99 | $postTree_array[] = [ |
@@ -38,87 +38,87 @@ |
||
38 | 38 | */ |
39 | 39 | class Tree extends \XoopsTree |
40 | 40 | { |
41 | - /** @var string */ |
|
42 | - private $prefix = ' '; |
|
41 | + /** @var string */ |
|
42 | + private $prefix = ' '; |
|
43 | 43 | |
44 | - /** @var string */ |
|
45 | - private $increment = ' '; |
|
44 | + /** @var string */ |
|
45 | + private $increment = ' '; |
|
46 | 46 | |
47 | - /** @var array */ |
|
48 | - private $postArray = []; |
|
47 | + /** @var array */ |
|
48 | + private $postArray = []; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $table_name |
|
52 | - * @param string $id_name |
|
53 | - * @param string $pid_name |
|
54 | - */ |
|
55 | - public function __construct($table_name, $id_name = 'post_id', $pid_name = 'pid') |
|
56 | - { |
|
57 | - parent::__construct($table_name, $id_name, $pid_name); |
|
58 | - } |
|
50 | + /** |
|
51 | + * @param string $table_name |
|
52 | + * @param string $id_name |
|
53 | + * @param string $pid_name |
|
54 | + */ |
|
55 | + public function __construct($table_name, $id_name = 'post_id', $pid_name = 'pid') |
|
56 | + { |
|
57 | + parent::__construct($table_name, $id_name, $pid_name); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @param string $val |
|
62 | - */ |
|
63 | - public function setPrefix($val = '') |
|
64 | - { |
|
65 | - $this->prefix = $val; |
|
66 | - $this->increment = $val; |
|
67 | - } |
|
60 | + /** |
|
61 | + * @param string $val |
|
62 | + */ |
|
63 | + public function setPrefix($val = '') |
|
64 | + { |
|
65 | + $this->prefix = $val; |
|
66 | + $this->increment = $val; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @param $sel_id |
|
71 | - * @param string $order |
|
72 | - */ |
|
73 | - public function getAllPostArray($sel_id, $order = '') |
|
74 | - { |
|
75 | - $this->postArray = $this->getAllChild($sel_id, $order); |
|
76 | - } |
|
69 | + /** |
|
70 | + * @param $sel_id |
|
71 | + * @param string $order |
|
72 | + */ |
|
73 | + public function getAllPostArray($sel_id, $order = '') |
|
74 | + { |
|
75 | + $this->postArray = $this->getAllChild($sel_id, $order); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param $postArray |
|
80 | - */ |
|
81 | - public function setPostArray($postArray) |
|
82 | - { |
|
83 | - $this->postArray = $postArray; |
|
84 | - } |
|
78 | + /** |
|
79 | + * @param $postArray |
|
80 | + */ |
|
81 | + public function setPostArray($postArray) |
|
82 | + { |
|
83 | + $this->postArray = $postArray; |
|
84 | + } |
|
85 | 85 | |
86 | - // returns an array of first child objects for a given id($sel_id) |
|
86 | + // returns an array of first child objects for a given id($sel_id) |
|
87 | 87 | |
88 | - /** |
|
89 | - * @param $postTree_array |
|
90 | - * @param int $pid |
|
91 | - * @param string $prefix |
|
92 | - * @return bool |
|
93 | - */ |
|
94 | - public function getPostTree(&$postTree_array, $pid = 0, $prefix = ' ') |
|
95 | - { |
|
96 | - if (!is_array($postTree_array)) { |
|
97 | - $postTree_array = []; |
|
98 | - } |
|
88 | + /** |
|
89 | + * @param $postTree_array |
|
90 | + * @param int $pid |
|
91 | + * @param string $prefix |
|
92 | + * @return bool |
|
93 | + */ |
|
94 | + public function getPostTree(&$postTree_array, $pid = 0, $prefix = ' ') |
|
95 | + { |
|
96 | + if (!is_array($postTree_array)) { |
|
97 | + $postTree_array = []; |
|
98 | + } |
|
99 | 99 | |
100 | - $newPostArray = []; |
|
101 | - $prefix .= $this->increment; |
|
102 | - foreach ($this->postArray as $post) { |
|
103 | - if ($post->getVar('pid') == $pid) { |
|
104 | - $postTree_array[] = [ |
|
105 | - 'prefix' => $prefix, |
|
106 | - 'icon' => $post->getVar('icon'), |
|
107 | - 'post_time' => $post->getVar('post_time'), |
|
108 | - 'post_id' => $post->getVar('post_id'), |
|
109 | - 'forum_id' => $post->getVar('forum_id'), |
|
110 | - 'subject' => $post->getVar('subject'), |
|
111 | - 'poster_name' => $post->getVar('poster_name'), |
|
112 | - 'uid' => $post->getVar('uid') |
|
113 | - ]; |
|
114 | - $this->getPostTree($postTree_array, $post->getVar('post_id'), $prefix); |
|
115 | - } else { |
|
116 | - $newPostArray[] = $post; |
|
117 | - } |
|
118 | - } |
|
119 | - $this->postArray = $newPostArray; |
|
120 | - unset($newPostArray); |
|
100 | + $newPostArray = []; |
|
101 | + $prefix .= $this->increment; |
|
102 | + foreach ($this->postArray as $post) { |
|
103 | + if ($post->getVar('pid') == $pid) { |
|
104 | + $postTree_array[] = [ |
|
105 | + 'prefix' => $prefix, |
|
106 | + 'icon' => $post->getVar('icon'), |
|
107 | + 'post_time' => $post->getVar('post_time'), |
|
108 | + 'post_id' => $post->getVar('post_id'), |
|
109 | + 'forum_id' => $post->getVar('forum_id'), |
|
110 | + 'subject' => $post->getVar('subject'), |
|
111 | + 'poster_name' => $post->getVar('poster_name'), |
|
112 | + 'uid' => $post->getVar('uid') |
|
113 | + ]; |
|
114 | + $this->getPostTree($postTree_array, $post->getVar('post_id'), $prefix); |
|
115 | + } else { |
|
116 | + $newPostArray[] = $post; |
|
117 | + } |
|
118 | + } |
|
119 | + $this->postArray = $newPostArray; |
|
120 | + unset($newPostArray); |
|
121 | 121 | |
122 | - return true; |
|
123 | - } |
|
122 | + return true; |
|
123 | + } |
|
124 | 124 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $ret[$key]['forum_name'] = $this->tree[$key]['obj']->getVar('forum_name'); |
69 | 69 | } |
70 | 70 | $ret[$key]['prefix'] = $prefix_curr; |
71 | - $prefix_curr .= $prefix_orig; |
|
71 | + $prefix_curr .= $prefix_orig; |
|
72 | 72 | } |
73 | 73 | if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
74 | 74 | foreach ($this->tree[$key]['child'] as $childkey) { |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
127 | 127 | trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); |
128 | 128 | |
129 | - $ret = '<select name=' . $name . '>'; |
|
129 | + $ret = '<select name='.$name.'>'; |
|
130 | 130 | if (!empty($addEmptyOption)) { |
131 | - $ret .= '<option value="0">' . (is_string($EmptyOption) ? $EmptyOption : '') . '</option>'; |
|
131 | + $ret .= '<option value="0">'.(is_string($EmptyOption) ? $EmptyOption : '').'</option>'; |
|
132 | 132 | } |
133 | 133 | $this->_makeSelBoxOptions('forum_name', $selected, $key, $ret, $prefix); |
134 | 134 | $ret .= '</select>'; |
@@ -30,208 +30,208 @@ discard block |
||
30 | 30 | require_once $GLOBALS['xoops']->path('class/tree.php'); |
31 | 31 | |
32 | 32 | if (!class_exists('ObjectTree')) { |
33 | - /** |
|
34 | - * Class ObjectTree |
|
35 | - */ |
|
36 | - class ObjectTree extends \XoopsObjectTree |
|
37 | - { |
|
38 | - /** |
|
39 | - * @param $objectArr |
|
40 | - * @param null $rootId |
|
41 | - */ |
|
42 | - public function __construct(&$objectArr, $rootId = null) |
|
43 | - { |
|
44 | - parent::__construct($objectArr, 'forum_id', 'parent_forum', $rootId); |
|
45 | - } |
|
33 | + /** |
|
34 | + * Class ObjectTree |
|
35 | + */ |
|
36 | + class ObjectTree extends \XoopsObjectTree |
|
37 | + { |
|
38 | + /** |
|
39 | + * @param $objectArr |
|
40 | + * @param null $rootId |
|
41 | + */ |
|
42 | + public function __construct(&$objectArr, $rootId = null) |
|
43 | + { |
|
44 | + parent::__construct($objectArr, 'forum_id', 'parent_forum', $rootId); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Make options for a select box from |
|
49 | - * |
|
50 | - * @param int $key ID of the object to display as the root of select options |
|
51 | - * @param string $ret (reference to a string when called from outside) Result from previous recursions |
|
52 | - * @param string $prefix_orig String to indent items at deeper levels |
|
53 | - * @param string $prefix_curr String to indent the current item |
|
54 | - * @param null|array $tags |
|
55 | - * @internal param string $fieldName Name of the member variable from the |
|
56 | - * node objects that should be used as the title for the options. |
|
57 | - * @internal param string $selected Value to display as selected |
|
58 | - * @access private |
|
59 | - */ |
|
60 | - protected function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null) |
|
61 | - { |
|
62 | - if ($key > 0) { |
|
63 | - if (count($tags) > 0) { |
|
64 | - foreach ($tags as $tag) { |
|
65 | - $ret[$key][$tag] = $this->tree[$key]['obj']->getVar($tag); |
|
66 | - } |
|
67 | - } else { |
|
68 | - $ret[$key]['forum_name'] = $this->tree[$key]['obj']->getVar('forum_name'); |
|
69 | - } |
|
70 | - $ret[$key]['prefix'] = $prefix_curr; |
|
71 | - $prefix_curr .= $prefix_orig; |
|
72 | - } |
|
73 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
74 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
75 | - $this->makeTreeItems($childkey, $ret, $prefix_orig, $prefix_curr, $tags); |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
47 | + /** |
|
48 | + * Make options for a select box from |
|
49 | + * |
|
50 | + * @param int $key ID of the object to display as the root of select options |
|
51 | + * @param string $ret (reference to a string when called from outside) Result from previous recursions |
|
52 | + * @param string $prefix_orig String to indent items at deeper levels |
|
53 | + * @param string $prefix_curr String to indent the current item |
|
54 | + * @param null|array $tags |
|
55 | + * @internal param string $fieldName Name of the member variable from the |
|
56 | + * node objects that should be used as the title for the options. |
|
57 | + * @internal param string $selected Value to display as selected |
|
58 | + * @access private |
|
59 | + */ |
|
60 | + protected function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null) |
|
61 | + { |
|
62 | + if ($key > 0) { |
|
63 | + if (count($tags) > 0) { |
|
64 | + foreach ($tags as $tag) { |
|
65 | + $ret[$key][$tag] = $this->tree[$key]['obj']->getVar($tag); |
|
66 | + } |
|
67 | + } else { |
|
68 | + $ret[$key]['forum_name'] = $this->tree[$key]['obj']->getVar('forum_name'); |
|
69 | + } |
|
70 | + $ret[$key]['prefix'] = $prefix_curr; |
|
71 | + $prefix_curr .= $prefix_orig; |
|
72 | + } |
|
73 | + if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
74 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
75 | + $this->makeTreeItems($childkey, $ret, $prefix_orig, $prefix_curr, $tags); |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Make a select box with options from the tree |
|
82 | - * |
|
83 | - * @param string $prefix String to indent deeper levels |
|
84 | - * @param integer $key ID of the object to display as the root of select options |
|
85 | - * @param null $tags |
|
86 | - * @return array|string HTML select box |
|
87 | - * @internal param string $name Name of the select box |
|
88 | - * @internal param string $fieldName Name of the member variable from the |
|
89 | - * node objects that should be used as the title for the options. |
|
90 | - * @internal param string $selected Value to display as selected |
|
91 | - * @internal param bool $addEmptyOption Set TRUE to add an empty option with value "0" at the top of the hierarchy |
|
92 | - */ |
|
93 | - public function &makeTree($prefix = '-', $key = 0, $tags = null) |
|
94 | - { |
|
95 | - $ret = []; |
|
96 | - $this->makeTreeItems($key, $ret, $prefix, '', $tags); |
|
80 | + /** |
|
81 | + * Make a select box with options from the tree |
|
82 | + * |
|
83 | + * @param string $prefix String to indent deeper levels |
|
84 | + * @param integer $key ID of the object to display as the root of select options |
|
85 | + * @param null $tags |
|
86 | + * @return array|string HTML select box |
|
87 | + * @internal param string $name Name of the select box |
|
88 | + * @internal param string $fieldName Name of the member variable from the |
|
89 | + * node objects that should be used as the title for the options. |
|
90 | + * @internal param string $selected Value to display as selected |
|
91 | + * @internal param bool $addEmptyOption Set TRUE to add an empty option with value "0" at the top of the hierarchy |
|
92 | + */ |
|
93 | + public function &makeTree($prefix = '-', $key = 0, $tags = null) |
|
94 | + { |
|
95 | + $ret = []; |
|
96 | + $this->makeTreeItems($key, $ret, $prefix, '', $tags); |
|
97 | 97 | |
98 | - return $ret; |
|
99 | - } |
|
98 | + return $ret; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Make a select box with options from the tree |
|
103 | - * |
|
104 | - * @param string $name Name of the select box |
|
105 | - * @param string $fieldName Name of the member variable from the |
|
106 | - * node objects that should be used as the title for the options. |
|
107 | - * @param string $prefix String to indent deeper levels |
|
108 | - * @param string $selected Value to display as selected |
|
109 | - * @param bool $addEmptyOption Set TRUE to add an empty option with value "0" at the top of the hierarchy |
|
110 | - * @param integer $key ID of the object to display as the root of select options |
|
111 | - * @param string $extra |
|
112 | - * @return string HTML select box |
|
113 | - * |
|
114 | - * @deprecated since 2.5.9, please use makeSelectElement() |
|
115 | - */ |
|
116 | - public function makeSelBox( |
|
117 | - $name, |
|
118 | - $fieldName, |
|
119 | - $prefix = '-', |
|
120 | - $selected = '', |
|
121 | - $addEmptyOption = false, |
|
122 | - $key = 0, |
|
123 | - $extra = '' |
|
124 | - ) //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) |
|
125 | - { |
|
126 | - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
|
127 | - trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); |
|
101 | + /** |
|
102 | + * Make a select box with options from the tree |
|
103 | + * |
|
104 | + * @param string $name Name of the select box |
|
105 | + * @param string $fieldName Name of the member variable from the |
|
106 | + * node objects that should be used as the title for the options. |
|
107 | + * @param string $prefix String to indent deeper levels |
|
108 | + * @param string $selected Value to display as selected |
|
109 | + * @param bool $addEmptyOption Set TRUE to add an empty option with value "0" at the top of the hierarchy |
|
110 | + * @param integer $key ID of the object to display as the root of select options |
|
111 | + * @param string $extra |
|
112 | + * @return string HTML select box |
|
113 | + * |
|
114 | + * @deprecated since 2.5.9, please use makeSelectElement() |
|
115 | + */ |
|
116 | + public function makeSelBox( |
|
117 | + $name, |
|
118 | + $fieldName, |
|
119 | + $prefix = '-', |
|
120 | + $selected = '', |
|
121 | + $addEmptyOption = false, |
|
122 | + $key = 0, |
|
123 | + $extra = '' |
|
124 | + ) //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) |
|
125 | + { |
|
126 | + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
|
127 | + trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); |
|
128 | 128 | |
129 | - $ret = '<select name=' . $name . '>'; |
|
130 | - if (!empty($addEmptyOption)) { |
|
131 | - $ret .= '<option value="0">' . (is_string($EmptyOption) ? $EmptyOption : '') . '</option>'; |
|
132 | - } |
|
133 | - $this->_makeSelBoxOptions('forum_name', $selected, $key, $ret, $prefix); |
|
134 | - $ret .= '</select>'; |
|
129 | + $ret = '<select name=' . $name . '>'; |
|
130 | + if (!empty($addEmptyOption)) { |
|
131 | + $ret .= '<option value="0">' . (is_string($EmptyOption) ? $EmptyOption : '') . '</option>'; |
|
132 | + } |
|
133 | + $this->_makeSelBoxOptions('forum_name', $selected, $key, $ret, $prefix); |
|
134 | + $ret .= '</select>'; |
|
135 | 135 | |
136 | - return $ret; |
|
137 | - } |
|
136 | + return $ret; |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Make a tree for the array of a given category |
|
141 | - * |
|
142 | - * @param string $key top key of the tree |
|
143 | - * @param array $ret the tree |
|
144 | - * @param integer $depth level of subcategories |
|
145 | - * @return void |
|
146 | - * @internal param array $tags fields to be used |
|
147 | - */ |
|
148 | - public function getAllChildObject($key, &$ret, $depth = 0) |
|
149 | - { |
|
150 | - if (0 == --$depth) { |
|
151 | - return; |
|
152 | - } |
|
139 | + /** |
|
140 | + * Make a tree for the array of a given category |
|
141 | + * |
|
142 | + * @param string $key top key of the tree |
|
143 | + * @param array $ret the tree |
|
144 | + * @param integer $depth level of subcategories |
|
145 | + * @return void |
|
146 | + * @internal param array $tags fields to be used |
|
147 | + */ |
|
148 | + public function getAllChildObject($key, &$ret, $depth = 0) |
|
149 | + { |
|
150 | + if (0 == --$depth) { |
|
151 | + return; |
|
152 | + } |
|
153 | 153 | |
154 | - if (isset($this->tree[$key]['child'])) { |
|
155 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
156 | - if (isset($this->tree[$childkey]['obj'])) { |
|
157 | - $ret['child'][$childkey] = $this->tree[$childkey]['obj']; |
|
158 | - } |
|
159 | - $this->getAllChild_object($childkey, $ret['child'][$childkey], $depth); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
154 | + if (isset($this->tree[$key]['child'])) { |
|
155 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
156 | + if (isset($this->tree[$childkey]['obj'])) { |
|
157 | + $ret['child'][$childkey] = $this->tree[$childkey]['obj']; |
|
158 | + } |
|
159 | + $this->getAllChild_object($childkey, $ret['child'][$childkey], $depth); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * Make a tree for the array |
|
166 | - * |
|
167 | - * @param int|string $key top key of the tree |
|
168 | - * @param integer $depth level of subcategories |
|
169 | - * @return array |
|
170 | - * @internal param array $tags fields to be used |
|
171 | - */ |
|
172 | - public function &makeObjectTree($key = 0, $depth = 0) |
|
173 | - { |
|
174 | - $ret = []; |
|
175 | - if ($depth > 0) { |
|
176 | - ++$depth; |
|
177 | - } |
|
178 | - $this->getAllChild_object($key, $ret, $depth); |
|
164 | + /** |
|
165 | + * Make a tree for the array |
|
166 | + * |
|
167 | + * @param int|string $key top key of the tree |
|
168 | + * @param integer $depth level of subcategories |
|
169 | + * @return array |
|
170 | + * @internal param array $tags fields to be used |
|
171 | + */ |
|
172 | + public function &makeObjectTree($key = 0, $depth = 0) |
|
173 | + { |
|
174 | + $ret = []; |
|
175 | + if ($depth > 0) { |
|
176 | + ++$depth; |
|
177 | + } |
|
178 | + $this->getAllChild_object($key, $ret, $depth); |
|
179 | 179 | |
180 | - return $ret; |
|
181 | - } |
|
180 | + return $ret; |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Make a tree for the array of a given category |
|
185 | - * |
|
186 | - * @param string $key top key of the tree |
|
187 | - * @param array $ret the tree |
|
188 | - * @param array $tags fields to be used |
|
189 | - * @param integer $depth level of subcategories |
|
190 | - * @return void |
|
191 | - */ |
|
192 | - public function getAllChildArray($key, &$ret, array $tags = [], $depth = 0) |
|
193 | - { |
|
194 | - if (0 == --$depth) { |
|
195 | - return; |
|
196 | - } |
|
183 | + /** |
|
184 | + * Make a tree for the array of a given category |
|
185 | + * |
|
186 | + * @param string $key top key of the tree |
|
187 | + * @param array $ret the tree |
|
188 | + * @param array $tags fields to be used |
|
189 | + * @param integer $depth level of subcategories |
|
190 | + * @return void |
|
191 | + */ |
|
192 | + public function getAllChildArray($key, &$ret, array $tags = [], $depth = 0) |
|
193 | + { |
|
194 | + if (0 == --$depth) { |
|
195 | + return; |
|
196 | + } |
|
197 | 197 | |
198 | - if (isset($this->tree[$key]['child'])) { |
|
199 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
200 | - if (isset($this->tree[$childkey]['obj'])) { |
|
201 | - if (count($tags) > 0) { |
|
202 | - foreach ($tags as $tag) { |
|
203 | - $ret['child'][$childkey][$tag] = $this->tree[$childkey]['obj']->getVar($tag); |
|
204 | - } |
|
205 | - } else { |
|
206 | - $ret['child'][$childkey]['forum_name'] = $this->tree[$childkey]['obj']->getVar('forum_name'); |
|
207 | - } |
|
208 | - } |
|
198 | + if (isset($this->tree[$key]['child'])) { |
|
199 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
200 | + if (isset($this->tree[$childkey]['obj'])) { |
|
201 | + if (count($tags) > 0) { |
|
202 | + foreach ($tags as $tag) { |
|
203 | + $ret['child'][$childkey][$tag] = $this->tree[$childkey]['obj']->getVar($tag); |
|
204 | + } |
|
205 | + } else { |
|
206 | + $ret['child'][$childkey]['forum_name'] = $this->tree[$childkey]['obj']->getVar('forum_name'); |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | - $this->getAllChildArray($childkey, $ret['child'][$childkey], $tags, $depth); |
|
211 | - } |
|
212 | - } |
|
213 | - } |
|
210 | + $this->getAllChildArray($childkey, $ret['child'][$childkey], $tags, $depth); |
|
211 | + } |
|
212 | + } |
|
213 | + } |
|
214 | 214 | |
215 | - /** |
|
216 | - * Make a tree for the array |
|
217 | - * |
|
218 | - * @param int|string $key top key of the tree |
|
219 | - * @param array $tags fields to be used |
|
220 | - * @param integer $depth level of subcategories |
|
221 | - * @return array |
|
222 | - */ |
|
223 | - public function &makeArrayTree($key = 0, $tags = null, $depth = 0) |
|
224 | - { |
|
225 | - $ret = []; |
|
226 | - if ($depth > 0) { |
|
227 | - ++$depth; |
|
228 | - } |
|
229 | - $this->getAllChildArray($key, $ret, $tags, $depth); |
|
215 | + /** |
|
216 | + * Make a tree for the array |
|
217 | + * |
|
218 | + * @param int|string $key top key of the tree |
|
219 | + * @param array $tags fields to be used |
|
220 | + * @param integer $depth level of subcategories |
|
221 | + * @return array |
|
222 | + */ |
|
223 | + public function &makeArrayTree($key = 0, $tags = null, $depth = 0) |
|
224 | + { |
|
225 | + $ret = []; |
|
226 | + if ($depth > 0) { |
|
227 | + ++$depth; |
|
228 | + } |
|
229 | + $this->getAllChildArray($key, $ret, $tags, $depth); |
|
230 | 230 | |
231 | - return $ret; |
|
232 | - } |
|
231 | + return $ret; |
|
232 | + } |
|
233 | 233 | |
234 | - /**#@+ |
|
234 | + /**#@+ |
|
235 | 235 | * get all parent forums |
236 | 236 | * |
237 | 237 | * @param string $key ID of the child object |
@@ -239,49 +239,49 @@ discard block |
||
239 | 239 | * @param int $uplevel (empty when called from outside) level of recursion |
240 | 240 | * @return array Array of parent nodes. |
241 | 241 | */ |
242 | - public function &myGetParentForums($key, array $ret = [], $uplevel = 0) |
|
243 | - { |
|
244 | - if (isset($this->tree[$key]['parent']) && isset($this->tree[$this->tree[$key]['parent']]['obj'])) { |
|
245 | - $ret[$uplevel] = $this->tree[$this->tree[$key]['parent']]['obj']; |
|
246 | - if ($this->tree[$key]['parent'] !== $key) { |
|
247 | - //$parents = $this->getParentForums($this->tree[$key]['parent'], $ret, $uplevel+1); |
|
248 | - $parents = $this->getParentForums($this->tree[$key]['parent']); |
|
249 | - foreach (array_keys($parents) as $newkey) { |
|
250 | - $ret[$newkey] = $parents[$newkey]; |
|
251 | - } |
|
252 | - } |
|
253 | - } |
|
242 | + public function &myGetParentForums($key, array $ret = [], $uplevel = 0) |
|
243 | + { |
|
244 | + if (isset($this->tree[$key]['parent']) && isset($this->tree[$this->tree[$key]['parent']]['obj'])) { |
|
245 | + $ret[$uplevel] = $this->tree[$this->tree[$key]['parent']]['obj']; |
|
246 | + if ($this->tree[$key]['parent'] !== $key) { |
|
247 | + //$parents = $this->getParentForums($this->tree[$key]['parent'], $ret, $uplevel+1); |
|
248 | + $parents = $this->getParentForums($this->tree[$key]['parent']); |
|
249 | + foreach (array_keys($parents) as $newkey) { |
|
250 | + $ret[$newkey] = $parents[$newkey]; |
|
251 | + } |
|
252 | + } |
|
253 | + } |
|
254 | 254 | |
255 | - return $ret; |
|
256 | - } |
|
255 | + return $ret; |
|
256 | + } |
|
257 | 257 | |
258 | - /** |
|
259 | - * @param $key |
|
260 | - * @param bool $reverse |
|
261 | - * @return array |
|
262 | - */ |
|
263 | - public function &getParentForums($key, $reverse = true) |
|
264 | - { |
|
265 | - $ret = []; |
|
266 | - $pids = []; |
|
267 | - if (isset($this->tree[$key]['parent']) && isset($this->tree[$this->tree[$key]['parent']]['obj'])) { |
|
268 | - $pids[] = $this->tree[$this->tree[$key]['parent']]['obj']->getVar($this->myId); |
|
269 | - $parents = $this->myGetParentForums($this->tree[$key]['parent'], $ret); |
|
270 | - foreach (array_keys($parents) as $newkey) { |
|
271 | - if (!is_object($newkey)) { |
|
272 | - continue; |
|
273 | - } |
|
274 | - $ret[] = $parents[$newkey]->getVar($this->myId); |
|
275 | - } |
|
276 | - } |
|
277 | - if ($reverse) { |
|
278 | - $pids = array_reverse($ret) + $pids; |
|
279 | - } else { |
|
280 | - $pids += $ret; |
|
281 | - } |
|
258 | + /** |
|
259 | + * @param $key |
|
260 | + * @param bool $reverse |
|
261 | + * @return array |
|
262 | + */ |
|
263 | + public function &getParentForums($key, $reverse = true) |
|
264 | + { |
|
265 | + $ret = []; |
|
266 | + $pids = []; |
|
267 | + if (isset($this->tree[$key]['parent']) && isset($this->tree[$this->tree[$key]['parent']]['obj'])) { |
|
268 | + $pids[] = $this->tree[$this->tree[$key]['parent']]['obj']->getVar($this->myId); |
|
269 | + $parents = $this->myGetParentForums($this->tree[$key]['parent'], $ret); |
|
270 | + foreach (array_keys($parents) as $newkey) { |
|
271 | + if (!is_object($newkey)) { |
|
272 | + continue; |
|
273 | + } |
|
274 | + $ret[] = $parents[$newkey]->getVar($this->myId); |
|
275 | + } |
|
276 | + } |
|
277 | + if ($reverse) { |
|
278 | + $pids = array_reverse($ret) + $pids; |
|
279 | + } else { |
|
280 | + $pids += $ret; |
|
281 | + } |
|
282 | 282 | |
283 | - return $pids; |
|
284 | - } |
|
285 | - /**#@-*/ |
|
286 | - } |
|
283 | + return $pids; |
|
284 | + } |
|
285 | + /**#@-*/ |
|
286 | + } |
|
287 | 287 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | case 'viewtopic.php': |
67 | 67 | /** @var Newbb\TopicHandler $topicHandler */ |
68 | 68 | $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
69 | - $post_id = Request::getInt('post_id', 0);// !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; |
|
69 | + $post_id = Request::getInt('post_id', 0); // !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; |
|
70 | 70 | $move = strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; |
71 | 71 | $topic_id = Request::getInt('topic_id', 0); // !empty($_REQUEST["topic_id"]) ? (int)($_REQUEST["topic_id"]) : 0; |
72 | 72 | if (!empty($post_id)) { |
@@ -28,65 +28,65 @@ |
||
28 | 28 | |
29 | 29 | class Plugin extends Userlog\Plugin\PluginAbstract implements Userlog\Plugin\PluginInterface |
30 | 30 | { |
31 | - /** |
|
32 | - * @param string $subscribe_from Name of the script |
|
33 | - * |
|
34 | - * 'name' => 'thread'; |
|
35 | - * 'title' => _MI_NEWBB_THREAD_NOTIFY; |
|
36 | - * 'description' => _MI_NEWBB_THREAD_NOTIFYDSC; |
|
37 | - * 'subscribe_from' => 'viewtopic.php'; |
|
38 | - * 'item_name' => 'topic_id'; |
|
39 | - * 'allow_bookmark' => 1; |
|
40 | - * |
|
41 | - * publisher: |
|
42 | - * 'name' = 'category_item'; |
|
43 | - * 'title' = _MI_PUBLISHER_CATEGORY_ITEM_NOTIFY; |
|
44 | - * 'description' = _MI_PUBLISHER_CATEGORY_ITEM_NOTIFY_DSC; |
|
45 | - * 'subscribe_from' = array('index.php', 'category.php', 'item.php'); |
|
46 | - * 'item_name' = 'categoryid'; |
|
47 | - * 'allow_bookmark' = 1; |
|
48 | - * |
|
49 | - * empty($subscribe_from): |
|
50 | - * @return bool|array $script_arr["item_name"] name of the item = array("subscribe_from1", "subscribe_from2") Name of the script |
|
51 | - * |
|
52 | - * !empty($subscribe_from): |
|
53 | - * @return bool|array $item["item_name"] name of the item, $item["item_id"] id of the item |
|
54 | - */ |
|
55 | - public function item($subscribe_from) |
|
56 | - { |
|
57 | - if (empty($subscribe_from)) { |
|
58 | - $script_arr = []; |
|
59 | - $script_arr['topic_id'] = ['viewtopic.php']; |
|
60 | - $script_arr['forum'] = ['viewforum.php']; |
|
31 | + /** |
|
32 | + * @param string $subscribe_from Name of the script |
|
33 | + * |
|
34 | + * 'name' => 'thread'; |
|
35 | + * 'title' => _MI_NEWBB_THREAD_NOTIFY; |
|
36 | + * 'description' => _MI_NEWBB_THREAD_NOTIFYDSC; |
|
37 | + * 'subscribe_from' => 'viewtopic.php'; |
|
38 | + * 'item_name' => 'topic_id'; |
|
39 | + * 'allow_bookmark' => 1; |
|
40 | + * |
|
41 | + * publisher: |
|
42 | + * 'name' = 'category_item'; |
|
43 | + * 'title' = _MI_PUBLISHER_CATEGORY_ITEM_NOTIFY; |
|
44 | + * 'description' = _MI_PUBLISHER_CATEGORY_ITEM_NOTIFY_DSC; |
|
45 | + * 'subscribe_from' = array('index.php', 'category.php', 'item.php'); |
|
46 | + * 'item_name' = 'categoryid'; |
|
47 | + * 'allow_bookmark' = 1; |
|
48 | + * |
|
49 | + * empty($subscribe_from): |
|
50 | + * @return bool|array $script_arr["item_name"] name of the item = array("subscribe_from1", "subscribe_from2") Name of the script |
|
51 | + * |
|
52 | + * !empty($subscribe_from): |
|
53 | + * @return bool|array $item["item_name"] name of the item, $item["item_id"] id of the item |
|
54 | + */ |
|
55 | + public function item($subscribe_from) |
|
56 | + { |
|
57 | + if (empty($subscribe_from)) { |
|
58 | + $script_arr = []; |
|
59 | + $script_arr['topic_id'] = ['viewtopic.php']; |
|
60 | + $script_arr['forum'] = ['viewforum.php']; |
|
61 | 61 | |
62 | - return $script_arr; |
|
63 | - } |
|
62 | + return $script_arr; |
|
63 | + } |
|
64 | 64 | |
65 | - switch ($subscribe_from) { |
|
66 | - case 'viewtopic.php': |
|
67 | - /** @var Newbb\TopicHandler $topicHandler */ |
|
68 | - $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
69 | - $post_id = Request::getInt('post_id', 0);// !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; |
|
70 | - $move = strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; |
|
71 | - $topic_id = Request::getInt('topic_id', 0); // !empty($_REQUEST["topic_id"]) ? (int)($_REQUEST["topic_id"]) : 0; |
|
72 | - if (!empty($post_id)) { |
|
73 | - $topicObject = $topicHandler->getByPost($post_id); |
|
74 | - $topic_id = $topicObject->getVar('topic_id'); |
|
75 | - } elseif (!empty($move)) { |
|
76 | - $forum_id = Request::getInt('forum_id', 0); //!empty($_REQUEST["forum_id"]) ? (int)($_REQUEST["forum_id"]) : 0; |
|
77 | - $topicObject = $topicHandler->getByMove($topic_id, ('prev' === $move) ? -1 : 1, $forum_id); |
|
78 | - $topic_id = $topicObject->getVar('topic_id'); |
|
79 | - } |
|
65 | + switch ($subscribe_from) { |
|
66 | + case 'viewtopic.php': |
|
67 | + /** @var Newbb\TopicHandler $topicHandler */ |
|
68 | + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
69 | + $post_id = Request::getInt('post_id', 0);// !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; |
|
70 | + $move = strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; |
|
71 | + $topic_id = Request::getInt('topic_id', 0); // !empty($_REQUEST["topic_id"]) ? (int)($_REQUEST["topic_id"]) : 0; |
|
72 | + if (!empty($post_id)) { |
|
73 | + $topicObject = $topicHandler->getByPost($post_id); |
|
74 | + $topic_id = $topicObject->getVar('topic_id'); |
|
75 | + } elseif (!empty($move)) { |
|
76 | + $forum_id = Request::getInt('forum_id', 0); //!empty($_REQUEST["forum_id"]) ? (int)($_REQUEST["forum_id"]) : 0; |
|
77 | + $topicObject = $topicHandler->getByMove($topic_id, ('prev' === $move) ? -1 : 1, $forum_id); |
|
78 | + $topic_id = $topicObject->getVar('topic_id'); |
|
79 | + } |
|
80 | 80 | |
81 | - return ['item_name' => 'topic_id', 'item_id' => $topic_id]; |
|
82 | - break; |
|
83 | - case 'viewforum.php': |
|
84 | - $forum_id = Request::getInt('forum', 0); // !empty($_REQUEST["forum"]) ? (int)($_REQUEST["forum"]) : 0; |
|
81 | + return ['item_name' => 'topic_id', 'item_id' => $topic_id]; |
|
82 | + break; |
|
83 | + case 'viewforum.php': |
|
84 | + $forum_id = Request::getInt('forum', 0); // !empty($_REQUEST["forum"]) ? (int)($_REQUEST["forum"]) : 0; |
|
85 | 85 | |
86 | - return ['item_name' => 'forum', 'item_id' => $forum_id]; |
|
87 | - break; |
|
88 | - } |
|
86 | + return ['item_name' => 'forum', 'item_id' => $forum_id]; |
|
87 | + break; |
|
88 | + } |
|
89 | 89 | |
90 | - return false; |
|
91 | - } |
|
90 | + return false; |
|
91 | + } |
|
92 | 92 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | require_once $GLOBALS['xoops']->path('class/template.php'); |
71 | 71 | $breadcrumbTpl = new \XoopsTpl(); |
72 | 72 | $breadcrumbTpl->assign('breadcrumb', $this->bread); |
73 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
73 | + $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl'); |
|
74 | 74 | unset($breadcrumbTpl); |
75 | 75 | |
76 | 76 | return $html; |
@@ -31,49 +31,49 @@ |
||
31 | 31 | */ |
32 | 32 | class Breadcrumb |
33 | 33 | { |
34 | - /** @var string */ |
|
35 | - private $dirname; |
|
34 | + /** @var string */ |
|
35 | + private $dirname; |
|
36 | 36 | |
37 | - /** @var array */ |
|
38 | - private $bread = []; |
|
37 | + /** @var array */ |
|
38 | + private $bread = []; |
|
39 | 39 | |
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->dirname = basename(dirname(dirname(__DIR__))); |
|
43 | - } |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->dirname = basename(dirname(dirname(__DIR__))); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Add link to breadcrumb |
|
47 | - * |
|
48 | - * @param string $title |
|
49 | - * @param string $link |
|
50 | - */ |
|
51 | - public function addLink($title = '', $link = '') |
|
52 | - { |
|
53 | - $this->bread[] = [ |
|
54 | - 'link' => $link, |
|
55 | - 'title' => $title |
|
56 | - ]; |
|
57 | - } |
|
45 | + /** |
|
46 | + * Add link to breadcrumb |
|
47 | + * |
|
48 | + * @param string $title |
|
49 | + * @param string $link |
|
50 | + */ |
|
51 | + public function addLink($title = '', $link = '') |
|
52 | + { |
|
53 | + $this->bread[] = [ |
|
54 | + 'link' => $link, |
|
55 | + 'title' => $title |
|
56 | + ]; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Render Pedigree BreadCrumb |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function render() |
|
65 | - { |
|
66 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
67 | - require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
68 | - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
69 | - } |
|
59 | + /** |
|
60 | + * Render Pedigree BreadCrumb |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function render() |
|
65 | + { |
|
66 | + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
67 | + require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
68 | + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
69 | + } |
|
70 | 70 | |
71 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
72 | - $breadcrumbTpl = new \XoopsTpl(); |
|
73 | - $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
74 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
75 | - unset($breadcrumbTpl); |
|
71 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
72 | + $breadcrumbTpl = new \XoopsTpl(); |
|
73 | + $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
74 | + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
75 | + unset($breadcrumbTpl); |
|
76 | 76 | |
77 | - return $html; |
|
78 | - } |
|
77 | + return $html; |
|
78 | + } |
|
79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // $start = 0; |
87 | 87 | // } |
88 | 88 | |
89 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_digest') . ' ORDER BY digest_id DESC'; |
|
89 | + $sql = 'SELECT * FROM '.$this->db->prefix('newbb_digest').' ORDER BY digest_id DESC'; |
|
90 | 90 | $result = $this->db->query($sql, $perpage, $start); |
91 | 91 | $ret = []; |
92 | 92 | // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function getDigestCount() |
104 | 104 | { |
105 | - $sql = 'SELECT COUNT(*) AS count FROM ' . $this->db->prefix('newbb_digest'); |
|
105 | + $sql = 'SELECT COUNT(*) AS count FROM '.$this->db->prefix('newbb_digest'); |
|
106 | 106 | $result = $this->db->query($sql); |
107 | 107 | if (!$result) { |
108 | 108 | return 0; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | public function getLastDigest() |
117 | 117 | { |
118 | - $sql = 'SELECT MAX(digest_time) AS last_digest FROM ' . $this->db->prefix('newbb_digest'); |
|
118 | + $sql = 'SELECT MAX(digest_time) AS last_digest FROM '.$this->db->prefix('newbb_digest'); |
|
119 | 119 | $result = $this->db->query($sql); |
120 | 120 | if (!$result) { |
121 | 121 | $this->last_digest = 0; |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | $GLOBALS['xoopsUser'] = $thisUser; |
207 | 207 | |
208 | 208 | $accessForums = $forumHandler->getIdsByPermission(); // get all accessible forums |
209 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $accessForums) . ')'; |
|
209 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $accessForums).')'; |
|
210 | 210 | $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
211 | - $time_criteria = ' AND t.digest_time > ' . $this->last_digest; |
|
211 | + $time_criteria = ' AND t.digest_time > '.$this->last_digest; |
|
212 | 212 | |
213 | 213 | $karma_criteria = $GLOBALS['xoopsModuleConfig']['enable_karma'] ? ' AND p.post_karma=0' : ''; |
214 | 214 | $reply_criteria = $GLOBALS['xoopsModuleConfig']['allow_require_reply'] ? ' AND p.require_reply=0' : ''; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if (count($uids) > 0) { |
244 | 244 | /** @var \XoopsMemberHandler $memberHandler */ |
245 | 245 | $memberHandler = xoops_getHandler('member'); |
246 | - $user_criteria = new \Criteria('uid', '(' . implode(',', $uids) . ')', 'IN'); |
|
246 | + $user_criteria = new \Criteria('uid', '('.implode(',', $uids).')', 'IN'); |
|
247 | 247 | $users = $memberHandler->getUsers($user_criteria, true); |
248 | 248 | } else { |
249 | 249 | $users = []; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $topic['uname'] = $topic['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']; |
262 | 262 | } |
263 | 263 | $summary = \Xmf\Metagen::generateDescription($topic['post_text'], SUMMARY_LENGTH); |
264 | - $author = $topic['uname'] . ' (' . formatTimestamp($topic['topic_time']) . ')'; |
|
265 | - $link = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/viewtopic.php?topic_id=' . $topic['topic_id'] . '&forum=' . $topic['forum_id']; |
|
264 | + $author = $topic['uname'].' ('.formatTimestamp($topic['topic_time']).')'; |
|
265 | + $link = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/viewtopic.php?topic_id='.$topic['topic_id'].'&forum='.$topic['forum_id']; |
|
266 | 266 | $title = $topic['topic_title']; |
267 | 267 | $digest->addItem($title, $link, $author, $summary); |
268 | 268 | } |
@@ -17,139 +17,139 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class DigestHandler extends \XoopsPersistableObjectHandler |
19 | 19 | { |
20 | - public $last_digest; |
|
20 | + public $last_digest; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Constructor |
|
24 | - * |
|
25 | - * @param null|\XoopsDatabase $db database connection |
|
26 | - */ |
|
27 | - public function __construct(\XoopsDatabase $db = null) |
|
28 | - { |
|
29 | - parent::__construct($db, 'newbb_digest', Digest::class, 'digest_id'); |
|
30 | - } |
|
22 | + /** |
|
23 | + * Constructor |
|
24 | + * |
|
25 | + * @param null|\XoopsDatabase $db database connection |
|
26 | + */ |
|
27 | + public function __construct(\XoopsDatabase $db = null) |
|
28 | + { |
|
29 | + parent::__construct($db, 'newbb_digest', Digest::class, 'digest_id'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param bool $isForced |
|
34 | - * @return int |
|
35 | - */ |
|
36 | - public function process($isForced = false) |
|
37 | - { |
|
38 | - $this->getLastDigest(); |
|
39 | - if (!$isForced) { |
|
40 | - $status = $this->checkStatus(); |
|
41 | - if ($status < 1) { |
|
42 | - return 1; |
|
43 | - } |
|
44 | - } |
|
45 | - $digest = $this->create(); |
|
46 | - $status = $this->buildDigest($digest); |
|
47 | - if (!$status) { |
|
48 | - return 2; |
|
49 | - } |
|
50 | - $status = $this->insert($digest); |
|
51 | - if (!$status) { |
|
52 | - return 3; |
|
53 | - } |
|
54 | - $status = $this->notify($digest); |
|
55 | - if (!$status) { |
|
56 | - return 4; |
|
57 | - } |
|
32 | + /** |
|
33 | + * @param bool $isForced |
|
34 | + * @return int |
|
35 | + */ |
|
36 | + public function process($isForced = false) |
|
37 | + { |
|
38 | + $this->getLastDigest(); |
|
39 | + if (!$isForced) { |
|
40 | + $status = $this->checkStatus(); |
|
41 | + if ($status < 1) { |
|
42 | + return 1; |
|
43 | + } |
|
44 | + } |
|
45 | + $digest = $this->create(); |
|
46 | + $status = $this->buildDigest($digest); |
|
47 | + if (!$status) { |
|
48 | + return 2; |
|
49 | + } |
|
50 | + $status = $this->insert($digest); |
|
51 | + if (!$status) { |
|
52 | + return 3; |
|
53 | + } |
|
54 | + $status = $this->notify($digest); |
|
55 | + if (!$status) { |
|
56 | + return 4; |
|
57 | + } |
|
58 | 58 | |
59 | - return 0; |
|
60 | - } |
|
59 | + return 0; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param \XoopsObject $digest |
|
64 | - * @return bool |
|
65 | - */ |
|
66 | - public function notify(\XoopsObject $digest) |
|
67 | - { |
|
68 | - //$content = $digest->getVar('digest_content'); |
|
69 | - /** @var \XoopsNotificationHandler $notificationHandler */ |
|
70 | - $notificationHandler = xoops_getHandler('notification'); |
|
71 | - $tags['DIGEST_ID'] = $digest->getVar('digest_id'); |
|
72 | - $tags['DIGEST_CONTENT'] = $digest->getVar('digest_content', 'E'); |
|
73 | - $notificationHandler->triggerEvent('global', 0, 'digest', $tags); |
|
62 | + /** |
|
63 | + * @param \XoopsObject $digest |
|
64 | + * @return bool |
|
65 | + */ |
|
66 | + public function notify(\XoopsObject $digest) |
|
67 | + { |
|
68 | + //$content = $digest->getVar('digest_content'); |
|
69 | + /** @var \XoopsNotificationHandler $notificationHandler */ |
|
70 | + $notificationHandler = xoops_getHandler('notification'); |
|
71 | + $tags['DIGEST_ID'] = $digest->getVar('digest_id'); |
|
72 | + $tags['DIGEST_CONTENT'] = $digest->getVar('digest_content', 'E'); |
|
73 | + $notificationHandler->triggerEvent('global', 0, 'digest', $tags); |
|
74 | 74 | |
75 | - return true; |
|
76 | - } |
|
75 | + return true; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param $start |
|
80 | - * @param int $perpage |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function getAllDigests($start = 0, $perpage = 5) |
|
84 | - { |
|
85 | - // if (empty($start)) { |
|
86 | - // $start = 0; |
|
87 | - // } |
|
78 | + /** |
|
79 | + * @param $start |
|
80 | + * @param int $perpage |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function getAllDigests($start = 0, $perpage = 5) |
|
84 | + { |
|
85 | + // if (empty($start)) { |
|
86 | + // $start = 0; |
|
87 | + // } |
|
88 | 88 | |
89 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_digest') . ' ORDER BY digest_id DESC'; |
|
90 | - $result = $this->db->query($sql, $perpage, $start); |
|
91 | - $ret = []; |
|
92 | - // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); |
|
93 | - while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
94 | - $ret[] = $myrow; // return as array |
|
95 | - } |
|
89 | + $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_digest') . ' ORDER BY digest_id DESC'; |
|
90 | + $result = $this->db->query($sql, $perpage, $start); |
|
91 | + $ret = []; |
|
92 | + // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); |
|
93 | + while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
94 | + $ret[] = $myrow; // return as array |
|
95 | + } |
|
96 | 96 | |
97 | - return $ret; |
|
98 | - } |
|
97 | + return $ret; |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * @return int |
|
102 | - */ |
|
103 | - public function getDigestCount() |
|
104 | - { |
|
105 | - $sql = 'SELECT COUNT(*) AS count FROM ' . $this->db->prefix('newbb_digest'); |
|
106 | - $result = $this->db->query($sql); |
|
107 | - if (!$result) { |
|
108 | - return 0; |
|
109 | - } else { |
|
110 | - $array = $this->db->fetchArray($result); |
|
100 | + /** |
|
101 | + * @return int |
|
102 | + */ |
|
103 | + public function getDigestCount() |
|
104 | + { |
|
105 | + $sql = 'SELECT COUNT(*) AS count FROM ' . $this->db->prefix('newbb_digest'); |
|
106 | + $result = $this->db->query($sql); |
|
107 | + if (!$result) { |
|
108 | + return 0; |
|
109 | + } else { |
|
110 | + $array = $this->db->fetchArray($result); |
|
111 | 111 | |
112 | - return $array['count']; |
|
113 | - } |
|
114 | - } |
|
112 | + return $array['count']; |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - public function getLastDigest() |
|
117 | - { |
|
118 | - $sql = 'SELECT MAX(digest_time) AS last_digest FROM ' . $this->db->prefix('newbb_digest'); |
|
119 | - $result = $this->db->query($sql); |
|
120 | - if (!$result) { |
|
121 | - $this->last_digest = 0; |
|
122 | - // echo "<br>no data:".$query; |
|
123 | - } else { |
|
124 | - $array = $this->db->fetchArray($result); |
|
125 | - $this->last_digest = isset($array['last_digest']) ? $array['last_digest'] : 0; |
|
126 | - } |
|
127 | - } |
|
116 | + public function getLastDigest() |
|
117 | + { |
|
118 | + $sql = 'SELECT MAX(digest_time) AS last_digest FROM ' . $this->db->prefix('newbb_digest'); |
|
119 | + $result = $this->db->query($sql); |
|
120 | + if (!$result) { |
|
121 | + $this->last_digest = 0; |
|
122 | + // echo "<br>no data:".$query; |
|
123 | + } else { |
|
124 | + $array = $this->db->fetchArray($result); |
|
125 | + $this->last_digest = isset($array['last_digest']) ? $array['last_digest'] : 0; |
|
126 | + } |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * @return int |
|
131 | - */ |
|
132 | - public function checkStatus() |
|
133 | - { |
|
134 | - if (!isset($this->last_digest)) { |
|
135 | - $this->getLastDigest(); |
|
136 | - } |
|
137 | - $deadline = (1 == $GLOBALS['xoopsModuleConfig']['email_digest']) ? 60 * 60 * 24 : 60 * 60 * 24 * 7; |
|
138 | - $time_diff = time() - $this->last_digest; |
|
129 | + /** |
|
130 | + * @return int |
|
131 | + */ |
|
132 | + public function checkStatus() |
|
133 | + { |
|
134 | + if (!isset($this->last_digest)) { |
|
135 | + $this->getLastDigest(); |
|
136 | + } |
|
137 | + $deadline = (1 == $GLOBALS['xoopsModuleConfig']['email_digest']) ? 60 * 60 * 24 : 60 * 60 * 24 * 7; |
|
138 | + $time_diff = time() - $this->last_digest; |
|
139 | 139 | |
140 | - return $time_diff - $deadline; |
|
141 | - } |
|
140 | + return $time_diff - $deadline; |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * @param \XoopsObject $digest |
|
145 | - * @param bool $force flag to force the query execution despite security settings |
|
146 | - * @return mixed object ID or false |
|
147 | - */ |
|
148 | - public function insert(\XoopsObject $digest, $force = true) |
|
149 | - { |
|
150 | - $digest->setVar('digest_time', time()); |
|
151 | - return parent::insert($digest, $force); |
|
152 | - /* |
|
143 | + /** |
|
144 | + * @param \XoopsObject $digest |
|
145 | + * @param bool $force flag to force the query execution despite security settings |
|
146 | + * @return mixed object ID or false |
|
147 | + */ |
|
148 | + public function insert(\XoopsObject $digest, $force = true) |
|
149 | + { |
|
150 | + $digest->setVar('digest_time', time()); |
|
151 | + return parent::insert($digest, $force); |
|
152 | + /* |
|
153 | 153 | $content = $digest->getVar('digest_content', 'E'); |
154 | 154 | |
155 | 155 | $id = $this->db->genId($digest->table . '_digest_id_seq'); |
@@ -166,108 +166,108 @@ discard block |
||
166 | 166 | |
167 | 167 | return true; |
168 | 168 | */ |
169 | - } |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * @param \XoopsObject $digest |
|
173 | - * @param bool $force (ignored) |
|
174 | - * @return bool FALSE if failed. |
|
175 | - */ |
|
176 | - public function delete(\XoopsObject $digest, $force = false) |
|
177 | - { |
|
178 | - $digest_id = $digest->getVar('digest_id'); |
|
171 | + /** |
|
172 | + * @param \XoopsObject $digest |
|
173 | + * @param bool $force (ignored) |
|
174 | + * @return bool FALSE if failed. |
|
175 | + */ |
|
176 | + public function delete(\XoopsObject $digest, $force = false) |
|
177 | + { |
|
178 | + $digest_id = $digest->getVar('digest_id'); |
|
179 | 179 | |
180 | - if (!isset($this->last_digest)) { |
|
181 | - $this->getLastDigest(); |
|
182 | - } |
|
183 | - if ($this->last_digest == $digest_id) { |
|
184 | - return false; |
|
185 | - } // It is not allowed to delete the last digest |
|
180 | + if (!isset($this->last_digest)) { |
|
181 | + $this->getLastDigest(); |
|
182 | + } |
|
183 | + if ($this->last_digest == $digest_id) { |
|
184 | + return false; |
|
185 | + } // It is not allowed to delete the last digest |
|
186 | 186 | |
187 | - return parent::delete($digest, true); |
|
188 | - } |
|
187 | + return parent::delete($digest, true); |
|
188 | + } |
|
189 | 189 | |
190 | - /** |
|
191 | - * @param \XoopsObject $digest |
|
192 | - * @return bool |
|
193 | - */ |
|
194 | - public function buildDigest(\XoopsObject $digest) |
|
195 | - { |
|
196 | - global $xoopsModule; |
|
190 | + /** |
|
191 | + * @param \XoopsObject $digest |
|
192 | + * @return bool |
|
193 | + */ |
|
194 | + public function buildDigest(\XoopsObject $digest) |
|
195 | + { |
|
196 | + global $xoopsModule; |
|
197 | 197 | |
198 | - if (!defined('SUMMARY_LENGTH')) { |
|
199 | - define('SUMMARY_LENGTH', 100); |
|
200 | - } |
|
198 | + if (!defined('SUMMARY_LENGTH')) { |
|
199 | + define('SUMMARY_LENGTH', 100); |
|
200 | + } |
|
201 | 201 | |
202 | - /** @var Newbb\ForumHandler $forumHandler */ |
|
203 | - $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
204 | - $thisUser = $GLOBALS['xoopsUser']; |
|
205 | - $GLOBALS['xoopsUser'] = null; // To get posts accessible by anonymous |
|
206 | - $GLOBALS['xoopsUser'] = $thisUser; |
|
202 | + /** @var Newbb\ForumHandler $forumHandler */ |
|
203 | + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
204 | + $thisUser = $GLOBALS['xoopsUser']; |
|
205 | + $GLOBALS['xoopsUser'] = null; // To get posts accessible by anonymous |
|
206 | + $GLOBALS['xoopsUser'] = $thisUser; |
|
207 | 207 | |
208 | - $accessForums = $forumHandler->getIdsByPermission(); // get all accessible forums |
|
209 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $accessForums) . ')'; |
|
210 | - $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
|
211 | - $time_criteria = ' AND t.digest_time > ' . $this->last_digest; |
|
208 | + $accessForums = $forumHandler->getIdsByPermission(); // get all accessible forums |
|
209 | + $forumCriteria = ' AND t.forum_id IN (' . implode(',', $accessForums) . ')'; |
|
210 | + $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
|
211 | + $time_criteria = ' AND t.digest_time > ' . $this->last_digest; |
|
212 | 212 | |
213 | - $karma_criteria = $GLOBALS['xoopsModuleConfig']['enable_karma'] ? ' AND p.post_karma=0' : ''; |
|
214 | - $reply_criteria = $GLOBALS['xoopsModuleConfig']['allow_require_reply'] ? ' AND p.require_reply=0' : ''; |
|
213 | + $karma_criteria = $GLOBALS['xoopsModuleConfig']['enable_karma'] ? ' AND p.post_karma=0' : ''; |
|
214 | + $reply_criteria = $GLOBALS['xoopsModuleConfig']['allow_require_reply'] ? ' AND p.require_reply=0' : ''; |
|
215 | 215 | |
216 | - $query = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.digest_time, p.uid, p.poster_name, pt.post_text FROM ' |
|
217 | - . $this->db->prefix('newbb_topics') |
|
218 | - . ' t, ' |
|
219 | - . $this->db->prefix('newbb_posts_text') |
|
220 | - . ' pt, ' |
|
221 | - . $this->db->prefix('newbb_posts') |
|
222 | - . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 ' |
|
223 | - . $forumCriteria |
|
224 | - . $approveCriteria |
|
225 | - . $time_criteria |
|
226 | - . $karma_criteria |
|
227 | - . $reply_criteria |
|
228 | - . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC'; |
|
229 | - if (!$result = $this->db->query($query)) { |
|
230 | - //echo "<br>No result:<br>$query"; |
|
231 | - return false; |
|
232 | - } |
|
233 | - $rows = []; |
|
234 | - $users = []; |
|
235 | - while (false !== ($row = $this->db->fetchArray($result))) { |
|
236 | - $users[$row['uid']] = 1; |
|
237 | - $rows[] = $row; |
|
238 | - } |
|
239 | - if (count($rows) < 1) { |
|
240 | - return false; |
|
241 | - } |
|
242 | - $uids = array_keys($users); |
|
243 | - if (count($uids) > 0) { |
|
244 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
245 | - $memberHandler = xoops_getHandler('member'); |
|
246 | - $user_criteria = new \Criteria('uid', '(' . implode(',', $uids) . ')', 'IN'); |
|
247 | - $users = $memberHandler->getUsers($user_criteria, true); |
|
248 | - } else { |
|
249 | - $users = []; |
|
250 | - } |
|
216 | + $query = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.digest_time, p.uid, p.poster_name, pt.post_text FROM ' |
|
217 | + . $this->db->prefix('newbb_topics') |
|
218 | + . ' t, ' |
|
219 | + . $this->db->prefix('newbb_posts_text') |
|
220 | + . ' pt, ' |
|
221 | + . $this->db->prefix('newbb_posts') |
|
222 | + . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 ' |
|
223 | + . $forumCriteria |
|
224 | + . $approveCriteria |
|
225 | + . $time_criteria |
|
226 | + . $karma_criteria |
|
227 | + . $reply_criteria |
|
228 | + . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC'; |
|
229 | + if (!$result = $this->db->query($query)) { |
|
230 | + //echo "<br>No result:<br>$query"; |
|
231 | + return false; |
|
232 | + } |
|
233 | + $rows = []; |
|
234 | + $users = []; |
|
235 | + while (false !== ($row = $this->db->fetchArray($result))) { |
|
236 | + $users[$row['uid']] = 1; |
|
237 | + $rows[] = $row; |
|
238 | + } |
|
239 | + if (count($rows) < 1) { |
|
240 | + return false; |
|
241 | + } |
|
242 | + $uids = array_keys($users); |
|
243 | + if (count($uids) > 0) { |
|
244 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
245 | + $memberHandler = xoops_getHandler('member'); |
|
246 | + $user_criteria = new \Criteria('uid', '(' . implode(',', $uids) . ')', 'IN'); |
|
247 | + $users = $memberHandler->getUsers($user_criteria, true); |
|
248 | + } else { |
|
249 | + $users = []; |
|
250 | + } |
|
251 | 251 | |
252 | - foreach ($rows as $topic) { |
|
253 | - if ($topic['uid'] > 0) { |
|
254 | - if (isset($users[$topic['uid']]) && is_object($users[$topic['uid']]) |
|
255 | - && $users[$topic['uid']]->isActive()) { |
|
256 | - $topic['uname'] = $users[$topic['uid']]->getVar('uname'); |
|
257 | - } else { |
|
258 | - $topic['uname'] = $GLOBALS['xoopsConfig']['anonymous']; |
|
259 | - } |
|
260 | - } else { |
|
261 | - $topic['uname'] = $topic['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']; |
|
262 | - } |
|
263 | - $summary = \Xmf\Metagen::generateDescription($topic['post_text'], SUMMARY_LENGTH); |
|
264 | - $author = $topic['uname'] . ' (' . formatTimestamp($topic['topic_time']) . ')'; |
|
265 | - $link = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/viewtopic.php?topic_id=' . $topic['topic_id'] . '&forum=' . $topic['forum_id']; |
|
266 | - $title = $topic['topic_title']; |
|
267 | - $digest->addItem($title, $link, $author, $summary); |
|
268 | - } |
|
269 | - $digest->buildContent(); |
|
252 | + foreach ($rows as $topic) { |
|
253 | + if ($topic['uid'] > 0) { |
|
254 | + if (isset($users[$topic['uid']]) && is_object($users[$topic['uid']]) |
|
255 | + && $users[$topic['uid']]->isActive()) { |
|
256 | + $topic['uname'] = $users[$topic['uid']]->getVar('uname'); |
|
257 | + } else { |
|
258 | + $topic['uname'] = $GLOBALS['xoopsConfig']['anonymous']; |
|
259 | + } |
|
260 | + } else { |
|
261 | + $topic['uname'] = $topic['poster_name'] ?: $GLOBALS['xoopsConfig']['anonymous']; |
|
262 | + } |
|
263 | + $summary = \Xmf\Metagen::generateDescription($topic['post_text'], SUMMARY_LENGTH); |
|
264 | + $author = $topic['uname'] . ' (' . formatTimestamp($topic['topic_time']) . ')'; |
|
265 | + $link = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/viewtopic.php?topic_id=' . $topic['topic_id'] . '&forum=' . $topic['forum_id']; |
|
266 | + $title = $topic['topic_title']; |
|
267 | + $digest->addItem($title, $link, $author, $summary); |
|
268 | + } |
|
269 | + $digest->buildContent(); |
|
270 | 270 | |
271 | - return true; |
|
272 | - } |
|
271 | + return true; |
|
272 | + } |
|
273 | 273 | } |
@@ -21,49 +21,49 @@ |
||
21 | 21 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
22 | 22 | $moduleDirNameUpper = strtoupper($moduleDirName); |
23 | 23 | |
24 | -define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); |
|
25 | -define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); |
|
26 | -define('CO_' . $moduleDirNameUpper . '_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)"); |
|
27 | -define('CO_' . $moduleDirNameUpper . '_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)"); |
|
28 | -define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); |
|
29 | -define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); |
|
30 | -define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); |
|
31 | -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); |
|
32 | -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> "); |
|
33 | -define('CO_' . $moduleDirNameUpper . '_OFF', "<span style='font-weight: bold;'>OFF</span>"); |
|
34 | -define('CO_' . $moduleDirNameUpper . '_ON', "<span style='font-weight: bold;'>ON</span>"); |
|
35 | -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); |
|
36 | -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); |
|
37 | -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>"); |
|
38 | -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); |
|
24 | +define('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS', 'GD library support: '); |
|
25 | +define('CO_'.$moduleDirNameUpper.'_GDLIBVERSION', 'GD Library version: '); |
|
26 | +define('CO_'.$moduleDirNameUpper.'_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)"); |
|
27 | +define('CO_'.$moduleDirNameUpper.'_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)"); |
|
28 | +define('CO_'.$moduleDirNameUpper.'_IMAGEINFO', 'Server status'); |
|
29 | +define('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); |
|
30 | +define('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); |
|
31 | +define('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); |
|
32 | +define('CO_'.$moduleDirNameUpper.'_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> "); |
|
33 | +define('CO_'.$moduleDirNameUpper.'_OFF', "<span style='font-weight: bold;'>OFF</span>"); |
|
34 | +define('CO_'.$moduleDirNameUpper.'_ON', "<span style='font-weight: bold;'>ON</span>"); |
|
35 | +define('CO_'.$moduleDirNameUpper.'_SERVERPATH', 'Server path to XOOPS root: '); |
|
36 | +define('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS', 'Server uploads status: '); |
|
37 | +define('CO_'.$moduleDirNameUpper.'_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>"); |
|
38 | +define('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); |
|
39 | 39 | |
40 | -define('CO_' . $moduleDirNameUpper . '_PRINT', "<span style='font-weight: bold;'>Print</span>"); |
|
41 | -define('CO_' . $moduleDirNameUpper . '_PDF', "<span style='font-weight: bold;'>Create PDF</span>"); |
|
40 | +define('CO_'.$moduleDirNameUpper.'_PRINT', "<span style='font-weight: bold;'>Print</span>"); |
|
41 | +define('CO_'.$moduleDirNameUpper.'_PDF', "<span style='font-weight: bold;'>Create PDF</span>"); |
|
42 | 42 | |
43 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); |
|
44 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); |
|
45 | -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); |
|
46 | -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); |
|
47 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); |
|
48 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); |
|
49 | -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); |
|
43 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); |
|
44 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED1', "Update failed - couldn't add new fields"); |
|
45 | +define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); |
|
46 | +define('CO_'.$moduleDirNameUpper.'_ERROR_COLUMN', 'Could not create column in database : %s'); |
|
47 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); |
|
48 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); |
|
49 | +define('CO_'.$moduleDirNameUpper.'_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); |
|
50 | 50 | |
51 | -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); |
|
51 | +define('CO_'.$moduleDirNameUpper.'_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); |
|
52 | 52 | |
53 | 53 | // Error Msgs |
54 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); |
|
55 | -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); |
|
56 | -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); |
|
54 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); |
|
55 | +define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_REMOVE', 'Could not delete %s'); |
|
56 | +define('CO_'.$moduleDirNameUpper.'_ERROR_NO_PLUGIN', 'Could not load plugin'); |
|
57 | 57 | |
58 | 58 | //Help |
59 | -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); |
|
60 | -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); |
|
61 | -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); |
|
62 | -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); |
|
59 | +define('CO_'.$moduleDirNameUpper.'_DIRNAME', basename(dirname(dirname(__DIR__)))); |
|
60 | +define('CO_'.$moduleDirNameUpper.'_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); |
|
61 | +define('CO_'.$moduleDirNameUpper.'_BACK_2_ADMIN', 'Back to Administration of '); |
|
62 | +define('CO_'.$moduleDirNameUpper.'_OVERVIEW', 'Overview'); |
|
63 | 63 | |
64 | 64 | //define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); |
65 | 65 | |
66 | 66 | //help multi-page |
67 | -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); |
|
68 | -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); |
|
69 | -define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); |
|
67 | +define('CO_'.$moduleDirNameUpper.'_DISCLAIMER', 'Disclaimer'); |
|
68 | +define('CO_'.$moduleDirNameUpper.'_LICENSE', 'License'); |
|
69 | +define('CO_'.$moduleDirNameUpper.'_SUPPORT', 'Support'); |
@@ -178,8 +178,8 @@ |
||
178 | 178 | define('_AM_NEWBB_CAN_ATTACH', 'Can use attachment'); |
179 | 179 | define('_AM_NEWBB_CAN_NOAPPROVE', 'Can post directly'); |
180 | 180 | define('_AM_NEWBB_CAN_TYPE', 'Can use topic type'); |
181 | -define('_AM_NEWBB_CAN_HTML', 'Can use and disable/enable HTML in posts');//irmtfan revised |
|
182 | -define('_AM_NEWBB_CAN_SIGNATURE', 'Can use and disable/enable signature. Default is set in profile module.');//irmtfan revised |
|
181 | +define('_AM_NEWBB_CAN_HTML', 'Can use and disable/enable HTML in posts'); //irmtfan revised |
|
182 | +define('_AM_NEWBB_CAN_SIGNATURE', 'Can use and disable/enable signature. Default is set in profile module.'); //irmtfan revised |
|
183 | 183 | define('_AM_NEWBB_ACTION', 'Action'); |
184 | 184 | define('_AM_NEWBB_PERM_TEMPLATE', 'Set default permission template'); |
185 | 185 | define('_AM_NEWBB_PERM_TEMPLATE_DESC', 'Edit the following permission template so that it can be applied to a forum or a couple of forums'); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // |
3 | 3 | if (defined('NEWBB_ADMIN_DEFINED')) { |
4 | - return; |
|
4 | + return; |
|
5 | 5 | } else { |
6 | - define('NEWBB_ADMIN_DEFINED', true); |
|
6 | + define('NEWBB_ADMIN_DEFINED', true); |
|
7 | 7 | } |
8 | 8 | //%%%%%% File Name index.php %%%%% |
9 | 9 | define('_AM_NEWBB_FORUMCONF', 'Forum Configuration'); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | define('_AM_NEWBB_DIGEST_HELP_3', 'The dispatch is made only to users signed up for notification of digest topics.'); |
76 | 76 | define('_AM_NEWBB_DIGEST_HELP_4', 'After creating and sending, do not delete the created messages. Otherwise they will be generated again.'); |
77 | 77 | define( |
78 | - '_AM_NEWBB_DIGEST_HELP_AUTO_DIGEST', |
|
79 | - 'To configure the automatic creation and distribution of Digest topics, you need to create a cron task on your server.<br>For example: * NIX systems: <strong>0 6 * * * wget --post-data \'foo=bar\' https://example.com/modules/newbb/digest.php</strong><br>In this example, the script will run every day at 6.00 and check if there are any new Digest topics. If they are not found, mailing will not be done.<br>If for any reason you do not have the opportunity to create a task, then it is possible to create and make the dispatch on this page manually by clicking on the button above.<br>Please note that it is not recommended to delete created mailings, otherwise they will be created and sent again.' |
|
78 | + '_AM_NEWBB_DIGEST_HELP_AUTO_DIGEST', |
|
79 | + 'To configure the automatic creation and distribution of Digest topics, you need to create a cron task on your server.<br>For example: * NIX systems: <strong>0 6 * * * wget --post-data \'foo=bar\' https://example.com/modules/newbb/digest.php</strong><br>In this example, the script will run every day at 6.00 and check if there are any new Digest topics. If they are not found, mailing will not be done.<br>If for any reason you do not have the opportunity to create a task, then it is possible to create and make the dispatch on this page manually by clicking on the button above.<br>Please note that it is not recommended to delete created mailings, otherwise they will be created and sent again.' |
|
80 | 80 | ); |
81 | 81 | //define('_AM_NEWBB_DIGEST_PAST', '<span style="color:red;">Should be sent out %d minutes ago</span>'); |
82 | 82 | //define('_AM_NEWBB_DIGEST_NEXT', 'Need to send out in %d minutes'); |
@@ -324,31 +324,31 @@ discard block |
||
324 | 324 | |
325 | 325 | // Help tab |
326 | 326 | define( |
327 | - '_AM_NEWBB_HELP_CATEGORY_TAB', |
|
328 | - 'To create a category, use the button above and fill in all the fields on the form.<br>By default, category images are located: /modules/newbb/assets/images/category/<br>Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.' |
|
327 | + '_AM_NEWBB_HELP_CATEGORY_TAB', |
|
328 | + 'To create a category, use the button above and fill in all the fields on the form.<br>By default, category images are located: /modules/newbb/assets/images/category/<br>Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.' |
|
329 | 329 | ); |
330 | 330 | define( |
331 | - '_AM_NEWBB_HELP_FORUM_TAB', |
|
332 | - 'To create and manage the forums use the buttons with the right<br>To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.<br>To move the forum between categories, use the \'Move\' button. Follow the further instructions.<br>To merge forums, use the \'Merge\' button. Follow the further instructions.<br>If you have an access rights template, then you can apply it to the forum you are creating.' |
|
331 | + '_AM_NEWBB_HELP_FORUM_TAB', |
|
332 | + 'To create and manage the forums use the buttons with the right<br>To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.<br>To move the forum between categories, use the \'Move\' button. Follow the further instructions.<br>To merge forums, use the \'Merge\' button. Follow the further instructions.<br>If you have an access rights template, then you can apply it to the forum you are creating.' |
|
333 | 333 | ); |
334 | 334 | define( |
335 | - '_AM_NEWBB_HELP_PERMISSION_TAB', |
|
336 | - '<strong>When setting permissions, be careful.</strong><br>After you install and apply the settings, you will automatically go to the next permissions tab.<br>Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.' |
|
335 | + '_AM_NEWBB_HELP_PERMISSION_TAB', |
|
336 | + '<strong>When setting permissions, be careful.</strong><br>After you install and apply the settings, you will automatically go to the next permissions tab.<br>Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.' |
|
337 | 337 | ); |
338 | 338 | define('_AM_NEWBB_HELP_ORDER_TAB', 'Allows you to set the order of categories and forums relative to each other.<br>The order (Weight) is set to 0 - top, 99 (and further) - bottom.'); |
339 | 339 | define('_AM_NEWBB_HELP_PRUNE_TAB', 'Allows you to clear forums from empty themes, obsolete themes, etc.<br>Also you can not delete topics that you want to clear, but transfer them to a specially created category \'Archive\' or any other.'); |
340 | 340 | define( |
341 | - '_AM_NEWBB_HELP_REPORT_TAB', |
|
342 | - 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.<br>You can review the report and take action in relation to the message, the author, etc.<br>When a user sends a message, moderators and administrators are notified by e-mail.' |
|
341 | + '_AM_NEWBB_HELP_REPORT_TAB', |
|
342 | + 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.<br>You can review the report and take action in relation to the message, the author, etc.<br>When a user sends a message, moderators and administrators are notified by e-mail.' |
|
343 | 343 | ); |
344 | 344 | define('_AM_NEWBB_HELP_VOTE_TAB', 'If you have the voting function enabled, here you can see the results of the voting.<br>This vote is not associated with other XOOPS modules.'); |
345 | 345 | define( |
346 | - '_AM_NEWBB_HELP_TYPE_TAB', |
|
347 | - 'Allows you to create tags for highlighting themes. For example:<br><strong style="color:blue;">[Important]</strong> <strong>Topic Title</strong><br><strong style="color:red;">[ATTENTION]</strong> <strong>Topic Title</strong><br>You can set theme types when creating a theme on the user side.' |
|
346 | + '_AM_NEWBB_HELP_TYPE_TAB', |
|
347 | + 'Allows you to create tags for highlighting themes. For example:<br><strong style="color:blue;">[Important]</strong> <strong>Topic Title</strong><br><strong style="color:red;">[ATTENTION]</strong> <strong>Topic Title</strong><br>You can set theme types when creating a theme on the user side.' |
|
348 | 348 | ); |
349 | 349 | define( |
350 | - '_AM_NEWBB_HELP_GROUPMOD_TAB', |
|
351 | - 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.<br>It is recommended to create separate groups of moderators, for more convenient management of moderators.<br>You can also assign specific users to moderators when creating a forum.' |
|
350 | + '_AM_NEWBB_HELP_GROUPMOD_TAB', |
|
351 | + 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.<br>It is recommended to create separate groups of moderators, for more convenient management of moderators.<br>You can also assign specific users to moderators when creating a forum.' |
|
352 | 352 | ); |
353 | 353 | define('_AM_NEWBB_HELP_SYNC_TAB', 'If you notice a problem with the message dates, the appearance of blank messages, etc. Here you can synchronize and correct forum data and topics'); |
354 | 354 |