1 | <?php |
||
2 | /* |
||
3 | You may not change or alter any portion of this comment or credits |
||
4 | of supporting developers from this source code or any supporting source code |
||
5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | |||
7 | This program is distributed in the hope that it will be useful, |
||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | */ |
||
11 | /** |
||
12 | * wgSitenotice module for xoops |
||
13 | * |
||
14 | * @copyright XOOPS Project (https://xoops.org) |
||
15 | * @license GPL 2.0 or later |
||
16 | * @package wgsitenotice |
||
17 | * @since 1.0 |
||
18 | * @min_xoops 2.5.11 |
||
19 | * @author Goffy (xoops.wedega.com) - Email:<[email protected]> - Website:<https://xoops.wedega.com> |
||
20 | */ |
||
21 | |||
22 | use Xmf\Request; |
||
0 ignored issues
–
show
|
|||
23 | |||
24 | include_once __DIR__ . '/header.php'; |
||
25 | //It recovered the value of argument op in URL$ |
||
26 | $op = Request::getString('op', 'default'); |
||
27 | |||
28 | $oc_server = Request::getString('oc_server', 'default'); |
||
29 | if ('default' === $oc_server) { |
||
30 | $oc_server = $helper->getConfig('wgsitenotice_oc_server').'checkonline.php'; |
||
31 | } |
||
32 | |||
33 | $template_main = 'wgsitenotice_admin_checkonline.tpl'; |
||
34 | $GLOBALS['xoopsTpl']->assign('disclaimer', \_AM_WGSITENOTICE_OC_DISCLAIMER); |
||
35 | $GLOBALS['xoopsTpl']->assign('disclaimer_desc', \_AM_WGSITENOTICE_OC_DISCLAIMER_DESCR); |
||
36 | $GLOBALS['xoopsTpl']->assign('onlinecheck_server', \_MI_WGSITENOTICE_OC_SERVER); |
||
37 | $GLOBALS['xoopsTpl']->assign('oc_server', $oc_server); |
||
38 | $GLOBALS['xoopsTpl']->assign('start_search', \_AM_WGSITENOTICE_OC_START); |
||
39 | $GLOBALS['xoopsTpl']->assign('modPathIcon32', $modPathIcon32); |
||
40 | $GLOBALS['xoopsTpl']->assign('modPathIcon16', $modPathIcon16); |
||
41 | |||
42 | // Switch options |
||
43 | switch ($op) |
||
44 | { |
||
45 | case 'download': |
||
46 | // Request version_id |
||
47 | $version_id = Request::getInt('version_id'); |
||
48 | if (0 == $version_id) { |
||
49 | $GLOBALS['xoopsTpl']->assign('error',\_AM_WGSITENOTICE_OC_ERR_INVALID_PARAM); |
||
50 | break; |
||
51 | } |
||
52 | //$xml_text = \file_get_contents($oc_server.'?version_id='.$version_id); |
||
53 | $xml_text = $checkonlineHandler->getData($oc_server . '?version_id='.$version_id); |
||
54 | // echo $xml_text; |
||
55 | $xml_arr = $checkonlineHandler->readXML($xml_text); |
||
56 | // var_dump($xml_arr); |
||
57 | if (!$xml_arr) { |
||
58 | //error when loading xml |
||
59 | $GLOBALS['xoopsTpl']->assign('error',\str_replace('%s', $oc_server, \_AM_WGSITENOTICE_OC_ERR_READ_XML)); |
||
60 | } else { |
||
61 | echo $oc_server.'?version_id='.$version_id; |
||
62 | echo $xml_arr->status_access; |
||
63 | |||
64 | if ('allowed' == $xml_arr->status_access) { |
||
65 | //download is allowed by the owner of the named server and save in table mod_wgsitenotice_versions |
||
66 | foreach ($xml_arr->versions->version as $onlineversion) { |
||
67 | //first create version |
||
68 | $versionsObj = $versionsHandler->create(); |
||
69 | // Set Vars |
||
70 | $versionsObj->setVar('version_name', $checkonlineHandler->xml2str($onlineversion->version_name)); |
||
71 | $versionsObj->setVar('version_lang', $checkonlineHandler->xml2str($onlineversion->version_lang)); |
||
72 | $versionsObj->setVar('version_descr', $checkonlineHandler->xml2str($onlineversion->version_descr)); |
||
73 | $versionsObj->setVar('version_author', $checkonlineHandler->xml2str($onlineversion->version_author)); |
||
74 | $versionsObj->setVar('version_date', $onlineversion->version_date); |
||
75 | // Insert Data |
||
76 | if ($versionsHandler->insert($versionsObj)) { |
||
77 | //than create content |
||
78 | $cont_errors = 0; |
||
79 | foreach ($xml_arr->versions->version->contents->content as $onlinecontent) { |
||
80 | $contentsObj = $contentsHandler->create(); |
||
81 | // Set Vars |
||
82 | $contentsObj->setVar('cont_version_id', $versionsObj->getVar('version_id')); |
||
83 | $contentsObj->setVar('cont_header', $checkonlineHandler->xml2str($onlinecontent->cont_header)); |
||
84 | /* echo "<br/>----------------------------------------------<br/>".$checkonlineHandler->xml2str($onlinecontent->cont_text);die; */ |
||
85 | $contentsObj->setVar('cont_text', $checkonlineHandler->xml2str($onlinecontent->cont_text)); |
||
86 | $contentsObj->setVar('cont_weight', $onlinecontent->cont_weight); |
||
87 | $contentsObj->setVar('cont_date', $onlinecontent->cont_date); |
||
88 | // Insert Data |
||
89 | if (!$contentsHandler->insert($contentsObj)) { |
||
90 | $cont_errors++; |
||
91 | } |
||
92 | } |
||
93 | if ($cont_errors > 0) { |
||
94 | \redirect_header('versions.php?op=list', 4, \str_replace('%e', $cont_errors, \_AM_WGSITENOTICE_OC_ERR_ADDCONT)); |
||
95 | } else { |
||
96 | \redirect_header('versions.php?op=list', 2, \_AM_WGSITENOTICE_FORMOK); |
||
97 | } |
||
98 | } |
||
99 | } |
||
100 | } else if ('forbidden' == $xml_arr->status_access) { |
||
101 | $GLOBALS['xoopsTpl']->assign('error',\_AM_WGSITENOTICE_OC_ERR_FORBIDDEN); |
||
102 | } else { |
||
103 | $GLOBALS['xoopsTpl']->assign('error',\str_replace('%s', $oc_server, \_AM_WGSITENOTICE_OC_ERR_CONNECT)); |
||
104 | } |
||
105 | } |
||
106 | break; |
||
107 | |||
108 | case 'checkonline': |
||
109 | $GLOBALS['xoopsTpl']->assign('wgsitenotice_url', \WGSITENOTICE_URL); |
||
110 | $GLOBALS['xoopsTpl']->assign('wgsitenotice_upload_url', \WGSITENOTICE_UPLOAD_URL); |
||
111 | |||
112 | // $xml_text = \file_get_contents($oc_server); |
||
113 | $xml_text = $checkonlineHandler->getData($oc_server); |
||
114 | $xml_arr = $checkonlineHandler->readXML($xml_text); |
||
115 | // echo "xml_text:<br/>".$xml_text; |
||
116 | // echo "<br/><br/>var_dump xml_arr:<br/>".var_dump($xml_arr); |
||
117 | |||
118 | if (!$xml_arr) { |
||
119 | $GLOBALS['xoopsTpl']->assign('error',\str_replace('%s', $oc_server, \_AM_WGSITENOTICE_OC_ERR_READ_XML)); |
||
120 | } else { |
||
121 | // echo "<br/>status_access:".$xml_arr->status_access; |
||
122 | if ('allowed' == $xml_arr->status_access) { |
||
123 | if ($xml_arr->versions_rows > 0) { |
||
124 | //download is allowed by the owner of the named server |
||
125 | foreach ($xml_arr->versions->version as $onlineversion) { |
||
126 | $version['id'] = $onlineversion->version_id; |
||
127 | $version['name'] = $checkonlineHandler->xml2str($onlineversion->version_name); |
||
128 | $version['lang'] = $checkonlineHandler->xml2str($onlineversion->version_lang); |
||
129 | $version['descr'] = $checkonlineHandler->xml2str($onlineversion->version_descr); |
||
130 | $version['author'] = $checkonlineHandler->xml2str($onlineversion->version_author); |
||
131 | $version['date'] = \formatTimestamp($onlineversion->version_date); |
||
132 | $GLOBALS['xoopsTpl']->append('versions_list', $version); |
||
133 | } |
||
134 | } else { |
||
135 | $GLOBALS['xoopsTpl']->assign('error',\_AM_WGSITENOTICE_OC_ERR_NO_VERSIONS); |
||
136 | } |
||
137 | } else if ('forbidden' == $xml_arr->status_access) { |
||
138 | $GLOBALS['xoopsTpl']->assign('error',\_AM_WGSITENOTICE_OC_ERR_FORBIDDEN); |
||
139 | } else { |
||
140 | $GLOBALS['xoopsTpl']->assign('error',\str_replace('%s', $oc_server, \_AM_WGSITENOTICE_OC_ERR_CONNECT)); |
||
141 | } |
||
142 | } |
||
143 | unset($version); |
||
144 | break; |
||
145 | case 'default': |
||
146 | default: |
||
147 | $template_main = 'wgsitenotice_admin_checkonline.tpl'; |
||
148 | $GLOBALS['xoopsTpl']->assign('navigation', $adminMenu->addNavigation(\basename(__FILE__))); |
||
149 | $GLOBALS['xoopsTpl']->assign('wgsitenotice_url', \WGSITENOTICE_URL); |
||
150 | $GLOBALS['xoopsTpl']->assign('wgsitenotice_upload_url', \WGSITENOTICE_UPLOAD_URL); |
||
151 | // Get Form |
||
152 | $checkonlineObj = $checkonlineHandler->create(); |
||
153 | $form = $checkonlineObj->getForm(); |
||
154 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
155 | break; |
||
156 | } |
||
157 | include_once __DIR__ . '/footer.php'; |
||
158 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths