Completed
Push — master ( c0ee0c...9768c0 )
by
unknown
33:12 queued 18:11
created
admin/model/common/update.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -235,6 +235,9 @@
 block discarded – undo
235 235
         return $data;
236 236
     }
237 237
 
238
+    /**
239
+     * @param string $url
240
+     */
238 241
     public function getRemoteVersion($url)
239 242
     {
240 243
         $remote_data = \Httpful\Request::get($url)
Please login to merge, or discard this patch.
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -10,292 +10,292 @@
 block discarded – undo
10 10
 class ModelCommonUpdate extends Model
11 11
 {
12 12
 
13
-    public function check()
14
-    {
15
-        // Fire event
16
-        $this->trigger->fire('pre.admin.update.check');
13
+	public function check()
14
+	{
15
+		// Fire event
16
+		$this->trigger->fire('pre.admin.update.check');
17 17
 
18
-        $this->cache->remove('addon');
19
-        $this->cache->remove('update');
20
-        $this->cache->remove('version');
18
+		$this->cache->remove('addon');
19
+		$this->cache->remove('update');
20
+		$this->cache->remove('version');
21 21
 
22
-        return true;
23
-    }
22
+		return true;
23
+	}
24 24
 
25
-    public function changelog()
26
-    {
27
-        $output = '';
25
+	public function changelog()
26
+	{
27
+		$output = '';
28 28
 
29
-        $url = 'https://api.github.com/repos/arastta/arastta/releases';
29
+		$url = 'https://api.github.com/repos/arastta/arastta/releases';
30 30
 
31
-        $json = \Httpful\Request::get($url)
32
-            ->send()
33
-            ->raw_body;
31
+		$json = \Httpful\Request::get($url)
32
+			->send()
33
+			->raw_body;
34 34
 
35
-        if (empty($json)) {
36
-            return $output;
37
-        }
35
+		if (empty($json)) {
36
+			return $output;
37
+		}
38 38
 
39
-        $parsedown = new ParsedownExtra();
39
+		$parsedown = new ParsedownExtra();
40 40
 
41
-        $releases = json_decode($json);
41
+		$releases = json_decode($json);
42 42
 
43
-        foreach ($releases as $release) {
44
-            if ($release->tag_name <= VERSION) {
45
-                continue;
46
-            }
43
+		foreach ($releases as $release) {
44
+			if ($release->tag_name <= VERSION) {
45
+				continue;
46
+			}
47 47
             
48
-            if ($release->prerelease == true) {
49
-                continue;
50
-            }
48
+			if ($release->prerelease == true) {
49
+				continue;
50
+			}
51 51
 
52
-            if (empty($release->body)) {
53
-                continue;
54
-            }
52
+			if (empty($release->body)) {
53
+				continue;
54
+			}
55 55
 
56
-            $output .= '<h2><span class="label label-primary">'.$release->tag_name.'</span></h2>';
56
+			$output .= '<h2><span class="label label-primary">'.$release->tag_name.'</span></h2>';
57 57
 
58
-            // Parse markdown output
59
-            $markdown = str_replace('## Changelog', '', $release->body);
58
+			// Parse markdown output
59
+			$markdown = str_replace('## Changelog', '', $release->body);
60 60
 
61
-            $output .= $parsedown->text($markdown);
61
+			$output .= $parsedown->text($markdown);
62 62
 
63
-            $output .= '<hr>';
64
-        }
63
+			$output .= '<hr>';
64
+		}
65 65
 
66
-        return $output;
67
-    }
66
+		return $output;
67
+	}
68 68
 
69
-    // Upgrade
70
-    public function update()
71
-    {
72
-        $version = $this->request->get['version'];
73
-        $product_id = $this->request->get['product_id'];
69
+	// Upgrade
70
+	public function update()
71
+	{
72
+		$version = $this->request->get['version'];
73
+		$product_id = $this->request->get['product_id'];
74 74
 
75
-        if (!$data = $this->downloadUpdate($product_id, $version)) {
76
-            return false;
77
-        }
75
+		if (!$data = $this->downloadUpdate($product_id, $version)) {
76
+			return false;
77
+		}
78 78
 
79
-        $path = 'temp-' . md5(mt_rand());
80
-        $file = DIR_UPLOAD . $path . '/upload.zip';
79
+		$path = 'temp-' . md5(mt_rand());
80
+		$file = DIR_UPLOAD . $path . '/upload.zip';
81 81
 
82
-        if (!is_dir(DIR_UPLOAD . $path)) {
83
-            $this->filesystem->mkdir(DIR_UPLOAD . $path);
84
-        }
82
+		if (!is_dir(DIR_UPLOAD . $path)) {
83
+			$this->filesystem->mkdir(DIR_UPLOAD . $path);
84
+		}
85 85
 
86
-        $uploaded = is_int(file_put_contents($file, $data)) ? true : false;
86
+		$uploaded = is_int(file_put_contents($file, $data)) ? true : false;
87 87
 
88
-        if (!$uploaded) {
89
-            return false;
90
-        }
88
+		if (!$uploaded) {
89
+			return false;
90
+		}
91 91
 
92
-        // Fire event
93
-        $this->trigger->fire('pre.admin.update.update', array(&$product_id));
92
+		// Fire event
93
+		$this->trigger->fire('pre.admin.update.update', array(&$product_id));
94 94
 
95
-        // Force enable maintenance mode
96
-        $maintenance_mode = $this->config->get('maintenance_mode');
97
-        $this->config->set('maintenance_mode', 1);
95
+		// Force enable maintenance mode
96
+		$maintenance_mode = $this->config->get('maintenance_mode');
97
+		$this->config->set('maintenance_mode', 1);
98 98
 
99
-        $installer = new Installer($this->registry);
99
+		$installer = new Installer($this->registry);
100 100
 
101
-        if (!$installer->unzip($file)) {
102
-            return false;
103
-        }
101
+		if (!$installer->unzip($file)) {
102
+			return false;
103
+		}
104 104
 
105
-        // Remove Zip
106
-        $this->filesystem->remove($file);
105
+		// Remove Zip
106
+		$this->filesystem->remove($file);
107 107
 
108
-        if ($product_id == 'core') {
109
-            $temp_path = DIR_UPLOAD . $path;
110
-            $install_path = $temp_path . '/install';
108
+		if ($product_id == 'core') {
109
+			$temp_path = DIR_UPLOAD . $path;
110
+			$install_path = $temp_path . '/install';
111 111
 
112
-            // Load the update script, if available
113
-            if (is_file($install_path.'/update.php')) {
114
-                require_once($install_path.'/update.php');
115
-            }
112
+			// Load the update script, if available
113
+			if (is_file($install_path.'/update.php')) {
114
+				require_once($install_path.'/update.php');
115
+			}
116 116
 
117
-            // Don't copy the install folder
118
-            $this->filesystem->remove($install_path);
117
+			// Don't copy the install folder
118
+			$this->filesystem->remove($install_path);
119 119
 
120
-            // Move all files/folders from temp path
121
-            try {
122
-                $this->filesystem->mirror($temp_path, DIR_ROOT, null, array('override' => true));
123
-            } catch (Exception $e) {
124
-                return false;
125
-            }
120
+			// Move all files/folders from temp path
121
+			try {
122
+				$this->filesystem->mirror($temp_path, DIR_ROOT, null, array('override' => true));
123
+			} catch (Exception $e) {
124
+				return false;
125
+			}
126 126
 
127
-            // Delete the temp path
128
-            $this->filesystem->remove($temp_path);
129
-        } else {
130
-            // Required for ftp & remove extension functions
131
-            $this->request->post['path'] = $path;
127
+			// Delete the temp path
128
+			$this->filesystem->remove($temp_path);
129
+		} else {
130
+			// Required for ftp & remove extension functions
131
+			$this->request->post['path'] = $path;
132 132
 
133
-            if ($this->filesystem->exists(DIR_UPLOAD . $path . '/install.json')) {
134
-                $install_data = json_decode(file_get_contents(DIR_UPLOAD . $path . '/install.json'), true);
133
+			if ($this->filesystem->exists(DIR_UPLOAD . $path . '/install.json')) {
134
+				$install_data = json_decode(file_get_contents(DIR_UPLOAD . $path . '/install.json'), true);
135 135
 
136
-                // Set it to use in the next step, addExtensionTheme
137
-                $this->session->data['product_id'] = $product_id;
138
-                $this->session->data['installer_info'] = $install_data;
139
-            }
136
+				// Set it to use in the next step, addExtensionTheme
137
+				$this->session->data['product_id'] = $product_id;
138
+				$this->session->data['installer_info'] = $install_data;
139
+			}
140 140
 
141
-            $ftp = $this->load->controller('extension/installer/parseFiles');
142
-            $remove = $this->load->controller('extension/installer/remove');
141
+			$ftp = $this->load->controller('extension/installer/parseFiles');
142
+			$remove = $this->load->controller('extension/installer/remove');
143 143
 
144
-            $this->db->query("UPDATE `" . DB_PREFIX . "addon` SET `product_version` = '" . $this->db->escape($version) . "' WHERE `product_id` = '" . (int)$product_id . "'");
145
-        }
144
+			$this->db->query("UPDATE `" . DB_PREFIX . "addon` SET `product_version` = '" . $this->db->escape($version) . "' WHERE `product_id` = '" . (int)$product_id . "'");
145
+		}
146 146
 
147
-        // Restore maintenance mode
148
-        $this->config->set('maintenance_mode', $maintenance_mode);
147
+		// Restore maintenance mode
148
+		$this->config->set('maintenance_mode', $maintenance_mode);
149 149
 
150
-        // Fire event
151
-        $this->trigger->fire('post.admin.update.update', array(&$product_id));
150
+		// Fire event
151
+		$this->trigger->fire('post.admin.update.update', array(&$product_id));
152 152
 
153
-        return true;
154
-    }
153
+		return true;
154
+	}
155 155
 
156
-    public function countUpdates()
157
-    {
158
-        return array_sum(array_map("count", $this->getUpdates()));
159
-    }
156
+	public function countUpdates()
157
+	{
158
+		return array_sum(array_map("count", $this->getUpdates()));
159
+	}
160 160
 
161
-    public function getUpdates()
162
-    {
163
-        $data = $this->cache->get('update');
161
+	public function getUpdates()
162
+	{
163
+		$data = $this->cache->get('update');
164 164
 
165
-        if (empty($data)) {
166
-            $data = array();
165
+		if (empty($data)) {
166
+			$data = array();
167 167
 
168
-            $this->load->model('extension/marketplace');
168
+			$this->load->model('extension/marketplace');
169 169
 
170
-            $addons = $this->model_extension_marketplace->getAddons(true);
170
+			$addons = $this->model_extension_marketplace->getAddons(true);
171 171
 
172
-            $versions = $this->getVersions($addons);
172
+			$versions = $this->getVersions($addons);
173 173
 
174
-            foreach ($versions as $key => $version) {
175
-                // Addons (extensions, themes, translations) comes as array
176
-                if (is_array($version)) {
177
-                    foreach ($version as $id => $addon_version) {
178
-                        $addon = $addons[$id];
179
-                        $type = $addon['product_type'];
174
+			foreach ($versions as $key => $version) {
175
+				// Addons (extensions, themes, translations) comes as array
176
+				if (is_array($version)) {
177
+					foreach ($version as $id => $addon_version) {
178
+						$addon = $addons[$id];
179
+						$type = $addon['product_type'];
180 180
 
181
-                        // English (en-GB) language, always up-to-date
182
-                        if ($addon['product_id'] == 225) {
183
-                            continue;
184
-                        }
181
+						// English (en-GB) language, always up-to-date
182
+						if ($addon['product_id'] == 225) {
183
+							continue;
184
+						}
185 185
 
186
-                        // Up-to-date
187
-                        if (version_compare($addon['product_version'], $addon_version) == 0) {
188
-                            continue;
189
-                        }
186
+						// Up-to-date
187
+						if (version_compare($addon['product_version'], $addon_version) == 0) {
188
+							continue;
189
+						}
190 190
 
191
-                        $data[$type][$addon['product_id']] = $addon_version;
192
-                    }
193
-                } elseif ($key == 'core') {
194
-                    if (version_compare(VERSION, $version) != 0) {
195
-                        $data['core'] = $version;
196
-                    }
197
-                }
198
-            }
191
+						$data[$type][$addon['product_id']] = $addon_version;
192
+					}
193
+				} elseif ($key == 'core') {
194
+					if (version_compare(VERSION, $version) != 0) {
195
+						$data['core'] = $version;
196
+					}
197
+				}
198
+			}
199 199
 
200
-            $this->cache->set('update', $data);
201
-        }
200
+			$this->cache->set('update', $data);
201
+		}
202 202
 
203
-        return $data;
204
-    }
203
+		return $data;
204
+	}
205 205
 
206
-    public function getVersions($addons = array())
207
-    {
208
-        $data = $this->cache->get('version');
206
+	public function getVersions($addons = array())
207
+	{
208
+		$data = $this->cache->get('version');
209 209
 
210
-        if (empty($data)) {
211
-            $data = array();
212
-
213
-            // Check core first
214
-            $info = $this->utility->getInfo();
215
-            $base_url = 'http://arastta.io';
210
+		if (empty($data)) {
211
+			$data = array();
212
+
213
+			// Check core first
214
+			$info = $this->utility->getInfo();
215
+			$base_url = 'http://arastta.io';
216 216
 
217
-            $url = $base_url.'/core/1.0/version/'.$info['arastta'].'/'.$info['php'].'/'.$info['mysql'].'/'.$info['langs'].'/'.$info['stores'];
217
+			$url = $base_url.'/core/1.0/version/'.$info['arastta'].'/'.$info['php'].'/'.$info['mysql'].'/'.$info['langs'].'/'.$info['stores'];
218 218
 
219
-            $data['core'] = $this->getRemoteVersion($url);
220
-
221
-            // Then addons
222
-            if (!empty($addons)) {
223
-                foreach ($addons as $addon) {
224
-                    $type = $addon['product_type'];
219
+			$data['core'] = $this->getRemoteVersion($url);
220
+
221
+			// Then addons
222
+			if (!empty($addons)) {
223
+				foreach ($addons as $addon) {
224
+					$type = $addon['product_type'];
225 225
 
226
-                    $url = $base_url.'/'.$type.'/1.0/version/'.$addon['product_id'].'/'.$addon['product_version'].'/'.$info['arastta'];
226
+					$url = $base_url.'/'.$type.'/1.0/version/'.$addon['product_id'].'/'.$addon['product_version'].'/'.$info['arastta'];
227 227
 
228
-                    $data[$type][$addon['product_id']] = $this->getRemoteVersion($url);
229
-                }
230
-            }
228
+					$data[$type][$addon['product_id']] = $this->getRemoteVersion($url);
229
+				}
230
+			}
231 231
 
232
-            $this->cache->set('version', $data);
233
-        }
232
+			$this->cache->set('version', $data);
233
+		}
234 234
 
235
-        return $data;
236
-    }
235
+		return $data;
236
+	}
237 237
 
238
-    public function getRemoteVersion($url)
239
-    {
240
-        $remote_data = \Httpful\Request::get($url)
241
-            ->addOnCurlOption(CURLOPT_REFERER, $this->url->getDomain())
242
-            ->send()
243
-            ->raw_body;
238
+	public function getRemoteVersion($url)
239
+	{
240
+		$remote_data = \Httpful\Request::get($url)
241
+			->addOnCurlOption(CURLOPT_REFERER, $this->url->getDomain())
242
+			->send()
243
+			->raw_body;
244 244
 
245
-        if (is_string($remote_data)) {
246
-            $version = json_decode($remote_data);
245
+		if (is_string($remote_data)) {
246
+			$version = json_decode($remote_data);
247 247
 
248
-            if (is_object($version)) {
249
-                $latest = $version->latest;
250
-            } else {
251
-                $latest = '0.0.0';
252
-            }
253
-        } else {
254
-            $latest = '0.0.0';
255
-        }
256
-
257
-        return $latest;
258
-    }
248
+			if (is_object($version)) {
249
+				$latest = $version->latest;
250
+			} else {
251
+				$latest = '0.0.0';
252
+			}
253
+		} else {
254
+			$latest = '0.0.0';
255
+		}
256
+
257
+		return $latest;
258
+	}
259 259
 
260
-    public function downloadUpdate($product_id, $version)
261
-    {
262
-        // Check core first
263
-        $info = $this->utility->getInfo();
264
-        $base_url = 'http://arastta.io';
260
+	public function downloadUpdate($product_id, $version)
261
+	{
262
+		// Check core first
263
+		$info = $this->utility->getInfo();
264
+		$base_url = 'http://arastta.io';
265 265
 
266
-        if ($product_id == 'core') {
267
-            $url = $base_url.'/core/1.0/update/'.$version.'/'.$info['php'].'/'.$info['mysql'];
268
-        } else {
269
-            $this->load->model('extension/marketplace');
270
-
271
-            $addons = $this->model_extension_marketplace->getAddons(true);
266
+		if ($product_id == 'core') {
267
+			$url = $base_url.'/core/1.0/update/'.$version.'/'.$info['php'].'/'.$info['mysql'];
268
+		} else {
269
+			$this->load->model('extension/marketplace');
270
+
271
+			$addons = $this->model_extension_marketplace->getAddons(true);
272 272
             
273
-            $type = $addons[$product_id]['product_type'];
273
+			$type = $addons[$product_id]['product_type'];
274 274
 
275
-            $url = $base_url.'/'.$type.'/1.0/update/'.$product_id.'/'.$version.'/'.$info['arastta'].'/'.$info['api'];
276
-        }
275
+			$url = $base_url.'/'.$type.'/1.0/update/'.$product_id.'/'.$version.'/'.$info['arastta'].'/'.$info['api'];
276
+		}
277 277
 
278
-        $file = \Httpful\Request::get($url)
279
-            ->timeout(30)
280
-            ->addOnCurlOption(CURLOPT_REFERER, $this->url->getDomain())
281
-            ->send()
282
-            ->raw_body;
278
+		$file = \Httpful\Request::get($url)
279
+			->timeout(30)
280
+			->addOnCurlOption(CURLOPT_REFERER, $this->url->getDomain())
281
+			->send()
282
+			->raw_body;
283 283
 
284
-        return $file;
285
-    }
284
+		return $file;
285
+	}
286 286
 
287
-    public function showColums($table)
288
-    {
289
-        $result = array();
287
+	public function showColums($table)
288
+	{
289
+		$result = array();
290 290
 
291
-        $query = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . $table . "`");
291
+		$query = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . $table . "`");
292 292
 
293
-        if ($query->num_rows) {
294
-            foreach ($query->rows as $row) {
295
-                $result[] = $row['Field'];
296
-            }
297
-        }
293
+		if ($query->num_rows) {
294
+			foreach ($query->rows as $row) {
295
+				$result[] = $row['Field'];
296
+			}
297
+		}
298 298
 
299
-        return $result;
300
-    }
299
+		return $result;
300
+	}
301 301
 }
Please login to merge, or discard this patch.
system/engine/loader.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -9,152 +9,152 @@
 block discarded – undo
9 9
 
10 10
 final class Loader {
11 11
 
12
-    private $registry;
12
+	private $registry;
13 13
 
14
-    public function __construct($registry) {
15
-        $this->registry = $registry;
16
-    }
14
+	public function __construct($registry) {
15
+		$this->registry = $registry;
16
+	}
17 17
 
18
-    public function __get($key) {
19
-        return $this->registry->get($key);
20
-    }
18
+	public function __get($key) {
19
+		return $this->registry->get($key);
20
+	}
21 21
 
22
-    public function __set($key, $value) {
23
-        $this->registry->set($key, $value);
24
-    }
22
+	public function __set($key, $value) {
23
+		$this->registry->set($key, $value);
24
+	}
25 25
 
26
-    public function controller($route, $args = array()) {
27
-        $this->trigger->fire('pre.load.controller', array(&$route, &$args));
26
+	public function controller($route, $args = array()) {
27
+		$this->trigger->fire('pre.load.controller', array(&$route, &$args));
28 28
 
29
-        $action = new Action($route, $args);
29
+		$action = new Action($route, $args);
30 30
 
31
-        $ret = $action->execute($this->registry);
31
+		$ret = $action->execute($this->registry);
32 32
 
33
-        $this->trigger->fire('post.load.controller', array(&$route, &$ret));
33
+		$this->trigger->fire('post.load.controller', array(&$route, &$ret));
34 34
 
35
-        return $ret;
36
-    }
35
+		return $ret;
36
+	}
37 37
 
38
-    public function model($model) {
39
-        // Create model name
40
-        $model_name = 'model_' . str_replace('/', '_', $model);
38
+	public function model($model) {
39
+		// Create model name
40
+		$model_name = 'model_' . str_replace('/', '_', $model);
41 41
         
42
-        // Return model instance if already created
43
-        if ($this->registry->get($model_name) !== null) {
44
-            return $this->registry->get($model_name);
45
-        }
42
+		// Return model instance if already created
43
+		if ($this->registry->get($model_name) !== null) {
44
+			return $this->registry->get($model_name);
45
+		}
46 46
         
47
-        $file = Client::getDir() . 'model/' . $model . '.php';
48
-        $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model);
47
+		$file = Client::getDir() . 'model/' . $model . '.php';
48
+		$class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model);
49 49
 
50
-        if (file_exists($file)) {
51
-            $this->trigger->fire('pre.load.model', array(&$model));
50
+		if (file_exists($file)) {
51
+			$this->trigger->fire('pre.load.model', array(&$model));
52 52
 
53
-            include_once($file);
53
+			include_once($file);
54 54
 
55
-            $model_class = new $class($this->registry);
55
+			$model_class = new $class($this->registry);
56 56
 
57
-            $this->registry->set($model_name, $model_class);
57
+			$this->registry->set($model_name, $model_class);
58 58
 
59
-            $this->trigger->fire('post.load.model', array(&$model_class));
60
-        } else {
61
-            trigger_error('Error: Could not load model ' . $file . '!');
62
-            exit();
63
-        }
64
-    }
59
+			$this->trigger->fire('post.load.model', array(&$model_class));
60
+		} else {
61
+			trigger_error('Error: Could not load model ' . $file . '!');
62
+			exit();
63
+		}
64
+	}
65 65
 
