Update of /cvsroot/mxbb/mx_contact In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3418 Added Files: contact_captcha.php db_install.php db_uninstall.php index.htm mx_contact.pak mx_contact.php readme.txt release.txt Log Message: First Version! --- NEW FILE: release.txt --- [b][Release]: mxBB Contact - Module[/b] [b][Authors]: darkassasin93, marcus.smith, OryNider[/b] [b][Version]: 1.0B[/b] [b]Designed for mxBB Version: 2.8.0[/b] [b][Support]:[/b] [URL=http://www.mx-system.com/]post here[/URL] [b]Author's Notes:[/b] Description: Allows visitors to contact the site Admin via a Contact Form. Files can also be attached and sent if permitte (12/12/2007) [b]ScreenShots: [/b] [IMG]http://img146.imageshack.us/img146/2414/mxbbcontactxl1.png[/IMG] [b][Download]: [/b][URL=http://www.mx-system.com/]mx_contact.zip[/URL] --- NEW FILE: contact_captcha.php --- <?php /*************************************************************************** * contact_captcha.php * ------------------- * Version: 9.0.0 * Begin: Tuesday, Dec 06, 2006 * Copyright: (C) 2006-07, Marcus * E-mail: ma...@ph... * $id: 21:55 25/06/2007 * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if( !defined('IN_PORTAL') || !is_object($mx_block)) { define('IN_PORTAL', true); $mx_root_path = '../../'; $module_root_path = './'; // // Let's include some stuff... // $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.' . $phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $block_id = ( !empty($HTTP_GET_VARS['block_id']) ) ? $HTTP_GET_VARS['block_id'] : $HTTP_POST_VARS['id']; if( empty($block_id) ) { $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE block_title = 'mxBB Contact' LIMIT 1"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not query Contact module information", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $block_id = $row['block_id']; } $is_block = FALSE; } else { // // Read block Configuration $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); if( is_object($mx_block)) { $is_block = TRUE; } global $images; } include_once($module_root_path . 'includes/contact_constants.'.$phpEx); define('PAGE_CONTACT_FORM', -1405); @session_start(); $contact_config = array(); $sql = "SELECT * FROM " . CONTACT_CONFIG_TABLE; if(!($result = $db->sql_query($sql))) { message_die(CRITICAL_ERROR, 'Could not query config information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $contact_config[$row['config_name']] = $row['config_value']; } // // Seed the random number generator // 104729 is the 10000th prime number // mt_srand((double)microtime() * 104729); $random = md5(mt_rand() * microtime()); $digit = rand(1,9); $random = str_replace(0, $digit, $random); // Substitute zeros $length = rand(4,5); $captcha = substr($random, 0, $length); unset($random, $digit); $type = ''; if($contact_config['contact_captcha_type'] == 2) { if(function_exists('glob')) { $type = rand(0,1); } else { $type = 1; // PHP < 4.3.0 } } if($contact_config['contact_captcha_type'] == 0 || $type == 0) { unset($type); foreach(glob($module_root_path . 'images/captcha/captcha*.png') as $bgimg); if(empty($bgimg)) { $type = 1; } else { // // Image based CAPTCHA // $bg = rand(1,5); $image = @imagecreatefrompng($module_root_path . 'images/captcha/captcha'.$bg.'.png'); $txtcol = imagecolorallocate($image, 0, 0, 0); display_code($captcha); } } if($contact_config['contact_captcha_type'] == 1 || $type == 1) { unset($type); // // Coloured CAPTCHA // $image = imagecreate(80,25); $background = imagecolorallocatealpha($image, rand(125,255), rand(125,255), rand(125,255), rand(50,100)); $linecol = imagecolorallocatealpha($image, rand(50,200), rand(50,200), rand(50,200), rand(20,80)); $txtcol = imagecolorallocate($image, 0,0,0); $blk = imagecolorallocate($image, 0,0,0); // // Random Lines // $lines = rand(2,5); for($i=1; $i<=$lines; $i++) { imageline($image, rand(2,78), rand(2,23), rand(78,2), rand(23,2), $linecol); } // // Border Lines // imageline($image, 0, 0, 79, 0, $blk); imageline($image, 0, 0, 0, 24, $blk); imageline($image, 79, 24, 0, 24, $blk); imageline($image, 79, 24, 79, 0, $blk); display_code($captcha); } function display_code($captcha) { global $module_root_path; global $txtcol, $image, $length; if(function_exists('imagettftext')) { for($i=1; $i<=$length; $i++) { // // Rotate Characters // $rotate = rand(1,2); if($rotate == 1) { $angle = rand(0,25); } else { $angle = rand(335,360); } // // TTF's Fonts // $font = rand(1,5); switch ($font) { case 1: imagettftext($image, rand(12,14), $angle, ($i*12), 20, $txtcol, $module_root_path . 'fonts/ArialRoundedBT.ttf', substr($captcha,($i-1),1)); break; case 2: imagettftext($image, rand(12,14), $angle, ($i*12), 20, $txtcol, $module_root_path . 'fonts/VillageSquare.ttf', substr($captcha,($i-1),1)); break; case 3: imagettftext($image, rand(12,14), $angle, ($i*12), 20, $txtcol, $module_root_path . 'fonts/BauerBodoniItalicBT.ttf', substr($captcha,($i-1),1)); break; case 4: imagettftext($image, rand(12,14), $angle, ($i*12), 20, $txtcol, $module_root_path . 'fonts/WarmMilk.ttf', substr($captcha,($i-1),1)); break; case 5: imagettftext($image, rand(12,14), $angle, ($i*12), 20, $txtcol, $module_root_path . 'fonts/OregonDry.ttf', substr($captcha,($i-1),1)); break; } } } else { // // Standard PHP Font // imagestring($image, rand(4,5), rand(13,18), 4, $captcha, $txtcol); } } if(@ini_get('register_globals') == '0' || strtolower(@ini_get('register_globals')) == 'off') { $HTTP_SESSION_VARS['randi'] = $captcha; } else { // PHP5 $_SESSION['randi'] = $captcha; } header("Content-type: image/png"); header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); imagepng($image); imagedestroy($image); ?> --- NEW FILE: db_uninstall.php --- <?php /** * * @package mxBB Portal Module - mx_contact * @version $Id: db_uninstall.php,v 1.1 2007/12/12 18:41:35 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(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } // // End session management // } $sql = array( "DROP TABLE ".$mx_table_prefix."contact_config", "DROP TABLE ".$mx_table_prefix."contact_emails" "DROP TABLE ".$mx_table_prefix."contact" ); $n = 0; $message = "<b>This list is a result of the SQL queries needed to uninstall radio Module Addon</b><br/><br/>"; while($sql[$n]) { $message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : ''; if( !$result = $db->sql_query($sql[$n]) ) { $message .= '<b><font color=#FF0000>[Error or Already removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } else { $message .='<b><font color=#0000fF>[Removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } $n++; } $message .= ' <br />If you get some Error, relax, this is normal when updating modules'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Installation Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: mx_contact.pak --- module=+:266=+:mxBB Contact=+:modules/mx_contact/=+:mx_contact=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:266=+:267=+:mxBB Contact=+:mxBB Contact block=+:mx_contact.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:mxBB Contact=+:Demo block=+:267=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 --- NEW FILE: readme.txt --- /********************************************************************************\ | | subject : mxBB-Portal, CMS & portal, module | name : mx_contact | begin : December, 2007 | copyright : (C) 2002-2007 mxBB | mxBB project site : www.mx-system.com | | author : OryNider (see additional credit below) | author site : http://pubory.uv.ro/ | author email : ory...@rd... | | additional credit : Original "Contact Form" Mod by | marcus.smith < ma...@ph... > (MarcuS) http://www.phobbia.net/mods/ | MOD Author : darkassasin93 < N/A > (Matt Bowen) N/A | | description : Allows visitors to contact the site Admin via a Contact Form. | Files can also be attached and sent if permitted | ScreenShot : http://img146.imageshack.us/img146/2414/mxbbcontactxl1.png |********************************************************************************| | | @package mxBB Portal Module - mx_phpCA | @version $Id: readme.txt,v 1.1 2007/12/12 18:41:38 orynider Exp $ | @copyright (c) 2002-2007 [OryNider] mxBB Development Team | @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 | \********************************************************************************/ /********************************************************************************\ | Installation Instructions \********************************************************************************/ Note: In order for this module to install you must have a working phpBB and mxBB installation. 1) Copy the folder: mx_contact into your: {mxBB install}\modules\ folder on your web server. 2) From your website enter mxBB Admin Control Panel. 3) Under mxBB-Portal click on Management. 4) Now click on Modules Setup. 5) Under Module Administration use the pull down menu and choose: mx_contact 6) Press the Install Module button 7) If you have followed the instructions correctly you should now be able to create Mx Counter blocks for inclusion on your pages. 8) chmod 777 efiles/ /********************************************************************************\ | End Of Document \********************************************************************************/ --- NEW FILE: mx_contact.php --- <?php /*************************************************************************** * contact.php * ----------- * Version: 9.0.0 * Begin: Sunday, Sept 17, 2006 * Copyright: (C) 2006-07, Marcus * E-mail: ma...@ph... * $id: 21:55 25/06/2007 * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ if( !defined('IN_PORTAL')) { //die("Hacking attempt"); } // // Read Block Settings // $title = $mx_block->block_info['block_title']; $b_description = $mx_block->block_info['block_desc']; $is_block = FALSE; include_once($module_root_path . 'includes/contact_constants.' . $phpEx); function this_contact_mxurl($args = '', $force_standalone_mode = false) { global $mx_root_path, $module_root_path, $page_id, $phpEx, $mx_block; if( $force_standalone_mode || !is_object($mx_block) ) { $mxurl = $mx_root_path . 'modules/mx_contact/' . 'contact.' . $phpEx . ($args == '' ? '' : '?' . $args); } else { $mxurl = $mx_root_path . 'index.' . $phpEx; if( is_numeric($page_id) && !empty($page_id) ) { $mxurl .= '?page=' . $page_id . ($args == '' ? '' : '&' . $args); } else { $mxurl .= '?page=' . $page_id . ($args == '' ? '' : '&' . $args); } } return $mxurl; } // // Session management // $userdata = session_pagestart($user_ip, PAGE_CONTACT_FORM); init_userprefs($userdata); $contact_config = array(); $_br = '<br /><br />'; $sql = "SELECT * FROM " . CONTACT_CONFIG_TABLE; if(!($result = $db->sql_query($sql))) { mx_message_die(CRITICAL_ERROR, 'Could not query config information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $contact_config[$row['config_name']] = $row['config_value']; } // // Is the Form Enabled? // if($contact_config['contact_form_enable'] == 0) { mx_message_die(GENERAL_MESSAGE, $lang['Contact_Disabled'] . $_br . sprintf($lang['Click_return_index'], "<a href=" . mx_append_sid(this_contact_mxurl()) . ">", "</a>")); } // // Assign parameters // $user_name = $userdata['username']; $real_name = (!isset($HTTP_POST_VARS['real_name'])) ? '' : stripslashes(trim(htmlspecialchars($HTTP_POST_VARS['real_name']))); $email = (!isset($HTTP_POST_VARS['email'])) ? '' : stripslashes(trim(htmlspecialchars($HTTP_POST_VARS['email']))); $comments = (!isset($HTTP_POST_VARS['feedback'])) ? '' : stripslashes(trim(htmlspecialchars($HTTP_POST_VARS['feedback']))); $attachment = (!isset($HTTP_POST_FILES['attachment']['name'])) ? '' : basename($HTTP_POST_FILES['attachment']['name']); $code = (!isset($HTTP_POST_VARS['code'])) ? '' : htmlspecialchars(trim($HTTP_POST_VARS['code'])); $script_path = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path'])); $script_name = ($script_path != $module_root_path) ? $module_root_path . '/contact.'.$phpEx : $script_path . 'conatct.'.$phpEx; $server_name = trim($board_config['server_name']); $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/'; $server_url = $server_protocol . $server_name . $server_port; $timedate = date("D M d, Y g:ia"); $CF_general_message = 0; // // "Quick Delete" an Attachment // if(isset($HTTP_GET_VARS['delete'])) { if($contact_config['contact_delete'] == 0) { mx_message_die(GENERAL_ERROR, $lang['QDelete_disabled']); } else { include_once($module_root_path . 'includes/functions_contact.'.$phpEx); exit; } } // // Start send script // if(isset($HTTP_POST_VARS['submit'])) { function error_check() { global $HTTP_POST_FILES, $lang, $phpEx, $module_root_path, $module_root_path, $mx_root_path; global $CF_general_message, $CF_code_empty, $CF_code_wrong, $CF_ini_max; global $CF_illegal_ext, $CF_unknown_ext, $CF_image_error, $CF_image_zip; global $CF_rname_empty, $CF_email_empty, $CF_email_check, $CF_comments_empty, $CF_comments_limit; global $CF_attach_POST_error, $CF_attach_file_exists, $CF_attach_file_dud, $CF_attach_file_big; // // Lets check for Errors // if($CF_general_message == 1) { @unlink($HTTP_POST_FILES['attachment']['tmp_name']); mx_message_die(GENERAL_ERROR, $lang['Contact_error'] . $CF_code_empty . $CF_code_wrong . $CF_attach_POST_error . $CF_illegal_ext . $CF_unknown_ext . $CF_rname_empty . $CF_email_empty . $CF_email_check . $CF_comments_empty . $CF_comments_limit . $CF_attach_file_exists . $CF_attach_file_dud . $CF_attach_file_big . $CF_image_error . $CF_image_zip . sprintf($lang['Click_return_form'], "<a href=" . this_contact_mxurl() . " onclick=\"history.back(-1); return false;\">", "</a>")); } } // // Flood Control // if($contact_config['contact_flood_limit'] != 0) { $sql = "SELECT send_time, ip_address FROM " . CONTACT_TABLE . " WHERE ip_address = '$user_ip' ORDER BY send_time DESC"; $result = $db->sql_query($sql); if(!$db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, 'Failed to retrieve flood information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $time_left = round(intval($row['send_time'] - time()) / intval(60) / intval(60)); if($row['ip_address'] == $user_ip && $row['send_time'] - time() > 0) { mx_message_die(GENERAL_ERROR, sprintf($lang['Flood_limit'], $time_left)); } } // // Captcha Code // if(extension_loaded('gd')) { if($contact_config['contact_captcha'] == 1) { @session_start(); if(@ini_get('register_globals') == '0' || strtolower(@ini_get('register_globals')) == 'off') { if(isset($HTTP_SESSION_VARS['randi'])) { $randi = substr($HTTP_SESSION_VARS['randi'],0,6); } } else { // Required for max PHP5 compatability if(isset($_SESSION['randi'])) { $randi = substr($_SESSION['randi'],0,6); } } if(empty($code)) { $CF_code_empty = $_br . $lang['Code_Empty']; $CF_general_message = 1; } elseif($code != $randi) { $CF_code_wrong = $_br . $lang['Code_Wrong']; $CF_general_message = 1; } // // Clear session data to prevent image reuse // @session_destroy(); unset($randi); } } // // Real Name Validator // if($contact_config['contact_require_rname'] == 1) { if(empty($real_name)) { $CF_rname_empty = $_br . $lang['Rname-Empty']; $CF_general_message = 1; } } // // E-mail Validator // if($contact_config['contact_require_email'] == 1) { if(!empty($email)) { if(!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-äöü]+\.([a-z0-9\-äöü]+\.)*?[a-z]+$/is', $email)) { $CF_email_check = $_br . $lang['Email-Check']; $CF_general_message = 1; } } else { $CF_email_empty = $_br . $lang['Email-Empty']; $CF_general_message = 1; } } // // Comments Validator // if($contact_config['contact_require_comments'] == 1) { if(empty($comments)) { $CF_comments_empty = $_br . $lang['Comments-Empty']; $CF_general_message = 1; } } if($contact_config['contact_char_limit'] > 0) { if(strlen(trim($comments)) > $contact_config['contact_char_limit']) { $CF_comments_limit = $_br . $lang['Comments_exceeded']; $CF_general_message = 1; } } // Stage 1 error_check(); $CF_attach_success = ''; if($contact_config['contact_permit_attachments'] == 1) { require($module_root_path . 'includes/contact_attach.'.$phpEx); } // Stage 5 error_check(); // // Indicate any fields that weren't completed // if(empty($real_name) && $contact_config['contact_require_rname'] == 0) { $real_name = $lang['Empty']; } if(empty($email) && $contact_config['contact_require_email'] == 0) { $email = $lang['Empty']; } if(empty($comments) && $contact_config['contact_require_comments'] == 0) { $comments = $lang['Empty']; } if($contact_config['contact_permit_attachments'] == 0) { $attach = '--'; $delete_link = ''; } // // Change "Anonymous" to "Guest" // $user_name = ($userdata['user_id'] == ANONYMOUS) ? $lang['Guest'] : $userdata['username']; // // Set the Subject // NB: not used if email/index.tpl has 'Subject:' hard-coded // $subject = trim(stripslashes($lang['Feedback'])); $sql = "SELECT user_lang FROM " . USERS_TABLE . " WHERE user_id = 2"; if(!$result = $db->sql_query($sql)) { mx_message_die(CRITICAL_ERROR, 'Could not query recipient information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); // // Send the e-mail // include($module_root_path . 'includes/contact_emailer.'.$phpEx); $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $email_headers = 'X-AntiAbuse: Board Servername - ' . $board_config['server_name'] . "\n"; $email_headers .= 'X-AntiAbuse: User ID - ' . $userdata['user_id'] . "\n"; $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n"; empty($contact_config['contact_admin_email']) ? $emailer->email_address($board_config['board_email']) : $emailer->email_address($contact_config['contact_admin_email']); $emailer->extra_headers($email_headers); $emailer->use_template('contact', $row['user_lang']); $emailer->set_subject($subject); $emailer->assign_vars(array( 'REAL_NAME' => $real_name, 'USERNAME' => $user_name, 'EMAIL' => $email, 'COMMENTS' => $comments, 'ATTACHMENT' => $attach, 'DELETE' => ($contact_config['contact_delete'] == 1) ? $delete_link : '', 'USER_IP' => decode_ip($user_ip), 'TIMEDATE' => $timedate, 'SITENAME' => $board_config['sitename']) ); $emailer->send(); $emailer->reset(); // // Send "Thank You" E-mail? // if($contact_config['contact_thankyou'] != 0) { include($module_root_path . 'includes/contact_extend.'.$phpEx); } // // SQL Time // $wait_time = time() + intval($contact_config['contact_flood_limit'] * 60) * intval(60); $sql = "INSERT INTO " . CONTACT_TABLE . " VALUES ('$user_ip', '$wait_time')"; $result = $db->sql_query($sql); if(!$db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, 'Failed to insert user information', '', __LINE__, __FILE__, $sql); } // // No Errors // if($CF_general_message == 0) { if($contact_config['contact_storage'] == 1) { $send_time = time(); $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); } } mx_message_die(GENERAL_MESSAGE, $lang['Contact_success'] . $CF_attach_success . $_br . sprintf($lang['Click_return_index'], "<a href=" . mx_append_sid(this_contact_mxurl()) . ">", "</a>")); } } // // End send script // // // Change "Anonymous" to "Guest" // $user_name = ($userdata['user_id'] == ANONYMOUS) ? $lang['Guest'] : $userdata['username']; // // Check if "Real Name" is required // $rname = ($contact_config['contact_require_rname'] == 1) ? $lang['Rname_require'] : $lang['Real_name']; // // Check if "E-mail" is required // $email = ($contact_config['contact_require_email'] == 1) ? $lang['E-mail_require'] : $lang['E-mail']; // // Check if "Comments" are required // $comments = ($contact_config['contact_require_comments'] == 1) ? $lang['Comments_require'] : $lang['Comments']; // // Pruning // if($contact_config['contact_prune'] == 1) { $send_time = time(); $sql = "DELETE FROM " . CONTACT_TABLE . " WHERE send_time <= '$send_time'"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, 'Failed to initiate pruning', '', __LINE__, __FILE__, $sql); } } // // Generate the Page // //include($mx_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( 'contact_body' => 'contact_body.tpl') ); $template->assign_vars(array( 'L_CONTACT_FORM' => $lang['Contact_form'], 'L_INTRODUCTION' => $lang['Contact_intro'], 'L_REAL_NAME' => $rname, 'L_REAL_NAME_EXPLAIN' => $lang['Real_name_explain'], 'L_EMAIL' => $email, 'L_EXPLAIN_EMAIL' => $lang['Explain_email'], 'L_COMMENTS' => $comments, 'L_COMMENTS_EXPLAIN' => $lang['Comments_explain'], 'L_COMMENTS_LIMIT' => ($contact_config['contact_char_limit'] > 0) ? sprintf($lang['Comments_limit'], $contact_config['contact_char_limit']) : '', 'L_ATTACHMENT' => $lang['Attachment'], 'L_ATTACHMENT_EXPLAIN' => sprintf($lang['Attachment_explain'], $contact_config['contact_max_file_size']), 'L_FLOOD_EXPLAIN' => ($contact_config['contact_flood_limit'] > 0) ? sprintf($lang['Flood_explain'], $contact_config['contact_flood_limit'], ($contact_config['contact_flood_limit'] <> 1) ? $lang['hours'] : $lang['hour']) : '', 'L_FIELDS_REQUIRED' => $lang['Fields_required'], 'L_NOTIFY_IP' => $lang['Notify_IP'], 'L_CHARS' => $lang['Chars'], 'L_CAPTCHA' => $lang['Captcha_code'], 'L_CAPTCHA_EXPLAIN' => $lang['Captcha_code_explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'USERNAME' => $user_name, 'CAPTCHA' => $module_root_path.'contact_captcha.'.$phpEx, 'S_FORM_ENCTYPE' => 'multipart/form-data', 'S_SUBMIT_ACTION' => mx_append_sid(this_contact_mxurl()) )); // // Permit Attachments // $attach_auth = 0; if(!$userdata['session_logged_in']) { $attach_auth = ($contact_config['contact_auth_guest'] == 1) ? 1 : 0; } else { switch ($userdata['user_level']) { case USER: $attach_auth = ($contact_config['contact_auth_user'] == 1) ? 1 : 0; break; case MOD: $attach_auth = ($contact_config['contact_auth_mod'] == 1) ? 1 : 0; break; case ADMIN: $attach_auth = ($contact_config['contact_auth_admin'] == 1) ? 1 : 0; break; default: $attach_auth = ($contact_config['contact_auth_guest'] == 1) ? 1 : 0; } } if($contact_config['contact_permit_attachments'] == 1 && $attach_auth == 1) { $template->assign_block_vars('permit_attachments', array()); } if($contact_config['contact_captcha'] == 1 && extension_loaded('gd')) { $template->assign_block_vars('captcha', array()); } $template->pparse('contact_body'); //include($mx_root_path . 'includes/page_tail.'.$phpEx); ?> --- NEW FILE: db_install.php --- <?php /** * * @package mxBB Portal Module - mx_contact * @version $Id: db_install.php,v 1.1 2007/12/12 18:41:35 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ //ini_set( 'display_errors', '1' ); 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); // End session management if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } } $mx_module_version = '1.0.0'; $mx_module_copy = 'mxBB <i> - Contact</i> module by OryNider'; // If fresh install if ( !$result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "radio_config" ) ) { $message = "<b>This is a fresh install!</b><br/><br/>"; // // Build Array of SQL Statements. // $sql = array(); $sql[] = 'DROP TABLE IF EXISTS ' . $mx_table_prefix . 'contact_config'; $sql[] = 'DROP TABLE IF EXISTS ' . $mx_table_prefix . 'contact_emails'; $sql[] = 'DROP TABLE IF EXISTS ' . $mx_table_prefix . 'contact'; $sql[] = 'CREATE TABLE ' . $mx_table_prefix . 'contact ( ip_address CHAR(8) NOT NULL DEFAULT \'\', send_time INTEGER(11) NOT NULL DEFAULT \'0\', KEY ip_address (ip_address) )'; $sql[] = 'CREATE TABLE ' . $mx_table_prefix . 'contact_config ( config_name VARCHAR(255) NOT NULL DEFAULT \'\', config_value VARCHAR(255) NOT NULL DEFAULT \'\', PRIMARY KEY (config_name) )'; $sql[] = 'CREATE TABLE ' . $mx_table_prefix . 'contact_emails ( email VARCHAR(50) NOT NULL DEFAULT\'\', sent INT(1) NOT NULL DEFAULT \'0\', lasttime INTEGER(11) NOT NULL DEFAULT \'0\', PRIMARY KEY (email) )'; $sql[] = 'CREATE TABLE ' . $mx_table_prefix . 'contact_msgs ( msg_id INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, sendtime INT(11) NOT NULL DEFAULT \'0\', username VARCHAR(25) NOT NULL DEFAULT \'\', realname VARCHAR(30) NOT NULL DEFAULT \'\', email VARCHAR(50) NOT NULL DEFAULT \'\', ip CHAR(8) NOT NULL DEFAULT \'\', message TEXT NOT NULL, 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(\'contact_admin_email\',\'\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_form_enable\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_require_rname\',\'0\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_require_email\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_require_comments\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_permit_attachments\',\'0\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_max_file_size\',\'128\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_file_root\',\'efiles\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_flood_limit\',\'8\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_char_limit\',\'255\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_prune\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_hash\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_auth_guest\',\'0\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_auth_user\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_auth_mod\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_auth_admin\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_captcha\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_captcha_type\',\'0\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_delete\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_storage\',\'1\')'; $sql[] = 'INSERT INTO ' . $mx_table_prefix . 'contact_config VALUES(\'contact_thankyou\',\'1\')'; $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 already installed $message = "<b>Module is already installed... consider upgrading ;)</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/Uninstallation Information - Module specific DB tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> --- NEW FILE: index.htm --- <html> <head> <title>mxBB Counter Module</title> </head> <body> <br /><br /><br /><br /><br /><br /><br /> <center><h1><a href="http://mxbb.net/">mxBB-Portal</a></h1></center> </body> |