Users/Markup

* implemented pending-status for newly created accounts
 * Markup should now properly recognize external links
 * Markup will remove links by pending accounts
This commit is contained in:
Sarjuuk
2016-02-17 00:21:03 +01:00
parent 08717c36d0
commit 741ebf38f9
16 changed files with 68 additions and 40 deletions

View File

@@ -132,8 +132,8 @@ define('U_GROUP_LOCALIZER', 0x0200);
define('U_GROUP_SALESAGENT', 0x0400);
define('U_GROUP_SCREENSHOT', 0x0800);
define('U_GROUP_VIDEO', 0x1000);
// define('U_GROUP_APIONLY, 0x2000); // the heck..?
// define('U_GROUP_PENDING, 0x4000); // would restrict some markup like urls
define('U_GROUP_APIONLY', 0x2000); // not used
define('U_GROUP_PENDING', 0x4000); // restricts usage of urls in comments
define('U_GROUP_STAFF', (U_GROUP_ADMIN|U_GROUP_EDITOR|U_GROUP_MOD|U_GROUP_BUREAU|U_GROUP_DEV|U_GROUP_BLOGGER|U_GROUP_LOCALIZER|U_GROUP_SALESAGENT));
define('U_GROUP_EMPLOYEE', (U_GROUP_ADMIN|U_GROUP_BUREAU|U_GROUP_DEV));

View File

@@ -112,7 +112,7 @@ class User
);
// gain rep for daily visit
if (!(self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM)))
if (!(self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM)) && !self::isInGroup(U_GROUP_PENDING))
Util::gainSiteReputation(self::$id, SITEREP_ACTION_DAILYVISIT);
// increment consecutive visits (next day or first of new month and not more than 48h)
@@ -245,9 +245,6 @@ class User
if (!self::verifyCrypt($pass))
return AUTH_WRONGPASS;
if ($query['status'] & ACC_STATUS_NEW)
return AUTH_ACC_INACTIVE;
// successfull auth; clear bans for this IP
DB::Aowow()->query('DELETE FROM ?_account_bannedips WHERE type = 0 AND ip = ?', self::$ip);

View File

