Sprawdzanie zgodności haseł
@return boolean
198021
public function beforeSave()
    {
        if ($this->getElement('password')->getValue() != $this->getElement('confirmPassword')->getValue()) {
            $this->getElement('confirmPassword')->addError('form.register.confirmPassword.error');
            return false;
        }
        //opcja zmiany (w tym przypadku ustawienia nowego) hasłą
        $this->getRecord()->password = \Cms\Model\Auth::getSaltedPasswordHash($this->getElement('password')->getValue());
        //domyślny język
        $this->getRecord()->lang = \App\Registry::$translate->getLocale();
        return true;
    }
1165756
public function afterSave()
    {
        //sprawdzenie istnienia rekordu
        if ($this->hasRecord()) {
            $this->_appendFiles($this->_record->getPk(), $this->getFiles());
        }
        //po uploadzie
        $this->afterUpload();
        return true;
    }
183749
public function canWriteRoutes()
    {
        if (!is_null($this->bCanWriteRoutes)) {
            return $this->bCanWriteRoutes;
        }

        //  First, test if file exists, if it does is it writable?
        if (file_exists(static::ROUTES_DIR . static::ROUTES_FILE)) {

            if (is_writable(static::ROUTES_DIR . static::ROUTES_FILE)) {

                $this->bCanWriteRoutes = true;
                return true;

            } else {

                //  Attempt to chmod the file
                if (@chmod(static::ROUTES_DIR . static::ROUTES_FILE, FILE_WRITE_MODE)) {

                    $this->bCanWriteRoutes = true;
                    return true;

                } else {

                    $this->setError('The route config exists, but is not writable.');
                    $this->bCanWriteRoutes = false;
                    return false;
                }
            }

        } elseif (is_writable(static::ROUTES_DIR)) {

            $this->bCanWriteRoutes = true;
            return true;

        } else {

            //  Attempt to chmod the directory
            if (@chmod(static::ROUTES_DIR, DIR_WRITE_MODE)) {

                $this->bCanWriteRoutes = true;
                return true;

            } else {

                $this->setError('The route directory is not writable. <small>' . static::ROUTES_DIR . '</small>');
                $this->bCanWriteRoutes = false;
                return false;
            }
        }
    }
421801
private function hasToBeReloaded()
    {
        if (!$this->getWurflConfig()->allowReload) {
            return false;
        }

        $state = $this->getPersistenceStorage()->load(self::WURFL_API_STATE);

        return !$this->isStateCurrent($state);
    }
54244
public function canEmbed():bool
    {
        return (
            !Craft::$app->getRequest()->getIsAjax() &&
            !Craft::$app->getRequest()->getIsConsoleRequest() &&
            !Craft::$app->getRequest()->getIsCpRequest() &&
            !Craft::$app->getRequest()->getIsLivePreview() &&
            !Craft::$app->getUser()->getIsGuest() &&
            (Craft::$app->getUser()->getIsAdmin() || Craft::$app->getUser()->checkPermission('accessCp'))
        );
    }
248744
public function _insert()
    {
        //data dodania
        $this->dateAdd = date('Y-m-d H:i:s');
        //adres IP
        $this->ip = \Mmi\App\FrontController::getInstance()->getEnvironment()->remoteAddress;
        $this->active = 1;
        //zapis znanego użytkownika
        if (\App\Registry::$auth->hasIdentity()) {
            $this->cmsAuthId = \App\Registry::$auth->getId();
        }
        //namespace w sesji
        $namespace = new \Mmi\Session\SessionSpace('contact');
        $this->uri = $namespace->referer;
        //wysyłka do maila zdefiniowanego w opcjach
        $option = (new CmsContactOptionQuery)->findPk($this->cmsContactOptionId);
        //niepoprawna opcja
        if (!$option) {
            return false;
        }
        //wysyłka maila
        if ($option->sendTo) {
            \Cms\Model\Mail::pushEmail('admin_cms_contact', $option->sendTo, ['contact' => $this, 'option' => $option], null, $this->email);
        }
        return parent::_insert();
    }
926071
public function isAllowed()
    {
		//jeśli brak dostępu do aktualnej kategorii
		if (!$this->_checkAccess($this->_category->id)) {
			return false;
		}
		//jeśli brak dostępu do któregoś rodzica
		if (!$this->_checkParents()) {
			return false;
		}
        return true;
    }
