@@ -45,38 +45,38 @@ |
||
45 | 45 | $GLOBALS['xoopsTpl']->assign('showItem', $rmId > 0); |
46 | 46 | |
47 | 47 | switch ($op) { |
48 | - case 'show': |
|
49 | - case 'list': |
|
50 | - default: |
|
51 | - $crReadmes = new \CriteriaCompo(); |
|
52 | - if ($rmId > 0) { |
|
53 | - $crReadmes->add(new \Criteria('rm_id', $rmId)); |
|
54 | - } |
|
55 | - $readmesCount = $readmesHandler->getCount($crReadmes); |
|
56 | - $GLOBALS['xoopsTpl']->assign('readmesCount', $readmesCount); |
|
57 | - $crReadmes->setStart($start); |
|
58 | - $crReadmes->setLimit($limit); |
|
59 | - $readmesAll = $readmesHandler->getAll($crReadmes); |
|
60 | - if ($readmesCount > 0) { |
|
61 | - $readmes = []; |
|
62 | - // Get All Readmes |
|
63 | - foreach (\array_keys($readmesAll) as $i) { |
|
64 | - $readmes[$i] = $readmesAll[$i]->getValuesReadmes(); |
|
65 | - $keywords[$i] = $readmesAll[$i]->getVar('rm_name'); |
|
66 | - } |
|
67 | - $GLOBALS['xoopsTpl']->assign('readmes', $readmes); |
|
68 | - unset($readmes); |
|
69 | - // Display Navigation |
|
70 | - if ($readmesCount > $limit) { |
|
71 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
72 | - $pagenav = new \XoopsPageNav($readmesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
73 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
74 | - } |
|
75 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
76 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
77 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
78 | - } |
|
79 | - break; |
|
48 | + case 'show': |
|
49 | + case 'list': |
|
50 | + default: |
|
51 | + $crReadmes = new \CriteriaCompo(); |
|
52 | + if ($rmId > 0) { |
|
53 | + $crReadmes->add(new \Criteria('rm_id', $rmId)); |
|
54 | + } |
|
55 | + $readmesCount = $readmesHandler->getCount($crReadmes); |
|
56 | + $GLOBALS['xoopsTpl']->assign('readmesCount', $readmesCount); |
|
57 | + $crReadmes->setStart($start); |
|
58 | + $crReadmes->setLimit($limit); |
|
59 | + $readmesAll = $readmesHandler->getAll($crReadmes); |
|
60 | + if ($readmesCount > 0) { |
|
61 | + $readmes = []; |
|
62 | + // Get All Readmes |
|
63 | + foreach (\array_keys($readmesAll) as $i) { |
|
64 | + $readmes[$i] = $readmesAll[$i]->getValuesReadmes(); |
|
65 | + $keywords[$i] = $readmesAll[$i]->getVar('rm_name'); |
|
66 | + } |
|
67 | + $GLOBALS['xoopsTpl']->assign('readmes', $readmes); |
|
68 | + unset($readmes); |
|
69 | + // Display Navigation |
|
70 | + if ($readmesCount > $limit) { |
|
71 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
72 | + $pagenav = new \XoopsPageNav($readmesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
73 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
74 | + } |
|
75 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
76 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
77 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
78 | + } |
|
79 | + break; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Breadcrumbs |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_readmes.tpl'; |
30 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
30 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
31 | 31 | |
32 | 32 | $op = Request::getCmd('op', 'list'); |
33 | 33 | $start = Request::getInt('start', 0); |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | unset($readmes); |
69 | 69 | // Display Navigation |
70 | 70 | if ($readmesCount > $limit) { |
71 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
72 | - $pagenav = new \XoopsPageNav($readmesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
71 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
72 | + $pagenav = new \XoopsPageNav($readmesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
73 | 73 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
74 | 74 | } |
75 | 75 | $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $xoBreadcrumbs[] = ['title' => _MA_WGGITHUB_READMES]; |
84 | 84 | |
85 | 85 | // Keywords |
86 | -wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
|
86 | +wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords)); |
|
87 | 87 | unset($keywords); |
88 | 88 | |
89 | 89 | // Description |
@@ -91,4 +91,4 @@ discard block |
||
91 | 91 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/readmes.php'); |
92 | 92 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
93 | 93 | |
94 | -require __DIR__ . '/footer.php'; |
|
94 | +require __DIR__.'/footer.php'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | use XoopsModules\Wggithub; |
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | |
27 | -require __DIR__ . '/header.php'; |
|
27 | +require __DIR__.'/header.php'; |
|
28 | 28 | |
29 | 29 | // Template Index |
30 | 30 | $templateMain = 'wggithub_admin_permissions.tpl'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $op = Request::getCmd('op', 'global'); |
34 | 34 | |
35 | 35 | // Get Form |
36 | -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
36 | +include_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; |
|
37 | 37 | \xoops_load('XoopsFormLoader'); |
38 | 38 | |
39 | 39 | $formTitle = \_AM_WGGITHUB_PERMISSIONS_GLOBAL; |
@@ -61,4 +61,4 @@ discard block |
||
61 | 61 | exit(); |
62 | 62 | } |
63 | 63 | |
64 | -require __DIR__ . '/footer.php'; |
|
64 | +require __DIR__.'/footer.php'; |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | Github\Releases, |
31 | 31 | }; |
32 | 32 | |
33 | -require __DIR__ . '/header.php'; |
|
33 | +require __DIR__.'/header.php'; |
|
34 | 34 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl'; |
35 | -include_once \XOOPS_ROOT_PATH . '/header.php'; |
|
35 | +include_once \XOOPS_ROOT_PATH.'/header.php'; |
|
36 | 36 | // Define Stylesheet |
37 | 37 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
38 | 38 | $keywords = []; |
@@ -165,4 +165,4 @@ discard block |
||
165 | 165 | var_dump($result); |
166 | 166 | */ |
167 | 167 | |
168 | -require __DIR__ . '/footer.php'; |
|
168 | +require __DIR__.'/footer.php'; |
@@ -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_READ = 2; |
|
52 | - public const PERM_README_UPDATE = 3; |
|
48 | + // Constants for permissions |
|
49 | + public const PERM_GLOBAL_NONE = 0; |
|
50 | + public const PERM_GLOBAL_VIEW = 1; |
|
51 | + public const PERM_GLOBAL_READ = 2; |
|
52 | + public const PERM_README_UPDATE = 3; |
|
53 | 53 | |
54 | 54 | } |
@@ -35,96 +35,96 @@ |
||
35 | 35 | */ |
36 | 36 | class ReadmesHandler extends \XoopsPersistableObjectHandler |
37 | 37 | { |
38 | - /** |
|
39 | - * Constructor |
|
40 | - * |
|
41 | - * @param \XoopsDatabase $db |
|
42 | - */ |
|
43 | - public function __construct(\XoopsDatabase $db) |
|
44 | - { |
|
45 | - parent::__construct($db, 'wggithub_readmes', Readmes::class, 'rm_id', 'rm_name'); |
|
46 | - } |
|
38 | + /** |
|
39 | + * Constructor |
|
40 | + * |
|
41 | + * @param \XoopsDatabase $db |
|
42 | + */ |
|
43 | + public function __construct(\XoopsDatabase $db) |
|
44 | + { |
|
45 | + parent::__construct($db, 'wggithub_readmes', Readmes::class, 'rm_id', 'rm_name'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param bool $isNew |
|
50 | - * |
|
51 | - * @return object |
|
52 | - */ |
|
53 | - public function create($isNew = true) |
|
54 | - { |
|
55 | - return parent::create($isNew); |
|
56 | - } |
|
48 | + /** |
|
49 | + * @param bool $isNew |
|
50 | + * |
|
51 | + * @return object |
|
52 | + */ |
|
53 | + public function create($isNew = true) |
|
54 | + { |
|
55 | + return parent::create($isNew); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * retrieve a field |
|
60 | - * |
|
61 | - * @param int $i field id |
|
62 | - * @param null fields |
|
63 | - * @return mixed reference to the {@link Get} object |
|
64 | - */ |
|
65 | - public function get($i = null, $fields = null) |
|
66 | - { |
|
67 | - return parent::get($i, $fields); |
|
68 | - } |
|
58 | + /** |
|
59 | + * retrieve a field |
|
60 | + * |
|
61 | + * @param int $i field id |
|
62 | + * @param null fields |
|
63 | + * @return mixed reference to the {@link Get} object |
|
64 | + */ |
|
65 | + public function get($i = null, $fields = null) |
|
66 | + { |
|
67 | + return parent::get($i, $fields); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * get inserted id |
|
72 | - * |
|
73 | - * @param null |
|
74 | - * @return int reference to the {@link Get} object |
|
75 | - */ |
|
76 | - public function getInsertId() |
|
77 | - { |
|
78 | - return $this->db->getInsertId(); |
|
79 | - } |
|
70 | + /** |
|
71 | + * get inserted id |
|
72 | + * |
|
73 | + * @param null |
|
74 | + * @return int reference to the {@link Get} object |
|
75 | + */ |
|
76 | + public function getInsertId() |
|
77 | + { |
|
78 | + return $this->db->getInsertId(); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Get Count Readmes in the database |
|
83 | - * @param int $start |
|
84 | - * @param int $limit |
|
85 | - * @param string $sort |
|
86 | - * @param string $order |
|
87 | - * @return int |
|
88 | - */ |
|
89 | - public function getCountReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
90 | - { |
|
91 | - $crCountReadmes = new \CriteriaCompo(); |
|
92 | - $crCountReadmes = $this->getReadmesCriteria($crCountReadmes, $start, $limit, $sort, $order); |
|
93 | - return $this->getCount($crCountReadmes); |
|
94 | - } |
|
81 | + /** |
|
82 | + * Get Count Readmes in the database |
|
83 | + * @param int $start |
|
84 | + * @param int $limit |
|
85 | + * @param string $sort |
|
86 | + * @param string $order |
|
87 | + * @return int |
|
88 | + */ |
|
89 | + public function getCountReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
90 | + { |
|
91 | + $crCountReadmes = new \CriteriaCompo(); |
|
92 | + $crCountReadmes = $this->getReadmesCriteria($crCountReadmes, $start, $limit, $sort, $order); |
|
93 | + return $this->getCount($crCountReadmes); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Get All Readmes in the database |
|
98 | - * @param int $start |
|
99 | - * @param int $limit |
|
100 | - * @param string $sort |
|
101 | - * @param string $order |
|
102 | - * @return array |
|
103 | - */ |
|
104 | - public function getAllReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
105 | - { |
|
106 | - $crAllReadmes = new \CriteriaCompo(); |
|
107 | - $crAllReadmes = $this->getReadmesCriteria($crAllReadmes, $start, $limit, $sort, $order); |
|
108 | - return $this->getAll($crAllReadmes); |
|
109 | - } |
|
96 | + /** |
|
97 | + * Get All Readmes in the database |
|
98 | + * @param int $start |
|
99 | + * @param int $limit |
|
100 | + * @param string $sort |
|
101 | + * @param string $order |
|
102 | + * @return array |
|
103 | + */ |
|
104 | + public function getAllReadmes($start = 0, $limit = 0, $sort = 'rm_id ASC, rm_name', $order = 'ASC') |
|
105 | + { |
|
106 | + $crAllReadmes = new \CriteriaCompo(); |
|
107 | + $crAllReadmes = $this->getReadmesCriteria($crAllReadmes, $start, $limit, $sort, $order); |
|
108 | + return $this->getAll($crAllReadmes); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Get Criteria Readmes |
|
113 | - * @param $crReadmes |
|
114 | - * @param int $start |
|
115 | - * @param int $limit |
|
116 | - * @param string $sort |
|
117 | - * @param string $order |
|
118 | - * @return int |
|
119 | - */ |
|
120 | - private function getReadmesCriteria($crReadmes, $start, $limit, $sort, $order) |
|
121 | - { |
|
122 | - $crReadmes->setStart($start); |
|
123 | - $crReadmes->setLimit($limit); |
|
124 | - $crReadmes->setSort($sort); |
|
125 | - $crReadmes->setOrder($order); |
|
126 | - return $crReadmes; |
|
127 | - } |
|
111 | + /** |
|
112 | + * Get Criteria Readmes |
|
113 | + * @param $crReadmes |
|
114 | + * @param int $start |
|
115 | + * @param int $limit |
|
116 | + * @param string $sort |
|
117 | + * @param string $order |
|
118 | + * @return int |
|
119 | + */ |
|
120 | + private function getReadmesCriteria($crReadmes, $start, $limit, $sort, $order) |
|
121 | + { |
|
122 | + $crReadmes->setStart($start); |
|
123 | + $crReadmes->setLimit($limit); |
|
124 | + $crReadmes->setSort($sort); |
|
125 | + $crReadmes->setOrder($order); |
|
126 | + return $crReadmes; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Update table requests |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $readmesObj->setVar('rm_content', $readme['content']); |
171 | 171 | $readmesObj->setVar('rm_encoding', $readme['encoding']); |
172 | 172 | $readmesObj->setVar('rm_downloadurl', $readme['download_url']); |
173 | - $readmesObj->setVar('rm_datecreated',time()); |
|
173 | + $readmesObj->setVar('rm_datecreated', time()); |
|
174 | 174 | $readmesObj->setVar('rm_submitter', $submitter); |
175 | 175 | // Insert Data |
176 | 176 | if (!$readmesHandler->insert($readmesObj)) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $readmesObj->setVar('rm_content', $readme['content']); |
241 | 241 | $readmesObj->setVar('rm_encoding', $readme['encoding']); |
242 | 242 | $readmesObj->setVar('rm_downloadurl', $readme['download_url']); |
243 | - $readmesObj->setVar('rm_datecreated',time()); |
|
243 | + $readmesObj->setVar('rm_datecreated', time()); |
|
244 | 244 | $readmesObj->setVar('rm_submitter', $submitter); |
245 | 245 | // Insert Data |
246 | 246 | if (!$readmesHandler->insert($readmesObj)) { |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | public function updateRepoReadme() |
279 | 279 | { |
280 | 280 | // update repo_readme |
281 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_readmes'); |
|
282 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_readmes') . '.rm_repoid '; |
|
283 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_readme = 1 '; |
|
284 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_readmes') . '.rm_id)>0));'; |
|
281 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_readmes'); |
|
282 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_readmes').'.rm_repoid '; |
|
283 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_readme = 1 '; |
|
284 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_readmes').'.rm_id)>0));'; |
|
285 | 285 | $GLOBALS['xoopsDB']->queryF($sql); |
286 | 286 | |
287 | 287 | return true; |
@@ -33,110 +33,110 @@ |
||
33 | 33 | */ |
34 | 34 | class PermissionsHandler extends \XoopsPersistableObjectHandler |
35 | 35 | { |
36 | - /** |
|
37 | - * Constructor |
|
38 | - * |
|
39 | - * @param null |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - } |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + * |
|
39 | + * @param null |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @public function getPermGlobalRead |
|
47 | - * returns global right for reading from github |
|
48 | - * |
|
49 | - * @param null |
|
50 | - * @return bool |
|
51 | - */ |
|
52 | - public function getPermGlobalRead() |
|
53 | - { |
|
54 | - global $xoopsUser, $xoopsModule; |
|
55 | - $currentuid = 0; |
|
56 | - if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
57 | - if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
58 | - return true; |
|
59 | - } |
|
60 | - $currentuid = $xoopsUser->uid(); |
|
61 | - } |
|
62 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
63 | - $mid = $xoopsModule->mid(); |
|
64 | - $memberHandler = \xoops_getHandler('member'); |
|
65 | - if (0 == $currentuid) { |
|
66 | - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
67 | - } else { |
|
68 | - $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
69 | - } |
|
70 | - if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_GLOBAL_READ, $my_group_ids, $mid)) { |
|
71 | - return true; |
|
72 | - } |
|
73 | - return false; |
|
74 | - } |
|
45 | + /** |
|
46 | + * @public function getPermGlobalRead |
|
47 | + * returns global right for reading from github |
|
48 | + * |
|
49 | + * @param null |
|
50 | + * @return bool |
|
51 | + */ |
|
52 | + public function getPermGlobalRead() |
|
53 | + { |
|
54 | + global $xoopsUser, $xoopsModule; |
|
55 | + $currentuid = 0; |
|
56 | + if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
57 | + if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
58 | + return true; |
|
59 | + } |
|
60 | + $currentuid = $xoopsUser->uid(); |
|
61 | + } |
|
62 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
63 | + $mid = $xoopsModule->mid(); |
|
64 | + $memberHandler = \xoops_getHandler('member'); |
|
65 | + if (0 == $currentuid) { |
|
66 | + $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
67 | + } else { |
|
68 | + $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
69 | + } |
|
70 | + if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_GLOBAL_READ, $my_group_ids, $mid)) { |
|
71 | + return true; |
|
72 | + } |
|
73 | + return false; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @public function permGlobalSubmit |
|
78 | - * returns right for global view |
|
79 | - * |
|
80 | - * @param null |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function getPermGlobalView() |
|
84 | - { |
|
85 | - global $xoopsUser, $xoopsModule; |
|
76 | + /** |
|
77 | + * @public function permGlobalSubmit |
|
78 | + * returns right for global view |
|
79 | + * |
|
80 | + * @param null |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function getPermGlobalView() |
|
84 | + { |
|
85 | + global $xoopsUser, $xoopsModule; |
|
86 | 86 | |
87 | 87 | if ($this->getPermGlobalRead()) { |
88 | 88 | return true; |
89 | 89 | } |
90 | 90 | |
91 | - $currentuid = 0; |
|
92 | - if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
93 | - if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
94 | - return true; |
|
95 | - } |
|
96 | - $currentuid = $xoopsUser->uid(); |
|
97 | - } |
|
98 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
99 | - $mid = $xoopsModule->mid(); |
|
100 | - $memberHandler = \xoops_getHandler('member'); |
|
101 | - if (0 == $currentuid) { |
|
102 | - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
103 | - } else { |
|
104 | - $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
105 | - } |
|
106 | - if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_GLOBAL_VIEW, $my_group_ids, $mid)) { |
|
107 | - return true; |
|
108 | - } |
|
109 | - return false; |
|
110 | - } |
|
91 | + $currentuid = 0; |
|
92 | + if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
93 | + if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
94 | + return true; |
|
95 | + } |
|
96 | + $currentuid = $xoopsUser->uid(); |
|
97 | + } |
|
98 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
99 | + $mid = $xoopsModule->mid(); |
|
100 | + $memberHandler = \xoops_getHandler('member'); |
|
101 | + if (0 == $currentuid) { |
|
102 | + $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
103 | + } else { |
|
104 | + $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
105 | + } |
|
106 | + if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_GLOBAL_VIEW, $my_group_ids, $mid)) { |
|
107 | + return true; |
|
108 | + } |
|
109 | + return false; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * @public function getPermReadmeUpdate |
|
114 | - * returns right for updating existing readme |
|
115 | - * |
|
116 | - * @param null |
|
117 | - * @return bool |
|
118 | - */ |
|
119 | - public function getPermReadmeUpdate() |
|
120 | - { |
|
121 | - global $xoopsUser, $xoopsModule; |
|
122 | - $currentuid = 0; |
|
123 | - if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
124 | - if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
125 | - return true; |
|
126 | - } |
|
127 | - $currentuid = $xoopsUser->uid(); |
|
128 | - } |
|
129 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
130 | - $mid = $xoopsModule->mid(); |
|
131 | - $memberHandler = \xoops_getHandler('member'); |
|
132 | - if (0 == $currentuid) { |
|
133 | - $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
134 | - } else { |
|
135 | - $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
136 | - } |
|
137 | - if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_README_UPDATE, $my_group_ids, $mid)) { |
|
138 | - return true; |
|
139 | - } |
|
140 | - return false; |
|
141 | - } |
|
112 | + /** |
|
113 | + * @public function getPermReadmeUpdate |
|
114 | + * returns right for updating existing readme |
|
115 | + * |
|
116 | + * @param null |
|
117 | + * @return bool |
|
118 | + */ |
|
119 | + public function getPermReadmeUpdate() |
|
120 | + { |
|
121 | + global $xoopsUser, $xoopsModule; |
|
122 | + $currentuid = 0; |
|
123 | + if (isset($xoopsUser) && \is_object($xoopsUser)) { |
|
124 | + if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
|
125 | + return true; |
|
126 | + } |
|
127 | + $currentuid = $xoopsUser->uid(); |
|
128 | + } |
|
129 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
130 | + $mid = $xoopsModule->mid(); |
|
131 | + $memberHandler = \xoops_getHandler('member'); |
|
132 | + if (0 == $currentuid) { |
|
133 | + $my_group_ids = [XOOPS_GROUP_ANONYMOUS]; |
|
134 | + } else { |
|
135 | + $my_group_ids = $memberHandler->getGroupsByUser($currentuid); |
|
136 | + } |
|
137 | + if ($grouppermHandler->checkRight('wggithub_ac', Constants::PERM_README_UPDATE, $my_group_ids, $mid)) { |
|
138 | + return true; |
|
139 | + } |
|
140 | + return false; |
|
141 | + } |
|
142 | 142 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | Utility |
25 | 25 | }; |
26 | 26 | |
27 | -require_once dirname(__DIR__, 3) . '/include/cp_header.php'; |
|
28 | -require \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
27 | +require_once dirname(__DIR__, 3).'/include/cp_header.php'; |
|
28 | +require \dirname(__DIR__).'/preloads/autoloader.php'; |
|
29 | 29 | |
30 | 30 | $op = \Xmf\Request::getCmd('op', ''); |
31 | 31 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | loadSampleData(); |
46 | 46 | } else { |
47 | 47 | xoops_cp_header(); |
48 | - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
48 | + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA_OK')), \constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM'), true); |
|
49 | 49 | xoops_cp_footer(); |
50 | 50 | } |
51 | 51 | break; |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
69 | 69 | |
70 | 70 | $language = 'english/'; |
71 | - if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { |
|
72 | - $language = $xoopsConfig['language'] . '/'; |
|
71 | + if (\is_dir(__DIR__.'/'.$xoopsConfig['language'])) { |
|
72 | + $language = $xoopsConfig['language'].'/'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // load module tables |
76 | 76 | foreach ($tables as $table) { |
77 | - $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
77 | + $tabledata = Yaml::readWrapped($language.$table.'.yml'); |
|
78 | 78 | TableLoad::truncateTable($table); |
79 | 79 | TableLoad::loadTableFromArray($table, $tabledata); |
80 | 80 | } |
81 | 81 | |
82 | 82 | // load permissions |
83 | 83 | $table = 'group_permission'; |
84 | - $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
84 | + $tabledata = Yaml::readWrapped($language.$table.'.yml'); |
|
85 | 85 | $mid = Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); |
86 | 86 | loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); |
87 | 87 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $utility::rcopy($src, $dest); |
95 | 95 | } |
96 | 96 | } |
97 | - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); |
|
97 | + \redirect_header('../admin/index.php', 1, \constant('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS')); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function saveSampleData() |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | |
109 | 109 | $tables = Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
110 | 110 | |
111 | - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; |
|
112 | - if (!\file_exists($languageFolder . '/')) { |
|
113 | - Utility::createFolder($languageFolder . '/'); |
|
111 | + $languageFolder = __DIR__.'/'.$xoopsConfig['language']; |
|
112 | + if (!\file_exists($languageFolder.'/')) { |
|
113 | + Utility::createFolder($languageFolder.'/'); |
|
114 | 114 | } |
115 | - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; |
|
115 | + $exportFolder = $languageFolder.'/Exports-'.date('Y-m-d-H-i-s').'/'; |
|
116 | 116 | Utility::createFolder($exportFolder); |
117 | 117 | |
118 | 118 | // save module tables |
119 | 119 | foreach ($tables as $table) { |
120 | - TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); |
|
120 | + TableLoad::saveTableToYamlFile($table, $exportFolder.$table.'.yml'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // save permissions |
124 | 124 | $criteria = new \CriteriaCompo(); |
125 | 125 | $criteria->add(new \Criteria('gperm_modid', Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); |
126 | 126 | $skipColumns[] = 'gperm_id'; |
127 | - TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); |
|
127 | + TableLoad::saveTableToYamlFile('group_permission', $exportFolder.'group_permission.yml', $criteria, $skipColumns); |
|
128 | 128 | unset($criteria); |
129 | 129 | |
130 | 130 | // --- COPY test folder files --------------- |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | Utility::rcopy($src, $dest); |
136 | 136 | } |
137 | 137 | } |
138 | - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); |
|
138 | + \redirect_header('../admin/index.php', 1, \constant('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA_SUCCESS')); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | function exportSchema() |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // |
151 | 151 | // \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); |
152 | 152 | } catch (\Exception $e) { |
153 | - exit(\constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); |
|
153 | + exit(\constant('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_ERROR')); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | } |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
174 | 174 | $prefixedTable = $db->prefix($table); |
175 | 175 | $count = 0; |
176 | - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); |
|
176 | + $sql = 'DELETE FROM '.$prefixedTable.' WHERE `'.$search.'`='.$db->quote($replace); |
|
177 | 177 | $db->queryF($sql); |
178 | 178 | foreach ($data as $row) { |
179 | - $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; |
|
179 | + $insertInto = 'INSERT INTO '.$prefixedTable.' ('; |
|
180 | 180 | $valueClause = ' VALUES ('; |
181 | 181 | $first = true; |
182 | 182 | foreach ($row as $column => $value) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $valueClause .= $db->quote($value); |
194 | 194 | } |
195 | 195 | } |
196 | - $sql = $insertInto . ') ' . $valueClause . ')'; |
|
196 | + $sql = $insertInto.') '.$valueClause.')'; |
|
197 | 197 | $result = $db->queryF($sql); |
198 | 198 | if (false !== $result) { |
199 | 199 | ++$count; |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | Github\Releases |
31 | 31 | }; |
32 | 32 | |
33 | -require __DIR__ . '/header.php'; |
|
33 | +require __DIR__.'/header.php'; |
|
34 | 34 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl'; |
35 | -include_once \XOOPS_ROOT_PATH . '/header.php'; |
|
35 | +include_once \XOOPS_ROOT_PATH.'/header.php'; |
|
36 | 36 | |
37 | 37 | // Permissions |
38 | 38 | $permGlobalView = $permissionsHandler->getPermGlobalView(); |
39 | 39 | if (!$permGlobalView) { |
40 | 40 | $GLOBALS['xoopsTpl']->assign('error', _NOPERM); |
41 | - require __DIR__ . '/footer.php'; |
|
41 | + require __DIR__.'/footer.php'; |
|
42 | 42 | } |
43 | 43 | $permGlobalRead = $permissionsHandler->getPermGlobalRead(); |
44 | 44 | $permReadmeUpdate = $permissionsHandler->getPermReadmeUpdate(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | // Define Stylesheet |
54 | 54 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
55 | -$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL . '/assets/css/tabs.css', null); |
|
55 | +$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL.'/assets/css/tabs.css', null); |
|
56 | 56 | $keywords = []; |
57 | 57 | // |
58 | 58 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | foreach (\array_keys($directoriesAll) as $i) { |
121 | 121 | $directories[$i] = $directoriesAll[$i]->getValuesDirectories(); |
122 | 122 | $dirName = $directoriesAll[$i]->getVar('dir_name'); |
123 | - $dirFilterRelease = (bool)$directoriesAll[$i]->getVar('dir_filterrelease'); |
|
123 | + $dirFilterRelease = (bool) $directoriesAll[$i]->getVar('dir_filterrelease'); |
|
124 | 124 | $repos = []; |
125 | 125 | $crRepositories = new \CriteriaCompo(); |
126 | 126 | $crRepositories->add(new \Criteria('repo_user', $dirName)); |
127 | 127 | $repositoriesCountTotal = $repositoriesHandler->getCount($crRepositories); |
128 | 128 | if ('any' === $filterRelease && $dirFilterRelease) { |
129 | - $crRepositories->add(new \Criteria('repo_prerelease', 1) ); |
|
129 | + $crRepositories->add(new \Criteria('repo_prerelease', 1)); |
|
130 | 130 | $crRepositories->add(new \Criteria('repo_release', 1), 'OR'); |
131 | 131 | } |
132 | 132 | if ('final' === $filterRelease && $dirFilterRelease) { |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | } |
182 | 182 | $directories[$i]['repos'] = $repos; |
183 | 183 | $directories[$i]['previousRepos'] = $start > 0; |
184 | - $directories[$i]['previousOp'] = '&start=' . ($start - $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby; |
|
184 | + $directories[$i]['previousOp'] = '&start='.($start - $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby; |
|
185 | 185 | $directories[$i]['nextRepos'] = ($repositoriesCount - $start) > $limit; |
186 | - $directories[$i]['nextOp'] = '&start=' . ($start + $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby; |
|
186 | + $directories[$i]['nextOp'] = '&start='.($start + $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby; |
|
187 | 187 | $GLOBALS['xoopsTpl']->assign('start', $start); |
188 | 188 | $GLOBALS['xoopsTpl']->assign('limit', $limit); |
189 | 189 | $GLOBALS['xoopsTpl']->assign('menu', $menu); |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | unset($crDirectories, $directories); |
195 | 195 | // Display Navigation |
196 | 196 | if ($directoriesCount > $limit) { |
197 | - include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
198 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
197 | + include_once \XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
198 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
199 | 199 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
200 | 200 | } |
201 | 201 | $GLOBALS['xoopsTpl']->assign('lang_thereare', \sprintf(\_MA_WGGITHUB_INDEX_THEREARE, $directoriesCount)); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Permissions |
209 | 209 | if (!$permGlobalRead) { |
210 | 210 | $GLOBALS['xoopsTpl']->assign('error', _NOPERM); |
211 | - require __DIR__ . '/footer.php'; |
|
211 | + require __DIR__.'/footer.php'; |
|
212 | 212 | } |
213 | 213 | executeUpdate(); |
214 | 214 | break; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // Permissions |
217 | 217 | if (!$permReadmeUpdate) { |
218 | 218 | $GLOBALS['xoopsTpl']->assign('error', _NOPERM); |
219 | - require __DIR__ . '/footer.php'; |
|
219 | + require __DIR__.'/footer.php'; |
|
220 | 220 | } |
221 | 221 | $repoId = Request::getInt('repo_id', 0); |
222 | 222 | $repoUser = Request::getString('repo_user', 'none'); |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | // Breadcrumbs |
230 | 230 | $xoBreadcrumbs[] = ['title' => \_MA_WGGITHUB_INDEX]; |
231 | 231 | // Keywords |
232 | -wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
|
232 | +wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords)); |
|
233 | 233 | unset($keywords); |
234 | 234 | // Description |
235 | 235 | wggithubMetaDescription(\_MA_WGGITHUB_INDEX_DESC); |
236 | 236 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/index.php'); |
237 | 237 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
238 | 238 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
239 | -require __DIR__ . '/footer.php'; |
|
239 | +require __DIR__.'/footer.php'; |
|
240 | 240 | |
241 | 241 | |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return bool |
247 | 247 | */ |
248 | -function executeUpdate(){ |
|
248 | +function executeUpdate() { |
|
249 | 249 | |
250 | 250 | $github = Github::getInstance(); |
251 | 251 | $helper = Helper::getInstance(); |
@@ -31,96 +31,96 @@ |
||
31 | 31 | */ |
32 | 32 | class SettingsHandler 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_settings', Settings::class, 'set_id', 'set_token'); |
|
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 Settings 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 getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountSettings = new \CriteriaCompo(); |
|
88 | - $crCountSettings = $this->getSettingsCriteria($crCountSettings, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountSettings); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Get All Settings 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 getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllSettings = new \CriteriaCompo(); |
|
103 | - $crAllSettings = $this->getSettingsCriteria($crAllSettings, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllSettings); |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Get Criteria Settings |
|
109 | - * @param $crSettings |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getSettingsCriteria($crSettings, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crSettings->setStart($start); |
|
119 | - $crSettings->setLimit($limit); |
|
120 | - $crSettings->setSort($sort); |
|
121 | - $crSettings->setOrder($order); |
|
122 | - return $crSettings; |
|
123 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_settings', Settings::class, 'set_id', 'set_token'); |
|
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 Settings 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 getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountSettings = new \CriteriaCompo(); |
|
88 | + $crCountSettings = $this->getSettingsCriteria($crCountSettings, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountSettings); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Get All Settings 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 getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllSettings = new \CriteriaCompo(); |
|
103 | + $crAllSettings = $this->getSettingsCriteria($crAllSettings, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllSettings); |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Get Criteria Settings |
|
109 | + * @param $crSettings |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getSettingsCriteria($crSettings, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crSettings->setStart($start); |
|
119 | + $crSettings->setLimit($limit); |
|
120 | + $crSettings->setSort($sort); |
|
121 | + $crSettings->setOrder($order); |
|
122 | + return $crSettings; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Get Primary Setting |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function setPrimarySetting($setId) |
150 | 150 | { |
151 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
151 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
152 | 152 | $settingsObj = null; |
153 | 153 | $settingsHandler = $helper->getHandler('Settings'); |
154 | 154 | if (isset($setId)) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // reset all |
161 | - $strSQL = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_settings') . ' SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_settings') . '.set_primary = 0'; |
|
161 | + $strSQL = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_settings').' SET '.$GLOBALS['xoopsDB']->prefix('wggithub_settings').'.set_primary = 0'; |
|
162 | 162 | $GLOBALS['xoopsDB']->queryF($strSQL); |
163 | 163 | // Set Vars |
164 | 164 | $settingsObj->setVar('set_primary', 1); |