@@ -30,27 +30,27 @@ |
||
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Brate')): |
33 | - /** |
|
34 | - * Class Brate |
|
35 | - */ |
|
36 | - class Brate extends XoopsObject |
|
37 | - { |
|
38 | - /** |
|
39 | - * Brate constructor. |
|
40 | - * @param null $id |
|
41 | - */ |
|
42 | - public function __construct($id = null) |
|
43 | - { |
|
44 | - // $this->ArtObject(); |
|
45 | - $this->table = planet_DB_prefix('rate'); |
|
46 | - $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
47 | - $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
48 | - $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
49 | - $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
50 | - $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
51 | - $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
52 | - } |
|
53 | - } |
|
33 | + /** |
|
34 | + * Class Brate |
|
35 | + */ |
|
36 | + class Brate extends XoopsObject |
|
37 | + { |
|
38 | + /** |
|
39 | + * Brate constructor. |
|
40 | + * @param null $id |
|
41 | + */ |
|
42 | + public function __construct($id = null) |
|
43 | + { |
|
44 | + // $this->ArtObject(); |
|
45 | + $this->table = planet_DB_prefix('rate'); |
|
46 | + $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
47 | + $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
48 | + $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
49 | + $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
50 | + $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
51 | + $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | endif; |
55 | 55 | |
56 | 56 | PlanetUtility::planetParseClass(' |
@@ -81,100 +81,100 @@ |
||
81 | 81 | * @link |
82 | 82 | */ |
83 | 83 | if (!class_exists('Xmlfeed')) { |
84 | - /** |
|
85 | - * Class Bxmlfeed |
|
86 | - */ |
|
87 | - class Bxmlfeed extends UniversalFeedCreator |
|
88 | - { |
|
89 | - public $version; |
|
90 | - public $filename = ''; |
|
91 | - |
|
92 | - /** |
|
93 | - * Bxmlfeed constructor. |
|
94 | - * @param $version |
|
95 | - */ |
|
96 | - public function __construct($version) |
|
97 | - { |
|
98 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
99 | - $this->version = $version; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @param $var |
|
104 | - * @param $val |
|
105 | - * @param bool $encoding |
|
106 | - */ |
|
107 | - public function setVar($var, $val, $encoding = false) |
|
108 | - { |
|
109 | - if (!empty($encoding)) { |
|
110 | - $val = $this->convert_encoding($val); |
|
111 | - } |
|
112 | - $this->$var = $val; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * @param $val |
|
117 | - * @return array|mixed|string |
|
118 | - */ |
|
119 | - public function convert_encoding($val) |
|
120 | - { |
|
121 | - if (is_array($val)) { |
|
122 | - foreach (array_keys($val) as $key) { |
|
123 | - $val[$key] = $this->convert_encoding($val[$key]); |
|
124 | - } |
|
125 | - } else { |
|
126 | - $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
127 | - } |
|
128 | - |
|
129 | - return $val; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @param $var |
|
134 | - * @return mixed |
|
135 | - */ |
|
136 | - public function getVar($var) |
|
137 | - { |
|
138 | - return $this->$var; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @param $img |
|
143 | - */ |
|
144 | - public function setImage(&$img) |
|
145 | - { |
|
146 | - $image = new FeedImage(); |
|
147 | - foreach ($img as $key => $val) { |
|
148 | - $image->$key = $this->convert_encoding($val); |
|
149 | - } |
|
150 | - $this->setVar('image', $image); |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * @param $itm |
|
155 | - */ |
|
156 | - public function _addItem(&$itm) |
|
157 | - { |
|
158 | - $item = new FeedItem(); |
|
159 | - foreach ($itm as $key => $val) { |
|
160 | - $item->$key = $this->convert_encoding($val); |
|
161 | - } |
|
162 | - $this->addItem($item); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @param $items |
|
167 | - */ |
|
168 | - public function addItems(&$items) |
|
169 | - { |
|
170 | - if (!is_array($items) || count($items) == 0) { |
|
171 | - return; |
|
172 | - } |
|
173 | - foreach ($items as $item) { |
|
174 | - $this->_addItem($item); |
|
175 | - } |
|
176 | - } |
|
177 | - } |
|
84 | + /** |
|
85 | + * Class Bxmlfeed |
|
86 | + */ |
|
87 | + class Bxmlfeed extends UniversalFeedCreator |
|
88 | + { |
|
89 | + public $version; |
|
90 | + public $filename = ''; |
|
91 | + |
|
92 | + /** |
|
93 | + * Bxmlfeed constructor. |
|
94 | + * @param $version |
|
95 | + */ |
|
96 | + public function __construct($version) |
|
97 | + { |
|
98 | + $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
99 | + $this->version = $version; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @param $var |
|
104 | + * @param $val |
|
105 | + * @param bool $encoding |
|
106 | + */ |
|
107 | + public function setVar($var, $val, $encoding = false) |
|
108 | + { |
|
109 | + if (!empty($encoding)) { |
|
110 | + $val = $this->convert_encoding($val); |
|
111 | + } |
|
112 | + $this->$var = $val; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * @param $val |
|
117 | + * @return array|mixed|string |
|
118 | + */ |
|
119 | + public function convert_encoding($val) |
|
120 | + { |
|
121 | + if (is_array($val)) { |
|
122 | + foreach (array_keys($val) as $key) { |
|
123 | + $val[$key] = $this->convert_encoding($val[$key]); |
|
124 | + } |
|
125 | + } else { |
|
126 | + $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
127 | + } |
|
128 | + |
|
129 | + return $val; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @param $var |
|
134 | + * @return mixed |
|
135 | + */ |
|
136 | + public function getVar($var) |
|
137 | + { |
|
138 | + return $this->$var; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @param $img |
|
143 | + */ |
|
144 | + public function setImage(&$img) |
|
145 | + { |
|
146 | + $image = new FeedImage(); |
|
147 | + foreach ($img as $key => $val) { |
|
148 | + $image->$key = $this->convert_encoding($val); |
|
149 | + } |
|
150 | + $this->setVar('image', $image); |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * @param $itm |
|
155 | + */ |
|
156 | + public function _addItem(&$itm) |
|
157 | + { |
|
158 | + $item = new FeedItem(); |
|
159 | + foreach ($itm as $key => $val) { |
|
160 | + $item->$key = $this->convert_encoding($val); |
|
161 | + } |
|
162 | + $this->addItem($item); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @param $items |
|
167 | + */ |
|
168 | + public function addItems(&$items) |
|
169 | + { |
|
170 | + if (!is_array($items) || count($items) == 0) { |
|
171 | + return; |
|
172 | + } |
|
173 | + foreach ($items as $item) { |
|
174 | + $this->_addItem($item); |
|
175 | + } |
|
176 | + } |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | PlanetUtility::planetParseClass(' |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
34 | 34 | |
35 | 35 | if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
36 | - redirect_header('index.php', 2, _NOPERM); |
|
36 | + redirect_header('index.php', 2, _NOPERM); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if ($op === 'save' && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) { |
40 | - $op = 'edit'; |
|
40 | + $op = 'edit'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ($op === 'save' && !$GLOBALS['xoopsSecurity']->check()) { |
44 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
44 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
45 | 45 | } |
46 | 46 | include XOOPS_ROOT_PATH . '/header.php'; |
47 | 47 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
@@ -50,109 +50,109 @@ discard block |
||
50 | 50 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
51 | 51 | |
52 | 52 | switch ($op) { |
53 | - /* save a single blog */ |
|
54 | - case 'save': |
|
55 | - |
|
56 | - if ($blog_id) { |
|
57 | - $blog_obj = $blogHandler->get($blog_id); |
|
58 | - if ($xoopsUser->isAdmin()) { |
|
59 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
60 | - } |
|
61 | - } else { |
|
62 | - if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
63 | - ) { |
|
64 | - redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
65 | - } |
|
66 | - |
|
67 | - $blog_obj = $blogHandler->create(); |
|
68 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
69 | - |
|
70 | - switch ($xoopsModuleConfig['newblog_submit']) { |
|
71 | - case 2: |
|
72 | - if (!is_object($xoopsUser)) { |
|
73 | - $status = 0; |
|
74 | - } else { |
|
75 | - $status = 1; |
|
76 | - } |
|
77 | - break; |
|
78 | - case 0: |
|
79 | - case 3: |
|
80 | - $status = 1; |
|
81 | - break; |
|
82 | - case 1: |
|
83 | - default: |
|
84 | - if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
85 | - $status = 0; |
|
86 | - } else { |
|
87 | - $status = 1; |
|
88 | - } |
|
89 | - break; |
|
90 | - } |
|
91 | - |
|
92 | - $blog_obj->setVar('blog_status', $status); |
|
93 | - } |
|
94 | - |
|
95 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
96 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
97 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
98 | - $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
99 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
100 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
101 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
102 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
103 | - if ($blog_obj->isNew()) { |
|
104 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
105 | - } |
|
106 | - |
|
107 | - if (!$blogHandler->insert($blog_obj)) { |
|
108 | - } elseif (0 !== count(Request::getArray('categories', array(), 'POST'))) { |
|
109 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | - if (in_array(0, $_POST['categories'])) { |
|
111 | - $_POST['categories'] = array(); |
|
112 | - } |
|
113 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
114 | - } |
|
115 | - $message = planet_constant('MD_DBUPDATED'); |
|
116 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
117 | - |
|
118 | - /* edit a single blog */ |
|
119 | - case 'edit': |
|
120 | - default: |
|
121 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
122 | - $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
123 | - $blog_obj->setVar('blog_id', $blog_id); |
|
124 | - } else { |
|
125 | - $blog_obj = $blogHandler->get($blog_id); |
|
126 | - } |
|
127 | - $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | - if (in_array('-1', $categories)) { |
|
129 | - $categories = array(); |
|
130 | - } |
|
131 | - if (empty($categories) && $blog_id > 0) { |
|
132 | - $crit = new Criteria('bc.blog_id', $blog_id); |
|
133 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
134 | - } |
|
135 | - if (empty($categories)) { |
|
136 | - $categories = array(0 => _NONE); |
|
137 | - } |
|
138 | - |
|
139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
140 | - echo '<br>'; |
|
141 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
142 | - $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
143 | - $blogs_obj = $blogHandler->getList($criteria); |
|
144 | - if (count($blogs_obj) > 0) { |
|
145 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
146 | - foreach (array_keys($blogs_obj) as $bid) { |
|
147 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
148 | - } |
|
149 | - echo '</div>'; |
|
150 | - unset($blogs_obj, $criteria); |
|
151 | - } |
|
152 | - } |
|
153 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
154 | - echo '</fieldset>'; |
|
155 | - break; |
|
53 | + /* save a single blog */ |
|
54 | + case 'save': |
|
55 | + |
|
56 | + if ($blog_id) { |
|
57 | + $blog_obj = $blogHandler->get($blog_id); |
|
58 | + if ($xoopsUser->isAdmin()) { |
|
59 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
60 | + } |
|
61 | + } else { |
|
62 | + if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
63 | + ) { |
|
64 | + redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
65 | + } |
|
66 | + |
|
67 | + $blog_obj = $blogHandler->create(); |
|
68 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
69 | + |
|
70 | + switch ($xoopsModuleConfig['newblog_submit']) { |
|
71 | + case 2: |
|
72 | + if (!is_object($xoopsUser)) { |
|
73 | + $status = 0; |
|
74 | + } else { |
|
75 | + $status = 1; |
|
76 | + } |
|
77 | + break; |
|
78 | + case 0: |
|
79 | + case 3: |
|
80 | + $status = 1; |
|
81 | + break; |
|
82 | + case 1: |
|
83 | + default: |
|
84 | + if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
85 | + $status = 0; |
|
86 | + } else { |
|
87 | + $status = 1; |
|
88 | + } |
|
89 | + break; |
|
90 | + } |
|
91 | + |
|
92 | + $blog_obj->setVar('blog_status', $status); |
|
93 | + } |
|
94 | + |
|
95 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
96 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
97 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
98 | + $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
99 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
100 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
101 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
102 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
103 | + if ($blog_obj->isNew()) { |
|
104 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
105 | + } |
|
106 | + |
|
107 | + if (!$blogHandler->insert($blog_obj)) { |
|
108 | + } elseif (0 !== count(Request::getArray('categories', array(), 'POST'))) { |
|
109 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | + if (in_array(0, $_POST['categories'])) { |
|
111 | + $_POST['categories'] = array(); |
|
112 | + } |
|
113 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
114 | + } |
|
115 | + $message = planet_constant('MD_DBUPDATED'); |
|
116 | + redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
117 | + |
|
118 | + /* edit a single blog */ |
|
119 | + case 'edit': |
|
120 | + default: |
|
121 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
122 | + $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
123 | + $blog_obj->setVar('blog_id', $blog_id); |
|
124 | + } else { |
|
125 | + $blog_obj = $blogHandler->get($blog_id); |
|
126 | + } |
|
127 | + $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | + if (in_array('-1', $categories)) { |
|
129 | + $categories = array(); |
|
130 | + } |
|
131 | + if (empty($categories) && $blog_id > 0) { |
|
132 | + $crit = new Criteria('bc.blog_id', $blog_id); |
|
133 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
134 | + } |
|
135 | + if (empty($categories)) { |
|
136 | + $categories = array(0 => _NONE); |
|
137 | + } |
|
138 | + |
|
139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
140 | + echo '<br>'; |
|
141 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
142 | + $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
143 | + $blogs_obj = $blogHandler->getList($criteria); |
|
144 | + if (count($blogs_obj) > 0) { |
|
145 | + echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
146 | + foreach (array_keys($blogs_obj) as $bid) { |
|
147 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
148 | + } |
|
149 | + echo '</div>'; |
|
150 | + unset($blogs_obj, $criteria); |
|
151 | + } |
|
152 | + } |
|
153 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
154 | + echo '</fieldset>'; |
|
155 | + break; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -33,61 +33,61 @@ |
||
33 | 33 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0)); |
34 | 34 | |
35 | 35 | if (empty($article_id) && empty($blog_id)) { |
36 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
36 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
40 | 40 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
41 | 41 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
42 | - $message = planet_constant('MD_NOACCESS'); |
|
42 | + $message = planet_constant('MD_NOACCESS'); |
|
43 | 43 | } else { |
44 | - $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
45 | - $ip = PlanetUtility::planetGetIP(); |
|
46 | - if ($article_id > 0) { |
|
47 | - $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
48 | - } else { |
|
49 | - $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
|
50 | - } |
|
51 | - if ($uid > 0) { |
|
52 | - $criteria->add(new Criteria('rate_uid', $uid)); |
|
53 | - } else { |
|
54 | - $criteria->add(new Criteria('rate_ip', $ip)); |
|
55 | - $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
56 | - } |
|
57 | - $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
58 | - if ($count = $rateHandler->getCount($criteria)) { |
|
59 | - $message = planet_constant('MD_ALREADYRATED'); |
|
60 | - } else { |
|
61 | - $rate_obj = $rateHandler->create(); |
|
62 | - if ($article_id > 0) { |
|
63 | - $rate_obj->setVar('art_id', $article_id); |
|
64 | - } else { |
|
65 | - $rate_obj->setVar('blog_id', $blog_id); |
|
66 | - } |
|
67 | - $rate_obj->setVar('rate_uid', $uid); |
|
68 | - $rate_obj->setVar('rate_ip', $ip); |
|
69 | - $rate_obj->setVar('rate_rating', $rate); |
|
70 | - $rate_obj->setVar('rate_time', time()); |
|
71 | - if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
72 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
73 | - } |
|
74 | - if ($article_id > 0) { |
|
75 | - $article_obj = $articleHandler->get($article_id); |
|
76 | - $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
77 | - $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
78 | - $articleHandler->insert($article_obj, true); |
|
79 | - } else { |
|
80 | - $blog_obj = $blogHandler->get($blog_id); |
|
81 | - $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
82 | - $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
83 | - $blogHandler->insert($blog_obj, true); |
|
84 | - } |
|
85 | - $message = planet_constant('MD_ACTIONDONE'); |
|
86 | - } |
|
44 | + $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
45 | + $ip = PlanetUtility::planetGetIP(); |
|
46 | + if ($article_id > 0) { |
|
47 | + $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
48 | + } else { |
|
49 | + $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
|
50 | + } |
|
51 | + if ($uid > 0) { |
|
52 | + $criteria->add(new Criteria('rate_uid', $uid)); |
|
53 | + } else { |
|
54 | + $criteria->add(new Criteria('rate_ip', $ip)); |
|
55 | + $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
56 | + } |
|
57 | + $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
58 | + if ($count = $rateHandler->getCount($criteria)) { |
|
59 | + $message = planet_constant('MD_ALREADYRATED'); |
|
60 | + } else { |
|
61 | + $rate_obj = $rateHandler->create(); |
|
62 | + if ($article_id > 0) { |
|
63 | + $rate_obj->setVar('art_id', $article_id); |
|
64 | + } else { |
|
65 | + $rate_obj->setVar('blog_id', $blog_id); |
|
66 | + } |
|
67 | + $rate_obj->setVar('rate_uid', $uid); |
|
68 | + $rate_obj->setVar('rate_ip', $ip); |
|
69 | + $rate_obj->setVar('rate_rating', $rate); |
|
70 | + $rate_obj->setVar('rate_time', time()); |
|
71 | + if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
72 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
73 | + } |
|
74 | + if ($article_id > 0) { |
|
75 | + $article_obj = $articleHandler->get($article_id); |
|
76 | + $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
77 | + $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
78 | + $articleHandler->insert($article_obj, true); |
|
79 | + } else { |
|
80 | + $blog_obj = $blogHandler->get($blog_id); |
|
81 | + $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
82 | + $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
83 | + $blogHandler->insert($blog_obj, true); |
|
84 | + } |
|
85 | + $message = planet_constant('MD_ACTIONDONE'); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | if ($article_id > 0) { |
89 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
89 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
90 | 90 | } else { |
91 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
91 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
92 | 92 | } |
93 | 93 | include __DIR__ . '/footer.php'; |
@@ -32,88 +32,88 @@ |
||
32 | 32 | |
33 | 33 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
34 | 34 | if (!defined('PLANET_INI')) { |
35 | - exit(); |
|
35 | + exit(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!defined('PLANET_FUNCTIONS_INI')): |
39 | - define('PLANET_FUNCTIONS_INI', 1); |
|
39 | + define('PLANET_FUNCTIONS_INI', 1); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param $name |
|
43 | - * @return mixed |
|
44 | - */ |
|
45 | - function planet_constant($name) |
|
46 | - { |
|
47 | - return mod_constant($name); |
|
48 | - } |
|
41 | + /** |
|
42 | + * @param $name |
|
43 | + * @return mixed |
|
44 | + */ |
|
45 | + function planet_constant($name) |
|
46 | + { |
|
47 | + return mod_constant($name); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param $name |
|
52 | - * @param bool $isRel |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - function planet_DB_prefix($name, $isRel = false) |
|
56 | - { |
|
57 | - return mod_DB_prefix($name, $isRel); |
|
58 | - } |
|
50 | + /** |
|
51 | + * @param $name |
|
52 | + * @param bool $isRel |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + function planet_DB_prefix($name, $isRel = false) |
|
56 | + { |
|
57 | + return mod_DB_prefix($name, $isRel); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @return bool |
|
62 | - */ |
|
63 | - function planet_load_object() |
|
64 | - { |
|
65 | - return load_object(); |
|
66 | - } |
|
60 | + /** |
|
61 | + * @return bool |
|
62 | + */ |
|
63 | + function planet_load_object() |
|
64 | + { |
|
65 | + return load_object(); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array|mixed |
|
70 | - */ |
|
71 | - function planet_load_config() |
|
72 | - { |
|
73 | - static $moduleConfig; |
|
74 | - if (isset($moduleConfig)) { |
|
75 | - return $moduleConfig; |
|
76 | - } |
|
68 | + /** |
|
69 | + * @return array|mixed |
|
70 | + */ |
|
71 | + function planet_load_config() |
|
72 | + { |
|
73 | + static $moduleConfig; |
|
74 | + if (isset($moduleConfig)) { |
|
75 | + return $moduleConfig; |
|
76 | + } |
|
77 | 77 | |
78 | - if (is_object($GLOBALS['xoopsModule']) |
|
79 | - && $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) { |
|
80 | - if (isset($GLOBALS['xoopsModuleConfig'])) { |
|
81 | - $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
|
82 | - } |
|
83 | - } else { |
|
84 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
85 | - $moduleHandler = xoops_getHandler('module'); |
|
86 | - $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
|
78 | + if (is_object($GLOBALS['xoopsModule']) |
|
79 | + && $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) { |
|
80 | + if (isset($GLOBALS['xoopsModuleConfig'])) { |
|
81 | + $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
|
82 | + } |
|
83 | + } else { |
|
84 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
85 | + $moduleHandler = xoops_getHandler('module'); |
|
86 | + $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
|
87 | 87 | |
88 | - $configHandler = xoops_getHandler('config'); |
|
89 | - $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); |
|
90 | - $configs = $configHandler->getConfigs($criteria); |
|
91 | - foreach (array_keys($configs) as $i) { |
|
92 | - $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
93 | - } |
|
94 | - unset($configs); |
|
95 | - } |
|
96 | - if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
97 | - $moduleConfig = array_merge($moduleConfig, $customConfig); |
|
98 | - } |
|
88 | + $configHandler = xoops_getHandler('config'); |
|
89 | + $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); |
|
90 | + $configs = $configHandler->getConfigs($criteria); |
|
91 | + foreach (array_keys($configs) as $i) { |
|
92 | + $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
93 | + } |
|
94 | + unset($configs); |
|
95 | + } |
|
96 | + if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
97 | + $moduleConfig = array_merge($moduleConfig, $customConfig); |
|
98 | + } |
|
99 | 99 | |
100 | - return $moduleConfig; |
|
101 | - } |
|
100 | + return $moduleConfig; |
|
101 | + } |
|
102 | 102 | |
103 | - function planet_define_url_delimiter() |
|
104 | - { |
|
105 | - if (defined('URL_DELIMITER')) { |
|
106 | - if (!in_array(URL_DELIMITER, array('?', '/'))) { |
|
107 | - die('Exit on security'); |
|
108 | - } |
|
109 | - } else { |
|
110 | - $moduleConfig = planet_load_config(); |
|
111 | - if (empty($moduleConfig['do_urw'])) { |
|
112 | - define('URL_DELIMITER', '?'); |
|
113 | - } else { |
|
114 | - define('URL_DELIMITER', '/'); |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
103 | + function planet_define_url_delimiter() |
|
104 | + { |
|
105 | + if (defined('URL_DELIMITER')) { |
|
106 | + if (!in_array(URL_DELIMITER, array('?', '/'))) { |
|
107 | + die('Exit on security'); |
|
108 | + } |
|
109 | + } else { |
|
110 | + $moduleConfig = planet_load_config(); |
|
111 | + if (empty($moduleConfig['do_urw'])) { |
|
112 | + define('URL_DELIMITER', '?'); |
|
113 | + } else { |
|
114 | + define('URL_DELIMITER', '/'); |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | endif; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
16 | 16 | |
17 | 17 | if (!@require_once XOOPS_ROOT_PATH . '/Frameworks/transfer/transfer.php') { |
18 | - return null; |
|
18 | + return null; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // Specify the addons to skip for the module |
@@ -28,41 +28,41 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class ModuleTransferHandler extends TransferHandler |
30 | 30 | { |
31 | - /** |
|
32 | - * ModuleTransferHandler constructor. |
|
33 | - */ |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - parent::__construct(); |
|
37 | - } |
|
31 | + /** |
|
32 | + * ModuleTransferHandler constructor. |
|
33 | + */ |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + parent::__construct(); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Get valid addon list |
|
41 | - * |
|
42 | - * @param array $skip Addons to skip |
|
43 | - * @param boolean $sort To sort the list upon 'level' |
|
44 | - * return array $list |
|
45 | - */ |
|
46 | - public function &getList($skip = array(), $sort = true) |
|
47 | - { |
|
48 | - $list = parent::getList($skip, $sort); |
|
39 | + /** |
|
40 | + * Get valid addon list |
|
41 | + * |
|
42 | + * @param array $skip Addons to skip |
|
43 | + * @param boolean $sort To sort the list upon 'level' |
|
44 | + * return array $list |
|
45 | + */ |
|
46 | + public function &getList($skip = array(), $sort = true) |
|
47 | + { |
|
48 | + $list = parent::getList($skip, $sort); |
|
49 | 49 | |
50 | - return $list; |
|
51 | - } |
|
50 | + return $list; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * If need change config of an item |
|
55 | - * 1 parent::load_item |
|
56 | - * 2 $this->config |
|
57 | - * 3 $this->do_transfer |
|
58 | - * @param $item |
|
59 | - * @param $data |
|
60 | - * @return |
|
61 | - */ |
|
62 | - public function do_transfer($item, &$data) |
|
63 | - { |
|
64 | - $ret = parent::do_transfer($item, $data); |
|
53 | + /** |
|
54 | + * If need change config of an item |
|
55 | + * 1 parent::load_item |
|
56 | + * 2 $this->config |
|
57 | + * 3 $this->do_transfer |
|
58 | + * @param $item |
|
59 | + * @param $data |
|
60 | + * @return |
|
61 | + */ |
|
62 | + public function do_transfer($item, &$data) |
|
63 | + { |
|
64 | + $ret = parent::do_transfer($item, $data); |
|
65 | 65 | |
66 | - return $ret; |
|
67 | - } |
|
66 | + return $ret; |
|
67 | + } |
|
68 | 68 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | if (!defined('PLANET_INI')) { |
29 | - define('PLANET_INI', 1); |
|
29 | + define('PLANET_INI', 1); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | require_once __DIR__ . '/../class/utility.php'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | // include customized variables |
57 | 57 | if (is_object($GLOBALS['xoopsModule']) && $GLOBALS['moddirname'] == $GLOBALS['xoopsModule']->getVar('dirname', 'n')) { |
58 | - $GLOBALS['xoopsModuleConfig'] = planet_load_config(); |
|
58 | + $GLOBALS['xoopsModuleConfig'] = planet_load_config(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | planet_load_object(); |
@@ -43,28 +43,28 @@ |
||
43 | 43 | $categories_option = $categoryHandler->getList(); |
44 | 44 | natsort($categories_option); |
45 | 45 | if (count($categories_option)) { |
46 | - $cat_option_tray = new XoopsFormElementTray(planet_constant('MD_CATEGORY'), '<br>'); |
|
47 | - $options = array(0 => _NONE); |
|
48 | - foreach ($categories_option as $id => $title) { |
|
49 | - $options[$id] = $title; |
|
50 | - } |
|
51 | - $cat_select = new XoopsFormSelect('', 'categories', $categories, 3, true); |
|
52 | - $cat_select->addOptionArray($options); |
|
53 | - $cat_option_tray->addElement($cat_select); |
|
54 | - $form->addElement($cat_option_tray); |
|
46 | + $cat_option_tray = new XoopsFormElementTray(planet_constant('MD_CATEGORY'), '<br>'); |
|
47 | + $options = array(0 => _NONE); |
|
48 | + foreach ($categories_option as $id => $title) { |
|
49 | + $options[$id] = $title; |
|
50 | + } |
|
51 | + $cat_select = new XoopsFormSelect('', 'categories', $categories, 3, true); |
|
52 | + $cat_select->addOptionArray($options); |
|
53 | + $cat_option_tray->addElement($cat_select); |
|
54 | + $form->addElement($cat_option_tray); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /* For admin only */ |
58 | 58 | if (is_object($xoopsUser) && $xoopsUser->isAdmin()) { |
59 | - $status_option_tray = new XoopsFormElementTray(planet_constant('MD_STATUS'), '<br>'); |
|
60 | - $status_select = new XoopsFormSelect('', 'blog_status', $blog_obj->getVar('blog_status')); |
|
61 | - $status_select->addOptionArray(array( |
|
62 | - '0' => planet_constant('MD_PENDING'), |
|
63 | - '1' => planet_constant('MD_ACTIVE'), |
|
64 | - '2' => planet_constant('MD_FEATURED') |
|
65 | - )); |
|
66 | - $status_option_tray->addElement($status_select); |
|
67 | - $form->addElement($status_option_tray); |
|
59 | + $status_option_tray = new XoopsFormElementTray(planet_constant('MD_STATUS'), '<br>'); |
|
60 | + $status_select = new XoopsFormSelect('', 'blog_status', $blog_obj->getVar('blog_status')); |
|
61 | + $status_select->addOptionArray(array( |
|
62 | + '0' => planet_constant('MD_PENDING'), |
|
63 | + '1' => planet_constant('MD_ACTIVE'), |
|
64 | + '2' => planet_constant('MD_FEATURED') |
|
65 | + )); |
|
66 | + $status_option_tray->addElement($status_select); |
|
67 | + $form->addElement($status_option_tray); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $form->addElement(new XoopsFormHidden('blog', $blog_id)); |
@@ -24,8 +24,8 @@ |
||
24 | 24 | |
25 | 25 | $moduleDirName = basename(dirname(__DIR__)); |
26 | 26 | $uploadFolders = array( |
27 | - NEWBB_UPLOAD_PATH, |
|
28 | - NEWBB_UPLOAD_PATH . '/thumbs' |
|
27 | + NEWBB_UPLOAD_PATH, |
|
28 | + NEWBB_UPLOAD_PATH . '/thumbs' |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | //$copyFiles = array( |