<?
/*

'config.inc' For GNUworld's mod.cservice's website interface

Created: <nighty@undernet.org> - 2001-10-29
Last modif: <nighty@undernet.org> - 2004-12-29

This file contains two sections,
- what you *MUST* edit to ensure your website can work properly.
- what you *CAN* edit to tweak it more precisely.

Enjoy!@#

*/

/*------------------------------------------------------------------------*/
/*   WHAT YOU NEED TO EDIT (when finished, look at the end of this file)  */
/*------------------------------------------------------------------------*/

define("LIVE_LOCATION","/live"); // define this to "" if you dont put it in a subdirectory like '/live' (default) but in '/' for example.
define("IFACE_URL","https://cservice.unionchat.org/live/"); // The GUI main URL (the one to access it), this value affect the eventual REFERER checks
define("SERVICE_CHANNEL","#cservice"); // The CService Official Channel

/* NOTE: to FORGE reply adresses, user 'nobody' needs a 'Tnobody' line added in /etc/sendmail.cf (or equiv.) */

define("NETWORK_NAME","UnionChat"); // Define this to your network name... better to be a "normal" single word ;)
define("BOT_NAME","X"); // You bot's name, defines some strings in the website to fit more your configuration.
define("IRC_SERVER","Irc.UnionChat.Org"); // Default server for irc:// option.
define("NETWORK_EMAIL","cservice@UnionChat.org"); // the email of your network (default).

define("PURGE_EMAIL","purge@UnionChat.org"); // the email where channel purge request form is sent.
define("XAT_EMAIL","x@UnionChat.org"); // the email where manager change form is sent.
define("OBJECT_EMAIL","object@UnionChat.org"); // the email where replies to password changes are sent.
define("ABUSE_GLOBAL_EMAIL","abuse@UnionChat.org"); // the email where abuse NOT REGARDING Channel Service should go (for complaints)

define("FROM_NEWUSER","x@UnionChat.org"); // the From: email for a NEWUSER registration email
define("FROM_NEWUSER_SUBJECT","Your Channel Service Account"); // the subject of that mail.

define("FROM_FPASS","recovery@UnionChat.org"); // the From: email for a FORGOTTEN PASSWORD email.
define("FROM_FPASS_SUBJECT","Your Channel Service Password for "); // the sujbect of that mail. 'username' is added at this string's end.

define("TOASTER_FROM_MAIL","toaster@UnionChat.org");

/******************************/
/* LOCAL DATABASE DEFINITIONS */
/******************************/
define("LOCALDB_NAME", getenv("LOCALDB_NAME") ?: "local_db"); // the local database that contains the gnuworld/doc/local_db.sql information.
define("LOCALDB_USER", getenv("LOCALDB_USER") ?: "gnuworld"); // the local user that has full access to LOCALDB_NAME.
define("LOCALDB_PASS", getenv("LOCALDB_PASS") ?: ""); // the password, use blank if you dont use passwords.
define("LOCALDB_HOST", getenv("LOCALDB_HOST") ?: "127.0.0.1"); // the local database ip or hostname

/*******************************/
/* REMOTE DATABASE DEFINITIONS */
/*******************************/
define("REMOTEDB_NAME", getenv("REMOTEDB_NAME") ?: "cservice"); // the remote database that contains cservice.sql, cservice.web.sql information.
define("REMOTEDB_USER", getenv("REMOTEDB_USER") ?: "gnuworld"); // the user that has access remotely to that db
define("REMOTEDB_PASS", getenv("REMOTEDB_PASS") ?: "foo"); // the password, use blank if you dont use passwords.
define("REMOTEDB_HOST", getenv("REMOTEDB_HOST") ?: "127.0.0.1"); // the remote database ip or hostname
define("REMOTEDB_PORT", 5432);


