Subversion Repositories ggsysinfo

[/] [modules/] [sysinfo/] [lib/] [PhpSecInfo/] [Test/] [Core/] [upload_max_filesize.php] - Blame information for rev 123

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 123 gg
<?php
2
/**
3
 * Test Class for upload_max_filesize
4
 *
5
 * @package PhpSecInfo
6
 * @author Ed Finkler <coj@funkatron.com>
7
 */
8
 
9
/**
10
 * require the PhpSecInfo_Test_Core class
11
 */
12
require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php');
13
 
14
/**
15
 * The max recommended size for the upload_max_filesize setting, in bytes
16
 *
17
 */
18
define ('PHPSECINFO_UPLOAD_MAXLIMIT', 1024*256);
19
 
20
 
21
/**
22
 * Test Class for upload_max_filesize
23
 *
24
 * @package PhpSecInfo
25
 */
26
class PhpSecInfo_Test_Core_Upload_Max_Filesize extends PhpSecInfo_Test_Core
27
{
28
 
29
 
30
        /**
31
         * This should be a <b>unique</b>, human-readable identifier for this test
32
         *
33
         * @var string
34
         */
35
        var $test_name = "upload_max_filesize";
36
 
37
        var $recommended_value = PHPSECINFO_UPLOAD_MAXLIMIT;
38
 
39
        function _retrieveCurrentValue() {
40
                $this->current_value =  $this->returnBytes(ini_get('upload_max_filesize'));
41
        }
42
 
43
        /**
44
         * Check to see if the post_max_size setting is enabled.
45
         */
46
        function _execTest() {
47
 
48
                if ($this->current_value
49
                        && $this->current_value <= $this->recommended_value
50
                        && $post_max_size != -1) {
51
                        return PHPSECINFO_TEST_RESULT_OK;
52
                }
53
 
54
                return PHPSECINFO_TEST_RESULT_NOTICE;
55
        }
56
 
57
 
58
        /**
59
         * Set the messages specific to this test
60
         *
61
         */
62
        function _setMessages() {
63
                parent::_setMessages();
64
 
65
                $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_max_filesize is enabled, and appears to be a relatively low value.');
66
                $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');
67
        }
68
 
69
 
70
}