albertlast /
SMF2.1
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * The settings file contains all of the basic settings that need to be present when a database/cache is not available. |
||
| 5 | * |
||
| 6 | * Simple Machines Forum (SMF) |
||
| 7 | * |
||
| 8 | * @package SMF |
||
| 9 | * @author Simple Machines http://www.simplemachines.org |
||
| 10 | * @copyright 2017 Simple Machines and individual contributors |
||
| 11 | * @license http://www.simplemachines.org/about/smf/license.php BSD |
||
| 12 | * |
||
| 13 | * @version 2.1 Beta 4 |
||
| 14 | */ |
||
| 15 | |||
| 16 | ########## Maintenance ########## |
||
| 17 | /** |
||
| 18 | * The maintenance "mode" |
||
| 19 | * Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!) |
||
| 20 | * 0 is default and disables maintenance mode. |
||
| 21 | * @var int 0, 1, 2 |
||
| 22 | * @global int $maintenance |
||
| 23 | */ |
||
| 24 | $maintenance = 0; |
||
| 25 | /** |
||
| 26 | * Title for the Maintenance Mode message. |
||
| 27 | * @var string |
||
| 28 | * @global int $mtitle |
||
| 29 | */ |
||
| 30 | $mtitle = 'Maintenance Mode'; |
||
| 31 | /** |
||
| 32 | * Description of why the forum is in maintenance mode. |
||
| 33 | * @var string |
||
| 34 | * @global string $mmessage |
||
| 35 | */ |
||
| 36 | $mmessage = 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!'; |
||
| 37 | |||
| 38 | ########## Forum Info ########## |
||
| 39 | /** |
||
| 40 | * The name of your forum. |
||
| 41 | * @var string |
||
| 42 | */ |
||
| 43 | $mbname = 'My Community'; |
||
| 44 | /** |
||
| 45 | * The default language file set for the forum. |
||
| 46 | * @var string |
||
| 47 | */ |
||
| 48 | $language = 'english'; |
||
| 49 | /** |
||
| 50 | * URL to your forum's folder. (without the trailing /!) |
||
| 51 | * @var string |
||
| 52 | */ |
||
| 53 | $boardurl = 'http://127.0.0.1/smf'; |
||
| 54 | /** |
||
| 55 | * Email address to send emails from. (like [email protected].) |
||
| 56 | * @var string |
||
| 57 | */ |
||
| 58 | $webmaster_email = '[email protected]'; |
||
| 59 | /** |
||
| 60 | * Name of the cookie to set for authentication. |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | $cookiename = 'SMFCookie11'; |
||
| 64 | |||
| 65 | ########## Database Info ########## |
||
| 66 | /** |
||
| 67 | * The database type |
||
| 68 | * Default options: mysql, postgresql |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | $db_type = 'mysql'; |
||
| 72 | /** |
||
| 73 | * The server to connect to (or a Unix socket) |
||
| 74 | * @var string |
||
| 75 | */ |
||
| 76 | $db_server = 'localhost'; |
||
| 77 | /** |
||
| 78 | * The database name |
||
| 79 | * @var string |
||
| 80 | */ |
||
| 81 | $db_name = 'smf'; |
||
| 82 | /** |
||
| 83 | * Database username |
||
| 84 | * @var string |
||
| 85 | */ |
||
| 86 | $db_user = 'root'; |
||
| 87 | /** |
||
| 88 | * Database password |
||
| 89 | * @var string |
||
| 90 | */ |
||
| 91 | $db_passwd = ''; |
||
| 92 | /** |
||
| 93 | * Database user for when connecting with SSI |
||
| 94 | * @var string |
||
| 95 | */ |
||
| 96 | $ssi_db_user = ''; |
||
| 97 | /** |
||
| 98 | * Database password for when connecting with SSI |
||
| 99 | * @var string |
||
| 100 | */ |
||
| 101 | $ssi_db_passwd = ''; |
||
| 102 | /** |
||
| 103 | * A prefix to put in front of your table names. |
||
| 104 | * This helps to prevent conflicts |
||
| 105 | * @var string |
||
| 106 | */ |
||
| 107 | $db_prefix = 'smf_'; |
||
| 108 | /** |
||
| 109 | * Use a persistent database connection |
||
| 110 | * @var int|bool |
||
| 111 | */ |
||
| 112 | $db_persist = 0; |
||
| 113 | /** |
||
| 114 | * |
||
| 115 | * @var int|bool |
||
| 116 | */ |
||
| 117 | $db_error_send = 0; |
||
| 118 | |||
| 119 | ########## Cache Info ########## |
||
| 120 | /** |
||
| 121 | * Select a cache system. You want to leave this up to the cache area of the admin panel for |
||
| 122 | * proper detection of apc, memcached, output_cache, smf, or xcache |
||
| 123 | * (you can add more with a mod). |
||
| 124 | * @var string |
||
| 125 | */ |
||
| 126 | $cache_accelerator = ''; |
||
| 127 | /** |
||
| 128 | * The level at which you would like to cache. Between 0 (off) through 3 (cache a lot). |
||
| 129 | * @var int |
||
| 130 | */ |
||
| 131 | $cache_enable = 0; |
||
| 132 | /** |
||
| 133 | * This is only used for memcache / memcached. Should be a string of 'server:port,server:port' |
||
| 134 | * @var array |
||
| 135 | */ |
||
| 136 | $cache_memcached = ''; |
||
| 137 | /** |
||
| 138 | * This is only for the 'smf' file cache system. It is the path to the cache directory. |
||
| 139 | * It is also recommended that you place this in /tmp/ if you are going to use this. |
||
| 140 | * @var string |
||
| 141 | */ |
||
| 142 | $cachedir = dirname(__FILE__) . '/cache'; |
||
| 143 | |||
| 144 | ########## Image Proxy ########## |
||
| 145 | # This is done entirely in Settings.php to avoid loading the DB while serving the images |
||
| 146 | /** |
||
| 147 | * Whether the proxy is enabled or not |
||
| 148 | * @var bool |
||
| 149 | */ |
||
| 150 | $image_proxy_enabled = true; |
||
| 151 | |||
| 152 | /** |
||
| 153 | * Secret key to be used by the proxy |
||
| 154 | * @var string |
||
| 155 | */ |
||
| 156 | $image_proxy_secret = 'smfisawesome'; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Maximum file size (in KB) for indiviudal files |
||
| 160 | * @var int |
||
| 161 | */ |
||
| 162 | $image_proxy_maxsize = 5192; |
||
| 163 | |||
| 164 | ########## Directories/Files ########## |
||
| 165 | # Note: These directories do not have to be changed unless you move things. |
||
| 166 | /** |
||
| 167 | * The absolute path to the forum's folder. (not just '.'!) |
||
| 168 | * @var string |
||
| 169 | */ |
||
| 170 | $boarddir = dirname(__FILE__); |
||
| 171 | /** |
||
| 172 | * Path to the Sources directory. |
||
| 173 | * @var string |
||
| 174 | */ |
||
| 175 | $sourcedir = dirname(__FILE__) . '/Sources'; |
||
| 176 | /** |
||
| 177 | * Path to the Packages directory. |
||
| 178 | * @var string |
||
| 179 | */ |
||
| 180 | $packagesdir = dirname(__FILE__) . '/Packages'; |
||
| 181 | /** |
||
| 182 | * Path to the tasks directory. |
||
| 183 | * @var string |
||
| 184 | */ |
||
| 185 | $tasksdir = $sourcedir . '/tasks'; |
||
| 186 | |||
| 187 | ########## Error-Catching ########## |
||
| 188 | # Note: You shouldn't touch these settings. |
||
| 189 | if (file_exists(dirname(__FILE__) . '/db_last_error.php')) |
||
| 190 | include(dirname(__FILE__) . '/db_last_error.php'); |
||
| 191 | |||
| 192 | if (!isset($db_last_error)) |
||
| 193 | { |
||
| 194 | // File does not exist so lets try to create it |
||
| 195 | file_put_contents(dirname(__FILE__) . '/db_last_error.php', '<' . '?' . "php\n" . '$db_last_error = 0;' . "\n" . '?' . '>'); |
||
| 196 | $db_last_error = 0; |
||
| 197 | } |
||
| 198 | |||
| 199 | if (file_exists(dirname(__FILE__) . '/install.php')) |
||
| 200 | { |
||
| 201 | header('Location: http' . (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 's' : '') . '://' . (empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']) . (strtr(dirname($_SERVER['PHP_SELF']), '\\', '/') == '/' ? '' : strtr(dirname($_SERVER['PHP_SELF']), '\\', '/')) . '/install.php'); exit; |
||
| 202 | } |
||
| 203 | |||
| 204 | # Make sure the paths are correct... at least try to fix them. |
||
| 205 | if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) |
||
| 206 | $boarddir = dirname(__FILE__); |
||
| 207 | if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) |
||
| 208 | $sourcedir = $boarddir . '/Sources'; |
||
| 209 | View Code Duplication | if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) |
|
|
0 ignored issues
–
show
|
|||
| 210 | $cachedir = $boarddir . '/cache'; |
||
| 211 | |||
| 212 | ?> |
||
|
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. Loading history...
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.