@@ -25,9 +25,9 @@ |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -include dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
29 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
30 | -include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php'; |
|
28 | +include dirname(dirname(__DIR__)).'/mainfile.php'; |
|
29 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
30 | +include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/functions.php'; |
|
31 | 31 | |
32 | 32 | planet_define_url_delimiter(); |
33 | 33 | $myts = MyTextSanitizer::getInstance(); |
@@ -24,5 +24,5 @@ |
||
24 | 24 | // URL: http://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -include dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
28 | -include XOOPS_ROOT_PATH . '/include/comment_post.php'; |
|
27 | +include dirname(dirname(__DIR__)).'/mainfile.php'; |
|
28 | +include XOOPS_ROOT_PATH.'/include/comment_post.php'; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $blog_id = (int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
31 | 31 | |
32 | 32 | if (!is_object($xoopsUser) || empty($blog_id)) { |
33 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
33 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $bookmark_handler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
39 | 39 | $criteria->add(new Criteria('bm_uid', $uid)); |
40 | 40 | if ($count = $bookmark_handler->getCount($criteria)) { |
41 | - $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
42 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, |
|
43 | - $message); |
|
41 | + $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
42 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, |
|
43 | + $message); |
|
44 | 44 | } |
45 | 45 | $bookmark_obj =& $bookmark_handler->create(); |
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmark_handler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, |
|
50 | - planet_constant('MD_NOTSAVED')); |
|
49 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, |
|
50 | + planet_constant('MD_NOTSAVED')); |
|
51 | 51 | } |
52 | 52 | $blog_handler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
53 | 53 | $blog_obj =& $blog_handler->get($blog_id); |
@@ -56,5 +56,5 @@ discard block |
||
56 | 56 | $blog_handler->insert($blog_obj, true); |
57 | 57 | $message = planet_constant('MD_ACTIONDONE'); |
58 | 58 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, |
59 | - $message); |
|
59 | + $message); |
|
60 | 60 | include __DIR__ . '/footer.php'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -include __DIR__ . '/header.php'; |
|
28 | +include __DIR__.'/header.php'; |
|
29 | 29 | |
30 | -$blog_id = (int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
|
30 | +$blog_id = (int) (isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
|
31 | 31 | |
32 | 32 | if (!is_object($xoopsUser) || empty($blog_id)) { |
33 | 33 | redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | $criteria->add(new Criteria('bm_uid', $uid)); |
40 | 40 | if ($count = $bookmark_handler->getCount($criteria)) { |
41 | 41 | $message = planet_constant('MD_ALREADYBOOKMARKED'); |
42 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, |
|
42 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid, 2, |
|
43 | 43 | $message); |
44 | 44 | } |
45 | -$bookmark_obj =& $bookmark_handler->create(); |
|
45 | +$bookmark_obj = & $bookmark_handler->create(); |
|
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmark_handler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, |
|
49 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, |
|
50 | 50 | planet_constant('MD_NOTSAVED')); |
51 | 51 | } |
52 | 52 | $blog_handler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
53 | -$blog_obj =& $blog_handler->get($blog_id); |
|
54 | -$marks = $blog_obj->getVar('blog_marks') + 1; |
|
55 | -$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks') + 1); |
|
53 | +$blog_obj = & $blog_handler->get($blog_id); |
|
54 | +$marks = $blog_obj->getVar('blog_marks')+1; |
|
55 | +$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks')+1); |
|
56 | 56 | $blog_handler->insert($blog_obj, true); |
57 | 57 | $message = planet_constant('MD_ACTIONDONE'); |
58 | -redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, |
|
58 | +redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, |
|
59 | 59 | $message); |
60 | -include __DIR__ . '/footer.php'; |
|
60 | +include __DIR__.'/footer.php'; |
@@ -44,110 +44,110 @@ |
||
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 | - // $this->ArtObject(); |
|
59 | - $this->table = planet_DB_prefix('article'); |
|
60 | - $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
61 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
62 | - |
|
63 | - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
64 | - $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
65 | - $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
66 | - $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
67 | - $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
68 | - |
|
69 | - $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
70 | - $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
71 | - $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
72 | - $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
73 | - |
|
74 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
75 | - $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
76 | - $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
77 | - $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
78 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * get title of the article |
|
83 | - * |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - public function getTitle() { |
|
87 | - $title = $this->getVar('art_title'); |
|
88 | - |
|
89 | - return $title; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * get formatted publish time of the article |
|
94 | - * |
|
95 | - * {@link Config} |
|
96 | - * |
|
97 | - * @param string $format format of time |
|
98 | - * @return string |
|
99 | - */ |
|
100 | - public function getTime($format = 'c') { |
|
101 | - $time = $this->getVar('art_time'); |
|
102 | - if (empty($time)) { |
|
103 | - $time = time(); |
|
104 | - } |
|
105 | - $time = planet_formatTimestamp($time, $format); |
|
106 | - |
|
107 | - return $time; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * get summary of the article |
|
112 | - * |
|
113 | - * @param int $length |
|
114 | - * @return string $summary |
|
115 | - */ |
|
116 | - public function &getSummary($length = 0) { |
|
117 | - $content = $this->getVar('art_content'); |
|
118 | - $summary =& planet_html2text($content); |
|
119 | - if (empty($length)) { |
|
120 | - $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
121 | - } |
|
122 | - if (!empty($length)) { |
|
123 | - $summary = xoops_substr($summary, 0, $length); |
|
124 | - } |
|
125 | - |
|
126 | - return $summary; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * get rating average of the article |
|
131 | - * |
|
132 | - * @param int $decimals decimal length |
|
133 | - * @return numeric |
|
134 | - */ |
|
135 | - public function getRatingAverage($decimals = 1) { |
|
136 | - $ave = 3; |
|
137 | - if ($this->getVar('art_rates')) { |
|
138 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
139 | - } |
|
140 | - |
|
141 | - return $ave; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * @return numeric |
|
146 | - */ |
|
147 | - public function getStar() { |
|
148 | - return $this->getRatingAverage(0); |
|
149 | - } |
|
150 | - } |
|
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 | + // $this->ArtObject(); |
|
59 | + $this->table = planet_DB_prefix('article'); |
|
60 | + $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
61 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
62 | + |
|
63 | + $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
64 | + $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
65 | + $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
66 | + $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
67 | + $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
68 | + |
|
69 | + $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
70 | + $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
71 | + $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
72 | + $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
73 | + |
|
74 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
75 | + $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
76 | + $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
77 | + $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
78 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * get title of the article |
|
83 | + * |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + public function getTitle() { |
|
87 | + $title = $this->getVar('art_title'); |
|
88 | + |
|
89 | + return $title; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * get formatted publish time of the article |
|
94 | + * |
|
95 | + * {@link Config} |
|
96 | + * |
|
97 | + * @param string $format format of time |
|
98 | + * @return string |
|
99 | + */ |
|
100 | + public function getTime($format = 'c') { |
|
101 | + $time = $this->getVar('art_time'); |
|
102 | + if (empty($time)) { |
|
103 | + $time = time(); |
|
104 | + } |
|
105 | + $time = planet_formatTimestamp($time, $format); |
|
106 | + |
|
107 | + return $time; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * get summary of the article |
|
112 | + * |
|
113 | + * @param int $length |
|
114 | + * @return string $summary |
|
115 | + */ |
|
116 | + public function &getSummary($length = 0) { |
|
117 | + $content = $this->getVar('art_content'); |
|
118 | + $summary =& planet_html2text($content); |
|
119 | + if (empty($length)) { |
|
120 | + $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
121 | + } |
|
122 | + if (!empty($length)) { |
|
123 | + $summary = xoops_substr($summary, 0, $length); |
|
124 | + } |
|
125 | + |
|
126 | + return $summary; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * get rating average of the article |
|
131 | + * |
|
132 | + * @param int $decimals decimal length |
|
133 | + * @return numeric |
|
134 | + */ |
|
135 | + public function getRatingAverage($decimals = 1) { |
|
136 | + $ave = 3; |
|
137 | + if ($this->getVar('art_rates')) { |
|
138 | + $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
139 | + } |
|
140 | + |
|
141 | + return $ave; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * @return numeric |
|
146 | + */ |
|
147 | + public function getStar() { |
|
148 | + return $this->getRatingAverage(0); |
|
149 | + } |
|
150 | + } |
|
151 | 151 | endif; |
152 | 152 | |
153 | 153 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
33 | +include_once dirname(__DIR__).'/include/vars.php'; |
|
34 | 34 | mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function &getSummary($length = 0) { |
117 | 117 | $content = $this->getVar('art_content'); |
118 | - $summary =& planet_html2text($content); |
|
118 | + $summary = & planet_html2text($content); |
|
119 | 119 | if (empty($length)) { |
120 | 120 | $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
121 | 121 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function getRatingAverage($decimals = 1) { |
136 | 136 | $ave = 3; |
137 | 137 | if ($this->getVar('art_rates')) { |
138 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
138 | + $ave = number_format($this->getVar('art_rating')/$this->getVar('art_rates'), $decimals); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $ave; |
@@ -44,29 +44,29 @@ 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 | - // parent:__construct(); |
|
57 | - $this->table = planet_DB_prefix('blog'); |
|
58 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
59 | - $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
60 | - $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
61 | - /* rss URI */ |
|
62 | - $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
63 | - $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
64 | - $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
65 | - /* blog website */ |
|
66 | - $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
67 | - $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
68 | - |
|
69 | - /* 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 | + // parent:__construct(); |
|
57 | + $this->table = planet_DB_prefix('blog'); |
|
58 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
59 | + $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
60 | + $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
61 | + /* rss URI */ |
|
62 | + $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
63 | + $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
64 | + $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
65 | + /* blog website */ |
|
66 | + $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
67 | + $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
68 | + |
|
69 | + /* regexp for blog article trackback |
|
70 | 70 | * From article url to article trackback URI |
71 | 71 | * |
72 | 72 | * For example: http://www.example.com/blog/111.html => http://www.example.com/blog/trackback/111.html |
@@ -77,71 +77,71 @@ discard block |
||
77 | 77 | * The input shall be: pattern[SPACE]replacement |
78 | 78 | * (.*wordpress/)(index.php)?(\?p.*) $1wp-trackback/$3 |
79 | 79 | */ |
80 | - $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
81 | - |
|
82 | - /* blog submitter: is_numeric - uid; is_string - IP */ |
|
83 | - $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
84 | - |
|
85 | - /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
86 | - $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
87 | - |
|
88 | - /* key for blog content */ |
|
89 | - $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
90 | - |
|
91 | - $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
92 | - $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
93 | - $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
94 | - /* bookmark times */ |
|
95 | - $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * get formatted publish time of the article |
|
100 | - * |
|
101 | - * {@link Config} |
|
102 | - * |
|
103 | - * @param string $format format of time |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - public function getTime($format = '') { |
|
107 | - $time = planet_formatTimestamp($this->getVar('blog_time'), $format); |
|
108 | - |
|
109 | - return $time; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * get verified image url of the category |
|
114 | - * |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function getImage() { |
|
118 | - $image = $this->getVar('blog_image'); |
|
119 | - |
|
120 | - return $image; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * get rating average of the article |
|
125 | - * |
|
126 | - * @param int $decimals decimal length |
|
127 | - * @return numeric |
|
128 | - */ |
|
129 | - public function getRatingAverage($decimals = 1) { |
|
130 | - $ave = 3; |
|
131 | - if ($this->getVar('blog_rates')) { |
|
132 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
133 | - } |
|
134 | - |
|
135 | - return $ave; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @return numeric |
|
140 | - */ |
|
141 | - public function getStar() { |
|
142 | - return $this->getRatingAverage(0); |
|
143 | - } |
|
144 | - } |
|
80 | + $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
81 | + |
|
82 | + /* blog submitter: is_numeric - uid; is_string - IP */ |
|
83 | + $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
84 | + |
|
85 | + /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
86 | + $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
87 | + |
|
88 | + /* key for blog content */ |
|
89 | + $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
90 | + |
|
91 | + $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
92 | + $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
93 | + $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
94 | + /* bookmark times */ |
|
95 | + $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * get formatted publish time of the article |
|
100 | + * |
|
101 | + * {@link Config} |
|
102 | + * |
|
103 | + * @param string $format format of time |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + public function getTime($format = '') { |
|
107 | + $time = planet_formatTimestamp($this->getVar('blog_time'), $format); |
|
108 | + |
|
109 | + return $time; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * get verified image url of the category |
|
114 | + * |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function getImage() { |
|
118 | + $image = $this->getVar('blog_image'); |
|
119 | + |
|
120 | + return $image; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * get rating average of the article |
|
125 | + * |
|
126 | + * @param int $decimals decimal length |
|
127 | + * @return numeric |
|
128 | + */ |
|
129 | + public function getRatingAverage($decimals = 1) { |
|
130 | + $ave = 3; |
|
131 | + if ($this->getVar('blog_rates')) { |
|
132 | + $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
133 | + } |
|
134 | + |
|
135 | + return $ave; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @return numeric |
|
140 | + */ |
|
141 | + public function getStar() { |
|
142 | + return $this->getRatingAverage(0); |
|
143 | + } |
|
144 | + } |
|
145 | 145 | endif; |
146 | 146 | /** |
147 | 147 | * 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 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
33 | +include_once dirname(__DIR__).'/include/vars.php'; |
|
34 | 34 | mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function getRatingAverage($decimals = 1) { |
130 | 130 | $ave = 3; |
131 | 131 | if ($this->getVar('blog_rates')) { |
132 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
132 | + $ave = number_format($this->getVar('blog_rating')/$this->getVar('blog_rates'), $decimals); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $ave; |
@@ -30,26 +30,26 @@ |
||
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 | - // $this->ArtObject(); |
|
44 | - $this->table = planet_DB_prefix('rate'); |
|
45 | - $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
46 | - $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
47 | - $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
48 | - $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
49 | - $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
50 | - $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
51 | - } |
|
52 | - } |
|
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 | + // $this->ArtObject(); |
|
44 | + $this->table = planet_DB_prefix('rate'); |
|
45 | + $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
46 | + $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
47 | + $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
48 | + $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
49 | + $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
50 | + $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | endif; |
54 | 54 | |
55 | 55 | planet_parse_class(' |
@@ -26,7 +26,7 @@ |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
29 | +include_once dirname(__DIR__).'/include/vars.php'; |
|
30 | 30 | mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Brate')): |
@@ -81,93 +81,93 @@ |
||
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 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
98 | - $this->version = $version; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @param $var |
|
103 | - * @param $val |
|
104 | - * @param bool $encoding |
|
105 | - */ |
|
106 | - public function setVar($var, $val, $encoding = false) { |
|
107 | - if (!empty($encoding)) { |
|
108 | - $val = $this->convert_encoding($val); |
|
109 | - } |
|
110 | - $this->$var = $val; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * @param $val |
|
115 | - * @return array|mixed|string |
|
116 | - */ |
|
117 | - public function convert_encoding($val) { |
|
118 | - if (is_array($val)) { |
|
119 | - foreach (array_keys($val) as $key) { |
|
120 | - $val[$key] = $this->convert_encoding($val[$key]); |
|
121 | - } |
|
122 | - } else { |
|
123 | - $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
124 | - } |
|
125 | - |
|
126 | - return $val; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @param $var |
|
131 | - * @return mixed |
|
132 | - */ |
|
133 | - public function getVar($var) { |
|
134 | - return $this->$var; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @param $img |
|
139 | - */ |
|
140 | - public function setImage(&$img) { |
|
141 | - $image = new FeedImage(); |
|
142 | - foreach ($img as $key => $val) { |
|
143 | - $image->$key = $this->convert_encoding($val); |
|
144 | - } |
|
145 | - $this->setVar('image', $image); |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * @param $itm |
|
150 | - */ |
|
151 | - public function _addItem(&$itm) { |
|
152 | - $item = new FeedItem(); |
|
153 | - foreach ($itm as $key => $val) { |
|
154 | - $item->$key = $this->convert_encoding($val); |
|
155 | - } |
|
156 | - $this->addItem($item); |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * @param $items |
|
161 | - */ |
|
162 | - public function addItems(&$items) { |
|
163 | - if (!is_array($items) || count($items) == 0) { |
|
164 | - return; |
|
165 | - } |
|
166 | - foreach ($items as $item) { |
|
167 | - $this->_addItem($item); |
|
168 | - } |
|
169 | - } |
|
170 | - } |
|
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 | + $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
98 | + $this->version = $version; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @param $var |
|
103 | + * @param $val |
|
104 | + * @param bool $encoding |
|
105 | + */ |
|
106 | + public function setVar($var, $val, $encoding = false) { |
|
107 | + if (!empty($encoding)) { |
|
108 | + $val = $this->convert_encoding($val); |
|
109 | + } |
|
110 | + $this->$var = $val; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * @param $val |
|
115 | + * @return array|mixed|string |
|
116 | + */ |
|
117 | + public function convert_encoding($val) { |
|
118 | + if (is_array($val)) { |
|
119 | + foreach (array_keys($val) as $key) { |
|
120 | + $val[$key] = $this->convert_encoding($val[$key]); |
|
121 | + } |
|
122 | + } else { |
|
123 | + $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
124 | + } |
|
125 | + |
|
126 | + return $val; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @param $var |
|
131 | + * @return mixed |
|
132 | + */ |
|
133 | + public function getVar($var) { |
|
134 | + return $this->$var; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @param $img |
|
139 | + */ |
|
140 | + public function setImage(&$img) { |
|
141 | + $image = new FeedImage(); |
|
142 | + foreach ($img as $key => $val) { |
|
143 | + $image->$key = $this->convert_encoding($val); |
|
144 | + } |
|
145 | + $this->setVar('image', $image); |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * @param $itm |
|
150 | + */ |
|
151 | + public function _addItem(&$itm) { |
|
152 | + $item = new FeedItem(); |
|
153 | + foreach ($itm as $key => $val) { |
|
154 | + $item->$key = $this->convert_encoding($val); |
|
155 | + } |
|
156 | + $this->addItem($item); |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * @param $items |
|
161 | + */ |
|
162 | + public function addItems(&$items) { |
|
163 | + if (!is_array($items) || count($items) == 0) { |
|
164 | + return; |
|
165 | + } |
|
166 | + foreach ($items as $item) { |
|
167 | + $this->_addItem($item); |
|
168 | + } |
|
169 | + } |
|
170 | + } |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | planet_parse_class(' |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
29 | +include_once dirname(__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 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param $version |
95 | 95 | */ |
96 | 96 | public function __construct($version) { |
97 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
97 | + $this->filename = XOOPS_CACHE_PATH.'/feed.xml'; |
|
98 | 98 | $this->version = $version; |
99 | 99 | } |
100 | 100 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | foreach (array_keys($val) as $key) { |
120 | 120 | $val[$key] = $this->convert_encoding($val[$key]); |
121 | 121 | } |
122 | - } else { |
|
122 | + }else { |
|
123 | 123 | $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
124 | 124 | } |
125 | 125 |
@@ -44,22 +44,22 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bcategory')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bcategory |
|
49 | - */ |
|
50 | - class Bcategory extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() { |
|
56 | - // $this->ArtObject(); |
|
57 | - $this->table = planet_DB_prefix('category'); |
|
58 | - $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
59 | - $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
60 | - $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
61 | - } |
|
62 | - } |
|
47 | + /** |
|
48 | + * Class Bcategory |
|
49 | + */ |
|
50 | + class Bcategory extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() { |
|
56 | + // $this->ArtObject(); |
|
57 | + $this->table = planet_DB_prefix('category'); |
|
58 | + $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
59 | + $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
60 | + $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | endif; |
65 | 65 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
33 | +include_once dirname(__DIR__).'/include/vars.php'; |
|
34 | 34 | mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -30,70 +30,70 @@ |
||
30 | 30 | mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Xmlrpc_client')) { |
33 | - /** |
|
34 | - * Class Xmlrpc_client |
|
35 | - */ |
|
36 | - class Xmlrpc_client |
|
37 | - { |
|
38 | - /** |
|
39 | - * Xmlrpc_client constructor. |
|
40 | - */ |
|
41 | - public function __construct() { |
|
42 | - } |
|
33 | + /** |
|
34 | + * Class Xmlrpc_client |
|
35 | + */ |
|
36 | + class Xmlrpc_client |
|
37 | + { |
|
38 | + /** |
|
39 | + * Xmlrpc_client constructor. |
|
40 | + */ |
|
41 | + public function __construct() { |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param $article |
|
46 | - */ |
|
47 | - public function setObject(&$article) { |
|
48 | - $this->$var = $val; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @param $article |
|
46 | + */ |
|
47 | + public function setObject(&$article) { |
|
48 | + $this->$var = $val; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @param $var |
|
53 | - * @param $val |
|
54 | - */ |
|
55 | - public function setVar($var, $val) { |
|
56 | - $this->$var = $val; |
|
57 | - } |
|
51 | + /** |
|
52 | + * @param $var |
|
53 | + * @param $val |
|
54 | + */ |
|
55 | + public function setVar($var, $val) { |
|
56 | + $this->$var = $val; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param $var |
|
61 | - * @return mixed |
|
62 | - */ |
|
63 | - public function getVar($var) { |
|
64 | - return $this->$var; |
|
65 | - } |
|
66 | - } |
|
59 | + /** |
|
60 | + * @param $var |
|
61 | + * @return mixed |
|
62 | + */ |
|
63 | + public function getVar($var) { |
|
64 | + return $this->$var; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!class_exists('Xmlrpc_server')) { |
70 | - /** |
|
71 | - * Class Xmlrpc_server |
|
72 | - */ |
|
73 | - class Xmlrpc_server |
|
74 | - { |
|
75 | - /** |
|
76 | - * Xmlrpc_server constructor. |
|
77 | - */ |
|
78 | - public function __construct() { |
|
79 | - } |
|
70 | + /** |
|
71 | + * Class Xmlrpc_server |
|
72 | + */ |
|
73 | + class Xmlrpc_server |
|
74 | + { |
|
75 | + /** |
|
76 | + * Xmlrpc_server constructor. |
|
77 | + */ |
|
78 | + public function __construct() { |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param $var |
|
83 | - * @param $val |
|
84 | - */ |
|
85 | - public function setVar($var, $val) { |
|
86 | - $this->$var = $val; |
|
87 | - } |
|
81 | + /** |
|
82 | + * @param $var |
|
83 | + * @param $val |
|
84 | + */ |
|
85 | + public function setVar($var, $val) { |
|
86 | + $this->$var = $val; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @param $var |
|
91 | - * @return mixed |
|
92 | - */ |
|
93 | - public function getVar($var) { |
|
94 | - return $this->$var; |
|
95 | - } |
|
96 | - } |
|
89 | + /** |
|
90 | + * @param $var |
|
91 | + * @return mixed |
|
92 | + */ |
|
93 | + public function getVar($var) { |
|
94 | + return $this->$var; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | planet_parse_class(' |
@@ -26,7 +26,7 @@ |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -include_once dirname(__DIR__) . '/include/vars.php'; |
|
29 | +include_once dirname(__DIR__).'/include/vars.php'; |
|
30 | 30 | mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Xmlrpc_client')) { |