Skip to content

Commit dbde9bf

Browse files
committed
added function qualifiers
1 parent 3d7fbaf commit dbde9bf

129 files changed

Lines changed: 25055 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/broken.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* wgGitHub module for xoops
14+
*
15+
* @copyright 2020 XOOPS Project (https://xooops.org)
16+
* @license GPL 2.0 or later
17+
* @package wggithub
18+
* @since 1.0
19+
* @min_xoops 2.5.10
20+
* @author TDM XOOPS - Email:<goffy@wedega.com> - Website:<https://wedega.com>
21+
*/
22+
23+
use Xmf\Request;
24+
use XoopsModules\Wggithub;
25+
use XoopsModules\Wggithub\Constants;
26+
27+
require __DIR__ . '/header.php';
28+
29+
// Define Stylesheet
30+
$GLOBALS['xoTheme']->addStylesheet($style, null);
31+
$templateMain = 'wggithub_admin_broken.tpl';
32+
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('broken.php'));
33+
34+
// Check table repositories
35+
$start = Request::getInt('startRepositories', 0);
36+
$limit = Request::getInt('limitRepositories', $helper->getConfig('adminpager'));
37+
$crRepositories = new \CriteriaCompo();
38+
$crRepositories->add(new \Criteria('repo_status', Constants::STATUS_BROKEN));
39+
$repositoriesCount = $repositoriesHandler->getCount($crRepositories);
40+
$GLOBALS['xoopsTpl']->assign('repositories_count', $repositoriesCount);
41+
$GLOBALS['xoopsTpl']->assign('repositories_result', \sprintf(\_AM_WGGITHUB_BROKEN_RESULT, 'Repositories'));
42+
$crRepositories->setStart($start);
43+
$crRepositories->setLimit($limit);
44+
if ($repositoriesCount > 0) {
45+
$repositoriesAll = $repositoriesHandler->getAll($crRepositories);
46+
foreach (\array_keys($repositoriesAll) as $i) {
47+
$repository['table'] = 'Repositories';
48+
$repository['key'] = 'repo_id';
49+
$repository['keyval'] = $repositoriesAll[$i]->getVar('repo_id');
50+
$repository['main'] = $repositoriesAll[$i]->getVar('repo_name');
51+
$GLOBALS['xoopsTpl']->append('repositories_list', $repository);
52+
}
53+
// Display Navigation
54+
if ($repositoriesCount > $limit) {
55+
include_once \XOOPS_ROOT_PATH . '/class/pagenav.php';
56+
$pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'startRepositories', 'op=list&limitRepositories=' . $limit);
57+
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
58+
}
59+
} else {
60+
$GLOBALS['xoopsTpl']->assign('nodataRepositories', \sprintf(\_AM_WGGITHUB_BROKEN_NODATA, 'Repositories'));
61+
}
62+
unset($crRepositories);
63+
64+
require __DIR__ . '/footer.php';

