Example #1
0
 public function updateAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $this->identity = $auth->getIdentity();
     }
     if (!$this->identity->id) {
         $this->_redirect('/user/login');
     }
     $id = $this->_request->getParam('id');
     $modelBlog = new Page();
     $formBlog = new Form_Source();
     if ($this->getRequest()->isPost()) {
         if ($formBlog->isValid($_POST)) {
             $blogData = $formBlog->getValues();
             $blogData['uid'] = $this->identity->id;
             $blogData['type'] = 'source';
             $blogData['createtime'] = time();
             $tags = str_replace(",", ",", $blogData['tags']);
             unset($blogData['tags']);
             unset($blogData['提交']);
             $updateBlog = $modelBlog->updatePage($id, $blogData);
             if ($updateBlog) {
                 $this->_redirect('source/view/id/' . $updateBlog);
             }
         }
     } else {
         $blog = $modelBlog->getPage($id);
         if ($this->identity->id != $blog->uid) {
             echo "你不是本博客的作者,不能对本博客进行编辑操作。";
             exit;
         }
         $arrBlog = $blog->toArray();
         // 该blog的tags
         $modelTags = new Tags();
         $where = array('blog_id' => $id);
         $tags = $modelTags->getTags($where);
         if (count($tags) > 0) {
             $strTags = '';
             foreach ($tags as $tag) {
                 $strTags .= $tag->tag . ",";
             }
             $strTags = rtrim($strTags, ",");
         }
         $arrBlog['tags'] = $strTags;
         $formBlog->populate($arrBlog);
     }
     $this->view->formBlog = $formBlog;
     //  $this->_helper->cache(array('index', 'view'), array('gook'));
 }
Example #2
0
<?php

/*
 *      addnewpage.php
 *      
 *      Copyright 2010 Nitzan Brumer <nitzan@taz>
 */
$page = new Page();
if (isset($_POST['subdelbanned'])) {
    $title = $_POST['title'];
    $content = $_POST['editor'];
    $spacialChars = array(" ", "/", "\\", "?", ".", ",", "#");
    $slug = str_replace($spacialChars, "-", $_POST['slug']);
    if (!empty($_POST['pageId'])) {
        $result = $page->updatePage($_POST['pageId'], $content, $title, $slug, $status);
    } else {
        $result = $page->addNewPage($content, $title, $slug);
    }
    if (isset($result['qid'])) {
        $page->populatPage($result['qid']);
    }
}
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
    $page = Page::getPageById($pid);
    $oldtitel = $page->title;
    $oldcontent = $page->content;
}
get_top_nav();
//Call the navigation
?>
Example #3
0
<?php

$url = "../index.php?mod=page&act=list";
require_once "../model/Page.php";
$model = new Page();
$page_id = (int) $_POST['page_id'];
$page_title_vi = $model->processData($_POST['page_title_vi']);
$page_title_en = $model->processData($_POST['page_title_en']);
$content_vi = $_POST['content_vi'];
$content_en = $_POST['content_en'];
$tinh_id = (int) $_POST['tinh_id'];
if ($page_id > 0) {
    $model->updatePage($page_id, $page_title_vi, $page_title_en, $content_vi, $content_en, 1, $tinh_id);
    header('location:' . $url);
} else {
    $model->insertPage($page_title_vi, $page_title_en, $content_vi, $content_en, 1, $tinh_id);
    header('location:' . $url);
}
Example #4
0
    $t = false;
} else {
    $t = true;
    if (!$user->str_check($_GET['n'])) {
        redirect("Location: error.php");
    }
    $post = $page->getPage($_GET['n']);
    if (!$post) {
        redirect("Location: error.php");
    }
}
if (isset($_POST['submit'])) {
    if ($_GET['n'] == "new") {
        $id = $page->createPage($_POST['name'], $_POST['title'], $user->getUser(), $_POST['post']);
    } else {
        $id = $page->updatePage($_POST['name'], $_POST['title'], $user->getUser(), $_POST['post']);
    }
    if ($id == false) {
        header("Location: error.php");
    } else {
        header("Location: pedit.php?n=" . $id);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>页面管理 > <?php 
if ($t) {
    echo "页面:" . $post['name'];
Example #5
0
function alterPage()
{
    $page = new Page();
    $page->storeFormValues($_POST);
    $page->updatePage();
}