ServerStats   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 30
c 2
b 0
f 0
dl 0
loc 56
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getServerStats() 0 51 4
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xoopsfaq\Common;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @copyright   XOOPS Project (https://xoops.org)
17
 * @license     GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
18
 * @author      mamba <[email protected]>
19
 */
20
trait ServerStats
21
{
22
    /**
23
     * serverStats()
24
     */
25
    public static function getServerStats(): string
26
    {
27
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
29
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
30
        \xoops_loadLanguage('common', $moduleDirName);
31
        $html = '';
32
        //        $sql   = 'SELECT metavalue';
33
        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
        //        $sql   .= " WHERE metakey='version' LIMIT 1";
35
        //        $query = $GLOBALS['xoopsDB']->query($sql);
36
        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'IMAGEINFO') . "</legend>\n";
38
        $html .= "<div style='padding: 8px;'>\n";
39
        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_' . 'METAVERSION') . $meta . "</div>\n";
40
        //        $html .= "<br>\n";
41
        //        $html .= "<br>\n";
42
        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SPHPINI') . "</div>\n";
43
        $html .= "<ul>\n";
44
45
        if (\function_exists('gd_info')) {
46
            $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDON') . '</span>';
47
            $gdlib = \gd_info();
48
            if (!empty(($gdlib))) {
49
                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
            }
51
        } else {
52
            $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDOFF') . '</span>';
53
        }
54
        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_' . 'OFF');
55
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
56
        //
57
        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>';
58
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
59
60
        $downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>';
61
        $html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SERVERUPLOADSTATUS') . $downloads;
62
63
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
64
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('post_max_size') . "</span></b>\n";
65
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . \ini_get('memory_limit') . "</span></b>\n";
66
        $html .= "</ul>\n";
67
        $html .= "<ul>\n";
68
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
69
        $html .= "</ul>\n";
70
        $html .= "<br>\n";
71
        $html .= \constant('CO_' . $moduleDirNameUpper . '_' . 'UPLOADPATHDSC') . "\n";
72
        $html .= '</div>';
73
        $html .= '</fieldset><br>';
74
75
        return $html;
76
    }
77
}
78