uawdijnntqw1x1x1
IP : 13.58.26.236
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
sudancam
/
public_html
/
..
/
.trash
/
.
/
admin.1
/
controller
/
catalog
/
.
/
review.php
/
/
<?php namespace Opencart\Admin\Controller\Catalog; class Review extends \Opencart\System\Engine\Controller { public function index(): void { $this->load->language('catalog/review'); $this->document->setTitle($this->language->get('heading_title')); $url = ''; if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_author'])) { $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_status'])) { $url .= '&filter_status=' . $this->request->get['filter_status']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = []; $data['breadcrumbs'][] = [ 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token']) ]; $data['breadcrumbs'][] = [ 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url) ]; $data['add'] = $this->url->link('catalog/review|form', 'user_token=' . $this->session->data['user_token'] . $url); $data['delete'] = $this->url->link('catalog/review|delete', 'user_token=' . $this->session->data['user_token']); $data['list'] = $this->getList(); $data['user_token'] = $this->session->data['user_token']; $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('catalog/review', $data)); } public function list(): void { $this->load->language('catalog/review'); $this->response->setOutput($this->getList()); } protected function getList(): string { if (isset($this->request->get['filter_product'])) { $filter_product = $this->request->get['filter_product']; } else { $filter_product = ''; } if (isset($this->request->get['filter_author'])) { $filter_author = $this->request->get['filter_author']; } else { $filter_author = ''; } if (isset($this->request->get['filter_status'])) { $filter_status = $this->request->get['filter_status']; } else { $filter_status = ''; } if (isset($this->request->get['filter_date_added'])) { $filter_date_added = $this->request->get['filter_date_added']; } else { $filter_date_added = ''; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'DESC'; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'r.date_added'; } if (isset($this->request->get['page'])) { $page = (int)$this->request->get['page']; } else { $page = 1; } $url = ''; if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_author'])) { $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_status'])) { $url .= '&filter_status=' . $this->request->get['filter_status']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['action'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . $url); $data['reviews'] = []; $filter_data = [ 'filter_product' => $filter_product, 'filter_author' => $filter_author, 'filter_status' => $filter_status, 'filter_date_added' => $filter_date_added, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $this->config->get('config_pagination_admin'), 'limit' => $this->config->get('config_pagination_admin') ]; $this->load->model('catalog/review'); $review_total = $this->model_catalog_review->getTotalReviews($filter_data); $results = $this->model_catalog_review->getReviews($filter_data); foreach ($results as $result) { $data['reviews'][] = [ 'review_id' => $result['review_id'], 'name' => $result['name'], 'author' => $result['author'], 'rating' => $result['rating'], 'status' => ($result['status']) ? $this->language->get('text_enabled') : $this->language->get('text_disabled'), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'edit' => $this->url->link('catalog/review|form', 'user_token=' . $this->session->data['user_token'] . '&review_id=' . $result['review_id'] . $url) ]; } $url = ''; if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_author'])) { $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_status'])) { $url .= '&filter_status=' . $this->request->get['filter_status']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if ($order == 'ASC') { $url .= '&order=DESC'; } else { $url .= '&order=ASC'; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['sort_product'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url); $data['sort_author'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.author' . $url); $data['sort_rating'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.rating' . $url); $data['sort_status'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.status' . $url); $data['sort_date_added'] = $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_added' . $url); $url = ''; if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_author'])) { $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_status'])) { $url .= '&filter_status=' . $this->request->get['filter_status']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['pagination'] = $this->load->controller('common/pagination', [ 'total' => $review_total, 'page' => $page, 'limit' => $this->config->get('config_pagination_admin'), 'url' => $this->url->link('catalog/review|list', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}') ]); $data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * $this->config->get('config_pagination_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_pagination_admin')) > ($review_total - $this->config->get('config_pagination_admin'))) ? $review_total : ((($page - 1) * $this->config->get('config_pagination_admin')) + $this->config->get('config_pagination_admin')), $review_total, ceil($review_total / $this->config->get('config_pagination_admin'))); $data['filter_product'] = $filter_product; $data['filter_author'] = $filter_author; $data['filter_status'] = $filter_status; $data['filter_date_added'] = $filter_date_added; $data['sort'] = $sort; $data['order'] = $order; return $this->load->view('catalog/review_list', $data); } public function form(): void { $this->load->language('catalog/review'); $this->document->setTitle($this->language->get('heading_title')); $data['text_form'] = !isset($this->request->get['review_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); $url = ''; if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_author'])) { $url .= '&filter_author=' . urlencode(html_entity_decode($this->request->get['filter_author'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_status'])) { $url .= '&filter_status=' . $this->request->get['filter_status']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = []; $data['breadcrumbs'][] = [ 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token']) ]; $data['breadcrumbs'][] = [ 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url) ]; $data['save'] = $this->url->link('catalog/review|save', 'user_token=' . $this->session->data['user_token']); $data['back'] = $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token'] . $url); if (isset($this->request->get['review_id'])) { $this->load->model('catalog/review'); $review_info = $this->model_catalog_review->getReview($this->request->get['review_id']); } if (isset($this->request->get['review_id'])) { $data['review_id'] = (int)$this->request->get['review_id']; } else { $data['review_id'] = 0; } $this->load->model('catalog/product'); if (!empty($review_info)) { $data['product_id'] = $review_info['product_id']; } else { $data['product_id'] = ''; } if (!empty($review_info)) { $data['product'] = $review_info['product']; } else { $data['product'] = ''; } if (!empty($review_info)) { $data['author'] = $review_info['author']; } else { $data['author'] = ''; } if (!empty($review_info)) { $data['text'] = $review_info['text']; } else { $data['text'] = ''; } if (!empty($review_info)) { $data['rating'] = $review_info['rating']; } else { $data['rating'] = ''; } if (!empty($review_info)) { $data['date_added'] = ($review_info['date_added'] != '0000-00-00 00:00' ? $review_info['date_added'] : date('Y-m-d')); } else { $data['date_added'] = date('Y-m-d'); } if (!empty($review_info)) { $data['status'] = $review_info['status']; } else { $data['status'] = ''; } $data['user_token'] = $this->session->data['user_token']; $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('catalog/review_form', $data)); } public function save(): void { $this->load->language('catalog/review'); $json = []; if (!$this->user->hasPermission('modify', 'catalog/review')) { $json['error']['warning'] = $this->language->get('error_permission'); } if ((utf8_strlen($this->request->post['author']) < 3) || (utf8_strlen($this->request->post['author']) > 64)) { $json['error']['author'] = $this->language->get('error_author'); } if (!$this->request->post['product_id']) { $json['error']['product'] = $this->language->get('error_product'); } if (utf8_strlen($this->request->post['text']) < 1) { $json['error']['text'] = $this->language->get('error_text'); } if (!isset($this->request->post['rating']) || $this->request->post['rating'] < 0 || $this->request->post['rating'] > 5) { $json['error']['rating'] = $this->language->get('error_rating'); } if (isset($json['error']) && !isset($json['error']['warning'])) { $json['error']['warning'] = $this->language->get('error_warning'); } if (!$json) { $this->load->model('catalog/review'); if (!$this->request->post['review_id']) { $json['review_id'] = $this->model_catalog_review->addReview($this->request->post); } else { $this->model_catalog_review->editReview($this->request->post['review_id'], $this->request->post); } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function delete(): void { $this->load->language('catalog/review'); $json = []; if (isset($this->request->post['selected'])) { $selected = $this->request->post['selected']; } else { $selected = []; } if (!$this->user->hasPermission('modify', 'catalog/review')) { $json['error'] = $this->language->get('error_permission'); } if (!$json) { $this->load->model('catalog/review'); foreach ($selected as $review_id) { $this->model_catalog_review->deleteReview($review_id); } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } }
/home/sudancam/public_html/../.trash/./admin.1/controller/catalog/./review.php