@@ -19,9 +19,9 @@ |
||
19 | 19 | * @min_xoops 2.5.10 |
20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
21 | 21 | */ |
22 | -require __DIR__ . '/header.php'; |
|
22 | +require __DIR__.'/header.php'; |
|
23 | 23 | $templateMain = 'wggithub_admin_about.tpl'; |
24 | 24 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('about.php')); |
25 | 25 | $adminObject::setPaypal('6KJ7RW5DR3VTJ'); |
26 | 26 | $GLOBALS['xoopsTpl']->assign('about', $adminObject->renderAbout(false)); |
27 | -require __DIR__ . '/footer.php'; |
|
27 | +require __DIR__.'/footer.php'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | // It recovered the value of argument op in URL$ |
30 | 30 | $op = Request::getCmd('op', 'list'); |
31 | 31 | // Request dir_id |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | // Display Navigation |
57 | 57 | if ($directoriesCount > $limit) { |
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
58 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
60 | 60 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
61 | 61 | } |
62 | 62 | } else { |
@@ -161,4 +161,4 @@ discard block |
||
161 | 161 | } |
162 | 162 | break; |
163 | 163 | } |
164 | -require __DIR__ . '/footer.php'; |
|
164 | +require __DIR__.'/footer.php'; |
@@ -31,109 +31,109 @@ |
||
31 | 31 | // Request dir_id |
32 | 32 | $dirId = Request::getInt('dir_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_directories.tpl'; |
|
41 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
42 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_DIRECTORY, 'directories.php?op=new', 'add'); |
|
43 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | - $directoriesCount = $directoriesHandler->getCountDirectories(); |
|
45 | - $directoriesAll = $directoriesHandler->getAllDirectories($start, $limit); |
|
46 | - $GLOBALS['xoopsTpl']->assign('directories_count', $directoriesCount); |
|
47 | - $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | - $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | - // Table view directories |
|
50 | - if ($directoriesCount > 0) { |
|
51 | - foreach (\array_keys($directoriesAll) as $i) { |
|
52 | - $directory = $directoriesAll[$i]->getValuesDirectories(); |
|
53 | - $GLOBALS['xoopsTpl']->append('directories_list', $directory); |
|
54 | - unset($directory); |
|
55 | - } |
|
56 | - // Display Navigation |
|
57 | - if ($directoriesCount > $limit) { |
|
58 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | - $pagenav = new \XoopsPageNav($directoriesCount, $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_DIRECTORIES); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'new': |
|
67 | - $templateMain = 'wggithub_admin_directories.tpl'; |
|
68 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
69 | - $adminObject->addItemButton(_AM_WGGITHUB_DIRECTORIES_LIST, 'directories.php', 'list'); |
|
70 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | - // Form Create |
|
72 | - $directoriesObj = $directoriesHandler->create(); |
|
73 | - $form = $directoriesObj->getFormDirectories(); |
|
74 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | - break; |
|
76 | - case 'save': |
|
77 | - // Security Check |
|
78 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | - \redirect_header('directories.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | - } |
|
81 | - if ($dirId > 0) { |
|
82 | - $directoriesObj = $directoriesHandler->get($dirId); |
|
83 | - } else { |
|
84 | - $directoriesObj = $directoriesHandler->create(); |
|
85 | - } |
|
86 | - // Set Vars |
|
87 | - $directoriesObj->setVar('dir_name', Request::getString('dir_name', '')); |
|
88 | - $directoriesObj->setVar('dir_type', Request::getInt('dir_type', 0)); |
|
89 | - $directoriesObj->setVar('dir_autoupdate', Request::getInt('dir_autoupdate', 0)); |
|
90 | - $directoriesObj->setVar('dir_online', Request::getInt('dir_online', 0)); |
|
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_directories.tpl'; |
|
41 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
42 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_DIRECTORY, 'directories.php?op=new', 'add'); |
|
43 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
44 | + $directoriesCount = $directoriesHandler->getCountDirectories(); |
|
45 | + $directoriesAll = $directoriesHandler->getAllDirectories($start, $limit); |
|
46 | + $GLOBALS['xoopsTpl']->assign('directories_count', $directoriesCount); |
|
47 | + $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
|
48 | + $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
|
49 | + // Table view directories |
|
50 | + if ($directoriesCount > 0) { |
|
51 | + foreach (\array_keys($directoriesAll) as $i) { |
|
52 | + $directory = $directoriesAll[$i]->getValuesDirectories(); |
|
53 | + $GLOBALS['xoopsTpl']->append('directories_list', $directory); |
|
54 | + unset($directory); |
|
55 | + } |
|
56 | + // Display Navigation |
|
57 | + if ($directoriesCount > $limit) { |
|
58 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($directoriesCount, $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_DIRECTORIES); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'new': |
|
67 | + $templateMain = 'wggithub_admin_directories.tpl'; |
|
68 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
69 | + $adminObject->addItemButton(_AM_WGGITHUB_DIRECTORIES_LIST, 'directories.php', 'list'); |
|
70 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
71 | + // Form Create |
|
72 | + $directoriesObj = $directoriesHandler->create(); |
|
73 | + $form = $directoriesObj->getFormDirectories(); |
|
74 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
75 | + break; |
|
76 | + case 'save': |
|
77 | + // Security Check |
|
78 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
79 | + \redirect_header('directories.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
80 | + } |
|
81 | + if ($dirId > 0) { |
|
82 | + $directoriesObj = $directoriesHandler->get($dirId); |
|
83 | + } else { |
|
84 | + $directoriesObj = $directoriesHandler->create(); |
|
85 | + } |
|
86 | + // Set Vars |
|
87 | + $directoriesObj->setVar('dir_name', Request::getString('dir_name', '')); |
|
88 | + $directoriesObj->setVar('dir_type', Request::getInt('dir_type', 0)); |
|
89 | + $directoriesObj->setVar('dir_autoupdate', Request::getInt('dir_autoupdate', 0)); |
|
90 | + $directoriesObj->setVar('dir_online', Request::getInt('dir_online', 0)); |
|
91 | 91 | $directoriesObj->setVar('dir_filterrelease', Request::getInt('dir_filterrelease', 0)); |
92 | - $directoryDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('dir_datecreated')); |
|
93 | - $directoriesObj->setVar('dir_datecreated', $directoryDatecreatedObj->getTimestamp()); |
|
94 | - $directoriesObj->setVar('dir_submitter', Request::getInt('dir_submitter', 0)); |
|
95 | - // Insert Data |
|
96 | - if ($directoriesHandler->insert($directoriesObj)) { |
|
97 | - \redirect_header('directories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
98 | - } |
|
99 | - // Get Form |
|
100 | - $GLOBALS['xoopsTpl']->assign('error', $directoriesObj->getHtmlErrors()); |
|
101 | - $form = $directoriesObj->getFormDirectories(); |
|
102 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
103 | - break; |
|
104 | - case 'edit': |
|
105 | - $templateMain = 'wggithub_admin_directories.tpl'; |
|
106 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
107 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_DIRECTORY, 'directories.php?op=new', 'add'); |
|
108 | - $adminObject->addItemButton(_AM_WGGITHUB_DIRECTORIES_LIST, 'directories.php', 'list'); |
|
109 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
110 | - // Get Form |
|
111 | - $directoriesObj = $directoriesHandler->get($dirId); |
|
112 | - $form = $directoriesObj->getFormDirectories(); |
|
113 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
114 | - break; |
|
115 | - case 'delete': |
|
116 | - $templateMain = 'wggithub_admin_directories.tpl'; |
|
117 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
118 | - $directoriesObj = $directoriesHandler->get($dirId); |
|
119 | - $dirName = $directoriesObj->getVar('dir_name'); |
|
120 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
121 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
122 | - \redirect_header('directories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
123 | - } |
|
124 | - if ($directoriesHandler->delete($directoriesObj)) { |
|
125 | - \redirect_header('directories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
126 | - } else { |
|
127 | - $GLOBALS['xoopsTpl']->assign('error', $directoriesObj->getHtmlErrors()); |
|
128 | - } |
|
129 | - } else { |
|
130 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
131 | - ['ok' => 1, 'dir_id' => $dirId, 'op' => 'delete'], |
|
132 | - $_SERVER['REQUEST_URI'], |
|
133 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $directoriesObj->getVar('dir_name'))); |
|
134 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
135 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
136 | - } |
|
137 | - break; |
|
92 | + $directoryDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('dir_datecreated')); |
|
93 | + $directoriesObj->setVar('dir_datecreated', $directoryDatecreatedObj->getTimestamp()); |
|
94 | + $directoriesObj->setVar('dir_submitter', Request::getInt('dir_submitter', 0)); |
|
95 | + // Insert Data |
|
96 | + if ($directoriesHandler->insert($directoriesObj)) { |
|
97 | + \redirect_header('directories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
98 | + } |
|
99 | + // Get Form |
|
100 | + $GLOBALS['xoopsTpl']->assign('error', $directoriesObj->getHtmlErrors()); |
|
101 | + $form = $directoriesObj->getFormDirectories(); |
|
102 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
103 | + break; |
|
104 | + case 'edit': |
|
105 | + $templateMain = 'wggithub_admin_directories.tpl'; |
|
106 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
107 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_DIRECTORY, 'directories.php?op=new', 'add'); |
|
108 | + $adminObject->addItemButton(_AM_WGGITHUB_DIRECTORIES_LIST, 'directories.php', 'list'); |
|
109 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
110 | + // Get Form |
|
111 | + $directoriesObj = $directoriesHandler->get($dirId); |
|
112 | + $form = $directoriesObj->getFormDirectories(); |
|
113 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
114 | + break; |
|
115 | + case 'delete': |
|
116 | + $templateMain = 'wggithub_admin_directories.tpl'; |
|
117 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('directories.php')); |
|
118 | + $directoriesObj = $directoriesHandler->get($dirId); |
|
119 | + $dirName = $directoriesObj->getVar('dir_name'); |
|
120 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
121 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
122 | + \redirect_header('directories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
123 | + } |
|
124 | + if ($directoriesHandler->delete($directoriesObj)) { |
|
125 | + \redirect_header('directories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
126 | + } else { |
|
127 | + $GLOBALS['xoopsTpl']->assign('error', $directoriesObj->getHtmlErrors()); |
|
128 | + } |
|
129 | + } else { |
|
130 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
131 | + ['ok' => 1, 'dir_id' => $dirId, 'op' => 'delete'], |
|
132 | + $_SERVER['REQUEST_URI'], |
|
133 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $directoriesObj->getVar('dir_name'))); |
|
134 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
135 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
136 | + } |
|
137 | + break; |
|
138 | 138 | } |
139 | 139 | require __DIR__ . '/footer.php'; |
@@ -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 |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | use XoopsModules\Wggithub\Common; |
25 | 25 | |
26 | -include_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
27 | -require __DIR__ . '/header.php'; |
|
26 | +include_once \dirname(__DIR__).'/preloads/autoloader.php'; |
|
27 | +require __DIR__.'/header.php'; |
|
28 | 28 | |
29 | 29 | // Template Index |
30 | 30 | $templateMain = 'wggithub_admin_index.tpl'; |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | // InfoBox Statistics |
41 | 41 | $adminObject->addInfoBox(_AM_WGGITHUB_STATISTICS); |
42 | 42 | // Info elements |
43 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_SETTINGS . '</label>', $countSettings)); |
|
44 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_DIRECTORIES . '</label>', $countDirectories)); |
|
45 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_LOGS . '</label>', $countLogs)); |
|
46 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_REPOSITORIES . '</label>', $countRepositories)); |
|
47 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_READMES . '</label>', $countReadmes)); |
|
48 | -$adminObject->addInfoBoxLine(\sprintf( '<label>' . _AM_WGGITHUB_THEREARE_RELEASES . '</label>', $countReleases)); |
|
43 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_SETTINGS.'</label>', $countSettings)); |
|
44 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_DIRECTORIES.'</label>', $countDirectories)); |
|
45 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_LOGS.'</label>', $countLogs)); |
|
46 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_REPOSITORIES.'</label>', $countRepositories)); |
|
47 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_READMES.'</label>', $countReadmes)); |
|
48 | +$adminObject->addInfoBoxLine(\sprintf('<label>'._AM_WGGITHUB_THEREARE_RELEASES.'</label>', $countReleases)); |
|
49 | 49 | |
50 | 50 | // Upload Folders |
51 | 51 | $configurator = new Common\Configurator(); |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | // Test Data |
66 | 66 | if ($helper->getConfig('displaySampleButton')) { |
67 | 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'); |
|
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 | 72 | $adminObject->displayButton('left'); |
73 | 73 | } |
74 | 74 | $GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex()); |
75 | 75 | // End Test Data |
76 | -require __DIR__ . '/footer.php'; |
|
76 | +require __DIR__.'/footer.php'; |
@@ -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'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | // It recovered the value of argument op in URL$ |
30 | 30 | $op = Request::getCmd('op', 'list'); |
31 | 31 | // Request rel_id |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | // Display Navigation |
57 | 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); |
|
58 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($releasesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
60 | 60 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
61 | 61 | } |
62 | 62 | } else { |
@@ -138,4 +138,4 @@ discard block |
||
138 | 138 | } |
139 | 139 | break; |
140 | 140 | } |
141 | -require __DIR__ . '/footer.php'; |
|
141 | +require __DIR__.'/footer.php'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | // It recovered the value of argument op in URL$ |
30 | 30 | $op = Request::getCmd('op', 'list'); |
31 | 31 | // Request repo_id |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | // Display Navigation |
57 | 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); |
|
58 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
60 | 60 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
61 | 61 | } |
62 | 62 | } else { |
@@ -168,4 +168,4 @@ discard block |
||
168 | 168 | } |
169 | 169 | break; |
170 | 170 | } |
171 | -require __DIR__ . '/footer.php'; |
|
171 | +require __DIR__.'/footer.php'; |
@@ -31,116 +31,116 @@ |
||
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 | - \redirect_header('repositories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
105 | - } |
|
106 | - // Get Form |
|
107 | - $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
108 | - $form = $repositoriesObj->getFormRepositories(); |
|
109 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
110 | - break; |
|
111 | - case 'edit': |
|
112 | - $templateMain = 'wggithub_admin_repositories.tpl'; |
|
113 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
114 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
115 | - $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
116 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
117 | - // Get Form |
|
118 | - $repositoriesObj = $repositoriesHandler->get($repoId); |
|
119 | - $form = $repositoriesObj->getFormRepositories(); |
|
120 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
121 | - break; |
|
122 | - case 'delete': |
|
123 | - $templateMain = 'wggithub_admin_repositories.tpl'; |
|
124 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
125 | - $repositoriesObj = $repositoriesHandler->get($repoId); |
|
126 | - $repoName = $repositoriesObj->getVar('repo_name'); |
|
127 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
128 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
129 | - \redirect_header('repositories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
130 | - } |
|
131 | - if ($repositoriesHandler->delete($repositoriesObj)) { |
|
132 | - \redirect_header('repositories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
133 | - } else { |
|
134 | - $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
135 | - } |
|
136 | - } else { |
|
137 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
138 | - ['ok' => 1, 'repo_id' => $repoId, 'op' => 'delete'], |
|
139 | - $_SERVER['REQUEST_URI'], |
|
140 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $repositoriesObj->getVar('repo_name'))); |
|
141 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
142 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
143 | - } |
|
144 | - 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 | + \redirect_header('repositories.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
105 | + } |
|
106 | + // Get Form |
|
107 | + $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
108 | + $form = $repositoriesObj->getFormRepositories(); |
|
109 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
110 | + break; |
|
111 | + case 'edit': |
|
112 | + $templateMain = 'wggithub_admin_repositories.tpl'; |
|
113 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
114 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_REPOSITORY, 'repositories.php?op=new', 'add'); |
|
115 | + $adminObject->addItemButton(_AM_WGGITHUB_REPOSITORIES_LIST, 'repositories.php', 'list'); |
|
116 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
117 | + // Get Form |
|
118 | + $repositoriesObj = $repositoriesHandler->get($repoId); |
|
119 | + $form = $repositoriesObj->getFormRepositories(); |
|
120 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
121 | + break; |
|
122 | + case 'delete': |
|
123 | + $templateMain = 'wggithub_admin_repositories.tpl'; |
|
124 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('repositories.php')); |
|
125 | + $repositoriesObj = $repositoriesHandler->get($repoId); |
|
126 | + $repoName = $repositoriesObj->getVar('repo_name'); |
|
127 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
128 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
129 | + \redirect_header('repositories.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
130 | + } |
|
131 | + if ($repositoriesHandler->delete($repositoriesObj)) { |
|
132 | + \redirect_header('repositories.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
133 | + } else { |
|
134 | + $GLOBALS['xoopsTpl']->assign('error', $repositoriesObj->getHtmlErrors()); |
|
135 | + } |
|
136 | + } else { |
|
137 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
138 | + ['ok' => 1, 'repo_id' => $repoId, 'op' => 'delete'], |
|
139 | + $_SERVER['REQUEST_URI'], |
|
140 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $repositoriesObj->getVar('repo_name'))); |
|
141 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
142 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
143 | + } |
|
144 | + break; |
|
145 | 145 | } |
146 | 146 | 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(); |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
21 | 21 | */ |
22 | 22 | |
23 | -include dirname(__DIR__, 3) . '/include/cp_header.php'; |
|
24 | -include_once \dirname(__DIR__) . '/include/common.php'; |
|
23 | +include dirname(__DIR__, 3).'/include/cp_header.php'; |
|
24 | +include_once \dirname(__DIR__).'/include/common.php'; |
|
25 | 25 | |
26 | -$sysPathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons16'); |
|
27 | -$sysPathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('sysicons32'); |
|
26 | +$sysPathIcon16 = '../'.$GLOBALS['xoopsModule']->getInfo('sysicons16'); |
|
27 | +$sysPathIcon32 = '../'.$GLOBALS['xoopsModule']->getInfo('sysicons32'); |
|
28 | 28 | $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').'/'; |
|
31 | 31 | |
32 | 32 | // Get instance of module |
33 | 33 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
@@ -40,7 +40,7 @@ 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'; |
|
43 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
44 | 44 | $xoopsTpl = new \XoopsTpl(); |
45 | 45 | } |
46 | 46 | |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | $GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32); |
65 | 65 | |
66 | 66 | $adminObject = \Xmf\Module\Admin::getInstance(); |
67 | -$style = WGGITHUB_URL . '/assets/css/admin/style.css'; |
|
67 | +$style = WGGITHUB_URL.'/assets/css/admin/style.css'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | // It recovered the value of argument op in URL$ |
30 | 30 | $op = Request::getCmd('op', 'list'); |
31 | 31 | // Request set_id |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | // Display Navigation |
57 | 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); |
|
58 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
59 | + $pagenav = new \XoopsPageNav($settingsCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
60 | 60 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
61 | 61 | } |
62 | 62 | } else { |
@@ -135,4 +135,4 @@ discard block |
||
135 | 135 | } |
136 | 136 | break; |
137 | 137 | } |
138 | -require __DIR__ . '/footer.php'; |
|
138 | +require __DIR__.'/footer.php'; |
@@ -31,113 +31,113 @@ |
||
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)) { |
|
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 | 96 | if (Request::getInt('set_primary', 0) > 0) { |
97 | 97 | $newSetId = $settingsObj->getNewInsertedIdSettings(); |
98 | 98 | $setId = $setId > 0 ? $setId : $newSetId; |
99 | 99 | $settingsHandler->setPrimarySetting($setId); |
100 | 100 | } |
101 | - \redirect_header('settings.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
102 | - } |
|
103 | - // Get Form |
|
104 | - $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
105 | - $form = $settingsObj->getFormSettings(); |
|
106 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
107 | - break; |
|
108 | - case 'edit': |
|
109 | - $templateMain = 'wggithub_admin_settings.tpl'; |
|
110 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
111 | - $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
112 | - $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
113 | - $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
114 | - // Get Form |
|
115 | - $settingsObj = $settingsHandler->get($setId); |
|
116 | - $form = $settingsObj->getFormSettings(); |
|
117 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
118 | - break; |
|
119 | - case 'delete': |
|
120 | - $templateMain = 'wggithub_admin_settings.tpl'; |
|
121 | - $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
122 | - $settingsObj = $settingsHandler->get($setId); |
|
123 | - $setToken = $settingsObj->getVar('set_token'); |
|
124 | - if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
125 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
126 | - \redirect_header('settings.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
127 | - } |
|
128 | - if ($settingsHandler->delete($settingsObj)) { |
|
129 | - \redirect_header('settings.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
130 | - } else { |
|
131 | - $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
132 | - } |
|
133 | - } else { |
|
134 | - $xoopsconfirm = new Common\XoopsConfirm( |
|
135 | - ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], |
|
136 | - $_SERVER['REQUEST_URI'], |
|
137 | - \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $settingsObj->getVar('set_token'))); |
|
138 | - $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
139 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
140 | - } |
|
141 | - break; |
|
101 | + \redirect_header('settings.php?op=list', 2, _AM_WGGITHUB_FORM_OK); |
|
102 | + } |
|
103 | + // Get Form |
|
104 | + $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
105 | + $form = $settingsObj->getFormSettings(); |
|
106 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
107 | + break; |
|
108 | + case 'edit': |
|
109 | + $templateMain = 'wggithub_admin_settings.tpl'; |
|
110 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
111 | + $adminObject->addItemButton(_AM_WGGITHUB_ADD_SETTING, 'settings.php?op=new', 'add'); |
|
112 | + $adminObject->addItemButton(_AM_WGGITHUB_SETTINGS_LIST, 'settings.php', 'list'); |
|
113 | + $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
|
114 | + // Get Form |
|
115 | + $settingsObj = $settingsHandler->get($setId); |
|
116 | + $form = $settingsObj->getFormSettings(); |
|
117 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
118 | + break; |
|
119 | + case 'delete': |
|
120 | + $templateMain = 'wggithub_admin_settings.tpl'; |
|
121 | + $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('settings.php')); |
|
122 | + $settingsObj = $settingsHandler->get($setId); |
|
123 | + $setToken = $settingsObj->getVar('set_token'); |
|
124 | + if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
|
125 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
126 | + \redirect_header('settings.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
|
127 | + } |
|
128 | + if ($settingsHandler->delete($settingsObj)) { |
|
129 | + \redirect_header('settings.php', 3, _AM_WGGITHUB_FORM_DELETE_OK); |
|
130 | + } else { |
|
131 | + $GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors()); |
|
132 | + } |
|
133 | + } else { |
|
134 | + $xoopsconfirm = new Common\XoopsConfirm( |
|
135 | + ['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], |
|
136 | + $_SERVER['REQUEST_URI'], |
|
137 | + \sprintf(_AM_WGGITHUB_FORM_SURE_DELETE, $settingsObj->getVar('set_token'))); |
|
138 | + $form = $xoopsconfirm->getFormXoopsConfirm(); |
|
139 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
140 | + } |
|
141 | + break; |
|
142 | 142 | } |
143 | 143 | require __DIR__ . '/footer.php'; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | use Xmf\Request; |
23 | 23 | |
24 | -include __DIR__ . '/header.php'; |
|
24 | +include __DIR__.'/header.php'; |
|
25 | 25 | |
26 | 26 | $adminObject = \Xmf\Module\Admin::getInstance(); |
27 | 27 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $fb_content = Request::getText('fb_content', ''); |
61 | 61 | $fb_content = \str_replace(["\r\n", "\n", "\r"], '<br>', $fb_content); //clean line break from dhtmltextarea |
62 | 62 | |
63 | - $title = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); |
|
64 | - $body = \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '<br>'; |
|
65 | - $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '<br>'; |
|
66 | - $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '<br>'; |
|
67 | - $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '<br><br>'; |
|
68 | - $body .= \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':<br>'; |
|
63 | + $title = \constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_FOR').$GLOBALS['xoopsModule']->getVar('dirname'); |
|
64 | + $body = \constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME').': '.$your_name.'<br>'; |
|
65 | + $body .= \constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL').': '.$your_mail.'<br>'; |
|
66 | + $body .= \constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE').': '.$your_site.'<br>'; |
|
67 | + $body .= \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE').': '.$fb_type.'<br><br>'; |
|
68 | + $body .= \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_CONTENT').':<br>'; |
|
69 | 69 | $body .= $fb_content; |
70 | 70 | $xoopsMailer = xoops_getMailer(); |
71 | 71 | $xoopsMailer->useMail(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $xoopsMailer->setBody($body); |
78 | 78 | $ret = $xoopsMailer->send(); |
79 | 79 | if ($ret) { |
80 | - \redirect_header('index.php', 3, \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS')); |
|
80 | + \redirect_header('index.php', 3, \constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_SUCCESS')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // show form with content again |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | $feedback->type = $fb_type; |
88 | 88 | $feedback->content = $fb_content; |
89 | 89 | echo '<div style="text-align:center;width: 80%; padding: 10px; border: 2px solid #ff0000; color: #ff0000; margin-right:auto;margin-left:auto;"> |
90 | - <h3>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR') . '</h3> |
|
90 | + <h3>' . \constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_ERROR').'</h3> |
|
91 | 91 | </div>'; |
92 | 92 | $form = $feedback->getFormFeedback(); |
93 | 93 | $form->display(); |
94 | 94 | |
95 | 95 | break; |
96 | 96 | } |
97 | -require __DIR__ . '/footer.php'; |
|
97 | +require __DIR__.'/footer.php'; |