protected function OnSuccess()
 {
     File::CreateWithText($this->file, $this->Value('Contents', false));
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportLayoutAction($this->layout, Action::Update());
     Response::Redirect($this->BackLink());
 }
Example #2
0
 protected function BeforeRemove(TableObject $deleteObject)
 {
     foreach (self::$deleteHooks as $deleteHook) {
         $deleteHook->BeforeDelete($deleteObject);
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportContainerAction($deleteObject, Action::Delete());
 }
Example #3
0
 /**
  * Execute delete hooks
  */
 protected function BeforeDelete()
 {
     foreach (self::$deleteHooks as $hook) {
         $hook->BeforeDelete($this->item);
     }
     $logger = new Logger(BackendModule::Guard()->GetUser());
     $logger->ReportAreaAction($this->item, Action::Delete());
 }
Example #4
0
 protected function BeforeRemove(Layout $layout)
 {
     $layoutFile = PathUtil::LayoutTemplate($layout);
     if (File::Exists($layoutFile)) {
         File::Delete($layoutFile);
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportLayoutAction($layout, Action::Delete());
 }
 /**
  * Deletes the container contents related to the container
  * @param Container $item The container to be deleted
  */
 public function BeforeDelete($item)
 {
     $contContainers = ContentContainer::Schema()->FetchByContainer(true, $item);
     $logger = new Logger(BackendModule::Guard()->GetUser());
     foreach ($contContainers as $contContainer) {
         $content = $contContainer->GetContent();
         $provider = ContentTreeUtil::GetTreeProvider($content);
         $tree = new TreeBuilder($provider);
         $logger->ReportContentAction($content, Action::Delete());
         $tree->Remove($provider->ItemByContent($content));
     }
 }
Example #6
0
 /**
  * Saves the group and redirects to the list
  */
 protected function OnSuccess()
 {
     $action = $this->group->Exists() ? Action::Update() : Action::Create();
     $this->group->SetName($this->Value('Name'));
     $this->group->SetCreateContainers((bool) $this->Value('CreateContainers'));
     $this->group->SetCreateLayouts((bool) $this->Value('CreateLayouts'));
     $this->group->SetCreateContainers((bool) $this->Value('CreateContainers'));
     $this->group->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportUserGroupAction($this->group, $action);
     $target = BackendRouter::ModuleUrl(new UsergroupList());
     Response::Redirect($target);
 }
Example #7
0
 /**
  * Remove htaccess page commands before page is deleted
  */
 protected function BeforeDelete()
 {
     foreach (self::$deleteHooks as $hook) {
         $hook->BeforeDelete($this->item);
     }
     $logger = new Logger(BackendModule::Guard()->GetUser());
     $logger->ReportPageAction($this->item, Action::Delete());
     $file = Path::Combine(PHINE_PATH, 'Public/.htaccess');
     if (!File::Exists($file)) {
         return;
     }
     $this->UpdateHtaccess($file);
 }
Example #8
0
 /**
  * Saves the container
  */
 protected function OnSuccess()
 {
     $action = Action::Update();
     if (!$this->container->Exists()) {
         $action = Action::Create();
         $this->container->SetUser(self::Guard()->GetUser());
     }
     $this->container->SetName($this->Value('Name'));
     $this->container->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportContainerAction($this->container, $action);
     if ($this->CanAssignGroup()) {
         $this->SaveRights();
     }
     Response::Redirect(BackendRouter::ModuleUrl(new ContainerList()));
 }
 protected function BeforeDelete()
 {
     $logger = new Logger(BackendModule::Guard()->GetUser());
     $logger->ReportContentAction($this->TreeProvider()->ContentByItem($this->item), Action::Delete());
 }
Example #10
0
 /**
  * Saves the area
  */
 protected function OnSuccess()
 {
     $action = $this->user->Exists() ? Action::Update() : Action::Create();
     $this->user->SetName($this->Value('Name'));
     $this->user->SetEMail($this->Value('EMail'));
     $this->user->SetLanguage(new Language($this->Value('Language')));
     if ($this->CanChangeIsAdmin()) {
         $this->user->SetIsAdmin((bool) $this->Value('IsAdmin'));
     }
     $this->SavePassword();
     $this->user->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportUserAction($this->user, $action);
     Response::Redirect(BackendRouter::ModuleUrl(new UserList()));
 }
Example #11
0
 private function RemoveTemplate()
 {
     $id = Request::PostData('delete');
     if (!$id) {
         return false;
     }
     $idParts = \explode('/', $id);
     $module = $this->RemovalTemplateModule($idParts);
     $templateName = trim($idParts[1]);
     if (!$module || !$templateName) {
         return false;
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportTemplateAction($module->MyType(), $templateName, Action::Delete());
     $folder = PathUtil::ModuleCustomTemplatesFolder($module);
     $template = Path::Combine($folder, Path::AddExtension($templateName, 'phtml'));
     if (File::Exists($template)) {
         File::Delete($template);
     }
     $this->DeleteUsages($module, $templateName);
     return true;
 }
Example #12
0
 /**
  * Saves the template into the given file name
  */
 protected function OnSuccess()
 {
     $newTemplate = $this->Value('Name');
     $action = Action::Create();
     if ($this->template) {
         $action = Action::Update();
         $this->UpdateUsages($newTemplate);
         $oldFile = $this->CalcFile($this->template);
         if (File::Exists($oldFile)) {
             File::Delete($oldFile);
         }
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportTemplateAction($this->module->MyType(), $newTemplate, $action);
     if (!Folder::Exists($this->folder)) {
         Folder::Create($this->folder);
     }
     File::CreateWithText($this->CalcFile($newTemplate), $this->Value('Contents', false));
     Response::Redirect($this->BackLink());
 }
Example #13
0
 /**
  * Saves the page
  */
 protected function OnSuccess()
 {
     $this->page->SetName($this->Value('Name'));
     $this->page->SetUrl($this->Value('Url'));
     $this->page->SetSite($this->site);
     $this->page->SetTitle($this->Value('Title'));
     $this->page->SetDescription($this->Value('Description'));
     $this->page->SetKeywords($this->Value('Keywords'));
     $this->page->SetLayout(new Layout($this->Value('Layout')));
     $this->page->SetMenuAccess($this->Value('MenuAccess'));
     $this->page->SetGuestsOnly((bool) $this->Value('GuestsOnly'));
     $this->page->SetPublish((bool) $this->Value('Publish'));
     $this->page->SetPublishFrom($this->PublishDate('PublishFrom'));
     $this->page->SetPublishTo($this->PublishDate('PublishTo'));
     $relevance = (double) $this->Value('SitemapRelevance') / 10;
     $this->page->SetSitemapRelevance(min(max(0.0, $relevance), 1.0));
     $this->page->SetSitemapChangeFrequency($this->Value('SitemapChangeFrequency'));
     $this->SaveType();
     $action = Action::Update();
     if (!$this->page->Exists()) {
         $action = Action::Create();
         $this->SaveNew();
     } else {
         $this->page->Save();
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportPageAction($this->page, $action);
     if ($this->CanAssignGroup()) {
         $this->SaveRights();
     }
     $this->SaveMemberGroups();
     $this->AdjustHtaccess();
     Response::Redirect($this->BackLink());
 }
Example #14
0
 /**
  * Saves the layout
  */
 protected function OnSuccess()
 {
     $action = Action::Update();
     $isNew = !$this->layout->Exists();
     if ($isNew) {
         $action = Action::Create();
         $this->layout->SetUser(self::Guard()->GetUser());
     }
     $oldFile = $isNew ? '' : PathUtil::LayoutTemplate($this->layout);
     $this->layout->SetName($this->Value('Name'));
     $this->layout->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportLayoutAction($this->layout, $action);
     if ($this->CanAssignGroup()) {
         $this->SaveRights();
     }
     if ($isNew) {
         $this->SaveAreas();
     }
     $this->UpdateFiles($oldFile);
     $args = array('layout' => $this->layout->GetID());
     Response::Redirect(BackendRouter::ModuleUrl(new AreaList(), $args));
 }
Example #15
0
 /**
  * Saves the user
  */
 protected function OnSuccess()
 {
     $action = $this->member->Exists() ? Action::Update() : Action::Create();
     $this->member->SetName($this->Value('Name'));
     $this->member->SetEMail($this->Value('EMail'));
     $this->SetPassword();
     $this->member->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportMemberAction($thos->member, $action);
     if ($this->groupsExist && $this->CanAssignGroup()) {
         $this->SaveGroups();
     }
     Response::Redirect(BackendRouter::ModuleUrl(new MemberList()));
 }
Example #16
0
 /**
  * Saves the site
  */
 protected function OnSuccess()
 {
     $action = Action::Update();
     if (!$this->site->Exists()) {
         $action = Action::Create();
         $this->site->SetUser(self::Guard()->GetUser());
     }
     $this->site->SetName($this->Value('Name'));
     $this->site->SetUrl($this->Value('Url'));
     $this->site->SetLanguage(Language::Schema()->ByID($this->Value('Language')));
     $this->site->SetSitemapActive((bool) $this->Value('SitemapActive'));
     $this->site->SetSitemapCacheLifetime((int) $this->Value('SitemapCacheLifetime'));
     $this->site->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportSiteAction($this->site, $action);
     if ($this->CanAssignGroup()) {
         $this->SaveRights();
     }
     Response::Redirect(BackendRouter::ModuleUrl(new SiteList()));
 }
Example #17
0
 /**
  * Reports a user group action to the log
  * @param Usergroup  $userGroup  The user group being manipulated
  * @param Enums\Action $action The operation executed on the user group 
  */
 function ReportUserGroupAction(Usergroup $userGroup, Enums\Action $action)
 {
     $logItem = $this->CreateLogItem(Enums\ObjectType::UserGroup(), $action);
     if (!$action->Equals(Enums\Action::Delete())) {
         $logUserGroup = new LogUsergroup();
         $logUserGroup->SetLogItem($logItem);
         $logUserGroup->SetUserGroup($userGroup);
         $logUserGroup->Save();
     }
 }
Example #18
0
 protected function BeforeRemove(TableObject $deleteObject)
 {
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportMemberGroupAction($deleteObject, Action::Delete());
 }
Example #19
0
 /**
  * Saves content base properties
  */
 private function SaveContent()
 {
     $this->Content()->SetType($this->FrontendModule()->MyType());
     $this->Content()->SetCssClass($this->Value('CssClass'));
     $this->Content()->SetCssID($this->Value('CssID'));
     $this->Content()->SetTemplate($this->Value('Template'));
     $this->Content()->SetCacheLifetime((int) $this->Value('CacheLifetime'));
     $this->Content()->SetGuestsOnly((bool) $this->Value('GuestsOnly'));
     if ($this->AutoPublish()) {
         $this->Content()->SetPublish(true);
     } else {
         $this->Content()->SetPublish((bool) $this->Value('Publish'));
     }
     $this->Content()->SetPublishFrom($this->PublishDate('PublishFrom'));
     $this->Content()->SetPublishTo($this->PublishDate('PublishTo'));
     $action = Action::Update();
     if (!$this->Content()->Exists()) {
         $action = Action::Create();
         $this->Content()->SetUser(self::Guard()->GetUser());
     }
     $this->Content()->Save();
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportContentAction($this->Content(), $action);
     if ($this->CanAssignGroup()) {
         $this->SaveRights();
     }
     $this->SaveMemberGroups();
     $this->SaveWordings();
 }