[1] | 1 | <?php |
---|
| 2 | /* defaults.inc.php |
---|
| 3 | * code by strangecode :: www.strangecode.com :: this document contains copyrighted information. */ |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | /* |
---|
| 7 | * This file contains global configration variables that apply to the underlying |
---|
| 8 | * codebase framework. These values can be overwritten in a site-specific config |
---|
| 9 | * file to customize values for a specific site. |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | // $CFG is the object we store all global codebase configuration variables in. |
---|
| 14 | if (!isset($CFG)) { |
---|
| 15 | $CFG = new stdClass; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | /****************************************************************************** |
---|
| 20 | * DEBUGGERY SETTINGS |
---|
| 21 | *****************************************************************************/ |
---|
| 22 | |
---|
| 23 | // The level of error reporting. Don't set this to 0 to suppress messages, use display_errors to control display. |
---|
| 24 | error_reporting(E_ALL ^ E_NOTICE); |
---|
| 25 | |
---|
| 26 | // Location to store log files. |
---|
| 27 | setDefault($CFG->log_directory, realpath(SITE_BASE . '/../log')); |
---|
| 28 | |
---|
| 29 | // Don't display errors, but do log them to a file. |
---|
| 30 | setDefault($CFG->display_errors, false); |
---|
| 31 | |
---|
| 32 | // Database debugging. |
---|
| 33 | setDefault($CFG->db_debug, false); // TRUE = display db errors. |
---|
| 34 | setDefault($CFG->db_die_on_failure, true); // TRUE = script stops on db error. |
---|
| 35 | setDefault($CFG->db_always_debug, false); // TRUE = display all SQL queries. |
---|
| 36 | |
---|
| 37 | // Logging priority can be any of the following, or null to deactivate: |
---|
| 38 | // LOG_EMERG system is unusable |
---|
| 39 | // LOG_ALERT action must be taken immediately |
---|
| 40 | // LOG_CRIT critical conditions |
---|
| 41 | // LOG_ERR error conditions |
---|
| 42 | // LOG_WARNING warning conditions |
---|
| 43 | // LOG_NOTICE normal, but significant, condition |
---|
| 44 | // LOG_INFO informational message |
---|
| 45 | // LOG_DEBUG debug-level message |
---|
| 46 | setDefault($CFG->log_file_priority, LOG_DEBUG); |
---|
| 47 | setDefault($CFG->log_email_priority, LOG_WARNING); |
---|
| 48 | setDefault($CFG->log_sms_priority, false); |
---|
| 49 | setDefault($CFG->log_screen_priority, false); |
---|
| 50 | |
---|
| 51 | // Email address to receive log event emails. |
---|
| 52 | setDefault($CFG->log_to_email, 'log@strangecode.com'); |
---|
| 53 | |
---|
| 54 | // SMS Email address to receive log event SMS messages |
---|
| 55 | setDefault($CFG->log_to_sms, 'sms@strangecode.com'); |
---|
| 56 | |
---|
| 57 | // General error log for the applications. |
---|
| 58 | setDefault($CFG->log_filename, 'app_error_log'); |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | /****************************************************************************** |
---|
| 62 | * CODEBASE FEATURES |
---|
| 63 | *****************************************************************************/ |
---|
| 64 | |
---|
| 65 | // Use mysql database? |
---|
| 66 | setDefault($CFG->enable_mysql, true); |
---|
| 67 | |
---|
| 68 | // Use php sessions? |
---|
| 69 | setDefault($CFG->enable_session, true); |
---|
| 70 | |
---|
| 71 | // Use mysql-based sessions? |
---|
| 72 | setDefault($CFG->enable_mysql_session_handler, true); |
---|
| 73 | |
---|
| 74 | /****************************************************************************** |
---|
| 75 | * USER LOGIN SETTINGS |
---|
| 76 | *****************************************************************************/ |
---|
| 77 | |
---|
| 78 | // The maximum amount of time a user is allowed to be logged in. |
---|
| 79 | // They will be forced to login again if they expire. |
---|
| 80 | // This applies to admins and users. In seconds. |
---|
| 81 | // 21600 seconds = 6 hours. |
---|
| 82 | setDefault($CFG->login_timeout, 21600); |
---|
| 83 | |
---|
| 84 | // The maximum amount of time a user is allowed to be idle before |
---|
| 85 | // their session expires. They will be forced to login again if they expire. |
---|
| 86 | // This applies to admins and users. In seconds. |
---|
| 87 | // 3600 seconds = 1 hour. |
---|
| 88 | setDefault($CFG->idle_timeout, 3600); |
---|
| 89 | |
---|
| 90 | /****************************************************************************** |
---|
| 91 | * ACCOUNT ABUSE SETTINGS |
---|
| 92 | *****************************************************************************/ |
---|
| 93 | |
---|
| 94 | // The period of time to compare login abuse attempts. If a threshold of |
---|
| 95 | // logins is reached in this amount of time the account is blocked. |
---|
| 96 | // Days and hours, like this: 'DD:HH' |
---|
| 97 | $CFG->login_abuse_timeframe = '04:00'; // 4 days |
---|
| 98 | |
---|
| 99 | // The number of warnings a user will receive (and their password reset each |
---|
| 100 | // time) before their account is completely blocked. |
---|
| 101 | $CFG->login_abuse_warnings = 3; |
---|
| 102 | |
---|
| 103 | // The maximum number of IP addresses a user can login with over the |
---|
| 104 | // timeout period before their account is blocked. |
---|
| 105 | $CFG->login_abuse_max_ips = 5; |
---|
| 106 | |
---|
| 107 | // The IP address subnet size threshold. Uses a CIDR notation |
---|
| 108 | // network mask. Any integar between 0 and 32 is permitted. Setting this |
---|
| 109 | // to '24' permits any address in a class C network (255.255.255.0) |
---|
| 110 | // to be considered the same. Setting to '32' compares each IP absolutely. |
---|
| 111 | // Setting to '0' ignores all IPs. |
---|
| 112 | $CFG->login_abuse_ip_bitmask = 32; |
---|
| 113 | |
---|
| 114 | // Array of IP addresses or hostnames that are to be granted relaxed auth access. |
---|
| 115 | // Specifically, these will be networks that fall behind shifting proxy server |
---|
| 116 | // and because the client IP would change between requests auth would fail. |
---|
| 117 | setDefault($CFG->trusted_networks, array()); |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | /****************************************************************************** |
---|
| 121 | * SESSION CONFIGURATION |
---|
| 122 | *****************************************************************************/ |
---|
| 123 | |
---|
| 124 | // Session name. |
---|
| 125 | setDefault($CFG->session_name, 'Strangecode'); |
---|
| 126 | |
---|
| 127 | // If not using cookies, will pass session ID by URL. |
---|
| 128 | setDefault($CFG->session_use_cookies, true); |
---|
| 129 | |
---|
| 130 | // Skip session for some user agents. |
---|
| 131 | if (preg_match('/Atomz|ApacheBench|Wget/i', getenv('HTTP_USER_AGENT'))) { |
---|
| 132 | $CFG->enable_session = false; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | // The maximum byte size that the session cache will hold. |
---|
| 136 | // Used in SessionCache.inc.php |
---|
| 137 | define('SESSION_CACHE_SIZE_BYTES', 204800); // 200 Kilobytes. |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | /****************************************************************************** |
---|
| 141 | * ET CETERA |
---|
| 142 | *****************************************************************************/ |
---|
| 143 | |
---|
| 144 | // Used as the fifth parameter to mail() to set the return address for sent messages. Requires safe_mode off. |
---|
| 145 | setDefault($CFG->envelope_sender_address, "-f $CFG->site_email"); |
---|
| 146 | |
---|
| 147 | // Character set for page output. Used by App::oTxt(), boot.inc.php sends a Content-Type header, and header.ihtml should have <meta content-type> tag. |
---|
| 148 | setDefault($CFG->character_set, 'ISO-8859-1'); |
---|
| 149 | |
---|
| 150 | // A key for calculating simple cryptographic signatures. |
---|
| 151 | if (!empty($_SERVER['SIGNING_KEY'])) { |
---|
| 152 | $CFG->signing_key = $_SERVER['SIGNING_KEY']; |
---|
| 153 | } else { |
---|
| 154 | $CFG->signing_key = 'change me please'; |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | // The human-readable format used to display dates. |
---|
| 158 | setDefault($CFG->date_format, 'd M Y'); |
---|
| 159 | setDefault($CFG->mysql_date_format, '%e %b %Y'); |
---|
| 160 | setDefault($CFG->mysql_time_format, '%k:%i'); |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | ?> |
---|