$emailList .= ", "; } } } // Generate the php config file // We have it aligned to the right so that extra white space does not get into the final file $configData = "<?php\r\n/**\r\n * This makes it easier to include configuration variables to other classes\r\n * by simply extending the class with the Config class. Any new variables that\r\n * get added MUST have a getter as that will be the only way to retrieve a Config\r\n * value if the config value needs to be used outside as it's own object.\r\n *\r\n * Change ALL values below to what you desire for your website. If you did not\r\n * change the gban.sql file, then the database name will be global_ban. Otherwise\r\n * all other variables, espeically those in the database block should be changed\r\n * appropriately.\r\n */\r\n\r\nclass Config {\r\n /**\r\n * Site specific settings\r\n */\r\n var \$" . "LANGUAGE = \"" . $_POST['LANGUAGE'] . "\"; // Default Language (English, Spanish, French, ...) \r\n var \$" . "bansPerPage = " . $_POST['bansPerPage'] . "; // Number of bans to display on ban list page for each page (-1 show all)\r\n var \$" . "maxPageLinks = " . $_POST['numPageLinks'] . "; // Number of links to show before and after selected page (IE: set at 2 you would see 1 2 ... 10 11 [12] 13 14 ... 23 24)\r\n var \$" . "demoRootDir = \"" . $_POST['demoDir'] . "\"; // Folder to save demos to (folder must be relative to banned dir)\r\n var \$" . "demoSizeLimit = \"" . $_POST['demoSizeLimit'] . "\"; // Demo size limit in MB\r\n var \$" . "siteName = \"" . str_replace("\$", "\\\$", $_POST['siteName']) . "\"; // The name of your website\r\n var \$" . "siteUrl = \"" . $url . "\"; // Your clan/server's home page\r\n var \$" . "siteLogo = \"" . $logo . "\"; // Found in images directory; you must save your logo to the images dir!!\r\n\r\n /**\r\n * SMF integration settings\r\n * The gban tables MUST be installed in your SMF database (\$" . "dbName = \"YOUR_SMF_DB\")\r\n * Full power admins are those with FULL ADMIN rights to the SMF boards\r\n * If you wish to use SMF integration you MUST install the zip under your Forums directory\r\n * So you will access the pages by going to Forums/banned\r\n */\r\n var \$" . "enableSmfIntegration = " . $_POST['smfIntegration'] . "; // Whether to enable SMF integartion\r\n var \$" . "smfTablePrefix = \"" . $_POST['smfTablePrefix'] . "\"; // The prefix of the SMF tables\r\n var \$" . "memberGroup = " . $_POST['smfMemberGroup'] . "; // The SMF group id that contains all your members\r\n var \$" . "adminGroup = " . $_POST['smfAdminGroup'] . "; // The SMF group id that contains all your admins\r\n var \$" . "banManagerGroup = " . $_POST['smfBanManagerGroup'] . "; // The SMF group id that contains all your ban managers\r\n var \$" . "fullPowerGroup = " . $_POST['smfFullPowerGroup'] . "; // The SMF group id that is allowed full access to the GlobalBan site and admin tools\r\n var \$" . "noPowerGroup = " . $_POST['smfNoPowerGroup'] . "; // The SMF group id that has no power unless given by an admin group\r\n\r\n /**\r\n * e107 integration settings\r\n */\r\n var \$" . "enableAutoPoste107Forum = " . $_POST['enableAutoPoste107Forum'] . "; // Whether to enable e107 integration, just generate Auto-Post in the e107 Forum with each new ban.\r\n var \$" . "e107TablePrefix = \"" . $_POST['e107TablePrefix'] . "\"; // The prefix of the e107 tables\r\n var \$" . "e107Url = \"" . $_POST['e107Url'] . "\"; // Your e107 web site Ej: \"http://www.e107.com/\"\r\n var \$" . "e107_dbName = \"" . $_POST['e107_dbName'] . "\"; // Set the e107 Database Name to access\r\n var \$" . "e107_dbUserName = \"" . $_POST['e107_dbUserName'] . "\"; // Set the Database's user name login (recommend a user with only select and insert privs)\r\n var \$" . "e107_dbPassword = \"" . $_POST['e107_dbPassword'] . "\"; // Set the Database user's password login\r\n var \$" . "e107_dbHostName = \"" . $_POST['e107_dbHostName'] . "\"; // Set the Database's host\r\n var \$" . "e107_bans_forum_category_number = \"" . $_POST['e107_bans_forum_category_number'] . "\"; // For example if your Banned forum category link is http://www.youre107.com/e107_plugins/forum/forum_viewforum.php?19 you must set it to \"19\"\r\n var \$" . "e107_GlobalBan_user = \"" . $_POST['e107_GlobalBan_user'] . "\"; // e107 user to use like post owner, format must be \"user_number_ID.user_name\", Ex: \"5.GlobalBan\"\r\n\r\n /**\r\n * Ban specific settings\r\n */\r\n var \$" . "banMessage = \"" . str_replace("\$", "\\\$", $_POST['banMessage']) . "\"; // Message to display to those banned\r\n var \$" . "daysBanPending = " . $_POST['daysBanPending'] . "; // Number of days to keep someone with a \"pending\" ban off the server (0 to let the person come back after being \"banned\"); this only affects \"members\" who do bans longer than 1 day\r\n var \$" . "allowAdminBans = " . $_POST['allowAdminBan'] . "; // Set to true to allow the banning of admins (Default off - false)\r\n var \$" . "teachAdmins = " . $_POST['teachAdmins'] . "; // Teach admins the !banmenu command\r\n var \$" . "removePendingOnUpload = " . $_POST['removePendingOnUpload'] . "; // Remove the pending status from a ban when a member uploads a demo for that ban\r\n var \$" . "adviseInGame = " . $_POST['adviseInGame'] . "; // Allows you to select which players will be advised during the game when you connect a player who was banned temporarily by a ban already expired: 1 - All (Panel), 2 - Only Admins Chat & Ex-Banned Player; 3 - Only Admins Chat; 4 - Only Ex-Banned (Panel); 5 - NoBody\r\n var \$" . "adviseInGameLenght = " . $_POST['adviseInGameLenght'] . "; // Allows you to select required Min Ban Lenght in seconds to advise.\r\n\r\n //var \$" . "numDemosToBan = -1; // The person uploading a demo needs to have X number of people banned from his demos before future uploads will auto-ban. (-1 is off)\r\n\r\n /**\r\n * Forum Settings\r\n * Very simple forum integration (Just adds a link button)\r\n */\r\n var \$" . "enableForumLink = " . $_POST['enableForumLink'] . ";\r\n var \$" . "forumURL = \"" . $_POST['forumURL'] . "\"; // Link to your forums\r\n \r\n /**\r\n * Web Settings\r\n * Very simple web integration (Just adds a link button)\r\n */\r\n var \$" . "enableWebLink = " . $_POST['enableWebLink'] . ";\r\n var \$" . "webUrl = \"" . $_POST['webUrl'] . "\"; // Link to your forums\r\n \r\n /**\r\n * HLstatsX Settings\r\n * Very simple web integration (Just adds a link button)\r\n */\r\n var \$" . "enableHLstatsLink = " . $_POST['enableHLstatsLink'] . ";\r\n var \$" . "HLstatsUrl = \"" . $_POST['HLstatsUrl'] . "\"; // Link to your forums\r\n\r\n /**\r\n * Database Block\r\n */\r\n var \$" . "dbName = \"" . $dbToUse . "\"; // Set the Database to access (where all gban tables are located, change if you place your gban tables in a different db)\r\n var \$" . "dbUserName = \"" . $_SESSION['dbuser'] . "\"; // Set the Database's user name login (recommend a user with only select, insert, update, and delete privs)\r\n var \$" . "dbPassword = \"" . str_replace("\$", "\\\$", $_SESSION['dbpass']) . "\"; // Set the Database user's password login\r\n var \$" . "dbHostName = \"" . $_SESSION['dbhost'] . "\"; // Set the Database's host\r\n var \$" . "matchHash = \"" . str_replace("\$", "\\\$", $_POST['hash']) . "\"; // This must match the has found in the ES script (prevent's people from accessing the page outside)\r\n var \$" . "createUserCode = \"" . str_replace("\$", "\\\$", $_POST['createUserCode']) . "\"; // This code must be entered for someone to create a new basic user\r\n\r\n /**\r\n * Email address of those who should get notices of when a new ban has been added\r\n * or changed.\r\n */\r\n var \$" . "sendEmails = " . $_POST['sendEmailsOnBan'] . "; // Send an email whenever a ban is added or updated (does not include imports)\r\n var \$" . "sendDemoEmails = " . $_POST['sendEmailsDemo'] . "; // Send an email whenever a new demo is added\r\n var \$" . "emailFromHeader = \"" . $_POST['senderEmail'] . "\"; // The from email address\r\n var \$" . "banManagerEmails = array(" . $emailList . "); // Who recieves emails when new bans are added\r\n\r\n function __construct() {\r\n }\r\n\r\n function Config() {\r\n }\r\n}\r\n?" . ">\r\n"; fwrite($fh, $configData); fclose($fh); // We can only save the super user if the config file exists // Add the super user if ($_POST['smfIntegration'] == "false") { include_once ROOTDIR . "/include/database/class.UserQueries.php"; // User specific queries $userQueries = new UserQueries(); if ($userQueries->addUser($_POST['username'], $_POST['password'], 1, $_POST['steamId'], $_POST['userEmail'])) { } } } } ob_start(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>GlobalBan Full Installation</title> <link rel="icon" href="images/favico.ico" type="image/vnd.microsoft.icon"> <link rel="stylesheet" type="text/css" href="css/banned.css" /> <script src="javascript/functions.js" language="javascript" type="text/javascript"></script> </head>
$valid['steamId'] = true; } } } if (isset($_POST['email'])) { $email = $_POST['email']; if (!$userQueries->emailExist($email) && !empty($email)) { if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\\.[A-Z]{2,6}\$/i", $email)) { $valid['email'] = false; } } } // Only a username and steam id are required for this if ($valid['username'] && $valid['steamId']) { $pass = $userQueries->createRandomPassword(); $userQueries->addUser($username, $pass, $_POST['userAccessLevel'], $steamId, $email); // Use this to build the URL link (replace manageUsers with login) $url = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; $url = str_replace('manageUsers&adminPage=1', 'login', $url); // Send the email // To send HTML mail, the Content-type header must be set $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=utf-8" . "\r\n"; // Additional headers $headers .= "From: " . $config->siteName . " Ban Management <" . $config->emailFromHeader . ">" . "\r\n"; $subject = $config->siteName . " GlobalBan - Ban Management -> New User Created"; $body = "<html><body>"; $body .= "<h2>" . $config->siteName . " GlobalBan - Ban Management -> New User Created</h2>"; $body .= "<br/><p>Username: "******"<br/><br/>Password: "******"</p>"; $body .= "<br/><br/>Your account has now been activated, you may login in: <a href='" . $url . "'>Admin Login</a>"; $body .= "<br/><p>Please update your profile once logged in with a new password of your choice.</p>";
$valid['vpassword'] = true; } } // User name if (isset($_POST['userCode'])) { $code = $_POST['userCode']; if (!empty($code)) { if ($config->createUserCode == $code || $config->createSuperCode == $code) { $valid['userCode'] = true; } } } // Redirect if everything works if ($valid['username'] && $valid['email'] && $valid['vemail'] && $valid['password'] && $valid['steamId'] && $valid['userCode']) { // Always add the user as a member if ($userQueries->addUser($username, $password, 4, $steamId, $email)) { // Email the user $subject = $config->siteName . " " . $LAN_NEWUSER_025 . " " . $LAN_NEWUSER_026; $body = "<html><body>"; $body .= $LAN_NEWUSER_022 . ": " . $username; $body .= "\n\n"; $body .= "\n\n"; $body .= "<p>" . $LAN_NEWUSER_023 . "</p>"; $body .= "</body></html>"; // To send HTML mail, the Content-type header must be set $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=utf-8" . "\r\n"; // Additional headers $headers .= "From: " . $config->siteName . " " . $LAN_NEWUSER_025 . " <" . $config->emailFromHeader . ">\r\n"; // Send an email message to those that wish to recieve a notice of a newly added ban mail($email, $subject, $body, $headers);