@@ -33,74 +33,74 @@ 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()); |
|
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 | 88 | |
89 | - // Title |
|
90 | - $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_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 Text dirName |
|
96 | - $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
97 | - // Directories Handler |
|
98 | - $directoriesHandler = $helper->getHandler('Directories'); |
|
99 | - // Form Select dirType |
|
100 | - $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
101 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
102 | - $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
103 | - $form->addElement($dirTypeSelect, true); |
|
89 | + // Title |
|
90 | + $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_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 Text dirName |
|
96 | + $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
|
97 | + // Directories Handler |
|
98 | + $directoriesHandler = $helper->getHandler('Directories'); |
|
99 | + // Form Select dirType |
|
100 | + $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
|
101 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
|
102 | + $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
|
103 | + $form->addElement($dirTypeSelect, true); |
|
104 | 104 | // Form Radio Yes/No dirAutoupdate |
105 | 105 | $dirAutoupdate = $this->isNew() ?: $this->getVar('dir_autoupdate'); |
106 | 106 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_AUTOUPDATE, 'dir_autoupdate', $dirAutoupdate)); |
@@ -110,51 +110,51 @@ discard block |
||
110 | 110 | // Form Radio Yes/No dirFilterrelease |
111 | 111 | $dirFilterrelease = $this->isNew() ?: $this->getVar('dir_filterrelease'); |
112 | 112 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_FILTERRELEASE, 'dir_filterrelease', $dirFilterrelease)); |
113 | - // Form Text Date Select dirDatecreated |
|
114 | - $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
115 | - $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
116 | - // Form Select User dirSubmitter |
|
117 | - $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
118 | - // To Save |
|
119 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
120 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
121 | - return $form; |
|
122 | - } |
|
113 | + // Form Text Date Select dirDatecreated |
|
114 | + $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
|
115 | + $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
|
116 | + // Form Select User dirSubmitter |
|
117 | + $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
|
118 | + // To Save |
|
119 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
120 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
121 | + return $form; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * Get Values |
|
126 | - * @param null $keys |
|
127 | - * @param null $format |
|
128 | - * @param null $maxDepth |
|
129 | - * @return array |
|
130 | - */ |
|
131 | - public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
132 | - { |
|
133 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
134 | - $ret['id'] = $this->getVar('dir_id'); |
|
135 | - $ret['name'] = $this->getVar('dir_name'); |
|
136 | - $ret['type'] = $this->getVar('dir_type'); |
|
124 | + /** |
|
125 | + * Get Values |
|
126 | + * @param null $keys |
|
127 | + * @param null $format |
|
128 | + * @param null $maxDepth |
|
129 | + * @return array |
|
130 | + */ |
|
131 | + public function getValuesDirectories($keys = null, $format = null, $maxDepth = null) |
|
132 | + { |
|
133 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
134 | + $ret['id'] = $this->getVar('dir_id'); |
|
135 | + $ret['name'] = $this->getVar('dir_name'); |
|
136 | + $ret['type'] = $this->getVar('dir_type'); |
|
137 | 137 | $ret['type_text'] = Constants::DIRECTORY_TYPE_USER == $this->getVar('dir_type') ? \_AM_WGGITHUB_DIRECTORY_TYPE_USER : \_AM_WGGITHUB_DIRECTORY_TYPE_ORG; |
138 | 138 | $ret['autoupdate'] = (int)$this->getVar('dir_autoupdate') > 0 ? _YES : _NO; |
139 | 139 | $ret['online'] = (int)$this->getVar('dir_online') > 0 ? _YES : _NO; |
140 | 140 | $ret['filterrelease'] = (int)$this->getVar('dir_filterrelease') > 0 ? _YES : _NO; |
141 | - $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
142 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
143 | - return $ret; |
|
144 | - } |
|
141 | + $ret['datecreated'] = \formatTimestamp($this->getVar('dir_datecreated'), 's'); |
|
142 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('dir_submitter')); |
|
143 | + return $ret; |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Returns an array representation of the object |
|
148 | - * |
|
149 | - * @return array |
|
150 | - */ |
|
151 | - public function toArrayDirectories() |
|
152 | - { |
|
153 | - $ret = []; |
|
154 | - $vars = $this->getVars(); |
|
155 | - foreach (\array_keys($vars) as $var) { |
|
156 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
157 | - } |
|
158 | - return $ret; |
|
159 | - } |
|
146 | + /** |
|
147 | + * Returns an array representation of the object |
|
148 | + * |
|
149 | + * @return array |
|
150 | + */ |
|
151 | + public function toArrayDirectories() |
|
152 | + { |
|
153 | + $ret = []; |
|
154 | + $vars = $this->getVars(); |
|
155 | + foreach (\array_keys($vars) as $var) { |
|
156 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
157 | + } |
|
158 | + return $ret; |
|
159 | + } |
|
160 | 160 | } |
@@ -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 |
@@ -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 | } |