@@ -31,96 +31,96 @@ |
||
31 | 31 | */ |
32 | 32 | class ReleasesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get Count Releases in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountReleases = new \CriteriaCompo(); |
|
88 | - $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountReleases); |
|
90 | - } |
|
77 | + /** |
|
78 | + * Get Count Releases in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountReleases = new \CriteriaCompo(); |
|
88 | + $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountReleases); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get All Releases in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllReleases = new \CriteriaCompo(); |
|
103 | - $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllReleases); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Get All Releases in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllReleases = new \CriteriaCompo(); |
|
103 | + $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllReleases); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get Criteria Releases |
|
109 | - * @param $crReleases |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crReleases->setStart($start); |
|
119 | - $crReleases->setLimit($limit); |
|
120 | - $crReleases->setSort($sort); |
|
121 | - $crReleases->setOrder($order); |
|
122 | - return $crReleases; |
|
123 | - } |
|
107 | + /** |
|
108 | + * Get Criteria Releases |
|
109 | + * @param $crReleases |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crReleases->setStart($start); |
|
119 | + $crReleases->setLimit($limit); |
|
120 | + $crReleases->setSort($sort); |
|
121 | + $crReleases->setOrder($order); |
|
122 | + return $crReleases; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Update table requests |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if (Constants::STATUS_NEW === $repoStatus || Constants::STATUS_UPDATED === $repoStatus || 0 == $releasesCount) { |
150 | 150 | $ghReleases = $libReleases->getReleases($repositoriesAll[$i]->getVar('repo_user'), $repositoriesAll[$i]->getVar('repo_name')); |
151 | 151 | if ($releasesCount > 0) { |
152 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
152 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
153 | 153 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
154 | 154 | return false; |
155 | 155 | } |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | $first = true; |
160 | 160 | $final = false; |
161 | 161 | foreach ($ghReleases as $ghRelease) { |
162 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
162 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
163 | 163 | // save first in any case and save first final version |
164 | 164 | $releasesObj = $releasesHandler->create(); |
165 | 165 | $releasesObj->setVar('rel_repoid', $repoId); |
166 | 166 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
167 | 167 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
168 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
168 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
169 | 169 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
170 | 170 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
171 | 171 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | $first = false; |
180 | - if (false === (bool)$ghRelease['prerelease']) { |
|
180 | + if (false === (bool) $ghRelease['prerelease']) { |
|
181 | 181 | $final = true; |
182 | 182 | } |
183 | 183 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | // must return true otherwise releases will not be loaded |
216 | 216 | return true; |
217 | 217 | } |
218 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
218 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
219 | 219 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
220 | 220 | return false; |
221 | 221 | } |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | $first = true; |
225 | 225 | $final = false; |
226 | 226 | foreach ($ghReleases as $ghRelease) { |
227 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
227 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
228 | 228 | // save first in any case and save first final version |
229 | 229 | $releasesObj = $releasesHandler->create(); |
230 | 230 | $releasesObj->setVar('rel_repoid', $repoId); |
231 | 231 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
232 | 232 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
233 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
233 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
234 | 234 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
235 | 235 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
236 | 236 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | } |
244 | 244 | $first = false; |
245 | - if (false === (bool)$ghRelease['prerelease']) { |
|
245 | + if (false === (bool) $ghRelease['prerelease']) { |
|
246 | 246 | $final = true; |
247 | 247 | } |
248 | 248 | } |
@@ -259,17 +259,17 @@ discard block |
||
259 | 259 | public function updateRepoReleases() |
260 | 260 | { |
261 | 261 | // update repo_prerelease |
262 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
263 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
264 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_prerelease = 1 '; |
|
265 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=1));'; |
|
262 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
263 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
264 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_prerelease = 1 '; |
|
265 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=1));'; |
|
266 | 266 | $GLOBALS['xoopsDB']->queryF($sql); |
267 | 267 | |
268 | 268 | // update repo_release |
269 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
270 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
271 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_release = 1 '; |
|
272 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=0));'; |
|
269 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
270 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
271 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_release = 1 '; |
|
272 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=0));'; |
|
273 | 273 | $GLOBALS['xoopsDB']->queryF($sql); |
274 | 274 | |
275 | 275 | return true; |
@@ -31,94 +31,94 @@ |
||
31 | 31 | */ |
32 | 32 | class RepositoriesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_repositories', Repositories::class, 'repo_id', 'repo_name'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_repositories', Repositories::class, 'repo_id', 'repo_name'); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get Count Repositories in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountRepositories = new \CriteriaCompo(); |
|
88 | - $crCountRepositories = $this->getRepositoriesCriteria($crCountRepositories, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountRepositories); |
|
90 | - } |
|
77 | + /** |
|
78 | + * Get Count Repositories in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountRepositories = new \CriteriaCompo(); |
|
88 | + $crCountRepositories = $this->getRepositoriesCriteria($crCountRepositories, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountRepositories); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get All Repositories in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllRepositories = new \CriteriaCompo(); |
|
103 | - $crAllRepositories = $this->getRepositoriesCriteria($crAllRepositories, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllRepositories); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Get All Repositories in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllRepositories = new \CriteriaCompo(); |
|
103 | + $crAllRepositories = $this->getRepositoriesCriteria($crAllRepositories, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllRepositories); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get Criteria Repositories |
|
109 | - * @param $crRepositories |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getRepositoriesCriteria($crRepositories, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crRepositories->setStart($start); |
|
119 | - $crRepositories->setLimit($limit); |
|
120 | - $crRepositories->setSort($sort); |
|
121 | - $crRepositories->setOrder($order); |
|
122 | - return $crRepositories; |
|
123 | - } |
|
107 | + /** |
|
108 | + * Get Criteria Repositories |
|
109 | + * @param $crRepositories |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getRepositoriesCriteria($crRepositories, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crRepositories->setStart($start); |
|
119 | + $crRepositories->setLimit($limit); |
|
120 | + $crRepositories->setSort($sort); |
|
121 | + $crRepositories->setOrder($order); |
|
122 | + return $crRepositories; |
|
123 | + } |
|
124 | 124 | } |
@@ -31,96 +31,96 @@ |
||
31 | 31 | */ |
32 | 32 | class ReadmesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_readmes', Readmes::class, 'rm_id', 'rm_name'); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Get Count Readmes in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountReadmes = new \CriteriaCompo(); |
|
88 | - $crCountReadmes = $this->getReadmesCriteria($crCountReadmes, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountReadmes); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Get All Readmes in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllReadmes = new \CriteriaCompo(); |
|
103 | - $crAllReadmes = $this->getReadmesCriteria($crAllReadmes, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllReadmes); |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Get Criteria Readmes |
|
109 | - * @param $crReadmes |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getReadmesCriteria($crReadmes, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crReadmes->setStart($start); |
|
119 | - $crReadmes->setLimit($limit); |
|
120 | - $crReadmes->setSort($sort); |
|
121 | - $crReadmes->setOrder($order); |
|
122 | - return $crReadmes; |
|
123 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_readmes', Readmes::class, 'rm_id', 'rm_name'); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Get Count Readmes in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountReadmes = new \CriteriaCompo(); |
|
88 | + $crCountReadmes = $this->getReadmesCriteria($crCountReadmes, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountReadmes); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Get All Readmes in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllReadmes = new \CriteriaCompo(); |
|
103 | + $crAllReadmes = $this->getReadmesCriteria($crAllReadmes, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllReadmes); |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Get Criteria Readmes |
|
109 | + * @param $crReadmes |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getReadmesCriteria($crReadmes, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crReadmes->setStart($start); |
|
119 | + $crReadmes->setLimit($limit); |
|
120 | + $crReadmes->setSort($sort); |
|
121 | + $crReadmes->setOrder($order); |
|
122 | + return $crReadmes; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Update table requests |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $readmesObj->setVar('rm_content', $readme['content']); |
167 | 167 | $readmesObj->setVar('rm_encoding', $readme['encoding']); |
168 | 168 | $readmesObj->setVar('rm_downloadurl', $readme['download_url']); |
169 | - $readmesObj->setVar('rm_datecreated',time()); |
|
169 | + $readmesObj->setVar('rm_datecreated', time()); |
|
170 | 170 | $readmesObj->setVar('rm_submitter', $submitter); |
171 | 171 | // Insert Data |
172 | 172 | if (!$readmesHandler->insert($readmesObj)) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $readmesObj->setVar('rm_content', $readme['content']); |
228 | 228 | $readmesObj->setVar('rm_encoding', $readme['encoding']); |
229 | 229 | $readmesObj->setVar('rm_downloadurl', $readme['download_url']); |
230 | - $readmesObj->setVar('rm_datecreated',time()); |
|
230 | + $readmesObj->setVar('rm_datecreated', time()); |
|
231 | 231 | $readmesObj->setVar('rm_submitter', $submitter); |
232 | 232 | // Insert Data |
233 | 233 | if (!$readmesHandler->insert($readmesObj)) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | interface Constants |
30 | 30 | { |
31 | - // Constants for tables |
|
31 | + // Constants for tables |
|
32 | 32 | public const TABLE_SETTINGS = 0; |
33 | 33 | public const TABLE_REPOSITORIES = 1; |
34 | 34 | public const TABLE_DIRECTORIES = 2; |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | public const DIRECTORY_TYPE_USER = 1; |
40 | 40 | public const DIRECTORY_TYPE_ORG = 2; |
41 | 41 | |
42 | - // Constants for status |
|
43 | - public const STATUS_NONE = 0; |
|
42 | + // Constants for status |
|
43 | + public const STATUS_NONE = 0; |
|
44 | 44 | public const STATUS_NEW = 1; |
45 | 45 | public const STATUS_UPDATED = 2; |
46 | - public const STATUS_UPTODATE = 3; |
|
46 | + public const STATUS_UPTODATE = 3; |
|
47 | 47 | |
48 | - // Constants for permissions |
|
49 | - public const PERM_GLOBAL_NONE = 0; |
|
50 | - public const PERM_GLOBAL_VIEW = 1; |
|
51 | - public const PERM_GLOBAL_SUBMIT = 2; |
|
52 | - public const PERM_GLOBAL_APPROVE = 3; |
|
48 | + // Constants for permissions |
|
49 | + public const PERM_GLOBAL_NONE = 0; |
|
50 | + public const PERM_GLOBAL_VIEW = 1; |
|
51 | + public const PERM_GLOBAL_SUBMIT = 2; |
|
52 | + public const PERM_GLOBAL_APPROVE = 3; |
|
53 | 53 | |
54 | 54 | } |
@@ -32,135 +32,135 @@ |
||
32 | 32 | */ |
33 | 33 | class Releases extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
43 | 43 | $this->initVar('rel_repoid', XOBJ_DTYPE_INT); |
44 | - $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
45 | - $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
46 | - $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
45 | + $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
47 | 47 | $this->initVar('rel_publishedat', XOBJ_DTYPE_INT); |
48 | - $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
49 | - $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
50 | - $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
51 | - $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
52 | - } |
|
48 | + $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
49 | + $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
50 | + $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
51 | + $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @static function &getInstance |
|
56 | - * |
|
57 | - * @param null |
|
58 | - */ |
|
59 | - public static function getInstance() |
|
60 | - { |
|
61 | - static $instance = false; |
|
62 | - if (!$instance) { |
|
63 | - $instance = new self(); |
|
64 | - } |
|
65 | - } |
|
54 | + /** |
|
55 | + * @static function &getInstance |
|
56 | + * |
|
57 | + * @param null |
|
58 | + */ |
|
59 | + public static function getInstance() |
|
60 | + { |
|
61 | + static $instance = false; |
|
62 | + if (!$instance) { |
|
63 | + $instance = new self(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * The new inserted $Id |
|
69 | - * @return inserted id |
|
70 | - */ |
|
71 | - public function getNewInsertedIdReleases() |
|
72 | - { |
|
73 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | - return $newInsertedId; |
|
75 | - } |
|
67 | + /** |
|
68 | + * The new inserted $Id |
|
69 | + * @return inserted id |
|
70 | + */ |
|
71 | + public function getNewInsertedIdReleases() |
|
72 | + { |
|
73 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | + return $newInsertedId; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @public function getForm |
|
79 | - * @param bool $action |
|
80 | - * @return \XoopsThemeForm |
|
81 | - */ |
|
82 | - public function getFormReleases($action = false) |
|
83 | - { |
|
84 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | - if (!$action) { |
|
86 | - $action = $_SERVER['REQUEST_URI']; |
|
87 | - } |
|
88 | - // Title |
|
89 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
90 | - // Get Theme Form |
|
91 | - \xoops_load('XoopsFormLoader'); |
|
92 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
93 | - $form->setExtra('enctype="multipart/form-data"'); |
|
77 | + /** |
|
78 | + * @public function getForm |
|
79 | + * @param bool $action |
|
80 | + * @return \XoopsThemeForm |
|
81 | + */ |
|
82 | + public function getFormReleases($action = false) |
|
83 | + { |
|
84 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | + if (!$action) { |
|
86 | + $action = $_SERVER['REQUEST_URI']; |
|
87 | + } |
|
88 | + // Title |
|
89 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
90 | + // Get Theme Form |
|
91 | + \xoops_load('XoopsFormLoader'); |
|
92 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
93 | + $form->setExtra('enctype="multipart/form-data"'); |
|
94 | 94 | // Form Table repositories |
95 | 95 | $repositoriesHandler = $helper->getHandler('Repositories'); |
96 | 96 | $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rel_repoid', $this->getVar('rel_repoid')); |
97 | 97 | $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
98 | 98 | $form->addElement($rmRepoidSelect); |
99 | - // Form Select relType |
|
100 | - $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
101 | - $relTypeSelect->addOption('file'); |
|
102 | - $form->addElement($relTypeSelect); |
|
103 | - // Form Text relName |
|
104 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
99 | + // Form Select relType |
|
100 | + $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
101 | + $relTypeSelect->addOption('file'); |
|
102 | + $form->addElement($relTypeSelect); |
|
103 | + // Form Text relName |
|
104 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
105 | 105 | // Form Radio Yes/No relPrerelease |
106 | 106 | $relPrerelease = $this->isNew() ?: $this->getVar('rel_prerelease'); |
107 | 107 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_RELEASE_PRERELEASE, 'rel_prerelease', $relPrerelease)); |
108 | - // Form Text Date Select relPublishedat |
|
109 | - $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
110 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
111 | - // Form Text relTarballurl |
|
112 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
113 | - // Form Text relZipballurl |
|
114 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
115 | - // Form Text Date Select relDatecreated |
|
116 | - $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
117 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
118 | - // Form Select User relSubmitter |
|
119 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
120 | - // To Save |
|
121 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
122 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
123 | - return $form; |
|
124 | - } |
|
108 | + // Form Text Date Select relPublishedat |
|
109 | + $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
110 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
111 | + // Form Text relTarballurl |
|
112 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
113 | + // Form Text relZipballurl |
|
114 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
115 | + // Form Text Date Select relDatecreated |
|
116 | + $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
117 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
118 | + // Form Select User relSubmitter |
|
119 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
120 | + // To Save |
|
121 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
122 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
123 | + return $form; |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Get Values |
|
128 | - * @param null $keys |
|
129 | - * @param null $format |
|
130 | - * @param null $maxDepth |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
134 | - { |
|
126 | + /** |
|
127 | + * Get Values |
|
128 | + * @param null $keys |
|
129 | + * @param null $format |
|
130 | + * @param null $maxDepth |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
134 | + { |
|
135 | 135 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
136 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
137 | - $ret['id'] = $this->getVar('rel_id'); |
|
136 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
137 | + $ret['id'] = $this->getVar('rel_id'); |
|
138 | 138 | $repositoriesHandler = $helper->getHandler('Repositories'); |
139 | 139 | $repositoriesObj = $repositoriesHandler->get($this->getVar('rel_repoid')); |
140 | 140 | $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
141 | - $ret['type'] = $this->getVar('rel_type'); |
|
142 | - $ret['name'] = $this->getVar('rel_name'); |
|
141 | + $ret['type'] = $this->getVar('rel_type'); |
|
142 | + $ret['name'] = $this->getVar('rel_name'); |
|
143 | 143 | $ret['prerelease'] = (int)$this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
144 | - $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
145 | - $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
146 | - $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
147 | - $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
148 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
149 | - return $ret; |
|
150 | - } |
|
144 | + $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
145 | + $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
146 | + $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
147 | + $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
148 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
149 | + return $ret; |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
153 | - * Returns an array representation of the object |
|
154 | - * |
|
155 | - * @return array |
|
156 | - */ |
|
157 | - public function toArrayReleases() |
|
158 | - { |
|
159 | - $ret = []; |
|
160 | - $vars = $this->getVars(); |
|
161 | - foreach (\array_keys($vars) as $var) { |
|
162 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
163 | - } |
|
164 | - return $ret; |
|
165 | - } |
|
152 | + /** |
|
153 | + * Returns an array representation of the object |
|
154 | + * |
|
155 | + * @return array |
|
156 | + */ |
|
157 | + public function toArrayReleases() |
|
158 | + { |
|
159 | + $ret = []; |
|
160 | + $vars = $this->getVars(); |
|
161 | + foreach (\array_keys($vars) as $var) { |
|
162 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
163 | + } |
|
164 | + return $ret; |
|
165 | + } |
|
166 | 166 | } |
@@ -132,15 +132,15 @@ |
||
132 | 132 | */ |
133 | 133 | public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
134 | 134 | { |
135 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
135 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
136 | 136 | $ret = $this->getValues($keys, $format, $maxDepth); |
137 | - $ret['id'] = $this->getVar('rel_id'); |
|
137 | + $ret['id'] = $this->getVar('rel_id'); |
|
138 | 138 | $repositoriesHandler = $helper->getHandler('Repositories'); |
139 | 139 | $repositoriesObj = $repositoriesHandler->get($this->getVar('rel_repoid')); |
140 | - $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
140 | + $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
141 | 141 | $ret['type'] = $this->getVar('rel_type'); |
142 | 142 | $ret['name'] = $this->getVar('rel_name'); |
143 | - $ret['prerelease'] = (int)$this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
|
143 | + $ret['prerelease'] = (int) $this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
|
144 | 144 | $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
145 | 145 | $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
146 | 146 | $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
@@ -32,84 +32,84 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class Repositories extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->initVar('repo_id', XOBJ_DTYPE_INT); |
|
43 | - $this->initVar('repo_nodeid', XOBJ_DTYPE_TXTBOX); |
|
44 | - $this->initVar('repo_user', XOBJ_DTYPE_TXTBOX); |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->initVar('repo_id', XOBJ_DTYPE_INT); |
|
43 | + $this->initVar('repo_nodeid', XOBJ_DTYPE_TXTBOX); |
|
44 | + $this->initVar('repo_user', XOBJ_DTYPE_TXTBOX); |
|
45 | 45 | $this->initVar('repo_name', XOBJ_DTYPE_TXTBOX); |
46 | - $this->initVar('repo_fullname', XOBJ_DTYPE_TXTBOX); |
|
47 | - $this->initVar('repo_createdat', XOBJ_DTYPE_INT); |
|
48 | - $this->initVar('repo_updatedat', XOBJ_DTYPE_INT); |
|
49 | - $this->initVar('repo_htmlurl', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('repo_fullname', XOBJ_DTYPE_TXTBOX); |
|
47 | + $this->initVar('repo_createdat', XOBJ_DTYPE_INT); |
|
48 | + $this->initVar('repo_updatedat', XOBJ_DTYPE_INT); |
|
49 | + $this->initVar('repo_htmlurl', XOBJ_DTYPE_TXTBOX); |
|
50 | 50 | $this->initVar('repo_prerelease', XOBJ_DTYPE_TXTBOX); |
51 | 51 | $this->initVar('repo_release', XOBJ_DTYPE_TXTBOX); |
52 | - $this->initVar('repo_status', XOBJ_DTYPE_INT); |
|
53 | - $this->initVar('repo_datecreated', XOBJ_DTYPE_INT); |
|
54 | - $this->initVar('repo_submitter', XOBJ_DTYPE_INT); |
|
55 | - } |
|
52 | + $this->initVar('repo_status', XOBJ_DTYPE_INT); |
|
53 | + $this->initVar('repo_datecreated', XOBJ_DTYPE_INT); |
|
54 | + $this->initVar('repo_submitter', XOBJ_DTYPE_INT); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @static function &getInstance |
|
59 | - * |
|
60 | - * @param null |
|
61 | - */ |
|
62 | - public static function getInstance() |
|
63 | - { |
|
64 | - static $instance = false; |
|
65 | - if (!$instance) { |
|
66 | - $instance = new self(); |
|
67 | - } |
|
68 | - } |
|
57 | + /** |
|
58 | + * @static function &getInstance |
|
59 | + * |
|
60 | + * @param null |
|
61 | + */ |
|
62 | + public static function getInstance() |
|
63 | + { |
|
64 | + static $instance = false; |
|
65 | + if (!$instance) { |
|
66 | + $instance = new self(); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * The new inserted $Id |
|
72 | - * @return inserted id |
|
73 | - */ |
|
74 | - public function getNewInsertedIdRepositories() |
|
75 | - { |
|
76 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
77 | - return $newInsertedId; |
|
78 | - } |
|
70 | + /** |
|
71 | + * The new inserted $Id |
|
72 | + * @return inserted id |
|
73 | + */ |
|
74 | + public function getNewInsertedIdRepositories() |
|
75 | + { |
|
76 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
77 | + return $newInsertedId; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @public function getForm |
|
82 | - * @param bool $action |
|
83 | - * @return \XoopsThemeForm |
|
84 | - */ |
|
85 | - public function getFormRepositories($action = false) |
|
86 | - { |
|
87 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
88 | - if (!$action) { |
|
89 | - $action = $_SERVER['REQUEST_URI']; |
|
90 | - } |
|
91 | - // Title |
|
92 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_REPOSITORY_ADD) : \sprintf(_AM_WGGITHUB_REPOSITORY_EDIT); |
|
93 | - // Get Theme Form |
|
94 | - \xoops_load('XoopsFormLoader'); |
|
95 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
96 | - $form->setExtra('enctype="multipart/form-data"'); |
|
97 | - // Form Text repoNodeid |
|
98 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_NODEID, 'repo_nodeid', 50, 255, $this->getVar('repo_nodeid'))); |
|
80 | + /** |
|
81 | + * @public function getForm |
|
82 | + * @param bool $action |
|
83 | + * @return \XoopsThemeForm |
|
84 | + */ |
|
85 | + public function getFormRepositories($action = false) |
|
86 | + { |
|
87 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
88 | + if (!$action) { |
|
89 | + $action = $_SERVER['REQUEST_URI']; |
|
90 | + } |
|
91 | + // Title |
|
92 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_REPOSITORY_ADD) : \sprintf(_AM_WGGITHUB_REPOSITORY_EDIT); |
|
93 | + // Get Theme Form |
|
94 | + \xoops_load('XoopsFormLoader'); |
|
95 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
96 | + $form->setExtra('enctype="multipart/form-data"'); |
|
97 | + // Form Text repoNodeid |
|
98 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_NODEID, 'repo_nodeid', 50, 255, $this->getVar('repo_nodeid'))); |
|
99 | 99 | // Form Text repoUser |
100 | 100 | $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_USER, 'repo_user', 50, 255, $this->getVar('repo_user')), true); |
101 | - // Form Text repoName |
|
102 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_NAME, 'repo_name', 50, 255, $this->getVar('repo_name')), true); |
|
103 | - // Form Text repoFullname |
|
104 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_FULLNAME, 'repo_fullname', 50, 255, $this->getVar('repo_fullname'))); |
|
105 | - // Form Text Date Select repoCreatedat |
|
106 | - $repoCreatedat = $this->isNew() ?: $this->getVar('repo_createdat'); |
|
107 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_CREATEDAT, 'repo_createdat', '', $repoCreatedat)); |
|
108 | - // Form Text Date Select repoUpdatedat |
|
109 | - $repoUpdatedat = $this->isNew() ?: $this->getVar('repo_updatedat'); |
|
110 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_UPDATEDAT, 'repo_updatedat', '', $repoUpdatedat)); |
|
111 | - // Form Text repoHtmlurl |
|
112 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_HTMLURL, 'repo_htmlurl', 50, 255, $this->getVar('repo_htmlurl'))); |
|
101 | + // Form Text repoName |
|
102 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_NAME, 'repo_name', 50, 255, $this->getVar('repo_name')), true); |
|
103 | + // Form Text repoFullname |
|
104 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_FULLNAME, 'repo_fullname', 50, 255, $this->getVar('repo_fullname'))); |
|
105 | + // Form Text Date Select repoCreatedat |
|
106 | + $repoCreatedat = $this->isNew() ?: $this->getVar('repo_createdat'); |
|
107 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_CREATEDAT, 'repo_createdat', '', $repoCreatedat)); |
|
108 | + // Form Text Date Select repoUpdatedat |
|
109 | + $repoUpdatedat = $this->isNew() ?: $this->getVar('repo_updatedat'); |
|
110 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_UPDATEDAT, 'repo_updatedat', '', $repoUpdatedat)); |
|
111 | + // Form Text repoHtmlurl |
|
112 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_HTMLURL, 'repo_htmlurl', 50, 255, $this->getVar('repo_htmlurl'))); |
|
113 | 113 | // Form Text repoPrerelease |
114 | 114 | $form->addElement(new \XoopsFormText(_AM_WGGITHUB_REPOSITORY_PRERELEASE, 'repo_prerelease', 50, 255, $this->getVar('repo_prerelease'))); |
115 | 115 | // Form Text repoRelease |
@@ -122,100 +122,100 @@ discard block |
||
122 | 122 | $repoStatusSelect->addOption(Constants::STATUS_UPDATED, _AM_WGGITHUB_STATUS_UPDATED); |
123 | 123 | $form->addElement($repoStatusSelect); |
124 | 124 | // Form Text Date Select repoDatecreated |
125 | - $repoDatecreated = $this->isNew() ?: $this->getVar('repo_datecreated'); |
|
126 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_DATECREATED, 'repo_datecreated', '', $repoDatecreated)); |
|
127 | - // Form Select User repoSubmitter |
|
128 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_REPOSITORY_SUBMITTER, 'repo_submitter', false, $this->getVar('repo_submitter'))); |
|
129 | - // Permissions |
|
130 | - $memberHandler = \xoops_getHandler('member'); |
|
131 | - $groupList = $memberHandler->getGroupList(); |
|
132 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
133 | - $fullList[] = \array_keys($groupList); |
|
134 | - if (!$this->isNew()) { |
|
135 | - $groupsIdsApprove = $grouppermHandler->getGroupIds('wggithub_approve_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
136 | - $groupsIdsApprove[] = \array_values($groupsIdsApprove); |
|
137 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_repositories[]', $groupsIdsApprove); |
|
138 | - $groupsIdsSubmit = $grouppermHandler->getGroupIds('wggithub_submit_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
139 | - $groupsIdsSubmit[] = \array_values($groupsIdsSubmit); |
|
140 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_repositories[]', $groupsIdsSubmit); |
|
141 | - $groupsIdsView = $grouppermHandler->getGroupIds('wggithub_view_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
142 | - $groupsIdsView[] = \array_values($groupsIdsView); |
|
143 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_repositories[]', $groupsIdsView); |
|
144 | - } else { |
|
145 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_repositories[]', $fullList); |
|
146 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_repositories[]', $fullList); |
|
147 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_repositories[]', $fullList); |
|
148 | - } |
|
149 | - // To Approve |
|
150 | - $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
151 | - $form->addElement($groupsCanApproveCheckbox); |
|
152 | - // To Submit |
|
153 | - $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
154 | - $form->addElement($groupsCanSubmitCheckbox); |
|
155 | - // To View |
|
156 | - $groupsCanViewCheckbox->addOptionArray($groupList); |
|
157 | - $form->addElement($groupsCanViewCheckbox); |
|
158 | - // To Save |
|
159 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
160 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
161 | - return $form; |
|
162 | - } |
|
125 | + $repoDatecreated = $this->isNew() ?: $this->getVar('repo_datecreated'); |
|
126 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_REPOSITORY_DATECREATED, 'repo_datecreated', '', $repoDatecreated)); |
|
127 | + // Form Select User repoSubmitter |
|
128 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_REPOSITORY_SUBMITTER, 'repo_submitter', false, $this->getVar('repo_submitter'))); |
|
129 | + // Permissions |
|
130 | + $memberHandler = \xoops_getHandler('member'); |
|
131 | + $groupList = $memberHandler->getGroupList(); |
|
132 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
133 | + $fullList[] = \array_keys($groupList); |
|
134 | + if (!$this->isNew()) { |
|
135 | + $groupsIdsApprove = $grouppermHandler->getGroupIds('wggithub_approve_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
136 | + $groupsIdsApprove[] = \array_values($groupsIdsApprove); |
|
137 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_repositories[]', $groupsIdsApprove); |
|
138 | + $groupsIdsSubmit = $grouppermHandler->getGroupIds('wggithub_submit_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
139 | + $groupsIdsSubmit[] = \array_values($groupsIdsSubmit); |
|
140 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_repositories[]', $groupsIdsSubmit); |
|
141 | + $groupsIdsView = $grouppermHandler->getGroupIds('wggithub_view_repositories', $this->getVar('repo_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
142 | + $groupsIdsView[] = \array_values($groupsIdsView); |
|
143 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_repositories[]', $groupsIdsView); |
|
144 | + } else { |
|
145 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_repositories[]', $fullList); |
|
146 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_repositories[]', $fullList); |
|
147 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_repositories[]', $fullList); |
|
148 | + } |
|
149 | + // To Approve |
|
150 | + $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
151 | + $form->addElement($groupsCanApproveCheckbox); |
|
152 | + // To Submit |
|
153 | + $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
154 | + $form->addElement($groupsCanSubmitCheckbox); |
|
155 | + // To View |
|
156 | + $groupsCanViewCheckbox->addOptionArray($groupList); |
|
157 | + $form->addElement($groupsCanViewCheckbox); |
|
158 | + // To Save |
|
159 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
160 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
161 | + return $form; |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * Get Values |
|
166 | - * @param null $keys |
|
167 | - * @param null $format |
|
168 | - * @param null $maxDepth |
|
169 | - * @return array |
|
170 | - */ |
|
171 | - public function getValuesRepositories($keys = null, $format = null, $maxDepth = null) |
|
172 | - { |
|
173 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
174 | - $ret['id'] = $this->getVar('repo_id'); |
|
175 | - $ret['nodeid'] = $this->getVar('repo_nodeid'); |
|
164 | + /** |
|
165 | + * Get Values |
|
166 | + * @param null $keys |
|
167 | + * @param null $format |
|
168 | + * @param null $maxDepth |
|
169 | + * @return array |
|
170 | + */ |
|
171 | + public function getValuesRepositories($keys = null, $format = null, $maxDepth = null) |
|
172 | + { |
|
173 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
174 | + $ret['id'] = $this->getVar('repo_id'); |
|
175 | + $ret['nodeid'] = $this->getVar('repo_nodeid'); |
|
176 | 176 | $ret['user'] = $this->getVar('repo_user'); |
177 | - $ret['name'] = $this->getVar('repo_name'); |
|
178 | - $ret['fullname'] = $this->getVar('repo_fullname'); |
|
179 | - $ret['createdat'] = \formatTimestamp($this->getVar('repo_createdat'), 'm'); |
|
180 | - $ret['updatedat'] = \formatTimestamp($this->getVar('repo_updatedat'), 'm'); |
|
181 | - $ret['htmlurl'] = $this->getVar('repo_htmlurl'); |
|
177 | + $ret['name'] = $this->getVar('repo_name'); |
|
178 | + $ret['fullname'] = $this->getVar('repo_fullname'); |
|
179 | + $ret['createdat'] = \formatTimestamp($this->getVar('repo_createdat'), 'm'); |
|
180 | + $ret['updatedat'] = \formatTimestamp($this->getVar('repo_updatedat'), 'm'); |
|
181 | + $ret['htmlurl'] = $this->getVar('repo_htmlurl'); |
|
182 | 182 | $ret['prerelease'] = $this->getVar('repo_prerelease'); |
183 | 183 | $ret['release'] = $this->getVar('repo_release'); |
184 | - $status = $this->getVar('repo_status'); |
|
185 | - $ret['status'] = $status; |
|
186 | - switch ($status) { |
|
187 | - case Constants::STATUS_NONE: |
|
188 | - default: |
|
189 | - $status_text = \_AM_WGGITHUB_STATUS_NONE; |
|
190 | - break; |
|
184 | + $status = $this->getVar('repo_status'); |
|
185 | + $ret['status'] = $status; |
|
186 | + switch ($status) { |
|
187 | + case Constants::STATUS_NONE: |
|
188 | + default: |
|
189 | + $status_text = \_AM_WGGITHUB_STATUS_NONE; |
|
190 | + break; |
|
191 | 191 | case Constants::STATUS_NEW: |
192 | 192 | $status_text = \_AM_WGGITHUB_STATUS_NEW; |
193 | 193 | break; |
194 | 194 | case Constants::STATUS_UPTODATE: |
195 | - $status_text = \_AM_WGGITHUB_STATUS_UPTODATE; |
|
196 | - break; |
|
197 | - case Constants::STATUS_UPDATED: |
|
198 | - $status_text = \_AM_WGGITHUB_STATUS_UPDATED; |
|
199 | - break; |
|
200 | - } |
|
201 | - $ret['status_text'] = $status_text; |
|
202 | - $ret['datecreated'] = \formatTimestamp($this->getVar('repo_datecreated'), 'm'); |
|
203 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('repo_submitter')); |
|
204 | - return $ret; |
|
205 | - } |
|
195 | + $status_text = \_AM_WGGITHUB_STATUS_UPTODATE; |
|
196 | + break; |
|
197 | + case Constants::STATUS_UPDATED: |
|
198 | + $status_text = \_AM_WGGITHUB_STATUS_UPDATED; |
|
199 | + break; |
|
200 | + } |
|
201 | + $ret['status_text'] = $status_text; |
|
202 | + $ret['datecreated'] = \formatTimestamp($this->getVar('repo_datecreated'), 'm'); |
|
203 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('repo_submitter')); |
|
204 | + return $ret; |
|
205 | + } |
|
206 | 206 | |
207 | - /** |
|
208 | - * Returns an array representation of the object |
|
209 | - * |
|
210 | - * @return array |
|
211 | - */ |
|
212 | - public function toArrayRepositories() |
|
213 | - { |
|
214 | - $ret = []; |
|
215 | - $vars = $this->getVars(); |
|
216 | - foreach (\array_keys($vars) as $var) { |
|
217 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
218 | - } |
|
219 | - return $ret; |
|
220 | - } |
|
207 | + /** |
|
208 | + * Returns an array representation of the object |
|
209 | + * |
|
210 | + * @return array |
|
211 | + */ |
|
212 | + public function toArrayRepositories() |
|
213 | + { |
|
214 | + $ret = []; |
|
215 | + $vars = $this->getVars(); |
|
216 | + foreach (\array_keys($vars) as $var) { |
|
217 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
218 | + } |
|
219 | + return $ret; |
|
220 | + } |
|
221 | 221 | } |
@@ -173,7 +173,7 @@ |
||
173 | 173 | $ret = $this->getValues($keys, $format, $maxDepth); |
174 | 174 | $ret['id'] = $this->getVar('repo_id'); |
175 | 175 | $ret['nodeid'] = $this->getVar('repo_nodeid'); |
176 | - $ret['user'] = $this->getVar('repo_user'); |
|
176 | + $ret['user'] = $this->getVar('repo_user'); |
|
177 | 177 | $ret['name'] = $this->getVar('repo_name'); |
178 | 178 | $ret['fullname'] = $this->getVar('repo_fullname'); |
179 | 179 | $ret['createdat'] = \formatTimestamp($this->getVar('repo_createdat'), 'm'); |
@@ -33,77 +33,77 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class Directories extends \XoopsObject |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor |
|
38 | - * |
|
39 | - * @param null |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->initVar('dir_id', \XOBJ_DTYPE_INT); |
|
44 | - $this->initVar('dir_name', \XOBJ_DTYPE_TXTBOX); |
|
45 | - $this->initVar('dir_type', \XOBJ_DTYPE_INT); |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + * |
|
39 | + * @param null |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->initVar('dir_id', \XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('dir_name', \XOBJ_DTYPE_TXTBOX); |
|
45 | + $this->initVar('dir_type', \XOBJ_DTYPE_INT); |
|
46 | 46 | $this->initVar('dir_autoupdate', XOBJ_DTYPE_INT); |
47 | 47 | $this->initVar('dir_online', XOBJ_DTYPE_INT); |
48 | 48 | $this->initVar('dir_filterrelease', XOBJ_DTYPE_INT); |
49 | - $this->initVar('dir_datecreated', \XOBJ_DTYPE_INT); |
|
50 | - $this->initVar('dir_submitter', \XOBJ_DTYPE_INT); |
|
51 | - } |
|
49 | + $this->initVar('dir_datecreated', \XOBJ_DTYPE_INT); |
|
50 | + $this->initVar('dir_submitter', \XOBJ_DTYPE_INT); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @static function &getInstance |
|
55 | - * |
|
56 | - * @param null |
|
57 | - */ |
|
58 | - public static function getInstance() |
|
59 | - { |
|
60 | - static $instance = false; |
|
61 | - if (!$instance) { |
|
62 | - $instance = new self(); |
|
63 | - } |
|
64 | - } |
|
53 | + /** |
|
54 | + * @static function &getInstance |
|
55 | + * |
|
56 | + * @param null |
|
57 | + */ |
|
58 | + public static function getInstance() |
|
59 | + { |
|
60 | + static $instance = false; |
|
61 | + if (!$instance) { |
|
62 | + $instance = new self(); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * The new inserted $Id |
|
68 | - * @return inserted id |
|
69 | - */ |
|
70 | - public function getNewInsertedIdDirectories() |
|
71 | - { |
|
72 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
73 | - return $newInsertedId; |
|
74 | - } |
|
66 | + /** |
|
67 | + * The new inserted $Id |
|
68 | + * @return inserted id |
|
69 | + */ |
|
70 | + public function getNewInsertedIdDirectories() |
|
71 | + { |
|
72 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
73 | + return $newInsertedId; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @public function getForm |
|
78 | - * @param bool $action |
|
79 | - * @return \XoopsThemeForm |
|
80 | - */ |
|
81 | - public function getFormDirectories($action = false) |
|
82 | - { |
|
83 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
84 | - if (!$action) { |
|
85 | - $action = $_SERVER['REQUEST_URI']; |
|
86 | - } |
|
87 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
88 | - // Permissions for uploader |
|
89 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
90 | - $groups = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : \XOOPS_GROUP_ANONYMOUS; |
|
91 | - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
92 | - // Title |
|
93 | - $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
|
94 | - // Get Theme Form |
|
95 | - \xoops_load('XoopsFormLoader'); |
|
96 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
97 | - $form->setExtra('enctype="multipart/form-data"'); |
|
98 | - // Form Text dirName |
|
99 | - $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
100 | - // Directories Handler |
|
101 | - $directoriesHandler = $helper->getHandler('Directories'); |
|
102 | - // Form Select dirType |
|
103 | - $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
104 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
105 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
106 | - $form->addElement($dirTypeSelect, true); |
|
76 | + /** |
|
77 | + * @public function getForm |
|
78 | + * @param bool $action |
|
79 | + * @return \XoopsThemeForm |
|
80 | + */ |
|
81 | + public function getFormDirectories($action = false) |
|
82 | + { |
|
83 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
84 | + if (!$action) { |
|
85 | + $action = $_SERVER['REQUEST_URI']; |
|
86 | + } |
|
87 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
88 | + // Permissions for uploader |
|
89 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
90 | + $groups = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : \XOOPS_GROUP_ANONYMOUS; |
|
91 | + $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
92 | + // Title |
|
93 | + $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
|
94 | + // Get Theme Form |
|
95 | + \xoops_load('XoopsFormLoader'); |
|
96 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
97 | + $form->setExtra('enctype="multipart/form-data"'); |
|
98 | + // Form Text dirName |
|
99 | + $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
100 | + // Directories Handler |
|
101 | + $directoriesHandler = $helper->getHandler('Directories'); |
|
102 | + // Form Select dirType |
|
103 | + $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
104 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
105 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
106 | + $form->addElement($dirTypeSelect, true); |
|
107 | 107 | // Form Radio Yes/No dirAutoupdate |
108 | 108 | $dirAutoupdate = $this->isNew() ?: $this->getVar('dir_autoupdate'); |
109 | 109 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_AUTOUPDATE, 'dir_autoupdate', $dirAutoupdate)); |
@@ -113,80 +113,80 @@ discard block |
||
113 | 113 | // Form Radio Yes/No dirFilterrelease |
114 | 114 | $dirFilterrelease = $this->isNew() ?: $this->getVar('dir_filterrelease'); |
115 | 115 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_FILTERRELEASE, 'dir_filterrelease', $dirFilterrelease)); |
116 | - // Form Text Date Select dirDatecreated |
|
117 | - $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
118 | - $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
119 | - // Form Select User dirSubmitter |
|
120 | - $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
121 | - // Permissions |
|
122 | - $memberHandler = \xoops_getHandler('member'); |
|
123 | - $groupList = $memberHandler->getGroupList(); |
|
124 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
125 | - $fullList[] = \array_keys($groupList); |
|
126 | - if (!$this->isNew()) { |
|
127 | - $groupsIdsApprove = $grouppermHandler->getGroupIds('wggithub_approve_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
128 | - $groupsIdsApprove[] = \array_values($groupsIdsApprove); |
|
129 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_directories[]', $groupsIdsApprove); |
|
130 | - $groupsIdsSubmit = $grouppermHandler->getGroupIds('wggithub_submit_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
131 | - $groupsIdsSubmit[] = \array_values($groupsIdsSubmit); |
|
132 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_directories[]', $groupsIdsSubmit); |
|
133 | - $groupsIdsView = $grouppermHandler->getGroupIds('wggithub_view_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
134 | - $groupsIdsView[] = \array_values($groupsIdsView); |
|
135 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_directories[]', $groupsIdsView); |
|
136 | - } else { |
|
137 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_directories[]', $fullList); |
|
138 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_directories[]', $fullList); |
|
139 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_directories[]', $fullList); |
|
140 | - } |
|
141 | - // To Approve |
|
142 | - $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
143 | - $form->addElement($groupsCanApproveCheckbox); |
|
144 | - // To Submit |
|
145 | - $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
146 | - $form->addElement($groupsCanSubmitCheckbox); |
|
147 | - // To View |
|
148 | - $groupsCanViewCheckbox->addOptionArray($groupList); |
|
149 | - $form->addElement($groupsCanViewCheckbox); |
|
150 | - // To Save |
|
151 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
152 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
153 | - return $form; |
|
154 | - } |
|
116 | + // Form Text Date Select dirDatecreated |
|
117 | + $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
118 | + $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
119 | + // Form Select User dirSubmitter |
|
120 | + $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
121 | + // Permissions |
|
122 | + $memberHandler = \xoops_getHandler('member'); |
|
123 | + $groupList = $memberHandler->getGroupList(); |
|
124 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
125 | + $fullList[] = \array_keys($groupList); |
|
126 | + if (!$this->isNew()) { |
|
127 | + $groupsIdsApprove = $grouppermHandler->getGroupIds('wggithub_approve_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
128 | + $groupsIdsApprove[] = \array_values($groupsIdsApprove); |
|
129 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_directories[]', $groupsIdsApprove); |
|
130 | + $groupsIdsSubmit = $grouppermHandler->getGroupIds('wggithub_submit_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
131 | + $groupsIdsSubmit[] = \array_values($groupsIdsSubmit); |
|
132 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_directories[]', $groupsIdsSubmit); |
|
133 | + $groupsIdsView = $grouppermHandler->getGroupIds('wggithub_view_directories', $this->getVar('dir_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
134 | + $groupsIdsView[] = \array_values($groupsIdsView); |
|
135 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_directories[]', $groupsIdsView); |
|
136 | + } else { |
|
137 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_APPROVE, 'groups_approve_directories[]', $fullList); |
|
138 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_SUBMIT, 'groups_submit_directories[]', $fullList); |
|
139 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(\_AM_WGGITHUB_PERMISSIONS_VIEW, 'groups_view_directories[]', $fullList); |
|
140 | + } |
|
141 | + // To Approve |
|
142 | + $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
143 | + $form->addElement($groupsCanApproveCheckbox); |
|
144 | + // To Submit |
|
145 | + $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
146 | + $form->addElement($groupsCanSubmitCheckbox); |
|
147 | + // To View |
|
148 | + $groupsCanViewCheckbox->addOptionArray($groupList); |
|
149 | + $form->addElement($groupsCanViewCheckbox); |
|
150 | + // To Save |
|
151 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
152 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
153 | + return $form; |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * Get Values |
|
158 | - * @param null $keys |
|
159 | - * @param null $format |
|
160 | - * @param null $maxDepth |
|
161 | - * @return array |
|
162 | - */ |
|
163 | - public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
164 | - { |
|
165 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
166 | - $ret['id'] = $this->getVar('dir_id'); |
|
167 | - $ret['name'] = $this->getVar('dir_name'); |
|
168 | - $ret['type'] = $this->getVar('dir_type'); |
|
156 | + /** |
|
157 | + * Get Values |
|
158 | + * @param null $keys |
|
159 | + * @param null $format |
|
160 | + * @param null $maxDepth |
|
161 | + * @return array |
|
162 | + */ |
|
163 | + public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
164 | + { |
|
165 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
166 | + $ret['id'] = $this->getVar('dir_id'); |
|
167 | + $ret['name'] = $this->getVar('dir_name'); |
|
168 | + $ret['type'] = $this->getVar('dir_type'); |
|
169 | 169 | $ret['type_text'] = Constants::DIRECTORY_TYPE_USER == $this->getVar('dir_type') ? \_AM_WGGITHUB_DIRECTORY_TYPE_USER : \_AM_WGGITHUB_DIRECTORY_TYPE_ORG; |
170 | 170 | $ret['autoupdate'] = (int)$this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
171 | 171 | $ret['online'] = (int)$this->getVar('dir_online') > 0 ? _YES : _NO; |
172 | 172 | $ret['filterrelease'] = (int)$this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
173 | - $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
174 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
175 | - return $ret; |
|
176 | - } |
|
173 | + $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
174 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
175 | + return $ret; |
|
176 | + } |
|
177 | 177 | |
178 | - /** |
|
179 | - * Returns an array representation of the object |
|
180 | - * |
|
181 | - * @return array |
|
182 | - */ |
|
183 | - public function toArrayDirectories() |
|
184 | - { |
|
185 | - $ret = []; |
|
186 | - $vars = $this->getVars(); |
|
187 | - foreach (\array_keys($vars) as $var) { |
|
188 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
189 | - } |
|
190 | - return $ret; |
|
191 | - } |
|
178 | + /** |
|
179 | + * Returns an array representation of the object |
|
180 | + * |
|
181 | + * @return array |
|
182 | + */ |
|
183 | + public function toArrayDirectories() |
|
184 | + { |
|
185 | + $ret = []; |
|
186 | + $vars = $this->getVars(); |
|
187 | + foreach (\array_keys($vars) as $var) { |
|
188 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
189 | + } |
|
190 | + return $ret; |
|
191 | + } |
|
192 | 192 | } |
@@ -167,9 +167,9 @@ |
||
167 | 167 | $ret['name'] = $this->getVar('dir_name'); |
168 | 168 | $ret['type'] = $this->getVar('dir_type'); |
169 | 169 | $ret['type_text'] = Constants::DIRECTORY_TYPE_USER == $this->getVar('dir_type') ? \_AM_WGGITHUB_DIRECTORY_TYPE_USER : \_AM_WGGITHUB_DIRECTORY_TYPE_ORG; |
170 | - $ret['autoupdate'] = (int)$this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
|
171 | - $ret['online'] = (int)$this->getVar('dir_online') > 0 ? _YES : _NO; |
|
172 | - $ret['filterrelease'] = (int)$this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
|
170 | + $ret['autoupdate'] = (int) $this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
|
171 | + $ret['online'] = (int) $this->getVar('dir_online') > 0 ? _YES : _NO; |
|
172 | + $ret['filterrelease'] = (int) $this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
|
173 | 173 | $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
174 | 174 | $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
175 | 175 | return $ret; |
@@ -191,14 +191,14 @@ |
||
191 | 191 | $donationform = [ |
192 | 192 | 0 => '<form name="donation" id="donation" action="http://www.txmodxoops.org/modules/xdonations/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
193 | 193 | 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
194 | - . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | - . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | - . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | - . _SUBMIT |
|
199 | - . '" title="' |
|
200 | - . _SUBMIT |
|
201 | - . '" type="submit"></td></tr></tbody></table>', |
|
194 | + . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | + . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | + . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | + . _SUBMIT |
|
199 | + . '" title="' |
|
200 | + . _SUBMIT |
|
201 | + . '" type="submit"></td></tr></tbody></table>', |
|
202 | 202 | 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="EUR" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"></form>', |
203 | 203 | 'D' => '', |
204 | 204 | 3 => '', |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | { |
57 | 57 | if ($considerHtml) { |
58 | 58 | // if the plain text is shorter than the maximum length, return the whole text |
59 | - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { |
|
59 | + if (mb_strlen(\preg_replace('/<.*?'.'>/', '', $text)) <= $length) { |
|
60 | 60 | return $text; |
61 | 61 | } |
62 | 62 | // splits all html-tags to scanable lines |
63 | - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
63 | + \preg_match_all('/(<.+?'.'>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
64 | 64 | $total_length = mb_strlen($ending); |
65 | 65 | $open_tags = []; |
66 | 66 | $truncate = ''; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | unset($open_tags[$pos]); |
79 | 79 | } |
80 | 80 | // if tag is an opening tag |
81 | - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { |
|
81 | + } elseif (\preg_match('/^<\s*([^\s>!]+).*?'.'>$/s', $line_matchings[1], $tag_matchings)) { |
|
82 | 82 | // add tag to the beginning of $open_tags list |
83 | 83 | \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); |
84 | 84 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if ($considerHtml) { |
139 | 139 | // close all unclosed html-tags |
140 | 140 | foreach ($open_tags as $tag) { |
141 | - $truncate .= '</' . $tag . '>'; |
|
141 | + $truncate .= '</'.$tag.'>'; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | //--></script> |
212 | 212 | <!-- End Form Validation JavaScript //-->', |
213 | 213 | ]; |
214 | - $paypalform = [ |
|
214 | + $paypalform = [ |
|
215 | 215 | 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
216 | 216 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
217 | 217 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | case 2: |
225 | 225 | $donationform[$key] = \sprintf( |
226 | 226 | $donationform[$key], |
227 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
227 | + $GLOBALS['xoopsConfig']['sitename'].' - '.('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
228 | 228 | $GLOBALS['xoopsUser']->getVar('email'), |
229 | 229 | XOOPS_LICENSE_KEY, |
230 | 230 | \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), |
231 | - \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') |
|
231 | + \mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')).' '.$GLOBALS['xoopsModule']->getVar('name') |
|
232 | 232 | ); |
233 | 233 | break; |
234 | 234 | } |
@@ -33,140 +33,140 @@ |
||
33 | 33 | */ |
34 | 34 | class Readmes extends \XoopsObject |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor |
|
38 | - * |
|
39 | - * @param null |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->initVar('rm_id', XOBJ_DTYPE_INT); |
|
44 | - $this->initVar('rm_repoid', XOBJ_DTYPE_INT); |
|
45 | - $this->initVar('rm_name', XOBJ_DTYPE_TXTBOX); |
|
46 | - $this->initVar('rm_type', XOBJ_DTYPE_TXTBOX); |
|
47 | - $this->initVar('rm_content', XOBJ_DTYPE_TXTAREA); |
|
48 | - $this->initVar('rm_encoding', XOBJ_DTYPE_TXTBOX); |
|
49 | - $this->initVar('rm_downloadurl', XOBJ_DTYPE_TXTBOX); |
|
50 | - $this->initVar('rm_datecreated', XOBJ_DTYPE_INT); |
|
51 | - $this->initVar('rm_submitter', XOBJ_DTYPE_INT); |
|
52 | - } |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + * |
|
39 | + * @param null |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->initVar('rm_id', XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('rm_repoid', XOBJ_DTYPE_INT); |
|
45 | + $this->initVar('rm_name', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('rm_type', XOBJ_DTYPE_TXTBOX); |
|
47 | + $this->initVar('rm_content', XOBJ_DTYPE_TXTAREA); |
|
48 | + $this->initVar('rm_encoding', XOBJ_DTYPE_TXTBOX); |
|
49 | + $this->initVar('rm_downloadurl', XOBJ_DTYPE_TXTBOX); |
|
50 | + $this->initVar('rm_datecreated', XOBJ_DTYPE_INT); |
|
51 | + $this->initVar('rm_submitter', XOBJ_DTYPE_INT); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @static function &getInstance |
|
56 | - * |
|
57 | - * @param null |
|
58 | - */ |
|
59 | - public static function getInstance() |
|
60 | - { |
|
61 | - static $instance = false; |
|
62 | - if (!$instance) { |
|
63 | - $instance = new self(); |
|
64 | - } |
|
65 | - } |
|
54 | + /** |
|
55 | + * @static function &getInstance |
|
56 | + * |
|
57 | + * @param null |
|
58 | + */ |
|
59 | + public static function getInstance() |
|
60 | + { |
|
61 | + static $instance = false; |
|
62 | + if (!$instance) { |
|
63 | + $instance = new self(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * The new inserted $Id |
|
69 | - * @return inserted id |
|
70 | - */ |
|
71 | - public function getNewInsertedIdReadmes() |
|
72 | - { |
|
73 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | - return $newInsertedId; |
|
75 | - } |
|
67 | + /** |
|
68 | + * The new inserted $Id |
|
69 | + * @return inserted id |
|
70 | + */ |
|
71 | + public function getNewInsertedIdReadmes() |
|
72 | + { |
|
73 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | + return $newInsertedId; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @public function getForm |
|
79 | - * @param bool $action |
|
80 | - * @return \XoopsThemeForm |
|
81 | - */ |
|
82 | - public function getFormReadmes($action = false) |
|
83 | - { |
|
84 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | - if (!$action) { |
|
86 | - $action = $_SERVER['REQUEST_URI']; |
|
87 | - } |
|
88 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
89 | - // Title |
|
90 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_README_ADD) : \sprintf(_AM_WGGITHUB_README_EDIT); |
|
91 | - // Get Theme Form |
|
92 | - \xoops_load('XoopsFormLoader'); |
|
93 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | - $form->setExtra('enctype="multipart/form-data"'); |
|
95 | - // Form Table repositories |
|
96 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
97 | - $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rm_repoid', $this->getVar('rm_repoid')); |
|
98 | - $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
|
99 | - $form->addElement($rmRepoidSelect); |
|
100 | - // Form Text rmName |
|
101 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_NAME, 'rm_name', 50, 255, $this->getVar('rm_name'))); |
|
102 | - // Form Text rmType |
|
77 | + /** |
|
78 | + * @public function getForm |
|
79 | + * @param bool $action |
|
80 | + * @return \XoopsThemeForm |
|
81 | + */ |
|
82 | + public function getFormReadmes($action = false) |
|
83 | + { |
|
84 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | + if (!$action) { |
|
86 | + $action = $_SERVER['REQUEST_URI']; |
|
87 | + } |
|
88 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
89 | + // Title |
|
90 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_README_ADD) : \sprintf(_AM_WGGITHUB_README_EDIT); |
|
91 | + // Get Theme Form |
|
92 | + \xoops_load('XoopsFormLoader'); |
|
93 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
94 | + $form->setExtra('enctype="multipart/form-data"'); |
|
95 | + // Form Table repositories |
|
96 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
97 | + $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rm_repoid', $this->getVar('rm_repoid')); |
|
98 | + $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
|
99 | + $form->addElement($rmRepoidSelect); |
|
100 | + // Form Text rmName |
|
101 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_NAME, 'rm_name', 50, 255, $this->getVar('rm_name'))); |
|
102 | + // Form Text rmType |
|
103 | 103 | $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_TYPE, 'rm_type', 50, 255, $this->getVar('rm_type'))); |
104 | - // Form Editor TextArea rmContent |
|
105 | - $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_README_CONTENT, 'rm_content', $this->getVar('rm_content', 'e'), 4, 47)); |
|
106 | - // Form Text rmEncoding |
|
107 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_ENCODING, 'rm_encoding', 50, 255, $this->getVar('rm_encoding'))); |
|
108 | - // Form Text rmDownloadurl |
|
109 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_DOWNLOADURL, 'rm_downloadurl', 50, 255, $this->getVar('rm_downloadurl'))); |
|
110 | - // Form Text Date Select rmDatecreated |
|
111 | - $rmDatecreated = $this->isNew() ?: $this->getVar('rm_datecreated'); |
|
112 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_README_DATECREATED, 'rm_datecreated', '', $rmDatecreated)); |
|
113 | - // Form Select User rmSubmitter |
|
114 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_README_SUBMITTER, 'rm_submitter', false, $this->getVar('rm_submitter'))); |
|
115 | - // To Save |
|
116 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
117 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
118 | - return $form; |
|
119 | - } |
|
104 | + // Form Editor TextArea rmContent |
|
105 | + $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_README_CONTENT, 'rm_content', $this->getVar('rm_content', 'e'), 4, 47)); |
|
106 | + // Form Text rmEncoding |
|
107 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_ENCODING, 'rm_encoding', 50, 255, $this->getVar('rm_encoding'))); |
|
108 | + // Form Text rmDownloadurl |
|
109 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_README_DOWNLOADURL, 'rm_downloadurl', 50, 255, $this->getVar('rm_downloadurl'))); |
|
110 | + // Form Text Date Select rmDatecreated |
|
111 | + $rmDatecreated = $this->isNew() ?: $this->getVar('rm_datecreated'); |
|
112 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_README_DATECREATED, 'rm_datecreated', '', $rmDatecreated)); |
|
113 | + // Form Select User rmSubmitter |
|
114 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_README_SUBMITTER, 'rm_submitter', false, $this->getVar('rm_submitter'))); |
|
115 | + // To Save |
|
116 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
117 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
118 | + return $form; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Get Values |
|
123 | - * @param null $keys |
|
124 | - * @param null $format |
|
125 | - * @param null $maxDepth |
|
126 | - * @return array |
|
127 | - */ |
|
128 | - public function getValuesReadmes($keys = null, $format = null, $maxDepth = null) |
|
129 | - { |
|
130 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
131 | - $utility = new \XoopsModules\Wggithub\Utility(); |
|
132 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
133 | - $ret['id'] = $this->getVar('rm_id'); |
|
134 | - $repositoriesHandler = $helper->getHandler('Repositories'); |
|
135 | - $repositoriesObj = $repositoriesHandler->get($this->getVar('rm_repoid')); |
|
136 | - $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
121 | + /** |
|
122 | + * Get Values |
|
123 | + * @param null $keys |
|
124 | + * @param null $format |
|
125 | + * @param null $maxDepth |
|
126 | + * @return array |
|
127 | + */ |
|
128 | + public function getValuesReadmes($keys = null, $format = null, $maxDepth = null) |
|
129 | + { |
|
130 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
131 | + $utility = new \XoopsModules\Wggithub\Utility(); |
|
132 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
133 | + $ret['id'] = $this->getVar('rm_id'); |
|
134 | + $repositoriesHandler = $helper->getHandler('Repositories'); |
|
135 | + $repositoriesObj = $repositoriesHandler->get($this->getVar('rm_repoid')); |
|
136 | + $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
137 | 137 | $rmName = $this->getVar('rm_name'); |
138 | - $ret['name'] = $rmName; |
|
139 | - $ret['type'] = $this->getVar('rm_type'); |
|
140 | - $ret['content'] = $this->getVar('rm_content', 'e'); |
|
138 | + $ret['name'] = $rmName; |
|
139 | + $ret['type'] = $this->getVar('rm_type'); |
|
140 | + $ret['content'] = $this->getVar('rm_content', 'e'); |
|
141 | 141 | $contentDecoded = base64_decode($this->getVar('rm_content', 'n')); |
142 | - if ('.MD' == substr(strtoupper($rmName), -3)) { |
|
142 | + if ('.MD' == substr(strtoupper($rmName), -3)) { |
|
143 | 143 | $Parsedown = new MDParser\Parsedown(); |
144 | 144 | $contentClean = $Parsedown->text($contentDecoded); |
145 | 145 | } else { |
146 | 146 | $contentClean = $contentDecoded; |
147 | 147 | } |
148 | 148 | $ret['content_clean'] = $contentClean; |
149 | - $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
150 | - $ret['content_short'] = $utility::truncateHtml($ret['content'], $editorMaxchar); |
|
151 | - $ret['encoding'] = $this->getVar('rm_encoding'); |
|
152 | - $ret['downloadurl'] = $this->getVar('rm_downloadurl'); |
|
153 | - $ret['datecreated'] = \formatTimestamp($this->getVar('rm_datecreated'), 'm'); |
|
154 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rm_submitter')); |
|
155 | - return $ret; |
|
156 | - } |
|
149 | + $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
150 | + $ret['content_short'] = $utility::truncateHtml($ret['content'], $editorMaxchar); |
|
151 | + $ret['encoding'] = $this->getVar('rm_encoding'); |
|
152 | + $ret['downloadurl'] = $this->getVar('rm_downloadurl'); |
|
153 | + $ret['datecreated'] = \formatTimestamp($this->getVar('rm_datecreated'), 'm'); |
|
154 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rm_submitter')); |
|
155 | + return $ret; |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Returns an array representation of the object |
|
160 | - * |
|
161 | - * @return array |
|
162 | - */ |
|
163 | - public function toArrayReadmes() |
|
164 | - { |
|
165 | - $ret = []; |
|
166 | - $vars = $this->getVars(); |
|
167 | - foreach (\array_keys($vars) as $var) { |
|
168 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
169 | - } |
|
170 | - return $ret; |
|
171 | - } |
|
158 | + /** |
|
159 | + * Returns an array representation of the object |
|
160 | + * |
|
161 | + * @return array |
|
162 | + */ |
|
163 | + public function toArrayReadmes() |
|
164 | + { |
|
165 | + $ret = []; |
|
166 | + $vars = $this->getVars(); |
|
167 | + foreach (\array_keys($vars) as $var) { |
|
168 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
169 | + } |
|
170 | + return $ret; |
|
171 | + } |
|
172 | 172 | } |