Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion upload/admin/controller/blog/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ private function getCategories($parent_id, $parent_path = '', $indent = '') {
$data['breadcrumbs'][] = array(
'text' => $result['name'],
'href' => $href,
'separator' => ' :: '
);
$href = '';
}
Expand Down
1 change: 0 additions & 1 deletion upload/catalog/controller/account/recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public function index() {
$pagination->total = $recurring_total;
$pagination->page = $page;
$pagination->limit = 10;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('account/recurring', 'page={page}', true);

$data['pagination'] = $pagination->render();
Expand Down
25 changes: 9 additions & 16 deletions upload/catalog/controller/blog/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function index() {

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
'href' => $this->url->link('common/home'),
);

$configblog_name = $this->config->get('configblog_name');
Expand Down Expand Up @@ -126,10 +125,6 @@ public function index() {
$this->document->addLink($this->url->link('blog/article', 'article_id=' . $this->request->get['article_id']), 'canonical');
$this->document->addScript('catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js');
$this->document->addStyle('catalog/view/javascript/jquery/magnific/magnific-popup.css');
$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js');
$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js');
$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');
$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');

if ($article_info['meta_h1']) {
$data['heading_title'] = $article_info['meta_h1'];
Expand Down Expand Up @@ -382,7 +377,7 @@ public function index() {
$url .= '&filter_news_id=' . $this->request->get['filter_news_id'];
}

$data['breadcrumbs'][] = array(
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_error'),
'href' => $this->url->link('product/product', $url . '&product_id=' . $article_id)
);
Expand Down Expand Up @@ -428,8 +423,6 @@ public function download() {

$download_info = $this->model_blog_article->getDownload($article_id, $download_id);



if ($download_info) {
$file = DIR_DOWNLOAD . $download_info['filename'];
$mask = basename($download_info['mask']);
Expand All @@ -455,7 +448,7 @@ public function download() {
exit('Error: Headers already sent out!');
}
} else {
$this->redirect(HTTP_SERVER . 'index.php?route=account/download');
$this->response->redirect($this->url->link('account/download'));
}
}

Expand All @@ -473,11 +466,13 @@ public function review() {
$page = 1;
}

$limit = 5;

$data['reviews'] = array();

$review_total = $this->model_blog_review->getTotalReviewsByArticleId($this->request->get['article_id']);

$results = $this->model_blog_review->getReviewsByArticleId($this->request->get['article_id'], ($page - 1) * 5, 5);
$results = $this->model_blog_review->getReviewsByArticleId($this->request->get['article_id'], ($page - 1) * $limit, $limit);

foreach ($results as $result) {
$data['reviews'][] = array(
Expand All @@ -492,15 +487,14 @@ public function review() {
$pagination = new Pagination();
$pagination->total = $review_total;
$pagination->page = $page;
$pagination->limit = 5;
$pagination->limit = $limit;
$pagination->url = $this->url->link('blog/article/review', 'article_id=' . $this->request->get['article_id'] . '&page={page}');

$data['pagination'] = $pagination->render();

$data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * 5) + 1 : 0, ((($page - 1) * 5) > ($review_total - 5)) ? $review_total : ((($page - 1) * 5) + 5), $review_total, ceil($review_total / 5));
$data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($review_total - $limit)) ? $review_total : ((($page - 1) * $limit) + $limit), $review_total, ceil($review_total / $limit));

$this->response->setOutput($this->load->view('blog/review', $data));

}

public function write() {
Expand Down Expand Up @@ -552,5 +546,4 @@ public function write() {
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
}
?>
}
4 changes: 1 addition & 3 deletions upload/catalog/controller/blog/latest.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ public function index() {
$pagination->total = $article_total;
$pagination->page = $page;
$pagination->limit = $limit;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('blog/latest', $url . '&page={page}');

$data['pagination'] = $pagination->render();
Expand All @@ -291,5 +290,4 @@ public function index() {

$this->response->setOutput($this->load->view('blog/latest', $data));
}
}
?>
}
12 changes: 12 additions & 0 deletions upload/catalog/controller/common/column_left.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public function index() {
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
}

if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) {
$this->load->model('blog/category');

$layout_id = $this->model_blog_category->getCategoryLayoutId($this->request->get['blog_category_id']);
}

if ($route == 'blog/article' && isset($this->request->get['article_id'])) {
$this->load->model('blog/article');

$layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']);
}

