-
Notifications
You must be signed in to change notification settings - Fork 204
/
add.php
39 lines (35 loc) · 1.13 KB
/
add.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
if (!defined('FLUX_ROOT')) exit;
$this->loginRequired();
$title = Flux::message('CMSPageAddTitle');
$pages = Flux::config('FluxTables.CMSPagesTable');
$title = trim($params->get('page_title'));
$path = trim($params->get('page_path'));
$body = trim($params->get('page_body'));
$tinymce_key = Flux::config('TinyMCEKey');
if(count($_POST))
{
if($page_title === '') {
$errorMessage = Flux::Message('CMSPageTitleError');
}
elseif($page_path === '') {
$errorMessage = Flux::Message('CMSPagePathError');
}
elseif($page_body === '') {
$errorMessage = Flux::Message('CMSPageBodyError');
}
else {
$sql = "INSERT INTO {$server->loginDatabase}.$pages (title, path, body, modified)";
$sql .= "VALUES (?, ?, ?, NOW())";
$sth = $server->connection->getStatement($sql);
$sth->execute(array($title, $path, $body));
$session->setMessageData(Flux::message('CMSPagesAdded'));
if ($auth->actionAllowed('pages', 'index')) {
$this->redirect($this->url('pages','index'));
}
else {
$this->redirect();
}
}
}
?>