admin/directories.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
default:
4242
// Define Stylesheet
4343
$GLOBALS['xoTheme']->addStylesheet($style, null);
44-
$GLOBALS['xoTheme']->addScript(WGGITHUB_URL . '/assets/js/jquery-ui.js');
45-
$GLOBALS['xoTheme']->addScript(WGGITHUB_URL . '/assets/js/sortable.js');
44+
$GLOBALS['xoTheme']->addScript(\WGGITHUB_URL . '/assets/js/jquery-ui.js');
45+
$GLOBALS['xoTheme']->addScript(\WGGITHUB_URL . '/assets/js/sortable.js');
4646
$templateMain = 'wggithub_admin_directories.tpl';
4747
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php'));
4848
$adminObject->addItemButton(\_AM_WGGITHUB_ADD_DIRECTORY, 'directories.php?op=new', 'add');
4949
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
5050
$directoriesCount = $directoriesHandler->getCountDirectories();
5151
$directoriesAll = $directoriesHandler->getAllDirectories($start, $limit);
5252
$GLOBALS['xoopsTpl']->assign('directories_count', $directoriesCount);
53-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
54-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
55-
$GLOBALS['xoopsTpl']->assign('wggithub_icons_url_16', WGGITHUB_ICONS_URL . '/16');
53+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
54+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
55+
$GLOBALS['xoopsTpl']->assign('wggithub_icons_url_16', \WGGITHUB_ICONS_URL . '/16');
5656
// Table view directories
5757
if ($directoriesCount > 0) {
5858
foreach (\array_keys($directoriesAll) as $i) {
@@ -133,7 +133,7 @@
133133
$errors = [];
134134
//delete all related data
135135
$crRepositories = new \CriteriaCompo();
136-
$crRepositories->add(new Criteria('repo_user', $dirName));
136+
$crRepositories->add(new \Criteria('repo_user', $dirName));
137137
$repositoriesAll = $repositoriesHandler->getAll($crRepositories);
138138
foreach (\array_keys($repositoriesAll) as $i) {
139139
$repoId = $repositoriesAll[$i]->getVar('repo_id');

admin/header.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
$sysPathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons16');
2727
$sysPathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons32');
2828
$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin');
29-
$modPathIcon16 = WGGITHUB_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons16') . '/';
30-
$modPathIcon32 = WGGITHUB_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons32') . '/';
29+
$modPathIcon16 = \WGGITHUB_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons16') . '/';
30+
$modPathIcon32 = \WGGITHUB_URL . '/' . $GLOBALS['xoopsModule']->getInfo('modicons32') . '/';
3131

3232
// Get instance of module
3333
$helper = \XoopsModules\Wggithub\Helper::getInstance();
@@ -64,4 +64,4 @@
6464
$GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32);
6565

6666
$adminObject = \Xmf\Module\Admin::getInstance();
67-
$style = WGGITHUB_URL . '/assets/css/admin/style.css';
67+
$style = \WGGITHUB_URL . '/assets/css/admin/style.css';

admin/logs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
$logsCount = $logsHandler->getCountLogs();
4747
$logsAll = $logsHandler->getAllLogs($start, $limit);
4848
$GLOBALS['xoopsTpl']->assign('logs_count', $logsCount);
49-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
50-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
49+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
50+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
5151
// Table view logs
5252
if ($logsCount > 0) {
5353
foreach (\array_keys($logsAll) as $i) {

admin/menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
$dirname = \basename(\dirname(__DIR__));
2424
$moduleHandler = \xoops_getHandler('module');
25-
$xoopsModule = XoopsModule::getByDirname($dirname);
25+
$xoopsModule = \XoopsModule::getByDirname($dirname);
2626
$moduleInfo = $moduleHandler->get($xoopsModule->getVar('mid'));
2727
$sysPathIcon32 = $moduleInfo->getInfo('sysicons32');
2828

admin/readmes.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
$filterField = Request::getString('filter_field', '');
5151
$filterValue = Request::getString('filter_value', 'none');
5252
if (Constants::FILTER_OPERAND_EQUAL == $operand) {
53-
$crRepositories->add(new Criteria($filterField, $filterValue));
53+
$crRepositories->add(new \Criteria($filterField, $filterValue));
5454
} elseif (Constants::FILTER_OPERAND_LIKE == $operand) {
55-
$crRepositories->add(new Criteria($filterField, "%$filterValue%", 'LIKE'));
55+
$crRepositories->add(new \Criteria($filterField, "%$filterValue%", 'LIKE'));
5656
}
5757
$repositoriesCount = $repositoriesHandler->getCount($crRepositories);
5858
$in = [];
@@ -63,15 +63,15 @@
6363
$in[] = $i;
6464
}
6565
}
66-
$crReadmes->add(new Criteria('rm_repoid', '(' . \implode(',', $in) . ')', 'IN'));
66+
$crReadmes->add(new \Criteria('rm_repoid', '(' . \implode(',', $in) . ')', 'IN'));
6767
}
6868
$crReadmes->setStart($start);
6969
$crReadmes->setLimit($limit);
7070
$readmesCount = $readmesHandler->getCount($crReadmes);
7171
$readmesAll = $readmesHandler->getAll($crReadmes);
7272
$GLOBALS['xoopsTpl']->assign('readmes_count', $readmesCount);
73-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
74-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
73+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
74+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
7575
// Table view readmes
7676
if ($readmesCount > 0) {
7777
foreach (\array_keys($readmesAll) as $i) {

admin/releases.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@
4949
$filterField = Request::getString('filter_field', '');
5050
$filterValue = Request::getString('filter_value', 'none');
5151
if (Constants::FILTER_OPERAND_EQUAL == $operand) {
52-
$crReleases->add(new Criteria($filterField, $filterValue));
52+
$crReleases->add(new \Criteria($filterField, $filterValue));
5353
} elseif (Constants::FILTER_OPERAND_LIKE == $operand) {
54-
$crReleases->add(new Criteria($filterField, "%$filterValue%", 'LIKE'));
54+
$crReleases->add(new \Criteria($filterField, "%$filterValue%", 'LIKE'));
5555
}
5656
}
5757
$crReleases->setStart($start);
5858
$crReleases->setLimit($limit);
5959
$releasesCount = $releasesHandler->getCount($crReleases);
6060
$releasesAll = $releasesHandler->getAll($crReleases);
6161
$GLOBALS['xoopsTpl']->assign('releases_count', $releasesCount);
62-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
63-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
62+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
63+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
6464
// Table view releases
6565
if ($releasesCount > 0) {
6666
foreach (\array_keys($releasesAll) as $i) {

admin/repositories.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
$autoApproved = (int)$helper->getConfig('autoapproved');
4747
$GLOBALS['xoopsTpl']->assign('autoApproved', !$autoApproved);
48-
$GLOBALS['xoopsTpl']->assign('wggithub_icons_url_16', WGGITHUB_ICONS_URL . '/16');
48+
$GLOBALS['xoopsTpl']->assign('wggithub_icons_url_16', \WGGITHUB_ICONS_URL . '/16');
4949

5050
$filterValue = '';
5151
$filterStatus = 0;
@@ -56,23 +56,23 @@
5656
$filterValue = Request::getString('filter_value', '');
5757
if ('' !== $filterValue) {
5858
if (Constants::FILTER_OPERAND_EQUAL == $operand) {
59-
$crRepositories->add(new Criteria($filterField, $filterValue));
59+
$crRepositories->add(new \Criteria($filterField, $filterValue));
6060
} elseif (Constants::FILTER_OPERAND_LIKE == $operand) {
61-
$crRepositories->add(new Criteria($filterField, "%$filterValue%", 'LIKE'));
61+
$crRepositories->add(new \Criteria($filterField, "%$filterValue%", 'LIKE'));
6262
}
6363
}
6464
$filterStatus = Request::getInt('filter_status');
6565
if ($filterStatus > 0) {
66-
$crRepositories->add(new Criteria('repo_status', $filterStatus));
66+
$crRepositories->add(new \Criteria('repo_status', $filterStatus));
6767
}
6868
}
6969
$crRepositories->setStart($start);
7070
$crRepositories->setLimit($limit);
7171
$repositoriesCount = $repositoriesHandler->getCount($crRepositories);
7272
$repositoriesAll = $repositoriesHandler->getAll($crRepositories);
7373
$GLOBALS['xoopsTpl']->assign('repositories_count', $repositoriesCount);
74-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
75-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
74+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
75+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
7676
// Table view repositories
7777
if ($repositoriesCount > 0) {
7878
foreach (\array_keys($repositoriesAll) as $i) {

admin/requests.php

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* wgGitHub module for xoops
14+
*
15+
* @copyright 2020 XOOPS Project (https://xooops.org)
16+
* @license GPL 2.0 or later
17+
* @package wggithub
18+
* @since 1.0
19+
* @min_xoops 2.5.10
20+
* @author TDM XOOPS - Email:<goffy@wedega.com> - Website:<https://wedega.com>
21+
*/
22+
23+
use Xmf\Request;
24+
use XoopsModules\Wggithub;
25+
use XoopsModules\Wggithub\Constants;
26+
use XoopsModules\Wggithub\Common;
27+
28+
require __DIR__ . '/header.php';
29+
// It recovered the value of argument op in URL$
30+
$op = Request::getCmd('op', 'list');
31+
// Request req_id
32+
$reqId = Request::getInt('req_id');
33+
switch ($op) {
34+
case 'list':
35+
default:
36+
// Define Stylesheet
37+
$GLOBALS['xoTheme']->addStylesheet($style, null);
38+
$start = Request::getInt('start', 0);
39+
$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
40+
$templateMain = 'wggithub_admin_requests.tpl';
41+
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php'));
42+
$adminObject->addItemButton(\_AM_WGGITHUB_ADD_REQUEST, 'requests.php?op=new', 'add');
43+
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
44+
$requestsCount = $requestsHandler->getCountRequests();
45+
$requestsAll = $requestsHandler->getAllRequests($start, $limit);
46+
$GLOBALS['xoopsTpl']->assign('requests_count', $requestsCount);
47+
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
48+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
49+
// Table view requests
50+
if ($requestsCount > 0) {
51+
foreach (\array_keys($requestsAll) as $i) {
52+
$request = $requestsAll[$i]->getValuesRequests();
53+
$GLOBALS['xoopsTpl']->append('requests_list', $request);
54+
unset($request);
55+
}
56+
// Display Navigation
57+
if ($requestsCount > $limit) {
58+
include_once \XOOPS_ROOT_PATH . '/class/pagenav.php';
59+
$pagenav = new \XoopsPageNav($requestsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
60+
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
61+
}
62+
} else {
63+
$GLOBALS['xoopsTpl']->assign('error', \_AM_WGGITHUB_THEREARENT_REQUESTS);
64+
}
65+
break;
66+
case 'new':
67+
$templateMain = 'wggithub_admin_requests.tpl';
68+
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php'));
69+
$adminObject->addItemButton(\_AM_WGGITHUB_REQUESTS_LIST, 'requests.php', 'list');
70+
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71+
// Form Create
72+
$requestsObj = $requestsHandler->create();
73+
$form = $requestsObj->getFormRequests();
74+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
75+
break;
76+
case 'save':
77+
// Security Check
78+
if (!$GLOBALS['xoopsSecurity']->check()) {
79+
\redirect_header('requests.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
80+
}
81+
if ($reqId > 0) {
82+
$requestsObj = $requestsHandler->get($reqId);
83+
} else {
84+
$requestsObj = $requestsHandler->create();
85+
}
86+
// Set Vars
87+
$requestsObj->setVar('req_request', Request::getString('req_request', ''));
88+
$requestsObj->setVar('req_result', Request::getString('req_result', ''));
89+
$requestDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('req_datecreated'));
90+
$requestsObj->setVar('req_datecreated', $requestDatecreatedObj->getTimestamp());
91+
$requestsObj->setVar('req_submitter', Request::getInt('req_submitter', 0));
92+
// Insert Data
93+
if ($requestsHandler->insert($requestsObj)) {
94+
\redirect_header('requests.php?op=list', 2, \_AM_WGGITHUB_FORM_OK);
95+
}
96+
// Get Form
97+
$GLOBALS['xoopsTpl']->assign('error', $requestsObj->getHtmlErrors());
98+
$form = $requestsObj->getFormRequests();
99+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
100+
break;
101+
case 'edit':
102+
$templateMain = 'wggithub_admin_requests.tpl';
103+
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php'));
104+
$adminObject->addItemButton(\_AM_WGGITHUB_ADD_REQUEST, 'requests.php?op=new', 'add');
105+
$adminObject->addItemButton(\_AM_WGGITHUB_REQUESTS_LIST, 'requests.php', 'list');
106+
$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
107+
// Get Form
108+
$requestsObj = $requestsHandler->get($reqId);
109+
$form = $requestsObj->getFormRequests();
110+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
111+
break;
112+
case 'delete':
113+
$templateMain = 'wggithub_admin_requests.tpl';
114+
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php'));
115+
$requestsObj = $requestsHandler->get($reqId);
116+
$reqRequest = $requestsObj->getVar('req_request');
117+
if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
118+
if (!$GLOBALS['xoopsSecurity']->check()) {
119+
\redirect_header('requests.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
120+
}
121+
if ($requestsHandler->delete($requestsObj)) {
122+
\redirect_header('requests.php', 3, \_AM_WGGITHUB_FORM_DELETE_OK);
123+
} else {
124+
$GLOBALS['xoopsTpl']->assign('error', $requestsObj->getHtmlErrors());
125+
}
126+
} else {
127+
$xoopsconfirm = new Common\XoopsConfirm(
128+
['ok' => 1, 'req_id' => $reqId, 'op' => 'delete'],
129+
$_SERVER['REQUEST_URI'],
130+
\sprintf(\_AM_WGGITHUB_FORM_SURE_DELETE, $requestsObj->getVar('req_request')));
131+
$form = $xoopsconfirm->getFormXoopsConfirm();
132+
$GLOBALS['xoopsTpl']->assign('form', $form->render());
133+
}
134+
break;
135+
}
136+
require __DIR__ . '/footer.php';

admin/settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
$settingsCount = $settingsHandler->getCountSettings();
5353
$settingsAll = $settingsHandler->getAllSettings($start, $limit);
5454
$GLOBALS['xoopsTpl']->assign('settings_count', $settingsCount);
55-
$GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL);
56-
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
55+
$GLOBALS['xoopsTpl']->assign('wggithub_url', \WGGITHUB_URL);
56+
$GLOBALS['xoopsTpl']->assign('wggithub_upload_url', \WGGITHUB_UPLOAD_URL);
5757
// Table view settings
5858
if ($settingsCount > 0) {
5959
foreach (\array_keys($settingsAll) as $i) {

0 commit comments

Comments
 (0)