ServerStats::getServerStats()   A
last analyzed

Complexity

Conditions 5
Paths 12

Size

Total Lines 50
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 27
c 0
b 0
f 0
nc 12
nop 0
dl 0
loc 50
rs 9.1768
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Rssfit\Common;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
17
/**
18
 * @copyright   XOOPS Project (https://xoops.org)
19
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
20
 * @author      mamba <[email protected]>
21
 */
22
trait ServerStats
23
{
24
    /**
25
     * serverStats()
26
     *
27
     */
28
    public static function getServerStats(): string
29
    {
30
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
31
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
32
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
33
        \xoops_loadLanguage('common', $moduleDirName);
34
        $html = '';
35
        //        $sql   = 'SELECT metavalue';
36
        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
37
        //        $sql   .= " WHERE metakey='version' LIMIT 1";
38
        //        $query = $GLOBALS['xoopsDB']->query($sql);
39
        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
40
        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
41
        $html .= "<div style='padding: 8px;'>\n";
42
        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
43
        //        $html .= "<br>\n";
44
        //        $html .= "<br>\n";
45
        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
46
        $html .= "<ul>\n";
47
48
        $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
49
        $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
50
        if (\function_exists('gd_info')) {
51
            if (true == ($gdlib = gd_info())) {
52
                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
53
            }
54
        }
55
        //
56
        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
57
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
58
        //
59
        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
60
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
61
        //
62
        $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
63
        $html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
64
65
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
66
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n";
67
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n";
68
        $html .= "</ul>\n";
69
        $html .= "<ul>\n";
70
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
71
        $html .= "</ul>\n";
72
        $html .= "<br>\n";
73
        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
74
        $html .= '</div>';
75
        $html .= '</fieldset><br>';
76
77
        return $html;
78
    }
79
}
80