/modules/shop/zc_install/includes/modules/pages/phpbb_setup/header_php.php

https://github.com/severnaya99/Sg-2010 · PHP · 82 lines · 39 code · 12 blank · 31 comment · 14 complexity · 0a6d353dfff9c2f222079af4e157ee8b MD5 · raw file

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // |zen-cart Open Source E-commerce |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 2003 The zen-cart developers |
  7. // | |
  8. // | http://www.zen-cart.com/index.php |
  9. // +----------------------------------------------------------------------+
  10. // | This source file is subject to version 2.0 of the GPL license, |
  11. // | that is bundled with this package in the file LICENSE, and is |
  12. // | available through the world-wide-web at the following url: |
  13. // | http://www.zen-cart.com/license/2_0.txt. |
  14. // | If you did not receive a copy of the zen-cart license and are unable |
  15. // | to obtain it through the world-wide-web, please send a note to |
  16. // | license@zen-cart.com so we can mail you a copy immediately. |
  17. // +----------------------------------------------------------------------+
  18. // $Id: header_php.php 290 2004-09-15 19:48:26Z wilt $
  19. //
  20. // check to see if we're upgrading
  21. $is_upgrade = $_GET['is_upgrade'];
  22. $zc_install->error = false;
  23. $zc_install->fatal_error = false;
  24. $zc_install->error_list = array();
  25. $virtual_http_path = parse_url($_GET['virtual_http_path']);
  26. $http_catalog = $virtual_http_path['path'];
  27. if (substr($http_catalog, -1) == '/') $http_catalog = substr($http_catalog, 0, strlen($http_catalog)-1);
  28. //echo 'filename='.$_SERVER['SCRIPT_FILENAME'].'<br>';
  29. //echo 'self='.$_SERVER['PHP_SELF'].'<br>';
  30. //echo 'docroot1='.$_SERVER['DOCUMENT_ROOT'].'<br>';
  31. if ($_SERVER['DOCUMENT_ROOT'] == '') { // try to calculate docroot
  32. $docroot = substr($_SERVER['SCRIPT_FILENAME'],0,strpos($_SERVER['SCRIPT_FILENAME'],$_SERVER['PHP_SELF']));
  33. } else {
  34. $docroot = $_SERVER['DOCUMENT_ROOT'];
  35. }
  36. $phpbb_suggest_dir = '';
  37. //echo 'docroot='.$docroot.'<br>';
  38. //look for typical paths to phpBB files
  39. foreach (array('/phpBB2', '/phpbb2', '/phpbb', '/phpBB', '/forum', '/forums') as $testpath) {
  40. //echo 'path='.$testpath.'<br>';
  41. if (file_exists($docroot . $testpath . '/config.php') ) {
  42. $phpbb_suggest_dir = $docroot . $testpath;
  43. break;
  44. }
  45. if (file_exists($docroot . str_replace($docroot,'',$_GET['physical_path'] ) . $testpath . '/config.php') && $phpbb_suggest_dir=='') {
  46. $phpbb_suggest_dir = $docroot .str_replace($docroot,'',$_GET['physical_path'] ) . $testpath ;
  47. break;
  48. }
  49. }
  50. $phpbb_suggest_dir = (substr($phpbb_suggest_dir,-1)=='/') ? substr($phpbb_suggest_dir,0,(strlen($phpbb_suggest_dir)-1)) : $phpbb_suggest_dir; //remove any trailing slashes
  51. $phpbb_suggest_dir = str_replace('//','/',$phpbb_suggest_dir); // remove any double-slashes
  52. if (isset($_POST['submit'])) {
  53. if ($_POST['phpbb_use'] == 'true') {
  54. $zc_install->fileExists($_POST['phpbb_dir'] . '/config.php', ERROR_TEXT_PHPBB_CONFIG_NOTEXIST . ' :'. $_POST['phpbb_dir'] . '/config.php', ERROR_CODE_PHPBB_CONFIG_NOTEXIST);
  55. // } else {
  56. // $_POST['phpbb_dir'] = ''; // if option set to "false", then do not enter a path in the configure.php file.
  57. }
  58. if (!$zc_install->fatal_error) {
  59. header('location: index.php?main_page=database_setup&language=' . $language . '&physical_path='.$_GET['physical_path'].'&virtual_http_path='.$_GET['virtual_http_path'].'&virtual_https_path='.$_GET['virtual_https_path'].'&virtual_https_server='.$_GET['virtual_https_server'].'&enable_ssl='.$_GET['enable_ssl'].'&enable_ssl_admin='.$_GET['enable_ssl_admin'].'&sql_cache='.$_GET['sql_cache'].'&phpbb_dir='.$_POST['phpbb_dir'].'&is_upgrade='.$_GET['is_upgrade'].'&use_phpbb='.$_POST['phpbb_use']);
  60. }
  61. } //endif 'submit'
  62. //future use (2 lines):
  63. // if (!isset($_POST['phpbb_db_name'])) $_POST['phpbb_db_name'] = '';
  64. // if (!isset($_POST['phpbb_db_prefix'])) $_POST['phpbb_db_prefix'] = '';
  65. // set defaults
  66. if (!isset($_POST['phpbb_dir'])) $_POST['phpbb_dir'] = $phpbb_suggest_dir;
  67. if (!isset($_POST['phpbb_use'])) $_POST['phpbb_use'] = '';
  68. setInputValue($_POST['phpbb_dir'], 'PHPBB_DIR_VALUE', $phpbb_suggest_dir);
  69. setRadioChecked($_POST['phpbb_use'], 'PHPBB_USE', 'false');
  70. ?>