66
-    public function view($template, $data = array()) {
67
-        $theme_dir = Client::isCatalog() ? 'theme' : 'template';
66
+	public function view($template, $data = array()) {
67
+		$theme_dir = Client::isCatalog() ? 'theme' : 'template';
68 68
         
69
-        if (Client::isAdmin() && isset($this->session->data['theme']) && $this->session->data['theme'] != 'advanced') {
70
-            if (file_exists(Client::getDir() . 'view/theme/' . $this->session->data['theme'] . '/template/' . $template)) {
71
-                $theme_dir = 'theme/' . $this->session->data['theme'] . '/template';
72
-            }
73
-        }
69
+		if (Client::isAdmin() && isset($this->session->data['theme']) && $this->session->data['theme'] != 'advanced') {
70
+			if (file_exists(Client::getDir() . 'view/theme/' . $this->session->data['theme'] . '/template/' . $template)) {
71
+				$theme_dir = 'theme/' . $this->session->data['theme'] . '/template';
72
+			}
73
+		}
74 74
 
75
-        $file = Client::getDir() . 'view/' . $theme_dir . '/' . $template;
75
+		$file = Client::getDir() . 'view/' . $theme_dir . '/' . $template;
76 76
 
77
-        if (file_exists($file)) {
78
-            $this->trigger->fire('pre.load.view', array(&$template, &$data));
77
+		if (file_exists($file)) {
78
+			$this->trigger->fire('pre.load.view', array(&$template, &$data));
79 79
 
80
-            extract($data);
80
+			extract($data);
81 81
 
82
-            ob_start();
82
+			ob_start();
83 83
 
84
-            require($file);
84
+			require($file);
85 85
 
86
-            $output = ob_get_contents();
86
+			$output = ob_get_contents();
87 87
 
88
-            ob_end_clean();
88
+			ob_end_clean();
89 89
 
90
-            $this->trigger->fire('post.load.view', array(&$output, $template));
90
+			$this->trigger->fire('post.load.view', array(&$output, $template));
91 91
 
92
-            return $output;
93
-        } else {
94
-            trigger_error('Error: Could not load template ' . $file . '!');
95
-            exit();
96
-        }
97
-    }
92
+			return $output;
93
+		} else {
94
+			trigger_error('Error: Could not load template ' . $file . '!');
95
+			exit();
96
+		}
97
+	}
98 98
 
99
-    public function output($file, $data) {
100
-        if (Client::isAdmin()) {
101
-            $output = $this->view($file.'.tpl', $data);
102
-        } else {
103
-            if (file_exists(Client::getDir() . 'view/theme/'. $this->config->get('config_template') . '/template/'.$file.'.tpl')) {
104
-                $output = $this->view($this->config->get('config_template') . '/template/'.$file.'.tpl', $data);
105
-            } else {
106
-                $output = $this->view('default/template/'.$file.'.tpl', $data);
107
-            }
108
-        }
99
+	public function output($file, $data) {
100
+		if (Client::isAdmin()) {
101
+			$output = $this->view($file.'.tpl', $data);
102
+		} else {
103
+			if (file_exists(Client::getDir() . 'view/theme/'. $this->config->get('config_template') . '/template/'.$file.'.tpl')) {
104
+				$output = $this->view($this->config->get('config_template') . '/template/'.$file.'.tpl', $data);
105
+			} else {
106
+				$output = $this->view('default/template/'.$file.'.tpl', $data);
107
+			}
108
+		}
109 109
 
110
-        return $output;
111
-    }
110
+		return $output;
111
+	}
112 112
 
113
-    public function library($library) {
114
-        $file = DIR_SYSTEM . 'library/' . $library . '.php';
113
+	public function library($library) {
114
+		$file = DIR_SYSTEM . 'library/' . $library . '.php';
115 115
 
116
-        if (file_exists($file)) {
117
-            $this->trigger->fire('pre.load.library', array(&$library));
116
+		if (file_exists($file)) {
117
+			$this->trigger->fire('pre.load.library', array(&$library));
118 118
 
119
-            include_once($file);
119
+			include_once($file);
120 120
 
121
-            $this->trigger->fire('post.load.library', array(&$library));
122
-        } else {
123
-            trigger_error('Error: Could not load library ' . $file . '!');
124
-            exit();
125
-        }
126
-    }
121
+			$this->trigger->fire('post.load.library', array(&$library));
122
+		} else {
123
+			trigger_error('Error: Could not load library ' . $file . '!');
124
+			exit();
125
+		}
126
+	}
127 127
 
128
-    public function helper($helper) {
129
-        $file = DIR_SYSTEM . 'helper/' . $helper . '.php';
128
+	public function helper($helper) {
129
+		$file = DIR_SYSTEM . 'helper/' . $helper . '.php';
130 130
 
131
-        if (file_exists($file)) {
132
-            $this->trigger->fire('pre.load.helper', array(&$helper));
131
+		if (file_exists($file)) {
132
+			$this->trigger->fire('pre.load.helper', array(&$helper));
133 133
 
134
-            include_once($file);
134
+			include_once($file);
135 135
 
136
-            $this->trigger->fire('post.load.helper', array(&$helper));
137
-        } else {
138
-            trigger_error('Error: Could not load helper ' . $file . '!');
139
-            exit();
140
-        }
141
-    }
136
+			$this->trigger->fire('post.load.helper', array(&$helper));
137
+		} else {
138
+			trigger_error('Error: Could not load helper ' . $file . '!');
139
+			exit();
140
+		}
141
+	}
142 142
 
143
-    public function config($config) {
144
-        $this->trigger->fire('pre.load.config', array(&$config));
143
+	public function config($config) {
144
+		$this->trigger->fire('pre.load.config', array(&$config));
145 145
 
146
-        $this->registry->get('config')->load($config);
146
+		$this->registry->get('config')->load($config);
147 147
 
148
-        $this->trigger->fire('post.load.config', array(&$config));
149
-    }
148
+		$this->trigger->fire('post.load.config', array(&$config));
149
+	}
150 150
 
151
-    public function language($language) {
152
-        $this->trigger->fire('pre.load.language', array(&$language));
151
+	public function language($language) {
152
+		$this->trigger->fire('pre.load.language', array(&$language));
153 153
 
154
-        $lang = $this->registry->get('language')->load($language);
154
+		$lang = $this->registry->get('language')->load($language);
155 155
 
156
-        $this->trigger->fire('post.load.language', array(&$language));
156
+		$this->trigger->fire('post.load.language', array(&$language));
157 157
 
158
-        return $lang;
159
-    }
158
+		return $lang;
159
+	}
160 160
 }
Please login to merge, or discard this patch.
system/library/version.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,76 +17,76 @@
 block discarded – undo
17 17
 final class Version extends Object
18 18
 {
19 19
 
20
-    protected $name = 'Arastta';
21
-
22
-    protected $code = 'Tianjin';
23
-
24
-    protected $major = '1';
25
-
26
-    protected $minor = '6';
27
-
28
-    protected $patch = '0';
29
-
30
-    protected $build = '';
31
-
32
-    protected $status = 'RC 2';
33
-
34
-    protected $date = '06-April-2017';
35
-
36
-    protected $time = '20:00';
37
-
38
-    protected $zone = 'GMT +3';
39
-
40
-    /**
41
-     * Compares two a "PHP standardized" version number against the current Arastta version.
42
-     *
43
-     * @param   string  $minimum  The minimum version of the Arastta which is compatible.
44
-     *
45
-     * @return  bool    True if the version is compatible.
46
-     *
47
-     * @see     http://www.php.net/version_compare
48
-     * @since   1.0
49
-     */
50
-    public function isCompatible($minimum)
51
-    {
52
-        return version_compare($this->getShortVersion(), $minimum, 'ge');
53
-    }
54
-
55
-    /**
56
-     * Gets a "PHP standardized" version string for the current Arastta.
57
-     *
58
-     * @return  string  Version string.
59
-     *
60
-     * @since   1.0
61
-     */
62
-    public function getReleaseVersion()
63
-    {
64
-        return $this->get('major') . '.' . $this->get('minor');
65
-    }
66
-
67
-    /**
68
-     * Gets a "PHP standardized" version string for the current Arastta.
69
-     *
70
-     * @return  string  Version string.
71
-     *
72
-     * @since   1.0
73
-     */
74
-    public function getShortVersion()
75
-    {
76
-        return $this->getReleaseVersion() . '.' . $this->get('patch');
77
-    }
78
-
79
-    /**
80
-     * Gets a version string for the current Arastta with all release information.
81
-     *
82
-     * @return  string  Complete version string.
83
-     *
84
-     * @since   1.0
85
-     */
86
-    public function getLongVersion()
87
-    {
88
-        return $this->get('name') . ' ' . $this->getShortVersion() . ' '
89
-        . $this->get('status') . ' [ ' . $this->get('code') . ' ] ' . $this->get('date') . ' '
90
-        . $this->get('time') . ' ' . $this->get('zone');
91
-    }
20
+	protected $name = 'Arastta';
21
+
22
+	protected $code = 'Tianjin';
23
+
24
+	protected $major = '1';
25
+
26
+	protected $minor = '6';
27
+
28
+	protected $patch = '0';
29
+
30
+	protected $build = '';
31
+
32
+	protected $status = 'RC 2';
33
+
34
+	protected $date = '06-April-2017';
35
+
36
+	protected $time = '20:00';
37
+
38
+	protected $zone = 'GMT +3';
39
+
40
+	/**
41
+	 * Compares two a "PHP standardized" version number against the current Arastta version.
42
+	 *
43
+	 * @param   string  $minimum  The minimum version of the Arastta which is compatible.
44
+	 *
45
+	 * @return  bool    True if the version is compatible.
46
+	 *
47
+	 * @see     http://www.php.net/version_compare
48
+	 * @since   1.0
49
+	 */
50
+	public function isCompatible($minimum)
51
+	{
52
+		return version_compare($this->getShortVersion(), $minimum, 'ge');
53
+	}
54
+
55
+	/**
56
+	 * Gets a "PHP standardized" version string for the current Arastta.
57
+	 *
58
+	 * @return  string  Version string.
59
+	 *
60
+	 * @since   1.0
61
+	 */
62
+	public function getReleaseVersion()
63
+	{
64
+		return $this->get('major') . '.' . $this->get('minor');
65
+	}
66
+
67
+	/**
68
+	 * Gets a "PHP standardized" version string for the current Arastta.
69
+	 *
70
+	 * @return  string  Version string.
71
+	 *
72
+	 * @since   1.0
73
+	 */
74
+	public function getShortVersion()
75
+	{
76
+		return $this->getReleaseVersion() . '.' . $this->get('patch');
77
+	}
78
+
79
+	/**
80
+	 * Gets a version string for the current Arastta with all release information.
81
+	 *
82
+	 * @return  string  Complete version string.
83
+	 *
84
+	 * @since   1.0
85
+	 */
86
+	public function getLongVersion()
87
+	{
88
+		return $this->get('name') . ' ' . $this->getShortVersion() . ' '
89
+		. $this->get('status') . ' [ ' . $this->get('code') . ' ] ' . $this->get('date') . ' '
90
+		. $this->get('time') . ' ' . $this->get('zone');
91
+	}
92 92
 }
Please login to merge, or discard this patch.
system/library/user.php 1 patch
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -9,170 +9,170 @@
 block discarded – undo
9 9
 
10 10
 class User extends Object {
11 11
 
12
-    protected $user_id;
13
-    protected $username;
14
-    protected $firstname;
15
-    protected $lastname;
16
-    protected $email;
17
-    protected $user_group_id;
18
-    protected $theme;
19
-    protected $params;
20
-    protected $permission = array();
21
-
22
-    protected $db;
23
-    protected $config;
24
-    protected $request;
25
-    protected $session;
26
-    protected $response;
27
-
28
-    public function __construct($registry) {
29
-        $this->db = $registry->get('db');
30
-        $this->config = $registry->get('config');
31
-        $this->request = $registry->get('request');
32
-        $this->session = $registry->get('session');
33
-        $this->response = $registry->get('response');
34
-
35
-        if (isset($this->session->data['user_id'])) {
36
-            $user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");
37
-
38
-            if ($user_query->num_rows) {
39
-                $this->user_id = $user_query->row['user_id'];
40
-                $this->username = $user_query->row['username'];
41
-                $this->firstname = $user_query->row['firstname'];
42
-                $this->lastname = $user_query->row['lastname'];
43
-                $this->email = $user_query->row['email'];
44
-                $this->user_group_id = $user_query->row['user_group_id'];
45
-
46
-                $params = json_decode($user_query->row['params'], true);
47
-
48
-                if (!isset($this->session->data['theme'])) {
49
-                    $this->session->data['theme'] = !empty($params['theme']) ? $params['theme'] : 'basic';
50
-                }
51
-
52
-                $this->theme = !empty($params['theme']) ? $params['theme'] : 'basic';
53
-                $this->params = $params;
54
-
55
-                $this->db->query("UPDATE " . DB_PREFIX . "user SET ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE user_id = '" . (int)$this->session->data['user_id'] . "'");
56
-
57
-                $user_group_query = $this->db->query("SELECT permission FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'");
58
-
59
-                $permissions = unserialize($user_group_query->row['permission']);
60
-
61
-                if (is_array($permissions)) {
62
-                    foreach ($permissions as $key => $value) {
63
-                        $this->permission[$key] = $value;
64
-                    }
65
-                }
66
-            } else {
67
-                $this->logout();
68
-            }
69
-        }
70
-    }
71
-
72
-    public function login($email, $password) {
73
-        $user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE email = '" . $this->db->escape($email) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1'");
74
-
75
-        if ($user_query->num_rows) {
76
-            $this->session->data['user_id'] = $user_query->row['user_id'];
77
-
78
-            $params = json_decode($user_query->row['params'], true);
79
-
80
-            $this->session->data['theme'] = !empty($params['theme']) ? $params['theme'] : 'basic';
81
-            $this->session->data['admin_language'] = !empty($params['language']) ? $params['language'] : $this->config->get('config_admin_language');
82
-
83
-            $this->user_id = $user_query->row['user_id'];
84
-            $this->username = $user_query->row['username'];
85
-            $this->firstname = $user_query->row['firstname'];
86
-            $this->lastname = $user_query->row['lastname'];
87
-            $this->email = $user_query->row['email'];
88
-            $this->user_group_id = $user_query->row['user_group_id'];
89
-            $this->theme = !empty($params['theme']) ? $params['theme'] : 'basic';
90
-            $this->params = $params;
91
-
92
-            $user_group_query = $this->db->query("SELECT permission FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'");
93
-
94
-            $permissions = unserialize($user_group_query->row['permission']);
95
-
96
-            if (is_array($permissions)) {
97
-                foreach ($permissions as $key => $value) {
98
-                    $this->permission[$key] = $value;
99
-                }
100
-            }
101
-
102
-            // Log this login action
103
-            $name = $user_query->row['firstname'] . ' ' . $user_query->row['lastname'];
104
-            $activity_data = array('name' => $name, 'email' => $user_query->row['email'], 'user_group_id' => $user_query->row['user_group_id']);
105
-
106
-            $this->db->query("INSERT INTO `" . DB_PREFIX . "user_activity` SET `user_id` = '" . (int)$this->user_id . "', `key` = 'login', `data` = '" . $this->db->escape(json_encode($activity_data)) . "', `ip` = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', `date_added` = NOW()");
107
-
108
-            return true;
109
-        } else {
110
-            return false;
111
-        }
112
-    }
113
-
114
-    public function logout() {
115
-        unset($this->session->data['user_id']);
116
-        unset($this->session->data['theme']);
117
-
118
-        $this->user_id = '';
119
-        $this->username = '';
120
-        $this->firstname = '';
121
-        $this->lastname = '';
122
-        $this->email = '';
123
-        $this->theme = '';
124
-        $this->params = '';
125
-    }
126
-
127
-    public function hasPermission($key, $value) {
128
-        if (isset($this->permission[$key])) {
129
-            return in_array($value, $this->permission[$key]);
130
-        } else {
131
-            return false;
132
-        }
133
-    }
134
-
135
-    public function validate($action = 'modify', $route = '') {
136
-        if (empty($route) && isset($this->request->get['route'])) {
137
-            $route = $this->request->get['route'];
138
-        }
139
-
140
-        return $this->user->hasPermission($action, $route);
141
-    }
142
-
143
-    public function isLogged() {
144
-        return $this->user_id;
145
-    }
146
-
147
-    public function getId() {
148
-        return $this->user_id;
149
-    }
150
-
151
-    public function getUsername() {
152
-        return $this->username;
153
-    }
154
-
155
-    public function getFirstName() {
156
-        return $this->firstname;
157
-    }
158
-
159
-    public function getLastName() {
160
-        return $this->lastname;
161
-    }
162
-
163
-    public function getEmail() {
164
-        return $this->email;
165
-    }
166
-
167
-    public function getGroupId() {
168
-        return $this->user_group_id;
169
-    }
170
-
171
-    public function getTheme() {
172
-        return $this->theme;
173
-    }
174
-
175
-    public function getParams() {
176
-        return $this->params;
177
-    }
12
+	protected $user_id;
13
+	protected $username;
14
+	protected $firstname;
15
+	protected $lastname;
16
+	protected $email;
17
+	protected $user_group_id;
18
+	protected $theme;
19
+	protected $params;
20
+	protected $permission = array();
21
+
22
+	protected $db;
23
+	protected $config;
24
+	protected $request;
25
+	protected $session;
26
+	protected $response;
27
+
28
+	public function __construct($registry) {
29
+		$this->db = $registry->get('db');
30
+		$this->config = $registry->get('config');
31
+		$this->request = $registry->get('request');
32
+		$this->session = $registry->get('session');
33
+		$this->response = $registry->get('response');
34
+
35
+		if (isset($this->session->data['user_id'])) {
36
+			$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . (int)$this->session->data['user_id'] . "' AND status = '1'");
37
+
38
+			if ($user_query->num_rows) {
39
+				$this->user_id = $user_query->row['user_id'];
40
+				$this->username = $user_query->row['username'];
41
+				$this->firstname = $user_query->row['firstname'];
42
+				$this->lastname = $user_query->row['lastname'];
43
+				$this->email = $user_query->row['email'];
44
+				$this->user_group_id = $user_query->row['user_group_id'];
45
+
46
+				$params = json_decode($user_query->row['params'], true);
47
+
48
+				if (!isset($this->session->data['theme'])) {
49
+					$this->session->data['theme'] = !empty($params['theme']) ? $params['theme'] : 'basic';
50
+				}
51
+
52
+				$this->theme = !empty($params['theme']) ? $params['theme'] : 'basic';
53
+				$this->params = $params;
54
+
55
+				$this->db->query("UPDATE " . DB_PREFIX . "user SET ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE user_id = '" . (int)$this->session->data['user_id'] . "'");
56
+
57
+				$user_group_query = $this->db->query("SELECT permission FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'");
58
+
59
+				$permissions = unserialize($user_group_query->row['permission']);
60
+
61
+				if (is_array($permissions)) {
62
+					foreach ($permissions as $key => $value) {
63
+						$this->permission[$key] = $value;
64
+					}
65
+				}
66
+			} else {
67
+				$this->logout();
68
+			}
69
+		}
70
+	}
71
+
72
+	public function login($email, $password) {
73
+		$user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE email = '" . $this->db->escape($email) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1'");
74
+
75
+		if ($user_query->num_rows) {
76
+			$this->session->data['user_id'] = $user_query->row['user_id'];
77
+
78
+			$params = json_decode($user_query->row['params'], true);
79
+
80
+			$this->session->data['theme'] = !empty($params['theme']) ? $params['theme'] : 'basic';
81
+			$this->session->data['admin_language'] = !empty($params['language']) ? $params['language'] : $this->config->get('config_admin_language');
82
+
83
+			$this->user_id = $user_query->row['user_id'];
84
+			$this->username = $user_query->row['username'];
85
+			$this->firstname = $user_query->row['firstname'];
86
+			$this->lastname = $user_query->row['lastname'];
87
+			$this->email = $user_query->row['email'];
88
+			$this->user_group_id = $user_query->row['user_group_id'];
89
+			$this->theme = !empty($params['theme']) ? $params['theme'] : 'basic';
90
+			$this->params = $params;
91
+
92
+			$user_group_query = $this->db->query("SELECT permission FROM " . DB_PREFIX . "user_group WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'");
93
+
94
+			$permissions = unserialize($user_group_query->row['permission']);
95
+
96
+			if (is_array($permissions)) {
97
+				foreach ($permissions as $key => $value) {
98
+					$this->permission[$key] = $value;
99
+				}
100
+			}
101
+
102
+			// Log this login action
103
+			$name = $user_query->row['firstname'] . ' ' . $user_query->row['lastname'];
104
+			$activity_data = array('name' => $name, 'email' => $user_query->row['email'], 'user_group_id' => $user_query->row['user_group_id']);
105
+
106
+			$this->db->query("INSERT INTO `" . DB_PREFIX . "user_activity` SET `user_id` = '" . (int)$this->user_id . "', `key` = 'login', `data` = '" . $this->db->escape(json_encode($activity_data)) . "', `ip` = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', `date_added` = NOW()");
107
+
108
+			return true;
109
+		} else {
110
+			return false;
111
+		}
112
+	}
113
+
114
+	public function logout() {
115
+		unset($this->session->data['user_id']);
116
+		unset($this->session->data['theme']);
117
+
118
+		$this->user_id = '';
119
+		$this->username = '';
120
+		$this->firstname = '';
121
+		$this->lastname = '';
122
+		$this->email = '';
123
+		$this->theme = '';
124
+		$this->params = '';
125
+	}
126
+
127
+	public function hasPermission($key, $value) {
128
+		if (isset($this->permission[$key])) {
129
+			return in_array($value, $this->permission[$key]);
130
+		} else {
131
+			return false;
132
+		}
133
+	}
134
+
135
+	public function validate($action = 'modify', $route = '') {
136
+		if (empty($route) && isset($this->request->get['route'])) {
137
+			$route = $this->request->get['route'];
138
+		}
139
+
140
+		return $this->user->hasPermission($action, $route);
141
+	}
142
+
143
+	public function isLogged() {
144
+		return $this->user_id;
145
+	}
146
+
147
+	public function getId() {
148
+		return $this->user_id;
149
+	}
150
+
151
+	public function getUsername() {
152
+		return $this->username;
153
+	}
154
+
155
+	public function getFirstName() {
156
+		return $this->firstname;
157
+	}
158
+
159
+	public function getLastName() {
160
+		return $this->lastname;
161
+	}
162
+
163
+	public function getEmail() {
164
+		return $this->email;
165
+	}
166
+
167
+	public function getGroupId() {
168
+		return $this->user_group_id;
169
+	}
170
+
171
+	public function getTheme() {
172
+		return $this->theme;
173
+	}
174
+
175
+	public function getParams() {
176
+		return $this->params;
177
+	}
178 178
 }
