/** * Check if to use a mobile theme * * @return boolean */ public function isMobileTheme() { if (is_bool($this->isMobileTheme)) { return $this->isMobileTheme; } if (!env('APP_MOBILE_THEME', false)) { return false; } /** * check if really a mobile * check cookie * check session * check user theme to use */ if (env('APP_ENV_MOBILE', false)) { return true; } if ($this->detector()->isMobile()) { $this->isMobileTheme = true; return true; } if ($this->detector()->isTablet()) { $this->isMobileTheme = true; return true; } if (!empty(zbase_cookie($this->mobileVarName))) { $this->isMobileTheme = true; return true; } if (!empty(zbase_session_has($this->mobileVarName)) && !empty(zbase_session_get($this->mobileVarName))) { $this->isMobileTheme = true; return true; } if (!empty(zbase_request_query_input($this->mobileVarName))) { if (!empty(zbase_request_query_input($this->mobileVarName . 'Cookie'))) { zbase_cookie_forever($this->mobileVarName, 1); } $this->isMobileTheme = true; return true; } $this->isMobileTheme = false; return false; }
/** * Check if form has error * @return boolean */ public function hasError() { return zbase_session_has('errorForm' . $this->id()); }
/** * Return the Current Authed User * @return \ */ function zbase_auth_user() { if (!zbase_auth_has()) { return false; } if (\Auth::user()->isAdmin() && !empty(zbase_session_has('_duplexSession'))) { return zbase_user_byId(zbase_session_get('_duplexSession')); } if (!empty(\Auth::user())) { return zbase_user_byid(\Auth::user()->id()); } return false; }