/*******************************/
/* LOCAL WEBSITE CONFIGURATION */
/*******************************/
define("HOSTING_LOGO",""); // this image should go in website/docs/gnuworld/images and be maximum 250*33 pixels.
define("HOSTING_URL","");
define("HOSTING_STATS", 1); // 1: enable, 0: disable. If you enabled this you *NEED* to ensure that a file
             			 // called 'hosting_stats' is WRITABLE by the httpd user in /tmp.
			             //
               			 // This option enables/disables the page access to 901+ on the web as well.
			             // If the file is not found, or found not writable, it's disabled.


define("CSERVICE_SITE_URL","../");

/*---------------------*/
/*  WHAT YOU CAN EDIT  */
/*---------------------*/

define("CRC_SALT_0001","1234");
define("CRC_SALT_0002","1234");
define("CRC_SALT_0003","1234");
define("CRC_SALT_0004","1234");
define("CRC_SALT_0005","1234");
define("CRC_SALT_0006","1234");
define("CRC_SALT_0007","1234");
define("CRC_SALT_0008","1234");
define("CRC_SALT_0009","1234");
define("CRC_SALT_0010","1234");
define("CRC_SALT_0011","1234");
define("CRC_SALT_0012","1234");
define("CRC_SALT_0013","1234");
define("CRC_SALT_0014","1234");
define("CRC_SALT_0015","1234");
define("CRC_SALT_0016","1234");
define("CRC_SALT_0017","1234");
define("CRC_SALT_0018","1234");
define("CRC_SALT_0019","1234");
define("CRC_SALT_0020","1234");

/* SALTs for external authentication capabilities (experimental) */
define("CRC_SALT_EXT1","1234");
define("CRC_SALT_EXT2","1234");
define("CRC_SALT_EXT3","1234");
define("CRC_SALT_EXT4","1234");
define("CRC_SALT_EXT5","1234");

/*
    those options are only used when using multiple mirrors of your CService website
    if you dont do mirrors at all, just leave those options as they are, this wont affect anything.
    if you do mirrors, the following options means that if the website is accessed with "ROUNDROBIN",
    it will automatically redirect accesses to "LOCALMIRROR".
*/
define("ADMINONLY_MIRROR",0); // Define this to 1 if you want that only * person can login.
define("CLIENT_MIRROR_URL","https://cservice.UnionChat.org/live/"); // define this in case ADMINONLY_MIRROR is set to 1.
define("LOCALMIRROR","cservice-live.xx.UnionChat.org");
define("ROUNDROBIN","cservice-live.UnionChat.org");

/******************/
/* THEMES OPTIONS */
/******************/
define("STD_THEME","default");  // define this to your site Theme, this MUST be a valid sub-directory of 'website/docs/gnuworld/themes/data/'
			                  // If you want more information on this new feature, please visit http://cservice.UnionChat.org/gnuworld-setup/
                              // or check the gnuworld/doc/idoc/ directory.
define("AUTO_SWITCH_THEMES",0); // If you set this .. dated themes will appear when they should (latest 'created_ts' "wins" if periods cover each other)
               			      // (not working at the moment... sorry)

/*************************/
/* VARIOUS CHECK OPTIONS */
/*************************/
define("ENABLE_REGISTER_GLOBALS", getenv("ENABLE_REGISTER_GLOBALS") ?: 1); // enable "fake" register globals function when using PHP >= 5.4
define("ENABLE_NOTES",0); // set this to 1 to enable or 0 to disable the "Notes" link on the web
                        // you *NEED* to have your X (mod.cservice) bot running with the code
               			// supporting it to enable this, check out 'gnuworld/doc/notes.sql' too.
define("NOTES_ADMIN_ONLY",1); // This applies if 'ENABLE_NOTES' is set to 1, when set to 0, everyone can use the feature
			                // when set to 1, only * persons can.
