|
From: FlorinCB <ory...@us...> - 2008-08-10 20:25:33
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22014/includes Modified Files: mx_functions.php Log Message: function update_portal_backend I will explain in the forum ... Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** mx_functions.php 15 Jul 2008 22:22:23 -0000 1.87 --- mx_functions.php 10 Aug 2008 20:25:27 -0000 1.88 *************** *** 2413,2415 **** --- 2413,2480 ---- } } + /** + * update config.php values. + * + */ + function update_portal_backend($new_backend = PORTAL_BACKEND) + { + global $mx_root_path, $lang, $phpEx, $portal_config; + + if( @file_exists($mx_root_path . "config.$phpEx") ) + { + require($mx_root_path . "config.$phpEx"); + } + + $mx_portal_name = 'MX-Publisher Modular System'; + + /* + $config = array( + 'dbms' => $dbms, + 'dbhost' => $dbhost, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + 'mx_table_prefix' => $mx_table_prefix, + 'portal_backend' => (!empty($portal_backend) ? $portal_backend : 'internal'), + ); + */ + + $new_backend = ($new_backend) ? $new_backend : 'internal'; + + $process_msgs[] = 'Writing config ...<br />'; + + $config_data = "<"."?php\n\n"; + $config_data .= "// $mx_portal_name auto-generated config file\n// Do not change anything in this file!\n\n"; + $config_data .= "// This file must be put into the $mx_portal_name directory, not into the phpBB directory.\n\n"; + $config_data .= '$'."dbms = '$dbms';\n\n"; + $config_data .= '$'."dbhost = '$dbhost';\n"; + $config_data .= '$'."dbname = '$dbname';\n"; + $config_data .= '$'."dbuser = '$dbuser';\n"; + $config_data .= '$'."dbpasswd = '$dbpasswd';\n\n"; + $config_data .= '$'."mx_table_prefix = '$mx_table_prefix';\n\n"; + $config_data .= "define('PORTAL_BACKEND', '$new_backend');\n\n"; + $config_data .= "define('MX_INSTALLED', true);\n\n"; + $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + + @umask(0111); + @chmod($mx_root_path . "config.$phpEx", 0644); + + if ( !($fp = @fopen($mx_root_path . 'config.' . $phpEx, 'w')) ) + { + $process_msgs[] = "Unable to write config file " . $mx_root_path . "config.$phpEx" . "<br />\n"; + } + $result = @fputs($fp, $config_data, strlen($config_data)); + @fclose($fp); + + $process_msgs[] = '<span style="color:pink;">'.str_replace("\n", "<br />\n", htmlspecialchars($config_data)).'</span>'; + + $message = '<hr />'; + for( $i=0; $i < count($process_msgs); $i++ ) + { + $message .= $process_msgs[$i] . ( $process_msgs[$i] == '<hr />' ? '' : '<br />' ) . "\n"; + } + $message .= '<hr />'; + + return $message; + } ?> \ No newline at end of file |