public function view($message = null, $error = null)
 {
     Loader::model('single_page');
     $this->set('generated', SinglePage::getList());
     if ($message && !$error) {
         $this->set('message', $message);
     } else {
         if ($message) {
             $this->error->add($message);
         }
     }
     if ($this->isPost()) {
         if ($this->token->validate('add_single_page')) {
             $pathToNode = SinglePage::getPathToNode($this->post('pageURL'), false);
             $path = SinglePage::sanitizePath($this->post('pageURL'));
             if (strlen($pathToNode) > 0) {
                 // now we check to see if this is already added
                 $pc = Page::getByPath('/' . $path, 'RECENT');
                 if ($pc->getError() == COLLECTION_NOT_FOUND) {
                     SinglePage::add($this->post('pageURL'));
                     $this->redirect('/dashboard/pages/single', t('Page Successfully Added.'));
                 } else {
                     $this->redirect('/dashboard/pages/single', t("That page has already been added."), 1);
                 }
             } else {
                 $this->redirect('/dashboard/pages/single', t('That specified path doesn\'t appear to be a valid static page.'), 1);
             }
         }
         $this->redirect('/dashboard/pages/single', $this->token->getErrorMessage(), 1);
     }
 }
예제 #2
0
 public function view()
 {
     $this->set('generated', SinglePage::getList());
     if ($this->isPost()) {
         if ($this->token->validate('add_single_page')) {
             $pathToNode = SinglePage::getPathToNode($this->post('pageURL'), false);
             $path = SinglePage::sanitizePath($this->post('pageURL'));
             if (strlen($pathToNode) > 0) {
                 // now we check to see if this is already added
                 $pc = Page::getByPath('/' . $path, 'RECENT');
                 if ($pc->getError() == COLLECTION_NOT_FOUND) {
                     SinglePage::add($path);
                     $this->redirect('/dashboard/pages/single', 'single_page_added');
                 } else {
                     $this->error->add(t("That page has already been added."));
                 }
             } else {
                 $this->error->add(t('That specified path doesn\'t appear to be a valid static page.'));
             }
         }
     }
 }
예제 #3
0
            // now we check to see if this is already added
            $pc = Page::getByPath('/' . $path, 'RECENT');
            if ($pc->getError() == COLLECTION_NOT_FOUND) {
                SinglePage::add($_POST['pageURL']);
                $this->controller->redirect('/dashboard/pages/single?page_created=1');
            } else {
                $error[] = t("That page has already been added.");
            }
        } else {
            $error[] = t('That specified path doesn\'t appear to be a valid static page.');
        }
    } else {
        $error[] = $valt->getErrorMessage();
    }
}
$generated = SinglePage::getList();
if ($_REQUEST['refreshed']) {
    $message = t('Page refreshed.');
} else {
    if ($_REQUEST['page_created']) {
        $message = t('Static page created.');
    }
}
?>
<h1><span><?php 
echo t('Single Pages');
?>
</span></h1>
	<div class="ccm-dashboard-inner">
	
	<div style="margin:0px; padding:0px; width:100%; height:auto" >