Returns true if the user is editing a frontpage.
@return bool
554925
public function is_editing_the_frontpage() {
        // There are some conditions to check related to contexts.
        $ctxconditions = $this->page->context->contextlevel == CONTEXT_COURSE &&
            $this->page->context->instanceid == get_site()->id;
        $issiteindex = (strpos($this->page->pagetype, 'site-index') === 0);
        // So now we can be 100% sure if edition is happening at frontpage.
        return ($ctxconditions && $issiteindex);
    }
912692
public function isPublished() {

		$user = Yii::$app->core->getUser();

		if( isset( $user ) ) {

			// Always published for owner
			if( $this->createdBy == $user->id ) {

				return true;
			}

			// TODO: Add code for secured visibility with password match

			// Visible to logged in users in strictly protected mode
			if( $this->isPublic() && $this->isVisibilityProtected() ) {

				return true;
			}
		}

		// Status(Active or Frozen) with public visibility
		return $this->isPublic() && $this->isVisibilityPublic( false );
	}
702570
public function isDeletable()
    {
        $user = $this->getAuthenticatedUser();

        if ( empty( $user ) )
        {
            return false;
        }

        $root = $this->getRootParagraph();

        return ! empty( $root->editUsers ) && in_array( $user->id, $root->editUsers )
            || ! empty( $root->editGroups ) && in_array( $user->groupId, $root->editGroups )
            || $this->getServiceLocator()
                    ->get( 'Grid\User\Model\Permissions\Model' )
                    ->isAllowed( $root, $this->id == $this->rootId ? 'delete' : 'edit' );
    }
644064
public function loggedIn(): bool
    {
        $session = $this->getSession();
        if (! $session->isStarted()) {
            $session->start();
            // If there isn't a session started the user can't be logged in.
            return false;
        }

        $page = $session->getPage();

        // Look for a selector to determine if the user is logged in.
        try {
            // Search for the body element.
            $body_element = $page->find('css', 'body');

            // If the page doesn't have a body element the user is not logged in.
            if (null === $body_element) {
                return false;
            }

            // The user is logged in if:
            $is_logged_in = (
                // The body has a logged-in class (front-end).
                $body_element->hasClass('logged-in') ||
                // The body has a wp-admin class (dashboard)
                $body_element->hasClass('wp-admin')
            );
            return $is_logged_in;
        } catch (DriverException $e) {
            // This may fail if the user has not loaded any site yet.
        }

        return false;
    }
645890
public static function checkBrowserOmniWeb()
    {
        if (stripos(self::$userAgentString, 'omniweb') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'omniweb'));
            $aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : '');
            self::$browser->setVersion($aversion[0]);
            self::$browser->setName(Browser::OMNIWEB);

            return true;
        }

        return false;
    }
351839
public function checkPageSubjectInUrl() {
        if ($this->checkPageSubjectDefined()) {

            $url_segment             = $this->owner->URLSegment;
            $pagesubject_url_segment = $this->owner->generateURLSegment($this->owner->SEOPageSubject);

            if (preg_match('/' . preg_quote($pagesubject_url_segment, '/') . '/i', $url_segment)) {
                return true;
            }
            else {
                return false;
            }
        }
        return false;

    }
1011518
public static function canEdit()
    {
		// Get current user
		$user = eZUser::currentUser();
		$user_has_access = $user->hasAccessTo( 'userpaex', 'editpaex' );

		if ( $user_has_access['accessWord'] == "yes" )
            return true;

        return false;
    }
1168884
public function checkPageSubjectInTitle() {
        if ($this->checkPageSubjectDefined()) {
            if (preg_match('/' . preg_quote($this->owner->SEOPageSubject, '/') . '/i', $this->owner->MetaTitle)) {
                return true;
            } elseif (preg_match('/' . preg_quote($this->owner->SEOPageSubject, '/') . '/i', $this->owner->Title)) {
                return true;
            } else {
                return false;
            }
        }
        return false;
    }
1013473
public function is_visible() {
        global $USER;

        $context = ($this->userid > 0) ? context_user::instance($this->userid) : context_system::instance();

        switch ($this->field->visible) {
            case PROFILE_VISIBLE_ALL:
                return true;
            case PROFILE_VISIBLE_PRIVATE:
                if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
                    return true;
                } else if ($this->userid == $USER->id) {
                    return true;
                } else {
                    return has_capability('moodle/user:viewalldetails', $context);
                }
            default:
                return has_capability('moodle/user:viewalldetails', $context);
        }
    }
1042337
function is_activation_page() {
            if ( $this->_menu->is_main_settings_page() ) {
                return true;
            }

            if ( ! $this->is_activation_mode() ) {
                return false;
            }

            // Check if current page is matching the activation page.
            return $this->is_matching_url( $this->get_activation_url() );
        }
677524
public function isHeadless()
    {
        if ($this->hasOption(self::OPTION_HEADLESS_PAGE)) {
            return $this->getOption(self::OPTION_HEADLESS_PAGE);
        }

        $isHeadless = $this->getIsHeadLessFromThemeDetailsProviders();
        if (empty($isHeadless)) {
            $isHeadless = false;
        }

        return $isHeadless;
    }
598211
protected function isAllowed()
    {
        /** @var  \Arcanesoft\Contracts\Auth\Models\User  $user */
        if (is_null($user = auth()->user()))
            return false;

        return $user->isAdmin() || $user->isModerator();
    }
1194595
static public function isEditor($request)
    {
        if (! User_Precondition::isLogedIn($request)){
            return false;
        }
        if ($request->user->hasPerm('tenant.owner') || $request->user->hasPerm('cms.editor')) {
            return true;
        }
        return false;
    }
793347
public function edit() {
		HtmlEditorField::include_js();
//		Requirements::javascript('simplewiki/javascript/sslinks/editor_plugin_src.js');

		$existing = $this->getEditingLocks($this->data(), true);
		// oops, we've somehow got here even though we shouldn't have
		if ($existing && $existing['user'] != Member::currentUser()->Email) {
			return $this->redirect($this->data()->Link());
		}

		if (!$this->data()->canEdit()) {
			return Security::permissionFailure($this);
		}

		$this->form = $this->EditForm();

		// check who's editing and whether or not we should bail out
		return $this->renderWith(array('WikiPage', 'Page'));
	}
4078
public function isCurrent()
    {
        $currentPage = Director::get_current_page();
        if ($currentPage instanceof ContentController) {
            $currentPage = $currentPage->data();
        }
        if ($currentPage instanceof SiteTree) {
            return $currentPage === $this || $currentPage->ID === $this->ID;
        }
        return false;
    }
1115178
public function isactive() {
        global $PAGE;

        if ($this->is_section()) {
            $active = $PAGE->navigation->find_active_node();
            while ($active = $active->parent) {
                if ($active->key == $this->key && $active->type == $this->type) {
                    return true;
                }
            }
        }
        return $this->isactive;
    }
1089948
protected function checkBrowserOmniWeb()
    {
        if (stripos($this->_agent, 'omniweb') !== false) {
            $aresult = explode('/', stristr($this->_agent, 'omniweb'));
            $aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : '');
            $this->setVersion($aversion[0]);
            $this->setBrowser(self::BROWSER_OMNIWEB);
            return true;
        }
        return false;
    }