sibtracker/system/ajax/newslist.php
2019-05-18 13:46:03 +08:00

96 lines
4.3 KiB
PHP

<?php
@session_start();
error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );
include SYSTEM_DIR.'/data/config.php';
require_once SYSTEM_DIR.'/classes/mysql.php';
require_once SYSTEM_DIR.'/data/dbconfig.php';
if ($_COOKIE['dle_skin']) {if (@is_dir(ROOT_DIR.'/templates/'.$_COOKIE['dle_skin'])){$config['skin'] = $_COOKIE['dle_skin'];}}
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
require_once SYSTEM_DIR.'/modules/functions.php';
require_once SYSTEM_DIR.'/modules/sitelogin.php';
require_once SYSTEM_DIR.'/classes/templates.class.php';
$tpl = new dle_template;
$tpl->dir = ROOT_DIR.'/templates/'.$config['skin'];;
define('TEMPLATE_DIR', $tpl->dir);
$id = intval($_REQUEST['news_id']);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// "Íà÷àëî" Ïîêàç êðàòêîãî ñîäåðæàíèÿ
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if($_REQUEST['action'] == "plus")
{
$result = $db->query("SELECT * FROM ".PREFIX."_post WHERE id='{$id}'");
$row = $db->get_row($result);
$tpl->load_template('newslist/newslist.tpl');
/* Äåëàåì ìèíóñ ìåñòî ïëþ÷à */
$tpl->set('{spoiler}',"<img style=\"cursor: pointer;\" src=\"/templates/{$config['skin']}/images/newslist_minus.gif\" onclick=\"newslist('".$row['id']."', 'minus'); return false;\" align=\"absmiddle\" border=\"0\" title=\"Óáðàòü êðàòêîå ñîäåðæàíèå ñòàòüè\"></div>");
$tpl->set("{story}", stripslashes($row['short_story']));
$tpl->set("{title}", stripslashes($row['title']));
$date_news = strtotime($row['date']);
$link = $config['http_home_url'].$row['id']."-".$row['alt_name'].".html";
$tpl->set("{link}", $link);
if(isset($_GET['author'])){$autor = "<a href=\"/user/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}else{$autor = "<a href=\"/newslist/".$category."/author/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}
$tpl->set("{author}", $autor);
if($is_logged){$tpl->set("[hide]", "");$tpl->set("[/hide]", "");}
else{$tpl->set_block("'\\[hide\\](.*?)\\[/hide\\]'si","<div class=\"quote\">Ñêðûòûé òåêñò, íåîáõîäèìà àâòîðèçàöèÿ.</div>");}
$tpl->set("{rating}", $row['rating']);
$date = date("d.m.Y",strtotime($row['date']));
$tpl->set("{date}", $date);
$tpl->set("[ajax]", "");
$tpl->set("[/ajax]", "");
$tpl->set_block("'\\[not-ajax\\](.*?)\\[/not-ajax\\]'si","");
$tpl->set("{coments}", $row['comm_num']);
$tpl->set("{prosmotr}", $row['news_read']);
$tpl->set('{THEME}', $config['http_home_url'].'templates/'.$config['skin']);
$tpl->compile('newslistspoiler');
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $tpl->result['newslistspoiler'];
}elseif($_REQUEST['action'] == "minus"){
$result = $db->query("SELECT * FROM ".PREFIX."_post WHERE id='{$id}'");
$row = $db->get_row($result);
$tpl->load_template('newslist/newslist.tpl');
$tpl->set('{spoiler}',"<img style=\"cursor: pointer;\" src=\"/templates/{$config['skin']}/images/newslist_plus.gif\" onclick=\"newslist('".$row['id']."', 'plus'); return false;\" align=\"absmiddle\" border=\"0\" title=\"Ïîêàçàòü êðàòêîå ñîäåðæàíèå ñòàòüè\"></div>");
$tpl->set("{story}", "");
$tpl->set("{title}", stripslashes($row['title']));
$date_news = strtotime($row['date']);
$link = $config['http_home_url'].$row['id']."-".$row['alt_name'].".html";
$tpl->set("{link}", $link);
if($row['approve'] == 1){$moder = "<font color =\"green\">Äà</a>";}else{$moder = "<font color =\"red\">Íåò</a>";}
if(isset($_GET['author'])){$autor = "<a href=\"/user/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}else{$autor = "<a href=\"/newslist/".$category."/author/".$row['autor']."/\">".stripcslashes($row['autor'])."</a>";}
$tpl->set("{author}", $autor);
$tpl->set("{rating}", $row['rating']);
$date = date("d.m.Y",strtotime($row['date']));
$tpl->set("{date}", $date);
$tpl->set_block("'\\[ajax\\](.*?)\\[/ajax\\]'si","");
$tpl->set("[not-ajax]", "");
$tpl->set("[/not-ajax]", "");
$tpl->set("{coments}", $row['comm_num']);
$tpl->set("{prosmotr}", $row['news_read']);
$tpl->set('{THEME}', $config['http_home_url'].'templates/'.$config['skin']);
$tpl->compile('newslistspoiler');
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo $tpl->result['newslistspoiler'];
}
?>