Please login to merge, or discard this patch.
system/library/route.php 2 patches
Indentation   +477 added lines, -477 removed lines patch added patch discarded remove patch
@@ -10,488 +10,488 @@
 block discarded – undo
10 10
 class Route extends Object
11 11
 {
12 12
 
13
-    protected $registry;
14
-
15
-    public function __construct($registry)
16
-    {
17
-        $this->registry = $registry;
18
-    }
19
-
20
-    public function __get($key)
21
-    {
22
-        return $this->registry->get($key);
23
-    }
24
-
25
-    public function __set($key, $value)
26
-    {
27
-        $this->registry->set($key, $value);
28
-    }
29
-
30
-    public function parse()
31
-    {
32
-        // Stop if SEO is disabled
33
-        if (!$this->config->get('config_seo_url')) {
34
-            return;
35
-        }
36
-
37
-        // Attach the URL builder
38
-        $this->url->addRewrite($this);
39
-
40
-        $query_string = $this->uri->getQuery();
41
-
42
-        $route = str_replace($this->url->getFullUrl(), '', rawurldecode($this->uri->toString()));
43
-        $route = str_replace('?'.$query_string, '', $route);
44
-
45
-        // www Redirection
46
-        if ($this->config->get('config_seo_www_red')) {
47
-            $this->checkWwwRedirection();
48
-        }
49
-
50
-        // Don't parse if home page
51
-        if (empty($route)) {
52
-            $this->request->get['route'] = 'common/home';
53
-
54
-            return;
55
-        }
56
-
57
-        // Don't parse if route is already set
58
-        if (!empty($this->request->get['route'])) {
59
-            // non-SEO to SEO URLs Redirection
60
-            if ($this->config->get('config_seo_nonseo_red')) {
61
-                $this->checkNonseoRedirection($this->request->get['route']);
62
-            }
63
-
64
-            return;
65
-        }
66
-
67
-        // non-SEO variables
68
-        if (!empty($query_string)) {
69
-            $query_array = $this->uri->getQuery(true);
70
-            $this->parseNonSeoVariables($query_array);
71
-
72
-            if ($this->config->get('config_seo_canonical')) {
73
-                $canonical_link = htmlspecialchars($this->url->getDomain().$route);
74
-
75
-                $this->document->addLink($canonical_link, 'canonical');
76
-            }
77
-        }
78
-
79
-        $seo_url = str_replace('index.php', '', $route);
80
-        $seo_url = ltrim($seo_url, '/');
81
-
82
-        // Add language code to URL
83
-        $is_lang_home = false;
84
-        if ($this->config->get('config_seo_lang_code')) {
85
-            if ($seo_url == $this->session->data['language']) {
86
-                $is_lang_home = true;
87
-            }
88
-
89
-            $seo_url = ltrim($seo_url, $this->session->data['language']);
90
-            $seo_url = ltrim($seo_url, '/');
91
-        }
92
-
93
-        // URLs are stored without suffix in database
94
-        if ($this->config->get('config_seo_suffix')) {
95
-            $seo_url = substr($seo_url, 0, -5);
96
-        }
97
-
98
-        $parts = explode('/', $seo_url);
99
-
100
-        // remove any empty arrays from trailing
101
-        if (utf8_strlen(end($parts)) == 0) {
102
-            array_pop($parts);
103
-        }
104
-
105
-        $seo = new Seo($this->registry);
13
+	protected $registry;
14
+
15
+	public function __construct($registry)
16
+	{
17
+		$this->registry = $registry;
18
+	}
19
+
20
+	public function __get($key)
21
+	{
22
+		return $this->registry->get($key);
23
+	}
24
+
25
+	public function __set($key, $value)
26
+	{
27
+		$this->registry->set($key, $value);
28
+	}
29
+
30
+	public function parse()
31
+	{
32
+		// Stop if SEO is disabled
33
+		if (!$this->config->get('config_seo_url')) {
34
+			return;
35
+		}
36
+
37
+		// Attach the URL builder
38
+		$this->url->addRewrite($this);
39
+
40
+		$query_string = $this->uri->getQuery();
41
+
42
+		$route = str_replace($this->url->getFullUrl(), '', rawurldecode($this->uri->toString()));
43
+		$route = str_replace('?'.$query_string, '', $route);
44
+
45
+		// www Redirection
46
+		if ($this->config->get('config_seo_www_red')) {
47
+			$this->checkWwwRedirection();
48
+		}
49
+
50
+		// Don't parse if home page
51
+		if (empty($route)) {
52
+			$this->request->get['route'] = 'common/home';
53
+
54
+			return;
55
+		}
56
+
57
+		// Don't parse if route is already set
58
+		if (!empty($this->request->get['route'])) {
59
+			// non-SEO to SEO URLs Redirection
60
+			if ($this->config->get('config_seo_nonseo_red')) {
61
+				$this->checkNonseoRedirection($this->request->get['route']);
62
+			}
63
+
64
+			return;
65
+		}
66
+
67
+		// non-SEO variables
68
+		if (!empty($query_string)) {
69
+			$query_array = $this->uri->getQuery(true);
70
+			$this->parseNonSeoVariables($query_array);
71
+
72
+			if ($this->config->get('config_seo_canonical')) {
73
+				$canonical_link = htmlspecialchars($this->url->getDomain().$route);
74
+
75
+				$this->document->addLink($canonical_link, 'canonical');
76
+			}
77
+		}
78
+
79
+		$seo_url = str_replace('index.php', '', $route);
80
+		$seo_url = ltrim($seo_url, '/');
81
+
82
+		// Add language code to URL
83
+		$is_lang_home = false;
84
+		if ($this->config->get('config_seo_lang_code')) {
85
+			if ($seo_url == $this->session->data['language']) {
86
+				$is_lang_home = true;
87
+			}
88
+
89
+			$seo_url = ltrim($seo_url, $this->session->data['language']);
90
+			$seo_url = ltrim($seo_url, '/');
91
+		}
92
+
93
+		// URLs are stored without suffix in database
94
+		if ($this->config->get('config_seo_suffix')) {
95
+			$seo_url = substr($seo_url, 0, -5);
96
+		}
97
+
98
+		$parts = explode('/', $seo_url);
99
+
100
+		// remove any empty arrays from trailing
101
+		if (utf8_strlen(end($parts)) == 0) {
102
+			array_pop($parts);
103
+		}
104
+
105
+		$seo = new Seo($this->registry);
106 106
         
107
-        foreach ($parts as $part) {
108
-            $query = $seo->getAliasQuery($part);
109
-
110
-            if (!empty($query) && strstr($query, '=')) {
111
-                $url = explode('=', $query);
112
-
113
-                switch ($url[0]) {
114
-                    case 'product_id':
115
-                        $this->request->get['product_id'] = $url[1];
116
-
117
-                        if (!$this->config->get('config_seo_category')) {
118
-                            $categories = array();
119
-
120
-                            $category_id = $seo->getCategoryIdBySortOrder($url[1]);
121
-
122
-                            if (!is_null($category_id)) {
123
-                                $categories = $seo->getParentCategoriesIds($category_id);
124
-
125
-                                $categories[] = $category_id;
126
-                            }
127
-
128
-                            if (!empty($categories)) {
129
-                                $this->request->get['path'] = implode('_', $categories);
130
-                            }
131
-                        }
132
-                        break;
133
-                    case 'category_id':
134
-                        if ($this->config->get('config_seo_category') == 'last') {
135
-                            $categories = $seo->getParentCategoriesIds($url[1]);
136
-
137
-                            $categories[] = $url[1];
138
-
139
-                            if (!empty($categories)) {
140
-                                $this->request->get['path'] = implode('_', $categories);
141
-                            }
142
-                        } else {
143
-                            if (!isset($this->request->get['path'])) {
144
-                                $this->request->get['path'] = $url[1];
145
-                            } else {
146
-                                $this->request->get['path'] .= '_' . $url[1];
147
-                            }
148
-                        }
149
-                        break;
150
-                    case 'blog_category_id':
151
-                        $this->request->get['route'] = 'blog/category';
152
-
153
-                        if ($this->config->get('config_seo_category') == 'last') {
154
-                            $categories = $seo->getParentCategoriesIds($url[1], 'blog_');
155
-
156
-                            $categories[] = $url[1];
157
-
158
-                            if (!empty($categories)) {
159
-                                $this->request->get['path'] = implode('_', $categories);
160
-                            }
161
-                        } else {
162
-                            if (!isset($this->request->get['path'])) {
163
-                                $this->request->get['path'] = $url[1];
164
-                            } else {
165
-                                $this->request->get['path'] .= '_' . $url[1];
166
-                            }
167
-                        }
168
-                        break;
169
-                    case 'blog_post_id':
170
-                        $this->request->get['route'] = 'blog/post';
171
-                        $this->request->get['post_id'] = $url[1];
172
-                        break;
173
-                    case 'manufacturer_id':
174
-                    case 'information_id':
175
-                    case 'route':
176
-                    default:
177
-                        $this->request->get[$url[0]] = $url[1];
178
-                        break;
179
-                }
180
-            } elseif ($is_lang_home) {
181
-                $this->request->get['route'] = 'common/home';
182
-
183
-                break;
184
-            } else {
185
-                $this->request->get['route'] = $seo_url;
186
-
187
-                break;
188
-            }
189
-        }
190
-
191
-        if (!isset($this->request->get['route'])) {
192
-            if (isset($this->request->get['product_id'])) {
193
-                $this->request->get['route'] = 'product/product';
194
-            } elseif (isset($this->request->get['path'])) {
195
-                $this->request->get['route'] = 'product/category';
196
-            } elseif (isset($this->request->get['manufacturer_id'])) {
197
-                $this->request->get['route'] = 'product/manufacturer/info';
198
-            } elseif (isset($this->request->get['information_id'])) {
199
-                $this->request->get['route'] = 'information/information';
200
-            }
201
-        }
202
-
203
-        unset($this->request->get['_route_']); // For B/C purpose
204
-    }
205
-
206
-    public function rewrite($link)
207
-    {
208
-        $url = '';
209
-        $is_home = false;
210
-
211
-        // common/currency, $data['redirect']
212
-        $link = str_replace('amp;amp;', 'amp;', $link);
213
-
214
-        $uri = new Uri($link);
215
-
216
-        if ($uri->getVar('route')) {
217
-            $seo = new Seo($this->registry);
218
-
219
-            switch ($uri->getVar('route')) {
220
-                case 'common/home':
221
-                    $is_home = true;
222
-                    break;
223
-                case 'product/product':
224
-                    if ($this->config->get('config_seo_category')) {
225
-                        if ($uri->getVar('path') && ($this->config->get('config_seo_category') == 'last')) {
226
-                            $categories = explode('_', $uri->getVar('path'));
227
-
228
-                            $categories = array(end($categories));
229
-                        } else {
230
-                            $categories = array();
231
-
232
-                            $category_id = $seo->getCategoryIdBySortOrder($uri->getVar('product_id'));
233
-
234
-                            if (!is_null($category_id)) {
235
-                                $categories = $seo->getParentCategoriesIds($category_id);
236
-
237
-                                $categories[] = $category_id;
238
-
239
-                                if ($this->config->get('config_seo_category') == 'last') {
240
-                                    $categories = array(end($categories));
241
-                                }
242
-                            }
243
-                        }
244
-
245
-                        foreach ($categories as $category) {
246
-                            $alias = $seo->getAlias($category, 'category');
247
-
248
-                            if ($alias) {
249
-                                $url .= '/' . $alias;
250
-                            }
251
-                        }
252
-
253
-                        $uri->delVar('path');
254
-                    }
255
-
256
-                    if ($uri->getVar('product_id')) {
257
-                        $alias = $seo->getAlias($uri->getVar('product_id'), 'product');
258
-
259
-                        if ($alias) {
260
-                            $url .= '/' . $alias;
261
-                        }
262
-
263
-                        $uri->delVar('product_id');
264
-                        $uri->delVar('manufacturer_id');
265
-                        $uri->delVar('path');
266
-                        $uri->delVar('search');
267
-                    }
268
-                    break;
269
-                case 'product/category':
270
-                    if ($uri->getVar('path')) {
271
-                        $categories = explode('_', $uri->getVar('path'));
272
-
273
-                        foreach ($categories as $category) {
274
-                            $alias = $seo->getAlias($category, 'category');
275
-
276
-                            if ($alias) {
277
-                                $url .= '/' . $alias;
278
-                            }
279
-                        }
280
-
281
-                        $uri->delVar('path');
282
-                    }
283
-                    break;
284
-                case 'information/information':
285
-                    if ($uri->getVar('information_id')) {
286
-                        $alias = $seo->getAlias($uri->getVar('information_id'), 'information');
287
-
288
-                        if ($alias) {
289
-                            $url .= '/' . $alias;
290
-                        }
291
-
292
-                        $uri->delVar('information_id');
293
-                    }
294
-                    break;
295
-                case 'product/manufacturer/info':
296
-                    if ($uri->getVar('manufacturer_id')) {
297
-                        $alias = $seo->getAlias($uri->getVar('manufacturer_id'), 'manufacturer');
298
-
299
-                        if ($alias) {
300
-                            $url .= '/' . $alias;
301
-                        }
302
-
303
-                        $uri->delVar('manufacturer_id');
304
-                    }
305
-                    break;
306
-                case 'blog/category':
307
-                    if ($uri->getVar('path')) {
308
-                        // Add blog home first
309
-                        $blog_home = $seo->getAlias('route=blog/home', 'other');
310
-
311
-                        if ($blog_home) {
312
-                            $url .= '/' . $blog_home;
313
-                        }
314
-
315
-                        $categories = explode('_', $uri->getVar('path'));
316
-
317
-                        foreach ($categories as $category) {
318
-                            $alias = $seo->getAlias($category, 'blog_category');
319
-
320
-                            if ($alias) {
321
-                                $url .= '/' . $alias;
322
-                            }
323
-                        }
324
-
325
-                        $uri->delVar('path');
326
-                    }
327
-                    break;
328
-                case 'blog/post':
329
-                    if ($uri->getVar('post_id')) {
330
-                        // Add blog home first
331
-                        $blog_home = $seo->getAlias('route=blog/home', 'other');
332
-
333
-                        if ($blog_home) {
334
-                            $url .= '/' . $blog_home;
335
-                        }
336
-
337
-                        $alias = $seo->getAlias($uri->getVar('post_id'), 'blog_post');
338
-
339
-                        if ($alias) {
340
-                            $url .= '/' . $alias;
341
-                        }
342
-
343
-                        $uri->delVar('post_id');
344
-                    }
345
-                    break;
346
-                default:
347
-                    $route = $uri->getVar('route');
348
-
349
-                    if (!$this->seoDisabled($route)) {
350
-                        $alias = $seo->getAlias('route='.$route, 'other');
351
-
352
-                        if (!empty($alias)) {
353
-                            $alias = str_replace('route=', '', $alias);
354
-
355
-                            $url = '/' . $alias;
356
-                        } else {
357
-                            $url = '/' . $route;
358
-                        }
359
-                    }
360
-
361
-                    break;
362
-            }
363
-
364
-            $uri->delVar('route');
365
-        }
366
-
367
-        if ($url || $is_home) {
368
-            // Add language code to URL
369
-            if ($this->config->get('config_seo_lang_code')) {
370
-                $url = '/'.$this->session->data['language'].$url;
371
-            }
372
-            $uri->delVar('lang');
373
-
374
-            // Append the suffix if enabled
375
-            if ($this->config->get('config_seo_suffix') && !$is_home) {
376
-                $url .= '.html';
377
-            }
378
-
379
-            $path = $uri->getPath();
380
-
381
-            if ($this->config->get('config_seo_rewrite') || ($is_home && !$this->config->get('config_seo_lang_code'))) {
382
-                $path = str_replace('index.php/', '', $path);
383
-                $path = str_replace('index.php', '', $path);
384
-            }
385
-
386
-            $path .= $url;
387
-
388
-            $uri->setPath($path);
389
-
390
-            return $uri->toString();
391
-        } else {
392
-            return $link;
393
-        }
394
-    }
395
-
396
-    public function checkNonseoRedirection($route)
397
-    {
398
-        if ($this->seoDisabled($route)) {
399
-            return;
400
-        }
401
-
402
-        $domain = $this->url->getDomain();
403
-
404
-        // Home page, redirect to domain with empty query
405
-        if ($route == 'common/home') {
406
-            $url = $this->rewrite($domain);
407
-
408
-            $this->response->redirect($url, 301);
409
-        } else {
410
-            $url_data = $this->request->get;
411
-            unset($url_data['lang']);
412
-            unset($url_data['_route_']); // For B/C purpose
413
-
414
-            if (!isset($url_data['route'])) {
415
-                $url_data['route'] = 'common/home';
416
-            }
417
-
418
-            $query = '';
419
-            if ($url_data) {
420
-                $query = 'index.php?'.urldecode(http_build_query($url_data, '', '&'));
421
-            }
422
-
423
-            $url = $domain.$query;
424
-
425
-            $url = $this->rewrite($url);
426
-
427
-            $this->response->redirect($url, 301);
428
-        }
429
-    }
430
-
431
-    public function checkWwwRedirection()
432
-    {
433
-        $redirect = false;
434
-
435
-        $host = $this->uri->getHost();
436
-
437
-        $www_red = $this->config->get('config_seo_www_red');
438
-        if (($www_red == 'with') and (strpos($host, 'www') !== 0)) {
439
-            $redirect = true;
440
-            $this->uri->setHost('www.'.$host);
441
-        } elseif (($www_red == 'non') and strpos($host, 'www') === 0) {
442
-            $redirect = true;
443
-            $this->uri->setHost(substr($host, 4, strlen($host)));
444
-        }
445
-
446
-        if ($redirect === false) {
447
-            return;
448
-        }
449
-
450
-        $this->response->redirect($this->uri->toString(), 301);
451
-    }
452
-
453
-    public function parseNonSeoVariables($query)
454
-    {
455
-        if (empty($query)) {
456
-            return;
457
-        }
458
-
459
-        foreach ($query as $variable => $value) {
460
-            if (is_array($value)) {
461
-                $this->parseNonSeoVariables($value);
462
-            } else {
463
-                // Removed as it breaks search and seems to be out of purpose
464
-                //$value = urlencode($value);
465
-
466
-                $this->request->get[$variable] = $value;
467
-            }
468
-        }
469
-    }
470
-
471
-    public function seoDisabled($route = '')
472
-    {
473
-        if (IS_ADMIN == true) {
474
-            return true;
475
-        }
476
-
477
-        // Do not generate SEO URLs if format available, to be used for format=raw, format=json etc
478
-        /*if (isset($this->request->get['format'])) {
107
+		foreach ($parts as $part) {
108
+			$query = $seo->getAliasQuery($part);
109
+
110
+			if (!empty($query) && strstr($query, '=')) {
111
+				$url = explode('=', $query);
112
+
113
+				switch ($url[0]) {
114
+					case 'product_id':
115
+						$this->request->get['product_id'] = $url[1];
116
+
117
+						if (!$this->config->get('config_seo_category')) {
118
+							$categories = array();
119
+
120
+							$category_id = $seo->getCategoryIdBySortOrder($url[1]);
121
+
122
+							if (!is_null($category_id)) {
123
+								$categories = $seo->getParentCategoriesIds($category_id);
124
+
125
+								$categories[] = $category_id;
126
+							}
127
+
128
+							if (!empty($categories)) {
129
+								$this->request->get['path'] = implode('_', $categories);
130
+							}
131
+						}
132
+						break;
133
+					case 'category_id':
134
+						if ($this->config->get('config_seo_category') == 'last') {
135
+							$categories = $seo->getParentCategoriesIds($url[1]);
136
+
137
+							$categories[] = $url[1];
138
+
139
+							if (!empty($categories)) {
140
+								$this->request->get['path'] = implode('_', $categories);
141
+							}
142
+						} else {
143
+							if (!isset($this->request->get['path'])) {
144
+								$this->request->get['path'] = $url[1];
145
+							} else {
146
+								$this->request->get['path'] .= '_' . $url[1];
147
+							}
148
+						}
149
+						break;
150
+					case 'blog_category_id':
151
+						$this->request->get['route'] = 'blog/category';
152
+
153
+						if ($this->config->get('config_seo_category') == 'last') {
154
+							$categories = $seo->getParentCategoriesIds($url[1], 'blog_');
155
+
156
+							$categories[] = $url[1];
157
+
158
+							if (!empty($categories)) {
159
+								$this->request->get['path'] = implode('_', $categories);
160
+							}
161
+						} else {
162
+							if (!isset($this->request->get['path'])) {
163
+								$this->request->get['path'] = $url[1];
164
+							} else {
165
+								$this->request->get['path'] .= '_' . $url[1];
166
+							}
167
+						}
168
+						break;
169
+					case 'blog_post_id':
170
+						$this->request->get['route'] = 'blog/post';
171
+						$this->request->get['post_id'] = $url[1];
172
+						break;
173
+					case 'manufacturer_id':
174
+					case 'information_id':
175
+					case 'route':
176
+					default:
177
+						$this->request->get[$url[0]] = $url[1];
178
+						break;
179
+				}
180
+			} elseif ($is_lang_home) {
181
+				$this->request->get['route'] = 'common/home';
182
+
183
+				break;
184
+			} else {
185
+				$this->request->get['route'] = $seo_url;
186
+
187
+				break;
188
+			}
189
+		}
190
+
191
+		if (!isset($this->request->get['route'])) {
192
+			if (isset($this->request->get['product_id'])) {
193
+				$this->request->get['route'] = 'product/product';
194
+			} elseif (isset($this->request->get['path'])) {
195
+				$this->request->get['route'] = 'product/category';
196
+			} elseif (isset($this->request->get['manufacturer_id'])) {
197
+				$this->request->get['route'] = 'product/manufacturer/info';
198
+			} elseif (isset($this->request->get['information_id'])) {
199
+				$this->request->get['route'] = 'information/information';
200
+			}
201
+		}
202
+
203
+		unset($this->request->get['_route_']); // For B/C purpose
204
+	}
205
+
206
+	public function rewrite($link)
207
+	{
208
+		$url = '';
209
+		$is_home = false;
210
+
211
+		// common/currency, $data['redirect']
212
+		$link = str_replace('amp;amp;', 'amp;', $link);
213
+
214
+		$uri = new Uri($link);
215
+
216
+		if ($uri->getVar('route')) {
217
+			$seo = new Seo($this->registry);
218
+
219
+			switch ($uri->getVar('route')) {
220
+				case 'common/home':
221
+					$is_home = true;
222
+					break;
223
+				case 'product/product':
224
+					if ($this->config->get('config_seo_category')) {
225
+						if ($uri->getVar('path') && ($this->config->get('config_seo_category') == 'last')) {
226
+							$categories = explode('_', $uri->getVar('path'));
227
+
228
+							$categories = array(end($categories));
229
+						} else {
230
+							$categories = array();
231
+
232
+							$category_id = $seo->getCategoryIdBySortOrder($uri->getVar('product_id'));
233
+
234
+							if (!is_null($category_id)) {
235
+								$categories = $seo->getParentCategoriesIds($category_id);
236
+
237
+								$categories[] = $category_id;
238
+
239
+								if ($this->config->get('config_seo_category') == 'last') {
240
+									$categories = array(end($categories));
241
+								}
242
+							}
243
+						}
244
+
245
+						foreach ($categories as $category) {
246
+							$alias = $seo->getAlias($category, 'category');
247
+
248
+							if ($alias) {
249
+								$url .= '/' . $alias;
250
+							}
251
+						}
252
+
253
+						$uri->delVar('path');
254
+					}
255
+
256
+					if ($uri->getVar('product_id')) {
257
+						$alias = $seo->getAlias($uri->getVar('product_id'), 'product');
258
+
259
+						if ($alias) {
260
+							$url .= '/' . $alias;
261
+						}
262
+
263
+						$uri->delVar('product_id');
264
+						$uri->delVar('manufacturer_id');
265
+						$uri->delVar('path');
266
+						$uri->delVar('search');
267
+					}
268
+					break;
269
+				case 'product/category':
270
+					if ($uri->getVar('path')) {
271
+						$categories = explode('_', $uri->getVar('path'));
272
+
273
+						foreach ($categories as $category) {
274
+							$alias = $seo->getAlias($category, 'category');
275
+
276
+							if ($alias) {
277
+								$url .= '/' . $alias;
278
+							}
279
+						}
280
+
281
+						$uri->delVar('path');
282
+					}
283
+					break;
284
+				case 'information/information':
285
+					if ($uri->getVar('information_id')) {
286
+						$alias = $seo->getAlias($uri->getVar('information_id'), 'information');
287
+
288
+						if ($alias) {
289
+							$url .= '/' . $alias;
290
+						}
291
+
292
+						$uri->delVar('information_id');
293
+					}
294
+					break;
295
+				case 'product/manufacturer/info':
296
+					if ($uri->getVar('manufacturer_id')) {
297
+						$alias = $seo->getAlias($uri->getVar('manufacturer_id'), 'manufacturer');
298
+
299
+						if ($alias) {
300
+							$url .= '/' . $alias;
301
+						}
302
+
303
+						$uri->delVar('manufacturer_id');
304
+					}
305
+					break;
306
+				case 'blog/category':
307
+					if ($uri->getVar('path')) {
308
+						// Add blog home first
309
+						$blog_home = $seo->getAlias('route=blog/home', 'other');
310
+
311
+						if ($blog_home) {
312
+							$url .= '/' . $blog_home;
313
+						}
314
+
315
+						$categories = explode('_', $uri->getVar('path'));
316
+
317
+						foreach ($categories as $category) {
318
+							$alias = $seo->getAlias($category, 'blog_category');
319
+
320
+							if ($alias) {
321
+								$url .= '/' . $alias;
322
+							}
323
+						}
324
+
325
+						$uri->delVar('path');
326
+					}
327
+					break;
328
+				case 'blog/post':
329
+					if ($uri->getVar('post_id')) {
330
+						// Add blog home first
331
+						$blog_home = $seo->getAlias('route=blog/home', 'other');
332
+
333
+						if ($blog_home) {
334
+							$url .= '/' . $blog_home;
335
+						}
336
+
337
+						$alias = $seo->getAlias($uri->getVar('post_id'), 'blog_post');
338
+
339
+						if ($alias) {
340
+							$url .= '/' . $alias;
341
+						}
342
+
343
+						$uri->delVar('post_id');
344
+					}
345
+					break;
346
+				default:
347
+					$route = $uri->getVar('route');
348
+
349
+					if (!$this->seoDisabled($route)) {
350
+						$alias = $seo->getAlias('route='.$route, 'other');
351
+
352
+						if (!empty($alias)) {
353
+							$alias = str_replace('route=', '', $alias);
354
+
355
+							$url = '/' . $alias;
356
+						} else {
357
+							$url = '/' . $route;
358
+						}
359
+					}
360
+
361
+					break;
362
+			}
363
+
364
+			$uri->delVar('route');
365
+		}
366
+
367
+		if ($url || $is_home) {
368
+			// Add language code to URL
369
+			if ($this->config->get('config_seo_lang_code')) {
370
+				$url = '/'.$this->session->data['language'].$url;
371
+			}
372
+			$uri->delVar('lang');
373
+
374
+			// Append the suffix if enabled
375
+			if ($this->config->get('config_seo_suffix') && !$is_home) {
376
+				$url .= '.html';
377
+			}
378
+
379
+			$path = $uri->getPath();
380
+
381
+			if ($this->config->get('config_seo_rewrite') || ($is_home && !$this->config->get('config_seo_lang_code'))) {
382
+				$path = str_replace('index.php/', '', $path);
383
+				$path = str_replace('index.php', '', $path);
384
+			}
385
+
386
+			$path .= $url;
387
+
388
+			$uri->setPath($path);
389
+
390
+			return $uri->toString();
391
+		} else {
392
+			return $link;
393
+		}
394
+	}
395
+
396
+	public function checkNonseoRedirection($route)
397
+	{
398
+		if ($this->seoDisabled($route)) {
399
+			return;
400
+		}
401
+
402
+		$domain = $this->url->getDomain();
403
+
404
+		// Home page, redirect to domain with empty query
405
+		if ($route == 'common/home') {
406
+			$url = $this->rewrite($domain);
407
+
408
+			$this->response->redirect($url, 301);
409
+		} else {
410
+			$url_data = $this->request->get;
411
+			unset($url_data['lang']);
412
+			unset($url_data['_route_']); // For B/C purpose
413
+
414
+			if (!isset($url_data['route'])) {
415
+				$url_data['route'] = 'common/home';
416
+			}
417
+
418
+			$query = '';
419
+			if ($url_data) {
420
+				$query = 'index.php?'.urldecode(http_build_query($url_data, '', '&'));
421
+			}
422
+
423
+			$url = $domain.$query;
424
+
425
+			$url = $this->rewrite($url);
426
+
427
+			$this->response->redirect($url, 301);
428
+		}
429
+	}
430
+
431
+	public function checkWwwRedirection()
432
+	{
433
+		$redirect = false;
434
+
435
+		$host = $this->uri->getHost();
436
+
437
+		$www_red = $this->config->get('config_seo_www_red');
438
+		if (($www_red == 'with') and (strpos($host, 'www') !== 0)) {
439
+			$redirect = true;
440
+			$this->uri->setHost('www.'.$host);
441
+		} elseif (($www_red == 'non') and strpos($host, 'www') === 0) {
442
+			$redirect = true;
443
+			$this->uri->setHost(substr($host, 4, strlen($host)));
444
+		}
445
+
446
+		if ($redirect === false) {
447
+			return;
448
+		}
449
+
450
+		$this->response->redirect($this->uri->toString(), 301);
451
+	}
452
+
453
+	public function parseNonSeoVariables($query)
454
+	{
455
+		if (empty($query)) {
456
+			return;
457
+		}
458
+
459
+		foreach ($query as $variable => $value) {
460
+			if (is_array($value)) {
461
+				$this->parseNonSeoVariables($value);
462
+			} else {
463
+				// Removed as it breaks search and seems to be out of purpose
464
+				//$value = urlencode($value);
465
+
466
+				$this->request->get[$variable] = $value;
467
+			}
468
+		}
469
+	}
470
+
471
+	public function seoDisabled($route = '')
472
+	{
473
+		if (IS_ADMIN == true) {
474
+			return true;
475
+		}
476
+
477
+		// Do not generate SEO URLs if format available, to be used for format=raw, format=json etc
478
+		/*if (isset($this->request->get['format'])) {
479 479
             return true;
480 480
         }*/
481 481
 
482
-        // Do not generate SEO URLs for special routes (payments, feeds)
483
-        $disabled_routes = array('payment/', 'feed/');
482
+		// Do not generate SEO URLs for special routes (payments, feeds)
483
+		$disabled_routes = array('payment/', 'feed/');
484 484
 
485
-        foreach($disabled_routes as $disabled_route) {
486
-            if (substr($route, 0, strlen($disabled_route)) == $disabled_route) {
487
-                return true;
488
-            }
489
-        }
485
+		foreach($disabled_routes as $disabled_route) {
486
+			if (substr($route, 0, strlen($disabled_route)) == $disabled_route) {
487
+				return true;
488
+			}
489
+		}
490 490
 
491
-        if ($this->request->isAjax()) {
492
-            return true;
493
-        }
491
+		if ($this->request->isAjax()) {
492
+			return true;
493
+		}
494 494
 
495
-        return false;
496
-    }
495
+		return false;
496
+	}
497 497
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                             if (!isset($this->request->get['path'])) {
144 144
                                 $this->request->get['path'] = $url[1];
145 145
                             } else {
146
-                                $this->request->get['path'] .= '_' . $url[1];
146
+                                $this->request->get['path'] .= '_'.$url[1];
147 147
                             }
148 148
                         }
