install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file create_config_inc.php

Documentation is available at create_config_inc.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * create_config
  10.  */
  11.  
  12. /**
  13.  * create configuration file
  14.  *
  15.  * @param string  $pParamHash['gBitDbType'] 
  16.  * @param string  $pParamHash['gBitDbHost'] 
  17.  * @param string  $pParamHash['gBitDbUser'] 
  18.  * @param string  $pParamHash['gBitDbPassword'] 
  19.  * @param string  $pParamHash['gBitDbName'] 
  20.  * @param numeric $pParamHash['gBitDbCaseSensitivity'] 
  21.  * @param string  $pParamHash['bit_db_prefix'] 
  22.  * @param string  $pParamHash['bit_root_url'] 
  23.  * @param boolean $pParamHash['auto_bug_submit'] 
  24.  * @param boolean $pParamHash['is_live'] 
  25.  * @access public
  26.  * @return void 
  27.  */
  28. function create_config$pParamHash {
  29.     // assign values to their keys
  30.     extract$pParamHash );
  31.  
  32.     $bit_db_prefix  empty$bit_db_prefix "" $bit_db_prefix;
  33.  
  34.     $gBitDbType     addslashes$gBitDbType );
  35.     $gBitDbHost     addslashes$gBitDbHost );
  36.     $gBitDbUser     addslashes$gBitDbUser );
  37.     $gBitDbPassword addslashes$gBitDbPassword );
  38.     $gBitDbName     addslashes$gBitDbName );
  39.     $bit_db_prefix  addslashes$bit_db_prefix );
  40.  
  41.     ifpreg_match'/\./'$bit_db_prefix ) ) {
  42.         if$gBitDbType == 'mysql' {
  43.             $bit_db_prefix preg_replace'/[`.]/'''$bit_db_prefix );
  44.         elseif!preg_match'/`\.`/'$bit_db_prefix ) ) {
  45.             $bit_db_prefix preg_replace'/\./''`.`'$bit_db_prefix );
  46.         }
  47.     }
  48.  
  49.     $config_file empty$_SERVER['CONFIG_INC''../config/kernel/config_inc.php' $_SERVER['CONFIG_INC'];
  50.     if!file_existsdirnamedirname$config_file ) ) ) ) {
  51.         mkdirdirnamedirname$config_file ) ) );
  52.     }
  53.     if!file_existsdirname$config_file ) ) ) {
  54.         mkdirdirname$config_file ) );
  55.     }
  56.  
  57.     // We can't call clean_file_path here even though we would like to.
  58.     $config_file strpos$_SERVER["SERVER_SOFTWARE"],"IIS" str_replace"/""\\"$config_file $config_file );
  59.  
  60.     $fw fopen$config_file'w' );
  61.     ifisset$fw )) {
  62.         $filetowrite "<?php
  63. // Copyright (c) 2006, bitweaver.org
  64. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE.
  65.  
  66. // The following line is required and should not be altered
  67. global \$gBitDbType, \$gBitDbHost, \$gBitDbUser, \$gBitDbPassword, \$gBitDbName, \$gBitDbCaseSensitivity, \$smarty_force_compile, \$gDebug, \$gPreScan;
  68.  
  69.  
  70.              /******************************************************\
  71.               ***************   Database settings   **************** 
  72.              \******************************************************/
  73.  
  74. // You can choose between different Database abstraction layers. Currently we support:
  75. //    adodb          ADODB
  76. //                   this is the default setting and is bundled with bitweaver
  77. //    pear           PEAR::DB
  78. //                   when using this, you can even remove the util/adodb directory
  79. \$gBitDbSystem = \"adodb\";
  80.  
  81.  
  82. // bitweaver can store its data in multiple different back-ends. Currently we
  83. // support MySQL, MSSQL, Firebird, Sybase, PostgreSQL and Oracle.  Enter the
  84. // hostname where your database lives, and the username and password you use to
  85. // connect to it.
  86. //
  87. // You must specify the name of a database that already exists. bitweaver will not
  88. // create the database for you, because it's very difficult to do that in a
  89. // reliable, database-neutral fashion. The user that you use should have the
  90. // following permissions:
  91. //
  92. //    SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP
  93. //
  94. // The possible database types that we support are:
  95. //    mysql          Standard MySQL
  96. //    mysqli         New MySQL driver
  97. //    sqlite         SQLLite
  98. //    mssql          MS-SQL (experimental)
  99. //    postgres       PostgreSQL 7.x
  100. //    oci8po         Oracle (9i and newer)
  101. //    firebird       FireBird
  102. //    sybase         Sybase
  103. \$gBitDbType=\"$gBitDbType\";
  104.  
  105. // Hostname or IP for your database.
  106. // Some examples:
  107. //    'localhost' if you are running the database on the same machine as bitweaver
  108. //    If you use Oracle, insert your TNS Name here
  109. //    If you use SQLite, insert the path and filename to your database file
  110. \$gBitDbHost=\"$gBitDbHost\";
  111.  
  112. // Database username
  113. \$gBitDbUser=\"$gBitDbUser\";
  114.  
  115. // Database password
  116. \$gBitDbPassword=\"$gBitDbPassword\";
  117.  
  118. // Database name
  119. \$gBitDbName=\"$gBitDbName\";
  120.  
  121. // Database field case default
  122. \$gBitDbCaseSensitivity=\"$gBitDbCaseSensitivity\";
  123.  
  124. // This prefix will be prepended to the begining of every table name to allow
  125. // multiple independent installs to share a single database. By ending the prefix
  126. // with a '.' (period) you can use a schema in systems that support it. Backticks
  127. // '`' around the '.' are required if present. A schema example is: 'bit`.`'
  128. define( 'BIT_DB_PREFIX', '$bit_db_prefix' );
  129.  
  130.  
  131.              /******************************************************\
  132.               *************** Environment Settings  **************** 
  133.              \******************************************************/
  134.  
  135. // Setting IS_LIVE to TRUE will let the application know that this site is a live
  136. // production site and is not used for testing purposes.  This will prevent any
  137. // nasty error pages from appearing and will redirect the user to a 'nicer' error
  138. // page. Errors should still show up in your error logs. Please use these when
  139. // submitting bugs to http://sourceforge.net/tracker/?group_id=141358&atid=749176
  140. define( 'IS_LIVE', $is_live );
  141.  
  142.  
  143. // if you set AUTO_BUG_SUBMIT to TRUE bitweaver will automatically email the team
  144. // with details regarding the error.  Alternatively you can submit bugs to
  145. // http://sourceforge.net/tracker/?group_id=141358&atid=749176 which will probably
  146. // get processed faster since more people have access to these.
  147. define( 'AUTO_BUG_SUBMIT', $auto_bug_submit );
  148.  
  149.  
  150. // This is the path from the server root to your bitweaver location.  i.e. if you
  151. // access bitweaver as 'http://MyServer.com/applications/new/wiki/index.php' you
  152. // should enter '/applications/new/'
  153. define( 'BIT_ROOT_URL', '$bit_root_url' );
  154.  
  155.  
  156. // Here you can set the valid base URI for your site. If you do not set this, we
  157. // will automatically determine a working value. You can force the use of a 
  158. // specific URI here by putting something like: 'http://myfiles.example.com'
  159. //define( 'BIT_ROOT_URI', 'http://myfiles.example.com' );
  160.  
  161.  
  162. // Add default STORAGE_HOST_URI for optionally splitting off storage files to 
  163. // separate host. This will allow you to serve thumbnails and other files from 
  164. // a different server to your web server. If this is not set, we will use 
  165. // BIT_ROOT_URI instead. Put something like: 'http://myfiles.example.com'
  166. //define( 'STORAGE_HOST_URI', 'http://myfiles.example.com' );
  167.  
  168.  
  169. // This allows you to set a custom path to your PHP tmp directory - used for ADODB
  170. // caching if active, and other stuff This is usually only needed in very
  171. // restrictive hosting environments.
  172. //\$gTempDir = '/path/to/private/directory';
  173.  
  174.  
  175. // \$gPreScan can be used to specify the order in which packages are scanned by
  176. // the kernel.  In the example provided below, the kernel package is processed
  177. // first, followed by the users and liberty packages.  Any packages not specified
  178. // in \$gPreScan are processed in the traditional order
  179. //\$gPreScan = array( 'kernel', 'storage', 'liberty', 'themes', 'users' );
  180.  
  181. // \$gThumbSizes defines the image thumbnail sizes that will be autogenerated when
  182. // images are uploaded and processed. The example provided shows the default sizes
  183. // that are used. You can add as many sizes as you want if you override the default. 
  184. /*
  185. \$gThumbSizes = array(
  186.         'extra-large'  => array( 'width' => 1024, 'height' => 1024 ),
  187.         'large'  => array( 'width' => 800, 'height' => 800 ),
  188.         'medium' => array( 'width' => 400, 'height' => 400 ),
  189.         'small'  => array( 'width' => 160, 'height' => 160 ),
  190.         'avatar' => array( 'width' => 100, 'height' => 100 ),
  191.         'icon'   => array( 'width' => 48,  'height' => 48 ),
  192. );
  193. */";
  194.  
  195.         ifsubstrPHP_OS0== 'WIN' {
  196.             $filetowrite .= "
  197.  
  198.  
  199. // Insert the absolute path to your php magic database. This is required for 
  200. // us to check and verify the mime type of uploaded files. This setting is only 
  201. // required on windows machines.
  202. //define( 'PHP_MAGIC_PATH', 'C:\\Program Files\\PHP\\extras\\magic.mime' );";
  203.         }
  204.  
  205.         ifdefined'ROLE_MODEL' )) {
  206.             $filetowrite .= "
  207.  
  208. define( 'LIBERTY_DEFAULT_MIME_HANDLER', 'mimeflatdefault' );";
  209.         }
  210.  
  211.         $filetowrite .= "
  212.  
  213.  
  214.              /******************************************************\
  215.               ***************   Debugging Options   **************** 
  216.              \******************************************************/
  217.  
  218. // If you wish to force compiling of every page, you can set the next setting to
  219. // TRUE. this will, however, severly impact performance since every page that is
  220. // generated is generated afresh and the cache is recreated every time.
  221. \$smarty_force_compile = FALSE;
  222.  
  223.  
  224. // Setting TEMPLATE_DEBUG = TRUE will output <!-- <called templates> --> in your
  225. // templates, which will allow you to track all used templates in the HTML source
  226. // of the page. This will also disable stripping of whitespace making it easier to
  227. // read the templates. You will only see the effect of the strip changes by
  228. // clearing out your cache or setting \$smarty_force_compile = TRUE;
  229. // Note: be sure to set this to FALSE and clear out the cache once done since it
  230. //       will increase the page size by at least 10%.
  231. //define( 'TEMPLATE_DEBUG', TRUE );
  232.  
  233. // If you want to go a step further with template debugging then this enables
  234. // smarty's debugging console.  A popup with a dump of all of the vars the
  235. // template(s) have been passed.
  236. \$smarty_debugging = FALSE;
  237.  
  238.  
  239. // This statement will enable you to view all database queries made
  240. //\$gDebug = TRUE;
  241.  
  242.  
  243. // This will turn on ADODB performance monitoring and log all queries. This should
  244. // not be enabled except when doing query analysis due to an overall performance
  245. // drop.  see kernel/admin/db_performance.php for statistics
  246. //define( 'DB_PERFORMANCE_STATS', TRUE );
  247.  
  248. ?>";
  249.         fwrite$fw$filetowrite );
  250.         fclose$fw );
  251.     else {
  252.         print "UNABLE TO WRITE TO ".realpath$config_file );
  253.     }
  254. }
  255.  
  256. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:16 +0000 by phpDocumentor 1.5.0-lsces