Thread: [Comoblog-commit] comoblog/_install comoblog_preferences.xml, 1.17, 1.18 step_1.php, 1.4, 1.5
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2006-08-16 01:12:45
|
Update of /cvsroot/comoblog/comoblog/_install In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2807/_install Modified Files: comoblog_preferences.xml step_1.php Log Message: added update for 1,2 to 1.3 - a few comments to help with releases //ADDED in 1.3 for new code //TODO for things that still need to be looked at Index: comoblog_preferences.xml =================================================================== RCS file: /cvsroot/comoblog/comoblog/_install/comoblog_preferences.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- comoblog_preferences.xml 16 Aug 2006 00:29:45 -0000 1.17 +++ comoblog_preferences.xml 16 Aug 2006 01:12:41 -0000 1.18 @@ -1,9 +1,9 @@ <comoblog_preferences> - - <param + + <param name="CFG_VERSION" - value="1.2" + value="1.3" description="CoMoblog version number" topic_id="0" [...997 lines suppressed...] name="CFG_FOOTER_FONT_FAMILY" value="Verdana,Arial,Helvetica,sans-serif" @@ -1393,7 +1393,7 @@ editable="Y" display_order="" /> - + <param name="CFG_FOOTER_FONT_SIZE" value="10" @@ -1406,7 +1406,7 @@ editable="Y" display_order="" /> - + <param name="CFG_FOOTER_FONT_STYLE" value="italic" Index: step_1.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/_install/step_1.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- step_1.php 9 Oct 2005 14:11:35 -0000 1.4 +++ step_1.php 16 Aug 2006 01:12:41 -0000 1.5 @@ -2,7 +2,7 @@ /* database configuration */ - + @ignore_user_abort(true); @set_time_limit(300); session_start(); @@ -17,47 +17,47 @@ if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { - + // check form foreach ($_POST as $k => $v) { $_POST[$k] = trim($v); } - + $errors = array(); - + if ($_POST['mysql_host'] == '') $errors[] = 'mySQL host name required'; - + if ($_POST['mysql_username'] == '') $errors[] = 'mySQL username required'; - + if ($_POST['mysql_password'] != $_POST['mysql_password_cfr']) $errors[] = 'mySQL password mismatch'; - + if ($_POST['mysql_dbname'] == '') $errors[] = 'mySQL database name required'; - + if ($_POST['mysql_tabprefix'] == '') $errors[] = 'mySQL tab prefix required'; - - + + if (count($errors) == 0) { // test db connection - + $_POST['mysql_tabprefix'] = eregi_replace(" +", "_", $_POST['mysql_tabprefix']); $_POST['mysql_tabprefix'] = eregi_replace("\.+", "_", $_POST['mysql_tabprefix']); $_POST['mysql_tabprefix'] = eregi_replace(";+", "_", $_POST['mysql_tabprefix']); $_POST['mysql_tabprefix'] = eregi_replace(":+", "_", $_POST['mysql_tabprefix']); - + $dbconn = @mysql_connect ($_POST['mysql_host'], $_POST['mysql_username'], $_POST['mysql_password']); if (!$dbconn) { $errors[] = 'Error connecting to mySQL server'; $errors[] = 'error reported: ' . mysql_error(); } - + $selectdb = @mysql_select_db ($_POST['mysql_dbname']); if (!$selectdb) - $errors[] = 'Error selecting database (check database name)'; + $errors[] = 'Error selecting database (check database name)'; $query = "select pref_value from ".$_POST['mysql_tabprefix']."preferences where pref_name='CFG_VERSION'"; $res = mysql_query($query); @@ -74,31 +74,31 @@ $config = str_replace('{##MYSQL_DBNAME##}', $_POST['mysql_dbname'], $config); $config = str_replace('{##MYSQL_TABPREFIX##}', $_POST['mysql_tabprefix'], $config); - $fp = fopen(dirname(__FILE__).'/../include/param.inc.php', 'w'); + $fp = fopen(dirname(__FILE__).'/../include/param.inc.'. $_SERVER['SERVER_NAME'].'.php', 'w'); fwrite($fp, $config); fclose($fp); - @chmod (dirname(__FILE__).'/../include/param.inc.php', 0600); - + @chmod (dirname(__FILE__).'/../include/param.inc.'. $_SERVER['SERVER_NAME'].'.php', 0600); + header ('Location: upgrade_0.php'); - exit; - } + exit; + } } - if (count($errors) == 0) { + if (count($errors) == 0) { require (dirname(__FILE__).'/../admin/include/xml2array.inc.php'); $xmlparse = &new ParseXML; $xml = $xmlparse->GetXMLTree('comoblog_db.xml'); $queryerror = false; - + // generate queries $tables = $xml['COMOBLOG_DB'][0]['TABLE']; for ($c = 0; $c < count($tables); $c++) { $table_name = $tables[$c]['ATTRIBUTES']['NAME']; $table_name = str_replace('comoblog_', $_POST['mysql_tabprefix'], $table_name); - $query = "CREATE TABLE `".$table_name."` (\n"; + $query = "CREATE TABLE `".$table_name."` (\n"; $fields = $tables[$c]['FIELD']; for ($f = 0; $f < count($fields); $f++) { $field_name = $fields[$f]['ATTRIBUTES']['NAME']; @@ -116,10 +116,10 @@ $query .= ",\nUNIQUE KEY (`".$uk."`)"; } $query .= "\n) TYPE=MyISAM\n"; - + // execute CREATE TABLE query $result = mysql_query($query); - + if (!$result) { $queryerror = true; } @@ -147,13 +147,13 @@ // execute INSERT query $result = mysql_query($query); - + if (!$result) { $queryerror = true; } } } - + // comoblog_preferences unset ($xmlparse); $xmlparse = &new ParseXML; @@ -170,16 +170,16 @@ $pref_accept_null = addslashes($preferences[$c]['ATTRIBUTES']['ACCEPT_NULL']); $pref_editable = addslashes($preferences[$c]['ATTRIBUTES']['EDITABLE']); $pref_display_order = addslashes($preferences[$c]['ATTRIBUTES']['DISPLAY_ORDER']); - + $query = "INSERT INTO `".$_POST['mysql_tabprefix']."preferences` (pref_name,pref_value,pref_description,pref_topic_id,pref_encrypt,pref_type,pref_restrict_values,pref_accept_null,pref_editable,pref_display_order) VALUES ('".$pref_name."','".$pref_value."','".$pref_description."','".$pref_topic_id."','".$pref_encrypt."','".$pref_type."','".$pref_restrict_values."','".$pref_accept_null."','".$pref_editable."','".$pref_display_order."')"; $result = mysql_query($query); - + if (!$result) { $queryerror = true; } } - + if ($queryerror === true) {// if query failed, delete all tables (prefixed by tab_prefix) and print error $sql2 = 'show tables from '.$_POST['mysql_dbname']; $res2 = mysql_query($sql2); @@ -188,7 +188,7 @@ mysql_query('drop table '.$row[0]); } $errors[] = 'Error creating mySQL tables'; - + mysql_close(); } else { @@ -201,13 +201,13 @@ $config = str_replace('{##MYSQL_PASSWORD##}', $_POST['mysql_password'], $config); $config = str_replace('{##MYSQL_DBNAME##}', $_POST['mysql_dbname'], $config); $config = str_replace('{##MYSQL_TABPREFIX##}', $_POST['mysql_tabprefix'], $config); - + $fp = fopen(dirname(__FILE__).'/../include/param.inc.php', 'w'); fwrite($fp, $config); fclose($fp); - + @chmod (dirname(__FILE__).'/../include/param.inc.php', 0600); - + // redirect to step 2 $_SESSION['step'] = 1; Header ('Location: step_2.php'); |