|
From: FlorinCB <ory...@us...> - 2008-09-28 14:37:53
|
Update of /cvsroot/mxbb/mx_contact In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28952 Modified Files: db_install.php mx_contact.php Added Files: db_upgrade.php Log Message: preparing for version 2 Index: db_install.php =================================================================== RCS file: /cvsroot/mxbb/mx_contact/db_install.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db_install.php 27 Sep 2008 20:21:49 -0000 1.3 --- db_install.php 28 Sep 2008 14:37:27 -0000 1.4 *************** *** 35,39 **** } ! $mx_module_version = '1.0.0'; $mx_module_copy = 'mxBB <i> - Contact</i> module by OryNider'; --- 35,39 ---- } ! $mx_module_version = '2.0.0'; $mx_module_copy = 'mxBB <i> - Contact</i> module by OryNider'; *************** *** 75,85 **** --- 75,90 ---- username VARCHAR(25) NOT NULL DEFAULT \'\', realname VARCHAR(30) NOT NULL DEFAULT \'\', + institution VARCHAR(50) NOT NULL DEFAULT \'\', + phone VARCHAR(50) NOT NULL DEFAULT \'\', + fax VARCHAR(50) NOT NULL DEFAULT \'\', email VARCHAR(50) NOT NULL DEFAULT \'\', ip CHAR(8) NOT NULL DEFAULT \'\', message TEXT NOT NULL, + newsletter int(3) NOT NULL default \'0\', upfile VARCHAR(255) NOT NULL DEFAULT \'\', PRIMARY KEY (msg_id) )'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_version\',\'9.0.0\')'; + $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'newsletter_version\',\'1.0.0\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_admin_email\',\'\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_form_enable\',\'1\')'; Index: mx_contact.php =================================================================== RCS file: /cvsroot/mxbb/mx_contact/mx_contact.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mx_contact.php 12 Dec 2007 19:27:52 -0000 1.2 --- mx_contact.php 28 Sep 2008 14:37:27 -0000 1.3 *************** *** 291,294 **** --- 291,299 ---- $comments = $lang['Empty']; } + + //Vars not used in simple contact block + $institution = $lang['Empty']; + $phone = $lang['Empty']; + $fax = $lang['Empty']; if($contact_config['contact_permit_attachments'] == 0) *************** *** 387,398 **** $getfile = (!empty($attachment)) ? $contact_config['contact_file_root'] . "/" . decode_ip($user_ip) . "/" . $attachment : ''; ! $sql = "INSERT INTO " . CONTACT_MSGS_TABLE . " (sendtime, username, realname, email, ip, message, upfile) ! VALUES ($send_time, '$user_name', '" . str_replace("\'", "''", $real_name) . "', ! '" . str_replace("\'", "''", $email) . "', '$user_ip', '" . addslashes(str_replace("\'", "''", $comments)) . "', '" . str_replace("\'", "''", $getfile) . "')"; ! if(!$db->sql_query($sql, END_TRANSACTION)) ! { ! mx_message_die(GENERAL_ERROR, 'Could not update Message Log', '', __LINE__, __FILE__, $sql); ! } } --- 392,413 ---- $getfile = (!empty($attachment)) ? $contact_config['contact_file_root'] . "/" . decode_ip($user_ip) . "/" . $attachment : ''; ! $sql = array( ! 'sendtime' => $send_time, ! 'username' => $user_name, ! 'realname' => str_replace("\'", "''", $real_name), ! 'institution' => str_replace("\'", "''", $institution), ! 'phone' => str_replace("\'", "''", $phone), ! 'fax' => str_replace("\'", "''", $fax), ! 'email' => str_replace("\'", "''", $email), ! 'ip' => $user_ip, ! 'message' => addslashes(str_replace("\'", "''", $comments)), ! 'newsletter'=> (int) $newsletter, ! 'upfile' => str_replace("\'", "''", $getfile), ! ); ! if(!$result = $db->sql_query("INSERT INTO " . CONTACT_MSGS_TABLE . $db->sql_build_array('INSERT', $sql))) ! { ! mx_message_die(GENERAL_ERROR, 'Could not update Message Log', '', __LINE__, __FILE__, $sql); ! } } --- NEW FILE: db_upgrade.php --- <?php /** * * @package mxBB Portal Module - mx_contact * @version $Id: db_upgrade.php,v 1.1 2008/09/28 14:37:28 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define( 'IN_PORTAL', true ); if ( !defined( 'IN_ADMIN' ) ) { $mx_root_path = './../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } // End session management } $mx_module_version = '2.0.0'; $mx_module_copy = 'mxBB <i> - Contact</i> module by OryNider'; $sql = array(); // // Precheck // if ( $result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "contact_config" ) ) { // // Upgrade checks // $upgrade_200 = 0; // // validate before 2.00 // $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "contact_config WHERE config_name = 'newsletter_version'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_200 = 1; } $message = "<b>Upgrading!</b><br/><br/>"; if ( $upgrade_200 == 1 ) { $message .= "<b>Upgrading to v. 2.00...</b><br/><br/>"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "contact_msgs ADD institution VARCHAR(50) NOT NULL DEFAULT '' AFTER realname"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "contact_msgs ADD phone VARCHAR(50) NOT NULL DEFAULT '' AFTER institution"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "contact_msgs ADD fax VARCHAR(50) NOT NULL DEFAULT '' AFTER phone"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "contact_msgs ADD newsletter int(3) NOT NULL default '0' AFTER message"; $sql[] = "INSERT INTO " . $mx_table_prefix . "contact_config VALUES ('newsletter_version', '1.0.0')"; } else { $message .= "<b>Nothing to upgrade...</b><br/><br/>"; } $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); } else { // // If not installed // $message = "<b>Module is not installed...and thus cannot be upgraded ;)</b><br/><br/>"; } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Module Installation/Upgrading/Uninstalling Information - module specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> |