Skip to content

Commit feff16c

Browse files
author
blueyon
committed
1.4.0
1 parent 0ec1852 commit feff16c

File tree

2,477 files changed

+263943
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,477 files changed

+263943
-0
lines changed

upload/.htaccess.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
2+
3+
# 2. In your opencart directory rename htaccess.txt to .htaccess.
4+
5+
# For any support issues please visit: http://www.opencart.com
6+
7+
Options +FollowSymlinks
8+
9+
RewriteEngine On
10+
RewriteBase /
11+
RewriteCond %{REQUEST_FILENAME} !-f
12+
RewriteCond %{REQUEST_FILENAME} !-d
13+
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

upload/admin/config.php

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
<?php
2+
class ControllerCatalogCategory extends Controller {
3+
private $error = array();
4+
5+
public function index() {
6+
$this->load->language('catalog/category');
7+
8+
$this->document->title = $this->language->get('heading_title');
9+
10+
$this->load->model('catalog/category');
11+
12+
$this->getList();
13+
}
14+
15+
public function insert() {
16+
$this->load->language('catalog/category');
17+
18+
$this->document->title = $this->language->get('heading_title');
19+
20+
$this->load->model('catalog/category');
21+
22+
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
23+
$this->model_catalog_category->addCategory($this->request->post);
24+
25+
$this->session->data['success'] = $this->language->get('text_success');
26+
27+
$this->redirect($this->url->https('catalog/category'));
28+
}
29+
30+
$this->getForm();
31+
}
32+
33+
public function update() {
34+
$this->load->language('catalog/category');
35+
36+
$this->document->title = $this->language->get('heading_title');
37+
38+
$this->load->model('catalog/category');
39+
40+
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
41+
$this->model_catalog_category->editCategory($this->request->get['category_id'], $this->request->post);
42+
43+
$this->session->data['success'] = $this->language->get('text_success');
44+
45+
$this->redirect($this->url->https('catalog/category'));
46+
}
47+
48+
$this->getForm();
49+
}
50+
51+
public function delete() {
52+
$this->load->language('catalog/category');
53+
54+
$this->document->title = $this->language->get('heading_title');
55+
56+
$this->load->model('catalog/category');
57+
58+
if (isset($this->request->post['selected']) && $this->validateDelete()) {
59+
foreach ($this->request->post['selected'] as $category_id) {
60+
$this->model_catalog_category->deleteCategory($category_id);
61+
}
62+
63+
$this->session->data['success'] = $this->language->get('text_success');
64+
65+
$this->redirect($this->url->https('catalog/category'));
66+
}
67+
68+
$this->getList();
69+
}
70+
71+
private function getList() {
72+
$this->document->breadcrumbs = array();
73+
74+
$this->document->breadcrumbs[] = array(
75+
'href' => $this->url->https('common/home'),
76+
'text' => $this->language->get('text_home'),
77+
'separator' => FALSE
78+
);
79+
80+
$this->document->breadcrumbs[] = array(
81+
'href' => $this->url->https('catalog/category'),
82+
'text' => $this->language->get('heading_title'),
83+
'separator' => ' :: '
84+
);
85+
86+
$this->data['insert'] = $this->url->https('catalog/category/insert');
87+
$this->data['delete'] = $this->url->https('catalog/category/delete');
88+
89+
$this->data['categories'] = array();
90+
91+
$results = $this->model_catalog_category->getCategories(0);
92+
93+
foreach ($results as $result) {
94+
$action = array();
95+
96+
$action[] = array(
97+
'text' => $this->language->get('text_edit'),
98+
'href' => $this->url->https('catalog/category/update&category_id=' . $result['category_id'])
99+
);
100+
101+
$this->data['categories'][] = array(
102+
'category_id' => $result['category_id'],
103+
'name' => $result['name'],
104+
'sort_order' => $result['sort_order'],
105+
'selected' => isset($this->request->post['selected']) && in_array($result['category_id'], $this->request->post['selected']),
106+
'action' => $action
107+
);
108+
}
109+
110+
$this->data['heading_title'] = $this->language->get('heading_title');
111+
112+
$this->data['text_no_results'] = $this->language->get('text_no_results');
113+
114+
$this->data['column_name'] = $this->language->get('column_name');
115+
$this->data['column_sort_order'] = $this->language->get('column_sort_order');
116+
$this->data['column_action'] = $this->language->get('column_action');
117+
118+
$this->data['button_insert'] = $this->language->get('button_insert');
119+
$this->data['button_delete'] = $this->language->get('button_delete');
120+
121+
if (isset($this->error['warning'])) {
122+
$this->data['error_warning'] = $this->error['warning'];
123+
} else {
124+
$this->data['error_warning'] = '';
125+
}
126+
127+
if (isset($this->session->data['success'])) {
128+
$this->data['success'] = $this->session->data['success'];
129+
130+
unset($this->session->data['success']);
131+
} else {
132+
$this->data['success'] = '';
133+
}
134+
135+
$this->template = 'catalog/category_list.tpl';
136+
$this->children = array(
137+
'common/header',
138+
'common/footer'
139+
);
140+
141+
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
142+
}
143+
144+
private function getForm() {
145+
$this->data['heading_title'] = $this->language->get('heading_title');
146+
147+
$this->data['text_none'] = $this->language->get('text_none');
148+
$this->data['text_image_manager'] = $this->language->get('text_image_manager');
149+
150+
$this->data['entry_name'] = $this->language->get('entry_name');
151+
$this->data['entry_keyword'] = $this->language->get('entry_keyword');
152+
$this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
153+
$this->data['entry_description'] = $this->language->get('entry_description');
154+
$this->data['entry_category'] = $this->language->get('entry_category');
155+
$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
156+
$this->data['entry_image'] = $this->language->get('entry_image');
157+
158+
$this->data['button_save'] = $this->language->get('button_save');
159+
$this->data['button_cancel'] = $this->language->get('button_cancel');
160+
161+
if (isset($this->error['warning'])) {
162+
$this->data['error_warning'] = $this->error['warning'];
163+
} else {
164+
$this->data['error_warning'] = '';
165+
}
166+
167+
if (isset($this->error['name'])) {
168+
$this->data['error_name'] = $this->error['name'];
169+
} else {
170+
$this->data['error_name'] = '';
171+
}
172+
173+
$this->document->breadcrumbs = array();
174+
175+
$this->document->breadcrumbs[] = array(
176+
'href' => $this->url->https('common/home'),
177+
'text' => $this->language->get('text_home'),
178+
'separator' => FALSE
179+
);
180+
181+
$this->document->breadcrumbs[] = array(
182+
'href' => $this->url->https('catalog/category'),
183+
'text' => $this->language->get('heading_title'),
184+
'separator' => ' :: '
185+
);
186+
187+
if (!isset($this->request->get['category_id'])) {
188+
$this->data['action'] = $this->url->https('catalog/category/insert');
189+
} else {
190+
$this->data['action'] = $this->url->https('catalog/category/update&category_id=' . $this->request->get['category_id']);
191+
}
192+
193+
$this->data['cancel'] = $this->url->https('catalog/category');
194+
195+
if (isset($this->request->get['category_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
196+
$category_info = $this->model_catalog_category->getCategory($this->request->get['category_id']);
197+
}
198+
199+
$this->load->model('localisation/language');
200+
201+
$this->data['languages'] = $this->model_localisation_language->getLanguages();
202+
203+
if (isset($this->request->post['category_description'])) {
204+
$this->data['category_description'] = $this->request->post['category_description'];
205+
} elseif (isset($category_info)) {
206+
$this->data['category_description'] = $this->model_catalog_category->getCategoryDescriptions($this->request->get['category_id']);
207+
} else {
208+
$this->data['category_description'] = array();
209+
}
210+
211+
if (isset($this->request->post['keyword'])) {
212+
$this->data['keyword'] = $this->request->post['keyword'];
213+
} elseif (isset($category_info)) {
214+
$this->data['keyword'] = $category_info['keyword'];
215+
} else {
216+
$this->data['keyword'] = '';
217+
}
218+
219+
$this->data['categories'] = $this->model_catalog_category->getCategories(0);
220+
221+
if (isset($this->request->post['parent_id'])) {
222+
$this->data['parent_id'] = $this->request->post['parent_id'];
223+
} elseif (isset($category_info)) {
224+
$this->data['parent_id'] = $category_info['parent_id'];
225+
} else {
226+
$this->data['parent_id'] = 0;
227+
}
228+
229+
if (isset($this->request->post['image'])) {
230+
$this->data['image'] = $this->request->post['image'];
231+
} elseif (isset($category_info)) {
232+
$this->data['image'] = $category_info['image'];
233+
} else {
234+
$this->data['image'] = '';
235+
}
236+
237+
$this->load->helper('image');
238+
239+
if (isset($category_info) && $category_info['image'] && file_exists(DIR_IMAGE . $category_info['image'])) {
240+
$this->data['preview'] = image_resize($category_info['image'], 100, 100);
241+
} else {
242+
$this->data['preview'] = image_resize('no_image.jpg', 100, 100);
243+
}
244+
245+
if (isset($this->request->post['sort_order'])) {
246+
$this->data['sort_order'] = $this->request->post['sort_order'];
247+
} elseif (isset($category_info)) {
248+
$this->data['sort_order'] = $category_info['sort_order'];
249+
} else {
250+
$this->data['sort_order'] = 0;
251+
}
252+
253+
$this->template = 'catalog/category_form.tpl';
254+
$this->children = array(
255+
'common/header',
256+
'common/footer'
257+
);
258+
259+
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
260+
}
261+
262+
private function validateForm() {
263+
if (!$this->user->hasPermission('modify', 'catalog/category')) {
264+
$this->error['warning'] = $this->language->get('error_permission');
265+
}
266+
267+
foreach ($this->request->post['category_description'] as $language_id => $value) {
268+
if ((strlen(utf8_decode($value['name'])) < 2) || (strlen(utf8_decode($value['name'])) > 32)) {
269+
$this->error['name'][$language_id] = $this->language->get('error_name');
270+
}
271+
}
272+
273+
if (!$this->error) {
274+
return TRUE;
275+
} else {
276+
return FALSE;
277+
}
278+
}
279+
280+
private function validateDelete() {
281+
if (!$this->user->hasPermission('modify', 'catalog/category')) {
282+
$this->error['warning'] = $this->language->get('error_permission');
283+
}
284+
285+
if (!$this->error) {
286+
return TRUE;
287+
} else {
288+
return FALSE;
289+
}
290+
}
291+
}
292+
?>

0 commit comments

Comments
 (0)