| @@ 22-46 (lines=25) @@ | ||
| 19 | ||
| 20 | public static function upgrade() |
|
| 21 | { |
|
| 22 | if (version_compare(self::$existing_version, '2.3.4beta1', '<=')) { |
|
| 23 | // Detect mod_rewrite #1808 |
|
| 24 | try { |
|
| 25 | $htaccess = file_get_contents(DOCROOT . '/.htaccess'); |
|
| 26 | ||
| 27 | if ($htaccess !== false && !preg_match('/SetEnv HTTP_MOD_REWRITE No/', $htaccess)) { |
|
| 28 | $rewrite = ' |
|
| 29 | <IfModule !mod_rewrite.c> |
|
| 30 | SetEnv HTTP_MOD_REWRITE No |
|
| 31 | </IfModule> |
|
| 32 | ||
| 33 | <IfModule mod_rewrite.c>'; |
|
| 34 | ||
| 35 | $htaccess = str_replace('<IfModule mod_rewrite.c>', $rewrite, $htaccess); |
|
| 36 | file_put_contents(DOCROOT . '/.htaccess', $htaccess); |
|
| 37 | } |
|
| 38 | } catch (Exception $ex) { |
|
| 39 | } |
|
| 40 | ||
| 41 | // Extend token field to enable more secure tokens |
|
| 42 | try { |
|
| 43 | Symphony::Database()->query('ALTER TABLE `tbl_forgotpass` CHANGE `token` `token` VARCHAR(16);'); |
|
| 44 | } catch (Exception $ex) { |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | if (version_compare(self::$existing_version, '2.3.4beta2', '<=')) { |
|
| 49 | // Extend session_id field for default Suhosin installs |
|
| @@ 58-81 (lines=24) @@ | ||
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | if (version_compare(self::$existing_version, '2.3.1RC1', '<=')) { |
|
| 59 | // Add Security Rules from 2.2 to .htaccess |
|
| 60 | try { |
|
| 61 | $htaccess = file_get_contents(DOCROOT . '/.htaccess'); |
|
| 62 | ||
| 63 | if ($htaccess !== false && preg_match('/### SECURITY - Protect crucial files/', $htaccess)) { |
|
| 64 | $security = ' |
|
| 65 | ### SECURITY - Protect crucial files |
|
| 66 | RewriteRule ^manifest/(.*)$ - [F] |
|
| 67 | RewriteRule ^workspace/(pages|utilities)/(.*)\.xsl$ - [F] |
|
| 68 | RewriteRule ^(.*)\.sql$ - [F] |
|
| 69 | RewriteRule (^|/)\. - [F] |
|
| 70 | ||
| 71 | ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"'; |
|
| 72 | ||
| 73 | $htaccess = str_replace( |
|
| 74 | '### SECURITY - Protect crucial files.*### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"', |
|
| 75 | $security, |
|
| 76 | $htaccess |
|
| 77 | ); |
|
| 78 | file_put_contents(DOCROOT . '/.htaccess', $htaccess); |
|
| 79 | } |
|
| 80 | } catch (Exception $ex) { |
|
| 81 | } |
|
| 82 | ||
| 83 | // Increase length of password field to accomodate longer hashes |
|
| 84 | Symphony::Database()->query("ALTER TABLE `tbl_authors` CHANGE `password` `password` VARCHAR( 150 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL"); |
|