149 149
                         break;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                             if (!isset($this->request->get['path'])) {
163 163
                                 $this->request->get['path'] = $url[1];
164 164
                             } else {
165
-                                $this->request->get['path'] .= '_' . $url[1];
165
+                                $this->request->get['path'] .= '_'.$url[1];
166 166
                             }
167 167
                         }
168 168
                         break;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                             $alias = $seo->getAlias($category, 'category');
247 247
 
248 248
                             if ($alias) {
249
-                                $url .= '/' . $alias;
249
+                                $url .= '/'.$alias;
250 250
                             }
251 251
                         }
252 252
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                         $alias = $seo->getAlias($uri->getVar('product_id'), 'product');
258 258
 
259 259
                         if ($alias) {
260
-                            $url .= '/' . $alias;
260
+                            $url .= '/'.$alias;
261 261
                         }
262 262
 
263 263
                         $uri->delVar('product_id');
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                             $alias = $seo->getAlias($category, 'category');
275 275
 
276 276
                             if ($alias) {
277
-                                $url .= '/' . $alias;
277
+                                $url .= '/'.$alias;
278 278
                             }
279 279
                         }
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                         $alias = $seo->getAlias($uri->getVar('information_id'), 'information');
287 287
 
288 288
                         if ($alias) {
289
-                            $url .= '/' . $alias;
289
+                            $url .= '/'.$alias;
290 290
                         }
291 291
 
292 292
                         $uri->delVar('information_id');
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                         $alias = $seo->getAlias($uri->getVar('manufacturer_id'), 'manufacturer');
298 298
 
299 299
                         if ($alias) {
300
-                            $url .= '/' . $alias;
300
+                            $url .= '/'.$alias;
301 301
                         }
302 302
 
303 303
                         $uri->delVar('manufacturer_id');
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                         $blog_home = $seo->getAlias('route=blog/home', 'other');
310 310
 
311 311
                         if ($blog_home) {
312
-                            $url .= '/' . $blog_home;
312
+                            $url .= '/'.$blog_home;
313 313
                         }
314 314
 
315 315
                         $categories = explode('_', $uri->getVar('path'));
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
                             $alias = $seo->getAlias($category, 'blog_category');
319 319
 
320 320
                             if ($alias) {
321
-                                $url .= '/' . $alias;
321
+                                $url .= '/'.$alias;
322 322
                             }
323 323
                         }
324 324
 
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
                         $blog_home = $seo->getAlias('route=blog/home', 'other');
332 332
 
333 333
                         if ($blog_home) {
334
-                            $url .= '/' . $blog_home;
334
+                            $url .= '/'.$blog_home;
335 335
                         }
336 336
 
337 337
                         $alias = $seo->getAlias($uri->getVar('post_id'), 'blog_post');
338 338
 
339 339
                         if ($alias) {
340
-                            $url .= '/' . $alias;
340
+                            $url .= '/'.$alias;
341 341
                         }
342 342
 
343 343
                         $uri->delVar('post_id');
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
                         if (!empty($alias)) {
353 353
                             $alias = str_replace('route=', '', $alias);
354 354
 
355
-                            $url = '/' . $alias;
355
+                            $url = '/'.$alias;
356 356
                         } else {
357
-                            $url = '/' . $route;
357
+                            $url = '/'.$route;
358 358
                         }
359 359
                     }
360 360
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         // Do not generate SEO URLs for special routes (payments, feeds)
483 483
         $disabled_routes = array('payment/', 'feed/');
484 484
 
