Welcome to mirror list, hosted at ThFree Co, Russian Federation.

upload_max_filesize.php « Core « Test « PhpSecInfo « SecurityInfo « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 07502a4153e176366577c2354b77ad5cfb862c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
 * Test Class for upload_max_filesize
 *
 * @package PhpSecInfo
 * @author Ed Finkler <coj@funkatron.com>
 */

/**
 * require the PhpSecInfo_Test_Core class
 */
require_once(PHPSECINFO_BASE_DIR . '/Test/Test_Core.php');

/**
 * The max recommended size for the upload_max_filesize setting, in bytes
 *
 */
define ('PHPSECINFO_UPLOAD_MAXLIMIT', 1024 * 256);


/**
 * Test Class for upload_max_filesize
 *
 * @package PhpSecInfo
 */
class PhpSecInfo_Test_Core_Upload_Max_Filesize extends PhpSecInfo_Test_Core
{


    /**
     * This should be a <b>unique</b>, human-readable identifier for this test
     *
     * @var string
     */
    var $test_name = "upload_max_filesize";

    var $recommended_value = PHPSECINFO_UPLOAD_MAXLIMIT;

    function _retrieveCurrentValue()
    {
        $this->current_value = $this->returnBytes(ini_get('upload_max_filesize'));
    }

    /**
     * Check to see if the post_max_size setting is enabled.
     */
    function _execTest()
    {

        if ($this->current_value
            && $this->current_value <= $this->recommended_value
            && $post_max_size != -1
        ) {
            return PHPSECINFO_TEST_RESULT_OK;
        }

        return PHPSECINFO_TEST_RESULT_NOTICE;
    }


    /**
     * Set the messages specific to this test
     *
     */
    function _setMessages()
    {
        parent::_setMessages();

        $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_max_filesize is enabled, and appears to be a relatively low value.');
        $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'upload_max_filesize is not enabled, or is set to a high value.  Are you sure your apps require uploading files of this size?  If not, lower the limit, as large file uploads can impact server performance');
    }


}