1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* RooCMS - Open Source Free Content Managment System
|
4
|
|
|
* @copyright © 2010-2021 alexandr Belov aka alex Roosso. All rights reserved.
|
5
|
|
|
* @author alex Roosso <[email protected]>
|
6
|
|
|
* @link http://www.roocms.com
|
7
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
8
|
|
|
*
|
9
|
|
|
* You should have received a copy of the GNU General Public License v3
|
10
|
|
|
* along with this program. If not, see http://www.gnu.org/licenses/
|
11
|
|
|
*/
|
12
|
|
|
|
13
|
|
|
|
14
|
|
|
//#########################################################
|
15
|
|
|
// Anti Hack
|
16
|
|
|
//---------------------------------------------------------
|
17
|
|
|
if(!defined('RooCMS') || !defined('ACP')) {
|
18
|
|
|
die('Access Denied');
|
19
|
|
|
}
|
20
|
|
|
//#########################################################
|
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/**
|
24
|
|
|
* Class ACP_Pages_Story
|
25
|
|
|
*/
|
26
|
|
|
class ACP_Pages_Story {
|
27
|
|
|
|
28
|
|
|
/**
|
29
|
|
|
* Edit content
|
30
|
|
|
*
|
31
|
|
|
* @param int $sid - Structure id
|
32
|
|
|
*/
|
33
|
|
|
public function edit($sid) {
|
34
|
|
|
|
35
|
|
|
global $db, $files, $img, $parse, $tpl, $smarty;
|
36
|
|
|
|
37
|
|
|
# download structure data
|
38
|
|
|
$q = $db->query("SELECT id AS sid, title, alias, meta_description, meta_keywords FROM ".STRUCTURE_TABLE." WHERE id='".$sid."'");
|
39
|
|
|
$data = $db->fetch_assoc($q);
|
40
|
|
|
|
41
|
|
|
|
42
|
|
|
# download content
|
43
|
|
|
$datacontent = [];
|
44
|
|
|
$q = $db->query("SELECT id, sid, sort, content, date_modified FROM ".PAGES_STORY_TABLE." WHERE sid='".$sid."' ORDER BY sort ASC, sid ASC");
|
45
|
|
|
while($row = $db->fetch_assoc($q)) {
|
46
|
|
|
$data['lm'] = $parse->date->unix_to_rus($row['date_modified'], true, true, true);
|
47
|
|
|
$datacontent[] = $row;
|
48
|
|
|
|
49
|
|
|
|
50
|
|
|
# download attached images
|
51
|
|
|
$attachimg = $img->load_images("page_story_id=".$row['id']);
|
52
|
|
|
$smarty->assign("attachimg", $attachimg);
|
53
|
|
|
|
54
|
|
|
# show attached images
|
55
|
|
|
$attachedimages[$row['id']] = $tpl->load_template("attached_images", true);
|
56
|
|
|
|
57
|
|
|
|
58
|
|
|
# download attached files
|
59
|
|
|
$attachfile = $files->load_files("page_story_id=".$row['id']);
|
60
|
|
|
$smarty->assign("attachfile", $attachfile);
|
61
|
|
|
|
62
|
|
|
# show attached files
|
63
|
|
|
$attachedfiles[$row['id']] = $tpl->load_template("attached_files", true);
|
64
|
|
|
}
|
65
|
|
|
|
66
|
|
|
$smarty->assign("data", $data);
|
67
|
|
|
$smarty->assign("datacontent", $datacontent);
|
68
|
|
|
|
69
|
|
|
# show attached images and files
|
70
|
|
|
$smarty->assign("attachedimages", $attachedimages);
|
|
|
|
|
71
|
|
|
$smarty->assign("attachedfiles", $attachedfiles);
|
|
|
|
|
72
|
|
|
|
73
|
|
|
# show upload files & images form
|
74
|
|
|
$tpl->load_image_upload_tpl("imagesupload");
|
75
|
|
|
$tpl->load_files_upload_tpl("filesupload");
|
76
|
|
|
|
77
|
|
|
$content = $tpl->load_template("pages_edit_story", true);
|
78
|
|
|
$smarty->assign("content", $content);
|
79
|
|
|
}
|
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/**
|
83
|
|
|
* Update page content
|
84
|
|
|
*
|
85
|
|
|
* @param mixed $data - this object data params
|
86
|
|
|
*/
|
87
|
|
|
public function update($data) {
|
|
|
|
|
88
|
|
|
|
89
|
|
|
|
90
|
|
|
}
|
91
|
|
|
|
92
|
|
|
|
93
|
|
|
/**
|
94
|
|
|
* Remove page
|
95
|
|
|
*
|
96
|
|
|
* @param int $sid - Structure id
|
97
|
|
|
*/
|
98
|
|
|
public function delete($sid) {
|
|
|
|
|
99
|
|
|
|
100
|
|
|
|
101
|
|
|
}
|
102
|
|
|
}
|
103
|
|
|
|