485
-        foreach($disabled_routes as $disabled_route) {
485
+        foreach ($disabled_routes as $disabled_route) {
486 486
             if (substr($route, 0, strlen($disabled_route)) == $disabled_route) {
487 487
                 return true;
488 488
             }
Please login to merge, or discard this patch.
system/library/seo.php 2 patches
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -10,250 +10,250 @@
 block discarded – undo
10 10
 class Seo extends Object
11 11
 {
12 12
 
13
-    protected $registry;
14
-
15
-    public function __construct($registry)
16
-    {
17
-        $this->registry = $registry;
18
-    }
19
-
20
-    public function __get($key)
21
-    {
22
-        return $this->registry->get($key);
23
-    }
24
-
25
-    public function __set($key, $value)
26
-    {
27
-        $this->registry->set($key, $value);
28
-    }
29
-
30
-    public function getAlias($id, $type = 'product')
31
-    {
32
-        static $rows = array('product' => array(), 'category' => array(), 'manufacturer' => array(), 'information' => array(), 'blog_post' => array(), 'blog_category' => array(), 'other' => array());
13
+	protected $registry;
14
+
15
+	public function __construct($registry)
16
+	{
17
+		$this->registry = $registry;
18
+	}
19
+
20
+	public function __get($key)
21
+	{
22
+		return $this->registry->get($key);
23
+	}
24
+
25
+	public function __set($key, $value)
26
+	{
27
+		$this->registry->set($key, $value);
28
+	}
29
+
30
+	public function getAlias($id, $type = 'product')
31
+	{
32
+		static $rows = array('product' => array(), 'category' => array(), 'manufacturer' => array(), 'information' => array(), 'blog_post' => array(), 'blog_category' => array(), 'other' => array());
33 33
         
34
-        if ($type == 'other') {
35
-            $query = $id;
36
-        } else {
37
-            $id = intval($id);
34
+		if ($type == 'other') {
35
+			$query = $id;
36
+		} else {
37
+			$id = intval($id);
38 38
 
39
-            if (empty($id)) {
40
-                return '';
41
-            }
39
+			if (empty($id)) {
40
+				return '';
41
+			}
42 42
 
43
-            $query = $type.'_id='.$id;
44
-        }
43
+			$query = $type.'_id='.$id;
44
+		}
45 45
 
46
-        if (!isset($rows[$type][$id])) {
47
-            $results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = '" . $this->db->escape($query) . "'");
46
+		if (!isset($rows[$type][$id])) {
47
+			$results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = '" . $this->db->escape($query) . "'");
48 48
 
49
-            if ($results->num_rows) {
50
-                $tmp = '';
51
-                $found = '';
49
+			if ($results->num_rows) {
50
+				$tmp = '';
51
+				$found = '';
52 52
 
53
-                // Get the language id
54
-                $lang_id = $this->getLanguageId();
53
+				// Get the language id
54
+				$lang_id = $this->getLanguageId();
55 55
 
56
-                foreach ($results->rows as $result) {
57
-                    if (!$result['keyword']) {
58
-                        continue;
59
-                    }
56
+				foreach ($results->rows as $result) {
57
+					if (!$result['keyword']) {
58
+						continue;
59
+					}
60 60
 
61
-                    $tmp = $result['keyword'];
61
+					$tmp = $result['keyword'];
62 62
 
63
-                    if ($result['language_id'] != $lang_id) {
64
-                        continue;
65
-                    }
63
+					if ($result['language_id'] != $lang_id) {
64
+						continue;
65
+					}
66 66
 
67
-                    $found = $result['keyword'];
67
+					$found = $result['keyword'];
68 68
 
69
-                    break;
70
-                }
69
+					break;
70
+				}
71 71
 
72
-                $alias = !empty($found) ? $found : $tmp;
73
-            } else {
74
-                if ($type == 'other') {
75
-                    $alias = $id;
76
-                } else {
77
-                    $alias = $type.'-'.$id;
78
-                }
79
-            }
72
+				$alias = !empty($found) ? $found : $tmp;
73
+			} else {
74
+				if ($type == 'other') {
75
+					$alias = $id;
76
+				} else {
77
+					$alias = $type.'-'.$id;
78
+				}
79
+			}
80 80
 
81
-            $rows[$type][$id] = $alias;
82
-        }
81
+			$rows[$type][$id] = $alias;
82
+		}
83 83
 
84
-        return $rows[$type][$id];
85
-    }
84
+		return $rows[$type][$id];
85
+	}
86 86
 
87
-    public function getAliasQuery($keyword)
88
-    {
89
-        $query = false;
87
+	public function getAliasQuery($keyword)
88
+	{
89
+		$query = false;
90 90
 
91
-        $results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($keyword) . "'");
91
+		$results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($keyword) . "'");
92 92
 
93
-        if ($results->num_rows) {
94
-            $tmp = '';
95
-            $found = '';
93
+		if ($results->num_rows) {
94
+			$tmp = '';
95
+			$found = '';
96 96
 
97
-            // Get the language id
98
-            $lang_id = $this->getLanguageId();
97
+			// Get the language id
98
+			$lang_id = $this->getLanguageId();
99 99
 
100
-            foreach ($results->rows as $result) {
101
-                if (!$result['query']) {
102
-                    continue;
103
-                }
100
+			foreach ($results->rows as $result) {
101
+				if (!$result['query']) {
102
+					continue;
103
+				}
104 104
 
105
-                $tmp = $result['query'];
105
+				$tmp = $result['query'];
106 106
 
107
-                if ($result['language_id'] != $lang_id) {
108
-                    continue;
109
-                }
107
+				if ($result['language_id'] != $lang_id) {
108
+					continue;
109
+				}
110 110
 
111
-                $found = $result['query'];
111
+				$found = $result['query'];
112 112
 
113
-                break;
114
-            }
113
+				break;
114
+			}
115 115
 
116
-            $query = !empty($found) ? $found : $tmp;
117
-        } elseif (strpos($keyword, '-')) {
118
-            $tmp = explode('-', $keyword);
119
-            $routes = array('product', 'category', 'manufacturer', 'information', 'blog_post', 'blog_category');
116
+			$query = !empty($found) ? $found : $tmp;
117
+		} elseif (strpos($keyword, '-')) {
118
+			$tmp = explode('-', $keyword);
119
+			$routes = array('product', 'category', 'manufacturer', 'information', 'blog_post', 'blog_category');
120 120
 
121
-            if (!empty($tmp[0]) && in_array($tmp[0], $routes) && !empty($tmp[1]) && is_numeric($tmp[1])) {
122
-                $query = $tmp[0].'_id='.$tmp[1];
123
-            }
124
-        }
121
+			if (!empty($tmp[0]) && in_array($tmp[0], $routes) && !empty($tmp[1]) && is_numeric($tmp[1])) {
122
+				$query = $tmp[0].'_id='.$tmp[1];
123
+			}
124
+		}
125 125
 
126
-        return $query;
127
-    }
126
+		return $query;
127
+	}
128 128
 
129
-    public function getLanguageId()
130
-    {
131
-        static $data = array();
129
+	public function getLanguageId()
130
+	{
131
+		static $data = array();
132 132
 
133
-        if ($this->config->get('config_seo_translate')) {
134
-            $code = $this->session->data['language'];
135
-        } else {
136
-            $code = $this->config->get('config_language');
137
-        }
133
+		if ($this->config->get('config_seo_translate')) {
134
+			$code = $this->session->data['language'];
135
+		} else {
136
+			$code = $this->config->get('config_language');
137
+		}
138 138
 
139
-        if (!isset($data[$code])) {
140
-            $sql = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' AND code = '" . $this->db->escape($code) . "' LIMIT 1");
139
+		if (!isset($data[$code])) {
140
+			$sql = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' AND code = '" . $this->db->escape($code) . "' LIMIT 1");
141 141
 
142
-            if ($sql->num_rows) {
143
-                $data[$code] = $sql->row['language_id'];
144
-            } else {
145
-                $data[$code] = 1;
146
-            }
147
-        }
142
+			if ($sql->num_rows) {
143
+				$data[$code] = $sql->row['language_id'];
144
+			} else {
145
+				$data[$code] = 1;
146
+			}
147
+		}
148 148
 
149
-        return $data[$code];
150
-    }
149
+		return $data[$code];
150
+	}
151 151
 
152
-    public function generateAlias($title, $id = null, $language_id = null)
153
-    {
154
-        $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
152
+	public function generateAlias($title, $id = null, $language_id = null)
153
+	{
154
+		$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
155 155
 
156
-        $alias = $this->safeAlias($title);
156
+		$alias = $this->safeAlias($title);
157 157
 
158
-        if ($id && $language_id) {
159
-            $count = 0;
160
-            $baseAlias = $alias;
158
+		if ($id && $language_id) {
159
+			$count = 0;
160
+			$baseAlias = $alias;
161 161
 
162
-            while ($this->db->query("SELECT COUNT(*) AS count FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($alias) . "' AND language_id = '" . (int)$language_id . "'")->row['count'] > 0) {
163
-                if ($count == 0) {
164
-                    $baseAlias = ($alias = $alias . '-' . $id) . '-';
165
-                } else {
166
-                    $alias = $baseAlias . $count;
167
-                }
162
+			while ($this->db->query("SELECT COUNT(*) AS count FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($alias) . "' AND language_id = '" . (int)$language_id . "'")->row['count'] > 0) {
163
+				if ($count == 0) {
164
+					$baseAlias = ($alias = $alias . '-' . $id) . '-';
165
+				} else {
166
+					$alias = $baseAlias . $count;
167
+				}
168 168
 
169
-                $count++;
170
-            }
171
-        }
169
+				$count++;
170
+			}
171
+		}
172 172
 
173
-        return $alias;
174
-    }
173
+		return $alias;
174
+	}
175 175
 
176
-    // From Joomla.Platform
177
-    public function safeAlias($string)
178
-    {
179
-        // Replace double byte whitespaces by single byte (East Asian languages)
180
-        $str = preg_replace('/\xE3\x80\x80/', ' ', $string);
176
+	// From Joomla.Platform
177
+	public function safeAlias($string)
178
+	{
179
+		// Replace double byte whitespaces by single byte (East Asian languages)
180
+		$str = preg_replace('/\xE3\x80\x80/', ' ', $string);
181 181
 
182
-        // Remove any '-' from the string as they will be used as concatenator.
183
-        // Would be great to let the spaces in but only Firefox is friendly with this
182
+		// Remove any '-' from the string as they will be used as concatenator.
183
+		// Would be great to let the spaces in but only Firefox is friendly with this
184 184
 
185
-        $str = str_replace('-', ' ', $str);
185
+		$str = str_replace('-', ' ', $str);
186 186
 
187
-        // Replace forbidden characters by whitespaces
188
-        $str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $str);
187
+		// Replace forbidden characters by whitespaces
188
+		$str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $str);
189 189
 
190
-        // Delete all '?'
191
-        $str = str_replace('?', '', $str);
190
+		// Delete all '?'
191
+		$str = str_replace('?', '', $str);
192 192
 
193
-        // Trim white spaces at beginning and end of alias and make lowercase
194
-        $str = trim(utf8_strtolower($str));
193
+		// Trim white spaces at beginning and end of alias and make lowercase
194
+		$str = trim(utf8_strtolower($str));
195 195
 
196
-        // Remove any duplicate whitespace and replace whitespaces by hyphens
197
-        $str = preg_replace('#\x20+#', '-', $str);
196
+		// Remove any duplicate whitespace and replace whitespaces by hyphens
197
+		$str = preg_replace('#\x20+#', '-', $str);
198 198
 
199
-        return $str;
200
-    }
199
+		return $str;
200
+	}
201 201
 
202
-    public function getCategoryIdBySortOrder($product_id)
203
-    {
204
-        static $data = array();
202
+	public function getCategoryIdBySortOrder($product_id)
203
+	{
204
+		static $data = array();
205 205
 
206
-        if (!isset($data[$product_id])) {
207
-            $data[$product_id] = null;
206
+		if (!isset($data[$product_id])) {
207
+			$data[$product_id] = null;
208 208
 
209
-            $sql = "SELECT pc.category_id FROM " . DB_PREFIX . "product_to_category AS pc";
210
-            $sql .= " LEFT JOIN " . DB_PREFIX . "category AS c ON (pc.category_id = c.category_id)";
211
-            $sql .= " LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id)";
212
-            $sql .= " WHERE pc.product_id = '" . (int)$product_id . "'";
213
-            $sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
214
-            $sql .= " AND c.status = '1'";
215
-            $sql .= " ORDER BY c.sort_order";
216
-            $sql .= " LIMIT 1";
209
+			$sql = "SELECT pc.category_id FROM " . DB_PREFIX . "product_to_category AS pc";
210
+			$sql .= " LEFT JOIN " . DB_PREFIX . "category AS c ON (pc.category_id = c.category_id)";
211
+			$sql .= " LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id)";
212
+			$sql .= " WHERE pc.product_id = '" . (int)$product_id . "'";
213
+			$sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
214
+			$sql .= " AND c.status = '1'";
215
+			$sql .= " ORDER BY c.sort_order";
216
+			$sql .= " LIMIT 1";
217 217
 
218
-            $query = $this->db->query($sql);
218
+			$query = $this->db->query($sql);
219 219
 
220
-            if (!$query->num_rows) {
221
-                return $data[$product_id];
222
-            }
220
+			if (!$query->num_rows) {
221
+				return $data[$product_id];
222
+			}
223 223
 
224
-            $data[$product_id] = $query->row['category_id'];
225
-        }
224
+			$data[$product_id] = $query->row['category_id'];
225
+		}
226 226
 
227
-        return $data[$product_id];
228
-    }
227
+		return $data[$product_id];
228
+	}
229 229
 
230
-    public function getParentCategoriesIds($category_id = 0, $table_prefix = '')
231
-    {
232
-        static $data = array();
230
+	public function getParentCategoriesIds($category_id = 0, $table_prefix = '')
231
+	{
232
+		static $data = array();
233 233
 
234
-        $unique_id = $table_prefix . $category_id;
234
+		$unique_id = $table_prefix . $category_id;
235 235
 
236
-        if (!isset($data[$unique_id])) {
237
-            $data[$unique_id] = array();
236
+		if (!isset($data[$unique_id])) {
237
+			$data[$unique_id] = array();
238 238
 
239
-            $sql = "SELECT c.parent_id FROM " . DB_PREFIX . $table_prefix . "category c";
240
-            $sql .= " LEFT JOIN " . DB_PREFIX . $table_prefix . "category_to_store c2s ON (c.category_id = c2s.category_id)";
241
-            $sql .= " WHERE c.category_id = '" . (int)$category_id . "'";
242
-            $sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
243
-            $sql .= " ORDER BY c.sort_order";
244
-            $sql .= " LIMIT 1";
239
+			$sql = "SELECT c.parent_id FROM " . DB_PREFIX . $table_prefix . "category c";
240
+			$sql .= " LEFT JOIN " . DB_PREFIX . $table_prefix . "category_to_store c2s ON (c.category_id = c2s.category_id)";
241
+			$sql .= " WHERE c.category_id = '" . (int)$category_id . "'";
242
+			$sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
243
+			$sql .= " ORDER BY c.sort_order";
244
+			$sql .= " LIMIT 1";
245 245
 
246
-            $query = $this->db->query($sql);
246
+			$query = $this->db->query($sql);
247 247
 
248
-            if (empty($query->row) || !isset($query->row['parent_id'])) {
249
-                return $data[$unique_id];
250
-            }
248
+			if (empty($query->row) || !isset($query->row['parent_id'])) {
249
+				return $data[$unique_id];
250
+			}
251 251
 
252
-            $data[$unique_id][] = $query->row['parent_id'];
252
+			$data[$unique_id][] = $query->row['parent_id'];
253 253
 
254
-            $data[$unique_id] = array_merge($this->getParentCategoriesIds($query->row['parent_id']), $data[$unique_id]);
255
-        }
254
+			$data[$unique_id] = array_merge($this->getParentCategoriesIds($query->row['parent_id']), $data[$unique_id]);
255
+		}
256 256
 
257
-        return $data[$unique_id];
258
-    }
257
+		return $data[$unique_id];
258
+	}
259 259
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         }
45 45
 
