@@ -30,28 +30,28 @@ |
||
| 30 | 30 | define('SYS_DEVELOPMENT_MODE', false); |
| 31 | 31 | |
| 32 | 32 | if ('' != directory()) { |
| 33 | - $subdirectory = '/'.directory().'/'; |
|
| 33 | + $subdirectory = '/'.directory().'/'; |
|
| 34 | 34 | } else { |
| 35 | - $subdirectory = '/'; |
|
| 35 | + $subdirectory = '/'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (isset($_SERVER['HTTP_HOST'])) { |
| 39 | - if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { |
|
| 40 | - define('HOST_URL', $_SERVER['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 41 | - } elseif (isset($_SERVER['REQUEST_SCHEME'])) { |
|
| 42 | - define('HOST_URL', $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 43 | - } else { |
|
| 44 | - if (isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']) { |
|
| 45 | - define('HOST_URL', 'https://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 46 | - } else { |
|
| 47 | - define('HOST_URL', 'http://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 48 | - } |
|
| 49 | - } |
|
| 39 | + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { |
|
| 40 | + define('HOST_URL', $_SERVER['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 41 | + } elseif (isset($_SERVER['REQUEST_SCHEME'])) { |
|
| 42 | + define('HOST_URL', $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 43 | + } else { |
|
| 44 | + if (isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']) { |
|
| 45 | + define('HOST_URL', 'https://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 46 | + } else { |
|
| 47 | + define('HOST_URL', 'http://'.$_SERVER['HTTP_HOST'].$subdirectory); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | //# Subdirectory trick |
| 53 | 53 | function directory() |
| 54 | 54 | { |
| 55 | - //#https://stackoverflow.com/questions/2090723/how-to-get-the-relative-directory-no-matter-from-where-its-included-in-php |
|
| 56 | - return substr(str_replace('\\', '/', realpath(dirname(__FILE__))), strlen(str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']))) + 1); |
|
| 55 | + //#https://stackoverflow.com/questions/2090723/how-to-get-the-relative-directory-no-matter-from-where-its-included-in-php |
|
| 56 | + return substr(str_replace('\\', '/', realpath(dirname(__FILE__))), strlen(str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']))) + 1); |
|
| 57 | 57 | } |
@@ -13,85 +13,85 @@ |
||
| 13 | 13 | |
| 14 | 14 | function php_test() |
| 15 | 15 | { |
| 16 | - $lock_msg = ''; |
|
| 16 | + $lock_msg = ''; |
|
| 17 | 17 | |
| 18 | - if (version_compare(phpversion(), '5.4', '<')) { |
|
| 19 | - $lock_msg .= "Error: Sorry, your PHP version isn't supported. Please upgrade to PHP >= 5.4<br>"; |
|
| 20 | - } |
|
| 18 | + if (version_compare(phpversion(), '5.4', '<')) { |
|
| 19 | + $lock_msg .= "Error: Sorry, your PHP version isn't supported. Please upgrade to PHP >= 5.4<br>"; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - return $lock_msg; |
|
| 22 | + return $lock_msg; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function db_test() |
| 26 | 26 | { |
| 27 | - $manager = QueryManager::current(); |
|
| 27 | + $manager = QueryManager::current(); |
|
| 28 | 28 | |
| 29 | - $lock_msg = ''; |
|
| 29 | + $lock_msg = ''; |
|
| 30 | 30 | |
| 31 | - // Pokemon Test |
|
| 32 | - $result = $manager->testTotalPokemon(); |
|
| 31 | + // Pokemon Test |
|
| 32 | + $result = $manager->testTotalPokemon(); |
|
| 33 | 33 | |
| 34 | - if (1 === $result) { |
|
| 35 | - $lock_msg .= 'Error: No Pokémon database found<br>'; |
|
| 36 | - } elseif (2 === $result) { |
|
| 37 | - $lock_msg .= 'Error: No Pokémon found is your database<br>'; |
|
| 38 | - } |
|
| 34 | + if (1 === $result) { |
|
| 35 | + $lock_msg .= 'Error: No Pokémon database found<br>'; |
|
| 36 | + } elseif (2 === $result) { |
|
| 37 | + $lock_msg .= 'Error: No Pokémon found is your database<br>'; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - // Gym Test |
|
| 41 | - $result = $manager->testTotalGyms(); |
|
| 40 | + // Gym Test |
|
| 41 | + $result = $manager->testTotalGyms(); |
|
| 42 | 42 | |
| 43 | - if (1 === $result) { |
|
| 44 | - $lock_msg .= 'Error: No Gym database found<br>'; |
|
| 45 | - } elseif (2 === $result) { |
|
| 46 | - $lock_msg .= 'Error: No Gym found is your database<br>'; |
|
| 47 | - } |
|
| 43 | + if (1 === $result) { |
|
| 44 | + $lock_msg .= 'Error: No Gym database found<br>'; |
|
| 45 | + } elseif (2 === $result) { |
|
| 46 | + $lock_msg .= 'Error: No Gym found is your database<br>'; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - // Pokéstop Test |
|
| 50 | - $result = $manager->testTotalPokestops(); |
|
| 49 | + // Pokéstop Test |
|
| 50 | + $result = $manager->testTotalPokestops(); |
|
| 51 | 51 | |
| 52 | - if (1 === $result) { |
|
| 53 | - $lock_msg .= 'Error: No Pokestop database found<br>'; |
|
| 54 | - } elseif (2 === $result) { |
|
| 55 | - $lock_msg .= 'Error: No Pokestop found in your database<br>'; |
|
| 56 | - } |
|
| 52 | + if (1 === $result) { |
|
| 53 | + $lock_msg .= 'Error: No Pokestop database found<br>'; |
|
| 54 | + } elseif (2 === $result) { |
|
| 55 | + $lock_msg .= 'Error: No Pokestop found in your database<br>'; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - return $lock_msg; |
|
| 58 | + return $lock_msg; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | function permission_test() |
| 62 | 62 | { |
| 63 | - $lock_msg = ''; |
|
| 63 | + $lock_msg = ''; |
|
| 64 | 64 | |
| 65 | - // Can we write on install and core/json folder? |
|
| 66 | - if (!is_writable(SYS_PATH.'/install/') || !is_writeable(SYS_PATH.'/core/json/')) { |
|
| 67 | - $lock_msg .= 'Error: Install can not be completed!<br> |
|
| 65 | + // Can we write on install and core/json folder? |
|
| 66 | + if (!is_writable(SYS_PATH.'/install/') || !is_writeable(SYS_PATH.'/core/json/')) { |
|
| 67 | + $lock_msg .= 'Error: Install can not be completed!<br> |
|
| 68 | 68 | Please fix install/ and core/json/ directory rights.<br> |
| 69 | 69 | Apache needs write access to both directories.<br>'; |
| 70 | - // This is really bad exit immediately |
|
| 71 | - echo $lock_msg; |
|
| 72 | - exit(); |
|
| 73 | - } |
|
| 70 | + // This is really bad exit immediately |
|
| 71 | + echo $lock_msg; |
|
| 72 | + exit(); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $lock_msg; |
|
| 75 | + return $lock_msg; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | function run_tests() |
| 79 | 79 | { |
| 80 | - // Execute tests |
|
| 81 | - $errors = ''; |
|
| 82 | - $errors .= php_test(); |
|
| 83 | - $errors .= db_test(); |
|
| 84 | - $errors .= permission_test(); |
|
| 85 | - |
|
| 86 | - // Write lockfile on error |
|
| 87 | - $lock_file = SYS_PATH.'/install/website.lock'; |
|
| 88 | - if (file_exists($lock_file)) { |
|
| 89 | - // delete old lockfile |
|
| 90 | - unlink($lock_file); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - // create new file if there is an error |
|
| 94 | - if ('' != $errors) { |
|
| 95 | - file_put_contents($lock_file, $errors); |
|
| 96 | - } |
|
| 80 | + // Execute tests |
|
| 81 | + $errors = ''; |
|
| 82 | + $errors .= php_test(); |
|
| 83 | + $errors .= db_test(); |
|
| 84 | + $errors .= permission_test(); |
|
| 85 | + |
|
| 86 | + // Write lockfile on error |
|
| 87 | + $lock_file = SYS_PATH.'/install/website.lock'; |
|
| 88 | + if (file_exists($lock_file)) { |
|
| 89 | + // delete old lockfile |
|
| 90 | + unlink($lock_file); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + // create new file if there is an error |
|
| 94 | + if ('' != $errors) { |
|
| 95 | + file_put_contents($lock_file, $errors); |
|
| 96 | + } |
|
| 97 | 97 | } |