diff --git a/instant-windows-config.php b/instant-windows-config.php new file mode 100644 index 000000000..b026daab7 --- /dev/null +++ b/instant-windows-config.php @@ -0,0 +1,358 @@ +. + */ + +defined('IN_CODE') or die('This script can not be run by itself.'); + +/** + * The configuration object. This is the only file that will require modification by + * end users. + * + * @package Base + */ +class Config +{ + /** + * This is the MySQL socket. It could be a network socket or a UNIX socket. + * + * eg '127.0.0.1:3306' + * or 'localhost' + * or 'mysql.myhost.com' + * or '/tmp/mysql.sock' + * + * @var string + */ + public static $database_socket='127.0.0.1:3308'; + + /** + * The user who will perform all database actions. You should + * tweak the user's permissions so they can only do the bare + * minimum they need to be able to do to update the webDiplomacy + * tables. Read the administrator documentation for more info. + * + * @var string + */ + public static $database_username='webdiplomacy'; + + /** + * The password of the above user + * + * @var string + */ + public static $database_password='webdiplomacy'; + + /** + * The database name + * + * @var string + */ + public static $database_name='webdiplomacy'; + + /** + * This is used to salt hashes for passwords, if it gets out it's not the end of the world. + * + * *This should be long ( ~30 charecters), random, contain lots of weird charecters, etc* + * If this isn't changed or is predictable it is a serious security risk! + * + * @var string + */ + public static $salt='1'; + + /** + * This is used for session keys and the captcha code, and can be changed from time + * to time without too much difficulty, but it's even more important that it isn't known! + * + * @var string + */ + public static $secret='1'; + + /** + * This is used to authenticate the cron process which will run the gamemaster script. + * If anyone can run the gamemaster script there may be problems (despite the locking), + * and it can increase load. Whatever this string is it means gamemaster needs to be run + * either by an admin, or by gamemaster.php?secret=[thissecret] + * + * @var string + */ + public static $gameMasterSecret='1'; + + /** + * This is used to authenticate the cron process which will run the gamemaster script. + * If anyone can run the gamemaster script there may be problems (despite the locking), + * and it can increase load. Whatever this string is it means gamemaster needs to be run + * either by an admin, or by gamemaster.php?secret=[thissecret] + * + * @var string + */ + public static $jsonSecret='1'; + + /** + * The administrators e-mail; if a user experiences a problem they will be invited to contact this + * e-mail address. It's unlikely bots will experience the sort of problem resulting in your e-mail + * being displayed, but if your e-mail provider doesn't filter spam well you may want to be careful. + * + * @var string + */ + public static $adminEMail='webmaster@yourdiplomacyserver.com'; + + /** + * The moderators e-mail; if users have been banned etc they will be directed to contact this e-mail + * to contest it. + * + * @var string + */ + public static $modEMail='moderators@yourdiplomacyserver.com'; + + /** + * An array of variants available on the server (for future releases, not yet enabled) + * @var array + */ + public static $variants=array(1=>'Classic', 2=>'World', 9=>'AncMed',19=>'Modern2',20=>'Empire4', 23=>'ClassicGvI');//3=>'FleetRome', 4=>'CustomStart', 5=>'BuildAnywhere'); + + /** + * The API configuration. Whether to enable it or not, and restrict it to some variants or some gameIDs. + * + * @var array + */ + public static $apiConfig = array( + /* Whether the API is enabled or not */ + "enabled" => true, + + /* Only replace players in CD if they are in a NoPress game */ + "noPressOnly" => true, + + /* If the API should only be enabled for some game ids, set the list of game ids here */ + "restrictToGameIDs" => array(), + + /* List of variant IDs supported */ + /* 1 = Classic, 15 = ClassicFvA, 23 = ClassicGvI */ + "variantIDs" => array(1, 15, 23) + ); + + /** + * Messages to display when different flags are set via the admin control panel. + * + * If ServerOffline is set it will be displayed and the script will not start. + * + * @var array + */ + public static $serverMessages=array( + 'Notice'=>'Default server-wide notice message.', + 'Panic'=>'Game processing has been paused and user registration has been disabled while a problem is resolved.', + 'Maintenance'=>"Server is in maintenance mode; only admins can fully interact with the server.", + 'ServerOffline'=>'' + ); + + /** + * An array of answers, indexed by the question, which are added to the FAQ page on this installation, adding it + * to the list of generic webDiplomacy FAQs. + * + * If false no server-specific FAQ section will be displayed. + * + * @var array + */ + public static $faq=array('Have any extra questions been added?'=>'No, not yet.'); + + /** + * The directory in which error logs are stored. If this returns false errors will not be logged. + * *Must not be accessible to the web server, as sensitive info is stored in this folder.* + * + * @return string + */ + public static function errorlogDirectory() + { + return false; + return '../errorlogs'; + } + + /** + * Should every piece of every order entered be logged as it comes in? This helps solve + * problems when people think they submitted correct orders but may not have, but it + * can use up lots of disk space and waste resources every time orders are submitted. + * + * Every complaint about incorrect orders have been found via the order logs to be + * correctly received, so it's probably not worth enabling this unless you get many + * complaints. + * + * If this is set to false orders will not be logged, if it returns a writable directory + * orders will be logged there. + * *Must not be accessible to the web server, as sensitive info is stored in this folder.* + * + * @return string + */ + public static function orderlogDirectory() + { + return false; + return '../orderlogs'; + } + + /** + * Where to log points before/after logs to, which log the points before/after games have ended. + * If false points are not logged. + * + * @var string + */ + public static $pointsLogFile=false;//'../pointslog.txt'; + + /** + * An array of e-mail settings, to validate e-mails etc. + * + * @var array + */ + public static $mailerConfig = array( + "From"=> "webmaster@yourdiplomacyserver.com", + /* The e-mail which mail is sent from. This should be a valid e-mail, + or it may trip spam filters. */ + "FromName"=> "webDiplomacy gamemaster", + /* The name being mailed from. */ + "UseMail"=>true, + /* Use the php mail() function. Either UseMail, UseSendmail or UseSMTP has to be TRUE, + if you're using e-mail. */ + "UseSendmail"=>false, + /* Use the sendmail binary, if this is false the variable below is ignored */ + "SendmailSettings"=> array( + "Location"=>"/usr/sbin/sendmail" + /* Location of the sendmail binary */ + ), + "UseSMTP"=> true, + /* Use SMTP, if this is FALSE the variable below is ignored. */ + "SMTPSettings"=> array( + "Host"=>"yourdiplomacyserver.com", + "Port"=>"25", + "SMTPAuth"=>false, + /* If this is FALSE the two variables below are ignored */ + "Username"=>"webmaster", + "Password"=>"password123" + /* Uncomment the line below to use SSL to connect (e.g. for gmail) */ + // , 'SMTPSecure'=>'ssl' + ), + "UseDebug" => true // If this is set to true mail will be output to the browser instead of sent, useful for debugging + ); + + /** + * Something to add after everything else has been printed off (except ''), useful for + * things like Google Analytics, or web-rings + */ + public static function customFooter() + { + return ''; + return 'Default custom server message / google analytics code.'; + } + + /** + * Read /contrib/phpBB3-files/README.txt for instructions on enabling the phpBB3 integration support. The final step + * is uncommenting the line below (assuming this is where it was installed to.) + */ + //public static $customForumURL='/contrib/phpBB3/'; + + // --- + // --- From here on down the default settings will probably be fine. + // --- + + /** + * Enables full error and profiler output even when not viewing as admin. (This + * is set to true if viewing as admin) + * @var boolean + */ + public static $debug=true; + + /** + * The locale for this site. + * + * @var string + */ + public static $locale = 'English'; + + /** + * The number of minutes that gamemaster.php will detect that it hasn't been run for before it will + * mark itself in downtime mode. + */ + public static $downtimeTriggerMinutes=12; + + + // --- + // --- The following settings are typically for Facebook webmasters only + // --- + + /** + * The URL which static data, such as images, are stored at (usually only for Facebook or advanced users) + * + * eg http://static.webdiplomacy.net/ + * + * @var string + */ + public static $facebookStaticURL=''; + + /** + * The URL of the front end of the server (usually only for Facebook or advanced users) + * + * eg http://webdiplomacy.net/ + * + * @var string + */ + public static $facebookServerURL=''; + + /** + * The Facebook API key. If you're not on Facebook this will be ignored + * + * @var string + */ + public static $facebookAPIKey=''; + + /** + * The Facebook secret. If you're not on Facebook this will be ignored + * + * @var string + */ + public static $facebookSecret=''; + + /** + * The path to the Facebook API script (facebook.php) + * + * eg ../../facebook-client/ + * + * @var string + */ + public static $facebookAPIPath=''; + + /** + * The user ID of the Facebook user to send game notification messages from. + * + * This is provided to $facebook->set_user(user_id,secret) + * + * @var int + */ + public static $facebookNotificationFromUserID=''; + + /** + * The authentication secret of the above Facebook user + * + * @var string + */ + public static $facebookNotificationFromUserSecret=''; + + /** + * The Facebook debug value + * + * @var bool + */ + public static $facebookDebug=false; +} + +?> diff --git a/windows_setup_guide.txt b/windows_setup_guide.txt new file mode 100644 index 000000000..3191dfe4a --- /dev/null +++ b/windows_setup_guide.txt @@ -0,0 +1,90 @@ +Guide for getting a development instance running on a Windows machine. + +This is entirely for development, I wouldn't recommend following these steps for an instance you intend to actually host from. + +These are the steps I took, I can't guarantee that any changes to these steps will work. + +-------------------------------------------------------------------------------------- + +Step 1: Download and install WampServer 3.2.0 - http://www.wampserver.com/en/download-wampserver-64bits/ + +This page will later host a newer version of WampServer, so you might need to find a legacy version. + +You will see a WampServer button in your task bar. Click this, and change your php version to 5.6.40 + +These are my versions with a working instance: + +phpMyAdmin 4.9.2 +Adminer 4.7.5 +Apache 2.4.41 +php 5.6.40 +MariaDB 10.4.10 +MySQL 5.7.28 + +-------------------------------------------------------------------------------------- + +Step 2: Verify everything is working + +Navigate to http://localhost/ + +You should have a WAMPServer instance up. + +-------------------------------------------------------------------------------------- + +Step 3: + +Navigate to "phpmyadmin" under "Tools". + +Log in to MySQL with + +username: root + +and a blank password. + + +Go to databases, and create a database named "webdiplomacy". + +Go to variables, and edit the "sql mode" variable so that it does not have STRICT_ALL_TABLES or STRICT_TRANS_TABLES. + +Go to user accounts, create a new user with username "webdiplomacy", password "webdiplomacy", and all the privileges. +I am sure this is insanely insecure, but this is for development only. + +-------------------------------------------------------------------------------------- + +Step 4: + +Navigate to C:\wamp64\www + +And clone your fork of webDiplomacy here. Ensure that the folder it's cloned to is named "webDiplomacy". + +Navigate to http://localhost/webdiplomacy/index.php? in your browser. You should see a bunch of errors. This is good! + +-------------------------------------------------------------------------------------- + +Step 5: + +Change the name of instant-windows-config.php to config.php + +You can edit the contents if you want, but this should be good. + +-------------------------------------------------------------------------------------- + +Step 6: + +Navigate back to phpmyadmin and log in as root. + +go to the "webdiplomacy" database, import, and choose the file C:\wamp64\www\webDiplomacy\install\FullInstall\fullInstall.sql + +This should work - if this file hasn't been properly maintained you may need to import every script under C:\wamp64\www\webDiplomacy\install instead, yikes. + +-------------------------------------------------------------------------------------- + +Step 7: + +You should have a working instance! Hooray! + +If you don't, please amend this guide once you figure it out. + +You can navigate to http://localhost/webdiplomacy/gamemaster.php?gameMasterSecret=1 to trigger a process event whenever you want. + +I recommend doing this instead of a timed script for testing. \ No newline at end of file