46 46
         if (!isset($rows[$type][$id])) {
47
-            $results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = '" . $this->db->escape($query) . "'");
47
+            $results = $this->db->query("SELECT * FROM ".DB_PREFIX."url_alias WHERE query = '".$this->db->escape($query)."'");
48 48
 
49 49
             if ($results->num_rows) {
50 50
                 $tmp = '';
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $query = false;
90 90
 
91
-        $results = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($keyword) . "'");
91
+        $results = $this->db->query("SELECT * FROM ".DB_PREFIX."url_alias WHERE keyword = '".$this->db->escape($keyword)."'");
92 92
 
93 93
         if ($results->num_rows) {
94 94
             $tmp = '';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         if (!isset($data[$code])) {
140
-            $sql = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' AND code = '" . $this->db->escape($code) . "' LIMIT 1");
140
+            $sql = $this->db->query("SELECT language_id FROM `".DB_PREFIX."language` WHERE status = '1' AND code = '".$this->db->escape($code)."' LIMIT 1");
141 141
 
142 142
             if ($sql->num_rows) {
143 143
                 $data[$code] = $sql->row['language_id'];
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
             $count = 0;
160 160
             $baseAlias = $alias;
161 161
 
162
-            while ($this->db->query("SELECT COUNT(*) AS count FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($alias) . "' AND language_id = '" . (int)$language_id . "'")->row['count'] > 0) {
162
+            while ($this->db->query("SELECT COUNT(*) AS count FROM ".DB_PREFIX."url_alias WHERE keyword = '".$this->db->escape($alias)."' AND language_id = '".(int)$language_id."'")->row['count'] > 0) {
163 163
                 if ($count == 0) {
164
-                    $baseAlias = ($alias = $alias . '-' . $id) . '-';
164
+                    $baseAlias = ($alias = $alias.'-'.$id).'-';
165 165
                 } else {
166
-                    $alias = $baseAlias . $count;
166
+                    $alias = $baseAlias.$count;
167 167
                 }
168 168
 
169 169
                 $count++;
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
         if (!isset($data[$product_id])) {
207 207
             $data[$product_id] = null;
208 208
 
209
-            $sql = "SELECT pc.category_id FROM " . DB_PREFIX . "product_to_category AS pc";
210
-            $sql .= " LEFT JOIN " . DB_PREFIX . "category AS c ON (pc.category_id = c.category_id)";
211
-            $sql .= " LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id)";
212
-            $sql .= " WHERE pc.product_id = '" . (int)$product_id . "'";
213
-            $sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
209
+            $sql = "SELECT pc.category_id FROM ".DB_PREFIX."product_to_category AS pc";
210
+            $sql .= " LEFT JOIN ".DB_PREFIX."category AS c ON (pc.category_id = c.category_id)";
211
+            $sql .= " LEFT JOIN ".DB_PREFIX."category_to_store c2s ON (c.category_id = c2s.category_id)";
212
+            $sql .= " WHERE pc.product_id = '".(int)$product_id."'";
213
+            $sql .= " AND c2s.store_id = '".(int)$this->config->get('config_store_id')."'";
214 214
             $sql .= " AND c.status = '1'";
215 215
             $sql .= " ORDER BY c.sort_order";
216 216
             $sql .= " LIMIT 1";
@@ -231,15 +231,15 @@  discard block
 block discarded – undo
231 231
     {
232 232
         static $data = array();
233 233
 
234
-        $unique_id = $table_prefix . $category_id;
234
+        $unique_id = $table_prefix.$category_id;
235 235
 
236 236
         if (!isset($data[$unique_id])) {
237 237
             $data[$unique_id] = array();
238 238
 
239
-            $sql = "SELECT c.parent_id FROM " . DB_PREFIX . $table_prefix . "category c";
240
-            $sql .= " LEFT JOIN " . DB_PREFIX . $table_prefix . "category_to_store c2s ON (c.category_id = c2s.category_id)";
241
-            $sql .= " WHERE c.category_id = '" . (int)$category_id . "'";
242
-            $sql .= " AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
239
+            $sql = "SELECT c.parent_id FROM ".DB_PREFIX.$table_prefix."category c";
240
+            $sql .= " LEFT JOIN ".DB_PREFIX.$table_prefix."category_to_store c2s ON (c.category_id = c2s.category_id)";
241
+            $sql .= " WHERE c.category_id = '".(int)$category_id."'";
242
+            $sql .= " AND c2s.store_id = '".(int)$this->config->get('config_store_id')."'";
243 243
             $sql .= " ORDER BY c.sort_order";
244 244
             $sql .= " LIMIT 1";
245 245
 
Please login to merge, or discard this patch.
system/library/utility.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -10,211 +10,211 @@
 block discarded – undo
10 10
 class Utility extends Object
11 11
 {
12 12
 
13
-    protected $registry;
14
-
15
-    public function __construct($registry)
16
-    {
17
-        $this->registry = $registry;
18
-    }
19
-
20
-    public function __get($key)
21
-    {
22
-        return $this->registry->get($key);
23
-    }
24
-
25
-    public function __set($key, $value)
26
-    {
27
-        $this->registry->set($key, $value);
28
-    }
29
-
30
-    public function getLanguage()
31
-    {
32
-        $lang = null;
33
-        $languages = array();
34
-
35
-        $prefix = Client::isAdmin() ? 'admin_' : '';
36
-
37
-        $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE status = '1'");
38
-
39
-        foreach ($query->rows as $result) {
40
-            $languages[$result['code']] = $result;
41
-        }
42
-
43
-        if (isset($this->request->get['lang']) && array_key_exists($this->request->get['lang'], $languages) && $languages[$this->request->get['lang']]['status']) {
44
-            $code = $this->request->get['lang'];
45
-        } elseif (isset($this->session->data[$prefix.'language']) && array_key_exists($this->session->data[$prefix.'language'], $languages) && $languages[$this->session->data[$prefix.'language']]['status']) {
46
-            $code = $this->session->data[$prefix.'language'];
47
-        } elseif (isset($this->request->cookie[$prefix.'language']) && array_key_exists($this->request->cookie[$prefix.'language'], $languages) && $languages[$this->request->cookie[$prefix.'language']]['status']) {
48
-            $code = $this->request->cookie[$prefix.'language'];
49
-        } else {
50
-            // Try to get the language from SEF URL
51
-            if (Client::isCatalog() && $this->config->get('config_seo_url')) {
52
-                $route = str_replace($this->url->getFullUrl(), '', rawurldecode($this->uri->toString()));
53
-                $route = str_replace('?'.$this->uri->getQuery(), '', $route);
54
-                $route_parts = explode('/', str_replace('index.php/', '', $route));
55
-
56
-                if (!empty($route_parts[0]) && (strlen($route_parts[0]) == 2)) {
57
-                    $code = $route_parts[0];
58
-                } else {
59
-                    $code = $this->getBrowserDefaultLanguage($languages);
60
-                }
61
-            } else {
62
-                $code = $this->getBrowserDefaultLanguage($languages);
63
-            }
64
-        }
65
-
66
-        // Check if lang code exists in db, otherwise return the first lang
67
-        if (isset($languages[$code])) {
68
-            $lang = $languages[$code];
69
-        } else {
70
-            reset($languages);
71
-            $lang = current($languages);
72
-        }
73
-
74
-        return $lang;
75
-    }
76
-
77
-    public function getBrowserDefaultLanguage($languages)
78
-    {
79
-        $browser = $this->getBrowserLangCode($languages);
80
-
81
-        if (is_object($this->config)) {
82
-            $default = Client::isAdmin() ? $this->config->get('config_admin_language') : $this->config->get('config_language');
83
-        } else {
84
-            $default = 'en';
85
-        }
86
-
87
-        $code = $browser ? $browser : $default;
88
-
89
-        return $code;
90
-    }
91
-
92
-    public function getDefaultLanguage()
93
-    {
94
-        if (!is_object($this->config)) {
95
-            return;
96
-        }
97
-
98
-        $store_id = $this->config->get('config_store_id');
99
-
100
-        if (Client::isAdmin()) {
101
-            $sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_admin_language' AND `store_id` = '" . $store_id . "'";
102
-        } else {
103
-            $sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_language' AND `store_id` = '" . $store_id . "'";
104
-        }
105
-        $query = $this->db->query($sql);
106
-        $code = $query->row['value'];
107
-
108
-        $language = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE `code` = '" . $code . "'");
109
-
110
-        return $language->row;
111
-    }
112
-
113
-    public function getBrowserLangCode($system_langs)
114
-    {
115
-        $lang = null;
116
-
117
-        if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
118
-            return $lang;
119
-        }
120
-
121
-        $browser_langs = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
122
-
123
-        foreach ($browser_langs as $browser_lang) {
124
-            // Slice out the part before ; on first step, the part before - on second, place into array
125
-            $browser_lang = substr($browser_lang, 0, strcspn($browser_lang, ';'));
126
-            $primary_browser_lang = substr($browser_lang, 0, 2);
127
-
128
-            foreach ($system_langs as $system_lang) {
129
-                if (!$system_lang['status']) {
130
-                    continue;
131
-                }
132
-
133
-                $system_code = $system_lang['code'];
134
-                $system_dir = $system_lang['directory'];
135
-
136
-                // Take off 3 letters (zh-yue) iso code languages as they can't match browsers' languages and default them to en
137
-                // http://www.w3.org/International/articles/language-tags/#extlang
138
-                if (strlen($system_dir) > 5) {
139
-                    continue;
140
-                }
141
-
142
-                if (strtolower($browser_lang) == strtolower(substr($system_dir, 0, strlen($browser_lang)))) {
143
-                    return $system_code;
144
-                } elseif ($primary_browser_lang == substr($system_dir, 0, 2)) {
145
-                    $primary_detected_code = $system_code;
146
-                }
147
-            }
148
-
149
-            if (isset($primary_detected_code)) {
150
-                return $primary_detected_code;
151
-            }
152
-        }
153
-
154
-        return $lang;
155
-    }
156
-
157
-    public function getInfo()
158
-    {
159
-        $info = array();
160
-
161
-        $info['arastta'] = VERSION;
162
-
163
-        $info['php'] = phpversion();
164
-
165
-        if (method_exists($this->db, 'getVersion')) {
166
-            $info['mysql'] = $this->db->getVersion();
167
-        } else {
168
-            $info['mysql'] = 'N/A';
169
-        }
13
+	protected $registry;
14
+
15
+	public function __construct($registry)
16
+	{
17
+		$this->registry = $registry;
18
+	}
19
+
20
+	public function __get($key)
21
+	{
22
+		return $this->registry->get($key);
23
+	}
24
+
25
+	public function __set($key, $value)
26
+	{
27
+		$this->registry->set($key, $value);
28
+	}
29
+
30
+	public function getLanguage()
31
+	{
32
+		$lang = null;
33
+		$languages = array();
34
+
35
+		$prefix = Client::isAdmin() ? 'admin_' : '';
36
+
37
+		$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE status = '1'");
38
+
39
+		foreach ($query->rows as $result) {
40
+			$languages[$result['code']] = $result;
41
+		}
42
+
43
+		if (isset($this->request->get['lang']) && array_key_exists($this->request->get['lang'], $languages) && $languages[$this->request->get['lang']]['status']) {
44
+			$code = $this->request->get['lang'];
45
+		} elseif (isset($this->session->data[$prefix.'language']) && array_key_exists($this->session->data[$prefix.'language'], $languages) && $languages[$this->session->data[$prefix.'language']]['status']) {
46
+			$code = $this->session->data[$prefix.'language'];
47
+		} elseif (isset($this->request->cookie[$prefix.'language']) && array_key_exists($this->request->cookie[$prefix.'language'], $languages) && $languages[$this->request->cookie[$prefix.'language']]['status']) {
48
+			$code = $this->request->cookie[$prefix.'language'];
49
+		} else {
50
+			// Try to get the language from SEF URL
51
+			if (Client::isCatalog() && $this->config->get('config_seo_url')) {
52
+				$route = str_replace($this->url->getFullUrl(), '', rawurldecode($this->uri->toString()));
53
+				$route = str_replace('?'.$this->uri->getQuery(), '', $route);
54
+				$route_parts = explode('/', str_replace('index.php/', '', $route));
55
+
56
+				if (!empty($route_parts[0]) && (strlen($route_parts[0]) == 2)) {
57
+					$code = $route_parts[0];
58
+				} else {
59
+					$code = $this->getBrowserDefaultLanguage($languages);
60
+				}
61
+			} else {
62
+				$code = $this->getBrowserDefaultLanguage($languages);
63
+			}
64
+		}
65
+
66
+		// Check if lang code exists in db, otherwise return the first lang
67
+		if (isset($languages[$code])) {
68
+			$lang = $languages[$code];
69
+		} else {
70
+			reset($languages);
71
+			$lang = current($languages);
72
+		}
73
+
74
+		return $lang;
75
+	}
76
+
77
+	public function getBrowserDefaultLanguage($languages)
78
+	{
79
+		$browser = $this->getBrowserLangCode($languages);
80
+
81
+		if (is_object($this->config)) {
82
+			$default = Client::isAdmin() ? $this->config->get('config_admin_language') : $this->config->get('config_language');
83
+		} else {
84
+			$default = 'en';
85
+		}
86
+
87
+		$code = $browser ? $browser : $default;
88
+
89
+		return $code;
90
+	}
91
+
92
+	public function getDefaultLanguage()
93
+	{
94
+		if (!is_object($this->config)) {
95
+			return;
96
+		}
97
+
98
+		$store_id = $this->config->get('config_store_id');
99
+
100
+		if (Client::isAdmin()) {
101
+			$sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_admin_language' AND `store_id` = '" . $store_id . "'";
102
+		} else {
103
+			$sql = "SELECT * FROM " . DB_PREFIX . "setting WHERE `key` = 'config_language' AND `store_id` = '" . $store_id . "'";
104
+		}
105
+		$query = $this->db->query($sql);
106
+		$code = $query->row['value'];
107
+
108
+		$language = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE `code` = '" . $code . "'");
109
+
110
+		return $language->row;
111
+	}
112
+
113
+	public function getBrowserLangCode($system_langs)
114
+	{
115
+		$lang = null;
116
+
117
+		if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
118
+			return $lang;
119
+		}
120
+
121
+		$browser_langs = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
122
+
123
+		foreach ($browser_langs as $browser_lang) {
124
+			// Slice out the part before ; on first step, the part before - on second, place into array
125
+			$browser_lang = substr($browser_lang, 0, strcspn($browser_lang, ';'));
126
+			$primary_browser_lang = substr($browser_lang, 0, 2);
127
+
128
+			foreach ($system_langs as $system_lang) {
129
+				if (!$system_lang['status']) {
130
+					continue;
131
+				}
132
+
133
+				$system_code = $system_lang['code'];
134
+				$system_dir = $system_lang['directory'];
135
+
136
+				// Take off 3 letters (zh-yue) iso code languages as they can't match browsers' languages and default them to en
137
+				// http://www.w3.org/International/articles/language-tags/#extlang
138
+				if (strlen($system_dir) > 5) {
139
+					continue;
140
+				}
141
+
142
+				if (strtolower($browser_lang) == strtolower(substr($system_dir, 0, strlen($browser_lang)))) {
143
+					return $system_code;
144
+				} elseif ($primary_browser_lang == substr($system_dir, 0, 2)) {
145
+					$primary_detected_code = $system_code;
146
+				}
147
+			}
148
+
149
+			if (isset($primary_detected_code)) {
150
+				return $primary_detected_code;
151
+			}
152
+		}
153
+
154
+		return $lang;
155
+	}
156
+
157
+	public function getInfo()
158
+	{
159
+		$info = array();
160
+
161
+		$info['arastta'] = VERSION;
162
+
163
+		$info['php'] = phpversion();
164
+
165
+		if (method_exists($this->db, 'getVersion')) {
166
+			$info['mysql'] = $this->db->getVersion();
167
+		} else {
168
+			$info['mysql'] = 'N/A';
169
+		}
170 170
 
171
-        $langs = array();
172
-        $languages = $this->getLanguages();
173
-        foreach ($languages as $language) {
174
-            $langs[] = $language['code'];
175
-        }
171
+		$langs = array();
172
+		$languages = $this->getLanguages();
173
+		foreach ($languages as $language) {
174
+			$langs[] = $language['code'];
175
+		}
176 176
 
177
-        $info['langs'] = implode(',', $langs);
177
+		$info['langs'] = implode(',', $langs);
178 178
 
179
-        $info['stores'] = (int) $this->getTotalStores() + 1;
179
+		$info['stores'] = (int) $this->getTotalStores() + 1;
180 180
 
181
-        $info['api'] = $this->config->get('api_key', '');
181
+		$info['api'] = $this->config->get('api_key', '');
182 182
 
183
-        return $info;
184
-    }
183
+		return $info;
184
+	}
185 185
 
186
-    public function getLanguages()
187
-    {
188
-        $language_data = $this->cache->get('language');
186
+	public function getLanguages()
187
+	{
188
+		$language_data = $this->cache->get('language');
189 189
 
190
-        if (!$language_data) {
191
-            $language_data = array();
192
-
193
-            $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE status = 1 ORDER BY sort_order, name");
190
+		if (!$language_data) {
191
+			$language_data = array();
192
+
193
+			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "language WHERE status = 1 ORDER BY sort_order, name");
194 194
 
195
-            foreach ($query->rows as $result) {
196
-                $language_data[$result['code']] = array(
197
-                    'language_id' => $result['language_id'],
198
-                    'name'        => $result['name'],
199
-                    'code'        => $result['code'],
200
-                    'locale'      => $result['locale'],
201
-                    'image'       => $result['image'],
202
-                    'directory'   => $result['directory'],
203
-                    'sort_order'  => $result['sort_order'],
204
-                    'status'      => $result['status']
205
-                );
206
-            }
195
+			foreach ($query->rows as $result) {
196
+				$language_data[$result['code']] = array(
197
+					'language_id' => $result['language_id'],
198
+					'name'        => $result['name'],
199
+					'code'        => $result['code'],
200
+					'locale'      => $result['locale'],
201
+					'image'       => $result['image'],
202
+					'directory'   => $result['directory'],
203
+					'sort_order'  => $result['sort_order'],
204
+					'status'      => $result['status']
205
+				);
206
+			}
207 207
 
208
-            $this->cache->set('language', $language_data);
209
-        }
208
+			$this->cache->set('language', $language_data);
209
+		}
210 210
 
211
-        return $language_data;
212
-    }
211
+		return $language_data;
212
+	}
213 213
 
214
-    public function getTotalStores()
215
-    {
216
-        $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "store");
214
+	public function getTotalStores()
215
+	{
216
+		$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "store");
217 217
 
218
-        return $query->row['total'];
219
-    }
218
+		return $query->row['total'];
219
+	}
220 220
 }
Please login to merge, or discard this patch.
catalog/controller/blog/category.php 2 patches
Indentation   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -10,439 +10,439 @@
 block discarded – undo
10 10
 class ControllerBlogCategory extends Controller
11 11
 {
12 12
 
13
-    public function index()
14
-    {
15
-        $this->load->language('blog/category');
13
+	public function index()
14
+	{
15
+		$this->load->language('blog/category');
16 16
 
17
-        $this->load->model('blog/category');
17
+		$this->load->model('blog/category');
18 18
 
19
-        $this->load->model('blog/post');
20
-        $this->load->model('blog/comment');
19
+		$this->load->model('blog/post');
20
+		$this->load->model('blog/comment');
21 21
 
22
-        $this->load->model('tool/image');
22
+		$this->load->model('tool/image');
23 23
 
24
-        #Get All Language Text
25
-        $data = $this->language->all();
24
+		#Get All Language Text
25
+		$data = $this->language->all();
26 26
 
27
-        $filter = '';
27
+		$filter = '';
28 28
 
29
-        if (isset($this->request->get['filter'])) {
30
-            $filter = urldecode($this->request->get['filter']);
31
-        }
29
+		if (isset($this->request->get['filter'])) {
30
+			$filter = urldecode($this->request->get['filter']);
31
+		}
32 32
 
33
-        $default_post_sort_order = explode('-', $this->config->get('config_blog_post_list_sort_order'));
33
+		$default_post_sort_order = explode('-', $this->config->get('config_blog_post_list_sort_order'));
34 34
 
35
-        if (count($default_post_sort_order) > 1) {
36
-            $sort  = $default_post_sort_order[0];
37
-            $order = $default_post_sort_order[1];
38
-        } else {
39
-            $sort  = $default_post_sort_order[0];
40
-            $order = 'ASC';
41
-        }
35
+		if (count($default_post_sort_order) > 1) {
36
+			$sort  = $default_post_sort_order[0];
37
+			$order = $default_post_sort_order[1];
38
+		} else {
39
+			$sort  = $default_post_sort_order[0];
40
+			$order = 'ASC';
41
+		}
42 42
 
43
-        if (isset($this->request->get['sort'])) {
44
-            $sort = $this->request->get['sort'];
45
-        }
43
+		if (isset($this->request->get['sort'])) {
44
+			$sort = $this->request->get['sort'];
45
+		}
46 46
 
47
-        if (isset($this->request->get['order'])) {
48
-            $order = $this->request->get['order'];
49
-        }
47
+		if (isset($this->request->get['order'])) {
48
+			$order = $this->request->get['order'];
49
+		}
50 50
 
51
-        $page = 1;
51
+		$page = 1;
52 52
 
53
-        if (isset($this->request->get['page'])) {
54
-            $page = $this->request->get['page'];
55
-        }
53
+		if (isset($this->request->get['page'])) {
54
+			$page = $this->request->get['page'];
55
+		}
56 56
 
57
-        $limit = $this->config->get('config_product_limit');
57
+		$limit = $this->config->get('config_product_limit');
58 58
 
59
-        if (isset($this->request->get['limit'])) {
60
-            $limit = $this->request->get['limit'];
61
-        }
59
+		if (isset($this->request->get['limit'])) {
60
+			$limit = $this->request->get['limit'];
61
+		}
62 62
 
63
-        $data['breadcrumbs'] = array();
63
+		$data['breadcrumbs'] = array();
64 64
 
65
-        $menu_home = $this->model_blog_post->checkMenu('home');
65
+		$menu_home = $this->model_blog_post->checkMenu('home');
66 66
 
67
-        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
67
+		$text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
68 68
 
69
-        $data['breadcrumbs'][] = array(
70
-            'text' => $this->language->get('text_home'),
71
-            'href' => $this->url->link('common/home')
72
-        );
69
+		$data['breadcrumbs'][] = array(
70
+			'text' => $this->language->get('text_home'),
71
+			'href' => $this->url->link('common/home')
72
+		);
73 73
 
74
-        $data['breadcrumbs'][] = array(
75
-            'text' => $text_home,
76
-            'href' => $this->url->link('blog/home')
77
-        );
74
+		$data['breadcrumbs'][] = array(
75
+			'text' => $text_home,
76
+			'href' => $this->url->link('blog/home')
77
+		);
78 78
 
79
-        if (isset($this->request->get['path'])) {
80
-            $url = '';
79
+		if (isset($this->request->get['path'])) {
80
+			$url = '';
81 81
 
82
-            if (isset($this->request->get['sort'])) {
83
-                $url .= '&sort=' . $this->request->get['sort'];
84
-            }
82
+			if (isset($this->request->get['sort'])) {
83
+				$url .= '&sort=' . $this->request->get['sort'];
84
+			}
85 85
 
86
-            if (isset($this->request->get['order'])) {
87
-                $url .= '&order=' . $this->request->get['order'];
88
-            }
86
+			if (isset($this->request->get['order'])) {
87
+				$url .= '&order=' . $this->request->get['order'];
88
+			}
89 89
 
90
-            if (isset($this->request->get['limit'])) {
91
-                $url .= '&limit=' . $this->request->get['limit'];
92
-            }
90
+			if (isset($this->request->get['limit'])) {
91
+				$url .= '&limit=' . $this->request->get['limit'];
92
+			}
93 93
 
94
-            $path = '';
94
+			$path = '';
95 95
 
96
-            $parts = explode('_', (string)$this->request->get['path']);
96
+			$parts = explode('_', (string)$this->request->get['path']);
97 97
 
98
-            $category_id = (int)array_pop($parts);
98
+			$category_id = (int)array_pop($parts);
99 99
 
100
-            foreach ($parts as $path_id) {
101
-                if (!$path) {
102
-                    $path = (int)$path_id;
103
-                } else {
104
-                    $path .= '_' . (int)$path_id;
105
-                }
100
+			foreach ($parts as $path_id) {
101
+				if (!$path) {
102
+					$path = (int)$path_id;
103
+				} else {
104
+					$path .= '_' . (int)$path_id;
105
+				}
106 106
 
107
-                $category_info = $this->model_blog_category->getCategory($path_id);
107
+				$category_info = $this->model_blog_category->getCategory($path_id);
108 108
 
109
-                if ($category_info) {
110
-                    $data['breadcrumbs'][] = array(
111
-                        'text' => $category_info['name'],
112
-                        'href' => $this->url->link('blog/category', 'path=' . $path . $url)
113
-                    );
114
-                }
115
-            }
116
-        } else {
117
-            $category_id = 0;
118
-        }
109
+				if ($category_info) {
110
+					$data['breadcrumbs'][] = array(
111
+						'text' => $category_info['name'],
112
+						'href' => $this->url->link('blog/category', 'path=' . $path . $url)
113
+					);
114
+				}
115
+			}
116
+		} else {
117
+			$category_id = 0;
118
+		}
119 119
 
120
-        $category_info = $this->model_blog_category->getCategory($category_id);
120
+		$category_info = $this->model_blog_category->getCategory($category_id);
121 121
 
122
-        if ($category_info) {
123
-            $title = empty($category_info['meta_title']) ? $category_info['name'] : $category_info['meta_title'];
122
+		if ($category_info) {
123
+			$title = empty($category_info['meta_title']) ? $category_info['name'] : $category_info['meta_title'];
124 124
 
125
-            $this->document->setTitle($title);
126
-            $this->document->setDescription($category_info['meta_description']);
127
-            $this->document->setKeywords($category_info['meta_keyword']);
128
-            if (!$this->config->get('config_seo_url')) {
129
-                $this->document->addLink($this->url->link('blog/category', 'path=' . $this->request->get['path']), 'canonical');
130
-            }
125
+			$this->document->setTitle($title);
126
+			$this->document->setDescription($category_info['meta_description']);
127
+			$this->document->setKeywords($category_info['meta_keyword']);
128
+			if (!$this->config->get('config_seo_url')) {
129
+				$this->document->addLink($this->url->link('blog/category', 'path=' . $this->request->get['path']), 'canonical');
130
+			}
131 131
 
132
-            if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
133
-                $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
134
-            } else {
135
-                $this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
136
-            }
132
+			if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
133
+				$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
134
+			} else {
135
+				$this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
136
+			}
137 137
 
138
-            $data['heading_title'] = $category_info['name'];
138
+			$data['heading_title'] = $category_info['name'];
139 139
 
140
-            // Set the last category breadcrumb
141
-            $data['breadcrumbs'][] = array(
142
-                'text' => $category_info['name'],
143
-                'href' => $this->url->link('blog/category', 'path=' . $this->request->get['path'])
144
-            );
140
+			// Set the last category breadcrumb
141
+			$data['breadcrumbs'][] = array(
142
+				'text' => $category_info['name'],
143
+				'href' => $this->url->link('blog/category', 'path=' . $this->request->get['path'])
144
+			);
145 145
 
146
-            $data['thumb'] = '';
146
+			$data['thumb'] = '';
147 147
 
148
-            if ($category_info['image']) {
149
-                $data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
150
-            }
148
+			if ($category_info['image']) {
149
+				$data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
150
+			}
151 151
 
152
-            $data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
152
+			$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
153 153
 
154
-            $data['author'] = $this->config->get('config_blog_post_list_author');
155
-            $data['category'] = $this->config->get('config_blog_post_list_category', 1);
156
-            $data['date_added'] = $this->config->get('config_blog_post_list_date');
157
-            $data['viewed'] = $this->config->get('config_blog_post_list_read');
154
+			$data['author'] = $this->config->get('config_blog_post_list_author');
155
+			$data['category'] = $this->config->get('config_blog_post_list_category', 1);
156
+			$data['date_added'] = $this->config->get('config_blog_post_list_date');
157
+			$data['viewed'] = $this->config->get('config_blog_post_list_read');
158 158
 
159
-            $url = '';
159
+			$url = '';
160 160
 
161
-            if (isset($this->request->get['filter'])) {
162
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
163
-            }
161
+			if (isset($this->request->get['filter'])) {
162
+				$url .= '&filter=' . urldecode($this->request->get['filter']);
163
+			}
164 164
 
165
-            if (isset($this->request->get['sort'])) {
166
-                $url .= '&sort=' . $this->request->get['sort'];
167
-            }
165
+			if (isset($this->request->get['sort'])) {
166
+				$url .= '&sort=' . $this->request->get['sort'];
167
+			}
168 168
 
169
-            if (isset($this->request->get['order'])) {
170
-                $url .= '&order=' . $this->request->get['order'];
171
-            }
172
-
173
-            if (isset($this->request->get['limit'])) {
174
-                $url .= '&limit=' . $this->request->get['limit'];
175
-            }
176
-
177
-            $data['categories'] = array();
178
-
179
-            $results = $this->model_blog_category->getCategories($category_id);
180
-
181
-            foreach ($results as $result) {
182
-                $filter_data = array(
183
-                    'filter_category_id'  => $result['category_id'],
184
-                    'filter_sub_category' => true
185
-                );
186
-
187
-                $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
188
-
189
-                $data['categories'][] = array(
190
-                    'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_blog_post->getTotalPosts($filter_data) . ')' : ''),
191
-                    'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
192
-                    'thumb' => $image
193
-                );
194
-            }
195
-
196
-            $data['posts'] = array();
197
-
198
-            $filter_data = array(
199
-                'filter_category_id' => $category_id,
200
-                'filter_filter'      => $filter,
201
-                'sort'               => $sort,
202
-                'order'              => $order,
203
-                'start'              => ($page - 1) * $limit,
204
-                'limit'              => $limit
205
-            );
206
-
207
-            $post_total = $this->model_blog_post->getTotalPosts($filter_data);
208
-
209
-            $results = $this->model_blog_post->getPosts($filter_data);
210
-
211
-            foreach ($results as $result) {
212
-                $image = '';
213
-
214
-                if ($result['image']) {
215
-                    $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
216
-                }
217
-
218
-                $category = $category_info['name'];
219
-
220
-                $comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
221
-
222
-                $this->trigger->fire('pre.post.display', array(&$result, 'category'));
223
-
224
-                $data['posts'][] = array(
225
-                    'post_id'       => $result['post_id'],
226
-                    'thumb'         => $image,
227
-                    'name'          => $result['name'],
228
-                    'description'   => $result['description'],
229
-                    'category'      => $category,
230
-                    'category_href' => $this->url->link('blog/category', 'path=' . $category_id),
231
-                    'viewed'        => $result['viewed'],
232
-                    'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
233
-                    'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
234
-                    'author'        => $result['author'],
235
-                    'author_href'   => $this->url->link('blog/home', 'filter_author=' . $result['author']),
236
-                    'href'          => $this->url->link('blog/post', 'path=' . $this->request->get['path'] . '&post_id=' . $result['post_id'])
237
-                );
238
-            }
239
-
240
-            $data['author'] = $this->config->get('config_blog_post_list_author');
241
-            $data['date_added'] = $this->config->get('config_blog_post_list_date');
242
-            $data['viewed'] = $this->config->get('config_blog_post_list_read');
243
-
244
-            $url = '';
245
-
246
-            if (isset($this->request->get['filter'])) {
247
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
248
-            }
249
-
250
-            if (isset($this->request->get['limit'])) {
251
-                $url .= '&limit=' . $this->request->get['limit'];
252
-            }
253
-
254
-            $data['sorts'] = array();
255
-
256
-            $data['sorts'][] = array(
257
-                'text'  => $this->language->get('text_default'),
258
-                'value' => 'p.sort_order-ASC',
259
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
260
-            );
261
-
262
-            $data['sorts'][] = array(
263
-                'text'  => $this->language->get('text_name_asc'),
264
-                'value' => 'pd.name-ASC',
265
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url)
266
-            );
267
-
268
-            $data['sorts'][] = array(
269
-                'text'  => $this->language->get('text_name_desc'),
270
-                'value' => 'pd.name-DESC',
271
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url)
272
-            );
273
-
274
-            $data['sorts'][] = array(
275
-                'text'  => $this->language->get('text_price_asc'),
276
-                'value' => 'p.price-ASC',
277
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url)
278
-            );
279
-
280
-            $data['sorts'][] = array(
281
-                'text'  => $this->language->get('text_price_desc'),
282
-                'value' => 'p.price-DESC',
283
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url)
284
-            );
285
-
286
-            if ($this->config->get('config_review_status')) {
287
-                $data['sorts'][] = array(
288
-                    'text'  => $this->language->get('text_rating_desc'),
289
-                    'value' => 'rating-DESC',
290
-                    'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url)
291
-                );
292
-
293
-                $data['sorts'][] = array(
294
-                    'text'  => $this->language->get('text_rating_asc'),
295
-                    'value' => 'rating-ASC',
296
-                    'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url)
297
-                );
298
-            }
299
-
300
-            $data['sorts'][] = array(
301
-                'text'  => $this->language->get('text_model_asc'),
302
-                'value' => 'p.model-ASC',
303
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
304
-            );
305
-
306
-            $data['sorts'][] = array(
307
-                'text'  => $this->language->get('text_model_desc'),
308
-                'value' => 'p.model-DESC',
309
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url)
310
-            );
311
-
312
-            $url = '';
313
-
314
-            if (isset($this->request->get['filter'])) {
315
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
316
-            }
317
-
318
-            if (isset($this->request->get['sort'])) {
319
-                $url .= '&sort=' . $this->request->get['sort'];
320
-            }
321
-
322
-            if (isset($this->request->get['order'])) {
323
-                $url .= '&order=' . $this->request->get['order'];
324
-            }
325
-
326
-            $data['limits'] = array();
327
-
328
-            $limits = array_unique(array($this->config->get('config_product_limit'), 25, 50, 75, 100));
329
-
330
-            sort($limits);
331
-
332
-            foreach ($limits as $value) {
333
-                $data['limits'][] = array(
334
-                    'text'  => $value,
335
-                    'value' => $value,
336
-                    'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value)
337
-                );
338
-            }
339
-
340
-            $url = '';
341
-
342
-            if (isset($this->request->get['filter'])) {
343
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
344
-            }
345
-
346
-            if (isset($this->request->get['sort'])) {
347
-                $url .= '&sort=' . $this->request->get['sort'];
348
-            }
349
-
350
-            if (isset($this->request->get['order'])) {
351
-                $url .= '&order=' . $this->request->get['order'];
352
-            }
353
-
354
-            if (isset($this->request->get['limit'])) {
355
-                $url .= '&limit=' . $this->request->get['limit'];
356
-            }
357
-
358
-            $pagination = new Pagination();
359
-            $pagination->total = $post_total;
360
-            $pagination->page = $page;
361
-            $pagination->limit = $limit;
362
-            $pagination->url = $this->url->link('post/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');
363
-
364
-            $data['pagination'] = $pagination->render();
365
-
366
-            $data['results'] = sprintf($this->language->get('text_pagination'), ($post_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($post_total - $limit)) ? $post_total : ((($page - 1) * $limit) + $limit), $post_total, ceil($post_total / $limit));
367
-
368
-            $data['sort'] = $sort;
369
-            $data['order'] = $order;
370
-            $data['limit'] = $limit;
371
-
372
-            $data['continue'] = $this->url->link('common/home');
373
-
374
-            $data['column_left'] = $this->load->controller('common/column_left');
375
-            $data['column_right'] = $this->load->controller('common/column_right');
376
-            $data['content_top'] = $this->load->controller('common/content_top');
377
-            $data['content_bottom'] = $this->load->controller('common/content_bottom');
378
-            $data['footer'] = $this->load->controller('common/footer');
379
-            $data['header'] = $this->load->controller('common/header');
380
-
381
-            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/category.tpl')) {
382
-                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/category.tpl', $data));
383
-            } else {
384
-                $this->response->setOutput($this->load->view('default/template/blog/category.tpl', $data));
385
-            }
386
-        } else {
387
-            $this->load->language('error/not_found');
388
-
389
-            $url = '';
169
+			if (isset($this->request->get['order'])) {
170
+				$url .= '&order=' . $this->request->get['order'];
171
+			}
172
+
173
+			if (isset($this->request->get['limit'])) {
174
+				$url .= '&limit=' . $this->request->get['limit'];
175
+			}
176
+
177
+			$data['categories'] = array();
178
+
179
+			$results = $this->model_blog_category->getCategories($category_id);
180
+
181
+			foreach ($results as $result) {
182
+				$filter_data = array(
183
+					'filter_category_id'  => $result['category_id'],
184
+					'filter_sub_category' => true
185
+				);
186
+
187
+				$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
188
+
189
+				$data['categories'][] = array(
190
+					'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_blog_post->getTotalPosts($filter_data) . ')' : ''),
191
+					'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
192
+					'thumb' => $image
193
+				);
194
+			}
195
+
196
+			$data['posts'] = array();
197
+
198
+			$filter_data = array(
199
+				'filter_category_id' => $category_id,
200
+				'filter_filter'      => $filter,
201
+				'sort'               => $sort,
202
+				'order'              => $order,
203
+				'start'              => ($page - 1) * $limit,
204
+				'limit'              => $limit
205
+			);
206
+
207
+			$post_total = $this->model_blog_post->getTotalPosts($filter_data);
208
+
209
+			$results = $this->model_blog_post->getPosts($filter_data);
210
+
211
+			foreach ($results as $result) {
212
+				$image = '';
213
+
214
+				if ($result['image']) {
215
+					$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
216
+				}
217
+
218
+				$category = $category_info['name'];
219
+
220
+				$comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
221
+
222
+				$this->trigger->fire('pre.post.display', array(&$result, 'category'));
223
+
224
+				$data['posts'][] = array(
225
+					'post_id'       => $result['post_id'],
226
+					'thumb'         => $image,
227
+					'name'          => $result['name'],
228
+					'description'   => $result['description'],
229
+					'category'      => $category,
230
+					'category_href' => $this->url->link('blog/category', 'path=' . $category_id),
231
+					'viewed'        => $result['viewed'],
232
+					'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
233
+					'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
234
+					'author'        => $result['author'],
235
+					'author_href'   => $this->url->link('blog/home', 'filter_author=' . $result['author']),
236
+					'href'          => $this->url->link('blog/post', 'path=' . $this->request->get['path'] . '&post_id=' . $result['post_id'])
237
+				);
238
+			}
239
+
240
+			$data['author'] = $this->config->get('config_blog_post_list_author');
241
+			$data['date_added'] = $this->config->get('config_blog_post_list_date');
242
+			$data['viewed'] = $this->config->get('config_blog_post_list_read');
243
+
244
+			$url = '';
245
+
246
+			if (isset($this->request->get['filter'])) {
247
+				$url .= '&filter=' . urldecode($this->request->get['filter']);
248
+			}
249
+
250
+			if (isset($this->request->get['limit'])) {
251
+				$url .= '&limit=' . $this->request->get['limit'];
252
+			}
253
+
254
+			$data['sorts'] = array();
255
+
256
+			$data['sorts'][] = array(
257
+				'text'  => $this->language->get('text_default'),
258
+				'value' => 'p.sort_order-ASC',
259
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
260
+			);
261
+
262
+			$data['sorts'][] = array(
263
+				'text'  => $this->language->get('text_name_asc'),
264
+				'value' => 'pd.name-ASC',
265
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url)
266
+			);
267
+
268
+			$data['sorts'][] = array(
269
+				'text'  => $this->language->get('text_name_desc'),
270
+				'value' => 'pd.name-DESC',
271
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url)
272
+			);
273
+
274
+			$data['sorts'][] = array(
275
+				'text'  => $this->language->get('text_price_asc'),
276
+				'value' => 'p.price-ASC',
277
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url)
278
+			);
279
+
280
+			$data['sorts'][] = array(
281
+				'text'  => $this->language->get('text_price_desc'),
282
+				'value' => 'p.price-DESC',
283
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url)
284
+			);
285
+
286
+			if ($this->config->get('config_review_status')) {
287
+				$data['sorts'][] = array(
288
+					'text'  => $this->language->get('text_rating_desc'),
289
+					'value' => 'rating-DESC',
290
+					'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url)
291
+				);
292
+
293
+				$data['sorts'][] = array(
294
+					'text'  => $this->language->get('text_rating_asc'),
295
+					'value' => 'rating-ASC',
296
+					'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url)
297
+				);
298
+			}
299
+
300
+			$data['sorts'][] = array(
301
+				'text'  => $this->language->get('text_model_asc'),
302
+				'value' => 'p.model-ASC',
303
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
304
+			);
305
+
306
+			$data['sorts'][] = array(
307
+				'text'  => $this->language->get('text_model_desc'),
308
+				'value' => 'p.model-DESC',
309
+				'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url)
310
+			);
311
+
312
+			$url = '';
313
+
314
+			if (isset($this->request->get['filter'])) {
315
+				$url .= '&filter=' . urldecode($this->request->get['filter']);
316
+			}
317
+
318
+			if (isset($this->request->get['sort'])) {
319
+				$url .= '&sort=' . $this->request->get['sort'];
320
+			}
321
+
322
+			if (isset($this->request->get['order'])) {
323
+				$url .= '&order=' . $this->request->get['order'];
324
+			}
325
+
326
+			$data['limits'] = array();
327
+
328
+			$limits = array_unique(array($this->config->get('config_product_limit'), 25, 50, 75, 100));
329
+
330
+			sort($limits);
331
+
332
+			foreach ($limits as $value) {
333
+				$data['limits'][] = array(
334
+					'text'  => $value,
335
+					'value' => $value,
336
+					'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value)
337
+				);
338
+			}
339
+
340
+			$url = '';
341
+
342
+			if (isset($this->request->get['filter'])) {
343
+				$url .= '&filter=' . urldecode($this->request->get['filter']);
344
+			}
345
+
346
+			if (isset($this->request->get['sort'])) {
347
+				$url .= '&sort=' . $this->request->get['sort'];
348
+			}
349
+
350
+			if (isset($this->request->get['order'])) {
351
+				$url .= '&order=' . $this->request->get['order'];
352
+			}
353
+
354
+			if (isset($this->request->get['limit'])) {
355
+				$url .= '&limit=' . $this->request->get['limit'];
356
+			}
357
+
358
+			$pagination = new Pagination();
359
+			$pagination->total = $post_total;
360
+			$pagination->page = $page;
361
+			$pagination->limit = $limit;
362
+			$pagination->url = $this->url->link('post/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');
363
+
364
+			$data['pagination'] = $pagination->render();
365
+
366
+			$data['results'] = sprintf($this->language->get('text_pagination'), ($post_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($post_total - $limit)) ? $post_total : ((($page - 1) * $limit) + $limit), $post_total, ceil($post_total / $limit));
367
+
368
+			$data['sort'] = $sort;
369
+			$data['order'] = $order;
370
+			$data['limit'] = $limit;
371
+
372
+			$data['continue'] = $this->url->link('common/home');
373
+
374
+			$data['column_left'] = $this->load->controller('common/column_left');
375
+			$data['column_right'] = $this->load->controller('common/column_right');
376
+			$data['content_top'] = $this->load->controller('common/content_top');
377
+			$data['content_bottom'] = $this->load->controller('common/content_bottom');
378
+			$data['footer'] = $this->load->controller('common/footer');
379
+			$data['header'] = $this->load->controller('common/header');
380
+
381
+			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/category.tpl')) {
382
+				$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/category.tpl', $data));
383
+			} else {
384
+				$this->response->setOutput($this->load->view('default/template/blog/category.tpl', $data));
385
+			}
386
+		} else {
387
+			$this->load->language('error/not_found');
388
+
389
+			$url = '';
390 390
 
391
-            if (isset($this->request->get['path'])) {
392
-                $url .= '&path=' . $this->request->get['path'];
393
-            }
391
+			if (isset($this->request->get['path'])) {
392
+				$url .= '&path=' . $this->request->get['path'];
393
+			}
394 394
 
395
-            if (isset($this->request->get['filter'])) {
396
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
397
-            }
395
+			if (isset($this->request->get['filter'])) {
396
+				$url .= '&filter=' . urldecode($this->request->get['filter']);
397
+			}
398 398
 
399
-            if (isset($this->request->get['sort'])) {
400
-                $url .= '&sort=' . $this->request->get['sort'];
401
-            }
399
+			if (isset($this->request->get['sort'])) {
400
+				$url .= '&sort=' . $this->request->get['sort'];
401
+			}
402 402
 
403
-            if (isset($this->request->get['order'])) {
404
-                $url .= '&order=' . $this->request->get['order'];
405
-            }
403
+			if (isset($this->request->get['order'])) {
404
+				$url .= '&order=' . $this->request->get['order'];
405
+			}
406 406
 
407
-            if (isset($this->request->get['page'])) {
408
-                $url .= '&page=' . $this->request->get['page'];
409
-            }
407
+			if (isset($this->request->get['page'])) {
408
+				$url .= '&page=' . $this->request->get['page'];
409
+			}
410 410
 
411
-            if (isset($this->request->get['limit'])) {
412
-                $url .= '&limit=' . $this->request->get['limit'];
413
-            }
411
+			if (isset($this->request->get['limit'])) {
412
+				$url .= '&limit=' . $this->request->get['limit'];
413
+			}
414 414
 
415
-            if (isset($this->request->get['blogpath'])) {
416
-                $data['breadcrumbs'][] = array(
417
-                    'text' => $this->language->get('text_error'),
418
-                    'href' => $this->url->link('blog/category', $url)
419
-                );
420
-            }
415
+			if (isset($this->request->get['blogpath'])) {
416
+				$data['breadcrumbs'][] = array(
417
+					'text' => $this->language->get('text_error'),
418
+					'href' => $this->url->link('blog/category', $url)
419
+				);
420
+			}
421 421
 
422
-            $this->document->setTitle($this->language->get('text_error'));
422
+			$this->document->setTitle($this->language->get('text_error'));
423 423
 
424
-            $data['heading_title'] = $this->language->get('text_error');
424
+			$data['heading_title'] = $this->language->get('text_error');
425 425
 
426
-            $data['text_error'] = $this->language->get('text_error');
426
+			$data['text_error'] = $this->language->get('text_error');
427 427
 
428
-            $data['button_continue'] = $this->language->get('button_continue');
428
+			$data['button_continue'] = $this->language->get('button_continue');
429 429
 
430
-            $data['continue'] = $this->url->link('common/home');
430
+			$data['continue'] = $this->url->link('common/home');
431 431
 
432
-            $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
432
+			$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
433 433
 
434
-            $data['column_left']    = $this->load->controller('common/column_left');
435
-            $data['column_right']   = $this->load->controller('common/column_right');
436
-            $data['content_top']    = $this->load->controller('common/content_top');
437
-            $data['content_bottom'] = $this->load->controller('common/content_bottom');
438
-            $data['footer']         = $this->load->controller('common/footer');
439
-            $data['header']         = $this->load->controller('common/header');
434
+			$data['column_left']    = $this->load->controller('common/column_left');
435
+			$data['column_right']   = $this->load->controller('common/column_right');
436
+			$data['content_top']    = $this->load->controller('common/content_top');
437
+			$data['content_bottom'] = $this->load->controller('common/content_bottom');
438
+			$data['footer']         = $this->load->controller('common/footer');
439
+			$data['header']         = $this->load->controller('common/header');
440 440
 
441
-            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
442
-                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/error/not_found.tpl', $data));
443
-            } else {
444
-                $this->response->setOutput($this->load->view('default/template/error/not_found.tpl', $data));
445
-            }
446
-        }
447
-    }
441
+			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
442
+				$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/error/not_found.tpl', $data));
443
+			} else {
444
+				$this->response->setOutput($this->load->view('default/template/error/not_found.tpl', $data));
445
+			}
446
+		}
447
+	}
448 448
 }
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         $menu_home = $this->model_blog_post->checkMenu('home');
66 66
 
