ini-file.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # This file is part of DotClear.
  4. # Copyright (c) 2004 Olivier Meunier and contributors. All rights
  5. # reserved.
  6. #
  7. # DotClear is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # DotClear is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with DotClear; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # ***** END LICENSE BLOCK *****
  22. define('STEP',6);
  23. require dirname(__FILE__).'/prepend.php';
  24. $p_location = preg_replace('|/install/ini-file.php$|','',$_SERVER['REQUEST_URI']);
  25. $p_blog_name = __('My first weblog');
  26. $p_url_scan = 'query_string';
  27. # Liste des url_scan
  28. $url_scan_list = array(
  29. 'Query string' => 'query_string',
  30. 'Path info' => 'path_info'
  31. );
  32. $done = false;
  33. $err = '';
  34. if (!empty($_POST['inifile'])) {
  35. $p_location = trim($_POST['p_location']);
  36. $p_blog_name = trim($_POST['p_blog_name']);
  37. $p_url_scan = trim($_POST['p_url_scan']);
  38. # Création de conf/dotclear.ini
  39. $ini_file = dirname(__FILE__).'/../conf/dotclear.ini';
  40. copy($ini_file.'.in',$ini_file);
  41. @unlink($ini_file.'.in');
  42. chmod($ini_file,0666);
  43. $objIni = new iniFile(dirname(__FILE__).'/../conf/dotclear.ini');
  44. if ($p_url_scan == 'path_info') {
  45. $objIni->editVar('dc_blog_url',$p_location.'/index.php/');
  46. } else {
  47. $objIni->editVar('dc_blog_url',$p_location.'/index.php');
  48. }
  49. $objIni->editVar('dc_app_url',$p_location);
  50. $objIni->editVar('dc_blog_rss',$p_location.'/rss.php');
  51. $objIni->editVar('dc_blog_atom',$p_location.'/atom.php');
  52. $objIni->editVar('dc_trackback_uri',$p_location.'/tb.php');
  53. $objIni->editVar('dc_img_url',$p_location.'/images/');
  54. $objIni->editVar('dc_blog_name',$p_blog_name);
  55. $objIni->editVar('dc_url_scan',$p_url_scan);
  56. $objIni->editVar('dc_encoding',ENCODING);
  57. if ($objIni->saveFile() === false) {
  58. $err = '<p class="important">'.__('Unable to write dotclear.ini').'</p>';
  59. } else {
  60. $done = true;
  61. $ses->reg('step',7);
  62. }
  63. }
  64. require dirname(__FILE__).'/__top.php';
  65. echo '<h2>'.__('Blog configuration').'</h2>';
  66. echo $err;
  67. if ($done)
  68. {
  69. echo '<p>'.__('Weblog successfully configured').'</p>';
  70. echo
  71. '<form action="end-install.php" method="post">'.
  72. '<p><input type="submit" class="submit" value="'.__('End installation').' &#187;" /></p>'.
  73. '</form>';
  74. }
  75. else
  76. {
  77. echo
  78. '<form action="ini-file.php" method="post">'.
  79. '<p>'.sprintf(__('DotClear needs to know in which directory it has been '.
  80. 'installed. For example, if DotClear has been installed in %s/dotclear, '.
  81. 'then please type "/dotclear" in the field below:'),$_SERVER['HTTP_HOST']).'</p>'.
  82. '<p class="field"><label class="float" for="p_location">'.__('DotClear location').' :</label> '.
  83. form::field('p_location',30,512,$p_location).'</p>'.
  84. '<p class="field"><label class="float" for="p_blog_name">'.__('Your blog\'s name').' :</label> '.
  85. form::field('p_blog_name',30,255,$p_blog_name).'</p>'.
  86. '<p class="field">'.__('Your blog archive addresses (permalinks) may be '.
  87. 'displayed in various formats. The "Query string" URLs will be displayed '.
  88. 'as "index.php?/2002/04". The "Path info" URLs will be displayed as '.
  89. '"index.php/2002/04" (preferred method for search engine optimization). '.
  90. 'And the "Get" URLs will be displayed as "index.php?d=2002/04" (only for '.
  91. 'mod_rewrite fans).').'</p>'.
  92. '<p>'.__('Please note that "Path info" type could be broken on some Web '.
  93. 'hosting configurations.').'</p>'.
  94. '<p class="field"><label class="float" for="p_url_scan">'.__('URLs format').' :</label> '.
  95. form::combo('p_url_scan',$url_scan_list,$p_url_scan).'</p>'.
  96. '<p><input type="submit" class="submit" value="'.__('Save').' &#187;" />'.
  97. form::hidden('inifile',1).'</p>'.
  98. '</form>';
  99. }
  100. ?>
  101. <?php require dirname(__FILE__).'/__bottom.php'; ?>