public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
示例#2
0
<?php

include "classes/Pages.php";
include "classes/Translation.php";
$p = new Pages($_GET['page']);
$p->addPage("divider1", "<b>" . $t->tr("Legende") . "</b>-----------------------", "");
$p->addPage("harbour", $t->tr("harbour"), "harbour.php");
$p->addPage("seamark", $t->tr("Seezeichen"), "seamark.php");
$p->addPage("light", $t->tr("Leuchtfeuer"), "light.php");
$p->addPage("lock", $t->tr("BrückenSchleusen"), "lock.php");
$p->addPage("divider2", "<b>" . $t->tr("help") . "</b>------------------------------", "");
$p->addPage("help-josm", $t->tr("help-josm"), "./map_key_pages/help-josm_" . $t->tr("langCode") . ".php");
$p->addPage("help-tidal-scale", $t->tr("help-tidal-scale"), "./map_key_pages/help-tidal-scale_" . $t->tr("langCode") . ".php");
$p->addPage("help-trip-planner", $t->tr("tripPlanner"), "./map_key_pages/help-trip-planner_" . $t->tr("langCode") . ".php");
$p->addPage("help-website", $t->tr("help-website-int"), "./map_key_pages/help-web-integr_" . $t->tr("langCode") . ".php");
$p->addPage("help-online", $t->tr("help-online"), "./map_key_pages/help-online_" . $t->tr("langCode") . ".php");
$p->addPage("divider3", "------------------------------------", "");
$p->addPage("license", $t->tr("license"), "./map_key_pages/license_" . $t->tr("langCode") . ".php");
$p->addPage("about", $t->tr("about"), "./map_key_pages/about_" . $t->tr("langCode") . ".php");
$p->setDefaultPage("harbour");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>OSW -<?php 
echo $t->tr('nautical_chart');
?>
: <?php 
echo $t->tr("Legende");
示例#3
0
	</div>
	
	<div id="container">
	
	<?php 
    if (isset($_POST['addnew'])) {
        echo '<p class="message success">Page Added</p>';
        if (isset($_POST['innav'])) {
            $innav = 'on';
        } else {
            $innav = 'off';
        }
        if (isset($_POST['cfield'])) {
            Pages::addPage($_POST['title'], $_POST['body'], $_POST['template'], $_POST['rewrite'], $innav, $_POST['cfield']);
        } else {
            Pages::addPage($_POST['title'], $_POST['body'], $_POST['template'], $_POST['rewrite'], $innav);
        }
    }
    ?>
	
	<?php 
    if (isset($_POST['update'])) {
        if (isset($_POST['innav'])) {
            $innav = 'on';
        } else {
            $innav = 'off';
        }
        if (isset($_POST['cfield'])) {
            Pages::updatePage($_POST['title'], $_POST['body'], $_POST['rewrite'], $_POST['template'], $innav, $_POST['id'], $_POST['cfield']);
        } else {
            Pages::updatePage($_POST['title'], $_POST['body'], $_POST['rewrite'], $_POST['template'], $innav, $_POST['id']);
示例#4
0
 public function saveAction()
 {
     // We'll need to access the pages database
     $pages = new Pages();
     // Is the form correctly posted ?
     if (!$this->getRequest()->isPost()) {
         throw new Stuffpress_Exception("Invalid request - must be post");
     }
     // Get the source from the request
     $id = (int) $this->_getParam('id');
     $type = (string) $this->_getParam('type');
     // Validate the parameters
     if (!($id >= 0 && in_array($type, Pages::getAvailablePages()))) {
         throw new Stuffpress_Exception("Parameters failed validation");
     }
     // If it is an edit; are we the owner ?
     if ($id > 0) {
         // Does the page exist ?
         if (!($page = $pages->getPage($id))) {
             throw new Stuffpress_Exception("Unknown page with id {$id}");
         }
         // Are we the owner ?
         if ($page['user_id'] != $this->_application->user->id) {
             throw new Stuffpress_AccessDeniedException("Not the owner of page {$id}");
         }
     }
     // Get the page descriptor
     $model = Pages::getModel($type);
     // Validate the form
     $form = $model->getForm();
     if (!$form->isValid($_POST)) {
         return $this->_helper->json->sendJson($form->getErrorArray());
     }
     // Get the form values
     $values = $form->getValues();
     // Proceed and save the values
     $title = @$values['title'];
     // There shoudl always be a title
     // Create the page if it does not exist
     if ($id == 0) {
         $id = $pages->addPage($type, $title);
     } else {
         $pages->setTitle($id, $title);
     }
     // Save the page configuration
     $model->processForm($id, $values);
     // Ok
     return $this->_helper->json->sendJson(false);
 }