Issues (525)

checkonline.php (3 issues)

Labels
Severity
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
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
use XoopsModules\Wgsitenotice\Helper;
24
25
$dirname = \basename(__DIR__);
26
require_once \dirname(__DIR__) . '/' . $dirname . '/preloads/autoloader.php';
27
28
//\defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
29
include \dirname(__DIR__, 2) . '/mainfile.php';
30
require __DIR__ . '/header.php';
31
32
$helper = \XoopsModules\Wgsitenotice\Helper::getInstance();
33
echo "<?xml version='1.0' encoding='utf-8'?>\n";
34
35
/* <?xml version="1.0" encoding="utf-8"?> */
36
echo "<document>\n";
37
echo "<status_connect>successful</status_connect>\n";
38
39
$version_id = Request::getInt('version_id');
40
echo '<version_id>' . $version_id . "</version_id>\n";
41
42
$oc_allowed = $helper->getConfig('wgsitenotice_oc_allowed');
43
44
if (1 == $oc_allowed) {
45
    //download of my version is allowed
46
    echo "<status_access>allowed</status_access>\n";
47
    $version_crit = new \CriteriaCompo();
0 ignored issues
show
The type CriteriaCompo was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
48
    $version_crit->setSort('version_id ASC, version_name');
49
    $version_crit->setOrder('ASC');
50
    if ($version_id > 0) $version_crit->add(new \Criteria('version_id', $version_id));
0 ignored issues
show
The type Criteria was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
51
    $version_crit->add(new \Criteria('version_online', '1'));
52
    $versions_rows = $versionsHandler->getCount($version_crit);
53
    echo '<versions_rows>' . $versions_rows . "</versions_rows>\n";
54
    $versions_arr = $versionsHandler->getAll($version_crit);
55
    unset($version_crit);
56
    if ($versions_rows > 0)
57
    {
58
        echo "<versions>\n";
59
        foreach (\array_keys($versions_arr) as $i) {
60
            echo "\t<version>\n";
61
            echo "\t<version_id>".$versions_arr[$i]->getVar('version_id')."</version_id>\n";
62
            echo "\t<version_name>".$versions_arr[$i]->getVar('version_name')."</version_name>\n";
63
            echo "\t<version_lang>".$versions_arr[$i]->getVar('version_lang')."</version_lang>\n";
64
            echo "\t<version_descr>".$versions_arr[$i]->getVar('version_descr')."</version_descr>\n";
65
            echo "\t<version_author>".$versions_arr[$i]->getVar('version_author')."</version_author>\n";
66
            echo "\t<version_date>".$versions_arr[$i]->getVar('version_date')."</version_date>\n";
67
68
            if ($version_id > 0) {
69
                echo "\t\t<contents>\n";
70
                $cont_crit = new \CriteriaCompo();
71
                $cont_crit->setSort('cont_weight');
72
                $cont_crit->setOrder('ASC');
73
                $cont_crit->add(new \Criteria('cont_version_id', $version_id));
74
                $contents_rows = $contentsHandler->getCount($cont_crit);
75
                $contents_arr = $contentsHandler->getAll($cont_crit);
76
                unset($cont_crit);
77
                if ($contents_rows > 0) {
78
                    foreach (\array_keys($contents_arr) as $j) {
79
                        echo "\t\t\t<content>\n";
80
                        echo "\t\t\t\t<cont_id>".$contents_arr[$j]->getVar('cont_id')."</cont_id>\n";
81
                        echo "\t\t\t\t<cont_version_id>".$contents_arr[$j]->getVar('cont_version_id')."</cont_version_id>\n";
82
                        $xml = $contents_arr[$j]->getVar('cont_header');
83
                        echo "\t\t\t\t<cont_header>".text2xml($xml)."</cont_header>\n";
84
                        $xml = $contents_arr[$j]->getVar('cont_text', 'n');
85
                        echo "\t\t\t\t<cont_text>".text2xml($xml)."</cont_text>\n";
86
                        echo "\t\t\t\t<cont_weight>".$contents_arr[$j]->getVar('cont_weight')."</cont_weight>\n";
87
                        echo "\t\t\t\t<cont_date>".$contents_arr[$j]->getVar('cont_date')."</cont_date>\n";
88
                        echo "\t\t\t</content>\n";
89
                    }
90
                }
91
                echo "\t\t</contents>\n";
92
            }
93
            echo "\t</version>\n";
94
        }
95
        echo "</versions>\n";
96
    }
97
} else {
98
    echo "<status_access>forbidden</status_access>\n";
99
}
100
echo "</document>\n";
101
102
function text2xml ($xml) {
103
    // replace html tags e.g. in case of links in the text
104
    $search = ['<', '>', '"'];
105
    $replace  = ['&lt;', '&gt;', '&quot;'];
106
107
    return \str_replace($search, $replace, (string)$xml);
108
}
109