implemented user page

well .. most of it anyway
This commit is contained in:
Sarjuuk
2015-05-20 01:22:09 +02:00
parent 6d488e5831
commit ebc7a9bee8
22 changed files with 1032 additions and 586 deletions

View File

@@ -352,14 +352,14 @@ class AjaxHandler
DB::Aowow()->query('UPDATE ?_comments SET editCount = editCount + 1, ?a WHERE id = ?d', $update, $this->get('id'));
break;
case 'delete': // user.js uses GET; global.js uses POST
if (!$this->post('id') && !$this->get('id'))
case 'delete':
if (!$this->post('id'))
break;
$ok = DB::Aowow()->query('UPDATE ?_comments SET flags = flags | ?d, deleteUserId = ?d, deleteDate = UNIX_TIMESTAMP() WHERE id = ?d{ AND userId = ?d}',
$ok = DB::Aowow()->query('UPDATE ?_comments SET flags = flags | ?d, deleteUserId = ?d, deleteDate = UNIX_TIMESTAMP() WHERE id IN (?a){ AND userId = ?d}',
CC_FLAG_DELETED,
User::$id,
$this->post('id') ?: $this->get('id'),
(array)$this->post('id'),
User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id
);
@@ -376,13 +376,13 @@ class AjaxHandler
}
break;
case 'undelete': // user.js uses GET; global.js uses POST
if (!$this->post('id') && !$this->get('id'))
case 'undelete':
if (!$this->post('id'))
break;
$ok = DB::Aowow()->query('UPDATE ?_comments SET flags = flags & ~?d WHERE id = ?d{ AND userId = deleteUserId AND deleteUserId = ?d}',
$ok = DB::Aowow()->query('UPDATE ?_comments SET flags = flags & ~?d WHERE id IN (?a){ AND userId = deleteUserId AND deleteUserId = ?d}',
CC_FLAG_DELETED,
$this->post('id') ?: $this->get('id'),
(array)$this->post('id'),
User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id
);
@@ -777,7 +777,10 @@ class AjaxHandler
if (!$this->get('id') || !preg_match('/^([0-9]+)\.(jpg|gif)$/', $this->get('id'), $matches) || !in_array($size, array_keys($s)))
return false;
header('Content-Type: image/'.$matches[2]);
$id = $matches[1];
$dest = imageCreateTruecolor($s[$size], $s[$size]);
if (file_exists('/uploads/avatars/'.$id.'.jpg'))
{
@@ -794,11 +797,8 @@ class AjaxHandler
}
$src = imageCreateFromJpeg('uploads/avatars/'.$id.'.jpg');
$dest = imageCreateTruecolor($s[$size], $s[$size]);
imagecopymerge($dest, $src, 0, 0, $offsetX, $offsetY, $s[$size], $s[$size], 100);
header('Content-Type: image/'.$matches[2]);
}
if ($matches[2] == 'gif')
imageGif($dest);
@@ -808,9 +808,6 @@ class AjaxHandler
return true;
}
return false;
}
private function profile_handlePin($id, $mode) // (un)favorite
{
/* params

View File

@@ -19,6 +19,7 @@ if (!defined('AOWOW_REVISION'))
class CommunityContent
{
private static $jsGlobals = [];
private static $subjCache = [];
private static $commentQuery = '
SELECT
@@ -86,32 +87,21 @@ class CommunityContent
?d
';
public static function getCommentPreviews($params = [])
private static function addSubject($type, $typeId)
{
/*
purged:0, <- doesnt seem to be used anymore
domain:'live' <- irrelevant for our case
*/
if (!isset(self::$subjCache[$type][$typeId]))
self::$subjCache[$type][$typeId] = 0;
}
$subjCache = [];
$comments = DB::Aowow()->select(
self::$previewQuery,
CC_FLAG_DELETED,
empty($params['user']) ? DBSIMPLE_SKIP : $params['user'],
empty($params['replies']) ? DBSIMPLE_SKIP : 0, // i dont know, how to switch the sign around
!empty($params['replies']) ? DBSIMPLE_SKIP : 0,
CC_FLAG_DELETED,
User::$id,
User::isInGroup(U_GROUP_COMMENTS_MODERATOR),
CFG_SQL_LIMIT_DEFAULT
);
foreach ($comments as $c)
$subjCache[$c['type']][$c['typeId']] = $c['typeId'];
foreach ($subjCache as $type => $ids)
private static function getSubjects()
{
$cnd = [CFG_SQL_LIMIT_NONE, ['id', array_unique($ids, SORT_NUMERIC)]];
foreach (self::$subjCache as $type => $ids)
{
$_ = array_filter(array_keys($ids), 'is_numeric');
if (!$_)
continue;
$cnd = [CFG_SQL_LIMIT_NONE, ['id', $_]];
switch ($type)
{
@@ -135,15 +125,41 @@ class CommunityContent
}
foreach ($obj->iterate() as $id => $__)
$subjCache[$type][$id] = $obj->getField('name', true);
self::$subjCache[$type][$id] = $obj->getField('name', true);
}
}
public static function getCommentPreviews($params = [], &$nFound = 0)
{
/*
purged:0, <- doesnt seem to be used anymore
domain:'live' <- irrelevant for our case
*/
$comments = DB::Aowow()->selectPage(
$nFound,
self::$previewQuery,
CC_FLAG_DELETED,
empty($params['user']) ? DBSIMPLE_SKIP : $params['user'],
empty($params['replies']) ? DBSIMPLE_SKIP : 0, // i dont know, how to switch the sign around
!empty($params['replies']) ? DBSIMPLE_SKIP : 0,
CC_FLAG_DELETED,
User::$id,
User::isInGroup(U_GROUP_COMMENTS_MODERATOR),
CFG_SQL_LIMIT_DEFAULT
);
foreach ($comments as $c)
self::addSubject($c['type'], $c['typeId']);
self::getSubjects();
foreach ($comments as $idx => &$c)
{
if (!empty($subjCache[$c['type']][$c['typeId']]))
if (!empty(self::$subjCache[$c['type']][$c['typeId']]))
{
// apply subject
$c['subject'] = $subjCache[$c['type']][$c['typeId']];
$c['subject'] = self::$subjCache[$c['type']][$c['typeId']];
// format date
$c['date'] = date(Util::$dateFormatInternal, $c['date']);
@@ -182,13 +198,13 @@ class CommunityContent
return $comments;
}
public static function getCommentReplies($commentId, $limit = 0, &$nFound = null)
public static function getCommentReplies($commentId, $limit = 0, &$nFound = 0)
{
$replies = [];
$query = $limit > 0 ? self::$commentQuery.' LIMIT '.$limit : self::$commentQuery;
// get replies
$results = DB::Aowow()->SelectPage($nFound, $query, User::$id, User::$id, $commentId, 0, 0, CC_FLAG_DELETED, User::$id, User::isInGroup(U_GROUP_COMMENTS_MODERATOR));
$results = DB::Aowow()->selectPage($nFound, $query, User::$id, User::$id, $commentId, 0, 0, CC_FLAG_DELETED, User::$id, User::isInGroup(U_GROUP_COMMENTS_MODERATOR));
foreach ($results as $r)
{
(new Markup($r['body']))->parseGlobalsFromText(self::$jsGlobals);
@@ -398,18 +414,39 @@ class CommunityContent
return $comments;
}
private static function getVideos($type, $typeId)
public static function getVideos($typeOrUser, $typeId = 0, &$nFound = 0)
{
$videos = DB::Aowow()->Query("
SELECT v.id, a.displayName AS user, v.date, v.videoId, v.caption, IF(v.status & 0x4, 1, 0) AS 'sticky', v.type, v.typeId
$videos = DB::Aowow()->selectPage($nFound, "
SELECT v.id, a.displayName AS user, v.date, v.videoId, v.caption, IF(v.status & ?d, 1, 0) AS 'sticky', v.type, v.typeId
FROM ?_videos v, ?_account a
WHERE v.type = ? AND v.typeId = ? AND v.status & 0x2 AND v.uploader = a.id",
$type, $typeId
WHERE {v.uploader = ?d }{v.type = ? }{AND v.typeId = ? }AND v.status & ?d AND (v.status & ?d) = 0 AND v.uploader = a.id",
CC_FLAG_STICKY,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeId : DBSIMPLE_SKIP,
CC_FLAG_APPROVED,
CC_FLAG_DELETED
);
if ($typeOrUser < 0) // only for user page
{
foreach ($videos as $v)
self::addSubject($v['type'], $v['typeId']);
self::getSubjects();
}
// format data to meet requirements of the js
foreach ($videos as &$v)
{
if ($typeOrUser < 0) // only for user page
{
if (!empty(self::$subjCache[$v['type']][$v['typeId']]) && !is_numeric(self::$subjCache[$v['type']][$v['typeId']]))
$v['subject'] = self::$subjCache[$v['type']][$v['typeId']];
else
$v['subject'] = Lang::user('removed');
}
$v['date'] = date(Util::$dateFormatInternal, $v['date']);
$v['videoType'] = 1; // always youtube
if (!$v['sticky'])
@@ -419,22 +456,39 @@ class CommunityContent
return $videos;
}
private static function getScreenshots($type, $typeId)
public static function getScreenshots($typeOrUser, $typeId = 0, &$nFound = 0)
{
$screenshots = DB::Aowow()->Query("
SELECT s.id, a.displayName AS user, s.date, s.width, s.height, s.type, s.typeId, s.caption, IF(s.status & ?d, 1, 0) AS 'sticky'
$screenshots = DB::Aowow()->selectPage($nFound, "
SELECT s.id, a.displayName AS user, s.date, s.width, s.height, s.caption, IF(s.status & ?d, 1, 0) AS 'sticky', s.type, s.typeId
FROM ?_screenshots s, ?_account a
WHERE s.type = ? AND s.typeId = ? AND s.status & ?d AND (s.status & ?d) = 0 AND s.uploader = a.id",
WHERE {s.uploader = ?d }{s.type = ? }{AND s.typeId = ? }AND s.status & ?d AND (s.status & ?d) = 0 AND s.uploader = a.id",
CC_FLAG_STICKY,
$type,
$typeId,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeId : DBSIMPLE_SKIP,
CC_FLAG_APPROVED,
CC_FLAG_DELETED
);
if ($typeOrUser < 0) // only for user page
{
foreach ($screenshots as $s)
self::addSubject($s['type'], $s['typeId']);
self::getSubjects();
}
// format data to meet requirements of the js
foreach ($screenshots as &$s)
{
if ($typeOrUser < 0) // only for user page
{
if (!empty(self::$subjCache[$s['type']][$s['typeId']]) && !is_numeric(self::$subjCache[$s['type']][$s['typeId']]))
$s['subject'] = self::$subjCache[$s['type']][$s['typeId']];
else
$s['subject'] = Lang::user('removed');
}
$s['date'] = date(Util::$dateFormatInternal, $s['date']);
if (!$s['sticky'])
unset($s['sticky']);

View File

@@ -58,10 +58,10 @@ define('ACC_BAN_TEMP', 0x01);
define('ACC_BAN_PERM', 0x02);
define('ACC_BAN_RATE', 0x04); // cannot rate community items (overrides site reputation)
define('ACC_BAN_COMMENT', 0x08); // cannot comment and reply
define('ACC_BAN_UPLOAD', 0x10); // cannot upload avatar / signature files
define('ACC_BAN_UPLOAD', 0x10); // cannot upload avatar / signature files [originally: ban from data upload]
define('ACC_BAN_SCREENSHOT', 0x20); // cannot upload screenshots
define('ACC_BAN_VIDEO', 0x40); // cannot suggest videos
// define('ACC_BAN_FORUM', 0x80); // cannot use forums (not used here)
// define('ACC_BAN_FORUM', 0x80); // cannot use forums [not used here]
// Site Reputation/Privileges
define('SITEREP_ACTION_REGISTER', 1); // Registered account

View File

@@ -96,7 +96,7 @@ switch ($pageCall)
case 'talent': // tool: talent calculator
case 'title':
case 'titles':
// case 'user': // tool: user profiles [nyi]
case 'user':
case 'video':
case 'zone':
case 'zones':

View File

@@ -5,6 +5,7 @@ class Lang
private static $timeUnits;
private static $main;
private static $account;
private static $user;
private static $mail;
private static $game;

View File

@@ -327,12 +327,8 @@ $lang = array(
// dashboard
'ipAddress' => "IP-Adresse",
'lastIP' => "Letzte bekannte IP",
'joinDate' => "Mitglied seit",
'lastLogin' => "Letzter Besuch",
'userGroups' => "Rolle",
'myAccount' => "Mein Account",
'editAccount' => "Benutze die folgenden Formulare um deine Account-Informationen zu aktualisieren",
'publicDesc' => "Öffentliche Beschreibung",
'viewPubDesc' => 'Die Beschreibung in deinem <a href="?user=%s">öffentlichen Profil</a> ansehen',
// bans
@@ -365,6 +361,22 @@ $lang = array(
'passCheckFail' => "Die Kennwörter stimmen nicht überein.", // message_passwordsdonotmatch
'newPassDiff' => "Euer neues Kennwort muss sich von eurem alten Kennwort unterscheiden." // message_newpassdifferent
),
'user' => array(
'notFound' => "Der Benutzer \"%s\" wurde nicht gefunden!",
'removed' => "(Entfernt)",
'joinDate' => "Mitglied seit",
'lastLogin' => "Letzter Besuch",
'userGroups' => "Rolle",
'consecVisits' => "Aufeinanderfolgende Besuche",
'publicDesc' => "Öffentliche Beschreibung",
'profileTitle' => "Profil von %s",
'contributions' => "Beiträge",
'uploads' => "Hochladevorgänge",
'comments' => "Kommentare",
'screenshots' => "Screenshots",
'videos' => "Videos",
'posts' => "Forenbeiträge"
),
'mail' => array(
'tokenExpires' => "Das Token wird in %s verfallen.",
'accConfirm' => ["Kontobestätigung", "Willkommen bei ".CFG_NAME_SHORT."!\r\n\r\nKlicke auf den Link um euren Account zu aktivieren.\r\n\r\n".HOST_URL."?account=signup&token=%s\r\n\r\nFalls Ihr diese Mail nicht angefordert habt kann sie einfach ignoriert werden."],

View File

@@ -322,12 +322,8 @@ $lang = array(
// dashboard
'ipAddress' => "IP-Adress",
'lastIP' => "last used IP",
'joinDate' => "Joined",
'lastLogin' => "Last visit",
'userGroups' => "Role",
'myAccount' => "My Account",
'editAccount' => "Simply use the forms below to update your account information",
'publicDesc' => "Public Description",
'viewPubDesc' => 'View your Public Description in your <a href="?user=%s">Profile Page</a>',
// bans
@@ -360,6 +356,22 @@ $lang = array(
'passCheckFail' => "Passwords do not match.", // message_passwordsdonotmatch
'newPassDiff' => "Your new password must be different than your previous one." // message_newpassdifferent
),
'user' => array(
'notFound' => "User \"%s\" not found!",
'removed' => "(Removed)",
'joinDate' => "Joined",
'lastLogin' => "Last visit",
'userGroups' => "Role",
'consecVisits' => "Consecutive visits",
'publicDesc' => "Public Description",
'profileTitle' => "%s's Profile",
'contributions' => "Contributions",
'uploads' => "Data uploads",
'comments' => "Comments",
'screenshots' => "Screenshots",
'videos' => "Videos",
'posts' => "Forum posts"
),
'mail' => array(
'tokenExpires' => "This token expires in %s.",
'accConfirm' => ["Account Confirmation", "Welcome to ".CFG_NAME_SHORT."!\r\n\r\nClick the Link below to activate your account.\r\n\r\n".HOST_URL."?account=signup&token=%s\r\n\r\nIf you did not request this mail simply ignore it."],

View File

@@ -328,12 +328,8 @@ $lang = array(
// dashboard
'ipAddress' => "IP-Adress",
'lastIP' => "last used IP",
'joinDate' => "Joined",
'lastLogin' => "Last visit",
'userGroups' => "Role",
'myAccount' => "My Account",
'editAccount' => "Simply use the forms below to update your account information",
'publicDesc' => "Public Description",
'viewPubDesc' => 'View your Public Description in your <a href="?user=%s">Profile Page</a>',
// bans
@@ -366,6 +362,22 @@ $lang = array(
'passCheckFail' => "Las contraseñas no son iguales.", // message_passwordsdonotmatch
'newPassDiff' => "Su nueva contraseña tiene que ser diferente a Su contraseña anterior." // message_newpassdifferent
),
'user' => array(
'notFound' => "¡No se encontró el usuario \"%s\"!",
'removed' => "(Removido)",
'joinDate' => "Se unió",
'lastLogin' => "Última visita",
'userGroups' => "Rol",
'consecVisits' => "Visitas consecutivas",
'publicDesc' => "Descripción pública",
'profileTitle' => "Perfíl de %s",
'contributions' => "Contribuciones",
'uploads' => "Datos enviados",
'comments' => "Comentarios",
'screenshots' => "Capturas de pantalla",
'videos' => "Vídeos",
'posts' => "Mensajes en los foros"
),
'mail' => array(
'tokenExpires' => "This token expires in %s.",
'accConfirm' => ["Account Confirmation", "Welcome to ".CFG_NAME_SHORT."!\r\n\r\nClick the Link below to activate your account.\r\n\r\n".HOST_URL."?account=signup&token=%s\r\n\r\nIf you did not request this mail simply ignore it."],

View File

@@ -327,12 +327,8 @@ $lang = array(
// dashboard
'ipAddress' => "IP-Adress",
'lastIP' => "last used IP",
'joinDate' => "Joined",
'lastLogin' => "Last visit",
'userGroups' => "Role",
'myAccount' => "My Account",
'editAccount' => "Simply use the forms below to update your account information",
'publicDesc' => "Public Description",
'viewPubDesc' => 'View your Public Description in your <a href="?user=%s">Profile Page</a>',
// bans
@@ -365,6 +361,22 @@ $lang = array(
'passCheckFail' => "Les mots de passe ne correspondent pas.", // message_passwordsdonotmatch
'newPassDiff' => "Votre nouveau mot de passe doit être différent de l'ancien." // message_newpassdifferent
),
'user' => array(
'notFound' => "Utilisateur \"%s\" non trouvé !",
'removed' => "(Supprimé)",
'joinDate' => "Inscription",
'lastLogin' => "Dernière visite",
'userGroups' => "Role",
'consecVisits' => "Visites consécutives",
'publicDesc' => "Description publique",
'profileTitle' => "Profil de %s",
'contributions' => "Contributions",
'uploads' => "Envois de données",
'comments' => "Commentaires",
'screenshots' => "Captures d'écran",
'videos' => "Vidéos",
'posts' => "Messages sur le forum"
),
'mail' => array(
'tokenExpires' => "This token expires in %s.",
'accConfirm' => ["Account Confirmation", "Welcome to ".CFG_NAME_SHORT."!\r\n\r\nClick the Link below to activate your account.\r\n\r\n".HOST_URL."?account=signup&token=%s\r\n\r\nIf you did not request this mail simply ignore it."],

View File

@@ -327,12 +327,8 @@ $lang = array(
// dashboard
'ipAddress' => "IP-Adress",
'lastIP' => "last used IP",
'joinDate' => "Joined",
'lastLogin' => "Last visit",
'userGroups' => "Role",
'myAccount' => "My Account",
'editAccount' => "Simply use the forms below to update your account information",
'publicDesc' => "Public Description",
'viewPubDesc' => 'View your Public Description in your <a href="?user=%s">Profile Page</a>',
// bans
@@ -365,6 +361,22 @@ $lang = array(
'passCheckFail' => "Пароли не совпадают.", // message_passwordsdonotmatch
'newPassDiff' => "Прежний и новый пароли не должны совпадать." // message_newpassdifferent
),
'user' => array(
'notFound' => "Пользователь \"%s\" не найден!",
'removed' => "(Удалено)",
'joinDate' => "Зарегистрировался",
'lastLogin' => "Последняя активность",
'userGroups' => "Роль",
'consecVisits' => "Регулярные посещения",
'publicDesc' => "Описание",
'profileTitle' => "Профиль %s",
'contributions' => "Вклад",
'uploads' => "Данных загружено",
'comments' => "Комментарии",
'screenshots' => "Скриншоты",
'videos' => "Видео",
'posts' => "Сообщений на форумах"
),
'mail' => array(
'tokenExpires' => "This token expires in %s.",
'accConfirm' => ["Account Confirmation", "Welcome to ".CFG_NAME_SHORT."!\r\n\r\nClick the Link below to activate your account.\r\n\r\n".HOST_URL."?account=signup&token=%s\r\n\r\nIf you did not request this mail simply ignore it."],

View File

@@ -180,8 +180,8 @@ class AccountPage extends GenericPage
/***********/
$infobox = [];
$infobox[] = Lang::account('joinDate'). Lang::main('colon').'[tooltip name=joinDate]'. date('l, G:i:s', $user['joinDate']). '[/tooltip][span class=tip tooltip=joinDate]'. date(Lang::main('dateFmtShort'), $user['joinDate']). '[/span]';
$infobox[] = Lang::account('lastLogin').Lang::main('colon').'[tooltip name=lastLogin]'.date('l, G:i:s', $user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.date(Lang::main('dateFmtShort'), $user['prevLogin']).'[/span]';
$infobox[] = Lang::user('joinDate'). Lang::main('colon').'[tooltip name=joinDate]'. date('l, G:i:s', $user['joinDate']). '[/tooltip][span class=tip tooltip=joinDate]'. date(Lang::main('dateFmtShort'), $user['joinDate']). '[/span]';
$infobox[] = Lang::user('lastLogin').Lang::main('colon').'[tooltip name=lastLogin]'.date('l, G:i:s', $user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.date(Lang::main('dateFmtShort'), $user['prevLogin']).'[/span]';
$infobox[] = Lang::account('lastIP').Lang::main('colon').$user['prevIP'];
$infobox[] = Lang::account('email'). Lang::main('colon').$user['email'];
@@ -189,7 +189,7 @@ class AccountPage extends GenericPage
foreach (Lang::account('groups') as $idx => $key)
if ($idx >= 0 && $user['userGroups'] & (1 << $idx))
$groups[] = (!fMod(count($groups) + 1, 3) ? '[br]' : null).Lang::account('groups', $idx);
$infobox[] = Lang::account('userGroups').Lang::main('colon').($groups ? implode(', ', $groups) : Lang::account('groups', -1));
$infobox[] = Lang::user('userGroups').Lang::main('colon').($groups ? implode(', ', $groups) : Lang::account('groups', -1));
$infobox[] = Util::ucFirst(Lang::main('siteRep')).Lang::main('colon').User::getReputation();

View File

@@ -361,9 +361,12 @@ class GenericPage
/* Special Display */
/*******************/
public function notFound($typeStr) // unknown ID
public function notFound($title, $msg = '') // unknown entry
{
$this->typeStr = $typeStr;
$this->notFound = array(
'title' => $this->typeId ? Util::ucFirst($title).' #'.$this->typeId : $title,
'msg' => !$msg && $this->typeId ? sprintf(Lang::main('pageNotFound'), $title) : $msg
);
$this->hasComContent = false;
Util::arraySumByKey($this->mysql, DB::Aowow()->getStatistics(), DB::World()->getStatistics());

219
pages/user.php Normal file
View File

@@ -0,0 +1,219 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
// exclude & weightscales are handled as Ajax
class UserPage extends GenericPage
{
protected $tpl = 'user';
protected $js = ['user.js', 'profile.js'];
protected $css = [['path' => 'Profiler.css']];
protected $mode = CACHE_TYPE_NONE;
protected $typeId = 0;
protected $pageName = '';
public function __construct($pageCall, $pageParam)
{
parent::__construct($pageCall, $pageParam);
if ($pageParam)
{
// todo: check if account is disabled or something
if ($user = DB::Aowow()->selectRow('SELECT a.id, a.user, a.displayName, a.consecutiveVisits, a.userGroups, a.avatar, a.title, a.description, a.joinDate, a.prevLogin, IFNULL(SUM(ar.amount), 0) AS sumRep FROM ?_account a LEFT JOIN ?_account_reputation ar ON a.id = ar.userId WHERE a.user = ? GROUP BY a.id', $pageParam))
$this->user = $user;
else
$this->notFound(sprintf(Lang::user('notFound'), $pageParam));
}
else if (User::$id)
header('Location: ?user='.User::$displayName, true, 302);
else
$this->forwardToSignIn('user');
}
protected function generateContent()
{
/***********/
/* Infobox */
/***********/
$infobox = $contrib = $groups = [];
foreach (Lang::account('groups') as $idx => $key)
if ($idx >= 0 && $this->user['userGroups'] & (1 << $idx))
$groups[] = (!fMod(count($groups) + 1, 3) ? '[br]' : null).Lang::account('groups', $idx);
$infobox[] = Lang::user('joinDate'). Lang::main('colon').'[tooltip name=joinDate]'. date('l, G:i:s', $this->user['joinDate']). '[/tooltip][span class=tip tooltip=joinDate]'. date(Lang::main('dateFmtShort'), $this->user['joinDate']). '[/span]';
$infobox[] = Lang::user('lastLogin').Lang::main('colon').'[tooltip name=lastLogin]'.date('l, G:i:s', $this->user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.date(Lang::main('dateFmtShort'), $this->user['prevLogin']).'[/span]';
$infobox[] = Lang::user('userGroups').Lang::main('colon').($groups ? implode(', ', $groups) : Lang::account('groups', -1));
$infobox[] = Lang::user('consecVisits').Lang::main('colon').$this->user['consecutiveVisits'];
$infobox[] = Util::ucFirst(Lang::main('siteRep')).Lang::main('colon').number_format($this->user['sumRep']);
// contrib -> [url=http://www.wowhead.com/client]Data uploads: n [small]([tooltip=tooltip_totaldatauploads]xx.y MB[/tooltip])[/small][/url]
$co = DB::Aowow()->selectRow(
'SELECT COUNT(DISTINCT c.id) AS sum, COUNT(cr.commentId) AS nRates FROM ?_comments c LEFT JOIN ?_comments_rates cr ON cr.commentId = c.id WHERE c.replyTo = 0 AND c.userId = ?d',
$this->user['id']
);
if ($co['sum'])
$contrib[] = Lang::user('comments').Lang::main('colon').$co['sum'].' [small]([tooltip=tooltip_totalratings]'.$co['nRates'].'[/tooltip])[/small]';
$ss = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) as nSticky FROM ?_screenshots WHERE uploader = ?d AND status & ?d AND (status & ?d) = 0',
CC_FLAG_STICKY,
$this->user['id'],
CC_FLAG_APPROVED,
CC_FLAG_DELETED
);
if ($ss['sum'])
$contrib[] = Lang::user('screenshots').Lang::main('colon').$ss['sum'].' [small]([tooltip=tooltip_normal]'.($ss['sum'] - $ss['nSticky']).'[/tooltip] + [tooltip=tooltip_sticky]'.$ss['nSticky'].'[/tooltip])[/small]';
$vi = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) as nSticky FROM ?_videos WHERE uploader = ?d AND status & ?d AND (status & ?d) = 0',
CC_FLAG_STICKY,
$this->user['id'],
CC_FLAG_APPROVED,
CC_FLAG_DELETED
);
if ($vi['sum'])
$contrib[] = Lang::user('videos').Lang::main('colon').$vi['sum'].' [small]([tooltip=tooltip_normal]'.($vi['sum'] - $vi['nSticky']).'[/tooltip] + [tooltip=tooltip_sticky]'.$vi['nSticky'].'[/tooltip])[/small]';
// contrib -> Forum posts: 5769 [small]([tooltip=topics]579[/tooltip] + [tooltip=replies]5190[/tooltip])[/small]
$this->infobox = '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]';
if ($contrib)
$this->contributions = '[ul][li]'.implode('[/li][li]', $contrib).'[/li][/ul]';
/****************/
/* Main Content */
/****************/
$this->name = $this->user['title'] ? $this->user['displayName'].'&nbsp;&lt;'.$this->user['title'].'&gt;' : sprintf(Lang::user('profileTitle'), $this->user['displayName']);
/**************/
/* Extra Tabs */
/**************/
$this->lvTabs = [];
$this->forceTabs = true;
// [unused] Site Achievements
// Reputation changelog (params only for comment-events)
if ($repData = DB::Aowow()->select('SELECT action, amount, date AS \'when\', IF(action IN (3, 4, 5), sourceA, 0) AS param FROM ?_account_reputation WHERE userId = ?d', $this->user['id']))
{
foreach ($repData as &$r)
$r['when'] = date(Util::$dateFormatInternal, $r['when']);
$this->lvTabs[] = array(
'file' => 'reputationhistory',
'data' => $repData,
'params' => []
);
}
// Comments
if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound))
{
$lvData = array(
'file' => 'commentpreview',
'data' => $_,
'params' => array(
'hiddenCols' => "$['author']",
'onBeforeCreate' => '$Listview.funcBox.beforeUserComments',
'_totalCount' => $nFound
)
);
if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{
$lvData['params']['name'] = '$LANG.tab_latestcomments';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, '.$nFound.')';
}
$this->lvTabs[] = $lvData;
}
// Comment Replies
if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound))
{
$lvData = array(
'file' => 'replypreview',
'data' => $_,
'params' => array(
'hiddenCols' => "$['author']",
'onBeforeCreate' => '$Listview.funcBox.beforeUserComments',
'_totalCount' => $nFound
)
);
if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{
$lvData['params']['name'] = '$LANG.tab_latestreplies';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, '.$nFound.')';
}
$this->lvTabs[] = $lvData;
}
// Screenshots
if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound))
{
$lvData = array(
'file' => 'screenshot',
'data' => $_,
'params' => array(
'_totalCount' => $nFound
)
);
if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{
$lvData['params']['name'] = '$LANG.tab_latestscreenshots';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, '.$nFound.')';
}
$this->lvTabs[] = $lvData;
}
// Videos
if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound))
{
$lvData = array(
'file' => 'video',
'data' => $_,
'params' => array(
'_totalCount' => $nFound
)
);
if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{
$lvData['params']['name'] = '$LANG.tab_latestvideos';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, '.$nFound.')';
}
$this->lvTabs[] = $lvData;
}
// forum -> latest topics [unused]
// forum -> latest replies [unused]
// Characters [todo]
$this->user['characterData'] = [];
// Profiles [todo]
$this->user['profileData'] = [];
}
protected function generateTitle()
{
array_unshift($this->title, sprintf(Lang::user('profileTitle'), $this->user['displayName']));
}
protected function generatePath() { }
}
?>

View File

@@ -9237,9 +9237,9 @@ Listview.funcBox = {
},
moneyCurrencyOver: function(currencyId, count, e) {
var buff = g_gatheredcurrencies[currencyId]['name_' + Locale.getName() /*g_loc.getName()*/];
var buff = g_gatheredcurrencies[currencyId]['name_' + Locale.getName()];
// justice / valor points handling removed
// sarjuuk: justice / valor points handling removed
$WH.Tooltip.showAtCursor(e, buff, 0, 0, 'q1');
},

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@ endif;
if (!empty($this->contributions)):
?>
<tr><th id="infobox-contributions"><?php echo Lang::main('contributions'); ?></th></tr>
<tr><th id="infobox-contributions"><?php echo Lang::user('contributions'); ?></th></tr>
<tr><td>
<div class="infobox-spacer"></div>
<div id="infobox-contents1"></div>

View File

@@ -1,6 +1,6 @@
<?php
$relTabs = !empty($relTabs);
$tabVar = $relTabs ? 'tabsRelated' : 'myTabs';
$tabVar = $relTabs || !empty($this->user) ? 'tabsRelated' : 'myTabs';
$isTabbed = !empty($this->forceTabs) || $relTabs || count($this->lvTabs) > 1;
if ($isTabbed):
@@ -42,7 +42,14 @@ foreach ($this->lvTabs as $lv):
endif;
endforeach;
if ($relTabs):
if (!empty($this->user)):
if (!empty($this->user['characterData'])):
echo ' us_addCharactersTab('.Util::toJSON($this->user['characterData']).");\n";
endif;
if (!empty($this->user['profileData'])):
echo ' us_addProfilesTab('.Util::toJSON($this->user['profileData']).");\n";
endif;
elseif ($relTabs):
?>
new Listview({template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: <?php echo $tabVar; ?>, parent: 'lv-generic', data: lv_comments});
new Listview({template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: <?php echo $tabVar; ?>, parent: 'lv-generic', data: lv_screenshots});

View File

@@ -2,7 +2,7 @@ new Listview({
template:'commentpreview',
<?php
echo !isset($params['id']) ? "id:'comments'," : null;
echo !isset($params['name']) ? "name:LANG.tab_latestcomments," : null;
echo !isset($params['name']) ? "name:LANG.tab_comments," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):

View File

@@ -2,6 +2,7 @@ new Listview({
template:'screenshot',
<?php
echo !isset($params['id']) ? "id:'screenshots'," : null;
echo !isset($params['name']) ? "name:LANG.tab_screenshots," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):

View File

@@ -24,7 +24,7 @@ $this->brick('pageTemplate');
<select id="pagetype">
<?php
foreach (Util::$typeStrings as $i => $str):
if (isset(Lang::game($str))):
if (Lang::game($str)):
echo " <option value=\"".$i."\">".Util::ucFirst(Lang::game($str))."</option>\n";
endif;
endforeach;

View File

@@ -9,13 +9,13 @@ $this->brick('announcement');
$this->brick('pageTemplate');
if (isset($this->typeStr)):
if (isset($this->notFound)):
?>
<div class="pad3"></div>
<div class="inputbox">
<h1><?php echo Util::ucFirst($this->typeStr).' #'.$this->typeId; ?></h1>
<div id="inputbox-error"><?php echo sprintf(Lang::main('pageNotFound'), $this->typeStr); ?></div>
<h1><?php echo $this->notFound['title']; ?></h1>
<div id="inputbox-error"><?php echo $this->notFound['msg']; ?></div>
<?php
else:
?>

View File

@@ -0,0 +1,46 @@
<?php $this->brick('header'); ?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php
$this->brick('announcement');
$this->brick('pageTemplate');
$this->brick('infobox');
?>
<script type="text/javascript">var g_pageInfo = { username: '<?php echo Util::jsEscape($this->user['displayName']); ?>' }</script>
<div class="text">
<div id="h1-icon-generic" class="h1-icon"></div>
<script type="text/javascript">
$WH.ge('h1-icon-generic').appendChild(Icon.createUser(<?php echo (is_numeric($this->user['avatar']) ? 2 : 1).', \''.($this->user['avatar'] ?: 'inv_misc_questionmark').'\''?>, 1, null, <?php echo User::isInGroup(U_GROUP_PREMIUM) ? 0 : 2; ?>, false, Icon.getPrivilegeBorder(<?php echo $this->user['sumRep']; ?>)));
</script>
<h1 class="h1-icon"><?php echo $this->name; ?></h1>
</div>
<h3 class="first"><?php echo Lang::user('publicDesc'); ?></h3>
<div id="description" class="left"><?php # must follow directly, no whitespaces allowed
if (!empty($this->user['description'])):
?>
<div id="description-generic"></div>
<script type="text/javascript">//<![CDATA[
Markup.printHtml('<?php echo $this->user['description']; ?>', "description-generic", { allow: Markup.CLASS_USER, roles: "<?php echo $this->user['userGroups']; ?>" });
//]]></script>
<?php
endif;
?></div>
<script type="text/javascript">us_addDescription()</script>
<div id="roster-status" class="profiler-message clear" style="display: none"></div>
<?php $this->brick('lvTabs', ['relTabs' => true]); ?>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>