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
nc 12
nop 0
dl 0
loc 50
rs 9.1768
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Gbook\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
19
/**
20
 * @copyright   XOOPS Project (https://xoops.org)
21
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
22
 * @author      mamba <[email protected]>
23
 */
24
trait ServerStats
25
{
26
    /**
27
     * serverStats()
28
     *
29
     * @return string
30
     */
31
    public static function getServerStats(): string
32
    {
33
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
34
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
35
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
36
        \xoops_loadLanguage('common', $moduleDirName);
37
        $html = '';
38
        //        $sql   = 'SELECT metavalue';
39
        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
40
        //        $sql   .= " WHERE metakey='version' LIMIT 1";
41
        //        $query = $GLOBALS['xoopsDB']->query($sql);
42
        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
43
        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
44
        $html .= "<div style='padding: 8px;'>\n";
45
        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
46
        //        $html .= "<br>\n";
47
        //        $html .= "<br>\n";
48
        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
49
        $html .= "<ul>\n";
50
51
        $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
52
        $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
53
        if (\function_exists('gd_info')) {
54
            if (true == ($gdlib = gd_info())) {
55
                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
56
            }
57
        }
58
        //
59
        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
60
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
61
        //
62
        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
63
        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
64
        //
65
        $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
66
        $html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
67
68
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
69
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n";
70
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n";
71
        $html .= "</ul>\n";
72
        $html .= "<ul>\n";
73
        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
74
        $html .= "</ul>\n";
75
        $html .= "<br>\n";
76
        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
77
        $html .= '</div>';
78
        $html .= '</fieldset><br>';
79
80
        return $html;
81
    }
82
}
83