Skip to content

Commit

Permalink
Fix PHP 8 fatal error: Undefined constant ADMINNAME
Browse files Browse the repository at this point in the history
```
PHP Fatal error:  Uncaught Error: Undefined constant "ADMINNAME" in
/home/deltik/public_html/e107_themes/bootstrap3/admin_template.php:83
Stack trace:
require_once('...')
require_once('...')
  thrown in
/home/deltik/public_html/e107_themes/bootstrap3/admin_template.php on
line 83
```
  • Loading branch information
Deltik committed Dec 4, 2020
1 parent 729da34 commit ace1ca1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions class2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2112,17 +2112,22 @@ function init_session()
exit;
}

define('ADMIN', $user->isAdmin());
define('ADMINID', $user->getAdminId());
define('ADMINNAME', $user->getAdminName());
define('ADMINPERMS', $user->getAdminPerms());
define('ADMINEMAIL', $user->getAdminEmail());
define('ADMINPWCHANGE', $user->getAdminPwchange());

if (!$user->isUser())
{
define('USER', false);
define('USERID', 0);
define('USERTHEME', false);
define('ADMIN', false);
define('GUEST', true);
define('USERCLASS', '');
define('USEREMAIL', '');
define('USERSIGNATURE', '');
define('ADMINPERMS', false);

if($user->hasSessionError())
{
Expand All @@ -2146,12 +2151,6 @@ function init_session()
define('USERVISITS', $user->get('user_visits'));
define('USERSIGNATURE', $user->get('user_signature'));

define('ADMIN', $user->isAdmin());
define('ADMINID', $user->getAdminId());
define('ADMINNAME', $user->getAdminName());
define('ADMINPERMS', $user->getAdminPerms());
define('ADMINEMAIL', $user->getAdminEmail());
define('ADMINPWCHANGE', $user->getAdminPwchange());
if(ADMIN) // XXX - why for admins only?
{
e107::getRedirect()->setPreviousUrl();
Expand Down

0 comments on commit ace1ca1

Please sign in to comment.