define("NOTES_LIM_TOTAL",10); // Total number of notes a user can send to all users. (0 = unlimited)
define("NOTES_LIM_PERUSR",3); // Total number of notes a user can send to a single user. (0 = unlimited)
define("NOTES_LIM_INBOX",15); // Total number of notes a user can have in his 'notes box'. (0 = unlimited)
                            // of course, if ENABLE_NOTES is defined to '0', above three values have no effect.

define("COOKIE_DOMAIN",""); // Blank:default. Define this to ".yourdomain.com" or anything else at your own risks ;P

define("BOFH_PASS_ADMIN",1); // set this to 0 to disable password complexity checking for * people.
define("BOFH_PASS_USER",0); // set this to 1 to enable password complexity checking for all users (overriding BOFH_PASS_ADMIN=0).
define("PW_MIN_CHARS",6); // minimum chars a password must contain.
define("PW_MIN_CAPSL",1); // minimum upper case letters a password must contain.
define("PW_MIN_MINSL",1); // minimum lower case letters a password must contain.
define("PW_MIN_DIGIT",1); // minimum digits a password must contain.
define("PW_MIN_OTHER",1); // minimum other chars a password must contain.

define("IPCHK_MAXHITS",5); // Number of failed forgotten_pass/login attempts before IP_LOCK

define("IPCHK_BANTIME",86400); // Time your IP/username is locked (seconds) when caught into IPCHK_MAXHITS+ failed attempts.
define("ACL_FOR_ANY",1); // set this to 1 if you want to be able to set and use ACLs for users that are not added to '*'.
define("IPR_REQUIRED",0); // set this to 1 if you want * and ACL'd people to REQUIRE one or more IPs in IP restriction list
              			// to be able to log in. (for more security, we recommend you set this to 1 after the IP restriction
			            // has been defined at least on yourself).

define("ENABLE_COMPLAINTS_MODULE",1); // set this to 0 to disable , 1 to enable, the /complaints reporting module (for example if you dont use it ;P)
define("COMPLAINTS_ADMINCOMMENT_ID",1); // this is *MUST* be set to a PERMANENTLY VALID USERNAME ID, if COMPLAINTS MODULE is enabled.
				                      // this will be the user that will post the anonymous objections under the form of an admin comment
				                      // when a complaint of this type is sent.

define("CONFIRM_STAR_PWRESET",	0);	// if set to 1, it will require CONFIRM_STAR_PWRESET_MAIL to confirm all requests.
define("CONFIRM_STAR_PWRESET_MAIL", ''); // must contain a valid email if CONFIRM_STAR_PWRESET is set to 1.
define("LOCK_ON_PWCHG",		0);	// if set to 1, will LOCK OUT the * account pending a password change (CONFIRM_STAR_PWRESET*)
define("LOCK_PWCHG_LEVEL",	0);	// set this to 0 to disable, if set to a level (1-29000), people added on * with that level or above
					            // will not be able to change their passwords with the system (requires manual DB modification, or modification of this value)
					            // suggested value would be 901 (coder level).
define("LOCK_STAR_MAILEDIT",	0);	// if set to 1, it will enable the feature preventing * users to modify email in another * account unless the editor has
					            // a level of at least *800

define("NEWUSERS_GFXCHECK",1);				// 1 = add a graphical code entry check to "newusers", 0 = disable the feature (or if no "libgd" is present)
define("FONT_PATH","/home/gnuworld/cservice-web/fonts/");	// ABSOLUTE PATH to the 'website/fonts/' directory (normally "/home/gnuworld/website/fonts/")
define("SPECIFIC_FONT","rans.ttf");			// if you let this empty, fonts will be randomly chosen into FONT_PATH (one single font used per code/image).
define("JPEG_OUT_QUALITY",60);				// %Quality of the JPEG generated (the less you put this, the harder it will be to read/recognize, ranges 1 to 100).

