@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bblog')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bblog |
|
49 | - */ |
|
50 | - class Bblog extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // parent:__construct(); |
|
58 | - $this->table = planet_DB_prefix('blog'); |
|
59 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | - $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | - /* rss URI */ |
|
63 | - $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | - $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | - $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | - /* blog website */ |
|
67 | - $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | - $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | - |
|
70 | - /* regexp for blog article trackback |
|
47 | + /** |
|
48 | + * Class Bblog |
|
49 | + */ |
|
50 | + class Bblog extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // parent:__construct(); |
|
58 | + $this->table = planet_DB_prefix('blog'); |
|
59 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | + $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | + /* rss URI */ |
|
63 | + $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | + $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | + $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | + /* blog website */ |
|
67 | + $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | + $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | + |
|
70 | + /* regexp for blog article trackback |
|
71 | 71 | * From article url to article trackback URI |
72 | 72 | * |
73 | 73 | * For example: http://www.example.com/blog/111.html => http://www.example.com/blog/trackback/111.html |
@@ -78,75 +78,75 @@ discard block |
||
78 | 78 | * The input shall be: pattern[SPACE]replacement |
79 | 79 | * (.*wordpress/)(index.php)?(\?p.*) $1wp-trackback/$3 |
80 | 80 | */ |
81 | - $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | - |
|
83 | - /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | - $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | - |
|
86 | - /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | - $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | - |
|
89 | - /* key for blog content */ |
|
90 | - $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | - |
|
92 | - $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | - $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | - $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | - /* bookmark times */ |
|
96 | - $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * get formatted publish time of the article |
|
101 | - * |
|
102 | - * {@link Config} |
|
103 | - * |
|
104 | - * @param string $format format of time |
|
105 | - * @return string |
|
106 | - */ |
|
107 | - public function getTime($format = '') |
|
108 | - { |
|
109 | - $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | - |
|
111 | - return $time; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * get verified image url of the category |
|
116 | - * |
|
117 | - * @return string |
|
118 | - */ |
|
119 | - public function getImage() |
|
120 | - { |
|
121 | - $image = $this->getVar('blog_image'); |
|
122 | - |
|
123 | - return $image; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * get rating average of the article |
|
128 | - * |
|
129 | - * @param int $decimals decimal length |
|
130 | - * @return numeric |
|
131 | - */ |
|
132 | - public function getRatingAverage($decimals = 1) |
|
133 | - { |
|
134 | - $ave = 3; |
|
135 | - if ($this->getVar('blog_rates')) { |
|
136 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | - } |
|
138 | - |
|
139 | - return $ave; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @return numeric |
|
144 | - */ |
|
145 | - public function getStar() |
|
146 | - { |
|
147 | - return $this->getRatingAverage(0); |
|
148 | - } |
|
149 | - } |
|
81 | + $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | + |
|
83 | + /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | + $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | + |
|
86 | + /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | + $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | + |
|
89 | + /* key for blog content */ |
|
90 | + $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | + |
|
92 | + $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | + $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | + $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | + /* bookmark times */ |
|
96 | + $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * get formatted publish time of the article |
|
101 | + * |
|
102 | + * {@link Config} |
|
103 | + * |
|
104 | + * @param string $format format of time |
|
105 | + * @return string |
|
106 | + */ |
|
107 | + public function getTime($format = '') |
|
108 | + { |
|
109 | + $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | + |
|
111 | + return $time; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * get verified image url of the category |
|
116 | + * |
|
117 | + * @return string |
|
118 | + */ |
|
119 | + public function getImage() |
|
120 | + { |
|
121 | + $image = $this->getVar('blog_image'); |
|
122 | + |
|
123 | + return $image; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * get rating average of the article |
|
128 | + * |
|
129 | + * @param int $decimals decimal length |
|
130 | + * @return numeric |
|
131 | + */ |
|
132 | + public function getRatingAverage($decimals = 1) |
|
133 | + { |
|
134 | + $ave = 3; |
|
135 | + if ($this->getVar('blog_rates')) { |
|
136 | + $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | + } |
|
138 | + |
|
139 | + return $ave; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @return numeric |
|
144 | + */ |
|
145 | + public function getStar() |
|
146 | + { |
|
147 | + return $this->getRatingAverage(0); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | endif; |
151 | 151 | /** |
152 | 152 | * Topic object handler class. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $ave = 3; |
135 | 135 | if ($this->getVar('blog_rates')) { |
136 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
136 | + $ave = number_format($this->getVar('blog_rating')/$this->getVar('blog_rates'), $decimals); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $ave; |
@@ -44,116 +44,116 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Barticle')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Barticle |
|
49 | - */ |
|
50 | - class Barticle extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - * |
|
55 | - * @param int $id ID of the article |
|
56 | - */ |
|
57 | - public function __construct($id = null) |
|
58 | - { |
|
59 | - // $this->ArtObject(); |
|
60 | - $this->table = planet_DB_prefix('article'); |
|
61 | - $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | - |
|
64 | - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | - $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | - $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | - $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | - $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | - |
|
70 | - $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | - $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | - $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | - $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | - |
|
75 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | - $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | - $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | - $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * get title of the article |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getTitle() |
|
88 | - { |
|
89 | - $title = $this->getVar('art_title'); |
|
90 | - |
|
91 | - return $title; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * get formatted publish time of the article |
|
96 | - * |
|
97 | - * {@link Config} |
|
98 | - * |
|
99 | - * @param string $format format of time |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function getTime($format = 'c') |
|
103 | - { |
|
104 | - $time = $this->getVar('art_time'); |
|
105 | - if (empty($time)) { |
|
106 | - $time = time(); |
|
107 | - } |
|
108 | - $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | - |
|
110 | - return $time; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * get summary of the article |
|
115 | - * |
|
116 | - * @param int $length |
|
117 | - * @return string $summary |
|
118 | - */ |
|
119 | - public function &getSummary($length = 0) |
|
120 | - { |
|
121 | - $content = $this->getVar('art_content'); |
|
122 | - $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | - if (empty($length)) { |
|
124 | - $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | - } |
|
126 | - if (!empty($length)) { |
|
127 | - $summary = xoops_substr($summary, 0, $length); |
|
128 | - } |
|
129 | - |
|
130 | - return $summary; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * get rating average of the article |
|
135 | - * |
|
136 | - * @param int $decimals decimal length |
|
137 | - * @return numeric |
|
138 | - */ |
|
139 | - public function getRatingAverage($decimals = 1) |
|
140 | - { |
|
141 | - $ave = 3; |
|
142 | - if ($this->getVar('art_rates')) { |
|
143 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | - } |
|
145 | - |
|
146 | - return $ave; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * @return numeric |
|
151 | - */ |
|
152 | - public function getStar() |
|
153 | - { |
|
154 | - return $this->getRatingAverage(0); |
|
155 | - } |
|
156 | - } |
|
47 | + /** |
|
48 | + * Class Barticle |
|
49 | + */ |
|
50 | + class Barticle extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + * |
|
55 | + * @param int $id ID of the article |
|
56 | + */ |
|
57 | + public function __construct($id = null) |
|
58 | + { |
|
59 | + // $this->ArtObject(); |
|
60 | + $this->table = planet_DB_prefix('article'); |
|
61 | + $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | + |
|
64 | + $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | + $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | + $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | + $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | + $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | + |
|
70 | + $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | + $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | + $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | + $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | + |
|
75 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | + $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | + $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | + $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * get title of the article |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getTitle() |
|
88 | + { |
|
89 | + $title = $this->getVar('art_title'); |
|
90 | + |
|
91 | + return $title; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * get formatted publish time of the article |
|
96 | + * |
|
97 | + * {@link Config} |
|
98 | + * |
|
99 | + * @param string $format format of time |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function getTime($format = 'c') |
|
103 | + { |
|
104 | + $time = $this->getVar('art_time'); |
|
105 | + if (empty($time)) { |
|
106 | + $time = time(); |
|
107 | + } |
|
108 | + $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | + |
|
110 | + return $time; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * get summary of the article |
|
115 | + * |
|
116 | + * @param int $length |
|
117 | + * @return string $summary |
|
118 | + */ |
|
119 | + public function &getSummary($length = 0) |
|
120 | + { |
|
121 | + $content = $this->getVar('art_content'); |
|
122 | + $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | + if (empty($length)) { |
|
124 | + $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | + } |
|
126 | + if (!empty($length)) { |
|
127 | + $summary = xoops_substr($summary, 0, $length); |
|
128 | + } |
|
129 | + |
|
130 | + return $summary; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * get rating average of the article |
|
135 | + * |
|
136 | + * @param int $decimals decimal length |
|
137 | + * @return numeric |
|
138 | + */ |
|
139 | + public function getRatingAverage($decimals = 1) |
|
140 | + { |
|
141 | + $ave = 3; |
|
142 | + if ($this->getVar('art_rates')) { |
|
143 | + $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | + } |
|
145 | + |
|
146 | + return $ave; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * @return numeric |
|
151 | + */ |
|
152 | + public function getStar() |
|
153 | + { |
|
154 | + return $this->getRatingAverage(0); |
|
155 | + } |
|
156 | + } |
|
157 | 157 | endif; |
158 | 158 | |
159 | 159 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function &getSummary($length = 0) |
120 | 120 | { |
121 | 121 | $content = $this->getVar('art_content'); |
122 | - $summary =& PlanetUtility::planetHtml2text($content); |
|
122 | + $summary = & PlanetUtility::planetHtml2text($content); |
|
123 | 123 | if (empty($length)) { |
124 | 124 | $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
125 | 125 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $ave = 3; |
142 | 142 | if ($this->getVar('art_rates')) { |
143 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
143 | + $ave = number_format($this->getVar('art_rating')/$this->getVar('art_rates'), $decimals); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $ave; |
@@ -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(' |
@@ -26,7 +26,7 @@ |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -require_once __DIR__ . '/../include/vars.php'; |
|
29 | +require_once __DIR__.'/../include/vars.php'; |
|
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Brate')): |
@@ -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(' |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -require_once __DIR__ . '/../include/vars.php'; |
|
29 | +require_once __DIR__.'/../include/vars.php'; |
|
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | /*** GENERAL USAGE ********************************************************* |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | */ |
65 | 65 | |
66 | 66 | // your local timezone, set to "" to disable or for GMT |
67 | -$server_TZ = abs((int)($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0)); |
|
68 | -$prefix = ($GLOBALS['xoopsConfig']['server_TZ'] < 0) ? '-' : '+'; |
|
69 | -$TIME_ZONE = $prefix . date('H:i', $server_TZ); |
|
67 | +$server_TZ = abs((int) ($GLOBALS['xoopsConfig']['server_TZ']*3600.0)); |
|
68 | +$prefix = ($GLOBALS['xoopsConfig']['server_TZ']<0) ? '-' : '+'; |
|
69 | +$TIME_ZONE = $prefix.date('H:i', $server_TZ); |
|
70 | 70 | define('TIME_ZONE', $TIME_ZONE); |
71 | 71 | // Version string. |
72 | 72 | define('FEEDCREATOR_VERSION', 'ARTICLE @ XOOPS powered by FeedCreator'); |
73 | 73 | |
74 | -require_once __DIR__ . '/feedcreator.class.php'; |
|
74 | +require_once __DIR__.'/feedcreator.class.php'; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Description |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function __construct($version) |
97 | 97 | { |
98 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
98 | + $this->filename = XOOPS_CACHE_PATH.'/feed.xml'; |
|
99 | 99 | $this->version = $version; |
100 | 100 | } |
101 | 101 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | foreach (array_keys($val) as $key) { |
123 | 123 | $val[$key] = $this->convert_encoding($val[$key]); |
124 | 124 | } |
125 | - } else { |
|
125 | + }else { |
|
126 | 126 | $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
127 | 127 | } |
128 | 128 |
@@ -32,8 +32,8 @@ |
||
32 | 32 | $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
33 | 33 | } |
34 | 34 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
35 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
|
36 | -include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/class/utility.php'; |
|
35 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/include/vars.php'; |
|
36 | +include XOOPS_ROOT_PATH.'/modules/'.$url_arr[2].'/class/utility.php'; |
|
37 | 37 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/functions.php'; |
38 | 38 | |
39 | 39 | /** |
@@ -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'; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | -$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
32 | -$blog_id = Request::getArray('blog', Request::getArray('blog', array(), 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
33 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
31 | +$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
32 | +$blog_id = Request::getArray('blog', Request::getArray('blog', array(), 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
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 | 36 | redirect_header('index.php', 2, _NOPERM); |
@@ -41,10 +41,10 @@ discard block |
||
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 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
47 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
46 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
47 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
48 | 48 | |
49 | 49 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
50 | 50 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | if ($blog_id) { |
57 | 57 | $blog_obj = $blogHandler->get($blog_id); |
58 | 58 | if ($xoopsUser->isAdmin()) { |
59 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
59 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); // @$_POST['blog_status']); |
|
60 | 60 | } |
61 | - } else { |
|
61 | + }else { |
|
62 | 62 | if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
63 | 63 | ) { |
64 | 64 | redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | case 2: |
72 | 72 | if (!is_object($xoopsUser)) { |
73 | 73 | $status = 0; |
74 | - } else { |
|
74 | + }else { |
|
75 | 75 | $status = 1; |
76 | 76 | } |
77 | 77 | break; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | default: |
84 | 84 | if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
85 | 85 | $status = 0; |
86 | - } else { |
|
86 | + }else { |
|
87 | 87 | $status = 1; |
88 | 88 | } |
89 | 89 | break; |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $blog_obj->setVar('blog_status', $status); |
93 | 93 | } |
94 | 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']); |
|
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 | 103 | if ($blog_obj->isNew()) { |
104 | 104 | $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
105 | 105 | } |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | if (in_array(0, $_POST['categories'])) { |
111 | 111 | $_POST['categories'] = array(); |
112 | 112 | } |
113 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
113 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST')); //$_POST['categories']); |
|
114 | 114 | } |
115 | 115 | $message = planet_constant('MD_DBUPDATED'); |
116 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
116 | + redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
117 | 117 | |
118 | 118 | /* edit a single blog */ |
119 | 119 | case 'edit': |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
122 | 122 | $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
123 | 123 | $blog_obj->setVar('blog_id', $blog_id); |
124 | - } else { |
|
124 | + }else { |
|
125 | 125 | $blog_obj = $blogHandler->get($blog_id); |
126 | 126 | } |
127 | - $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
127 | + $categories = Request::getArray('categories', array(), 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | 128 | if (in_array('-1', $categories)) { |
129 | 129 | $categories = array(); |
130 | 130 | } |
131 | - if (empty($categories) && $blog_id > 0) { |
|
131 | + if (empty($categories) && $blog_id>0) { |
|
132 | 132 | $crit = new Criteria('bc.blog_id', $blog_id); |
133 | 133 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
134 | 134 | } |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | $categories = array(0 => _NONE); |
137 | 137 | } |
138 | 138 | |
139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
140 | 140 | echo '<br>'; |
141 | 141 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
142 | 142 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
143 | 143 | $blogs_obj = $blogHandler->getList($criteria); |
144 | - if (count($blogs_obj) > 0) { |
|
145 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
144 | + if (count($blogs_obj)>0) { |
|
145 | + echo "<div class=\"errorMsg\">".planet_constant('MD_BLOGEXISTS'); |
|
146 | 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>'; |
|
147 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
148 | 148 | } |
149 | 149 | echo '</div>'; |
150 | 150 | unset($blogs_obj, $criteria); |
151 | 151 | } |
152 | 152 | } |
153 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
153 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
154 | 154 | echo '</fieldset>'; |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | |
158 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
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'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | 31 | $rate = Request::getInt('rate', Request::getInt('rate', 0, 'POST'), 'GET'); //(int)(!empty($_POST['rate']) ? $_POST['rate'] : (!empty($_GET['rate']) ? $_GET['rate'] : 0)); |
32 | 32 | $article_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET'); //(int)(!empty($_POST['article']) ? $_POST['article'] : (!empty($_GET['article']) ? $_GET['article'] : 0)); |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
41 | 41 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
42 | 42 | $message = planet_constant('MD_NOACCESS'); |
43 | -} else { |
|
43 | +}else { |
|
44 | 44 | $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
45 | 45 | $ip = PlanetUtility::planetGetIP(); |
46 | - if ($article_id > 0) { |
|
46 | + if ($article_id>0) { |
|
47 | 47 | $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
48 | - } else { |
|
48 | + }else { |
|
49 | 49 | $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
50 | 50 | } |
51 | - if ($uid > 0) { |
|
51 | + if ($uid>0) { |
|
52 | 52 | $criteria->add(new Criteria('rate_uid', $uid)); |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $criteria->add(new Criteria('rate_ip', $ip)); |
55 | - $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
55 | + $criteria->add(new Criteria('rate_time', time()-24*3600, '>')); |
|
56 | 56 | } |
57 | 57 | $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
58 | 58 | if ($count = $rateHandler->getCount($criteria)) { |
59 | 59 | $message = planet_constant('MD_ALREADYRATED'); |
60 | - } else { |
|
60 | + }else { |
|
61 | 61 | $rate_obj = $rateHandler->create(); |
62 | - if ($article_id > 0) { |
|
62 | + if ($article_id>0) { |
|
63 | 63 | $rate_obj->setVar('art_id', $article_id); |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | $rate_obj->setVar('blog_id', $blog_id); |
66 | 66 | } |
67 | 67 | $rate_obj->setVar('rate_uid', $uid); |
@@ -71,23 +71,23 @@ discard block |
||
71 | 71 | if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
72 | 72 | redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
73 | 73 | } |
74 | - if ($article_id > 0) { |
|
74 | + if ($article_id>0) { |
|
75 | 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); |
|
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 | 78 | $articleHandler->insert($article_obj, true); |
79 | - } else { |
|
79 | + }else { |
|
80 | 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); |
|
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 | 83 | $blogHandler->insert($blog_obj, true); |
84 | 84 | } |
85 | 85 | $message = planet_constant('MD_ACTIONDONE'); |
86 | 86 | } |
87 | 87 | } |
88 | -if ($article_id > 0) { |
|
89 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
90 | -} else { |
|
91 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
88 | +if ($article_id>0) { |
|
89 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_id, 2, $message); |
|
90 | +}else { |
|
91 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
92 | 92 | } |
93 | -include __DIR__ . '/footer.php'; |
|
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; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (isset($GLOBALS['xoopsModuleConfig'])) { |
81 | 81 | $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
82 | 82 | } |
83 | - } else { |
|
83 | + }else { |
|
84 | 84 | /** @var XoopsModuleHandler $moduleHandler */ |
85 | 85 | $moduleHandler = xoops_getHandler('module'); |
86 | 86 | $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | unset($configs); |
95 | 95 | } |
96 | - if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
96 | + if ($customConfig = @include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/plugin.php') { |
|
97 | 97 | $moduleConfig = array_merge($moduleConfig, $customConfig); |
98 | 98 | } |
99 | 99 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | if (!in_array(URL_DELIMITER, array('?', '/'))) { |
107 | 107 | die('Exit on security'); |
108 | 108 | } |
109 | - } else { |
|
109 | + }else { |
|
110 | 110 | $moduleConfig = planet_load_config(); |
111 | 111 | if (empty($moduleConfig['do_urw'])) { |
112 | 112 | define('URL_DELIMITER', '?'); |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | define('URL_DELIMITER', '/'); |
115 | 115 | } |
116 | 116 | } |
@@ -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 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
16 | 16 | |
17 | -if (!@require_once XOOPS_ROOT_PATH . '/Frameworks/transfer/transfer.php') { |
|
17 | +if (!@require_once XOOPS_ROOT_PATH.'/Frameworks/transfer/transfer.php') { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 |