67
-        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
67
+        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog');
68 68
 
69 69
         $data['breadcrumbs'][] = array(
70 70
             'text' => $this->language->get('text_home'),
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
             $url = '';
81 81
 
82 82
             if (isset($this->request->get['sort'])) {
83
-                $url .= '&sort=' . $this->request->get['sort'];
83
+                $url .= '&sort='.$this->request->get['sort'];
84 84
             }
85 85
 
86 86
             if (isset($this->request->get['order'])) {
87
-                $url .= '&order=' . $this->request->get['order'];
87
+                $url .= '&order='.$this->request->get['order'];
88 88
             }
89 89
 
90 90
             if (isset($this->request->get['limit'])) {
91
-                $url .= '&limit=' . $this->request->get['limit'];
91
+                $url .= '&limit='.$this->request->get['limit'];
92 92
             }
93 93
 
94 94
             $path = '';
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                 if (!$path) {
102 102
                     $path = (int)$path_id;
103 103
                 } else {
104
-                    $path .= '_' . (int)$path_id;
104
+                    $path .= '_'.(int)$path_id;
105 105
                 }
106 106
 
107 107
                 $category_info = $this->model_blog_category->getCategory($path_id);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 if ($category_info) {
110 110
                     $data['breadcrumbs'][] = array(
111 111
                         'text' => $category_info['name'],
112
-                        'href' => $this->url->link('blog/category', 'path=' . $path . $url)
112
+                        'href' => $this->url->link('blog/category', 'path='.$path.$url)
113 113
                     );
114 114
                 }
115 115
             }
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
             $this->document->setDescription($category_info['meta_description']);
127 127
             $this->document->setKeywords($category_info['meta_keyword']);
128 128
             if (!$this->config->get('config_seo_url')) {
129
-                $this->document->addLink($this->url->link('blog/category', 'path=' . $this->request->get['path']), 'canonical');
129
+                $this->document->addLink($this->url->link('blog/category', 'path='.$this->request->get['path']), 'canonical');
130 130
             }
131 131
 
132
-            if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
133
-                $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
132
+            if (is_file(DIR_CATALOG.'view/theme/'.$this->config->get('config_template').'/stylesheet/blog.css')) {
133
+                $this->document->addStyle('catalog/view/theme/'.$this->config->get('config_template').'/stylesheet/blog.css');
134 134
             } else {
135 135
                 $this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
136 136
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             // Set the last category breadcrumb
141 141
             $data['breadcrumbs'][] = array(
142 142
                 'text' => $category_info['name'],
143
-                'href' => $this->url->link('blog/category', 'path=' . $this->request->get['path'])
143
+                'href' => $this->url->link('blog/category', 'path='.$this->request->get['path'])
144 144
             );
145 145
 
146 146
             $data['thumb'] = '';
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
             $url = '';
160 160
 
161 161
             if (isset($this->request->get['filter'])) {
162
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
162
+                $url .= '&filter='.urldecode($this->request->get['filter']);
163 163
             }
164 164
 
165 165
             if (isset($this->request->get['sort'])) {
166
-                $url .= '&sort=' . $this->request->get['sort'];
166
+                $url .= '&sort='.$this->request->get['sort'];
167 167
             }
168 168
 
169 169
             if (isset($this->request->get['order'])) {
170
-                $url .= '&order=' . $this->request->get['order'];
170
+                $url .= '&order='.$this->request->get['order'];
171 171
             }
172 172
 
173 173
             if (isset($this->request->get['limit'])) {
174
-                $url .= '&limit=' . $this->request->get['limit'];
174
+                $url .= '&limit='.$this->request->get['limit'];
175 175
             }
176 176
 
177 177
             $data['categories'] = array();
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
                 $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
188 188
 
189 189
                 $data['categories'][] = array(
190
-                    'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_blog_post->getTotalPosts($filter_data) . ')' : ''),
191
-                    'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
190
+                    'name'  => $result['name'].($this->config->get('config_product_count') ? ' ('.$this->model_blog_post->getTotalPosts($filter_data).')' : ''),
191
+                    'href'  => $this->url->link('blog/category', 'path='.$this->request->get['path'].'_'.$result['category_id'].$url),
192 192
                     'thumb' => $image
193 193
                 );
194 194
             }
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
                     'name'          => $result['name'],
228 228
                     'description'   => $result['description'],
229 229
                     'category'      => $category,
230
-                    'category_href' => $this->url->link('blog/category', 'path=' . $category_id),
230
+                    'category_href' => $this->url->link('blog/category', 'path='.$category_id),
231 231
                     'viewed'        => $result['viewed'],
232 232
                     'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
233 233
                     'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
234 234
                     'author'        => $result['author'],
235
-                    'author_href'   => $this->url->link('blog/home', 'filter_author=' . $result['author']),
236
-                    'href'          => $this->url->link('blog/post', 'path=' . $this->request->get['path'] . '&post_id=' . $result['post_id'])
235
+                    'author_href'   => $this->url->link('blog/home', 'filter_author='.$result['author']),
236
+                    'href'          => $this->url->link('blog/post', 'path='.$this->request->get['path'].'&post_id='.$result['post_id'])
237 237
                 );
238 238
             }
239 239
 
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
             $url = '';
245 245
 
246 246
             if (isset($this->request->get['filter'])) {
247
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
247
+                $url .= '&filter='.urldecode($this->request->get['filter']);
248 248
             }
249 249
 
250 250
             if (isset($this->request->get['limit'])) {
251
-                $url .= '&limit=' . $this->request->get['limit'];
251
+                $url .= '&limit='.$this->request->get['limit'];
252 252
             }
253 253
 
254 254
             $data['sorts'] = array();
@@ -256,71 +256,71 @@  discard block
 block discarded – undo
256 256
             $data['sorts'][] = array(
257 257
                 'text'  => $this->language->get('text_default'),
258 258
                 'value' => 'p.sort_order-ASC',
259
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
259
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=p.sort_order&order=ASC'.$url)
260 260
             );
261 261
 
262 262
             $data['sorts'][] = array(
263 263
                 'text'  => $this->language->get('text_name_asc'),
264 264
                 'value' => 'pd.name-ASC',
265
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url)
265
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=pd.name&order=ASC'.$url)
266 266
             );
267 267
 
268 268
             $data['sorts'][] = array(
269 269
                 'text'  => $this->language->get('text_name_desc'),
270 270
                 'value' => 'pd.name-DESC',
271
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url)
271
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=pd.name&order=DESC'.$url)
272 272
             );
273 273
 
274 274
             $data['sorts'][] = array(
275 275
                 'text'  => $this->language->get('text_price_asc'),
276 276
                 'value' => 'p.price-ASC',
277
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url)
277
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=p.price&order=ASC'.$url)
278 278
             );
279 279
 
280 280
             $data['sorts'][] = array(
281 281
                 'text'  => $this->language->get('text_price_desc'),
282 282
                 'value' => 'p.price-DESC',
283
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url)
283
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=p.price&order=DESC'.$url)
284 284
             );
285 285
 
286 286
             if ($this->config->get('config_review_status')) {
287 287
                 $data['sorts'][] = array(
288 288
                     'text'  => $this->language->get('text_rating_desc'),
289 289
                     'value' => 'rating-DESC',
290
-                    'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url)
290
+                    'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=rating&order=DESC'.$url)
291 291
                 );
292 292
 
293 293
                 $data['sorts'][] = array(
294 294
                     'text'  => $this->language->get('text_rating_asc'),
295 295
                     'value' => 'rating-ASC',
296
-                    'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url)
296
+                    'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=rating&order=ASC'.$url)
297 297
                 );
298 298
             }
299 299
 
300 300
             $data['sorts'][] = array(
301 301
                 'text'  => $this->language->get('text_model_asc'),
302 302
                 'value' => 'p.model-ASC',
303
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
303
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=p.model&order=ASC'.$url)
304 304
             );
305 305
 
306 306
             $data['sorts'][] = array(
307 307
                 'text'  => $this->language->get('text_model_desc'),
308 308
                 'value' => 'p.model-DESC',
309
-                'href'  => $this->url->link('post/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url)
309
+                'href'  => $this->url->link('post/category', 'path='.$this->request->get['path'].'&sort=p.model&order=DESC'.$url)
310 310
             );
311 311
 
312 312
             $url = '';
313 313
 
314 314
             if (isset($this->request->get['filter'])) {
315
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
315
+                $url .= '&filter='.urldecode($this->request->get['filter']);
316 316
             }
317 317
 
318 318
             if (isset($this->request->get['sort'])) {
319
-                $url .= '&sort=' . $this->request->get['sort'];
319
+                $url .= '&sort='.$this->request->get['sort'];
320 320
             }
321 321
 
322 322
             if (isset($this->request->get['order'])) {
323
-                $url .= '&order=' . $this->request->get['order'];
323
+                $url .= '&order='.$this->request->get['order'];
324 324
             }
325 325
 
326 326
             $data['limits'] = array();
@@ -333,33 +333,33 @@  discard block
 block discarded – undo
333 333
                 $data['limits'][] = array(
334 334
                     'text'  => $value,
335 335
                     'value' => $value,
336
-                    'href'  => $this->url->link('blog/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $value)
336
+                    'href'  => $this->url->link('blog/category', 'path='.$this->request->get['path'].$url.'&limit='.$value)
337 337
                 );
338 338
             }
339 339
 
340 340
             $url = '';
341 341
 
342 342
             if (isset($this->request->get['filter'])) {
343
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
343
+                $url .= '&filter='.urldecode($this->request->get['filter']);
344 344
             }
345 345
 
346 346
             if (isset($this->request->get['sort'])) {
347
-                $url .= '&sort=' . $this->request->get['sort'];
347
+                $url .= '&sort='.$this->request->get['sort'];
348 348
             }
349 349
 
350 350
             if (isset($this->request->get['order'])) {
351
-                $url .= '&order=' . $this->request->get['order'];
351
+                $url .= '&order='.$this->request->get['order'];
352 352
             }
353 353
 
354 354
             if (isset($this->request->get['limit'])) {
355
-                $url .= '&limit=' . $this->request->get['limit'];
355
+                $url .= '&limit='.$this->request->get['limit'];
356 356
             }
357 357
 
358 358
             $pagination = new Pagination();
359 359
             $pagination->total = $post_total;
360 360
             $pagination->page = $page;
361 361
             $pagination->limit = $limit;
362
-            $pagination->url = $this->url->link('post/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');
362
+            $pagination->url = $this->url->link('post/category', 'path='.$this->request->get['path'].$url.'&page={page}');
363 363
 
364 364
             $data['pagination'] = $pagination->render();
365 365
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
             $data['footer'] = $this->load->controller('common/footer');
379 379
             $data['header'] = $this->load->controller('common/header');
380 380
 
381
-            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/category.tpl')) {
382
-                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/category.tpl', $data));
381
+            if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/blog/category.tpl')) {
382
+                $this->response->setOutput($this->load->view($this->config->get('config_template').'/template/blog/category.tpl', $data));
383 383
             } else {
384 384
                 $this->response->setOutput($this->load->view('default/template/blog/category.tpl', $data));
385 385
             }