define("NEWUSERS_IPCHECK",1); // define this to 1, if you want to enable ONE IP = ONE USERNAME per 24h.
define("REMEMBER_LOGIN",1); // set either to 1, or 0 to enable, or disable "username pre-fill" in the LOGIN page(s).
define("PREFILL_NOTICE",1); // Display (1) or not (1) a notice about the "username pre-fill" and how it helps you know you're on the good page.
define("DISALLOW_RESERVED_BLOCKS",0); // define this to 1 if you want to disable access to the website to IANA reserved blocks (10.*, 192.168.*, etc.), 0 to disable check.

define("LREQ_TIME",600); // min time between forgotten password requests to avoid flooding, set this to 0 to disable.

define("REGPROC_IDLECHECK",1); // If this is set to 1, users that are idle more than 21 days will not be allowed to
			     // register a channel or be a channel supporter until they login to the bot on IRC.

define("REGPROC_ALLOWMULTIPLE",0); // If this is set to 1, users will be allowed to register an unlimited amount
				                 // of channels, but will still be allowed to have only ONE channel being applied at a time.
define("MAX_CONCURRENT_SUPPORTS",10);	// amount of applications a username can support at a given time
define("MIN_DAYS_BEFORE_REG",1);		// minimum probation period (in days) for a new username to be a new channel applicant
define("MIN_DAYS_BEFORE_SUPPORT",1);	// minimum probation period (in days) for a new username to be a new channel supporter
define("MIN_DAYS_BEFORE_TMGR",1);		// minimum probation period (in days) for a new username to be a temporary manager (manager change)
define("MIN_DAYS_BEFORE_PMGR",1);		// minimum probation period (in days) for a new username to be a permanent manager (manager change)

define("DEFAULT_REQUIRED_SUPPORTERS",3); // this option defines number of default required supporters (see below).

define("MOD_VA_LEVEL", 751); // Set level allowed to modify a users Verification Answer
/*
Current feature of REQUIRED_SUPPORTERS :
		0	set it to 0 to allow instant registration (no supporters)	[VERY SMALL NETWORKS]
		1-9	requiring 1 to 9 supporters for standard registration		[VARIOUS NETWORKS]
		10	requires 10 supporters to register a channel.			[WIDE NETWORKS]

>>>>>>> IMPORTANT NOTICE <<<<<<<<
The number of required supporters will be, if not existing in tables "variables" in the remote DB,
updated to the number you set above (ie. first run), BUT, if there's already a definition for it in the DB,
the DB one will be the one used by the interface.
You can change the amount of required supporters using the website itself in 'ACL Manager'.
You must be 901+ to view the [Modify] button next to number of required supporters, ensure
the "New Regs" are LOCKED (at the top of the ACL Manager page) then click on the [Modify] button,
One button there will allow you to reset to "config.inc"'s setting, or change to another number,
after validating, re-open "New Regs" and see the changes.
This requires to login with a user with an admin access of 901 or above (coder level only).
>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<
*/