591785
public function beforeSave()
    {
        //brak loginu lub hasła
        if (!$this->getElement('username')->getValue() || !$this->getElement('password')->getValue()) {
            return false;
        }
        //autoryzacja
        $auth = \App\Registry::$auth;
        \App\Registry::$auth->setIdentity($this->getElement('username')->getValue());
        \App\Registry::$auth->setCredential($this->getElement('password')->getValue());
        //autoryzacja
        if (!\App\Registry::$auth->authenticate()) {
            return false;
        }
        //zapamiętanie jeśli zaznaczona opcja
        if ($this->getElement('remember')) {
            \App\Registry::$auth->rememberMe(\App\Registry::$config->session->authRemember);
        }
        return true;
    }
420810
protected function hasRoutingConfig()
    {
        $has_config = false;

        if ($this->locator) {
            try {
                $routing_file = $this->locator->locate($this->getRoutingFilename());

                if (filesize($routing_file) > 0) {
                    $this->debug(sprintf('hasRoutingConfig: Located Routing File %s', $routing_file));
                    $has_config = true;
                }
            } catch (\InvalidArgumentException $e) {}
        }

        return($has_config);
    }
1243994
public function isVisible()
    {
        //jeśli nie jest aktywna
        if (!$this->active) {
            return false;
        }
        //jeśli status różny od aktywna (bieżąca)
        if ($this->status != \Cms\Orm\CmsCategoryRecord::STATUS_ACTIVE) {
            return false;
        }
        //nie osiągnięto czasu publikacji
        if (null !== $this->dateStart && $this->dateStart > date('Y-m-d H:i:s')) {
            return false;
        }
        //przekroczono czas publikacji
        if (null !== $this->dateEnd && $this->dateEnd < date('Y-m-d H:i:s')) {
            return false;
        }
        return true;
    }
678610
protected function isSaved(): bool
    {
        return $this->filesystem->has($this->path)
            && $this->filesystem->getTimestamp($this->path) > $this->file->getUpdatedAt();
    }
173567
public function hasChanges()
    {
        if ($this->hasChanges) {
            return $this->hasChanges;
        }

        $this->hasChanges = count($this->newResources) > 0 || count($this->deletedResources) > 0 || count($this->updatedResources) > 0;

        return $this->hasChanges;
    }
637052
public function is()
	{
		$this->routes = array(); 

		foreach(func_get_args() as $param)
		{
			if(!is_array($param))
			{
				$this->routes[] = $param;
				continue;
			}

			foreach ($param as $p) 
			{
				$this->routes[] = $p;
			}
		}

		$this->request = Request::path();

		$this->parseRoutes();

		foreach($this->routes as $route)
		{
			if(!Request::is($route))
			{
				continue;
			}

			foreach($this->bad_routes as $bad_route)
			{
				if(str_is($bad_route, $this->request))
				{
					return false;
				}
			}

			return true;		
		}

		return false;
	}
437267
private function _hasPrintableAttributes()
    {
        //iteracja po atrybutach
        foreach ($this->_cmsAttributes as $attribute) {
            //nie jest atrybutem odziedziczonym - czyli będzie wypisany przy renderingu
            if (!$attribute->getJoined('cms_attribute_relation')->isMaterializedInherited()) {
                return true;
            }
        }
        return false;
    }
193905
protected function _createTempFiles()
    {
        //jeśli już są pliki tymczasowe, to wychodzimy
        if ((new \Cms\Orm\CmsFileQuery)
            ->byObject('tmp-' . $this->getUploaderObject(), $this->getUploaderId())
            ->count()) {
            return true;
        }
        $objectId = null;
        if ($this->_form->hasRecord()) {
            $objectId = $this->_form->getRecord()->getPk();
        }
        //tworzymy pliki tymczasowe - linki do oryginałów
        \Cms\Model\File::link($this->getUploaderObject(), $objectId, 'tmp-' . $this->getUploaderObject(), $this->getUploaderId());
        return true;
    }
638077
public function isDirty()
    {
        return true === $this->attributes->areDirty()
            || true === $this->hasOneEmbeds->areDirty()
            || true === $this->hasManyEmbeds->areDirty()
        ;
    }
808190
protected function hasAccess()
    {
        return $this->module->password == Yii::$app->session->get(self::STYLEGUIDE_SESSION_PWNAME, false);
    }