*/
protected $hasValidCookie = false;
+ /**
+ * true if within ACP or WCFSetup
+ * @var boolean
+ */
+ protected $isACP = false;
+
/**
* language id for active user
* @var integer
* @see \wcf\system\SingletonFactory::init()
*/
protected function init() {
+ $this->isACP = (class_exists(WCFACP::class, false) || !PACKAGE_ID);
$this->usersOnlyPermissions = UserGroupOptionCacheBuilder::getInstance()->getData(array(), 'usersOnlyOptions');
}
}
$this->user = new User($this->session->userID);
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$this->virtualSession = ACPSessionVirtual::getExistingSession($sessionID);
}
else {
protected function loadVirtualSession($forceReload = false) {
if ($this->virtualSession === null || $forceReload) {
$this->virtualSession = null;
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$virtualSessionAction = new ACPSessionVirtualAction(array(), 'create', array('data' => array('sessionID' => $this->session->sessionID)));
}
else {
// MySQL error 23000 = unique key
// do not check against the message itself, some weird systems localize them
if ($e->getCode() == 23000) {
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$this->virtualSession = ACPSessionVirtual::getExistingSession($this->session->sessionID);
}
else {
case 0:
// delete virtual session
if ($this->virtualSession) {
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$virtualSessionEditor = new ACPSessionVirtualEditor($this->virtualSession);
}
else {
$virtualSessionEditor->delete();
}
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$sessionCount = ACPSessionVirtual::countVirtualSessions($this->session->sessionID);
}
else {
$sessionEditor->update($data);
if ($this->virtualSession instanceof ACPSessionVirtual) {
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$virtualSessionEditor = new ACPSessionVirtualEditor($this->virtualSession);
}
else {
));
if ($this->virtualSession instanceof ACPSessionVirtual) {
- if (class_exists(WCFACP::class, false)) {
+ if ($this->isACP) {
$virtualSessionEditor = new ACPSessionVirtualEditor($this->virtualSession);
}
else {
self::resetSessions(array($this->user->userID));
// update last activity time
- if (!class_exists(WCFACP::class, false)) {
+ if (!$this->isACP) {
$editor = new UserEditor($this->user);
$editor->update(array('lastActivityTime' => TIME_NOW));
}