define("GLINE_CHECK", 0);  // Enable gline check for new user registration
define("RBL_CHECKS", 0);		// enable RBL check for new user registration.
define("TOTP_USR_FLAG",1024);
define("TOTP_ADMIN_IPR_FLAG", 2048);
define("NON_BOGUS_TOTP",'/^[0-9\=]+$/');
define("TOTP_ON",0);		// enable TOTP checks on login.
// define(TOTP_VIEW,1);            // define if TOTP key is viewabled by CSA's
// define(TOTP_VIEW_LVL,800);	// define minimum access level to view TOTP key
define("TOTP_RESET_LVL",800);	// define minimum access level to reset TOTP key
define("TOTP_SALT", '0123456789');	// salt for TOTP cookie md5hash
define("TOTP_CONFIRM_INT", 21600);// seconds for confirmation link validity
define("TOTP_PATH", 'totp/');	// path to totp help, activation and confirmation files relative to /live pages
define("SHOW_TOTP_PUBLIC", 0);	// Allow regulars to see if OTHER user has TOTP on/off
define("TOTP_ALLOW_ALL", 1);	// Allow regulars (1) or just opers/*'s to enable TOTP
define ("TOTP_DEBUG", 0);		// trun on/off  totp debuging
define ("TOTP_ALLOW_SELF_OFF", 1);	// allow regulars to disable TOTP on their own
define("USRNREG_CHANS", "");		// define channels ID list for wich usernames to be checked against new username registration for similarity. 1= *, 8656 = #cservice. Use: select id from channels where name='#desired_channel_name'; from psql console to get channel ID
define("USRNREG_EUSERS", '');		//define list of usernames not added to channels above, but still look for similarity with new username reg (ex/active opers, ex/deleted CSA's, etc)
define("USRNREG_WARN_ENABLE", 1);			//enable (1) or disable (0) similarity check for new usernames registration
define("USRNREG_DIST", 4);	// how many letters need to be changed/added/removed to get from username1 to username2
define("USRNREG_SIMILAR", 75);	// How simmilar username1 needs to be to username2 to trigger response
define("USRNREG_ERR_MSG", "<li>Sorry, that username is unavailable [likeness]. Please contact cservice-abuse@undernet.org for more information.\n"); // Error message when username is too similar
define("WARN_EXPIRE_SESSION", 1); // warn *'s when web session is about to expire due to inactivity
define("WARN_EXP_SESS_GRACE", 300); // warn with xx seconds before websession becomes invalid
define("DEFAULT_SESS_TIMEOUT", array(900, 1800, 3600, 5400, 7200));
define("WARN_SESS_DEFAULTS", DEFAULT_SESS_TIMEOUT);
define("WARN_EXP_SESS_HOME", "http://testnet.UnionChat.org/live/"); // location when logging out from warning popup
define("BIND_OUT_IP", '10.0.0.1');

define("SMTP_HOST", '');
define("SMTP_PORT", '25');
define("SMTP_USER", '');
define("SMTP_PASS", '');
define("MAIL_TYPE", 'sendmail');	// set to smtp or sendmail
define("DEBUG_MAIL", false);
define("ALLOW_SELF_MAXLOGINS", 1);	// 0 - disallow regulars to change own maxlogins, 1- allow
define("DEFAULT_MAX_LOGINS", 1); // Set the number of default max logins allowed for a newly registered user
define("ALLOW_MAX_LOGINS", array(
	['max_logins' => 2, 'account_age' => 172800],
	['max_logins' => 3, 'account_age' => 259200],
));
define("ALLOW_MULTI_CHANS", array(
	"1" => 86400,  // first channel after 1 day
	"2" => 172800, // minimum time since added as 500 in 1-st channel, to allow second reg
	"3" => 259200  // minimum time since added as 500 in 2-nd channel, to allow third reg
));
define("IPR_EXPIRY", array(3600, 10800, 21600, 86400, 259200, 518400, 1296000, 2592000, 7776000, 15552000, 31536000, 0));

/* To show you read this whole file, please comment or remove the next line. */
//die("<h2><b>Error</b>: Edit website/php_includes/config.inc file !</h2>");
/* --- CONFIGURACIÓN DE NIVELES PARA IRCOPS --- */

// Nivel mínimo para que la web muestre herramientas administrativas
$min_admn_level = 1000; 

// Array de niveles que la web debe procesar como "especiales"
// Asegúrate de incluir el 1000 y tu nivel 29000
$admin_levels = array(1000, 1500, 2000, 29000); 

// Si quieres que el nivel 1 también vea la web (solo recomendado para pruebas)
// $min_admn_level = 1; 

/* --- FIX PARA EL BUCLE DE REDIRECCIÓN --- */
// Esto evita que la web se pierda intentando validar el subdirectorio /live
if (isset($_SERVER['HTTP_HOST'])) {
    define("COOKIE_PATH", "/live/");
}
?>