if (!$layout_id) {
$layout_id = $this->model_design_layout->getLayout($route);
}
Expand Down
12 changes: 12 additions & 0 deletions upload/catalog/controller/common/column_right.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public function index() {
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
}

if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) {
$this->load->model('blog/category');

$layout_id = $this->model_blog_category->getCategoryLayoutId($this->request->get['blog_category_id']);
}

if ($route == 'blog/article' && isset($this->request->get['article_id'])) {
$this->load->model('blog/article');

$layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']);
}

if (!$layout_id) {
$layout_id = $this->model_design_layout->getLayout($route);
}
Expand Down
12 changes: 12 additions & 0 deletions upload/catalog/controller/common/content_bottom.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public function index() {
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
}

if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) {
$this->load->model('blog/category');

$layout_id = $this->model_blog_category->getCategoryLayoutId($this->request->get['blog_category_id']);
}

if ($route == 'blog/article' && isset($this->request->get['article_id'])) {
$this->load->model('blog/article');

$layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']);
}

if (!$layout_id) {
$layout_id = $this->model_design_layout->getLayout($route);
}
Expand Down
12 changes: 12 additions & 0 deletions upload/catalog/controller/common/content_top.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public function index() {
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
}

if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) {
$this->load->model('blog/category');

$layout_id = $this->model_blog_category->getCategoryLayoutId($this->request->get['blog_category_id']);
}

if ($route == 'blog/article' && isset($this->request->get['article_id'])) {
$this->load->model('blog/article');

$layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']);
}

if (!$layout_id) {
$layout_id = $this->model_design_layout->getLayout($route);
}
Expand Down
13 changes: 5 additions & 8 deletions upload/catalog/model/blog/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function getArticleLayoutId($article_id) {
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return $this->config->get('config_layout_article');
return 0;
}
}

Expand All @@ -317,15 +317,14 @@ public function getCategories($article_id) {
}

public function getDownloads($article_id) {

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_download pd LEFT JOIN " . DB_PREFIX . "download d ON(pd.download_id=d.download_id) LEFT JOIN " . DB_PREFIX . "download_description dd ON(pd.download_id=dd.download_id) WHERE article_id = '" . (int)$article_id . "' AND dd.language_id = '" . (int)$this->config->get('config_language_id')."'");

return $query->rows;
}

public function getDownload($article_id, $download_id) {
$download="";
if($download_id!=0)$download=" AND d.download_id=".(int)$download_id;
$download="";
if($download_id!=0)$download=" AND d.download_id=".(int)$download_id;
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "article_to_download pd LEFT JOIN " . DB_PREFIX . "download d ON(pd.download_id=d.download_id) LEFT JOIN " . DB_PREFIX . "download_description dd ON(pd.download_id=dd.download_id) WHERE article_id = '" . (int)$article_id . "' ".$download." AND dd.language_id = '" . (int)$this->config->get('config_language_id')."'");

return $query->row;
Expand Down Expand Up @@ -431,7 +430,5 @@ public function getTotalArticles($data = array()) {
}

return $article_data;
}

}
?>
}
}
5 changes: 2 additions & 3 deletions upload/catalog/model/blog/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ public function getCategoryLayoutId($blog_category_id) {
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return $this->config->get('config_layout_category');
return 0;
}
}

public function getTotalCategoriesByCategoryId($parent_id = 0) {
return count($this->getCategories((int)$parent_id));
}
}
?>
}
8 changes: 3 additions & 5 deletions upload/catalog/model/blog/review.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public function addReview($article_id, $data) {
$message .= sprintf($this->language->get('text_rating'), $data['rating']) . "\n";
$message .= $this->language->get('text_review') . "\n";
$message .= html_entity_decode($data['text'], ENT_QUOTES, 'UTF-8') . "\n\n";

$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');

$mail = new Mail($this->config->get('config_mail_engine'));
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
Expand All @@ -43,13 +42,12 @@ public function addReview($article_id, $data) {
$emails = explode(',', $this->config->get('config_alert_email'));

foreach ($emails as $email) {
if ($email && preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $email)) {
if (utf8_strlen($email) > 0 && filter_var($email, FILTER_VALIDATE_EMAIL)) {
$mail->setTo($email);
$mail->send();
}
}
}

}

public function getReviewsByArticleId($article_id, $start = 0, $limit = 20) {
Expand Down
Loading