@@ -301,7 +301,7 @@ $lang = array(
'groups' => array(
-1 => "Keine", "Tester", "Administrator", "Editor", "Moderator", "Bürokrat",
"Entwickler", "VIP", "Blogger", "Premium", "Übersetzer", "Handelsvertreter",
"Screenshot-Verwalter", "Video-Verwalter"
"Screenshot-Verwalter", "Video-Verwalter", "API-Partner", "Ausstehend"
),
// signIn
'doSignIn' => "Mit Eurem AoWoW-Konto anmelden",
@@ -347,7 +347,7 @@ $lang = array(
'accActivated' => 'Euer Konto wurde soeben aktiviert.<br>Ihr könnt euch nun <a href="?account=signin&token=%s">anmelden</a>',
'userNotFound' => "Ein Konto mit diesem Namen existiert nicht.",
'wrongPass' => "Dieses Kennwort ist ungültig.",
'accInactive' => "Dieses Konto wurde bisher nicht aktiviert.",
// 'accInactive' => "Dieses Konto wurde bisher nicht aktiviert.",
'loginExceeded' => "Die maximale Anzahl an Anmelde-Versuchen von dieser IP wurde überschritten. Bitte versucht es in %s erneut.",
'signupExceeded'=> "Die maximale Anzahl an Regustrierungen von dieser IP wurde überschritten. Bitte versucht es in %s erneut.",
'errNameLength' => "Euer Benutzername muss mindestens 4 Zeichen lang sein.", // message_usernamemin

View File

@@ -296,7 +296,7 @@ $lang = array(
'groups' => array(
-1 => "None", "Tester", "Administrator", "Editor", "Moderator", "Bureaucrat",
"Developer", "VIP", "Blogger", "Premium", "Localizer", "Sales agent",
"Screenshot manager", "Video manager"
"Screenshot manager", "Video manager", "API partner", "Pending"
),
// signIn
'doSignIn' => "Log in to your AoWoW Account",
@@ -342,7 +342,7 @@ $lang = array(
'accActivated' => 'Your account has been activated.<br>Proceed to <a href="?account=signin&token=%s">sign in</a>',
'userNotFound' => "The username you entered does not exists.",
'wrongPass' => "That password is not vaild.",
'accInactive' => "That account has not yet been confirmed active.",
// 'accInactive' => "That account has not yet been confirmed active.",
'loginExceeded' => "The maximum number of logins from this IP has been exceeded. Please try again in %s.",
'signupExceeded'=> "The maximum number of signups from this IP has been exceeded. Please try again in %s.",
'errNameLength' => "Your username must be at least 4 characters long.", // message_usernamemin

View File

@@ -301,7 +301,7 @@ $lang = array(
'groups' => array(
-1 => "Ninguno", "Probador", "Administrador", "Editor", "Moderador", "Burócrata",
"Desarrollador", "VIP", "Bloggor", "Premium", "Traductor", "Agente de ventas",
"Gestor de Capturas de pantalla","Gestor de vídeos"
"Gestor de Capturas de pantalla","Gestor de vídeos", "Partner de API", "Pendiente"
),
// signIn
@@ -348,7 +348,7 @@ $lang = array(
'accActivated' => 'Your account has been activated.<br>Proceed to <a href="?account=signin&token=%s">sign in</a>',
'userNotFound' => "The username you entered does not exists.",
'wrongPass' => "That password is not vaild.",
'accInactive' => "That account has not yet been confirmed active.",
// 'accInactive' => "That account has not yet been confirmed active.",
'loginExceeded' => "The maximum number of logins from this IP has been exceeded. Please try again in %s.",
'signupExceeded'=> "The maximum number of signups from this IP has been exceeded. Please try again in %s.",
'errNameLength' => "Tu nombre de usuario tiene que tener por lo menos cuatro caracteres.", // message_usernamemin

View File

@@ -301,7 +301,7 @@ $lang = array(
'groups' => array(
-1 => "None", "Testeur", "Administrateur", "Éditeur", "Modérateur", "Bureaucrate",
"Développeur", "VIP", "Bloggeur", "Premium", "Traducteur", "Agent de ventes",
"Gestionnaire de capture d'écran","Gestionnaire de vidéos"
"Gestionnaire de capture d'écran","Gestionnaire de vidéos" "Partenaire API", "En attente"
),
// signIn
'doSignIn' => "Connexion à votre compte Aowow",
@@ -347,7 +347,7 @@ $lang = array(
'accActivated' => 'Votre compte a été activé.<br>Vous pouvez maintenant <a href="?account=signin&token=%s">vous connecter</a>',
'userNotFound' => "Le nom d'utilisateur que vous avez saisi n'éxiste pas.",
'wrongPass' => "Ce mot de passe est invalide.",
'accInactive' => "Ce compte n'a pas encore été activé.",
// 'accInactive' => "Ce compte n'a pas encore été activé.",
'loginExceeded' => "Le nombre maximum de connections depuis cette IP a été dépassé. Essayez de nouevau dans %s.",
'signupExceeded'=> "Le nombre maximum d'inscriptions depuis cette IP a été dépassé. Essayez de nouveau dans %s.",
'errNameLength' => "Votre nom d'utilisateur doit faire au moins 4 caractères de long.", // message_usernamemin

View File

@@ -301,7 +301,7 @@ $lang = array(
'groups' => array(
-1 => "Нет", "Тестер", "Администратор", "Редактор", "Модератор", "Бюрократ",
"Разработчик", "VIP", "Блогер", "Учетная запись Премиум", "Переводчик", "Агент по продажам",
"Менеджер изображений", "Менеджер видео"
"Менеджер изображений", "Менеджер видео", "API партнер", "Ожидающее"
),
// signIn
'doSignIn' => "Войти в вашу учетную запись Aowow",
@@ -347,7 +347,7 @@ $lang = array(
'accActivated' => 'Your account has been activated.<br>Proceed to <a href="?account=signin&token=%s">sign in</a>',
'userNotFound' => "The username you entered does not exists.",
'wrongPass' => "That password is not vaild.",
'accInactive' => "That account has not yet been confirmed active.",
// 'accInactive' => "That account has not yet been confirmed active.",
'loginExceeded' => "The maximum number of logins from this IP has been exceeded. Please try again in %s.",
'signupExceeded'=> "The maximum number of signups from this IP has been exceeded. Please try again in %s.",
'errNameLength' => "Имя пользователя не должно быть короче 4 символов.", // message_usernamemin

View File

@@ -141,11 +141,9 @@ class AccountPage extends GenericPage
else if (!empty($_GET['token']) && ($newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE status = ?d AND token = ?', ACC_STATUS_NEW, $_GET['token'])))
{
$nStep = 2;
DB::Aowow()->query('UPDATE ?_account SET status = ?d WHERE token = ?', ACC_STATUS_OK, $_GET['token']);
DB::Aowow()->query('UPDATE ?_account SET status = ?d, statusTimer = 0, token = 0, userGroups = ?d WHERE token = ?', ACC_STATUS_OK, U_GROUP_NONE, $_GET['token']);
DB::Aowow()->query('REPLACE INTO ?_account_bannedips (ip, type, count, unbanDate) VALUES (?, 1, ?d + 1, UNIX_TIMESTAMP() + ?d)', User::$ip, CFG_ACC_FAILED_AUTH_COUNT, CFG_ACC_FAILED_AUTH_BLOCK);
Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER);
$this->text = sprintf(Lang::account('accActivated'), $_GET['token']);
}
else
@@ -335,9 +333,10 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
return Lang::main('intError');
// reset account status, update expiration
DB::Aowow()->query('UPDATE ?_account SET prevIP = IF(curIp = ?, prevIP, curIP), curIP = IF(curIp = ?, curIP, ?), allowExpire = ?d, status = 0, statusTimer = 0, token = "" WHERE user = ?',
DB::Aowow()->query('UPDATE ?_account SET prevIP = IF(curIp = ?, prevIP, curIP), curIP = IF(curIp = ?, curIP, ?), allowExpire = ?d, status = IF(status = ?d, status, 0), statusTimer = IF(status = ?d, statusTimer, 0), token = IF(status = ?d, token, "") WHERE user = ?',
User::$ip, User::$ip, User::$ip,
$this->_post['remember_me'] != 'yes',
ACC_STATUS_NEW, ACC_STATUS_NEW, ACC_STATUS_NEW,
$this->_post['username']
);
@@ -355,9 +354,6 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
case AUTH_WRONGPASS:
User::destroy();
return Lang::account('wrongPass');
case AUTH_ACC_INACTIVE:
User::destroy();
return Lang::account('accInactive');
case AUTH_IPBANNED:
User::destroy();
return sprintf(Lang::account('loginExceeded'), Util::formatTime(CFG_ACC_FAILED_AUTH_BLOCK * 1000));
@@ -404,7 +400,7 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
// create..
$token = Util::createHash();
$id = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, email, joindate, curIP, allowExpire, locale, status, statusTimer, token) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), ?, ?d, ?d, ?d, UNIX_TIMESTAMP() + ?d, ?)',
$ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, email, joindate, curIP, allowExpire, locale, userGroups, status, statusTimer, token) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), ?, ?d, ?d, ?d, ?d, UNIX_TIMESTAMP() + ?d, ?)',
$this->_post['username'],
User::hashCrypt($this->_post['password']),
Util::ucFirst($this->_post['username']),
@@ -412,14 +408,18 @@ Markup.printHtml("description text here", "description-generic", { allow: Markup
User::$ip,
$this->_post['remember_me'] != 'yes',
User::$localeId,
U_GROUP_PENDING,
ACC_STATUS_NEW,
CFG_ACC_CREATE_SAVE_DECAY,
$token
);
if (!$id) // something went wrong
if (!$ok)
return Lang::main('intError');
else if ($_ = $this->sendMail(Lang::mail('accConfirm', 0), sprintf(Lang::mail('accConfirm', 1), $token), CFG_ACC_CREATE_SAVE_DECAY))
{
if ($id = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE token = ?', $token))
Util::gainSiteReputation($id, SITEREP_ACTION_REGISTER);
// success:: update ip-bans
if (!$ip || $ip['unbanDate'] < time())
DB::Aowow()->query('REPLACE INTO ?_account_bannedips (ip, type, count, unbanDate) VALUES (?, 1, 1, UNIX_TIMESTAMP() + ?d)', User::$ip, CFG_ACC_FAILED_AUTH_BLOCK);

View File

@@ -702,7 +702,7 @@ class NpcPage extends GenericPage
$this->extendGlobalData($objectiveOf->getJSGlobals());
$this->lvTabs[] = ['quest', array(
'data' => aray_values($objectiveOf->getListviewData()),
'data' => array_values($objectiveOf->getListviewData()),
'name' => '$LANG.tab_objectiveof',
'id' => 'objective-of'
)];

View File

@@ -44,7 +44,8 @@ var Markup = {
CLASS_USER: MARKUP_CLASS_USER,
CLASS_PENDING: MARKUP_CLASS_PENDING,
whitelistedWebsites: [/(.*\.)?wowhead.com/i, /(.*\.)?thottbot.com/i, /(.*\.)?torhead.com/i, /(.*\.)?mmoui.com/i, /(.*\.)?tankspot.com/i, /(.*\.)?guildfans.com/i, /(.*\.)?allakhazam.com/i, /(.*\.)?zam.com/i, /(.*\.)?blizzard.com/i, /(.*\.)?worldofwarcraft.com/i, /(.*\.)?wow-europe.com/i, /(.*\.)?battle.net/i, /(.*\.)?sc2ranks.com/i, /(.*\.)?torchlightarmory.com/i, /(.*\.)?vindictusdb.com/i, /(.*\.)?wowinterface.com/i, /(.*\.)?vginterface.com/i, /(.*\.)?lotrointerface.com/i, /(.*\.)?eq2interface.com/i, /(.*\.)?eqinterface.com/i, /(.*\.)?mmo-champion.com/i, /(.*\.)?joystiq.com/i, /(.*\.)?wow-heroes.com/i, /(.*\.)?be-imba.hu/i, /(.*\.)?wowpedia.org/i, /(.*\.)?curse.com/i, /(.*\.)?elitistjerks.com/i, /(.*\.)?wowwiki.com/i, /(.*\.)?worldoflogs.com/i, /(.*\.)?wowinsider.com/i, /(.*\.)?guildwork.com/i],
/* aowow custom: first element */
whitelistedWebsites: [new RegExp('(.*\\.)?' + location.hostname, 'i'), /(.*\.)?wowhead.com/i, /(.*\.)?thottbot.com/i, /(.*\.)?torhead.com/i, /(.*\.)?mmoui.com/i, /(.*\.)?tankspot.com/i, /(.*\.)?guildfans.com/i, /(.*\.)?allakhazam.com/i, /(.*\.)?zam.com/i, /(.*\.)?blizzard.com/i, /(.*\.)?worldofwarcraft.com/i, /(.*\.)?wow-europe.com/i, /(.*\.)?battle.net/i, /(.*\.)?sc2ranks.com/i, /(.*\.)?torchlightarmory.com/i, /(.*\.)?vindictusdb.com/i, /(.*\.)?wowinterface.com/i, /(.*\.)?vginterface.com/i, /(.*\.)?lotrointerface.com/i, /(.*\.)?eq2interface.com/i, /(.*\.)?eqinterface.com/i, /(.*\.)?mmo-champion.com/i, /(.*\.)?joystiq.com/i, /(.*\.)?wow-heroes.com/i, /(.*\.)?be-imba.hu/i, /(.*\.)?wowpedia.org/i, /(.*\.)?curse.com/i, /(.*\.)?elitistjerks.com/i, /(.*\.)?wowwiki.com/i, /(.*\.)?worldoflogs.com/i, /(.*\.)?wowinsider.com/i, /(.*\.)?guildwork.com/i],
rolesToClass: function(roles)
{
@@ -3483,14 +3484,16 @@ var Markup = {
_fixUrl: function(url)
{
if(!url) return '';
if (!url)
return '';
// Make local URLs absolute
var firstChar = url.charAt(0);
if(firstChar == '/' || firstChar == '?')
if (firstChar == '/' || firstChar == '?')
{
url = url.replace(/^[\/\?]+/, '');
// aowow custom
// url = '/' + url;
url = '?' + url;
}
@@ -3500,9 +3503,12 @@ var Markup = {
_isUrlExternal: function(str)
{
if(!str)
if (!str)
return false;
return (str.indexOf('wowhead.com') == -1 && str.match(/^([^:\\./]+):/i));
// aowow custom
// return (str.indexOf('wowhead.com') == -1 && str.match(/^([^:\\./]+):/i));
return g_isExternalUrl(str);
},
_nodeSearch: function(node, name, depth)

View File

@@ -1526,7 +1526,7 @@ Summary.prototype = {
var o = $WH.ce('option');
o.value = p;
o._weights = weights[p];
$WH.ae(o, $WH.ct(weights[p].name ? weights[p].name :LANG.presets[p]));
$WH.ae(o, $WH.ct(weights[p].name ? weights[p].name : LANG.presets[p]));
$WH.ae(group, o);
}

View File

@@ -2207,7 +2207,9 @@ var g_user_roles = {
10: 'Übersetzer',
11: 'Handelsvertreter',
12: 'Screenshot-Verwalter',
13: 'Video-Verwalter'
13: 'Video-Verwalter',
14: 'API-Partner',
15: 'Ausstehend'
};
var g_gem_colors = {
@@ -2316,6 +2318,9 @@ var g_conditions = {
/* end custom */
var LANG = {
linkremoved: "Link entfernt",
linkremoved_tip: "Neue Benutzer können nicht<br />zu nicht-weißgelisteten Seiten verlinken.",
and: " und ",
or: " oder ", // custom
comma: ", ",

View File

@@ -2252,7 +2252,9 @@ var g_user_roles = {
10: 'Localizer',
11: 'Sales agent',
12: 'Screenshot manager',
13: 'Video manager'
13: 'Video manager',
14: 'API partner',
15: 'Pending'
};
var g_gem_colors = {
@@ -2362,6 +2364,9 @@ var g_conditions = {
/* end custom */
var LANG = {
linkremoved: "link removed",
linkremoved_tip: "Newly registered users cannot<br />post links.",
and: " and ",
or: " or ", // custom
comma: ", ",

View File

@@ -2208,7 +2208,9 @@ var g_user_roles = {
10: 'Traductor',
11: 'Agente de ventas',
12: 'Gestor de Capturas de pantalla',
13: 'Gestor de vídeos'
13: 'Gestor de vídeos',
14: 'Partner de API',
15: 'Pendiente'
};
var g_gem_colors = {
@@ -2318,8 +2320,11 @@ var g_conditions = {
/* end custom */
var LANG = {
linkremoved: "enlace eliminado",
linkremoved_tip: "Los nuevos usuarios no pueden enlazar a<br />webs que no estén aprobadas.",
and: " y ",
or: " o ",
or: " o ", // custom
comma: ", ",
ellipsis: "…",
dash: " ",

View File

@@ -2195,7 +2195,9 @@ var g_user_roles = {
10: 'Traducteur',
11: 'Agent de ventes',
12: 'Gestionnaire de capture d\'écran',
13: 'Gestionnaire de vidéos'
13: 'Gestionnaire de vidéos',
14: 'artenaire API',
15: 'En attente'
};
var g_gem_colors = {
@@ -2305,8 +2307,11 @@ var g_conditions = {
/* end custom */
var LANG = {
linkremoved: "lien enlevé",
linkremoved_tip: "Les nouveaux utilisateurs ne peuvent pas donner de liens vers<br />des sites web non-approuvés.",
and: " et ",
or: " ou ",
or: " ou ", // custom
comma: ", ",
ellipsis: "…",
dash: " ",

View File

@@ -2195,7 +2195,9 @@ var g_user_roles = {
10: 'Переводчик',
11: 'Агент по продажам',
12: 'Менеджер изображений',
13: 'Менеджер видео'
13: 'Менеджер видео',
14: 'API партнер',
15: 'Ожидающее'
};
var g_gem_colors = {
@@ -2305,8 +2307,11 @@ var g_conditions = {
/* end custom */
var LANG = {
linkremoved: "ссылка удалена",
linkremoved_tip: "Новые пользователи не могут публиковать<br />\nссылки на не разрешенные сайты.",
and: " и ",
or: " или ",
or: " или ", // custom
comma: ", ",
ellipsis: "…",
dash: " ",