0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
models
/
[
Home
]
File: rss_model.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | COPYRIGHT NOTICE | Copyright 2008 JROX Technologies, Inc. All Rights Reserved. | ------------------------------------------------------------------------- | This script may be only used and modified in accordance to the license | agreement attached (license.txt) except where expressly noted within | commented areas of the code body. This copyright notice and the | comments above and below must remain intact at all times. By using this | code you agree to indemnify JROX Technologies, Inc, its corporate agents | and affiliates from any liability that might arise from its use. | | Selling the code for this program without prior written consent is | expressly forbidden and in violation of Domestic and International | copyright laws. | | ------------------------------------------------------------------------- | FILENAME - rss_model.php | ------------------------------------------------------------------------- | | This model handles the functions for managing RSS feeds | */ class Rss_Model extends Model { function _get_new_products($num_options = '') { $sql = 'SELECT ' . $this->db->dbprefix('products') . '.*, ' . $this->db->dbprefix('products') . '.product_id as pid, ' . $this->db->dbprefix('products_photos') . '.* FROM ' . $this->db->dbprefix('products') . ' LEFT JOIN ' . $this->db->dbprefix('products_photos') . ' ON ' . $this->db->dbprefix('products') . '.product_id = ' . $this->db->dbprefix('products_photos') . '.product_id AND ' . $this->db->dbprefix('products_photos') . '.product_default = \'1\' AND product_featured = \'1\' WHERE ' . $this->db->dbprefix('products') . '.product_new = \'1\' AND product_status = \'1\' AND date_expires >= ' . now() . ' AND date_available < ' . now() . ' GROUP BY ' . $this->db->dbprefix('products') . '.product_id ORDER BY ' . $this->db->dbprefix('products') . '.product_id DESC LIMIT 0, ' . $this->config->item('sts_content_rss_per_page'); $query = $this->db->query($sql); if ($query->num_rows() > 0) { $array = array(); foreach ($query->result_array() as $row) { $row['content_title'] = $row['product_name']; $row['content_body'] = $row['product_overview']; $row['content_url'] = base_url() . PRODUCTS_ROUTE . '/details/' . $row['pid'] . '/' . url_title($row['product_name']); $row['content_date'] = date ('r', $row['date_added']); $row['product_price'] = format_amounts($row['product_price'], $num_options); //check the image if (empty($row['photo_file_name'])) { $row['image_file'] = base_url(). 'themes/main/' . $this->config->item('layout_design_site_theme') . '/images/no_photo.png'; } else { if ($row['image_resized'] == 1) { $row['image_file'] = base_url() . 'images/' . $this->config->item('images_products_dir') . '/' . $row['raw_name'].'_jrox'.$row['file_ext']; } else { $row['image_file'] = base_url() . 'images/' . $this->config->item('images_products_dir') . '/' . $row['photo_file_name']; } } $row['content_description'] = '<![CDATA[<table><tr><td><a href="' . $row['content_url'] . '"><img src="' . $row['image_file'] . '" border="0" align="left" height="' . $this->config->item('rss_image_height') . '" width="' . $this->config->item('rss_image_width') . '"></a></td><td style="text-decoration:none;">' . $row['content_body'] . '<p>' . $this->lang->line('price') . ':<span class="price">' . $row['product_price'] . '</span></p></td></tr></table>]]>'; array_push($array, $row); } return $array; } return false; } // ------------------------------------------------------------------------ function _get_featured_products($num_options = '') { $sql = 'SELECT ' . $this->db->dbprefix('products') . '.*, ' . $this->db->dbprefix('products') . '.product_id as pid, ' . $this->db->dbprefix('products_photos') . '.* FROM ' . $this->db->dbprefix('products') . ' LEFT JOIN ' . $this->db->dbprefix('products_photos') . ' ON ' . $this->db->dbprefix('products') . '.product_id = ' . $this->db->dbprefix('products_photos') . '.product_id AND ' . $this->db->dbprefix('products_photos') . '.product_default = \'1\' AND product_featured = \'1\' WHERE ' . $this->db->dbprefix('products') . '.product_featured = \'1\' AND product_status = \'1\' AND date_expires >= ' . now() . ' AND date_available < ' . now() . ' GROUP BY ' . $this->db->dbprefix('products') . '.product_id ORDER BY ' . $this->db->dbprefix('products') . '.product_id DESC LIMIT 0, ' . $this->config->item('sts_content_rss_per_page'); $query = $this->db->query($sql); if ($query->num_rows() > 0) { $array = array(); foreach ($query->result_array() as $row) { $row['content_title'] = $row['product_name']; $row['content_body'] = $row['product_overview']; $row['content_url'] = base_url() . PRODUCTS_ROUTE . '/details/' . $row['pid'] . '/' . url_title($row['product_name']); $row['content_date'] = date ('r', $row['date_added']); $row['product_price'] = format_amounts($row['product_price'], $num_options); //check the image if (empty($row['photo_file_name'])) { $row['image_file'] = base_url(). 'themes/main/' . $this->config->item('layout_design_site_theme') . '/images/no_photo.png'; } else { if ($row['image_resized'] == 1) { $row['image_file'] = base_url() . 'images/' . $this->config->item('images_products_dir') . '/' . $row['raw_name'].'_jrox'.$row['file_ext']; } else { $row['image_file'] = base_url() . 'images/' . $this->config->item('images_products_dir') . '/' . $row['photo_file_name']; } } $row['content_description'] = '<![CDATA[<table><tr><td><a href="' . $row['content_url'] . '"><img src="' . $row['image_file'] . '" border="0" align="left" height="' . $this->config->item('rss_image_height') . '" width="' . $this->config->item('rss_image_width') . '"></a></td><td style="text-decoration:none;">' . $row['content_body'] . '<p>' . $this->lang->line('price') . ':<span class="price">' . $row['product_price'] . '</span></p></td></tr></table>]]>'; array_push($array, $row); } return $array; } return false; } // ------------------------------------------------------------------------ function _get_faqs() { $sql = 'SELECT ' . $this->db->dbprefix('faq_articles') . '.* FROM ' . $this->db->dbprefix('faq_articles') . ' WHERE ' . $this->db->dbprefix('faq_articles') . '.status = \'1\' AND date_published <=' . now() . ' ORDER BY ' . $this->db->dbprefix('faq_articles') . '.article_id DESC LIMIT 0, ' . $this->config->item('sts_content_rss_per_page'); $query = $this->db->query($sql); if ($query->num_rows() > 0) { $array = array(); foreach ($query->result_array() as $row) { $row['content_url'] = base_url() . FAQ_ROUTE . '/view/category_id/' . $row['category_id']; $row['content_date'] = date ('r', $row['date_published']); $body = explode('{more}', $row['content_body']); $content_body = word_limiter($body[0], 50); $row['content_description'] = '<![CDATA[' . $content_body . ']]>'; array_push($array, $row); } return $array; } return false; } // ------------------------------------------------------------------------ function _get_content() { $sql = 'SELECT ' . $this->db->dbprefix('content_articles') . '.* FROM ' . $this->db->dbprefix('content_articles') . ' WHERE ' . $this->db->dbprefix('content_articles') . '.status = \'1\' AND date_published <=' . now() . ' ORDER BY ' . $this->db->dbprefix('content_articles') . '.article_id DESC LIMIT 0, ' . $this->config->item('sts_content_rss_per_page'); $query = $this->db->query($sql); if ($query->num_rows() > 0) { $array = array(); foreach ($query->result_array() as $row) { if ($row['category_id'] == 0) { continue; } if ($row['category_id'] <= 6 && $row['category_id'] >= 2) { continue; } $row['content_url'] = base_url() . CONTENT_ROUTE . '/article/' . $row['article_id'] . '/' . url_title($row['content_title']); $row['content_date'] = date ('r', $row['date_published']); $body = explode('{more}', $row['content_body']); $content_body = word_limiter($body[0], 100); $row['content_description'] = '<![CDATA[' . $content_body . ']]>'; array_push($array, $row); } return $array; } return false; } } ?>