private function OnSuccess() { $member = $this->confirmer->GetMember(); $member->SetConfirmed(Date::Now()); if ($this->confirm->GetActivate()) { $member->SetActive(true); } $member->Save(); $this->AddGroups($member); if ($this->confirm->GetSuccessUrl()) { Response::Redirect(FrontendRouter::Url($this->confirm->GetSuccessUrl())); } }
/** * * @param boolean $publish A flag to activate/deactivate publishing generally * @param Date $from The from date; null denoting no restriction in start date * @param Date $to The to date; null denoting no restriction in end date * @return boolean Returns true if publish is true and now is between from and to date */ public static function IsPublishedNow($publish, Date $from = null, Date $to = null) { if (!$publish) { return false; } $now = Date::Now(); if ($from && $from->IsAfter($now)) { return false; } if ($to && $to->IsBefore($now)) { return false; } return true; }
/** * Calculates if the cache content needs to be used * @return boolean */ function MustUseCache() { if ($this->cacheLifetime == 0) { return false; } if (!File::Exists($this->file)) { return false; } $now = Date::Now(); $lastMod = File::GetLastModified($this->file); if ($now->TimeStamp() - $lastMod->TimeStamp() < $this->cacheLifetime) { return true; } return false; }
protected function OnSuccess() { $this->member = new Member(); $this->member->SetEMail($this->Value('EMail')); $this->member->SetName($this->Value('Name')); $password = $this->Value('Password'); $salt = String::Start(md5(uniqid(microtime())), 8); $pwHash = hash('sha256', $password . $salt); $this->member->SetPassword($pwHash); $this->member->SetPasswordSalt($salt); $this->member->SetCreated(Date::Now()); $this->member->Save(); $this->SendConfirmMail(); if ($this->register->GetNextUrl()) { Response::Redirect(FrontendRouter::Url($this->register->GetNextUrl())); } }
/** * Deletes log items older then the given amount of days * @param int $days The days */ private function DeleteOldLogItems() { $days = SettingsProxy::Singleton()->Settings()->GetLogLifetime(); $deleteBefore = Date::Now(); $deleteBefore->AddDays(-$days); $tblLogItem = LogItem::Schema()->Table(); $sql = Access::SqlBuilder(); $where = $sql->LT($tblLogItem->Field('Changed'), $sql->Value($deleteBefore)); LogItem::Schema()->Delete($where); }
/** * Updates the version of the bundle * @param string $bundle The bundle name */ private function UpdateBundleVersion($bundle) { $instBundle = InstalledBundle::Schema()->ByBundle($bundle); if (!$instBundle) { $instBundle = new InstalledBundle(); } $instBundle->SetVersion($this->installedBundles[$bundle]); $instBundle->SetBundle($bundle); $instBundle->SetLastUpdate(Date::Now()); $instBundle->Save(); }
/** * True if cache file contents must be used * @param strinh $cacheFile The cache file * @return boolean */ private function MustUseCache($cacheFile) { $seconds = $this->content->GetCacheLifetime(); if ($seconds == 0) { return false; } if (!File::Exists($cacheFile)) { return false; } $now = Date::Now(); $lastMod = File::GetLastModified($cacheFile); if ($now->TimeStamp() - $lastMod->TimeStamp() < $seconds) { return true; } return false; }