Passed
Push — master ( f484b2...53f74f )
by alexandr
06:57
created
roocms/acp/feeds.php 2 patches
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -15,163 +15,163 @@
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS') || !defined('ACP')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
22 22
 
23 23
 class ACP_Feeds {
24 24
 
25
-	# objects
26
-	private $engine;	# ... object global structure operations
27
-	private $unit;		# ... object for works content pages
28
-
29
-
30
-
31
-	/**
32
-	 * Show must go on ...
33
-	 */
34
-	public function __construct() {
35
-
36
-		global $tpl;
37
-
38
-		require_once _CLASS."/class_structure.php";
39
-		$this->engine = new Structure();
40
-
41
-		# initialise
42
-		$this->init();
43
-
44
-		# output
45
-		$tpl->load_template("feeds");
46
-	}
47
-
48
-
49
-	/**
50
-	 * init action
51
-	 */
52
-	private function init() {
53
-
54
-		global $roocms, $get, $post, $db;
55
-
56
-		# set object for works content
57
-		if(isset($get->_page) && array_key_exists($this->engine->page_type, $this->engine->content_types)) {
58
-
59
-			# init codeengine
60
-			switch($this->engine->page_type) {
61
-				case 'feed':
62
-					require_once _ROOCMS."/acp/feeds_feed.php";
63
-					$this->unit = new ACP_Feeds_Feed($this->get_settings());
64
-					break;
65
-			}
66
-
67
-			# action
68
-			switch($roocms->part) {
69
-				# edit feed option
70
-				case 'settings':
71
-					$this->unit->settings();
72
-					break;
73
-
74
-				# update feed option
75
-				case 'update_settings':
76
-					$this->unit->update_settings();
77
-					break;
78
-
79
-				# cp feed items
80
-				case 'control':
81
-					$this->unit->control();
82
-					break;
83
-
84
-				# create new item in feed
85
-				case 'create_item':
86
-					$this->unit->create_item();
87
-					break;
88
-
89
-
90
-				# modify
91
-				case 'edit_item':
92
-				case 'update_item':
93
-				case 'migrate_item':
94
-				case 'status_on_item':
95
-				case 'status_off_item':
96
-				case 'delete_item':
97
-					if($db->check_id($get->_item, PAGES_FEED_TABLE)) {
98
-						switch($roocms->part) {
99
-							# edit item in feed
100
-							case 'edit_item':
101
-								$this->unit->edit_item($get->_item);
102
-								break;
103
-
104
-							# update item in feed
105
-							case 'update_item':
106
-								if(isset($post->update_item)) {
107
-									$this->unit->update_item($get->_item);
108
-								}
109
-								goback();
110
-								break;
111
-
112
-							# migrate item in feeds
113
-							case 'migrate_item':
114
-								$this->unit->migrate_item($get->_item);
115
-								break;
116
-
117
-							# update status item in feed to on
118
-							case 'status_on_item':
119
-								$this->unit->change_item_status($get->_item, 1);
120
-								break;
121
-
122
-							# update status item in feed to off
123
-							case 'status_off_item':
124
-								$this->unit->change_item_status($get->_item, 0);
125
-								break;
126
-
127
-							# delete item from feed
128
-							case 'delete_item':
129
-								$this->unit->delete_item($get->_item);
130
-								break;
131
-						}
132
-
133
-					}
134
-					else {
135
-						goback();
136
-					}
137
-					break;
138
-
139
-				default:
140
-					go(CP."?act=structure");
141
-					break;
142
-			}
143
-		}
144
-		else {
145
-			# go
146
-			go(CP."?act=structure");
147
-		}
148
-	}
149
-
150
-
151
-	/**
152
-	 * get array with feed settings
153
-	 *
154
-	 * @return array<integer|string|boolean|array>
155
-	 */
156
-	private function get_settings() {
157
-
158
-		$setting = array(
159
-			'id'                 => $this->engine->page_sid,
160
-			'alias'              => $this->engine->page_alias,
161
-			'title'              => $this->engine->page_title,
162
-			'rss'                => $this->engine->page_rss,
163
-			'show_child_feeds'   => $this->engine->page_show_child_feeds,
164
-			'items_per_page'     => $this->engine->page_items_per_page,
165
-			'items_sorting'      => $this->engine->page_items_sorting,
166
-			'thumb_img_width'    => $this->engine->page_thumb_img_width,
167
-			'thumb_img_height'   => $this->engine->page_thumb_img_height,
168
-			'append_info_before' => $this->engine->page_append_info_before,
169
-			'append_info_after'  => $this->engine->page_append_info_after,
170
-			'subfeeds'           => $this->engine->load_tree($this->engine->page_sid)
171
-		);
172
-
173
-		return $setting;
174
-	}
25
+        # objects
26
+        private $engine;	# ... object global structure operations
27
+        private $unit;		# ... object for works content pages
28
+
29
+
30
+
31
+        /**
32
+         * Show must go on ...
33
+         */
34
+        public function __construct() {
35
+
36
+                global $tpl;
37
+
38
+                require_once _CLASS."/class_structure.php";
39
+                $this->engine = new Structure();
40
+
41
+                # initialise
42
+                $this->init();
43
+
44
+                # output
45
+                $tpl->load_template("feeds");
46
+        }
47
+
48
+
49
+        /**
50
+         * init action
51
+         */
52
+        private function init() {
53
+
54
+                global $roocms, $get, $post, $db;
55
+
56
+                # set object for works content
57
+                if(isset($get->_page) && array_key_exists($this->engine->page_type, $this->engine->content_types)) {
58
+
59
+                        # init codeengine
60
+                        switch($this->engine->page_type) {
61
+                                case 'feed':
62
+                                        require_once _ROOCMS."/acp/feeds_feed.php";
63
+                                        $this->unit = new ACP_Feeds_Feed($this->get_settings());
64
+                                        break;
65
+                        }
66
+
67
+                        # action
68
+                        switch($roocms->part) {
69
+                                # edit feed option
70
+                                case 'settings':
71
+                                        $this->unit->settings();
72
+                                        break;
73
+
74
+                                # update feed option
75
+                                case 'update_settings':
76
+                                        $this->unit->update_settings();
77
+                                        break;
78
+
79
+                                # cp feed items
80
+                                case 'control':
81
+                                        $this->unit->control();
82
+                                        break;
83
+
84
+                                # create new item in feed
85
+                                case 'create_item':
86
+                                        $this->unit->create_item();
87
+                                        break;
88
+
89
+
90
+                                # modify
91
+                                case 'edit_item':
92
+                                case 'update_item':
93
+                                case 'migrate_item':
94
+                                case 'status_on_item':
95
+                                case 'status_off_item':
96
+                                case 'delete_item':
97
+                                        if($db->check_id($get->_item, PAGES_FEED_TABLE)) {
98
+                                                switch($roocms->part) {
99
+                                                        # edit item in feed
100
+                                                        case 'edit_item':
101
+                                                                $this->unit->edit_item($get->_item);
102
+                                                                break;
103
+
104
+                                                        # update item in feed
105
+                                                        case 'update_item':
106
+                                                                if(isset($post->update_item)) {
107
+                                                                        $this->unit->update_item($get->_item);
108
+                                                                }
109
+                                                                goback();
110
+                                                                break;
111
+
112
+                                                        # migrate item in feeds
113
+                                                        case 'migrate_item':
114
+                                                                $this->unit->migrate_item($get->_item);
115
+                                                                break;
116
+
117
+                                                        # update status item in feed to on
118
+                                                        case 'status_on_item':
119
+                                                                $this->unit->change_item_status($get->_item, 1);
120
+                                                                break;
121
+
122
+                                                        # update status item in feed to off
123
+                                                        case 'status_off_item':
124
+                                                                $this->unit->change_item_status($get->_item, 0);
125
+                                                                break;
126
+
127
+                                                        # delete item from feed
128
+                                                        case 'delete_item':
129
+                                                                $this->unit->delete_item($get->_item);
130
+                                                                break;
131
+                                                }
132
+
133
+                                        }
134
+                                        else {
135
+                                                goback();
136
+                                        }
137
+                                        break;
138
+
139
+                                default:
140
+                                        go(CP."?act=structure");
141
+                                        break;
142
+                        }
143
+                }
144
+                else {
145
+                        # go
146
+                        go(CP."?act=structure");
147
+                }
148
+        }
149
+
150
+
151
+        /**
152
+         * get array with feed settings
153
+         *
154
+         * @return array<integer|string|boolean|array>
155
+         */
156
+        private function get_settings() {
157
+
158
+                $setting = array(
159
+                        'id'                 => $this->engine->page_sid,
160
+                        'alias'              => $this->engine->page_alias,
161
+                        'title'              => $this->engine->page_title,
162
+                        'rss'                => $this->engine->page_rss,
163
+                        'show_child_feeds'   => $this->engine->page_show_child_feeds,
164
+                        'items_per_page'     => $this->engine->page_items_per_page,
165
+                        'items_sorting'      => $this->engine->page_items_sorting,
166
+                        'thumb_img_width'    => $this->engine->page_thumb_img_width,
167
+                        'thumb_img_height'   => $this->engine->page_thumb_img_height,
168
+                        'append_info_before' => $this->engine->page_append_info_before,
169
+                        'append_info_after'  => $this->engine->page_append_info_after,
170
+                        'subfeeds'           => $this->engine->load_tree($this->engine->page_sid)
171
+                );
172
+
173
+                return $setting;
174
+        }
175 175
 }
176 176
 
177 177
 /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 //#########################################################
21 21
 
22 22
 
