User/Misc

* floating changes
 * codify user checks into functions
This commit is contained in:
Sarjuuk
2025-04-02 22:27:05 +02:00
parent 3078763ec3
commit 682b315e17
22 changed files with 78 additions and 71 deletions

View File

@@ -27,7 +27,7 @@ class AjaxAccount extends AjaxHandler
{
parent::__construct($params);
if (!$this->params || !User::$id)
if (!$this->params || !User::isLoggedIn())
return;
// select handler

View File

@@ -172,7 +172,7 @@ class AjaxComment extends AjaxHandler
protected function handleCommentDelete() : void
{
if (!$this->_post['id'] || !User::$id)
if (!$this->_post['id'] || !User::isLoggedIn())
{
trigger_error('AjaxComment::handleCommentDelete - commentId empty or user not logged in', E_USER_ERROR);
return;
@@ -204,7 +204,7 @@ class AjaxComment extends AjaxHandler
protected function handleCommentUndelete() : void
{
if (!$this->_post['id'] || !User::$id)
if (!$this->_post['id'] || !User::isLoggedIn())
{
trigger_error('AjaxComment::handleCommentUndelete - commentId empty or user not logged in', E_USER_ERROR);
return;
@@ -242,7 +242,7 @@ class AjaxComment extends AjaxHandler
protected function handleCommentVote() : string
{
if (!User::$id || !$this->_get['id'] || !$this->_get['rating'])
if (!User::isLoggedIn() || !$this->_get['id'] || !$this->_get['rating'])
return Util::toJSON(['error' => 1, 'message' => Lang::main('genericError')]);
$target = DB::Aowow()->selectRow('SELECT c.`userId` AS owner, ur.`value` FROM ?_comments c LEFT JOIN ?_user_ratings ur ON ur.`type` = ?d AND ur.`entry` = c.id AND ur.`userId` = ?d WHERE c.id = ?d', RATING_COMMENT, User::$id, $this->_get['id']);
@@ -393,7 +393,7 @@ class AjaxComment extends AjaxHandler
protected function handleReplyDelete() : void
{
if (!User::$id || !$this->_post['id'])
if (!User::isLoggedIn() || !$this->_post['id'])
{
trigger_error('AjaxComment::handleReplyDelete - commentId empty or user not logged in', E_USER_ERROR);
return;
@@ -407,7 +407,7 @@ class AjaxComment extends AjaxHandler
protected function handleReplyFlag() : void
{
if (!User::$id || !$this->_post['id'])
if (!User::isLoggedIn() || !$this->_post['id'])
{
trigger_error('AjaxComment::handleReplyFlag - commentId empty or user not logged in', E_USER_ERROR);
return;

View File

@@ -10,7 +10,7 @@ class AjaxCookie extends AjaxHandler
public function __construct(array $params)
{
// note that parent::__construct has to come after this
if (!$params || !User::$id)
if (!$params || !User::isLoggedIn())
return;
$this->_get = array(
@@ -30,7 +30,7 @@ class AjaxCookie extends AjaxHandler
*/
protected function handleCookie() : string
{
if (User::$id && $this->params && $this->_get[$this->params[0]])
if (User::isLoggedIn() && $this->params && $this->_get[$this->params[0]])
{
if (DB::Aowow()->query('REPLACE INTO ?_account_cookies VALUES (?d, ?, ?)', User::$id, $this->params[0], $this->_get[$this->params[0]]))
return '0';

View File

@@ -34,7 +34,7 @@ class AjaxEdit extends AjaxHandler
*/
protected function handleUpload() : string
{
if (!User::$id || $this->_get['guide'] != 1)
if (!User::canWriteGuide() || $this->_get['guide'] != 1)
return Util::toJSON(['success' => false, 'error' => '']);
require_once('includes/libs/qqFileUploader.class.php');

View File

@@ -25,7 +25,7 @@ class AjaxGetdescription extends AjaxHandler
{
$this->contentType = MIME_TYPE_TEXT;
if (!User::$id)
if (!User::canWriteGuide())
return '';
$desc = (new Markup($this->_post['description']))->stripTags();

View File

@@ -103,7 +103,7 @@ class AjaxProfile extends AjaxHandler
*/
protected function handleLink() : void // links char with account
{
if (!User::$id || empty($this->_get['id']))
if (!User::isLoggedIn() || empty($this->_get['id']))
{
trigger_error('AjaxProfile::handleLink - profileId empty or user not logged in', E_USER_ERROR);
return;
@@ -143,7 +143,7 @@ class AjaxProfile extends AjaxHandler
*/
protected function handlePin() : void // (un)favorite
{
if (!User::$id || empty($this->_get['id'][0]))
if (!User::isLoggedIn() || empty($this->_get['id'][0]))
{
trigger_error('AjaxProfile::handlePin - profileId empty or user not logged in', E_USER_ERROR);
return;
@@ -173,7 +173,7 @@ class AjaxProfile extends AjaxHandler
*/
protected function handlePrivacy() : void // public visibility
{
if (!User::$id || empty($this->_get['id'][0]))
if (!User::isLoggedIn() || empty($this->_get['id'][0]))
{
trigger_error('AjaxProfile::handlePrivacy - profileId empty or user not logged in', E_USER_ERROR);
return;
@@ -451,7 +451,7 @@ class AjaxProfile extends AjaxHandler
*/
protected function handleDelete() : void // kill a profile
{
if (!User::$id || !$this->_get['id'])
if (!User::isLoggedIn() || !$this->_get['id'])
{
trigger_error('AjaxProfile::handleDelete - profileId empty or user not logged in', E_USER_ERROR);
return;

View File

@@ -134,7 +134,7 @@ class Report
return;
}
if (!User::$id && !User::$ip)
if (!User::isLoggedIn() && !User::$ip)
{
trigger_error('Report - could not determine IP for anonymous user', E_USER_ERROR);
$this->errorCode = self::ERR_MISCELLANEOUS;
@@ -147,7 +147,7 @@ class Report
private function checkTargetContext() : int
{
// check already reported
$field = User::$id ? 'userId' : 'ip';
$field = User::isLoggedIn() ? 'userId' : 'ip';
if (DB::Aowow()->selectCell('SELECT 1 FROM ?_reports WHERE `mode` = ?d AND `reason`= ?d AND `subject` = ?d AND ?# = ?', $this->mode, $this->reason, $this->subject, $field, User::$id ?: User::$ip))
return self::ERR_ALREADY_REPORTED;

View File

@@ -92,8 +92,8 @@ class User
self::$expires = (bool)$uData['allowExpire'];
self::$reputation = $uData['reputation'];
self::$banStatus = $uData['bans'];
self::$groups = $uData['bans'] & (ACC_BAN_TEMP | ACC_BAN_PERM) ? 0 : intval($uData['userGroups']);
self::$perms = $uData['bans'] & (ACC_BAN_TEMP | ACC_BAN_PERM) ? 0 : intval($uData['userPerms']);
self::$groups = self::isBanned() ? 0 : intval($uData['userGroups']);
self::$perms = self::isBanned() ? 0 : intval($uData['userPerms']);
self::$dailyVotes = $uData['dailyVotes'];
self::$excludeGroups = $uData['excludeGroups'];
@@ -114,7 +114,7 @@ class User
// - conscutive visits
// - votes per day
// - reputation for daily visit
if (self::$id)
if (self::isLoggedIn())
{
$lastLogin = DB::Aowow()->selectCell('SELECT curLogin FROM ?_account WHERE id = ?d', self::$id);
// either the day changed or the last visit was >24h ago
@@ -133,7 +133,7 @@ class User
);
// gain rep for daily visit
if (!(self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM)) && !self::isInGroup(U_GROUP_PENDING))
if (!(self::isBanned()) && !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)
@@ -181,7 +181,7 @@ class User
$_SESSION['timeout'] = self::$expires ? time() + Cfg::get('SESSION_TIMEOUT_DELAY') : 0;
// $_SESSION['dataKey'] does not depend on user login status and is set in User::init()
if (self::$id && $toDB)
if (self::isLoggedIn() && $toDB)
DB::Aowow()->query('UPDATE ?_account SET `locale` = ? WHERE `id` = ?', self::$preferedLoc->value, self::$id);
}
@@ -427,7 +427,7 @@ class User
public static function canComment() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_COMMENT | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_COMMENT))
return false;
return self::$perms || self::$reputation >= Cfg::get('REP_REQ_COMMENT');
@@ -435,7 +435,7 @@ class User
public static function canReply() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_COMMENT | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_COMMENT))
return false;
return self::$perms || self::$reputation >= Cfg::get('REP_REQ_REPLY');
@@ -443,7 +443,7 @@ class User
public static function canUpvote() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_COMMENT | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_COMMENT))
return false;
return self::$perms || (self::$reputation >= Cfg::get('REP_REQ_UPVOTE') && self::$dailyVotes > 0);
@@ -451,7 +451,7 @@ class User
public static function canDownvote() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_RATE | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_RATE))
return false;
return self::$perms || (self::$reputation >= Cfg::get('REP_REQ_DOWNVOTE') && self::$dailyVotes > 0);
@@ -459,7 +459,7 @@ class User
public static function canSupervote() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_RATE | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_RATE) || self::isInGroup(U_GROUP_PENDING))
return false;
return self::$reputation >= Cfg::get('REP_REQ_SUPERVOTE');
@@ -467,7 +467,7 @@ class User
public static function canUploadScreenshot() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_SCREENSHOT | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_SCREENSHOT) || self::isInGroup(U_GROUP_PENDING))
return false;
return true;
@@ -475,7 +475,7 @@ class User
public static function canWriteGuide() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_GUIDE | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_GUIDE) || self::isInGroup(U_GROUP_PENDING))
return false;
return true;
@@ -483,7 +483,7 @@ class User
public static function canSuggestVideo() : bool
{
if (!self::$id || self::$banStatus & (ACC_BAN_VIDEO | ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned(ACC_BAN_VIDEO) || self::isInGroup(U_GROUP_PENDING))
return false;
return true;
@@ -494,6 +494,16 @@ class User
return self::isInGroup(U_GROUP_PREMIUM) || self::$reputation >= Cfg::get('REP_REQ_PREMIUM');
}
public static function isLoggedIn() : bool
{
return self::$id > 0; // more checks? maybe check pending email verification here? (self::isInGroup(U_GROUP_PENDING))
}
public static function isBanned(int $addBanMask = 0x0) : bool
{
return self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM | $addBanMask);
}
/**************/
/* js-related */
@@ -512,7 +522,7 @@ class User
public static function getMaxDailyVotes() : int
{
if (!self::$id || self::$banStatus & (ACC_BAN_PERM | ACC_BAN_TEMP))
if (!self::isLoggedIn() || self::isBanned())
return 0;
return Cfg::get('USER_MAX_VOTES') + (self::$reputation >= Cfg::get('REP_REQ_VOTEMORE_BASE') ? 1 + intVal((self::$reputation - Cfg::get('REP_REQ_VOTEMORE_BASE')) / Cfg::get('REP_REQ_VOTEMORE_ADD')) : 0);
@@ -533,7 +543,7 @@ class User
'cookies' => []
);
if (!self::$id || self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM))
if (!self::isLoggedIn() || self::isBanned())
return $gUser;
$gUser['commentban'] = !self::canComment();
@@ -646,17 +656,15 @@ class User
public static function getCookies() : array
{
$data = [];
if (!self::isLoggedIn())
return [];
if (self::$id)
$data = DB::Aowow()->selectCol('SELECT `name` AS ARRAY_KEY, `data` FROM ?_account_cookies WHERE `userId` = ?d', self::$id);
return $data;
return DB::Aowow()->selectCol('SELECT `name` AS ARRAY_KEY, `data` FROM ?_account_cookies WHERE `userId` = ?d', self::$id);
}
public static function getFavorites() : array
{
if (!self::$id)
if (!self::isLoggedIn())
return [];
$res = DB::Aowow()->selectCol('SELECT `type` AS ARRAY_KEY, `typeId` AS ARRAY_KEY2, `typeId` FROM ?_account_favorites WHERE `userId` = ?d', self::$id);

View File

@@ -63,10 +63,10 @@ class AccountPage extends GenericPage
if ($pageParam)
{
// requires auth && not authed
if ($this->validCats[$pageParam][0] && !User::$id)
if ($this->validCats[$pageParam][0] && !User::isLoggedIn())
$this->forwardToSignIn('account='.$pageParam);
// doesn't require auth && authed
else if (!$this->validCats[$pageParam][0] && User::$id)
else if (!$this->validCats[$pageParam][0] && User::isLoggedIn())
header('Location: ?account', true, 302); // goto dashboard
}
}
@@ -200,7 +200,7 @@ class AccountPage extends GenericPage
private function createDashboard()
{
if (!User::$id)
if (!User::isLoggedIn())
$this->forwardToSignIn('account');
$user = DB::Aowow()->selectRow('SELECT * FROM ?_account WHERE id = ?d', User::$id);

View File

@@ -329,13 +329,13 @@ class GenericPage
}
// requires authed user
if ($this->reqAuth && !User::$id)
if ($this->reqAuth && !User::isLoggedIn())
$this->forwardToSignIn($_SERVER['QUERY_STRING'] ?? '');
// restricted access
if ($this->reqUGroup && !User::isInGroup($this->reqUGroup))
{
if (User::$id)
if (User::isLoggedIn())
$this->error();
else
$this->forwardToSignIn($_SERVER['QUERY_STRING'] ?? '');

View File

@@ -489,7 +489,7 @@ class GuidePage extends GenericPage
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ?_guides WHERE `id` = ?d AND `status` <> ?d {AND `userId` = ?d}', $this->typeId, GUIDE_STATUS_ARCHIVED, User::isInGroup(U_GROUP_STAFF) ? DBSIMPLE_SKIP : User::$id))
$this->typeId = intVal($id);
}
else if ($this->_get['id'] === 0) // create new guide and load in editor
else if ($this->_get['id'] === 0) // create new guide and load in editor
$this->typeId = DB::Aowow()->query('INSERT INTO ?_guides (`userId`, `date`, `status`) VALUES (?d, ?d, ?d)', User::$id, time(), GUIDE_STATUS_DRAFT);
return $this->typeId > 0;

View File

@@ -29,7 +29,7 @@ class GuidesPage extends GenericPage
if ($pageCall == 'my-guides')
{
if (!User::$id)
if (!User::isLoggedIn())
$this->error();
$this->name = Util::ucFirst(Lang::guide('myGuides'));
@@ -81,7 +81,7 @@ class GuidesPage extends GenericPage
$this->lvTabs[] = [GuideList::$brickFile, $tabData];
$this->redButtons = [BUTTON_GUIDE_NEW => User::$id && User::canComment()];
$this->redButtons = [BUTTON_GUIDE_NEW => User::canWriteGuide()];
}
protected function generateTitle()

View File

@@ -139,13 +139,12 @@ class MorePage extends GenericPage
private function handleReputationPage()
{
if (!User::$id)
if (!User::isLoggedIn())
return;
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', User::$id))
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', User::$id))
{
foreach ($repData as &$r)
$r['when'] = date(Util::$dateFormatInternal, $r['when']);
array_walk($repData, fn(&$x) => $x['when'] = date(Util::$dateFormatInternal, $x['when']));
$this->tabsTitle = Lang::main('yourRepHistory');
$this->lvTabs[] = ['reputationhistory', array(

View File

@@ -31,12 +31,12 @@ class UserPage extends GenericPage
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))
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 LOWER(a.`displayName`) = LOWER(?) GROUP BY a.`id`', $pageParam))
$this->user = $user;
else
$this->notFound(sprintf(Lang::user('notFound'), $pageParam));
}
else if (User::$id)
else if (User::isLoggedIn())
{
header('Location: ?user='.User::$displayName, true, 302);
die();

View File

@@ -1,7 +1,7 @@
<?php namespace Aowow; ?>
<?php
if (User::$id):
if (User::isLoggedIn()):
echo '<span id="toplinks-favorites"><a class="hassubmenu"></a>|</span>';
echo '<a id="toplinks-user">'.User::$displayName.'</a>';
echo '<span id="toplinks-rep" title="'.Lang::main('reputationTip').'">(<a href="?reputation">'.User::getReputation().'</a>)</span>';

View File

@@ -17,7 +17,7 @@ if (!empty($this->gPageInfo)):
echo " var g_pageInfo = ".Util::toJSON($this->gPageInfo).";\n";
// only used by item.php
if (User::$id > 0 && isset($this->redButtons[BUTTON_EQUIP]) && $this->redButtons[BUTTON_EQUIP]):
if (User::isLoggedIn() && isset($this->redButtons[BUTTON_EQUIP])):
echo " DomContentLoaded.addEvent(function() { pr_addEquipButton('equip-pinned-button', ".$this->typeId."); });\n";
endif;
endif;

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>You are not logged in. Please <a href="?account=signin">log in</a> or <a href="?account=signup">register an account</a> to add your comment.</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>You are not signed in. Please <a href="?account=signin">sign in</a> to submit a screenshot.</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>You are not signed in. Please <a href="?account=signin">sign in</a> to submit a video.</small>
<?php

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Vous n'êtes pas connecté(e). Veuillez vous <a href="?account=signin">connecter</a> ou vous <a href="?account=signup">inscrire</a> pour ajouter votre commentaire.</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Vous n'êtes pas connecté(e). Veuillez vous <a href="?account=signin">connecter</a> pour envoyer une capture d'écran.</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Vous n'êtes pas connecté(e). Veuillez vous <a href="?account=signin">connecter</a> pour envoyer une vidéo.</small>
<?php

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Ihr seid nicht angemeldet. Bitte <a href="?account=signin">meldet Euch an</a>, oder <a href="?account=signup">registriert Euch</a>, um einen Kommentar einzusenden.</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Ihr seid nicht angemeldet. Bitte <a href="?account=signin">meldet Euch an</a>, um einen Screenshot einzusenden.</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Ihr seid nicht angemeldet. Bitte <a href="?account=signin">meldet Euch an</a>, um ein Video vorzuschlagen.</small>
<?php

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>你尚未登录,请先<a href="?account=signin">登录</a>或<a href="?account=signup">注册一个账号</a> 以发表你的评论。</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>你尚未登录,请先<a href="?account=signin">登录</a>以提交截图。</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>You are not signed in. Please <a href="?account=signin">sign in</a> to submit a video.</small>
<?php

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>No has iniciado sesión. Por favor <a href="?account=signin">entra a tu cuenta</a> o <a href="?account=signup">registra una cuenta</a> para añadir tu comentario.</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>No has iniciado sesión. <a href="?account=signin">Inicia sesión</a> para enviar una captura de pantalla.</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>No has iniciado sesión. <a href="?account=signin">Inicia sesión</a> para enviar un video.</small>
<?php

View File

@@ -25,7 +25,7 @@
<div class="comment-edit-body"><textarea class="comment-editbox" rows="10" cols="40" name="commentbody" disabled="disabled"></textarea></div>
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Вы не вошли на сайт. Пожалуйста <a href="?account=signin">войдите</a> или <a href="?account=signup">зарегистрируйтесь</a>, чтобы добавлять комментарии.</small>
<?php
@@ -58,7 +58,7 @@
<input type="file" name="screenshotfile" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Вы не вошли на сайт. Пожалуйста <a href="?account=signin">войдите</a>, чтобы отправить скриншот.</small>
<?php
@@ -85,7 +85,7 @@
<input type="text" name="videourl" disabled="disabled" /><br />
<?php
endif;
if (!User::$id):
if (!User::isLoggedIn()):
?>
<small>Вы не вошли на сайт. Пожалуйста <a href="?account=signin">войдите</a>, чтобы отправить видео.</small>
<?php