@@ -389,27 +389,27 @@  discard block
 block discarded – undo
389 389
             $url = '';
390 390
 
391 391
             if (isset($this->request->get['path'])) {
392
-                $url .= '&path=' . $this->request->get['path'];
392
+                $url .= '&path='.$this->request->get['path'];
393 393
             }
394 394
 
395 395
             if (isset($this->request->get['filter'])) {
396
-                $url .= '&filter=' . urldecode($this->request->get['filter']);
396
+                $url .= '&filter='.urldecode($this->request->get['filter']);
397 397
             }
398 398
 
399 399
             if (isset($this->request->get['sort'])) {
400
-                $url .= '&sort=' . $this->request->get['sort'];
400
+                $url .= '&sort='.$this->request->get['sort'];
401 401
             }
402 402
 
403 403
             if (isset($this->request->get['order'])) {
404
-                $url .= '&order=' . $this->request->get['order'];
404
+                $url .= '&order='.$this->request->get['order'];
405 405
             }
406 406
 
407 407
             if (isset($this->request->get['page'])) {
408
-                $url .= '&page=' . $this->request->get['page'];
408
+                $url .= '&page='.$this->request->get['page'];
409 409
             }
410 410
 
411 411
             if (isset($this->request->get['limit'])) {
412
-                $url .= '&limit=' . $this->request->get['limit'];
412
+                $url .= '&limit='.$this->request->get['limit'];
413 413
             }
414 414
 
415 415
             if (isset($this->request->get['blogpath'])) {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
             $data['continue'] = $this->url->link('common/home');
431 431
 
432
-            $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
432
+            $this->response->addHeader($this->request->server['SERVER_PROTOCOL'].' 404 Not Found');
433 433
 
434 434
             $data['column_left']    = $this->load->controller('common/column_left');
435 435
             $data['column_right']   = $this->load->controller('common/column_right');
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
             $data['footer']         = $this->load->controller('common/footer');
439 439
             $data['header']         = $this->load->controller('common/header');
440 440
 
441
-            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
442
-                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/error/not_found.tpl', $data));
441
+            if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/error/not_found.tpl')) {
442
+                $this->response->setOutput($this->load->view($this->config->get('config_template').'/template/error/not_found.tpl', $data));
443 443
             } else {
444 444
                 $this->response->setOutput($this->load->view('default/template/error/not_found.tpl', $data));
445 445
             }
Please login to merge, or discard this patch.
catalog/controller/blog/home.php 2 patches
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -9,197 +9,197 @@
 block discarded – undo
9 9
 
10 10
 class ControllerBlogHome extends Controller
11 11
 {
12
-    private $error = array();
12
+	private $error = array();
13 13
 
14
-    public function index()
15
-    {
16
-        $this->load->language('blog/home');
14
+	public function index()
15
+	{
16
+		$this->load->language('blog/home');
17 17
 
18
-        $this->load->model('blog/post');
19
-        $this->load->model('blog/comment');
18
+		$this->load->model('blog/post');
19
+		$this->load->model('blog/comment');
20 20
 
21
-        $this->load->model('tool/image');
21
+		$this->load->model('tool/image');
22 22
 
23
-        #Get All Language Text
24
-        $data = $this->language->all();
23
+		#Get All Language Text
24
+		$data = $this->language->all();
25 25
 
26
-        $data['breadcrumbs'] = array();
26
+		$data['breadcrumbs'] = array();
27 27
 
28
-        $menu_home = $this->model_blog_post->checkMenu('home');
28
+		$menu_home = $this->model_blog_post->checkMenu('home');
29 29
 
30
-        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
30
+		$text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
31 31
 
32
-        $data['breadcrumbs'][] = array(
33
-            'text' => $this->language->get('text_home'),
34
-            'href' => $this->url->link('common/home')
35
-        );
32
+		$data['breadcrumbs'][] = array(
33
+			'text' => $this->language->get('text_home'),
34
+			'href' => $this->url->link('common/home')
35
+		);
36 36
 
37
-        $data['breadcrumbs'][] = array(
38
-            'text' => $text_home,
39
-            'href' => $this->url->link('blog/home')
40
-        );
37
+		$data['breadcrumbs'][] = array(
38
+			'text' => $text_home,
39
+			'href' => $this->url->link('blog/home')
40
+		);
41 41
 
42
-        $filter_author = false;
42
+		$filter_author = false;
43 43
 
44
-        if (isset($this->request->get['filter_author'])) {
45
-            $filter_author = $this->request->get['filter_author'];
46
-        }
44
+		if (isset($this->request->get['filter_author'])) {
45
+			$filter_author = $this->request->get['filter_author'];
46
+		}
47 47
 
48
-        $filter_tag= false;
48
+		$filter_tag= false;
49 49
 
50
-        if (isset($this->request->get['tag'])) {
51
-            $filter_tag = $this->request->get['tag'];
52
-        }
50
+		if (isset($this->request->get['tag'])) {
51
+			$filter_tag = $this->request->get['tag'];
52
+		}
53 53
 
54
-        $page = 1;
54
+		$page = 1;
55 55
 
56
-        if (isset($this->request->get['page'])) {
57
-            $page = $this->request->get['page'];
58
-        }
56
+		if (isset($this->request->get['page'])) {
57
+			$page = $this->request->get['page'];
58
+		}
59 59
 
60
-        $limit = $this->config->get('config_blog_post_list_limit');
60
+		$limit = $this->config->get('config_blog_post_list_limit');
61 61
 
62
-        $data['posts'] = array();
63
-        $data['featured_posts'] = array();
62
+		$data['posts'] = array();
63
+		$data['featured_posts'] = array();
64 64
 
65
-        $results = $this->model_blog_post->getFeaturedPosts();
65
+		$results = $this->model_blog_post->getFeaturedPosts();
66 66
 
67
-        foreach ($results as $result) {
68
-            $image = '';
67
+		foreach ($results as $result) {
68
+			$image = '';
69 69
 
70
-            if ($result['image']) {
71
-                $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
72
-            }
70
+			if ($result['image']) {
71
+				$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
72
+			}
73 73
 
74
-            $category = $this->model_blog_post->getPostCategory($result['post_id']);
74
+			$category = $this->model_blog_post->getPostCategory($result['post_id']);
75 75
 
76
-            $comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
76
+			$comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
77 77
 
78
-            $this->trigger->fire('pre.post.display', array(&$result, 'home'));
78
+			$this->trigger->fire('pre.post.display', array(&$result, 'home'));
79 79
 
80
-            $data['featured_posts'][] = array(
81
-                'post_id'       => $result['post_id'],
82
-                'thumb'         => $image,
83
-                'name'          => $result['name'],
84
-                'description'   => $result['description'],
85
-                'category'      => $category['name'],
86
-                'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
87
-                'viewed'        => $result['viewed'],
88
-                'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
89
-                'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
90
-                'author'        => $result['author'],
91
-                'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
92
-                'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
93
-            );
94
-        }
80
+			$data['featured_posts'][] = array(
81
+				'post_id'       => $result['post_id'],
82
+				'thumb'         => $image,
83
+				'name'          => $result['name'],
84
+				'description'   => $result['description'],
85
+				'category'      => $category['name'],
86
+				'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
87
+				'viewed'        => $result['viewed'],
88
+				'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
89
+				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
90
+				'author'        => $result['author'],
91
+				'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
92
+				'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
93
+			);
94
+		}
95 95
 
96
-        $filter_data = array(
97
-            'filter_featured' => '0',
98
-            'filter_author'   => $filter_author,
99
-            'filter_tag'      => $filter_tag,
100
-            'start'           => ($page - 1) * $limit,
101
-            'limit'           => $limit
102
-        );
96
+		$filter_data = array(
97
+			'filter_featured' => '0',
98
+			'filter_author'   => $filter_author,
99
+			'filter_tag'      => $filter_tag,
100
+			'start'           => ($page - 1) * $limit,
101
+			'limit'           => $limit
102
+		);
103 103
 
104
-        $post_total = $this->model_blog_post->getTotalPosts($filter_data);
104
+		$post_total = $this->model_blog_post->getTotalPosts($filter_data);
105 105
 
106
-        $results = $this->model_blog_post->getPosts($filter_data);
106
+		$results = $this->model_blog_post->getPosts($filter_data);
107 107
 
108
-        foreach ($results as $result) {
109
-            $image = '';
108
+		foreach ($results as $result) {
109
+			$image = '';
110 110
 
111
-            if ($result['image']) {
112
-                $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
113
-            }
111
+			if ($result['image']) {
112
+				$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_blog_post_list_width'), $this->config->get('config_blog_post_list_height'));
113
+			}
114 114
 
115
-            $category = $this->model_blog_post->getPostCategory($result['post_id']);
115
+			$category = $this->model_blog_post->getPostCategory($result['post_id']);
116 116
 
117
-            $comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
117
+			$comment_total = $this->model_blog_comment->getTotalCommentsByPostId($result['post_id']);
118 118
 
119
-            $this->trigger->fire('pre.post.display', array(&$result, 'home'));
119
+			$this->trigger->fire('pre.post.display', array(&$result, 'home'));
120 120
 
121
-            $data['posts'][] = array(
122
-                'post_id'       => $result['post_id'],
123
-                'thumb'         => $image,
124
-                'name'          => $result['name'],
125
-                'description'   => $result['description'],
126
-                'category'      => $category['name'],
127
-                'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
128
-                'viewed'        => $result['viewed'],
129
-                'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
130
-                'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
131
-                'author'        => $result['author'],
132
-                'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
133
-                'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
134
-            );
135
-        }
121
+			$data['posts'][] = array(
122
+				'post_id'       => $result['post_id'],
123
+				'thumb'         => $image,
124
+				'name'          => $result['name'],
125
+				'description'   => $result['description'],
126
+				'category'      => $category['name'],
127
+				'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
128
+				'viewed'        => $result['viewed'],
129
+				'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
130
+				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
131
+				'author'        => $result['author'],
132
+				'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
133
+				'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
134
+			);
135
+		}
136 136
 
137
-        $data['author'] = $this->config->get('config_blog_post_list_author');
138
-        $data['category'] = $this->config->get('config_blog_post_list_category', 1);
139
-        $data['date_added'] = $this->config->get('config_blog_post_list_date');
140
-        $data['viewed'] = $this->config->get('config_blog_post_list_read');
137
+		$data['author'] = $this->config->get('config_blog_post_list_author');
138
+		$data['category'] = $this->config->get('config_blog_post_list_category', 1);
139
+		$data['date_added'] = $this->config->get('config_blog_post_list_date');
140
+		$data['viewed'] = $this->config->get('config_blog_post_list_read');
141 141
 
142
-        $data['heading_title'] = $this->config->get('config_blog_name');
142
+		$data['heading_title'] = $this->config->get('config_blog_name');
143 143
 
144
-        $title = ($this->config->get('config_blog_meta_title')) ? $this->config->get('config_blog_meta_title') : $this->config->get('config_blog_name');
145
-
146
-        $data['description'] = html_entity_decode($this->config->get('config_blog_description'), ENT_QUOTES, 'UTF-8');
144
+		$title = ($this->config->get('config_blog_meta_title')) ? $this->config->get('config_blog_meta_title') : $this->config->get('config_blog_name');
145
+
146
+		$data['description'] = html_entity_decode($this->config->get('config_blog_description'), ENT_QUOTES, 'UTF-8');
147 147
 
148
-        $this->document->setTitle($title);
149
-        $this->document->setDescription($this->config->get('config_blog_meta_description'));
150
-        $this->document->setKeywords($this->config->get('config_blog_meta_keyword'));
151
-        if (!$this->config->get('config_seo_url')) {
152
-            $this->document->addLink($this->url->link('blog/home'), 'canonical');
153
-        }
154
-
155
-        $this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.carousel.css');
156
-        $this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.transitions.css');
157
-        $this->document->addScript('catalog/view/javascript/jquery/owl-carousel/owl.carousel.min.js');
158
-
159
-        if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
160
-            $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
161
-        } else {
162
-            $this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
163
-        }
164
-
165
-        $data['description'] = html_entity_decode($this->config->get('config_blog_description'), ENT_QUOTES, 'UTF-8');
166
-
167
-        $data['date_added_status']     = $this->config->get('blogsetting_date_added');
168
-        $data['comments_count_status'] = $this->config->get('blogsetting_comments_count');
169
-        $data['page_view_status']      = $this->config->get('blogsetting_page_view');
170
-        $data['author_status']         = $this->config->get('blogsetting_author');
171
-        $data['list_columns']          = $this->config->get('blogsetting_layout');
172
-
173
-        $data['continue'] = $this->url->link('common/home');
174
-
175
-        $url = '';
176
-
177
-        if (isset($this->request->get['page'])) {
178
-            $url .= '&page=' . $this->request->get['page'];
179
-        }
180
-
181
-        $pagination        = new Pagination();
182
-        $pagination->total = $post_total;
183
-        $pagination->page  = $page;
184
-        $pagination->limit = $limit;
185
-        $pagination->text  = $this->language->get('text_pagination');
186
-        $pagination->url   = $this->url->link('blog/home', $url . '&page={page}');
187
-
188
-        $data['pagination'] = $pagination->render();
189
-
190
-        $data['results'] = sprintf($this->language->get('text_pagination'), ($post_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($post_total - $limit)) ? $post_total : ((($page - 1) * $limit) + $limit), $post_total, ceil($post_total / $limit));
191
-
192
-        $data['column_left']    = $this->load->controller('common/column_left');
193
-        $data['column_right']   = $this->load->controller('common/column_right');
194
-        $data['content_top']    = $this->load->controller('common/content_top');
195
-        $data['content_bottom'] = $this->load->controller('common/content_bottom');
196
-        $data['footer']         = $this->load->controller('common/footer');
197
-        $data['header']         = $this->load->controller('common/header');
198
-
199
-        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/home.tpl')) {
200
-            $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/home.tpl', $data));
201
-        } else {
202
-            $this->response->setOutput($this->load->view('default/template/blog/home.tpl', $data));
203
-        }
204
-    }
148
+		$this->document->setTitle($title);
149
+		$this->document->setDescription($this->config->get('config_blog_meta_description'));
150
+		$this->document->setKeywords($this->config->get('config_blog_meta_keyword'));
151
+		if (!$this->config->get('config_seo_url')) {
152
+			$this->document->addLink($this->url->link('blog/home'), 'canonical');
153
+		}
154
+
155
+		$this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.carousel.css');
156
+		$this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.transitions.css');
157
+		$this->document->addScript('catalog/view/javascript/jquery/owl-carousel/owl.carousel.min.js');
158
+
159
+		if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
160
+			$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
161
+		} else {
162
+			$this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
163
+		}
164
+
165
+		$data['description'] = html_entity_decode($this->config->get('config_blog_description'), ENT_QUOTES, 'UTF-8');
166
+
167
+		$data['date_added_status']     = $this->config->get('blogsetting_date_added');
168
+		$data['comments_count_status'] = $this->config->get('blogsetting_comments_count');
169
+		$data['page_view_status']      = $this->config->get('blogsetting_page_view');
170
+		$data['author_status']         = $this->config->get('blogsetting_author');
171
+		$data['list_columns']          = $this->config->get('blogsetting_layout');
172
+
173
+		$data['continue'] = $this->url->link('common/home');
174
+
175
+		$url = '';
176
+
177
+		if (isset($this->request->get['page'])) {
178
+			$url .= '&page=' . $this->request->get['page'];
179
+		}
180
+
181
+		$pagination        = new Pagination();
182
+		$pagination->total = $post_total;
183
+		$pagination->page  = $page;
184
+		$pagination->limit = $limit;
185
+		$pagination->text  = $this->language->get('text_pagination');
186
+		$pagination->url   = $this->url->link('blog/home', $url . '&page={page}');
187
+
188
+		$data['pagination'] = $pagination->render();
189
+
190
+		$data['results'] = sprintf($this->language->get('text_pagination'), ($post_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($post_total - $limit)) ? $post_total : ((($page - 1) * $limit) + $limit), $post_total, ceil($post_total / $limit));
191
+
192
+		$data['column_left']    = $this->load->controller('common/column_left');
193
+		$data['column_right']   = $this->load->controller('common/column_right');
194
+		$data['content_top']    = $this->load->controller('common/content_top');
195
+		$data['content_bottom'] = $this->load->controller('common/content_bottom');
196
+		$data['footer']         = $this->load->controller('common/footer');
197
+		$data['header']         = $this->load->controller('common/header');
198
+
199
+		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/home.tpl')) {
200
+			$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/home.tpl', $data));
201
+		} else {
202
+			$this->response->setOutput($this->load->view('default/template/blog/home.tpl', $data));
203
+		}
204
+	}
205 205
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
         $menu_home = $this->model_blog_post->checkMenu('home');
29 29
 
30
-        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog') ;
30
+        $text_home = ($menu_home) ? $menu_home : $this->language->get('text_blog');
31 31
 
32 32
         $data['breadcrumbs'][] = array(
33 33
             'text' => $this->language->get('text_home'),
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             $filter_author = $this->request->get['filter_author'];
46 46
         }
47 47
 
48
-        $filter_tag= false;
48
+        $filter_tag = false;
49 49
 
50 50
         if (isset($this->request->get['tag'])) {
51 51
             $filter_tag = $this->request->get['tag'];
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
                 'name'          => $result['name'],
84 84
                 'description'   => $result['description'],
85 85
                 'category'      => $category['name'],
86
-                'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
86
+                'category_href' => $this->url->link('blog/category', 'path='.$category['category_id']),
87 87
                 'viewed'        => $result['viewed'],
88 88
                 'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
89 89
                 'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
90 90
                 'author'        => $result['author'],
91
-                'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
92
-                'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
91
+                'author_href'   => $this->url->link('blog/home', 'filter_author='.rawurlencode($result['author'])),
92
+                'href'          => $this->url->link('blog/post', 'post_id='.$result['post_id'])
93 93
             );
94 94
         }
95 95
 
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
                 'name'          => $result['name'],
125 125
                 'description'   => $result['description'],
126 126
                 'category'      => $category['name'],
127
-                'category_href' => $this->url->link('blog/category', 'path=' . $category['category_id']),
127
+                'category_href' => $this->url->link('blog/category', 'path='.$category['category_id']),
128 128
                 'viewed'        => $result['viewed'],
129 129
                 'comment_total' => sprintf((($comment_total > 1) ? $this->language->get('text_comment_totals') : $this->language->get('text_comment_total')), $comment_total),
130 130
                 'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_available'])),
131 131
                 'author'        => $result['author'],
132
-                'author_href'   => $this->url->link('blog/home', 'filter_author=' . rawurlencode($result['author'])),
133
-                'href'          => $this->url->link('blog/post', 'post_id=' . $result['post_id'])
132
+                'author_href'   => $this->url->link('blog/home', 'filter_author='.rawurlencode($result['author'])),
133
+                'href'          => $this->url->link('blog/post', 'post_id='.$result['post_id'])
134 134
             );
135 135
         }
136 136
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
         $this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.transitions.css');
157 157
         $this->document->addScript('catalog/view/javascript/jquery/owl-carousel/owl.carousel.min.js');
158 158
 
159
-        if (is_file(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css')) {
160
-            $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/blog.css');
159
+        if (is_file(DIR_CATALOG.'view/theme/'.$this->config->get('config_template').'/stylesheet/blog.css')) {
160
+            $this->document->addStyle('catalog/view/theme/'.$this->config->get('config_template').'/stylesheet/blog.css');
161 161
         } else {
162 162
             $this->document->addStyle('catalog/view/theme/default/stylesheet/blog.css');
163 163
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $url = '';
176 176
 
177 177
         if (isset($this->request->get['page'])) {
178
-            $url .= '&page=' . $this->request->get['page'];
178
+            $url .= '&page='.$this->request->get['page'];
179 179
         }
180 180
 
181 181
         $pagination        = new Pagination();
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $pagination->page  = $page;
184 184
         $pagination->limit = $limit;
185 185
         $pagination->text  = $this->language->get('text_pagination');
186
-        $pagination->url   = $this->url->link('blog/home', $url . '&page={page}');
186
+        $pagination->url   = $this->url->link('blog/home', $url.'&page={page}');
187 187
 
188 188
         $data['pagination'] = $pagination->render();
189 189
 
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
         $data['footer']         = $this->load->controller('common/footer');
197 197
         $data['header']         = $this->load->controller('common/header');
198 198
 
199
-        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/blog/home.tpl')) {
200
-            $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/blog/home.tpl', $data));
199
+        if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/blog/home.tpl')) {
200
+            $this->response->setOutput($this->load->view($this->config->get('config_template').'/template/blog/home.tpl', $data));
201 201
         } else {
202 202
             $this->response->setOutput($this->load->view('default/template/blog/home.tpl', $data));
203 203
         }
Please login to merge, or discard this patch.