23
-class ACP_Feeds {
23
+class ACP_Feeds {
24 24
 
25 25
 	# objects
26 26
 	private $engine;	# ... object global structure operations
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * Show must go on ...
33 33
 	 */
34
-	public function __construct() {
34
+	public function __construct() {
35 35
 
36 36
 		global $tpl;
37 37
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * init action
51 51
 	 */
52
-	private function init() {
52
+	private function init() {
53 53
 
54 54
 		global $roocms, $get, $post, $db;
55 55
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 								break;
131 131
 						}
132 132
 
133
-					}
133
+					}
134 134
 					else {
135 135
 						goback();
136 136
 					}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 					go(CP."?act=structure");
141 141
 					break;
142 142
 			}
143
-		}
143
+		}
144 144
 		else {
145 145
 			# go
146 146
 			go(CP."?act=structure");
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @return array<integer|string|boolean|array>
155 155
 	 */
156
-	private function get_settings() {
156
+	private function get_settings() {
157 157
 
158 158
 		$setting = array(
159 159
 			'id'                 => $this->engine->page_sid,
Please login to merge, or discard this patch.
roocms/acp/pages.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS') || !defined('ACP')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,64 +25,64 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class ACP_Pages {
27 27
 
28
-	# vars
29
-	private $engine;	# [object] global structure operations
30
-	private $unit;		# [object] for works content pages
28
+        # vars
29
+        private $engine;	# [object] global structure operations
30
+        private $unit;		# [object] for works content pages
31 31
 
32 32
 
33 33
 
34
-	/**
35
-	* Show must go on
36
-	*
37
-	*/
38
-	public function __construct() {
34
+        /**
35
+         * Show must go on
36
+         *
37
+         */
38
+        public function __construct() {
39 39
 
40
-		global $roocms, $get, $post, $tpl;
40
+                global $roocms, $get, $post, $tpl;
41 41
 
42
-		require_once _CLASS."/class_structure.php";
43
-		$this->engine = new Structure();
42
+                require_once _CLASS."/class_structure.php";
43
+                $this->engine = new Structure();
44 44
 
45 45
 
46
-		# set object for works content
47
-		if(isset($get->_page)) {
48
-			switch($this->engine->page_type) {
49
-				case 'html':
50
-					require_once _ROOCMS."/acp/pages_html.php";
51
-					$this->unit = new ACP_Pages_HTML;
52
-					break;
46
+                # set object for works content
47
+                if(isset($get->_page)) {
48
+                        switch($this->engine->page_type) {
49
+                                case 'html':
50
+                                        require_once _ROOCMS."/acp/pages_html.php";
51
+                                        $this->unit = new ACP_Pages_HTML;
52
+                                        break;
53 53
 
54
-				case 'php':
55
-					require_once _ROOCMS."/acp/pages_php.php";
56
-					$this->unit = new ACP_Pages_PHP;
57
-					break;
58
-			}
59
-		}
54
+                                case 'php':
55
+                                        require_once _ROOCMS."/acp/pages_php.php";
56
+                                        $this->unit = new ACP_Pages_PHP;
57
+                                        break;
58
+                        }
59
+                }
60 60
 
61
-		# action
62
-		switch($roocms->part) {
61
+                # action
62
+                switch($roocms->part) {
63 63
 
64
-			case 'edit':
65
-				$this->unit->edit($this->engine->page_sid);
66
-				break;
64
+                        case 'edit':
65
+                                $this->unit->edit($this->engine->page_sid);
66
+                                break;
67 67
 
68
-			case 'update':
69
-				if(isset($post->update_page)) {
70
-					$this->unit->update($this->engine);
71
-				}
72
-				else {
73
-					goback();
74
-				}
75
-				break;
68
+                        case 'update':
69
+                                if(isset($post->update_page)) {
70
+                                        $this->unit->update($this->engine);
71
+                                }
72
+                                else {
73
+                                        goback();
74
+                                }
75
+                                break;
76 76
 
77
-			default:
78
-				go(CP."?act=structure");
79
-				break;
80
-		}
77
+                        default:
78
+                                go(CP."?act=structure");
79
+                                break;
80
+                }
81 81
 
82 82
 
83
-		# output
84
-		$tpl->load_template("pages");
85
-	}
83
+                # output
84
+                $tpl->load_template("pages");
85
+        }
86 86
 }
87 87
 
88 88
 /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 class ACP_Pages {
27 27
 
28 28
 	# vars
29
-	private $engine;	# [object] global structure operations
30
-	private $unit;		# [object] for works content pages
29
+	private $engine; # [object] global structure operations
30
+	private $unit; # [object] for works content pages
31 31
 
32 32
 
33 33
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		# set object for works content
47 47
 		if(isset($get->_page)) {
48
-			switch($this->engine->page_type) {
48
+			switch ($this->engine->page_type) {
49 49
 				case 'html':
50 50
 					require_once _ROOCMS."/acp/pages_html.php";
51 51
 					$this->unit = new ACP_Pages_HTML;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		}
60 60
 
61 61
 		# action
62
-		switch($roocms->part) {
62
+		switch ($roocms->part) {
63 63
 
64 64
 			case 'edit':
65 65
 				$this->unit->edit($this->engine->page_sid);
Please login to merge, or discard this patch.
roocms/acp/pages_html.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS') || !defined('ACP')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,101 +25,101 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class ACP_Pages_HTML {
27 27
 
28
-	/**
29
-	 * Edit content
30
-	 *
31
-	 * @param int $sid - Structure id
32
-	 */
33
-	public function edit($sid) {
28
+        /**
29
+         * Edit content
30
+         *
31
+         * @param int $sid - Structure id
32
+         */
33
+        public function edit($sid) {
34 34
 
35
-		global $db, $files, $img, $parse, $tpl, $smarty;
35
+                global $db, $files, $img, $parse, $tpl, $smarty;
36 36
 
37
-		# download data
38
-		$q = $db->query("SELECT h.id, h.sid, h.content, s.title, s.alias, s.meta_description, s.meta_keywords, h.date_modified
37
+                # download data
38
+                $q = $db->query("SELECT h.id, h.sid, h.content, s.title, s.alias, s.meta_description, s.meta_keywords, h.date_modified
39 39
 					FROM ".PAGES_HTML_TABLE." AS h
40 40
 						LEFT JOIN ".STRUCTURE_TABLE." AS s ON (s.id = h.sid)
41 41
 					WHERE h.sid='".$sid."'");
42
-		$data = $db->fetch_assoc($q);
43
-		$data['lm'] = $parse->date->unix_to_rus($data['date_modified'], true, true, true);
42
+                $data = $db->fetch_assoc($q);
43
+                $data['lm'] = $parse->date->unix_to_rus($data['date_modified'], true, true, true);
44 44
 
45
-		$smarty->assign("data", $data);
45
+                $smarty->assign("data", $data);
46 46
 
47 47
 
48
-		# download attached images
49
-		$attachimg = $img->load_images("pagesid=".$sid);
50
-		$smarty->assign("attachimg", $attachimg);
48
+                # download attached images
49
+                $attachimg = $img->load_images("pagesid=".$sid);
50
+                $smarty->assign("attachimg", $attachimg);
51 51
 
52
-		# show attached images
53
-		$attachedimages = $tpl->load_template("attached_images", true);
54
-		$smarty->assign("attachedimages", $attachedimages);
52
+                # show attached images
53
+                $attachedimages = $tpl->load_template("attached_images", true);
54
+                $smarty->assign("attachedimages", $attachedimages);
55 55
 
56 56
 
57
-		# download attached files
58
-		$attachfile = $files->load_files("pagesid=".$sid);
59
-		$smarty->assign("attachfile", $attachfile);
57
+                # download attached files
58
+                $attachfile = $files->load_files("pagesid=".$sid);
59
+                $smarty->assign("attachfile", $attachfile);
60 60
 
61
-		# show attached files
62
-		$attachedfiles = $tpl->load_template("attached_files", true);
63
-		$smarty->assign("attachedfiles", $attachedfiles);
61
+                # show attached files
62
+                $attachedfiles = $tpl->load_template("attached_files", true);
63
+                $smarty->assign("attachedfiles", $attachedfiles);
64 64
 
65 65
 
66
-		# show upload files & images form
67
-		$tpl->load_image_upload_tpl("imagesupload");
68
-		$tpl->load_files_upload_tpl("filesupload");
66
+                # show upload files & images form
67
+                $tpl->load_image_upload_tpl("imagesupload");
68
+                $tpl->load_files_upload_tpl("filesupload");
69 69
 
70
-		$content = $tpl->load_template("pages_edit_html", true);
71
-		$smarty->assign("content", $content);
72
-	}
70
+                $content = $tpl->load_template("pages_edit_html", true);
71
+                $smarty->assign("content", $content);
72
+        }
73 73
 
74 74
 
75
-	/**
76
-	 * Update page content
77
-	 *
78
-	 * @param mixed $data - this object data params
79
-	 */
80
-	public function update($data) {
75
+        /**
76
+         * Update page content
77
+         *
78
+         * @param mixed $data - this object data params
79
+         */
80
+        public function update($data) {
81 81
 
82
-		global $db, $logger, $files, $img, $post;
82
+                global $db, $logger, $files, $img, $post;
83 83
 
84
-		#sortable images
85
-		$img->update_images_info("pagesid", $data->page_sid);
84
+                #sortable images
85
+                $img->update_images_info("pagesid", $data->page_sid);
86 86
 
87 87
 
88
-		# attachment images
89
-		$images = $img->upload_image("images", "", array($data->page_thumb_img_width, $data->page_thumb_img_height));
90
-		if($images) {
91
-			foreach($images AS $image) {
92
-				$img->insert_images($image, "pagesid=".$data->page_sid);
93
-			}
94
-		}
88
+                # attachment images
89
+                $images = $img->upload_image("images", "", array($data->page_thumb_img_width, $data->page_thumb_img_height));
90
+                if($images) {
91
+                        foreach($images AS $image) {
92
+                                $img->insert_images($image, "pagesid=".$data->page_sid);
93
+                        }
94
+                }
95 95
 
96
-		# attachment files
97
-		$files->upload("files", "pagesid=".$data->page_sid);
96
+                # attachment files
97
+                $files->upload("files", "pagesid=".$data->page_sid);
98 98
 
99
-		# db
100
-		$db->query("UPDATE ".PAGES_HTML_TABLE." SET content='".$post->content."', date_modified='".time()."' WHERE sid='".$data->page_sid."'");
99
+                # db
100
+                $db->query("UPDATE ".PAGES_HTML_TABLE." SET content='".$post->content."', date_modified='".time()."' WHERE sid='".$data->page_sid."'");
101 101
 
102
-		# notice
103
-		$logger->info("Страница #".$data->page_sid." успешно обновлена.");
102
+                # notice
103
+                $logger->info("Страница #".$data->page_sid." успешно обновлена.");
104 104
 
105
-		# go
106
-		goback();
107
-	}
105
+                # go
106
+                goback();
107
+        }
108 108
 
109 109
 
110
-	/**
111
-	 * Remove page
112
-	 *
113
-	 * @param int $sid - Structure id
114
-	 */
115
-	public function delete($sid) {
110
+        /**
111
+         * Remove page
112
+         *
113
+         * @param int $sid - Structure id
114
+         */
115
+        public function delete($sid) {
116 116
 
117
-		global $db, $img;
117
+                global $db, $img;
118 118
 
119
-		# del attached images
120
-		$img->remove_images("pagesid=".$sid);
119
+                # del attached images
120
+                $img->remove_images("pagesid=".$sid);
121 121
 
122
-		# del pageunit
123
-		$db->query("DELETE FROM ".PAGES_HTML_TABLE." WHERE sid='".$sid."'");
124
-	}
122
+                # del pageunit
123
+                $db->query("DELETE FROM ".PAGES_HTML_TABLE." WHERE sid='".$sid."'");
124
+        }
125 125
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 						LEFT JOIN ".STRUCTURE_TABLE." AS s ON (s.id = h.sid)
41 41
 					WHERE h.sid='".$sid."'");
42 42
 		$data = $db->fetch_assoc($q);
43
-		$data['lm'] = $parse->date->unix_to_rus($data['date_modified'], true, true, true);
43
+		$data['lm'] = $parse->date->unix_to_rus($data['date_modified'], TRUE, TRUE, TRUE);
44 44
 
45 45
 		$smarty->assign("data", $data);
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$smarty->assign("attachimg", $attachimg);
51 51
 
52 52
 		# show attached images
53
-		$attachedimages = $tpl->load_template("attached_images", true);
53
+		$attachedimages = $tpl->load_template("attached_images", TRUE);
54 54
 		$smarty->assign("attachedimages", $attachedimages);
55 55
 
56 56
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$smarty->assign("attachfile", $attachfile);
60 60
 
61 61
 		# show attached files
62
-		$attachedfiles = $tpl->load_template("attached_files", true);
62
+		$attachedfiles = $tpl->load_template("attached_files", TRUE);
63 63
 		$smarty->assign("attachedfiles", $attachedfiles);
64 64
 
65 65
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$tpl->load_image_upload_tpl("imagesupload");
68 68
 		$tpl->load_files_upload_tpl("filesupload");
69 69
 
70
-		$content = $tpl->load_template("pages_edit_html", true);
70
+		$content = $tpl->load_template("pages_edit_html", TRUE);
71 71
 		$smarty->assign("content", $content);
72 72
 	}
73 73
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		# attachment images
89 89
 		$images = $img->upload_image("images", "", array($data->page_thumb_img_width, $data->page_thumb_img_height));
90 90
 		if($images) {
91
-			foreach($images AS $image) {
91
+			foreach($images as $image) {
92 92
 				$img->insert_images($image, "pagesid=".$data->page_sid);
93 93
 			}
94 94
 		}
Please login to merge, or discard this patch.
roocms/acp/pages_php.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS') || !defined('ACP')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,57 +25,57 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class ACP_Pages_PHP {
27 27
 
28
-	/**
29
-	* Edit content
30
-	*
31
-	* @param int $sid - Structure id
32
-	*/
33
-	public function edit($sid) {
28
+        /**
29
+         * Edit content
30
+         *
31
+         * @param int $sid - Structure id
32
+         */
33
+        public function edit($sid) {
34 34
 
35
-		global $db, $tpl, $smarty, $parse;
35
+                global $db, $tpl, $smarty, $parse;
36 36
 
37
-		$q = $db->query("SELECT h.id, h.sid, h.content, p.title, p.alias, p.meta_description, p.meta_keywords, h.date_modified
37
+                $q = $db->query("SELECT h.id, h.sid, h.content, p.title, p.alias, p.meta_description, p.meta_keywords, h.date_modified
38 38
 							FROM ".PAGES_PHP_TABLE." AS h
39 39
 							LEFT JOIN ".STRUCTURE_TABLE." AS p ON (p.id = h.sid)
40 40
 							WHERE h.sid='".$sid."'");
41
-		$data = $db->fetch_assoc($q);
42
-		$data['lm'] = $parse->date->unix_to_rus($data['date_modified'], true, true, true);
41
+                $data = $db->fetch_assoc($q);
42
+                $data['lm'] = $parse->date->unix_to_rus($data['date_modified'], true, true, true);
43 43
 
44
-		$smarty->assign("data", $data);
44
+                $smarty->assign("data", $data);
45 45
 
46
-		$content = $tpl->load_template("pages_edit_php", true);
46
+                $content = $tpl->load_template("pages_edit_php", true);
47 47
 
48
-		$smarty->assign("content", $content);
49
-	}
48
+                $smarty->assign("content", $content);
49
+        }
50 50
 
51 51
 
52
-	/**
53
-	* Update page content
54
-	*
55
-	* @param mixed $data - this object data params
56
-	*/
57
-	public function update($data) {
52
+        /**
53
+         * Update page content
54
+         *
55
+         * @param mixed $data - this object data params
56
+         */
57
+        public function update($data) {
58 58
 
59
-		global $db, $logger, $post;
59
+                global $db, $logger, $post;
60 60
 
61
-		$db->query("UPDATE ".PAGES_PHP_TABLE." SET content='".$post->content."', date_modified='".time()."' WHERE sid='".$data->page_sid."'");
61
+                $db->query("UPDATE ".PAGES_PHP_TABLE." SET content='".$post->content."', date_modified='".time()."' WHERE sid='".$data->page_sid."'");
62 62
 
63
-		$logger->info("Страница #".$data->page_sid." успешно обновлена.");
63
+                $logger->info("Страница #".$data->page_sid." успешно обновлена.");
64 64
 
65
-		goback();
66
-	}
65
+                goback();
66
+        }
67 67
 
68 68
 
69
-	/**
70
-	* Remove page
71
-	*
72
-	* @param int $sid - Structure id
73
-	*/
74
-	public function delete($sid) {
69
+        /**
70
+         * Remove page
71
+         *
72
+         * @param int $sid - Structure id
73
+         */
74
+        public function delete($sid) {
75 75
 
76
-		global $db;
76
+                global $db;
77 77
 
78
-		# del pageunit
79
-		$db->query("DELETE FROM ".PAGES_PHP_TABLE." WHERE sid='".$sid."'");
80
-	}
78
+                # del pageunit
79
+                $db->query("DELETE FROM ".PAGES_PHP_TABLE." WHERE sid='".$sid."'");
80
+        }
81 81
 }
Please login to merge, or discard this patch.
roocms/site_pageFeed.php 2 patches
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,410 +25,410 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class PageFeed {
27 27
 
28
-	use FeedExtends;
28
+        use FeedExtends;
29 29
 
30
-	# vars
31
-	private $item_id	= 0;
32
-	private $items_per_page	= 10;
30
+        # vars
31
+        private $item_id	= 0;
32
+        private $items_per_page	= 10;
33 33
 
34 34
 
35
-	/**
36
-	 * Lets begin...
37
-	 * Why does the gull die?
38
-	 */
39
-	public function __construct() {
35
+        /**
36
+         * Lets begin...
37
+         * Why does the gull die?
38
+         */
39
+        public function __construct() {
40 40
 
41
-		global $db, $structure, $config, $get, $parse, $smarty;
41
+                global $db, $structure, $config, $get, $parse, $smarty;
42 42
 
43
-		$feed           = [];
44
-		$feed['title'] 	= $structure->page_title;
45
-		$feed['alias'] 	= $structure->page_alias;
46
-		$feed['id'] 	= $structure->page_sid;
43
+                $feed           = [];
44
+                $feed['title'] 	= $structure->page_title;
45
+                $feed['alias'] 	= $structure->page_alias;
46
+                $feed['id'] 	= $structure->page_sid;
47 47
 
48
-		# append information
49
-		$feed['append_info_before'] = $parse->text->html($structure->page_append_info_before);
50
-		$feed['append_info_after'] = $parse->text->html($structure->page_append_info_after);
48
+                # append information
49
+                $feed['append_info_before'] = $parse->text->html($structure->page_append_info_before);
50
+                $feed['append_info_after'] = $parse->text->html($structure->page_append_info_after);
51 51
 
52
-		$smarty->assign("feed", $feed);
52
+                $smarty->assign("feed", $feed);
53 53
 
54
-		if(isset($get->_id) && $db->check_id(round($get->_id), PAGES_FEED_TABLE, "id", "(date_end_publications = '0' || date_end_publications > '".time()."') AND status='1'")) {
55
-			$this->item_id = (int) round($get->_id);
56
-			$this->load_item($this->item_id);
57
-		}
58
-		elseif(isset($get->_export) && $get->_export == "RSS" && $structure->page_rss && $config->rss_power) {
59
-			$this->load_feed_rss();
60
-		}
61
-		else {
62
-			$this->load_feed();
63
-		}
64
-	}
54
+                if(isset($get->_id) && $db->check_id(round($get->_id), PAGES_FEED_TABLE, "id", "(date_end_publications = '0' || date_end_publications > '".time()."') AND status='1'")) {
55
+                        $this->item_id = (int) round($get->_id);
56
+                        $this->load_item($this->item_id);
57
+                }
58
+                elseif(isset($get->_export) && $get->_export == "RSS" && $structure->page_rss && $config->rss_power) {
59
+                        $this->load_feed_rss();
60
+                }
61
+                else {
62
+                        $this->load_feed();
63
+                }
64
+        }
65 65
 
66 66
 
67
-	/**
68
-	 * Загружаем фид
69
-	 */
70
-	private function load_feed() {
67
+        /**
68
+         * Загружаем фид
69
+         */
70
+        private function load_feed() {
71 71
 
72
-		global $db, $config, $structure, $users, $tags, $rss, $parse, $img, $tpl, $smarty;
72
+                global $db, $config, $structure, $users, $tags, $rss, $parse, $img, $tpl, $smarty;
73 73
 
74
-		# set limit on per page
75
-		$this->items_per_page = ($structure->page_items_per_page > 0) ? $structure->page_items_per_page : $config->feed_items_per_page ;
76
-		$db->limit =& $this->items_per_page;
74
+                # set limit on per page
75
+                $this->items_per_page = ($structure->page_items_per_page > 0) ? $structure->page_items_per_page : $config->feed_items_per_page ;
76
+                $db->limit =& $this->items_per_page;
77 77
 
78
-		# cond request
79
-		$cond = $this->feed_condition();
78
+                # cond request
79
+                $cond = $this->feed_condition();
80 80
 
81
-		# order request
82
-		$order = $this->feed_order($structure->page_items_sorting);
81
+                # order request
82
+                $order = $this->feed_order($structure->page_items_sorting);
83 83
 
84
-		# calculate pages
85
-		$db->pages_mysql(PAGES_FEED_TABLE, $cond);
84
+                # calculate pages
85
+                $db->pages_mysql(PAGES_FEED_TABLE, $cond);
86 86
 
87
-		# get array pagination template array
88
-		$pages = $db->construct_pagination();
87
+                # get array pagination template array
88
+                $pages = $db->construct_pagination();
89 89
 
90
-		# RSS
91
-		$rss->set_header_link();
90
+                # RSS
91
+                $rss->set_header_link();
92 92
 
93
-		# Feed list
94
-		$taglinks = [];
95
-		$authors  = [];
96
-		$feeds    = [];
97
-		$q = $db->query("SELECT id, author_id, title, brief_item, date_publications, views FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order." LIMIT ".$db->from.",".$db->limit);
98
-		while($row = $db->fetch_assoc($q)) {
99
-			$row['datepub']    = $parse->date->unix_to_rus($row['date_publications'],true);
100
-			$row['date']       = $parse->date->unix_to_rus_array($row['date_publications']);
101
-			$row['brief_item'] = $parse->text->html($row['brief_item']);
93
+                # Feed list
94
+                $taglinks = [];
95
+                $authors  = [];
96
+                $feeds    = [];
97
+                $q = $db->query("SELECT id, author_id, title, brief_item, date_publications, views FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order." LIMIT ".$db->from.",".$db->limit);
98
+                while($row = $db->fetch_assoc($q)) {
99
+                        $row['datepub']    = $parse->date->unix_to_rus($row['date_publications'],true);
100
+                        $row['date']       = $parse->date->unix_to_rus_array($row['date_publications']);
101
+                        $row['brief_item'] = $parse->text->html($row['brief_item']);
102 102
 
103 103
 
104
-			$row['image']      = $img->load_images("feeditemid=".$row['id']."", 0, 1);
104
+                        $row['image']      = $img->load_images("feeditemid=".$row['id']."", 0, 1);
105 105
 
106
-			$row['tags']       = [];
106
+                        $row['tags']       = [];
107 107
 
108
-			$taglinks[$row['id']] = "feeditemid=".$row['id'];
108
+                        $taglinks[$row['id']] = "feeditemid=".$row['id'];
109 109
 
110
-			$authors[] = $row['author_id'];
110
+                        $authors[] = $row['author_id'];
111 111
 
112
-			$feeds[$row['id']] = $row;
113
-		}
112
+                        $feeds[$row['id']] = $row;
113
+                }
114 114
 
115
-		# tags collect
116
-		$feeds = $tags->collect_tags($feeds, $taglinks);
115
+                # tags collect
116
+                $feeds = $tags->collect_tags($feeds, $taglinks);
117 117
 
118
-		# authors
119
-		$fauthors = $users->get_userlist(-1,-1,-1,$authors);
118
+                # authors
119
+                $fauthors = $users->get_userlist(-1,-1,-1,$authors);
120 120
 
121
-		# smarty
122
-		$smarty->assign("authors", $fauthors);
123
-		$smarty->assign("feeds", $feeds);
124
-		$smarty->assign("pages", $pages);
125
-		$smarty->assign("rsslink", $rss->rss_link);
121
+                # smarty
122
+                $smarty->assign("authors", $fauthors);
123
+                $smarty->assign("feeds", $feeds);
124
+                $smarty->assign("pages", $pages);
125
+                $smarty->assign("rsslink", $rss->rss_link);
126 126
 
127
-		$tpl->load_template("feed");
128
-	}
127
+                $tpl->load_template("feed");
128
+        }
129 129
 
130 130
 
131
-	/**
132
-	 * Load Feed Item
133
-	 *
134
-	 * @param int $id  - идентификатор элемента
135
-	 */
136
-	private function load_item($id) {
131
+        /**
132
+         * Load Feed Item
133
+         *
134
+         * @param int $id  - идентификатор элемента
135
+         */
136
+        private function load_item($id) {
137 137
 
138
-		global $db, $structure, $nav, $users, $parse, $tags, $files, $img, $tpl, $smarty, $site;
138
+                global $db, $structure, $nav, $users, $parse, $tags, $files, $img, $tpl, $smarty, $site;
139 139
 
140
-		# query data
141
-		$q = $db->query("SELECT id, title, meta_title, meta_description, meta_keywords, author_id, full_item, views, date_publications, sort FROM ".PAGES_FEED_TABLE." WHERE id='".$id."'");
142
-		$item = $db->fetch_assoc($q);
143
-		$item['datepub'] 	= $parse->date->unix_to_rus($item['date_publications'],true);
144
-		$item['date']		= $parse->date->unix_to_rus_array($item['date_publications']);
145
-		$item['full_item']	= $parse->text->html($item['full_item']);
140
+                # query data
141
+                $q = $db->query("SELECT id, title, meta_title, meta_description, meta_keywords, author_id, full_item, views, date_publications, sort FROM ".PAGES_FEED_TABLE." WHERE id='".$id."'");
142
+                $item = $db->fetch_assoc($q);
143
+                $item['datepub'] 	= $parse->date->unix_to_rus($item['date_publications'],true);
144
+                $item['date']		= $parse->date->unix_to_rus_array($item['date_publications']);
145
+                $item['full_item']	= $parse->text->html($item['full_item']);
146 146
 
147
-		# tags
148
-		$item['tags'] = $tags->read_tags("feeditemid=".$id);
147
+                # tags
148
+                $item['tags'] = $tags->read_tags("feeditemid=".$id);
149 149
 
150
-		# add prev/next item
151
-		$item = array_merge($item, $this->load_prevnext_item($item['id']));
150
+                # add prev/next item
151
+                $item = array_merge($item, $this->load_prevnext_item($item['id']));
152 152
 
153
-		# author
154
-		if($item['author_id'] != 0) {
155
-			$item['author'] = $users->get_user_data($item['author_id']);
156
-		}
153
+                # author
154
+                if($item['author_id'] != 0) {
155
+                        $item['author'] = $users->get_user_data($item['author_id']);
156
+                }
157 157
 
158
-		# load attached images
159
-		$images = $img->load_images("feeditemid=".$id);
160
-		$smarty->assign("images", $images);
158
+                # load attached images
159
+                $images = $img->load_images("feeditemid=".$id);
160
+                $smarty->assign("images", $images);
161 161
 
162
-		# load attached files
163
-		$attachfile = $files->load_files("feeditemid=".$id);
164
-		$smarty->assign("attachfile", $attachfile);
162
+                # load attached files
163
+                $attachfile = $files->load_files("feeditemid=".$id);
164
+                $smarty->assign("attachfile", $attachfile);
165 165
 
166
-		# more items
167
-		$more = $this->rand_items($this->except_id($item));
166
+                # more items
167
+                $more = $this->rand_items($this->except_id($item));
168 168
 
169
-		# meta
170
-		if(trim($item['meta_title']) != "") {
171
-			$site['title'] = $item['meta_title']." - ".$site['title'];
172
-		}
173
-		else {
174
-			$site['title'] = $item['title']." - ".$site['title'];
175
-		}
176
-		if(trim($item['meta_description']) != "") {
177
-			$site['description']	= $item['meta_description'];
178
-		}
179
-		if(trim($item['meta_keywords']) != "") {
180
-			$site['keywords']	= $item['meta_keywords'];
181
-		}
169
+                # meta
170
+                if(trim($item['meta_title']) != "") {
171
+                        $site['title'] = $item['meta_title']." - ".$site['title'];
172
+                }
173
+                else {
174
+                        $site['title'] = $item['title']." - ".$site['title'];
175
+                }
176
+                if(trim($item['meta_description']) != "") {
177
+                        $site['description']	= $item['meta_description'];
178
+                }
179
+                if(trim($item['meta_keywords']) != "") {
180
+                        $site['keywords']	= $item['meta_keywords'];
181
+                }
182 182
 
183
-		# breadcrumb
184
-		$nav->breadcrumb[] = array('alias'=>$structure->page_alias, 'id'=>$item['id'], 'title'=>$item['title']);
183
+                # breadcrumb
184
+                $nav->breadcrumb[] = array('alias'=>$structure->page_alias, 'id'=>$item['id'], 'title'=>$item['title']);
185 185
 
186
-		$smarty->assign("more", $more);
187
-		$smarty->assign("item", $item);
188
-		$tpl->load_template("feed_item");
186
+                $smarty->assign("more", $more);
187
+                $smarty->assign("item", $item);
188
+                $tpl->load_template("feed_item");
189 189
 
190
-		// cnt views
191
-		$this->count_views($id);
192
-	}
190
+                // cnt views
191
+                $this->count_views($id);
192
+        }
193 193
 
194 194
 
195
-	/**
196
-	 * загружаем RSS фид
197
-	 */
198
-	private function load_feed_rss() {
195
+        /**
196
+         * загружаем RSS фид
197
+         */
198
+        private function load_feed_rss() {
199 199
 
200
-		global $db, $rss, $structure;
200
+                global $db, $rss, $structure;
201 201
 
202
-		# cond request
203
-		$cond = $this->feed_condition();
202
+                # cond request
203
+                $cond = $this->feed_condition();
204 204
 
205
-		# order request
206
-		$order = $this->feed_order($structure->page_items_sorting);
205
+                # order request
206
+                $order = $this->feed_order($structure->page_items_sorting);
207 207
 
208
-		$q = $db->query("SELECT id, title, brief_item, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order." LIMIT ".$db->from.",".$db->limit);
209
-		while($row = $db->fetch_assoc($q)) {
210
-			# uri
211
-			$newslink = SCRIPT_NAME."?page=".$structure->page_alias."&id=".$row['id'];
208
+                $q = $db->query("SELECT id, title, brief_item, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order." LIMIT ".$db->from.",".$db->limit);
209
+                while($row = $db->fetch_assoc($q)) {
210
+                        # uri
211
+                        $newslink = SCRIPT_NAME."?page=".$structure->page_alias."&id=".$row['id'];
212 212
 
213
-			# item
214
-			$rss->create_item($newslink, $row['title'], $row['brief_item'], $newslink, $row['date_publications'], false, $structure->page_title);
215
-			if($rss->lastbuilddate == 0) {
216
-				$rss->set_lastbuilddate($row['date_publications']);
217
-			}
218
-		}
219
-	}
213
+                        # item
214
+                        $rss->create_item($newslink, $row['title'], $row['brief_item'], $newslink, $row['date_publications'], false, $structure->page_title);
215
+                        if($rss->lastbuilddate == 0) {
216
+                                $rss->set_lastbuilddate($row['date_publications']);
217
+                        }
218
+                }
219
+        }
220 220
 
221 221
 
222
-	/**
223
-	 * Считаем показы/просмотры элемента
224
-	 *
225
-	 * @param int $id - идентификатор элемента
226
-	 */
227
-	private function count_views($id) {
228
-
229
-		global $db;
230
-
231
-		if(!isset($_COOKIE["roocms-fid-".$id])) {
222
+        /**
223
+         * Считаем показы/просмотры элемента
224
+         *
225
+         * @param int $id - идентификатор элемента
226
+         */
227
+        private function count_views($id) {
228
+
229
+                global $db;
230
+
231
+                if(!isset($_COOKIE["roocms-fid-".$id])) {
232 232
 
233
-			$db->query("UPDATE ".PAGES_FEED_TABLE." SET views=views+1 WHERE id='".$id."'");
233
+                        $db->query("UPDATE ".PAGES_FEED_TABLE." SET views=views+1 WHERE id='".$id."'");
234 234
 
235
-			// TODO: В дальнейшем время жизни будет опционально устанавливаться.
236
-			$exp = time()+(60*60*24);
237
-			setcookie("roocms-fid-".$id, "true", $exp);
238
-		}
239
-	}
240
-
241
-
242
-	/**
243
-	 * Get data for prev and next feed item
244
-	 *
245
-	 * @param int $id - use feed item id
246
-	 *
247
-	 * @return array
248
-	 */
249
-	private function load_prevnext_item($id) {
250
-
251
-		global $db, $structure, $img, $parse;
235
+                        // TODO: В дальнейшем время жизни будет опционально устанавливаться.
236
+                        $exp = time()+(60*60*24);
237
+                        setcookie("roocms-fid-".$id, "true", $exp);
238
+                }
239
+        }
240
+
241
+
242
+        /**
243
+         * Get data for prev and next feed item
244
+         *
245
+         * @param int $id - use feed item id
246
+         *
247
+         * @return array
248
+         */
249
+        private function load_prevnext_item($id) {
250
+
251
+                global $db, $structure, $img, $parse;
252 252
 
253
-		# cond request
254
-		$cond = $this->feed_condition();
253
+                # cond request
254
+                $cond = $this->feed_condition();
255 255
 
256
-		# order request
257
-		$order = $this->feed_order($structure->page_items_sorting);
256
+                # order request
257
+                $order = $this->feed_order($structure->page_items_sorting);
258 258
 
259
-		# query
260
-		$i = 0;
261
-		$previndex = -1;
262
-		$nextindex = -1;
259
+                # query
260
+                $i = 0;
261
+                $previndex = -1;
262
+                $nextindex = -1;
263 263
 
264
-		$data = [];
265
-		$res = [];
264
+                $data = [];
265
+                $res = [];
266 266
 
267
-		$q = $db->query("SELECT id, title, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order."");
268
-		while($row = $db->fetch_assoc($q)) {
267
+                $q = $db->query("SELECT id, title, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order."");
268
+                while($row = $db->fetch_assoc($q)) {
269 269
 
270
-			$res[$i] = $row;
270
+                        $res[$i] = $row;
271 271
 
272
-			if($row['id'] == $id) {
273
-				$nextindex = $i - 1;
274
-				if($nextindex >= 0) {
275
-					$data['next'] = $res[$nextindex];
276
-				}
272
+                        if($row['id'] == $id) {
273
+                                $nextindex = $i - 1;
274
+                                if($nextindex >= 0) {
275
+                                        $data['next'] = $res[$nextindex];
276
+                                }
277 277
 
278
-				$previndex = $i + 1;
279
-			}
278
+                                $previndex = $i + 1;
279
+                        }
280 280
 
281
-			if($i == $previndex) {
282
-				$data['prev'] = $res[$previndex];
283
-				break;
284
-			}
281
+                        if($i == $previndex) {
282
+                                $data['prev'] = $res[$previndex];
283
+                                break;
284
+                        }
285 285
 
286
-			$i++;
287
-		}
286
+                        $i++;
287
+                }
288 288
 
289
-		foreach($data AS $k=>$v) {
290
-			$data[$k]['datepub'] = $parse->date->unix_to_rus($data[$k]['date_publications']);
291
-			$data[$k]['image'] = $img->load_images("feeditemid=".$data[$k]['id']."", 0, 1);
292
-		}
289
+                foreach($data AS $k=>$v) {
290
+                        $data[$k]['datepub'] = $parse->date->unix_to_rus($data[$k]['date_publications']);
291
+                        $data[$k]['image'] = $img->load_images("feeditemid=".$data[$k]['id']."", 0, 1);
292
+                }
293 293
 
294
-		# return
295
-		return $data;
296
-	}
294
+                # return
295
+                return $data;
296
+        }
297 297
 
298 298
 
299
-	/**
300
-	 * Load random feed items
301
-	 *
302
-	 * @param array $i - array exceptions.
303
-	 *
304
-	 * @return array
305
-	 */
306
-	private function rand_items(array $i) {
299
+        /**
300
+         * Load random feed items
301
+         *
302
+         * @param array $i - array exceptions.
303
+         *
304
+         * @return array
305
+         */
306
+        private function rand_items(array $i) {
307 307
 
308
-		global $db, $img, $parse;
308
+                global $db, $img, $parse;
309 309
 
310
-		# add exceptions to condition
311
-		$exc = "";
312
-		foreach($i AS $k=>$v) {
313
-			$exc = $db->qcond_and($exc);
314
-			$exc .= " id != ".$v." ";
315
-		}
310
+                # add exceptions to condition
311
+                $exc = "";
312
+                foreach($i AS $k=>$v) {
313
+                        $exc = $db->qcond_and($exc);
314
+                        $exc .= " id != ".$v." ";
315
+                }
316 316
 
317
-		# cond request
318
-		$cond = $this->feed_condition()." AND ".$exc." ";
317
+                # cond request
318
+                $cond = $this->feed_condition()." AND ".$exc." ";
319 319
 
320
-		$data = [];
321
-		$q = $db->query("SELECT id, title, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY RAND() LIMIT 3"); // TODO: Избавиться от RAND!!!
322
-		while($row = $db->fetch_assoc($q)) {
323
-			$row['datepub'] = $parse->date->unix_to_rus($row['date_publications']);
324
-			$row['image']   = $img->load_images("feeditemid=".$row['id']."", 0, 1);
320
+                $data = [];
321
+                $q = $db->query("SELECT id, title, date_publications FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY RAND() LIMIT 3"); // TODO: Избавиться от RAND!!!
322
+                while($row = $db->fetch_assoc($q)) {
323
+                        $row['datepub'] = $parse->date->unix_to_rus($row['date_publications']);
324
+                        $row['image']   = $img->load_images("feeditemid=".$row['id']."", 0, 1);
325 325
 
326
-			$data[] = $row;
327
-		}
326
+                        $data[] = $row;
327
+                }
328 328
 
329
-		return $data;
330
-	}
329
+                return $data;
330
+        }
331 331
 
332 332
 
333
-	/**
334
-	 * Get exception ids
335
-	 *
336
-	 * @param array $data - info data for handle exception
337
-	 *
338
-	 * @return array exception ids
339
-	 */
340
-	private function except_id(array $data) {
333
+        /**
334
+         * Get exception ids
335
+         *
336
+         * @param array $data - info data for handle exception
337
+         *
338
+         * @return array exception ids
339
+         */
340
+        private function except_id(array $data) {
341 341
 
342
-		$res = [];
343
-		$res[] = $data['id'];
342
+                $res = [];
343
+                $res[] = $data['id'];
344 344
 
345
-		if(isset($data['prev']['id'])) {
346
-			$res[] = $data['prev']['id'];
347
-		}
345
+                if(isset($data['prev']['id'])) {
346
+                        $res[] = $data['prev']['id'];
347
+                }
348 348
 
349
-		if(isset($data['next']['id'])) {
350
-			$res[] = $data['next']['id'];
351
-		}
349
+                if(isset($data['next']['id'])) {
350
+                        $res[] = $data['next']['id'];
351
+                }
352 352
 
353
-		return $res;
354
-	}
353
+                return $res;
354
+        }
355 355
 
356 356
 
357
-	/**
358
-	 * Construct condition for query feed from DB
359
-	 *
360
-	 * @return string
361
-	 */
362
-	private function feed_condition() {
357
+        /**
358
+         * Construct condition for query feed from DB
359
+         *
360
+         * @return string
361
+         */
362
+        private function feed_condition() {
363 363
 
364
-		global $db, $structure, $users;
364
+                global $db, $structure, $users;
365 365
 
366
-		# query id's feeds begin
367
-		$cond = " date_publications <= '".time()."' AND ( sid='".$structure->page_sid."' ";
366
+                # query id's feeds begin
367
+                $cond = " date_publications <= '".time()."' AND ( sid='".$structure->page_sid."' ";
368 368
 
369
-		$showchilds =& $structure->page_show_child_feeds;
370
-
371
-		if($showchilds != "none") {
372
-			$qfeeds = $this->construct_child_feeds($structure->page_sid, $showchilds);
373
-			foreach($qfeeds as $v) {
374
-				# query id's feeds collect
375
-				if($structure->sitetree[$v]['access']) {
376
-					$cond .= " OR sid='".$v."' ";
377
-				}
378
-			}
379
-		}
369
+                $showchilds =& $structure->page_show_child_feeds;
370
+
371
+                if($showchilds != "none") {
372
+                        $qfeeds = $this->construct_child_feeds($structure->page_sid, $showchilds);
373
+                        foreach($qfeeds as $v) {
374
+                                # query id's feeds collect
375
+                                if($structure->sitetree[$v]['access']) {
376
+                                        $cond .= " OR sid='".$v."' ";
377
+                                }
378
+                        }
379
+                }
380 380
 
381
-		# query id's feeds final
382
-		$cond .= " ) ";
381
+                # query id's feeds final
382
+                $cond .= " ) ";
383 383
 
384
-		# access condition
385
-		$accesscond = "";
386
-		if($users->title != "a") {
387
-			$accesscond = " AND (group_access='0' OR group_access='".$users->gid."' OR group_access LIKE '%,".$users->gid.",%' OR group_access LIKE '".$users->gid.",%' OR group_access LIKE '%,".$users->gid."')";
388
-		}
389
-
390
-		$cond .= " ".$accesscond." AND (date_end_publications = '0' || date_end_publications > '".time()."') AND status='1' ";
384
+                # access condition
385
+                $accesscond = "";
386
+                if($users->title != "a") {
387
+                        $accesscond = " AND (group_access='0' OR group_access='".$users->gid."' OR group_access LIKE '%,".$users->gid.",%' OR group_access LIKE '".$users->gid.",%' OR group_access LIKE '%,".$users->gid."')";
388
+                }
389
+
390
+                $cond .= " ".$accesscond." AND (date_end_publications = '0' || date_end_publications > '".time()."') AND status='1' ";
391 391
 
392
-		# return
393
-		return $cond;
394
-	}
392
+                # return
393
+                return $cond;
394
+        }
395 395
 
396 396
 
397
-	/**
398
-	 * Get feeds IDs for data request condition
399
-	 *
400
-	 * @param int    $sid  - structure id
401
-	 * @param string $type - rule
402
-	 *
403
-	 * @return array - id's
404
-	 */
405
-	private function construct_child_feeds($sid, $type="default") {
397
+        /**
398
+         * Get feeds IDs for data request condition
399
+         *
400
+         * @param int    $sid  - structure id
401
+         * @param string $type - rule
402
+         *
403
+         * @return array - id's
404
+         */
405
+        private function construct_child_feeds($sid, $type="default") {
406 406
 
407
-		global $structure;
407
+                global $structure;
408 408
 
409
-		$feeds = [];
410
-
411
-		$tfeeds = $structure->load_tree($sid, 0, false);
412
-		foreach((array)$tfeeds AS $v) {
413
-			if($v['page_type'] == "feed") {
409
+                $feeds = [];
410
+
411
+                $tfeeds = $structure->load_tree($sid, 0, false);
412
+                foreach((array)$tfeeds AS $v) {
413
+                        if($v['page_type'] == "feed") {
414 414
 
415
-				$feeds[$v['id']] = $v['id'];
415
+                                $feeds[$v['id']] = $v['id'];
416 416
 
417
-				# default rule
418
-				if($type == "default" && $v['show_child_feeds'] != "none") {
419
-					$addfeeds = $this->construct_child_feeds($v['id'],$v['show_child_feeds']);
420
-					$feeds = array_merge($feeds, $addfeeds);
421
-				}
417
+                                # default rule
418
+                                if($type == "default" && $v['show_child_feeds'] != "none") {
419
+                                        $addfeeds = $this->construct_child_feeds($v['id'],$v['show_child_feeds']);
420
+                                        $feeds = array_merge($feeds, $addfeeds);
421
+                                }
422 422
 
423
-				# force rule
424
-				if($type == "forced") {
425
-					$addfeeds = $this->construct_child_feeds($v['id'],$type);
426
-					$feeds = array_merge($feeds, $addfeeds);
427
-				}
428
-			}
429
-		}
423
+                                # force rule
424
+                                if($type == "forced") {
425
+                                        $addfeeds = $this->construct_child_feeds($v['id'],$type);
426
+                                        $feeds = array_merge($feeds, $addfeeds);
427
+                                }
428
+                        }
429
+                }
430 430
 
431 431
 
432
-		return $feeds;
433
-	}
432
+                return $feeds;
433
+        }
434 434
 }
435 435
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	use FeedExtends;
29 29
 
30 30
 	# vars
31
-	private $item_id	= 0;
32
-	private $items_per_page	= 10;
31
+	private $item_id = 0;
32
+	private $items_per_page = 10;
33 33
 
34 34
 
35 35
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$feed           = [];
44 44
 		$feed['title'] 	= $structure->page_title;
45 45
 		$feed['alias'] 	= $structure->page_alias;
46
-		$feed['id'] 	= $structure->page_sid;
46
+		$feed['id'] = $structure->page_sid;
47 47
 
48 48
 		# append information
49 49
 		$feed['append_info_before'] = $parse->text->html($structure->page_append_info_before);
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 		global $db, $config, $structure, $users, $tags, $rss, $parse, $img, $tpl, $smarty;
73 73
 
74 74
 		# set limit on per page
75
-		$this->items_per_page = ($structure->page_items_per_page > 0) ? $structure->page_items_per_page : $config->feed_items_per_page ;
76
-		$db->limit =& $this->items_per_page;
75
+		$this->items_per_page = ($structure->page_items_per_page > 0) ? $structure->page_items_per_page : $config->feed_items_per_page;
76
+		$db->limit = & $this->items_per_page;
77 77
 
78 78
 		# cond request
79 79
 		$cond = $this->feed_condition();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$feeds    = [];
97 97
 		$q = $db->query("SELECT id, author_id, title, brief_item, date_publications, views FROM ".PAGES_FEED_TABLE." WHERE ".$cond." ORDER BY ".$order." LIMIT ".$db->from.",".$db->limit);
98 98
 		while($row = $db->fetch_assoc($q)) {
99
-			$row['datepub']    = $parse->date->unix_to_rus($row['date_publications'],true);
99
+			$row['datepub']    = $parse->date->unix_to_rus($row['date_publications'], true);
100 100
 			$row['date']       = $parse->date->unix_to_rus_array($row['date_publications']);
101 101
 			$row['brief_item'] = $parse->text->html($row['brief_item']);
102 102
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$feeds = $tags->collect_tags($feeds, $taglinks);
117 117
 
118 118
 		# authors
119
-		$fauthors = $users->get_userlist(-1,-1,-1,$authors);
119
+		$fauthors = $users->get_userlist(-1, -1, -1, $authors);
120 120
 
121 121
 		# smarty
122 122
 		$smarty->assign("authors", $fauthors);
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 		# query data
141 141
 		$q = $db->query("SELECT id, title, meta_title, meta_description, meta_keywords, author_id, full_item, views, date_publications, sort FROM ".PAGES_FEED_TABLE." WHERE id='".$id."'");
142 142
 		$item = $db->fetch_assoc($q);
143
-		$item['datepub'] 	= $parse->date->unix_to_rus($item['date_publications'],true);
144
-		$item['date']		= $parse->date->unix_to_rus_array($item['date_publications']);
145
-		$item['full_item']	= $parse->text->html($item['full_item']);
143
+		$item['datepub'] = $parse->date->unix_to_rus($item['date_publications'], true);
144
+		$item['date'] = $parse->date->unix_to_rus_array($item['date_publications']);
145
+		$item['full_item'] = $parse->text->html($item['full_item']);
146 146
 
147 147
 		# tags
148 148
 		$item['tags'] = $tags->read_tags("feeditemid=".$id);
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 			$site['title'] = $item['title']." - ".$site['title'];
175 175
 		}
176 176
 		if(trim($item['meta_description']) != "") {
177
-			$site['description']	= $item['meta_description'];
177
+			$site['description'] = $item['meta_description'];
178 178
 		}
179 179
 		if(trim($item['meta_keywords']) != "") {
180
-			$site['keywords']	= $item['meta_keywords'];
180
+			$site['keywords'] = $item['meta_keywords'];
181 181
 		}
182 182
 
183 183
 		# breadcrumb
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			$db->query("UPDATE ".PAGES_FEED_TABLE." SET views=views+1 WHERE id='".$id."'");
234 234
 
235 235
 			// TODO: В дальнейшем время жизни будет опционально устанавливаться.
236
-			$exp = time()+(60*60*24);
236
+			$exp = time() + (60 * 60 * 24);
237 237
 			setcookie("roocms-fid-".$id, "true", $exp);
238 238
 		}
239 239
 	}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		# query id's feeds begin
367 367
 		$cond = " date_publications <= '".time()."' AND ( sid='".$structure->page_sid."' ";
368 368
 
369
-		$showchilds =& $structure->page_show_child_feeds;
369
+		$showchilds = & $structure->page_show_child_feeds;
370 370
 
371 371
 		if($showchilds != "none") {
372 372
 			$qfeeds = $this->construct_child_feeds($structure->page_sid, $showchilds);
@@ -402,27 +402,27 @@  discard block
 block discarded – undo
402 402
 	 *
403 403
 	 * @return array - id's
404 404
 	 */
405
-	private function construct_child_feeds($sid, $type="default") {
405
+	private function construct_child_feeds($sid, $type = "default") {
406 406
 
407 407
 		global $structure;
408 408
 
409 409
 		$feeds = [];
410 410
 
411 411
 		$tfeeds = $structure->load_tree($sid, 0, false);
412
-		foreach((array)$tfeeds AS $v) {
412
+		foreach((array) $tfeeds AS $v) {
413 413
 			if($v['page_type'] == "feed") {
414 414
 
415 415
 				$feeds[$v['id']] = $v['id'];
416 416
 
417 417
 				# default rule
418 418
 				if($type == "default" && $v['show_child_feeds'] != "none") {
419
-					$addfeeds = $this->construct_child_feeds($v['id'],$v['show_child_feeds']);
419
+					$addfeeds = $this->construct_child_feeds($v['id'], $v['show_child_feeds']);
420 420
 					$feeds = array_merge($feeds, $addfeeds);
421 421
 				}
422 422
 
423 423
 				# force rule
424 424
 				if($type == "forced") {
425
-					$addfeeds = $this->construct_child_feeds($v['id'],$type);
425
+					$addfeeds = $this->construct_child_feeds($v['id'], $type);
426 426
 					$feeds = array_merge($feeds, $addfeeds);
427 427
 				}
428 428
 			}
Please login to merge, or discard this patch.
roocms/site_pagePHP.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,33 +25,33 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class PagePHP {
27 27
 
28
-	/**
29
-	* Initialisation
30
-	*
31
-	*/
32
-	public function __construct() {
33
-		$this->load_content();
34
-	}
28
+        /**
29
+         * Initialisation
30
+         *
31
+         */
32
+        public function __construct() {
33
+                $this->load_content();
34
+        }
35 35
 
36 36
 
37
-	/**
38
-	* Load Content
39
-	*
40
-	*/
41
-	public function load_content() {
37
+        /**
38
+         * Load Content
39
+         *
40
+         */
41
+        public function load_content() {
42 42
 
43
-		global $db, $structure, $parse, $tpl, $smarty;
43
+                global $db, $structure, $parse, $tpl, $smarty;
44 44
 
45
-		$q = $db->query("SELECT content FROM ".PAGES_PHP_TABLE." WHERE sid='".$structure->page_sid."'");
46
-		$data = $db->fetch_assoc($q);
45
+                $q = $db->query("SELECT content FROM ".PAGES_PHP_TABLE." WHERE sid='".$structure->page_sid."'");
46
+                $data = $db->fetch_assoc($q);
47 47
 
48
-		ob_start();
49
-			eval($parse->text->html($data['content']));
50
-			$output = ob_get_contents();
51
-		ob_end_clean();
48
+                ob_start();
49
+                        eval($parse->text->html($data['content']));
50
+                        $output = ob_get_contents();
51
+                ob_end_clean();
52 52
 
53
-		$smarty->assign("content", $output);
53
+                $smarty->assign("content", $output);
54 54
 
55
-		$tpl->load_template("page_php");
56
-	}
55
+                $tpl->load_template("page_php");
56
+        }
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
roocms/site_pageHTML.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,39 +25,39 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class PageHTML {
27 27
 
28
-	/**
29
-	* Initialisation
30
-	*
31
-	*/
32
-	public function __construct() {
33
-		$this->load_content();
34
-	}
28
+        /**
29
+         * Initialisation
30
+         *
31
+         */
32
+        public function __construct() {
33
+                $this->load_content();
34
+        }
35 35
 
36 36
 
37
-	/**
38
-	* Load Content
39
-	*
40
-	*/
41
-	public function load_content() {
37
+        /**
38
+         * Load Content
39
+         *
40
+         */
41
+        public function load_content() {
42 42
 
43
-		global $db, $structure, $parse, $files, $img, $tpl, $smarty;
43
+                global $db, $structure, $parse, $files, $img, $tpl, $smarty;
44 44
 
45
-		# get data
46
-		$q = $db->query("SELECT content FROM ".PAGES_HTML_TABLE." WHERE sid='".$structure->page_sid."'");
47
-		$data = $db->fetch_assoc($q);
45
+                # get data
46
+                $q = $db->query("SELECT content FROM ".PAGES_HTML_TABLE." WHERE sid='".$structure->page_sid."'");
47
+                $data = $db->fetch_assoc($q);
48 48
 
49
-		$data['content'] = $parse->text->html($data['content']);
49
+                $data['content'] = $parse->text->html($data['content']);
50 50
 
51
-		# load attached images
52
-		$images = $img->load_images("pagesid=".$structure->page_sid);
51
+                # load attached images
52
+                $images = $img->load_images("pagesid=".$structure->page_sid);
53 53
 
54
-		# load attached files
55
-		$attachfile = $files->load_files("pagesid=".$structure->page_sid);
54
+                # load attached files
55
+                $attachfile = $files->load_files("pagesid=".$structure->page_sid);
56 56
 
57
-		# tpl
58
-		$smarty->assign("images", $images);
59
-		$smarty->assign("attachfile", $attachfile);
60
-		$smarty->assign("content", $data['content']);
61
-		$tpl->load_template("page_html");
62
-	}
57
+                # tpl
58
+                $smarty->assign("images", $images);
59
+                $smarty->assign("attachfile", $attachfile);
60
+                $smarty->assign("content", $data['content']);
61
+                $tpl->load_template("page_html");
62
+        }
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
roocms/class/class_structure.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,249 +25,249 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class Structure {
27 27
 
28
-	# vars
29
-	public $content_types		= array('html'	=> array('title' => 'HTML'),
30
-						'php'	=> array('title' => 'PHP'),
31
-						'feed'	=> array('title' => 'Лента'));
32
-	# site tree
33
-	public $sitetree		= [];
34
-
35
-	# on/off (release in future)
36
-	public $access			= true;
37
-
38
-	# aliases
39
-	private $aliases 		= [];
40
-
41
-	# page vars
42
-	public $page_sid		= 1;				# page sid
43
-	public $page_parent		= 0;				# Parent id
44
-	public $page_alias		= "index";			# unique alias name
45
-	public $page_title		= "Добро пожаловать [RooCMS]";	# title page
46
-	public $page_meta_title		= "";				# Meta Title
47
-	public $page_meta_desc		= "";				# Meta description
48
-	public $page_meta_keys		= "";				# Meta keywords
49
-	public $page_noindex		= false;			# Meta noindex
50
-	public $page_type		= "html";			# page type
51
-	public $page_group_access	= array(0);			# allowed acces to user group (sep. comma)
52
-	public $page_rss		= false;			# on/off RSS feed
53
-	public $page_show_child_feeds	= 'none';			# feed option for show childs feed
54
-	public $page_items_per_page	= 10;				# show items on per page
55
-	public $page_items_sorting	= "datepublication";		# type sorting for feed
56
-	public $page_items		= 0;				# show amount items on feed
57
-	public $page_thumb_img_width	= 0;				# in pixels
58
-	public $page_thumb_img_height	= 0;				# in pixels
59
-	public $page_append_info_before	= "";				# info
60
-	public $page_append_info_after	= "";				# info
61
-
62
-
63
-
64
-	/**
65
-	* Init class
66
-	*
67
-	* @param bool $ui - use true only user interface
68
-	*/
69
-	public function __construct($ui=true) {
70
-
71
-		# load site tree
72
-		$this->sitetree = $this->load_tree();
73
-
74
-		if(!empty($this->sitetree)) {
75
-			$this->update_tree_parent();
76
-		}
77
-
78
-        	# user interface loaded
79
-        	if($ui) {
80
-			$this->load_ui();
81
-		}
82
-	}
83
-
84
-
85
-	/**
86
-	 * Construct tree for site (step 1)
87
-	 *
88
-	 * @param int     $parent   - id for start construction tree.
89
-	 * @param int     $maxlevel - set level for get sublevels, if param == 0, return all sublevels
90
-	 * @param boolean $child    - set false if you dont get sublevels.
91
-	 *
92
-	 * @return array|null|false - return false if tree not construct, or return rray tree.
93
-	 */
94
-	public function load_tree($parent=0, $maxlevel=0, $child=true) {
95
-
96
-		global $db, $users;
97
-		static $use = false;
98
-		$tree = [];
99
-
100
-		# Делаем единичный запрос в БД собирая данные по структуре сайта.
101
-		if(!$use) {
102
-			$q = $db->query("SELECT 
28
+        # vars
29
+        public $content_types		= array('html'	=> array('title' => 'HTML'),
30
+                                                'php'	=> array('title' => 'PHP'),
31
+                                                'feed'	=> array('title' => 'Лента'));
32
+        # site tree
33
+        public $sitetree		= [];
34
+
35
+        # on/off (release in future)
36
+        public $access			= true;
37
+
38
+        # aliases
39
+        private $aliases 		= [];
40
+
41
+        # page vars
42
+        public $page_sid		= 1;				# page sid
43
+        public $page_parent		= 0;				# Parent id
44
+        public $page_alias		= "index";			# unique alias name
45
+        public $page_title		= "Добро пожаловать [RooCMS]";	# title page
46
+        public $page_meta_title		= "";				# Meta Title
47
+        public $page_meta_desc		= "";				# Meta description
48
+        public $page_meta_keys		= "";				# Meta keywords
49
+        public $page_noindex		= false;			# Meta noindex
50
+        public $page_type		= "html";			# page type
51
+        public $page_group_access	= array(0);			# allowed acces to user group (sep. comma)
52
+        public $page_rss		= false;			# on/off RSS feed
53
+        public $page_show_child_feeds	= 'none';			# feed option for show childs feed
54
+        public $page_items_per_page	= 10;				# show items on per page
55
+        public $page_items_sorting	= "datepublication";		# type sorting for feed
56
+        public $page_items		= 0;				# show amount items on feed
57
+        public $page_thumb_img_width	= 0;				# in pixels
58
+        public $page_thumb_img_height	= 0;				# in pixels
59
+        public $page_append_info_before	= "";				# info
60
+        public $page_append_info_after	= "";				# info
61
+
62
+
63
+
64
+        /**
65
+         * Init class
66
+         *
67
+         * @param bool $ui - use true only user interface
68
+         */
69
+        public function __construct($ui=true) {
70
+
71
+                # load site tree
72
+                $this->sitetree = $this->load_tree();
73
+
74
+                if(!empty($this->sitetree)) {
75
+                        $this->update_tree_parent();
76
+                }
77
+
78
+                # user interface loaded
79
+                if($ui) {
80
+                        $this->load_ui();
81
+                }
82
+        }
83
+
84
+
85
+        /**
86
+         * Construct tree for site (step 1)
87
+         *
88
+         * @param int     $parent   - id for start construction tree.
89
+         * @param int     $maxlevel - set level for get sublevels, if param == 0, return all sublevels
90
+         * @param boolean $child    - set false if you dont get sublevels.
91
+         *
92
+         * @return array|null|false - return false if tree not construct, or return rray tree.
93
+         */
94
+        public function load_tree($parent=0, $maxlevel=0, $child=true) {
95
+
96
+                global $db, $users;
97
+                static $use = false;
98
+                $tree = [];
99
+
100
+                # Делаем единичный запрос в БД собирая данные по структуре сайта.
101
+                if(!$use) {
102
+                        $q = $db->query("SELECT 
103 103
 						id, nav, alias, parent_id,  
104 104
 						title, meta_title, meta_description, meta_keywords, noindex, rss,
105 105
 						page_type, sort, childs, items, show_child_feeds, group_access, 
106 106
 						items_per_page, items_sorting, thumb_img_width, thumb_img_height,
107 107
 						append_info_before, append_info_after
108 108
 					FROM ".STRUCTURE_TABLE." ORDER BY sort ASC");
109
-			while($row = $db->fetch_assoc($q)) {
110
-
111
-				# structure
112
-				$row['level']  = 0;
113
-				$row['parent'] = 0;
114
-
115
-				# group access
116
-				$row['group_access'] = $users->get_gid_access_granted($row['group_access']);
117
-
118
-				# access
119
-				$row['access'] = ($users->title == "a" || array_key_exists(0, $row['group_access']) || array_key_exists($users->gid, $row['group_access'])) ? true : false ;
109
+                        while($row = $db->fetch_assoc($q)) {
120 110
 
111
+                                # structure
112
+                                $row['level']  = 0;
113
+                                $row['parent'] = 0;
121 114
 
122
-				$tree[$row['id']] = $row;
115
+                                # group access
116
+                                $row['group_access'] = $users->get_gid_access_granted($row['group_access']);
123 117
 
124
-				$this->aliases[$row['alias']] = $row['id'];
125
-			}
118
+                                # access
119
+                                $row['access'] = ($users->title == "a" || array_key_exists(0, $row['group_access']) || array_key_exists($users->gid, $row['group_access'])) ? true : false ;
126 120
 
127
-			$use = true;
128
-		}
129
-		else {
130
-			$tree = $this->sitetree;
131
-		}
132 121
 
133
-		# construct tree
134
-		if(!empty($tree)) {
135
-			$tree = $this->construct_tree($tree, $parent, $maxlevel, $child);
136
-			return $tree;
137
-		}
138
-		else {
139
-			return false;
140
-		}
141
-	}
122
+                                $tree[$row['id']] = $row;
142 123
 
124
+                                $this->aliases[$row['alias']] = $row['id'];
125
+                        }
143 126
 
144
-	/**
145
-	 * Construct tree for site (step 2)
146
-	 *
147
-	 * @param array   $unit     - fresh data tree
148
-	 * @param int     $parent   - id for start construction tree.
149
-	 * @param int     $maxlevel - set level for get sublevels, if param == 0, return all sublevels
150
-	 * @param boolean $child    - set false if you dont get sublevels.
151
-	 * @param int     $level    - this param for this handler. Dont use handly.
152
-	 *
153
-	 * @return array|null
154
-	 */
155
-	private function construct_tree(array $unit, $parent=0, $maxlevel=0, $child=true, $level=0) {
127
+                        $use = true;
128
+                }
129
+                else {
130
+                        $tree = $this->sitetree;
131
+                }
156 132
 
157
-		# create array
158
-		if($level == 0) {
159
-			$tree = [];
160
-		}
133
+                # construct tree
134
+                if(!empty($tree)) {
135
+                        $tree = $this->construct_tree($tree, $parent, $maxlevel, $child);
136
+                        return $tree;
137
+                }
138
+                else {
139
+                        return false;
140
+                }
141
+        }
161 142
 
162
-		foreach($unit AS $i=>$value) {
163
-			if($unit[$i]['parent_id'] == $parent) {
164
-				# update level
165
-				$value['level'] = $level;
166 143
 
167
-				# add branch(s)
168
-				$tree[$value['id']] = $value;
169
-
170
-				# check child
171
-				if($child && ($maxlevel == 0 || $level+1 <= $maxlevel)) {
172
-
173
-					$subtree = $this->construct_tree($unit, $unit[$i]['id'], $maxlevel, $child, $level + 1);
174
-
175
-					if(is_array($subtree)) {
176
-						$tree = $tree + $subtree;
177
-					}
178
-				}
179
-			}
180
-		}
181
-
182
-		# be back
183
-		if(!empty($tree)) {
184
-			return $tree;
185
-		}
186
-	}
144
+        /**
145
+         * Construct tree for site (step 2)
146
+         *
147
+         * @param array   $unit     - fresh data tree
148
+         * @param int     $parent   - id for start construction tree.
149
+         * @param int     $maxlevel - set level for get sublevels, if param == 0, return all sublevels
150
+         * @param boolean $child    - set false if you dont get sublevels.
151
+         * @param int     $level    - this param for this handler. Dont use handly.
152
+         *
153
+         * @return array|null
154
+         */
155
+        private function construct_tree(array $unit, $parent=0, $maxlevel=0, $child=true, $level=0) {
156
+
157
+                # create array
158
+                if($level == 0) {
159
+                        $tree = [];
160
+                }
161
+
162
+                foreach($unit AS $i=>$value) {
163
+                        if($unit[$i]['parent_id'] == $parent) {
164
+                                # update level
165
+                                $value['level'] = $level;
166
+
167
+                                # add branch(s)
168
+                                $tree[$value['id']] = $value;
169
+
170
+                                # check child
171
+                                if($child && ($maxlevel == 0 || $level+1 <= $maxlevel)) {
172
+
173
+                                        $subtree = $this->construct_tree($unit, $unit[$i]['id'], $maxlevel, $child, $level + 1);
174
+
175
+                                        if(is_array($subtree)) {
176
+                                                $tree = $tree + $subtree;
177
+                                        }
178
+                                }
179
+                        }
180
+                }
181
+
182
+                # be back
183
+                if(!empty($tree)) {
184
+                        return $tree;
185
+                }
186
+        }
187 187
 
188 188
 
189
-	/**
190
-	 * Load ui data
191
-	 */
192
-	private function load_ui() {
189
+        /**
190
+         * Load ui data
191
+         */
192
+        private function load_ui() {
193 193
 
194
-		global $get;
194
+                global $get;
195 195
 
196
-		# const for default structure id
197
-		if(!defined('PAGEID')) {
198
-			define('PAGEID', 1);
199
-		}
196
+                # const for default structure id
197
+                if(!defined('PAGEID')) {
198
+                        define('PAGEID', 1);
199
+                }
200 200
 
201
-		# init id for vars
202
-		$lid = PAGEID;
201
+                # init id for vars
202
+                $lid = PAGEID;
203 203
 
204
-		if(isset($get->_page)) {
205
-			if(isset($this->sitetree[$get->_page])) {
206
-				$lid = $get->_page;
207
-			}
204
+                if(isset($get->_page)) {
205
+                        if(isset($this->sitetree[$get->_page])) {
206
+                                $lid = $get->_page;
207
+                        }
208 208
 
209
-			if(isset($this->aliases[$get->_page])) {
210
-				$lid = $this->aliases[$get->_page];
211
-			}
212
-		}
209
+                        if(isset($this->aliases[$get->_page])) {
210
+                                $lid = $this->aliases[$get->_page];
211
+                        }
212
+                }
213 213
 
214
-		# set vars
215
-		$this->set_page_vars($this->sitetree[$lid]);
216
-	}
214
+                # set vars
215
+                $this->set_page_vars($this->sitetree[$lid]);
216
+        }
217 217
 
218 218
 
219 219
         /**
220
-        * Устанавливает основные переменные класса
221
-        * В так же передает в шаблоны глобальные перенменные:
222
-        *   Идентификатор структурной еденицы
223
-        *   Алиас структурной еденицы
224
-        *   Заголовок структурной еденицы
225
-        *
226
-        * @param array $data - параметры вызванной страницы
227
-        */
228
-	private function set_page_vars($data) {
229
-
230
-		global $config, $smarty;
231
-
232
-        	# set vars
233
-		$this->page_sid                = $data['id'];
234
-		$this->page_parent             = $data['parent_id'];
235
-		$this->page_alias              = $data['alias'];
236
-		$this->page_title              = $data['title'];
237
-		$this->page_meta_title         = (trim($data['meta_title']) != "") ? $data['meta_title'] : $data['title'];
238
-		$this->page_meta_desc          = (trim($data['meta_description']) != "") ? $data['meta_description'] : $config->meta_description;
239
-		$this->page_meta_keys          = (trim($data['meta_keywords']) != "") ? $data['meta_keywords'] : $config->meta_keywords;
240
-		$this->page_noindex            = (bool) $data['noindex'];
241
-		$this->page_type               = $data['page_type'];
242
-		$this->page_group_access       = $data['group_access'];
243
-		$this->page_rss                = (bool) $data['rss'];
244
-		$this->page_show_child_feeds   = $data['show_child_feeds'];
245
-		$this->page_items_per_page     = $data['items_per_page'];
246
-		$this->page_items_sorting      = $data['items_sorting'];
247
-		$this->page_items              = $data['items'];
248
-		$this->page_thumb_img_width    = $data['thumb_img_width'];
249
-		$this->page_thumb_img_height   = $data['thumb_img_height'];
250
-		$this->page_append_info_before = $data['append_info_before'];
251
-		$this->page_append_info_after  = $data['append_info_after'];
252
-
253
-		# access
254
-		$this->access = $data['access'];
220
+         * Устанавливает основные переменные класса
221
+         * В так же передает в шаблоны глобальные перенменные:
222
+         *   Идентификатор структурной еденицы
223
+         *   Алиас структурной еденицы
224
+         *   Заголовок структурной еденицы
225
+         *
226
+         * @param array $data - параметры вызванной страницы
227
+         */
228
+        private function set_page_vars($data) {
229
+
230
+                global $config, $smarty;
231
+
232
+                # set vars
233
+                $this->page_sid                = $data['id'];
234
+                $this->page_parent             = $data['parent_id'];
235
+                $this->page_alias              = $data['alias'];
236
+                $this->page_title              = $data['title'];
237
+                $this->page_meta_title         = (trim($data['meta_title']) != "") ? $data['meta_title'] : $data['title'];
238
+                $this->page_meta_desc          = (trim($data['meta_description']) != "") ? $data['meta_description'] : $config->meta_description;
239
+                $this->page_meta_keys          = (trim($data['meta_keywords']) != "") ? $data['meta_keywords'] : $config->meta_keywords;
240
+                $this->page_noindex            = (bool) $data['noindex'];
241
+                $this->page_type               = $data['page_type'];
242
+                $this->page_group_access       = $data['group_access'];
243
+                $this->page_rss                = (bool) $data['rss'];
244
+                $this->page_show_child_feeds   = $data['show_child_feeds'];
245
+                $this->page_items_per_page     = $data['items_per_page'];
246
+                $this->page_items_sorting      = $data['items_sorting'];
247
+                $this->page_items              = $data['items'];
248
+                $this->page_thumb_img_width    = $data['thumb_img_width'];
249
+                $this->page_thumb_img_height   = $data['thumb_img_height'];
250
+                $this->page_append_info_before = $data['append_info_before'];
251
+                $this->page_append_info_after  = $data['append_info_after'];
252
+
253
+                # access
254
+                $this->access = $data['access'];
255 255
 
256 256
                 # set smarty vars
257 257
                 $smarty->assign("page_sid",   $data['id']);
258 258
                 $smarty->assign("page_alias", $data['alias']);
259 259
                 $smarty->assign("page_title", $data['title']);
260
-	}
261
-
262
-
263
-	/**
264
-	 * Функция собирает информация о родителе структурного элемента.
265
-	 */
266
-	private function update_tree_parent() {
267
-		foreach($this->sitetree AS $k=>$v) {
268
-			if($v['parent_id'] != 0) {
269
-				$this->sitetree[$k]['parent'] = $this->sitetree[$v['parent_id']];
270
-			}
271
-		}
272
-	}
260
+        }
261
+
262
+
263
+        /**
264
+         * Функция собирает информация о родителе структурного элемента.
265
+         */
266
+        private function update_tree_parent() {
267
+                foreach($this->sitetree AS $k=>$v) {
268
+                        if($v['parent_id'] != 0) {
269
+                                $this->sitetree[$k]['parent'] = $this->sitetree[$v['parent_id']];
270
+                        }
271
+                }
272
+        }
273 273
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -26,38 +26,38 @@  discard block
 block discarded – undo
26 26
 class Structure {
27 27
 
28 28
 	# vars
29
-	public $content_types		= array('html'	=> array('title' => 'HTML'),
29
+	public $content_types = array('html'	=> array('title' => 'HTML'),
30 30
 						'php'	=> array('title' => 'PHP'),
31 31
 						'feed'	=> array('title' => 'Лента'));
32 32
 	# site tree
33
-	public $sitetree		= [];
33
+	public $sitetree = [];
34 34
 
35 35
 	# on/off (release in future)
36
-	public $access			= true;
36
+	public $access = true;
37 37
 
38 38
 	# aliases
39
-	private $aliases 		= [];
39
+	private $aliases = [];
40 40
 
41 41
 	# page vars
42
-	public $page_sid		= 1;				# page sid
43
-	public $page_parent		= 0;				# Parent id
44
-	public $page_alias		= "index";			# unique alias name
45
-	public $page_title		= "Добро пожаловать [RooCMS]";	# title page
46
-	public $page_meta_title		= "";				# Meta Title
47
-	public $page_meta_desc		= "";				# Meta description
48
-	public $page_meta_keys		= "";				# Meta keywords
49
-	public $page_noindex		= false;			# Meta noindex
50
-	public $page_type		= "html";			# page type
51
-	public $page_group_access	= array(0);			# allowed acces to user group (sep. comma)
52
-	public $page_rss		= false;			# on/off RSS feed
53
-	public $page_show_child_feeds	= 'none';			# feed option for show childs feed
54
-	public $page_items_per_page	= 10;				# show items on per page
55
-	public $page_items_sorting	= "datepublication";		# type sorting for feed
56
-	public $page_items		= 0;				# show amount items on feed
57
-	public $page_thumb_img_width	= 0;				# in pixels
58
-	public $page_thumb_img_height	= 0;				# in pixels
59
-	public $page_append_info_before	= "";				# info
60
-	public $page_append_info_after	= "";				# info
42
+	public $page_sid = 1; # page sid
43
+	public $page_parent = 0; # Parent id
44
+	public $page_alias		= "index"; # unique alias name
45
+	public $page_title		= "Добро пожаловать [RooCMS]"; # title page
46
+	public $page_meta_title = ""; # Meta Title
47
+	public $page_meta_desc		= ""; # Meta description
48
+	public $page_meta_keys		= ""; # Meta keywords
49
+	public $page_noindex = false; # Meta noindex
50
+	public $page_type = "html"; # page type
51
+	public $page_group_access = array(0); # allowed acces to user group (sep. comma)
52
+	public $page_rss = false; # on/off RSS feed
53
+	public $page_show_child_feeds = 'none'; # feed option for show childs feed
54
+	public $page_items_per_page = 10; # show items on per page
55
+	public $page_items_sorting = "datepublication"; # type sorting for feed
56
+	public $page_items = 0; # show amount items on feed
57
+	public $page_thumb_img_width = 0; # in pixels
58
+	public $page_thumb_img_height = 0; # in pixels
59
+	public $page_append_info_before = ""; # info
60
+	public $page_append_info_after = ""; # info
61 61
 
62 62
 
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	*
67 67
 	* @param bool $ui - use true only user interface
68 68
 	*/
69
-	public function __construct($ui=true) {
69
+	public function __construct($ui = true) {
70 70
 
71 71
 		# load site tree
72 72
 		$this->sitetree = $this->load_tree();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return array|null|false - return false if tree not construct, or return rray tree.
93 93
 	 */
94
-	public function load_tree($parent=0, $maxlevel=0, $child=true) {
94
+	public function load_tree($parent = 0, $maxlevel = 0, $child = true) {
95 95
 
96 96
 		global $db, $users;
97 97
 		static $use = false;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 				$row['group_access'] = $users->get_gid_access_granted($row['group_access']);
117 117
 
118 118
 				# access
119
-				$row['access'] = ($users->title == "a" || array_key_exists(0, $row['group_access']) || array_key_exists($users->gid, $row['group_access'])) ? true : false ;
119
+				$row['access'] = ($users->title == "a" || array_key_exists(0, $row['group_access']) || array_key_exists($users->gid, $row['group_access'])) ? true : false;
120 120
 
121 121
 
122 122
 				$tree[$row['id']] = $row;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return array|null
154 154
 	 */
155
-	private function construct_tree(array $unit, $parent=0, $maxlevel=0, $child=true, $level=0) {
155
+	private function construct_tree(array $unit, $parent = 0, $maxlevel = 0, $child = true, $level = 0) {
156 156
 
157 157
 		# create array
158 158
 		if($level == 0) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 				$tree[$value['id']] = $value;
169 169
 
170 170
 				# check child
171
-				if($child && ($maxlevel == 0 || $level+1 <= $maxlevel)) {
171
+				if($child && ($maxlevel == 0 || $level + 1 <= $maxlevel)) {
172 172
 
173 173
 					$subtree = $this->construct_tree($unit, $unit[$i]['id'], $maxlevel, $child, $level + 1);
174 174
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		$this->access = $data['access'];
255 255
 
256 256
                 # set smarty vars
257
-                $smarty->assign("page_sid",   $data['id']);
257
+                $smarty->assign("page_sid", $data['id']);
258 258
                 $smarty->assign("page_alias", $data['alias']);
259 259
                 $smarty->assign("page_title", $data['title']);
260 260
 	}
Please login to merge, or discard this patch.
roocms/class/class_template.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 // Anti Hack
16 16
 //---------------------------------------------------------
17 17
 if(!defined('RooCMS')) {
18
-	die('Access Denied');
18
+        die('Access Denied');
19 19
 }
20 20
 //#########################################################
21 21
 
@@ -25,296 +25,296 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class Template {
27 27
 
28
-	use TemplateExtends;
28
+        use TemplateExtends;
29 29
 
30
-	# vars
31
-	private $skinfolder	= "default";
30
+        # vars
31
+        private $skinfolder	= "default";
32 32
 
33
-	# other buffer
34
-	private $css		= "";
35
-	private $js		= "";
36
-	private $skin		= "";
33
+        # other buffer
34
+        private $css		= "";
35
+        private $js		= "";
36
+        private $skin		= "";
37 37
 
38
-	# output buffer
39
-	private $out 		= "";
38
+        # output buffer
39
+        private $out 		= "";
40 40
 
41 41
 
42
-	/**
43
-	 * Init
44
-	 *
45
-	 * @param mixed $skin - set relative path to folder with "skin" from the folder _SKIN
46
-	 */
47
-	public function __construct($skin=false) {
42
+        /**
43
+         * Init
44
+         *
45
+         * @param mixed $skin - set relative path to folder with "skin" from the folder _SKIN
46
+         */
47
+        public function __construct($skin=false) {
48 48
 
49
-		global $config, $site, $users, $smarty;
49
+                global $config, $site, $users, $smarty;
50 50
 
51
-		// TODO: set_skin
52
-		if(!$skin) {
53
-			if(defined('ACP')) {
54
-				$this->skinfolder = "acp";
55
-			}
56
-			elseif(defined('INSTALL')) {
57
-				$this->skinfolder = "../install/skin";
58
-			}
59
-			else {
60
-				$this->skinfolder = $site['skin'];
61
-			}
62
-		}
63
-		else {
64
-			$this->skinfolder = $skin;
65
-		}
51
+                // TODO: set_skin
52
+                if(!$skin) {
53
+                        if(defined('ACP')) {
54
+                                $this->skinfolder = "acp";
55
+                        }
56
+                        elseif(defined('INSTALL')) {
57
+                                $this->skinfolder = "../install/skin";
58
+                        }
59
+                        else {
60
+                                $this->skinfolder = $site['skin'];
61
+                        }
62
+                }
63
+                else {
64
+                        $this->skinfolder = $skin;
65
+                }
66 66
 
67
-		# init settings smarty
68
-		$this->set_smarty_options();
67
+                # init settings smarty
68
+                $this->set_smarty_options();
69 69
 
70
-		# config vars
71
-		$smarty->assign("config", $config);
70
+                # config vars
71
+                $smarty->assign("config", $config);
72 72
 
73
-		# init userdata to tpl
74
-		$smarty->assign("userdata", $users->userdata);
73
+                # init userdata to tpl
74
+                $smarty->assign("userdata", $users->userdata);
75 75
 
76
-		# copyright text
77
-		$smarty->assign("copyright", "<a href=\"http://www.roocms.com/\">RooCMS</a> &copy; 2010-".date("Y"));
78
-	}
76
+                # copyright text
77
+                $smarty->assign("copyright", "<a href=\"http://www.roocms.com/\">RooCMS</a> &copy; 2010-".date("Y"));
78
+        }
79 79
 
80 80
 
81
-	/**
82
-	* set Smarty settings
83
-	*
84
-	*/
85
-	private function set_smarty_options() {
81
+        /**
82
+         * set Smarty settings
83
+         *
84
+         */
85
+        private function set_smarty_options() {
86 86
 
87
-		global $config, $parse, $smarty;
87
+                global $config, $parse, $smarty;
88 88
 
89
-		# set tempplates options
89
+                # set tempplates options
90 90
                 $smarty->template_dir 	= _SKIN."/".$this->skinfolder."/";
91 91
                 $smarty->compile_id 	=& $this->skinfolder;
92 92
                 $smarty->compile_dir  	= _CACHESKIN;
93 93
                 $smarty->cache_dir    	= _CACHE;
94 94
 
95
-		# set other options
95
+                # set other options
96 96
                 $smarty->caching 	= 0;
97 97
                 $smarty->cache_lifetime = 60;
98 98
 
99
-		if($config->tpl_recompile_force || DEBUGMODE) {
100
-			$smarty->force_compile 	      = $config->tpl_recompile_force;
101
-		}
102
-		if($config->if_modified_since) {
103
-			$smarty->cache_modified_check = $config->if_modified_since;
104
-		}
105
-
106
-		# filters
107
-		if($parse->uri_chpu) {
108
-			$smarty->autoload_filters = array('output' => array('correct4pu'));
109
-		}
110
-
111
-		//$smarty->config_fix_newlines = false;
112
-		//$smarty->compile_check = false;
113
-
114
-		//$smarty->clearAllCache();
115
-
116
-		# debug mode for smarty
117
-		//$smarty->debugging = DEBUGMODE;
118
-
119
-		# set skin variable
120
-        	$this->skin =  str_replace(_SITEROOT."/", "", _SKIN)."/".$this->skinfolder;
121
-
122
-		# assign skin folders templates
123
-		$smarty->assign("SKIN", $this->skin);
124
-	}
125
-
126
-
127
-	/**
128
-	 * Load template
129
-	 *
130
-	 * @param string  $tpl    - template name
131
-	 * @param bool    $return - if use $return to true, function return dump data tpl
132
-	 *
133
-	 * @return string|null
134
-	 */
135
-	public function load_template($tpl, $return=false) {
136
-
137
-		global $smarty;
138
-
139
-		$path	= _SKIN."/".$this->skinfolder;
140
-		$out 	= "";
141
-
142
-		if($this->tpl_exists($path, $tpl)) {
143
-			# load html
144
-			if(DEBUGMODE && $tpl != "header") {
145
-				$out .= "\r\n<!-- begin template: {$tpl} -->\r\n";
146
-			}
147
-
148
-			$out .= $smarty->fetch($tpl.".tpl");
149
-
150
-			if(DEBUGMODE && $tpl != "footer") {
151
-				$out .= "\r\n<!-- end template: {$tpl} -->\r\n";
152
-			}
153
-		}
154
-
155
-		if($return) {
156
-			return $out;
157
-		}
158
-		else {
159
-			$this->out .= $out;
160
-		}
161
-	}
162
-
163
-
164
-	/**
165
-	 * If tpl exists
166
-	 *
167
-	 * @param string $path - path to folder
168
-	 * @param string $tpl  - template name
169
-	 *
170
-	 * @return bool
171
-	 */
172
-	private function tpl_exists($path, $tpl) {
173
-
174
-		global $debug;
175
-
176
-		if(is_file($path."/".$tpl.".tpl")) {
177
-			return true;
178
-		}
179
-		else {
180
-			if(DEBUGMODE) { # show message in debugmode
181
-				$debug->debug_info .= "Не удалось найти шаблон: <br /><b>".$path."/".$tpl.".tpl</b><br />";
182
-			}
183
-
184
-			return false;
185
-		}
186
-	}
187
-
188
-
189
-	/**
190
-	 * Parse OUTPUT for user components (blocks, modules, widgets)
191
-	 *
192
-	 * @param string $component - block | module
193
-	 */
194
-	private function init_component($component="blocks") {
195
-
196
-		global $blocks, $module;
197
-
198
-		preg_match_all('(\{\$'.$component.'-\>load\(([a-zA-Z0-9_"\';&-]*?)\)\})', $this->out, $name);
199
-
200
-		$b = array_unique($name[1]);
201
-		foreach($b as $v) {
202
-			$v = str_ireplace('"', '', $v);
203
-			$buf = $$component->load($v);
204
-			$this->out = str_ireplace("{\${$component}->load({$v})}", $buf, $this->out);
205
-		}
206
-	}
207
-
208
-
209
-	/**
210
-	 * Load head
211
-	 *
212
-	 * @return string|null tpl
213
-	 */
214
-	private function init_head() {
215
-
216
-		global $db, $config, $site, $structure, $nav, $parse, $rss, $smarty;
217
-
218
-		# global site title
219
-		/*if(!defined('INSTALL') && $config->global_site_title) {
99
+                if($config->tpl_recompile_force || DEBUGMODE) {
100
+                        $smarty->force_compile 	      = $config->tpl_recompile_force;
101
+                }
102
+                if($config->if_modified_since) {
103
+                        $smarty->cache_modified_check = $config->if_modified_since;
104
+                }
105
+
106
+                # filters
107
+                if($parse->uri_chpu) {
108
+                        $smarty->autoload_filters = array('output' => array('correct4pu'));
109
+                }
110
+
111
+                //$smarty->config_fix_newlines = false;
112
+                //$smarty->compile_check = false;
113
+
114
+                //$smarty->clearAllCache();
115
+
116
+                # debug mode for smarty
117
+                //$smarty->debugging = DEBUGMODE;
118
+
119
+                # set skin variable
120
+                $this->skin =  str_replace(_SITEROOT."/", "", _SKIN)."/".$this->skinfolder;
121
+
122
+                # assign skin folders templates
123
+                $smarty->assign("SKIN", $this->skin);
124
+        }
125
+
126
+
127
+        /**
128
+         * Load template
129
+         *
130
+         * @param string  $tpl    - template name
131
+         * @param bool    $return - if use $return to true, function return dump data tpl
132
+         *
133
+         * @return string|null
134
+         */
135
+        public function load_template($tpl, $return=false) {
136
+
137
+                global $smarty;
138
+
139
+                $path	= _SKIN."/".$this->skinfolder;
140
+                $out 	= "";
141
+
142
+                if($this->tpl_exists($path, $tpl)) {
143
+                        # load html
144
+                        if(DEBUGMODE && $tpl != "header") {
145
+                                $out .= "\r\n<!-- begin template: {$tpl} -->\r\n";
146
+                        }
147
+
148
+                        $out .= $smarty->fetch($tpl.".tpl");
149
+
150
+                        if(DEBUGMODE && $tpl != "footer") {
151
+                                $out .= "\r\n<!-- end template: {$tpl} -->\r\n";
152
+                        }
153
+                }
154
+
155
+                if($return) {
156
+                        return $out;
157
+                }
158
+                else {
159
+                        $this->out .= $out;
160
+                }
161
+        }
162
+
163
+
164
+        /**
165
+         * If tpl exists
166
+         *
167
+         * @param string $path - path to folder
168
+         * @param string $tpl  - template name
169
+         *
170
+         * @return bool
171
+         */
172
+        private function tpl_exists($path, $tpl) {
173
+
174
+                global $debug;
175
+
176
+                if(is_file($path."/".$tpl.".tpl")) {
177
+                        return true;
178
+                }
179
+                else {
180
+                        if(DEBUGMODE) { # show message in debugmode
181
+                                $debug->debug_info .= "Не удалось найти шаблон: <br /><b>".$path."/".$tpl.".tpl</b><br />";
182
+                        }
183
+
184
+                        return false;
185
+                }
186
+        }
187
+
188
+
189
+        /**
190
+         * Parse OUTPUT for user components (blocks, modules, widgets)
191
+         *
192
+         * @param string $component - block | module
193
+         */
194
+        private function init_component($component="blocks") {
195
+
196
+                global $blocks, $module;
197
+
198
+                preg_match_all('(\{\$'.$component.'-\>load\(([a-zA-Z0-9_"\';&-]*?)\)\})', $this->out, $name);
199
+
200
+                $b = array_unique($name[1]);
201
+                foreach($b as $v) {
202
+                        $v = str_ireplace('"', '', $v);
203
+                        $buf = $$component->load($v);
204
+                        $this->out = str_ireplace("{\${$component}->load({$v})}", $buf, $this->out);
205
+                }
206
+        }
207
+
208
+
209
+        /**
210
+         * Load head
211
+         *
212
+         * @return string|null tpl
213
+         */
214
+        private function init_head() {
215
+
216
+                global $db, $config, $site, $structure, $nav, $parse, $rss, $smarty;
217
+
218
+                # global site title
219
+                /*if(!defined('INSTALL') && $config->global_site_title) {
220 220
 			$site['title'] .= " &bull; ".$config->site_title;
221 221
 		}*/
222 222
 
223
-		$site['pagination'] = [];
224
-		$site['pagination'] = array(
225
-			'page'  => $db->page,
226
-			'pages' => $db->pages
227
-		);
223
+                $site['pagination'] = [];
224
+                $site['pagination'] = array(
225
+                        'page'  => $db->page,
226
+                        'pages' => $db->pages
227
+                );
228 228
 
229 229
 
230
-		# get actual version included js and styles in templates (only Developer or Debug mode)
231
-		$build = (DEBUGMODE) ? "?v=".str_ireplace(".","",ROOCMS_VERSION)."-".time() : "" ;
230
+                # get actual version included js and styles in templates (only Developer or Debug mode)
231
+                $build = (DEBUGMODE) ? "?v=".str_ireplace(".","",ROOCMS_VERSION)."-".time() : "" ;
232 232
 
233
-		# assign tpl vars
234
-		$smarty->assign("site",	      $site);
235
-		$smarty->assign("charset",    CHARSET);
236
-		$smarty->assign("build",      $build);
237
-		$smarty->assign("css",        $this->css);
238
-		$smarty->assign("jscript",    $this->js);
239
-		$smarty->assign("error",      $parse->error);
240
-		$smarty->assign("info",	      $parse->info);
233
+                # assign tpl vars
234
+                $smarty->assign("site",	      $site);
235
+                $smarty->assign("charset",    CHARSET);
236
+                $smarty->assign("build",      $build);
237
+                $smarty->assign("css",        $this->css);
238
+                $smarty->assign("jscript",    $this->js);
239
+                $smarty->assign("error",      $parse->error);
240
+                $smarty->assign("info",	      $parse->info);
241 241
 
242
-		if(!defined('ACP') && !defined('INSTALL')) {
243
-			# rss link
244
-			$smarty->assign("rsslink",	$rss->rss_link);
242
+                if(!defined('ACP') && !defined('INSTALL')) {
243
+                        # rss link
244
+                        $smarty->assign("rsslink",	$rss->rss_link);
245 245
 
246
-			# meta noindex
247
-			$smarty->assign("noindex",	$structure->page_noindex);
246
+                        # meta noindex
247
+                        $smarty->assign("noindex",	$structure->page_noindex);
248 248
 
249
-			# breadcrumb
250
-			$nav->construct_breadcrumb($structure->page_sid);
251
-			krsort($nav->breadcrumb);
249
+                        # breadcrumb
250
+                        $nav->construct_breadcrumb($structure->page_sid);
251
+                        krsort($nav->breadcrumb);
252 252
 
253
-			$smarty->assign("breadcrumb",	$nav->breadcrumb);
253
+                        $smarty->assign("breadcrumb",	$nav->breadcrumb);
254 254
 
255
-			$breadcrumb = $this->load_template("breadcrumb", true);
256
-			$smarty->assign("breadcrumb",	$breadcrumb);
257
-		}
255
+                        $breadcrumb = $this->load_template("breadcrumb", true);
256
+                        $smarty->assign("breadcrumb",	$breadcrumb);
257
+                }
258 258
 
259
-		# head
260
-		return $this->load_template("header", true);
261
-	}
259
+                # head
260
+                return $this->load_template("header", true);
261
+        }
262 262
 
263 263
 
264
-	/**
265
-	 * load footer
266
-	 *
267
-	 * @return string|null tpl
268
-	 */
269
-	private function init_footer() {
264
+        /**
265
+         * load footer
266
+         *
267
+         * @return string|null tpl
268
+         */
269
+        private function init_footer() {
270 270
 
271
-		global $db, $debug, $smarty;
271
+                global $db, $debug, $smarty;
272 272
 
273
-		# debug_info in footer
274
-		$smarty->assign("db_querys", 		$db->cnt_querys);
273
+                # debug_info in footer
274
+                $smarty->assign("db_querys", 		$db->cnt_querys);
275 275
 
276
-		$debug->end_productivity();
277
-		$smarty->assign("debug_timer",		$debug->productivity_time);
278
-		$smarty->assign("debug_memory",		$debug->productivity_memory);
279
-		$smarty->assign("debug_memusage",	$debug->memory_peak_usage);
280
-		$smarty->assign("exist_errors",		$debug->exist_errors);
276
+                $debug->end_productivity();
277
+                $smarty->assign("debug_timer",		$debug->productivity_time);
278
+                $smarty->assign("debug_memory",		$debug->productivity_memory);
279
+                $smarty->assign("debug_memusage",	$debug->memory_peak_usage);
280
+                $smarty->assign("exist_errors",		$debug->exist_errors);
281 281
 
282
-		# foot
283
-		return $this->load_template("footer", true);
284
-	}
282
+                # foot
283
+                return $this->load_template("footer", true);
284
+        }
285 285
 
286 286
 
287
-	/**
288
-	* Show HTML data to screen
289
-	*
290
-	*/
291
-	public function out() {
287
+        /**
288
+         * Show HTML data to screen
289
+         *
290
+         */
291
+        public function out() {
292 292
 
293
-		global $roocms, $rss;
293
+                global $roocms, $rss;
294 294
 
295
-		# html output
296
-		if(!$roocms->rss) {
295
+                # html output
296
+                if(!$roocms->rss) {
297 297
 
298
-			# template with header and footer
299
-			if(!$roocms->ajax) {
300
-				$this->out = $this->init_head().$this->out.$this->init_footer();
301
-			}
298
+                        # template with header and footer
299
+                        if(!$roocms->ajax) {
300
+                                $this->out = $this->init_head().$this->out.$this->init_footer();
301
+                        }
302 302
 
303
-			# blocks & module in UI
304
-			if(!defined('ACP')) {
305
-				$this->init_component("blocks");
306
-				$this->init_component("module");
307
-			}
303
+                        # blocks & module in UI
304
+                        if(!defined('ACP')) {
305
+                                $this->init_component("blocks");
306
+                                $this->init_component("module");
307
+                        }
308 308
 
309
-			# output
310
-			echo $this->out;
311
-		}
312
-		else {
313
-			# rss output
314
-			echo $rss->out();
315
-		}
309
+                        # output
310
+                        echo $this->out;
311
+                }
312
+                else {
313
+                        # rss output
314
+                        echo $rss->out();
315
+                }
316 316
 
317
-		# secure
318
-		unset($_GET);
319
-	}
317
+                # secure
318
+                unset($_GET);
319
+        }
320 320
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 	use TemplateExtends;
29 29
 
30 30
 	# vars
31
-	private $skinfolder	= "default";
31
+	private $skinfolder = "default";
32 32
 
33 33
 	# other buffer
34
-	private $css		= "";
35
-	private $js		= "";
34
+	private $css = "";
35
+	private $js = "";
36 36
 	private $skin		= "";
37 37
 
38 38
 	# output buffer
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @param mixed $skin - set relative path to folder with "skin" from the folder _SKIN
46 46
 	 */
47
-	public function __construct($skin=false) {
47
+	public function __construct($skin = false) {
48 48
 
49 49
 		global $config, $site, $users, $smarty;
50 50
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 
89 89
 		# set tempplates options
90 90
                 $smarty->template_dir 	= _SKIN."/".$this->skinfolder."/";
91
-                $smarty->compile_id 	=& $this->skinfolder;
91
+                $smarty->compile_id = & $this->skinfolder;
92 92
                 $smarty->compile_dir  	= _CACHESKIN;
93 93
                 $smarty->cache_dir    	= _CACHE;
94 94
 
95 95
 		# set other options
96
-                $smarty->caching 	= 0;
96
+                $smarty->caching = 0;
97 97
                 $smarty->cache_lifetime = 60;
98 98
 
99 99
 		if($config->tpl_recompile_force || DEBUGMODE) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		//$smarty->debugging = DEBUGMODE;
118 118
 
119 119
 		# set skin variable
120
-        	$this->skin =  str_replace(_SITEROOT."/", "", _SKIN)."/".$this->skinfolder;
120
+        	$this->skin = str_replace(_SITEROOT."/", "", _SKIN)."/".$this->skinfolder;
121 121
 
122 122
 		# assign skin folders templates
123 123
 		$smarty->assign("SKIN", $this->skin);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return string|null
134 134
 	 */
135
-	public function load_template($tpl, $return=false) {
135
+	public function load_template($tpl, $return = false) {
136 136
 
137 137
 		global $smarty;
138 138
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @param string $component - block | module
193 193
 	 */
194
-	private function init_component($component="blocks") {
194
+	private function init_component($component = "blocks") {
195 195
 
196 196
 		global $blocks, $module;
197 197
 
@@ -228,32 +228,32 @@  discard block
 block discarded – undo
228 228
 
229 229
 
230 230
 		# get actual version included js and styles in templates (only Developer or Debug mode)
231
-		$build = (DEBUGMODE) ? "?v=".str_ireplace(".","",ROOCMS_VERSION)."-".time() : "" ;
231
+		$build = (DEBUGMODE) ? "?v=".str_ireplace(".", "", ROOCMS_VERSION)."-".time() : "";
232 232
 
233 233
 		# assign tpl vars
234
-		$smarty->assign("site",	      $site);
235
-		$smarty->assign("charset",    CHARSET);
236
-		$smarty->assign("build",      $build);
237
-		$smarty->assign("css",        $this->css);
238
-		$smarty->assign("jscript",    $this->js);
239
-		$smarty->assign("error",      $parse->error);
240
-		$smarty->assign("info",	      $parse->info);
234
+		$smarty->assign("site", $site);
235
+		$smarty->assign("charset", CHARSET);
236
+		$smarty->assign("build", $build);
237
+		$smarty->assign("css", $this->css);
238
+		$smarty->assign("jscript", $this->js);
239
+		$smarty->assign("error", $parse->error);
240
+		$smarty->assign("info", $parse->info);
241 241
 
242 242
 		if(!defined('ACP') && !defined('INSTALL')) {
243 243
 			# rss link
244
-			$smarty->assign("rsslink",	$rss->rss_link);
244
+			$smarty->assign("rsslink", $rss->rss_link);
245 245
 
246 246
 			# meta noindex
247
-			$smarty->assign("noindex",	$structure->page_noindex);
247
+			$smarty->assign("noindex", $structure->page_noindex);
248 248
 
249 249
 			# breadcrumb
250 250
 			$nav->construct_breadcrumb($structure->page_sid);
251 251
 			krsort($nav->breadcrumb);
252 252
 
253
-			$smarty->assign("breadcrumb",	$nav->breadcrumb);
253
+			$smarty->assign("breadcrumb", $nav->breadcrumb);
254 254
 
255 255
 			$breadcrumb = $this->load_template("breadcrumb", true);
256
-			$smarty->assign("breadcrumb",	$breadcrumb);
256
+			$smarty->assign("breadcrumb", $breadcrumb);
257 257
 		}
258 258
 
259 259
 		# head
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 		global $db, $debug, $smarty;
272 272
 
273 273
 		# debug_info in footer
274
-		$smarty->assign("db_querys", 		$db->cnt_querys);
274
+		$smarty->assign("db_querys", $db->cnt_querys);
275 275
 
276 276
 		$debug->end_productivity();
277
-		$smarty->assign("debug_timer",		$debug->productivity_time);
278
-		$smarty->assign("debug_memory",		$debug->productivity_memory);
279
-		$smarty->assign("debug_memusage",	$debug->memory_peak_usage);
280
-		$smarty->assign("exist_errors",		$debug->exist_errors);
277
+		$smarty->assign("debug_timer", $debug->productivity_time);
278
+		$smarty->assign("debug_memory", $debug->productivity_memory);
279
+		$smarty->assign("debug_memusage", $debug->memory_peak_usage);
280
+		$smarty->assign("exist_errors", $debug->exist_errors);
281 281
 
282 282
 		# foot
283 283
 		return $this->load_template("footer", true);
Please login to merge, or discard this patch.