예제 #1
0
 public function __construct()
 {
     $this->table = 'blog_post';
     $this->className = 'BlogPost';
     $this->edit = true;
     $this->view = false;
     $this->delete = true;
     if (isset($_GET['id_' . $this->table]) || isset($_GET['add' . $this->table])) {
         $this->multishop_context = Shop::CONTEXT_ALL;
     }
     $this->module = 'psblog';
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items ?')));
     $this->addRowAction('edit');
     $this->addRowAction('delete');
     $this->_select .= ' l.iso_code ';
     $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'lang l on l.id_lang = a.id_lang ';
     $this->_orderBy = 'id_blog_post';
     $this->_orderWay = 'DESC';
     $this->fields_list = array('id_blog_post' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'status' => array('title' => $this->l('Status'), 'align' => 'center', 'icon' => array('published' => 'enabled.gif', 'drafted' => 'warning.gif', 'suspended' => 'forbbiden.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'search' => false, 'width' => 60));
     if (count(Language::getLanguages(true)) > 1) {
         $this->fields_list['iso_code'] = array('title' => $this->l('Lang'), 'width' => 20);
     }
     $this->fields_list['title'] = array('title' => $this->l('Title'), 'width' => 400);
     $this->fields_list['date_on'] = array('title' => $this->l('Publication date'), 'width' => 120, 'type' => 'date', 'search' => false);
     $this->conf = Psblog::getPreferences();
     BlogShop::addBlogAssoTables();
     parent::__construct();
 }
예제 #2
0
 public function hookLeftColumn($params)
 {
     if (!$this->checkServerConf()) {
         return false;
     }
     $is_home = Tools::getValue('controller') == 'index' ? true : false;
     require_once _PS_MODULE_DIR_ . "psblog/psblog.php";
     require_once _PS_MODULE_DIR_ . "psblog/classes/BlogPost.php";
     $pref = array_merge(Psblog::getPreferences(), self::getPreferences());
     if (!($is_home && $pref['block_articles_home'] == 1)) {
         $this->calculHookCommon($params);
         return $this->display(__FILE__, 'block.tpl');
     }
 }
예제 #3
0
 public function hookLeftColumn($params)
 {
     if (!$this->checkServerConf()) {
         return false;
     }
     require_once _PS_MODULE_DIR_ . "psblog/psblog.php";
     require_once _PS_MODULE_DIR_ . "psblog/classes/BlogCategory.php";
     $pref = array_merge(Psblog::getPreferences(), self::getPreferences());
     $list = BlogCategory::listCategories(true, true);
     if ($list) {
         $i = 0;
         foreach ($list as $val) {
             $list[$i]['link'] = BlogCategory::linkCategory($val['id_blog_category'], $val['link_rewrite'], $val['id_lang']);
             $i++;
         }
     }
     $this->smarty->assign(array('post_categories' => $list, 'post_conf' => $pref));
     return $this->display(__FILE__, 'blockcategories.tpl');
 }
예제 #4
0
 public static function getPreferences()
 {
     if (is_null(self::$pref)) {
         $config = Configuration::get('PSBLOG_CONF');
         $options = self::$default_values;
         if ($config) {
             $options = array_merge($options, unserialize(base64_decode($config)));
         }
         self::$pref = $options;
     }
     return self::$pref;
 }
예제 #5
0
 public function cleanImages()
 {
     $conf = Psblog::getPreferences();
     $save_path = rtrim($conf['img_save_path'], '/') . "/";
     $psblog_images = $this->getImages();
     foreach ($psblog_images as $img) {
         $filename = $img['img_name'];
         if (file_exists(_PS_ROOT_DIR_ . "/" . $save_path . $filename)) {
             @unlink(_PS_ROOT_DIR_ . "/" . $save_path . $filename);
         }
     }
     $result = Db::getInstance()->Execute('DELETE FROM  ' . _DB_PREFIX_ . 'blog_image WHERE id_blog_post = ' . intval($this->id));
     return $result;
 }
예제 #6
0
<?php

/**
 * Prestablog RSS feed
 * @category front
 *
 * @author Appside 
 * @copyright Appside
 * @link appside.net
 */
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once _PS_MODULE_DIR_ . "psblog/psblog.php";
require_once _PS_MODULE_DIR_ . "psblog/classes/BlogPost.php";
require_once _PS_MODULE_DIR_ . "psblog/classes/BlogCategory.php";
$conf = Psblog::getPreferences();
$context = Context::getContext();
$id_lang = Tools::getValue('id_lang') ? (int) Tools::getValue('id_lang') : $context->language->id;
$id_category = Tools::getValue('id_category') ? (int) Tools::getValue('id_category') : null;
if (!$conf['rss_active']) {
    header('HTTP/1.1 404 Not Found');
    header('Status: 404 Not Found');
    header('Location: ' . _PS_BASE_URL_ . __PS_BASE_URI__ . '404.php');
}
header("Content-Type:text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0">
	<channel>
	
		<title><![CDATA[<?php 
예제 #7
0
 public function __construct()
 {
     parent::__construct();
     $this->context = Context::getContext();
     $this->conf = Psblog::getPreferences();
 }