Skip to content
Permalink
Browse files

Merge branch 'master' into server-fix-ip-address-display

  • Loading branch information...
andygrunwald committed Feb 5, 2019
2 parents 36af57d + 6e53100 commit 548d6350cd91ca23bfe7aedc09d5196b80a6a0e6
@@ -195,6 +195,7 @@
"modules/usrmgr/Functions/CheckOldPW.php",
"modules/usrmgr/Functions/CheckOptGender.php",
"modules/usrmgr/Functions/CheckValidUsername.php",
"modules/usrmgr/Functions/CheckDuplicateAndValidEmail.php",
"modules/usrmgr/Functions/ClanURLLinkUsrMgrSearch.php",
"modules/usrmgr/Functions/ClanURLLinkUsrMgrSearchInc.php",
"modules/usrmgr/Functions/FieldNeeded.php",
@@ -3,8 +3,8 @@
use LanSuite\Validator\Email;
/**
* CheckValidEmail is a callback function for e.g. MasterForm to verify a given email adress against a set of requirements.
* So far it uses a generic (configurable) Validator and checks if the given address is already in use
* CheckValidEmail is a callback function for e.g. MasterForm to verify a given email address against a set of requirements.
* So far it uses a generic (configurable) Validator
*
* @param string $email
* @return bool|mixed|string
@@ -66,17 +66,6 @@ function CheckValidEmail($email)
break;
}
// Compare first and second email entry.
// As only first entry is passed to this function, we have to get the second one from $_POST directly
if (!isset($_POST['email2']) || $email !== $_POST['email2']) {
return t('E-Mail-Adressen stimmen nicht überein. Bitte überprüfe deine Eingabe');
}
// Check if we already have a user with that email address
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE email = %string%', $email);
if ($row){
return t('Diese E-Mail-Adresse ist bereits in Verwendung. Bitte verwende die "Passwort zurücksetzen"-Funktion, um dein Passwort zurück zu setzen');
}
// Check for forbidden trash mail services
$TrashMailDomains = explode("\n", $cfg['mf_forbidden_trashmail_domains']);
foreach ($TrashMailDomains as $key => $val) {
@@ -47,6 +47,8 @@ public function __construct($discordServerId = ''){
*/
public function fetchServerData(){
global $cfg;
clearstatcache('ext_inc/discord/cache.json');
if (is_readable('ext_inc/discord/cache.json') && time()-filemtime('ext_inc/discord/cache.json') < 60) {
// Cache file is readable and <60 seconds old.
@@ -59,7 +61,7 @@ public function fetchServerData(){
} else {
// No cache file or too old; let's fetch data.
$APIurl = 'https://discordapp.com/api/servers/'.$this->discordServerId .'/widget.json';
$JsonReturnData = @file_get_contents($APIurl);
$JsonReturnData = @file_get_contents($APIurl,false,stream_context_create(array('http' => array('timeout' => (isset($cfg['discord_json_timeout']) ? $cfg['discord_json_timeout'] : 4)))));
if (is_writeable('ext_inc/discord/')) {
// Note: This intentionally also writes empty results to the cache file.
@file_put_contents('ext_inc/discord/cache.json', $JsonReturnData, LOCK_EX);
@@ -11,6 +11,12 @@
<default></default>
<description>Discord server ID</description>
</item>
<item>
<name>discord_json_timeout</name>
<type>int</type>
<default>4</default>
<description>Timeout für den Abruf der Discord JSON Daten</description>
</item>
</items>
</group>
<group>
@@ -161,7 +161,7 @@
$text = str_replace("%CLANURL%", $user["clanurl"], $text);
$text = str_replace("%PARTYNAME%", $party_data["name"], $text);
$text = str_replace('%PARTYURL%', $cfg['sys_partyurl'], $text);
$text = str_replace('%PARTYURL%', (!empty($cfg['sys_partyurl_ssl'])) ? $cfg["sys_partyurl_ssl"] : $cfg["sys_partyurl"], $text);
$text = str_replace("%MAXGUESTS%", $party_data['max_guest'], $text);
$text = str_replace("%WWCLID%", $user["wwclid"], $text);
@@ -24,7 +24,7 @@ public function GenerateNewsfeed()
if ($cfg["news_logourl"]) {
$image = $xml->write_tag("url", $cfg["news_logourl"], 3);
$image .= $xml->write_tag("title", $cfg['sys_page_title'] ." - Logo", 3);
$image .= $xml->write_tag("link", $cfg["sys_partyurl"], 3);
$image .= $xml->write_tag("link", (!empty($cfg['sys_partyurl_ssl'])) ? $cfg["sys_partyurl_ssl"] : $cfg["sys_partyurl"], 3);
$channel .= $xml->write_master_tag("image", $image, 2);
}
@@ -176,7 +176,7 @@ public function SendSignonMail($type = 0)
}
$message = str_replace('%CLAN%', $clan, $message);
$message = str_replace('%PARTYNAME%', $_SESSION['party_info']['name'], $message);
$message = str_replace('%PARTYURL%', $cfg['sys_partyurl'], $message);
$message = str_replace('%PARTYURL%', (!empty($cfg['sys_partyurl_ssl'])) ? $cfg["sys_partyurl_ssl"] : $cfg["sys_partyurl"], $message);
$message = str_replace('%PAGE_TITLE%', $cfg['sys_page_title'], $message);
if ($mail->create_inet_mail($_POST["firstname"] . " " . $_POST["name"], $_POST["email"], $cfg["signon_signonemail_subject"], $message, $cfg["sys_party_mail"])) {
return true;
@@ -209,7 +209,7 @@ public function SendSignonMail($type = 0)
$anmelde_schluss = "Anmeldeschluss: " . $func->unixstamp2date($_SESSION['party_info']['s_enddate'], 'date');
}
$message = str_replace('%SIGNON_DEADLINE%', $anmelde_schluss, $message);
$message = str_replace('%PARTYURL%', $cfg['sys_partyurl'], $message);
$message = str_replace('%PARTYURL%', (!empty($cfg['sys_partyurl_ssl'])) ? $cfg["sys_partyurl_ssl"] : $cfg["sys_partyurl"], $message);
if ($mail->create_inet_mail($row["firstname"] . " " . $row["name"], $row["email"], $subject, $message, $cfg["sys_party_mail"])) {
return true;
} else {
@@ -234,7 +234,7 @@ public function WriteXMLStatFile()
$system = $xml->write_tag('version', LANSUITE_VERSION, 2);
$system .= $xml->write_tag('name', $cfg['feed_partyname'], 2);
$system .= $xml->write_tag('link', $cfg['sys_partyurl'], 2);
$system .= $xml->write_tag('link', (!empty($cfg['sys_partyurl_ssl'])) ? $cfg["sys_partyurl_ssl"] : $cfg["sys_partyurl"], 2);
$system .= $xml->write_tag('language', 'de-de', 2);
$system .= $xml->write_tag('current_party', $cfg['signon_partyid'], 2);
@@ -0,0 +1,38 @@
<?php
/**
* CheckDuplicateAndValidEmail is a callback function to check a given email address for duplicates and
* to perform generic validations via CheckValidEmail.
*
* @param string $email
* @return bool|mixed|string
*/
function CheckDuplicateAndValidEmail($email)
{
global $cfg,$db;
$email = trim($email);
$useremail = null;
if (isset($_GET['userid'])) {
$userrow = $db->qry_first('SELECT email FROM %prefix%user WHERE userid=%int%', $_GET['userid']);
$useremail = $userrow['email'];
}
if ($useremail === null || ($useremail!==null && $email != $useremail)) {
// Compare first and second email entry.
// As only first entry is passed to this function, we have to get the second one from $_POST directly
if (!isset($_POST['email2']) || $email !== $_POST['email2']) {
return t('E-Mail-Adressen stimmen nicht überein. Bitte überprüfe deine Eingabe');
}
// Check if we already have a user with that email address
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE email = %string%', $email);
if ($row) {
return t('Diese E-Mail-Adresse ist bereits in Verwendung. Bitte verwende die "Passwort zurücksetzen"-Funktion, um dein Passwort zurück zu setzen');
}
}
// All checks succeeded; call global email validation routine
return CheckValidEmail($email);
}
@@ -9,7 +9,11 @@ function CheckValidUsername($username)
{
global $cfg, $db;
if ($cfg['signon_username_unique']) {
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE username=%string%', $username);
if (isset($_GET['userid'])) {
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE username=%string% AND userid!=%int%', $username, $_GET['userid']);
} else {
$row = $db->qry_first('SELECT * FROM %prefix%user WHERE username=%string%', $username);
}
if ($row) {
return t('Der gewählte Username existiert bereits');
}
@@ -89,8 +89,8 @@
$mf->AddFix('type', 1);
}
$mf->AddField(t('E-Mail'), 'email', '', '', '', 'CheckValidEmail');
$mf->AddField(t('E-Mail wiederholen'), 'email2', '', '', '');
$mf->AddField(t('E-Mail'), 'email', '', '', '', 'CheckDuplicateAndValidEmail');
$mf->AddField(t('E-Mail wiederholen'), 'email2', '', '', true);
if (($_GET['action'] != 'change' && $_GET['action'] != 'entrance') || ($_GET['action'] == 'entrance' && !$_GET['userid'])) {
if ($cfg['signon_autopw']) {
$_SESSION['tmp_pass'] = $usrmgr->GeneratePassword();
@@ -259,7 +259,7 @@
if (!$DoSignon && !$quick_signon) {
// Settings
if ($auth['type'] >= 2 or !$_GET['userid'] or ($auth['userid'] == $_GET['userid'] and ($cfg['user_self_details_change'] or $missing_fields))) {
if ($auth['type'] >= 2 or !$_GET['userid'] or $auth['userid'] == $_GET['userid']) {
if ($cfg['user_design_change']) {
$selections = [];
$selections[''] = t('System-Vorgabe');

0 comments on commit 548d635

Please sign in to comment.
You can’t perform that action at this time.