@@ -27,52 +27,52 @@ |
||
27 | 27 | $sysPathIcon32 = $moduleInfo->getInfo('sysicons32'); |
28 | 28 | |
29 | 29 | $adminmenu[] = [ |
30 | - 'title' => _MI_WGGITHUB_ADMENU1, |
|
31 | - 'link' => 'admin/index.php', |
|
32 | - 'icon' => $sysPathIcon32.'/dashboard.png', |
|
30 | + 'title' => _MI_WGGITHUB_ADMENU1, |
|
31 | + 'link' => 'admin/index.php', |
|
32 | + 'icon' => $sysPathIcon32.'/dashboard.png', |
|
33 | 33 | ]; |
34 | 34 | $adminmenu[] = [ |
35 | - 'title' => _MI_WGGITHUB_ADMENU2, |
|
36 | - 'link' => 'admin/settings.php', |
|
37 | - 'icon' => 'assets/icons/32/blank.gif', |
|
35 | + 'title' => _MI_WGGITHUB_ADMENU2, |
|
36 | + 'link' => 'admin/settings.php', |
|
37 | + 'icon' => 'assets/icons/32/blank.gif', |
|
38 | 38 | ]; |
39 | 39 | $adminmenu[] = [ |
40 | - 'title' => _MI_WGGITHUB_ADMENU3, |
|
41 | - 'link' => 'admin/directories.php', |
|
42 | - 'icon' => 'assets/icons/32/blank.gif', |
|
40 | + 'title' => _MI_WGGITHUB_ADMENU3, |
|
41 | + 'link' => 'admin/directories.php', |
|
42 | + 'icon' => 'assets/icons/32/blank.gif', |
|
43 | 43 | ]; |
44 | 44 | $adminmenu[] = [ |
45 | - 'title' => _MI_WGGITHUB_ADMENU4, |
|
46 | - 'link' => 'admin/requests.php', |
|
47 | - 'icon' => 'assets/icons/32/blank.gif', |
|
45 | + 'title' => _MI_WGGITHUB_ADMENU4, |
|
46 | + 'link' => 'admin/requests.php', |
|
47 | + 'icon' => 'assets/icons/32/blank.gif', |
|
48 | 48 | ]; |
49 | 49 | $adminmenu[] = [ |
50 | - 'title' => _MI_WGGITHUB_ADMENU5, |
|
51 | - 'link' => 'admin/repositories.php', |
|
52 | - 'icon' => 'assets/icons/32/blank.gif', |
|
50 | + 'title' => _MI_WGGITHUB_ADMENU5, |
|
51 | + 'link' => 'admin/repositories.php', |
|
52 | + 'icon' => 'assets/icons/32/blank.gif', |
|
53 | 53 | ]; |
54 | 54 | $adminmenu[] = [ |
55 | - 'title' => _MI_WGGITHUB_ADMENU6, |
|
56 | - 'link' => 'admin/readmes.php', |
|
57 | - 'icon' => 'assets/icons/32/addlink.png', |
|
55 | + 'title' => _MI_WGGITHUB_ADMENU6, |
|
56 | + 'link' => 'admin/readmes.php', |
|
57 | + 'icon' => 'assets/icons/32/addlink.png', |
|
58 | 58 | ]; |
59 | 59 | $adminmenu[] = [ |
60 | - 'title' => _MI_WGGITHUB_ADMENU7, |
|
61 | - 'link' => 'admin/releases.php', |
|
62 | - 'icon' => 'assets/icons/32/blank.gif', |
|
60 | + 'title' => _MI_WGGITHUB_ADMENU7, |
|
61 | + 'link' => 'admin/releases.php', |
|
62 | + 'icon' => 'assets/icons/32/blank.gif', |
|
63 | 63 | ]; |
64 | 64 | $adminmenu[] = [ |
65 | - 'title' => _MI_WGGITHUB_ADMENU8, |
|
66 | - 'link' => 'admin/permissions.php', |
|
67 | - 'icon' => $sysPathIcon32.'/permissions.png', |
|
65 | + 'title' => _MI_WGGITHUB_ADMENU8, |
|
66 | + 'link' => 'admin/permissions.php', |
|
67 | + 'icon' => $sysPathIcon32.'/permissions.png', |
|
68 | 68 | ]; |
69 | 69 | $adminmenu[] = [ |
70 | - 'title' => _MI_WGGITHUB_ADMENU9, |
|
71 | - 'link' => 'admin/feedback.php', |
|
72 | - 'icon' => $sysPathIcon32.'/mail_foward.png', |
|
70 | + 'title' => _MI_WGGITHUB_ADMENU9, |
|
71 | + 'link' => 'admin/feedback.php', |
|
72 | + 'icon' => $sysPathIcon32.'/mail_foward.png', |
|
73 | 73 | ]; |
74 | 74 | $adminmenu[] = [ |
75 | - 'title' => _MI_WGGITHUB_ABOUT, |
|
76 | - 'link' => 'admin/about.php', |
|
77 | - 'icon' => $sysPathIcon32.'/about.png', |
|
75 | + 'title' => _MI_WGGITHUB_ABOUT, |
|
76 | + 'link' => 'admin/about.php', |
|
77 | + 'icon' => $sysPathIcon32.'/about.png', |
|
78 | 78 | ]; |
@@ -50,26 +50,26 @@ |
||
50 | 50 | // Upload Folders |
51 | 51 | $configurator = new Common\Configurator(); |
52 | 52 | if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) { |
53 | - foreach (\array_keys($configurator->uploadFolders) as $i) { |
|
54 | - $folder[] = $configurator->uploadFolders[$i]; |
|
55 | - } |
|
53 | + foreach (\array_keys($configurator->uploadFolders) as $i) { |
|
54 | + $folder[] = $configurator->uploadFolders[$i]; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | // Uploads Folders Created |
58 | 58 | foreach (\array_keys($folder) as $i) { |
59 | - $adminObject->addConfigBoxLine($folder[$i], 'folder'); |
|
60 | - $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); |
|
59 | + $adminObject->addConfigBoxLine($folder[$i], 'folder'); |
|
60 | + $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Render Index |
64 | 64 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php')); |
65 | 65 | // Test Data |
66 | 66 | if ($helper->getConfig('displaySampleButton')) { |
67 | - \xoops_loadLanguage('admin/modulesadmin', 'system'); |
|
68 | - include_once \dirname(__DIR__) . '/testdata/index.php'; |
|
69 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add'); |
|
70 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add'); |
|
67 | + \xoops_loadLanguage('admin/modulesadmin', 'system'); |
|
68 | + include_once \dirname(__DIR__) . '/testdata/index.php'; |
|
69 | + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add'); |
|
70 | + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add'); |
|
71 | 71 | // $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add'); |
72 | - $adminObject->displayButton('left'); |
|
72 | + $adminObject->displayButton('left'); |
|
73 | 73 | } |
74 | 74 | $GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); |
75 | 75 | // End Test Data |
@@ -20,8 +20,8 @@ |
||
20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
21 | 21 | */ |
22 | 22 | if (isset($templateMain)) { |
23 | - $GLOBALS['xoopsTpl']->assign('maintainedby', $helper->getConfig('maintainedby')); |
|
24 | - $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); |
|
23 | + $GLOBALS['xoopsTpl']->assign('maintainedby', $helper->getConfig('maintainedby')); |
|
24 | + $GLOBALS['xoopsTpl']->display("db:{$templateMain}"); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | xoops_cp_footer(); |
@@ -31,111 +31,111 @@ |
||
31 | 31 | // Request rel_id |
32 | 32 | $relId = Request::getInt('rel_id'); |
33 | 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_releases.tpl'; |
|
41 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
42 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_RELEASE, 'releases.php?op=new', 'add'); |
|
43 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | - $releasesCount = $releasesHandler->getCountReleases(); |
|
45 | - $releasesAll = $releasesHandler->getAllReleases($start, $limit); |
|
46 | - $GLOBALS['xoopsTpl']->assign('releases_count', $releasesCount); |
|
47 | - $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | - // Table view releases |
|
50 | - if ($releasesCount > 0) { |
|
51 | - foreach (\array_keys($releasesAll) as $i) { |
|
52 | - $release = $releasesAll[$i]->getValuesReleases(); |
|
53 | - $GLOBALS['xoopsTpl']->append('releases_list', $release); |
|
54 | - unset($release); |
|
55 | - } |
|
56 | - // Display Navigation |
|
57 | - if ($releasesCount > $limit) { |
|
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($releasesCount, $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_RELEASES); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'new': |
|
67 | - $templateMain = 'wggithub_admin_releases.tpl'; |
|
68 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
69 | - $adminObject->addItemButton(_AM_WGGITHUB_RELEASES_LIST, 'releases.php', 'list'); |
|
70 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | - // Form Create |
|
72 | - $releasesObj = $releasesHandler->create(); |
|
73 | - $form = $releasesObj->getFormReleases(); |
|
74 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | - break; |
|
76 | - case 'save': |
|
77 | - // Security Check |
|
78 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | - \redirect_header('releases.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | - } |
|
81 | - if ($relId > 0) { |
|
82 | - $releasesObj = $releasesHandler->get($relId); |
|
83 | - } else { |
|
84 | - $releasesObj = $releasesHandler->create(); |
|
85 | - } |
|
86 | - // Set Vars |
|
87 | - $releasesObj->setVar('rel_repoid', Request::getInt('rel_repoid', 0)); |
|
88 | - $releasesObj->setVar('rel_type', Request::getInt('rel_type', 0)); |
|
89 | - $releasesObj->setVar('rel_name', Request::getString('rel_name', '')); |
|
90 | - $releasePublishedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rel_publishedat')); |
|
91 | - $releasesObj->setVar('rel_publishedat', $releasePublishedatObj->getTimestamp()); |
|
92 | - $releasesObj->setVar('rel_tarballurl', Request::getString('rel_tarballurl', '')); |
|
93 | - $releasesObj->setVar('rel_zipballurl', Request::getString('rel_zipballurl', '')); |
|
94 | - $releaseDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rel_datecreated')); |
|
95 | - $releasesObj->setVar('rel_datecreated', $releaseDatecreatedObj->getTimestamp()); |
|
96 | - $releasesObj->setVar('rel_submitter', Request::getInt('rel_submitter', 0)); |
|
97 | - // Insert Data |
|
98 | - if ($releasesHandler->insert($releasesObj)) { |
|
99 | - \redirect_header('releases.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
100 | - } |
|
101 | - // Get Form |
|
102 | - $GLOBALS['xoopsTpl']->assign('error', $releasesObj->getHtmlErrors()); |
|
103 | - $form = $releasesObj->getFormReleases(); |
|
104 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
105 | - break; |
|
106 | - case 'edit': |
|
107 | - $templateMain = 'wggithub_admin_releases.tpl'; |
|
108 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
109 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_RELEASE, 'releases.php?op=new', 'add'); |
|
110 | - $adminObject->addItemButton(_AM_WGGITHUB_RELEASES_LIST, 'releases.php', 'list'); |
|
111 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
112 | - // Get Form |
|
113 | - $releasesObj = $releasesHandler->get($relId); |
|
114 | - $form = $releasesObj->getFormReleases(); |
|
115 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
116 | - break; |
|
117 | - case 'delete': |
|
118 | - $templateMain = 'wggithub_admin_releases.tpl'; |
|
119 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
120 | - $releasesObj = $releasesHandler->get($relId); |
|
121 | - $relName = $releasesObj->getVar('rel_name'); |
|
122 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
123 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
124 | - \redirect_header('releases.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
125 | - } |
|
126 | - if ($releasesHandler->delete($releasesObj)) { |
|
127 | - \redirect_header('releases.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
128 | - } else { |
|
129 | - $GLOBALS['xoopsTpl']->assign('error', $releasesObj->getHtmlErrors()); |
|
130 | - } |
|
131 | - } else { |
|
132 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
133 | - ['ok' => 1, 'rel_id' => $relId, 'op' => 'delete'], |
|
134 | - $_SERVER['REQUEST_URI'], |
|
135 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $releasesObj->getVar('rel_name'))); |
|
136 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
137 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
138 | - } |
|
139 | - break; |
|
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_releases.tpl'; |
|
41 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
42 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_RELEASE, 'releases.php?op=new', 'add'); |
|
43 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | + $releasesCount = $releasesHandler->getCountReleases(); |
|
45 | + $releasesAll = $releasesHandler->getAllReleases($start, $limit); |
|
46 | + $GLOBALS['xoopsTpl']->assign('releases_count', $releasesCount); |
|
47 | + $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | + // Table view releases |
|
50 | + if ($releasesCount > 0) { |
|
51 | + foreach (\array_keys($releasesAll) as $i) { |
|
52 | + $release = $releasesAll[$i]->getValuesReleases(); |
|
53 | + $GLOBALS['xoopsTpl']->append('releases_list', $release); |
|
54 | + unset($release); |
|
55 | + } |
|
56 | + // Display Navigation |
|
57 | + if ($releasesCount > $limit) { |
|
58 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($releasesCount, $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_RELEASES); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'new': |
|
67 | + $templateMain = 'wggithub_admin_releases.tpl'; |
|
68 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
69 | + $adminObject->addItemButton(_AM_WGGITHUB_RELEASES_LIST, 'releases.php', 'list'); |
|
70 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | + // Form Create |
|
72 | + $releasesObj = $releasesHandler->create(); |
|
73 | + $form = $releasesObj->getFormReleases(); |
|
74 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | + break; |
|
76 | + case 'save': |
|
77 | + // Security Check |
|
78 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | + \redirect_header('releases.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | + } |
|
81 | + if ($relId > 0) { |
|
82 | + $releasesObj = $releasesHandler->get($relId); |
|
83 | + } else { |
|
84 | + $releasesObj = $releasesHandler->create(); |
|
85 | + } |
|
86 | + // Set Vars |
|
87 | + $releasesObj->setVar('rel_repoid', Request::getInt('rel_repoid', 0)); |
|
88 | + $releasesObj->setVar('rel_type', Request::getInt('rel_type', 0)); |
|
89 | + $releasesObj->setVar('rel_name', Request::getString('rel_name', '')); |
|
90 | + $releasePublishedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rel_publishedat')); |
|
91 | + $releasesObj->setVar('rel_publishedat', $releasePublishedatObj->getTimestamp()); |
|
92 | + $releasesObj->setVar('rel_tarballurl', Request::getString('rel_tarballurl', '')); |
|
93 | + $releasesObj->setVar('rel_zipballurl', Request::getString('rel_zipballurl', '')); |
|
94 | + $releaseDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rel_datecreated')); |
|
95 | + $releasesObj->setVar('rel_datecreated', $releaseDatecreatedObj->getTimestamp()); |
|
96 | + $releasesObj->setVar('rel_submitter', Request::getInt('rel_submitter', 0)); |
|
97 | + // Insert Data |
|
98 | + if ($releasesHandler->insert($releasesObj)) { |
|
99 | + \redirect_header('releases.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
100 | + } |
|
101 | + // Get Form |
|
102 | + $GLOBALS['xoopsTpl']->assign('error', $releasesObj->getHtmlErrors()); |
|
103 | + $form = $releasesObj->getFormReleases(); |
|
104 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
105 | + break; |
|
106 | + case 'edit': |
|
107 | + $templateMain = 'wggithub_admin_releases.tpl'; |
|
108 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
109 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_RELEASE, 'releases.php?op=new', 'add'); |
|
110 | + $adminObject->addItemButton(_AM_WGGITHUB_RELEASES_LIST, 'releases.php', 'list'); |
|
111 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
112 | + // Get Form |
|
113 | + $releasesObj = $releasesHandler->get($relId); |
|
114 | + $form = $releasesObj->getFormReleases(); |
|
115 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
116 | + break; |
|
117 | + case 'delete': |
|
118 | + $templateMain = 'wggithub_admin_releases.tpl'; |
|
119 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('releases.php')); |
|
120 | + $releasesObj = $releasesHandler->get($relId); |
|
121 | + $relName = $releasesObj->getVar('rel_name'); |
|
122 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
123 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
124 | + \redirect_header('releases.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
125 | + } |
|
126 | + if ($releasesHandler->delete($releasesObj)) { |
|
127 | + \redirect_header('releases.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
128 | + } else { |
|
129 | + $GLOBALS['xoopsTpl']->assign('error', $releasesObj->getHtmlErrors()); |
|
130 | + } |
|
131 | + } else { |
|
132 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
133 | + ['ok' => 1, 'rel_id' => $relId, 'op' => 'delete'], |
|
134 | + $_SERVER['REQUEST_URI'], |
|
135 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $releasesObj->getVar('rel_name'))); |
|
136 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
137 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
138 | + } |
|
139 | + break; |
|
140 | 140 | } |
141 | 141 | require __DIR__ . '/footer.php'; |
@@ -31,106 +31,106 @@ |
||
31 | 31 | // Request req_id |
32 | 32 | $reqId = Request::getInt('req_id'); |
33 | 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; |
|
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 | 135 | } |
136 | 136 | require __DIR__ . '/footer.php'; |
@@ -31,141 +31,141 @@ |
||
31 | 31 | // Request repo_id |
32 | 32 | $repoId = Request::getInt('repo_id'); |
33 | 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_repositories.tpl'; |
|
41 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
42 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
43 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | - $repositoriesCount = $repositoriesHandler->getCountRepositories(); |
|
45 | - $repositoriesAll = $repositoriesHandler->getAllRepositories($start, $limit); |
|
46 | - $GLOBALS['xoopsTpl']->assign('repositories_count', $repositoriesCount); |
|
47 | - $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | - // Table view repositories |
|
50 | - if ($repositoriesCount > 0) { |
|
51 | - foreach (\array_keys($repositoriesAll) as $i) { |
|
52 | - $repository = $repositoriesAll[$i]->getValuesRepositories(); |
|
53 | - $GLOBALS['xoopsTpl']->append('repositories_list', $repository); |
|
54 | - unset($repository); |
|
55 | - } |
|
56 | - // Display Navigation |
|
57 | - if ($repositoriesCount > $limit) { |
|
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($repositoriesCount, $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_REPOSITORIES); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'new': |
|
67 | - $templateMain = 'wggithub_admin_repositories.tpl'; |
|
68 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
69 | - $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
70 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | - // Form Create |
|
72 | - $repositoriesObj = $repositoriesHandler->create(); |
|
73 | - $form = $repositoriesObj->getFormRepositories(); |
|
74 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | - break; |
|
76 | - case 'save': |
|
77 | - // Security Check |
|
78 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | - \redirect_header('repositories.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | - } |
|
81 | - if ($repoId > 0) { |
|
82 | - $repositoriesObj = $repositoriesHandler->get($repoId); |
|
83 | - } else { |
|
84 | - $repositoriesObj = $repositoriesHandler->create(); |
|
85 | - } |
|
86 | - // Set Vars |
|
87 | - $repositoriesObj->setVar('repo_nodeid', Request::getString('repo_nodeid', '')); |
|
88 | - $repositoriesObj->setVar('repo_user', Request::getString('repo_user', '')); |
|
89 | - $repositoriesObj->setVar('repo_name', Request::getString('repo_name', '')); |
|
90 | - $repositoriesObj->setVar('repo_fullname', Request::getString('repo_fullname', '')); |
|
91 | - $repositoryCreatedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_createdat')); |
|
92 | - $repositoriesObj->setVar('repo_createdat', $repositoryCreatedatObj->getTimestamp()); |
|
93 | - $repositoryUpdatedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_updatedat')); |
|
94 | - $repositoriesObj->setVar('repo_updatedat', $repositoryUpdatedatObj->getTimestamp()); |
|
95 | - $repositoriesObj->setVar('repo_htmlurl', Request::getString('repo_htmlurl', '')); |
|
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_repositories.tpl'; |
|
41 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
42 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
43 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | + $repositoriesCount = $repositoriesHandler->getCountRepositories(); |
|
45 | + $repositoriesAll = $repositoriesHandler->getAllRepositories($start, $limit); |
|
46 | + $GLOBALS['xoopsTpl']->assign('repositories_count', $repositoriesCount); |
|
47 | + $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | + // Table view repositories |
|
50 | + if ($repositoriesCount > 0) { |
|
51 | + foreach (\array_keys($repositoriesAll) as $i) { |
|
52 | + $repository = $repositoriesAll[$i]->getValuesRepositories(); |
|
53 | + $GLOBALS['xoopsTpl']->append('repositories_list', $repository); |
|
54 | + unset($repository); |
|
55 | + } |
|
56 | + // Display Navigation |
|
57 | + if ($repositoriesCount > $limit) { |
|
58 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($repositoriesCount, $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_REPOSITORIES); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'new': |
|
67 | + $templateMain = 'wggithub_admin_repositories.tpl'; |
|
68 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
69 | + $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
70 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | + // Form Create |
|
72 | + $repositoriesObj = $repositoriesHandler->create(); |
|
73 | + $form = $repositoriesObj->getFormRepositories(); |
|
74 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | + break; |
|
76 | + case 'save': |
|
77 | + // Security Check |
|
78 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | + \redirect_header('repositories.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | + } |
|
81 | + if ($repoId > 0) { |
|
82 | + $repositoriesObj = $repositoriesHandler->get($repoId); |
|
83 | + } else { |
|
84 | + $repositoriesObj = $repositoriesHandler->create(); |
|
85 | + } |
|
86 | + // Set Vars |
|
87 | + $repositoriesObj->setVar('repo_nodeid', Request::getString('repo_nodeid', '')); |
|
88 | + $repositoriesObj->setVar('repo_user', Request::getString('repo_user', '')); |
|
89 | + $repositoriesObj->setVar('repo_name', Request::getString('repo_name', '')); |
|
90 | + $repositoriesObj->setVar('repo_fullname', Request::getString('repo_fullname', '')); |
|
91 | + $repositoryCreatedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_createdat')); |
|
92 | + $repositoriesObj->setVar('repo_createdat', $repositoryCreatedatObj->getTimestamp()); |
|
93 | + $repositoryUpdatedatObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_updatedat')); |
|
94 | + $repositoriesObj->setVar('repo_updatedat', $repositoryUpdatedatObj->getTimestamp()); |
|
95 | + $repositoriesObj->setVar('repo_htmlurl', Request::getString('repo_htmlurl', '')); |
|
96 | 96 | $repositoriesObj->setVar('repo_prerelease', Request::getInt('repo_prerelease', 0)); |
97 | 97 | $repositoriesObj->setVar('repo_release', Request::getInt('repo_release', 0)); |
98 | - $repositoriesObj->setVar('repo_status', Request::getInt('repo_status', 0)); |
|
99 | - $repositoryDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_datecreated')); |
|
100 | - $repositoriesObj->setVar('repo_datecreated', $repositoryDatecreatedObj->getTimestamp()); |
|
101 | - $repositoriesObj->setVar('repo_submitter', Request::getInt('repo_submitter', 0)); |
|
102 | - // Insert Data |
|
103 | - if ($repositoriesHandler->insert($repositoriesObj)) { |
|
104 | - $newRepoId = $repositoriesObj->getNewInsertedIdRepositories(); |
|
105 | - $permId = isset($_REQUEST['repo_id']) ? $repoId : $newRepoId; |
|
106 | - $grouppermHandler = \xoops_getHandler('groupperm'); |
|
107 | - $mid = $GLOBALS['xoopsModule']->getVar('mid'); |
|
108 | - // Permission to view_repositories |
|
109 | - $grouppermHandler->deleteByModule($mid, 'wggithub_view_repositories', $permId); |
|
110 | - if (isset($_POST['groups_view_repositories'])) { |
|
111 | - foreach ($_POST['groups_view_repositories'] as $onegroupId) { |
|
112 | - $grouppermHandler->addRight('wggithub_view_repositories', $permId, $onegroupId, $mid); |
|
113 | - } |
|
114 | - } |
|
115 | - // Permission to submit_repositories |
|
116 | - $grouppermHandler->deleteByModule($mid, 'wggithub_submit_repositories', $permId); |
|
117 | - if (isset($_POST['groups_submit_repositories'])) { |
|
118 | - foreach ($_POST['groups_submit_repositories'] as $onegroupId) { |
|
119 | - $grouppermHandler->addRight('wggithub_submit_repositories', $permId, $onegroupId, $mid); |
|
120 | - } |
|
121 | - } |
|
122 | - // Permission to approve_repositories |
|
123 | - $grouppermHandler->deleteByModule($mid, 'wggithub_approve_repositories', $permId); |
|
124 | - if (isset($_POST['groups_approve_repositories'])) { |
|
125 | - foreach ($_POST['groups_approve_repositories'] as $onegroupId) { |
|
126 | - $grouppermHandler->addRight('wggithub_approve_repositories', $permId, $onegroupId, $mid); |
|
127 | - } |
|
128 | - } |
|
129 | - \redirect_header('repositories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
130 | - } |
|
131 | - // Get Form |
|
132 | - $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
133 | - $form = $repositoriesObj->getFormRepositories(); |
|
134 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
135 | - break; |
|
136 | - case 'edit': |
|
137 | - $templateMain = 'wggithub_admin_repositories.tpl'; |
|
138 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
139 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
140 | - $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
141 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
142 | - // Get Form |
|
143 | - $repositoriesObj = $repositoriesHandler->get($repoId); |
|
144 | - $form = $repositoriesObj->getFormRepositories(); |
|
145 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
146 | - break; |
|
147 | - case 'delete': |
|
148 | - $templateMain = 'wggithub_admin_repositories.tpl'; |
|
149 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
150 | - $repositoriesObj = $repositoriesHandler->get($repoId); |
|
151 | - $repoName = $repositoriesObj->getVar('repo_name'); |
|
152 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
153 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
154 | - \redirect_header('repositories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
155 | - } |
|
156 | - if ($repositoriesHandler->delete($repositoriesObj)) { |
|
157 | - \redirect_header('repositories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
158 | - } else { |
|
159 | - $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
160 | - } |
|
161 | - } else { |
|
162 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
163 | - ['ok' => 1, 'repo_id' => $repoId, 'op' => 'delete'], |
|
164 | - $_SERVER['REQUEST_URI'], |
|
165 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $repositoriesObj->getVar('repo_name'))); |
|
166 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
167 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
168 | - } |
|
169 | - break; |
|
98 | + $repositoriesObj->setVar('repo_status', Request::getInt('repo_status', 0)); |
|
99 | + $repositoryDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('repo_datecreated')); |
|
100 | + $repositoriesObj->setVar('repo_datecreated', $repositoryDatecreatedObj->getTimestamp()); |
|
101 | + $repositoriesObj->setVar('repo_submitter', Request::getInt('repo_submitter', 0)); |
|
102 | + // Insert Data |
|
103 | + if ($repositoriesHandler->insert($repositoriesObj)) { |
|
104 | + $newRepoId = $repositoriesObj->getNewInsertedIdRepositories(); |
|
105 | + $permId = isset($_REQUEST['repo_id']) ? $repoId : $newRepoId; |
|
106 | + $grouppermHandler = \xoops_getHandler('groupperm'); |
|
107 | + $mid = $GLOBALS['xoopsModule']->getVar('mid'); |
|
108 | + // Permission to view_repositories |
|
109 | + $grouppermHandler->deleteByModule($mid, 'wggithub_view_repositories', $permId); |
|
110 | + if (isset($_POST['groups_view_repositories'])) { |
|
111 | + foreach ($_POST['groups_view_repositories'] as $onegroupId) { |
|
112 | + $grouppermHandler->addRight('wggithub_view_repositories', $permId, $onegroupId, $mid); |
|
113 | + } |
|
114 | + } |
|
115 | + // Permission to submit_repositories |
|
116 | + $grouppermHandler->deleteByModule($mid, 'wggithub_submit_repositories', $permId); |
|
117 | + if (isset($_POST['groups_submit_repositories'])) { |
|
118 | + foreach ($_POST['groups_submit_repositories'] as $onegroupId) { |
|
119 | + $grouppermHandler->addRight('wggithub_submit_repositories', $permId, $onegroupId, $mid); |
|
120 | + } |
|
121 | + } |
|
122 | + // Permission to approve_repositories |
|
123 | + $grouppermHandler->deleteByModule($mid, 'wggithub_approve_repositories', $permId); |
|
124 | + if (isset($_POST['groups_approve_repositories'])) { |
|
125 | + foreach ($_POST['groups_approve_repositories'] as $onegroupId) { |
|
126 | + $grouppermHandler->addRight('wggithub_approve_repositories', $permId, $onegroupId, $mid); |
|
127 | + } |
|
128 | + } |
|
129 | + \redirect_header('repositories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
130 | + } |
|
131 | + // Get Form |
|
132 | + $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
133 | + $form = $repositoriesObj->getFormRepositories(); |
|
134 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
135 | + break; |
|
136 | + case 'edit': |
|
137 | + $templateMain = 'wggithub_admin_repositories.tpl'; |
|
138 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
139 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
140 | + $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
141 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
142 | + // Get Form |
|
143 | + $repositoriesObj = $repositoriesHandler->get($repoId); |
|
144 | + $form = $repositoriesObj->getFormRepositories(); |
|
145 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
146 | + break; |
|
147 | + case 'delete': |
|
148 | + $templateMain = 'wggithub_admin_repositories.tpl'; |
|
149 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
150 | + $repositoriesObj = $repositoriesHandler->get($repoId); |
|
151 | + $repoName = $repositoriesObj->getVar('repo_name'); |
|
152 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
153 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
154 | + \redirect_header('repositories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
155 | + } |
|
156 | + if ($repositoriesHandler->delete($repositoriesObj)) { |
|
157 | + \redirect_header('repositories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
158 | + } else { |
|
159 | + $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
160 | + } |
|
161 | + } else { |
|
162 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
163 | + ['ok' => 1, 'repo_id' => $repoId, 'op' => 'delete'], |
|
164 | + $_SERVER['REQUEST_URI'], |
|
165 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $repositoriesObj->getVar('repo_name'))); |
|
166 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
167 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
168 | + } |
|
169 | + break; |
|
170 | 170 | } |
171 | 171 | require __DIR__ . '/footer.php'; |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $myts = MyTextSanitizer::getInstance(); |
41 | 41 | // |
42 | 42 | if (!isset($xoopsTpl) || !\is_object($xoopsTpl)) { |
43 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
44 | - $xoopsTpl = new \XoopsTpl(); |
|
43 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
44 | + $xoopsTpl = new \XoopsTpl(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Load languages |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | // Local admin menu class |
52 | 52 | if (\file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) { |
53 | - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); |
|
53 | + include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); |
|
54 | 54 | } else { |
55 | - \redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); |
|
55 | + \redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | xoops_cp_header(); |
@@ -31,108 +31,108 @@ |
||
31 | 31 | // Request set_id |
32 | 32 | $setId = Request::getInt('set_id'); |
33 | 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_settings.tpl'; |
|
41 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
42 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
43 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | - $settingsCount = $settingsHandler->getCountSettings(); |
|
45 | - $settingsAll = $settingsHandler->getAllSettings($start, $limit); |
|
46 | - $GLOBALS['xoopsTpl']->assign('settings_count', $settingsCount); |
|
47 | - $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | - // Table view settings |
|
50 | - if ($settingsCount > 0) { |
|
51 | - foreach (\array_keys($settingsAll) as $i) { |
|
52 | - $setting = $settingsAll[$i]->getValuesSettings(); |
|
53 | - $GLOBALS['xoopsTpl']->append('settings_list', $setting); |
|
54 | - unset($setting); |
|
55 | - } |
|
56 | - // Display Navigation |
|
57 | - if ($settingsCount > $limit) { |
|
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($settingsCount, $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_SETTINGS); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'new': |
|
67 | - $templateMain = 'wggithub_admin_settings.tpl'; |
|
68 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
69 | - $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
70 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | - // Form Create |
|
72 | - $settingsObj = $settingsHandler->create(); |
|
73 | - $form = $settingsObj->getFormSettings(); |
|
74 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | - break; |
|
76 | - case 'save': |
|
77 | - // Security Check |
|
78 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | - \redirect_header('settings.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | - } |
|
81 | - if ($setId > 0) { |
|
82 | - $settingsObj = $settingsHandler->get($setId); |
|
83 | - } else { |
|
84 | - $settingsObj = $settingsHandler->create(); |
|
85 | - } |
|
86 | - // Set Vars |
|
87 | - $settingsObj->setVar('set_username', Request::getString('set_username', '')); |
|
88 | - $settingsObj->setVar('set_token', Request::getString('set_token', '')); |
|
89 | - $settingsObj->setVar('set_options', Request::getString('set_options', '')); |
|
90 | - $settingsObj->setVar('set_primary', Request::getInt('set_primary', 0)); |
|
91 | - $settingDateObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('set_date')); |
|
92 | - $settingsObj->setVar('set_date', $settingDateObj->getTimestamp()); |
|
93 | - $settingsObj->setVar('set_submitter', Request::getInt('set_submitter', 0)); |
|
94 | - // Insert Data |
|
95 | - if ($settingsHandler->insert($settingsObj)) { |
|
96 | - \redirect_header('settings.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
97 | - } |
|
98 | - // Get Form |
|
99 | - $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
100 | - $form = $settingsObj->getFormSettings(); |
|
101 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
102 | - break; |
|
103 | - case 'edit': |
|
104 | - $templateMain = 'wggithub_admin_settings.tpl'; |
|
105 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
106 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
107 | - $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
108 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
109 | - // Get Form |
|
110 | - $settingsObj = $settingsHandler->get($setId); |
|
111 | - $form = $settingsObj->getFormSettings(); |
|
112 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
113 | - break; |
|
114 | - case 'delete': |
|
115 | - $templateMain = 'wggithub_admin_settings.tpl'; |
|
116 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
117 | - $settingsObj = $settingsHandler->get($setId); |
|
118 | - $setToken = $settingsObj->getVar('set_token'); |
|
119 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
120 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
121 | - \redirect_header('settings.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
122 | - } |
|
123 | - if ($settingsHandler->delete($settingsObj)) { |
|
124 | - \redirect_header('settings.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
125 | - } else { |
|
126 | - $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
127 | - } |
|
128 | - } else { |
|
129 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
130 | - ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], |
|
131 | - $_SERVER['REQUEST_URI'], |
|
132 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $settingsObj->getVar('set_token'))); |
|
133 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
134 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
135 | - } |
|
136 | - break; |
|
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_settings.tpl'; |
|
41 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
42 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
43 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | + $settingsCount = $settingsHandler->getCountSettings(); |
|
45 | + $settingsAll = $settingsHandler->getAllSettings($start, $limit); |
|
46 | + $GLOBALS['xoopsTpl']->assign('settings_count', $settingsCount); |
|
47 | + $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | + // Table view settings |
|
50 | + if ($settingsCount > 0) { |
|
51 | + foreach (\array_keys($settingsAll) as $i) { |
|
52 | + $setting = $settingsAll[$i]->getValuesSettings(); |
|
53 | + $GLOBALS['xoopsTpl']->append('settings_list', $setting); |
|
54 | + unset($setting); |
|
55 | + } |
|
56 | + // Display Navigation |
|
57 | + if ($settingsCount > $limit) { |
|
58 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($settingsCount, $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_SETTINGS); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'new': |
|
67 | + $templateMain = 'wggithub_admin_settings.tpl'; |
|
68 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
69 | + $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
70 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | + // Form Create |
|
72 | + $settingsObj = $settingsHandler->create(); |
|
73 | + $form = $settingsObj->getFormSettings(); |
|
74 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | + break; |
|
76 | + case 'save': |
|
77 | + // Security Check |
|
78 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | + \redirect_header('settings.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | + } |
|
81 | + if ($setId > 0) { |
|
82 | + $settingsObj = $settingsHandler->get($setId); |
|
83 | + } else { |
|
84 | + $settingsObj = $settingsHandler->create(); |
|
85 | + } |
|
86 | + // Set Vars |
|
87 | + $settingsObj->setVar('set_username', Request::getString('set_username', '')); |
|
88 | + $settingsObj->setVar('set_token', Request::getString('set_token', '')); |
|
89 | + $settingsObj->setVar('set_options', Request::getString('set_options', '')); |
|
90 | + $settingsObj->setVar('set_primary', Request::getInt('set_primary', 0)); |
|
91 | + $settingDateObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('set_date')); |
|
92 | + $settingsObj->setVar('set_date', $settingDateObj->getTimestamp()); |
|
93 | + $settingsObj->setVar('set_submitter', Request::getInt('set_submitter', 0)); |
|
94 | + // Insert Data |
|
95 | + if ($settingsHandler->insert($settingsObj)) { |
|
96 | + \redirect_header('settings.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
97 | + } |
|
98 | + // Get Form |
|
99 | + $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
100 | + $form = $settingsObj->getFormSettings(); |
|
101 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
102 | + break; |
|
103 | + case 'edit': |
|
104 | + $templateMain = 'wggithub_admin_settings.tpl'; |
|
105 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
106 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
107 | + $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
108 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
109 | + // Get Form |
|
110 | + $settingsObj = $settingsHandler->get($setId); |
|
111 | + $form = $settingsObj->getFormSettings(); |
|
112 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
113 | + break; |
|
114 | + case 'delete': |
|
115 | + $templateMain = 'wggithub_admin_settings.tpl'; |
|
116 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
117 | + $settingsObj = $settingsHandler->get($setId); |
|
118 | + $setToken = $settingsObj->getVar('set_token'); |
|
119 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
120 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
121 | + \redirect_header('settings.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
122 | + } |
|
123 | + if ($settingsHandler->delete($settingsObj)) { |
|
124 | + \redirect_header('settings.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
125 | + } else { |
|
126 | + $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
127 | + } |
|
128 | + } else { |
|
129 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
130 | + ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], |
|
131 | + $_SERVER['REQUEST_URI'], |
|
132 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $settingsObj->getVar('set_token'))); |
|
133 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
134 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
135 | + } |
|
136 | + break; |
|
137 | 137 | } |
138 | 138 | require __DIR__ . '/footer.php'; |
@@ -31,110 +31,110 @@ |
||
31 | 31 | // Request rm_id |
32 | 32 | $rmId = Request::getInt('rm_id'); |
33 | 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_readmes.tpl'; |
|
41 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
42 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_README, 'readmes.php?op=new', 'add'); |
|
43 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | - $readmesCount = $readmesHandler->getCountReadmes(); |
|
45 | - $readmesAll = $readmesHandler->getAllReadmes($start, $limit); |
|
46 | - $GLOBALS['xoopsTpl']->assign('readmes_count', $readmesCount); |
|
47 | - $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | - // Table view readmes |
|
50 | - if ($readmesCount > 0) { |
|
51 | - foreach (\array_keys($readmesAll) as $i) { |
|
52 | - $readme = $readmesAll[$i]->getValuesReadmes(); |
|
53 | - $GLOBALS['xoopsTpl']->append('readmes_list', $readme); |
|
54 | - unset($readme); |
|
55 | - } |
|
56 | - // Display Navigation |
|
57 | - if ($readmesCount > $limit) { |
|
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($readmesCount, $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_READMES); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'new': |
|
67 | - $templateMain = 'wggithub_admin_readmes.tpl'; |
|
68 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
69 | - $adminObject->addItemButton(_AM_WGGITHUB_READMES_LIST, 'readmes.php', 'list'); |
|
70 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | - // Form Create |
|
72 | - $readmesObj = $readmesHandler->create(); |
|
73 | - $form = $readmesObj->getFormReadmes(); |
|
74 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | - break; |
|
76 | - case 'save': |
|
77 | - // Security Check |
|
78 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | - \redirect_header('readmes.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | - } |
|
81 | - if ($rmId > 0) { |
|
82 | - $readmesObj = $readmesHandler->get($rmId); |
|
83 | - } else { |
|
84 | - $readmesObj = $readmesHandler->create(); |
|
85 | - } |
|
86 | - // Set Vars |
|
87 | - $readmesObj->setVar('rm_repoid', Request::getInt('rm_repoid', 0)); |
|
88 | - $readmesObj->setVar('rm_name', Request::getString('rm_name', '')); |
|
89 | - $readmesObj->setVar('rm_type', Request::getString('rm_type', '')); |
|
90 | - $readmesObj->setVar('rm_content', Request::getString('rm_content', '')); |
|
91 | - $readmesObj->setVar('rm_encoding', Request::getString('rm_encoding', '')); |
|
92 | - $readmesObj->setVar('rm_downloadurl', Request::getString('rm_downloadurl', '')); |
|
93 | - $readmeDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rm_datecreated')); |
|
94 | - $readmesObj->setVar('rm_datecreated', $readmeDatecreatedObj->getTimestamp()); |
|
95 | - $readmesObj->setVar('rm_submitter', Request::getInt('rm_submitter', 0)); |
|
96 | - // Insert Data |
|
97 | - if ($readmesHandler->insert($readmesObj)) { |
|
98 | - \redirect_header('readmes.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
99 | - } |
|
100 | - // Get Form |
|
101 | - $GLOBALS['xoopsTpl']->assign('error', $readmesObj->getHtmlErrors()); |
|
102 | - $form = $readmesObj->getFormReadmes(); |
|
103 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
104 | - break; |
|
105 | - case 'edit': |
|
106 | - $templateMain = 'wggithub_admin_readmes.tpl'; |
|
107 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
108 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_README, 'readmes.php?op=new', 'add'); |
|
109 | - $adminObject->addItemButton(_AM_WGGITHUB_READMES_LIST, 'readmes.php', 'list'); |
|
110 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
111 | - // Get Form |
|
112 | - $readmesObj = $readmesHandler->get($rmId); |
|
113 | - $form = $readmesObj->getFormReadmes(); |
|
114 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
115 | - break; |
|
116 | - case 'delete': |
|
117 | - $templateMain = 'wggithub_admin_readmes.tpl'; |
|
118 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
119 | - $readmesObj = $readmesHandler->get($rmId); |
|
120 | - $rmName = $readmesObj->getVar('rm_name'); |
|
121 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
122 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
123 | - \redirect_header('readmes.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
124 | - } |
|
125 | - if ($readmesHandler->delete($readmesObj)) { |
|
126 | - \redirect_header('readmes.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
127 | - } else { |
|
128 | - $GLOBALS['xoopsTpl']->assign('error', $readmesObj->getHtmlErrors()); |
|
129 | - } |
|
130 | - } else { |
|
131 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
132 | - ['ok' => 1, 'rm_id' => $rmId, 'op' => 'delete'], |
|
133 | - $_SERVER['REQUEST_URI'], |
|
134 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $readmesObj->getVar('rm_name'))); |
|
135 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
136 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
137 | - } |
|
138 | - break; |
|
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_readmes.tpl'; |
|
41 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
42 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_README, 'readmes.php?op=new', 'add'); |
|
43 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | + $readmesCount = $readmesHandler->getCountReadmes(); |
|
45 | + $readmesAll = $readmesHandler->getAllReadmes($start, $limit); |
|
46 | + $GLOBALS['xoopsTpl']->assign('readmes_count', $readmesCount); |
|
47 | + $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | + // Table view readmes |
|
50 | + if ($readmesCount > 0) { |
|
51 | + foreach (\array_keys($readmesAll) as $i) { |
|
52 | + $readme = $readmesAll[$i]->getValuesReadmes(); |
|
53 | + $GLOBALS['xoopsTpl']->append('readmes_list', $readme); |
|
54 | + unset($readme); |
|
55 | + } |
|
56 | + // Display Navigation |
|
57 | + if ($readmesCount > $limit) { |
|
58 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($readmesCount, $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_READMES); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'new': |
|
67 | + $templateMain = 'wggithub_admin_readmes.tpl'; |
|
68 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
69 | + $adminObject->addItemButton(_AM_WGGITHUB_READMES_LIST, 'readmes.php', 'list'); |
|
70 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | + // Form Create |
|
72 | + $readmesObj = $readmesHandler->create(); |
|
73 | + $form = $readmesObj->getFormReadmes(); |
|
74 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | + break; |
|
76 | + case 'save': |
|
77 | + // Security Check |
|
78 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | + \redirect_header('readmes.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | + } |
|
81 | + if ($rmId > 0) { |
|
82 | + $readmesObj = $readmesHandler->get($rmId); |
|
83 | + } else { |
|
84 | + $readmesObj = $readmesHandler->create(); |
|
85 | + } |
|
86 | + // Set Vars |
|
87 | + $readmesObj->setVar('rm_repoid', Request::getInt('rm_repoid', 0)); |
|
88 | + $readmesObj->setVar('rm_name', Request::getString('rm_name', '')); |
|
89 | + $readmesObj->setVar('rm_type', Request::getString('rm_type', '')); |
|
90 | + $readmesObj->setVar('rm_content', Request::getString('rm_content', '')); |
|
91 | + $readmesObj->setVar('rm_encoding', Request::getString('rm_encoding', '')); |
|
92 | + $readmesObj->setVar('rm_downloadurl', Request::getString('rm_downloadurl', '')); |
|
93 | + $readmeDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('rm_datecreated')); |
|
94 | + $readmesObj->setVar('rm_datecreated', $readmeDatecreatedObj->getTimestamp()); |
|
95 | + $readmesObj->setVar('rm_submitter', Request::getInt('rm_submitter', 0)); |
|
96 | + // Insert Data |
|
97 | + if ($readmesHandler->insert($readmesObj)) { |
|
98 | + \redirect_header('readmes.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
99 | + } |
|
100 | + // Get Form |
|
101 | + $GLOBALS['xoopsTpl']->assign('error', $readmesObj->getHtmlErrors()); |
|
102 | + $form = $readmesObj->getFormReadmes(); |
|
103 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
104 | + break; |
|
105 | + case 'edit': |
|
106 | + $templateMain = 'wggithub_admin_readmes.tpl'; |
|
107 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
108 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_README, 'readmes.php?op=new', 'add'); |
|
109 | + $adminObject->addItemButton(_AM_WGGITHUB_READMES_LIST, 'readmes.php', 'list'); |
|
110 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
111 | + // Get Form |
|
112 | + $readmesObj = $readmesHandler->get($rmId); |
|
113 | + $form = $readmesObj->getFormReadmes(); |
|
114 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
115 | + break; |
|
116 | + case 'delete': |
|
117 | + $templateMain = 'wggithub_admin_readmes.tpl'; |
|
118 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('readmes.php')); |
|
119 | + $readmesObj = $readmesHandler->get($rmId); |
|
120 | + $rmName = $readmesObj->getVar('rm_name'); |
|
121 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
122 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
123 | + \redirect_header('readmes.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
124 | + } |
|
125 | + if ($readmesHandler->delete($readmesObj)) { |
|
126 | + \redirect_header('readmes.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
127 | + } else { |
|
128 | + $GLOBALS['xoopsTpl']->assign('error', $readmesObj->getHtmlErrors()); |
|
129 | + } |
|
130 | + } else { |
|
131 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
132 | + ['ok' => 1, 'rm_id' => $rmId, 'op' => 'delete'], |
|
133 | + $_SERVER['REQUEST_URI'], |
|
134 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $readmesObj->getVar('rm_name'))); |
|
135 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
136 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
137 | + } |
|
138 | + break; |
|
139 | 139 | } |
140 | 140 | require __DIR__ . '/footer.php'; |