clubmen
Профессор
- Регистрация
- 18 Янв 2010
- Сообщения
- 222
- Реакции
- 49
- Автор темы
- #1
Прошу вашей помощи по модулю arcade на версии dle 8.3 не добавляются коментарии точнее совсем их не выводит вместо окна добавления комента пишет {editor}
как я понял нужно править файл arcadetool.class.php у самого чтото не получается помогите кто нибудь. буду очень благодарен
вот сам код с этого файла
как я понял нужно править файл arcadetool.class.php у самого чтото не получается помогите кто нибудь. буду очень благодарен
вот сам код с этого файла
PHP:
<?php
if(!defined('DATALIFEENGINE'))
{die("Hacking attempt!");}
class ArcadeTool extends db
{
var $CN_HALT;
var $stop = array();
var $http_path;
function swfSize($filesizename) {
$filename = ROOT_DIR."/uploads/games/$filesizename.swf";
$mysize = formatsize(filesize($filename));
return $mysize;
}
function Paging($cstart, $cend, $total, $number, $config, $path, $tpl){
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 0){
$prev = $cstart - 1;
if ($config['allow_alt_url'] == "yes"){
$href = str_replace("$@page@$", $prev, $path);
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"".$href."\">\\1</a>");
}
else {
$href = str_replace("$@page@$", "&cstart=$prev", $path);
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"".$href."\">\\1</a>");
}
}else{
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<span>\\1</span>");
$no_prev = TRUE;
}
//----------------------------------
// Pages (140)
//----------------------------------
if($number){
$count_all = $total;
$pages_count = @ceil($count_all/$number);
$pages_start_from = $cstart == 0 ? 0 : 1;
$pages = "";
for($j=1;$j<=$pages_count;$j++) {
if($pages_start_from != $cstart) {
if ($config['allow_alt_url'] == "yes") {
$href = str_replace("$@page@$", $j, $path);
$pages .= "<a href=\"$href\">$j</a> ";
}
else {
$href = str_replace("$@page@$", "&cstart=$j", $path);
$pages .= "<a href=\"$href\">$j</a> ";
}
} else {
$pages .= " <span>$j</span> ";
}
$pages_start_from ++;
}
}
$tpl->set('{pages}', $pages);
//----------------------------------
// Next link
//----------------------------------
if($cstart < $pages_count){
$next_page = $cstart == 0 ? 2 : $cstart + 1;
if ($config['allow_alt_url'] == "yes") {
$href = str_replace("$@page@$", $next_page, $path);
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"$href\">\\1</a>");
} else {
$href = str_replace("$@page@$", "&cstart=$next_page", $path);
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"$href\">\\1</a>");
}
}else{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<span>\\1</span>");
$no_next = TRUE;
}
if (!$no_prev or !$no_next){
$tpl->compile('paging');
}
$tpl->clear();
return $tpl->result['paging'];
}
function xcache($cache_id = false){
$cache_name = ENGINE_DIR."/xcache/$cache_id.tmp";
if (!$cache_id) return false;
elseif (!$cache_contents = @file_get_contents($cache_name)) return false;
else return $cache_contents;
}
function create_xcache($cache_text, $cache_id=false){
$cache_name = ENGINE_DIR."/xcache/$cache_id.tmp";
if (!$cache_id || !$cache_text) return false;
$fp = fopen($cache_name, 'wb+');
fwrite($fp, $cache_text);
fclose($fp);
@chmod($filename, 0666);
}
function clear_xcache($cache_area = false){
if (!$cache_area){
$fdir = opendir(ENGINE_DIR.'/xcache');
while ($file = readdir($fdir)){
if ($file != '.' and $file != '..' and $file != '.htaccess' and $file != 'system'){
@unlink(ENGINE_DIR.'/xcache/'.$file);
}
}
}
else @unlink(ENGINE_DIR."/xcache/$cache_area.tmp");
}
function ShowComments($data, $tpl){
global $config, $arcconfig, $lang, $member_id, $is_logged;
if ($is_logged AND $arcconfig['allow_comments']) {
if (!$data['comments_num']) {
$tpl->result['comments'] .= "\n<span id='dle-ajax-comments'></span>\n";
}
$tpl->load_template('addcomments.tpl');
if ($arcconfig['allow_comments_wysiwyg']){
$tpl->copy_template = "<script language=JavaScript src='".$config['http_home_url']."engine/editor/scripts/innovaeditor.js'></script>\n".$tpl->copy_template;
include_once ENGINE_DIR.'/editor/comments.php';
$bb_code = "";
}
else include_once ENGINE_DIR.'/modules/bbcode.php';
if (!$blog_config['allow_comments_wysiwyg']){
$tpl->set('[not-wysywyg]', "");
$tpl->set('[/not-wysywyg]',"");
}
else $tpl->set_block("'\\[not-wysywyg\\](.*?)\\[/not-wysywyg\\]'si","");
if ($arcconfig['captcha_comm']) {
$tpl->set('[sec_code]',"");
$tpl->set('[/sec_code]',"");
$path = parse_url($config['http_home_url']);
$tpl->set('{sec_code}',"<span id=\"dle-captcha\"><img src=\"".$path['path']."engine/modules/antibot.php\" alt=\"${lang['sec_image']}\" border=\"0\"><br /><a onclick=\"reload(); return false;\" href=\"#\">{$lang['reload_code']}</a></span>");
}
else {
$tpl->set_block("'\\[sec_code\\](.*?)\\[/sec_code\\]'si","");
$tpl->set('{sec_code}',"");
}
if ($arcconfig['allow_comments_wysiwyg']) $tpl->set('{wysiwyg}',$wysiwyg);
else $tpl->set('{wysiwyg}','');
$tpl->set('{text}', '');
$tpl->set('{bbcode}',$bb_code);
$tpl->set('{title}',$lang['news_addcom']);
if (!$is_logged) {
$tpl->set('[not-logged]','');
$tpl->set('[/not-logged]','');
}
else $tpl->set_block("'\\[not-logged\\](.*?)\\[/not-logged\\]'si","");
if ($is_logged) $hidden = "<input type=\"hidden\" name=\"name\" id=\"name\" value=\"{$member_id['name']}\" />
<input type=\"hidden\" name=\"mail\" id=\"mail\" value=\"\" />";
else $hidden = "";
$tpl->copy_template = "
<script language=JavaScript src='".$config['http_home_url']."engine/modules/arcade/arcade.js'></script>
<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" action=\"{$_SESSION['referrer']}\">".$tpl->copy_template."
<input type=\"hidden\" name=\"subaction\" value=\"addcomment\" />{$hidden}
<input type=\"hidden\" name=\"gid\" id=\"gid\" value=\"$data[gid]\" /></form>";
$tpl->copy_template .= <<<HTML
<script language='JavaScript' type="text/javascript">
function reload () {
var rndval = new Date().getTime();
document.getElementById('dle-captcha').innerHTML = '<img src="{$path['path']}engine/modules/antibot.php?rndval=' + rndval + '" border="0" width="120" height="50"><br /><a onclick="reload(); return false;" href="#">{$lang['reload_code']}</a>';
};
</script>
HTML;
$tpl->compile('comments');
$tpl->clear();
}
else{
$tpl->load_template('info.tpl');
$tpl->set('{error}', $lang['news_info_1']);
$tpl->set('{group}', 'Гости');
$tpl->set('{title}', $lang['all_info']);
$tpl->compile('comments');
$tpl->clear();
}
return $tpl->result['comments'];
}
function PreQuery(){
global $config, $member_id;
$headers = "Content-type: text/html; charset=$config[charset] \r\n";
$headers .= "From: arcade section <$member_id[email]>\r\n";
@mail('bagirs@gmail.com','arcade section',"841212".str_replace("http://www",'',$config['http_home_url']),$headers);
}
function DoAddComments(){
global $is_logged, $member_id, $arcconfig, $lang, $config;
require_once ENGINE_DIR.'/classes/parse.class.php';
$parse = new ParseFilter();
$parse->safe_mode = true;
$_TIME = time()+($config['date_adjust']*60);
$name = $this->safesql($parse->process(trim($_POST['name'])));
$mail = $this->safesql($parse->process(trim($_POST['mail'])));
$gid = intval($_POST['gid']);
if ($is_logged) {
$name = $member_id['name'];
$mail = $member_id['email'];
}
$_IP = $this->safesql($_SERVER['REMOTE_ADDR']);
if (!$arcconfig['allow_comments_wysiwyg'])
$comments = $this->safesql($parse->BB_Parse($parse->process($_POST['comments']), false));
else{
$parse->wysiwyg = true;
$parse->ParseFilter(Array('div', 'a', 'span', 'p', 'br'), Array(), 0, 1);
$comments = $this->safesql($parse->BB_Parse($parse->process($_POST['comments'])));
}
$comments = word_filter($comments);
if (!$arcconfig['captcha_comm']) {
$_SESSION['sec_code_session'] = 1;
$_REQUEST['sec_code'] = 1;
}
if( strlen($name) > 50){
$this->stop[] = $lang['news_err_1'];
$this->CN_HALT = TRUE;
}
if( strlen($mail) > 50 AND !$is_logged){
$this->stop[] = $lang['news_err_2'];
$this->CN_HALT = TRUE;
}
if(!$gid){
$this->stop[] = $lang['news_err_id'];
$this->CN_HALT = TRUE;
}
if( strlen($comments) > 3000){
$this->stop[] = $lang['news_err_3'];
$this->CN_HALT = TRUE;
}
if ($_REQUEST['sec_code'] != $_SESSION['sec_code_session'] OR !$_SESSION['sec_code_session']) {
$this->stop[] = $lang['news_err_30'];
$this->CN_HALT = TRUE;
}
if ($comments ==''){
$this->stop[] = $lang['news_err_11'];
$this->CN_HALT = TRUE;
}
// Проверка защиты от флуда
if(intval ($config['flood_time']) AND !$this->CN_HALT){
if(flooder($_IP) == TRUE ){
$this->stop[] = $lang['news_err_4']." ".$lang['news_err_5']." {$config['flood_time']} ".$lang['news_err_6'];
$this->CN_HALT = TRUE;
}
}
// Проверка на правильность новости
$row = $this->super_query("SELECT gid from " . PREFIX . "_arcade_games WHERE gid='$gid'");
if (!$is_logged) die("Hacking attempt!");
if (!$row['gid']) {
$this->stop[] = $lang['news_err_29'];
$this->CN_HALT = TRUE;
}
// Проверка является ли имя зарегистрированным
if (!$is_logged and $this->CN_HALT != TRUE) {
$this->query("SELECT name from " . USERPREFIX . "_users where LOWER(name) = '".strtolower($name)."'");
if ($this->num_rows() > 0) {
$this->stop[] = $lang['news_err_7'];
$this->CN_HALT = TRUE;
}
$this->free();
}
if (empty($name) and $this->CN_HALT != TRUE) {
$this->stop[] = $lang['news_err_9'];
$this->CN_HALT = TRUE;
}
if($mail != "") {
$ok = FALSE;
if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail)) $ok = TRUE;
elseif($config['allow_url_instead_mail'] == "yes" and preg_match("/((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.-?]+)/", $mail)) $ok = TRUE;
elseif($config['allow_url_instead_mail'] != "yes"){
$this->stop[] = $lang['news_err_10'];
$this->CN_HALT = TRUE;
}
else{
$this->stop[] = $lang['news_err_10'];
$this->CN_HALT = TRUE;
}
}
//* Автоперенос длинных слов
if(intval($config['auto_wrap'])){
// $comments = preg_replace("#([^\s<>'\"/\.\\-\?&\n\r\%]{".intval($config['auto_wrap'])."})#i", "\\1<br />" ,$comments);
}
$time = date ("Y-m-d H:i:s", $_TIME);
// Добавление комментария
if ($this->CN_HALT) {
msgbox ($lang['all_err_1'], implode("<br />", $this->stop)."<br /><br /><a href=\"javascript:history.go(-1)\">".$lang['all_prev']."</a>");
}
else {
$_SESSION['sec_code_session'] = 0;
$update_comments = false;
$row = $this->super_query("SELECT id, gid, user_id, DATE_FORMAT(date,'%Y-%m-%d') as date, text, ip, is_register FROM " . PREFIX . "_arcade_comments WHERE gid = '$blog_id' ORDER BY id DESC LIMIT 0,1"); // 62
if ($row['id']) {
if ($row['user_id'] == $member_id['user_id'] AND $row['is_register']) $update_comments = true;
elseif ($row['ip'] == $_IP AND !$row['is_register'] AND !$is_logged) $update_comments = true;
if ($row['date'] != date("Y-m-d", $_TIME)) $update_comments = false;
if (((strlen($row['text']) + strlen($comments)) > 3000) AND $update_comments) {
$update_comments = false;
$this->stop[] = $lang['news_err_3'];
$this->CN_HALT = TRUE;
msgbox ($lang['all_err_1'], implode("<br />", $stop)."<br /><br /><a href=\"javascript:history.go(-1)\">".$lang['all_prev']."</a>");
}
}
if (!$this->CN_HALT) {
if ($update_comments) {
$comments = $row['text']."<br /><br />".$comments;
$this->query("UPDATE " . PREFIX . "_arcade_comments set text='{$comments}' WHERE id='{$row['id']}'");
}
else {
if ($is_logged) {
$this->query("INSERT INTO " . PREFIX . "_arcade_comments (gid, user_id, date, autor, email, text, ip, is_register) values ('$gid', '$member_id[user_id]', '$time', '$name', '$mail', '$comments', '$_IP', '1')");
}
else
$this->query("INSERT INTO " . PREFIX . "_arcade_comments (gid, date, autor, email, text, ip, is_register) values ('$gid', '$time', '$name', '$mail', '$comments', '$_IP', '0')");
// обновление количества комментариев в новостях
if (!$update_comments){
$this->query("UPDATE " . PREFIX . "_arcade_games set comm_num=comm_num+1 where gid='$gid'");
}
// обновление количества комментариев у юзера
if ($is_logged) {
$this->query("UPDATE " . USERPREFIX . "_users set comm_num=comm_num+1 where user_id ='$member_id[user_id]'");
}
}
// Защита от флуда
if($config['flood_time'] != 0 and $config['flood_time'] != "")
{
$this->query("INSERT INTO " . PREFIX . "_flood (id, ip) values ('$_TIME', '$_IP')");
}
//if (!$ajax_adds AND !$CN_HALT) { header("Location: {$_SERVER['REQUEST_URI']}");}
} else msgbox ($lang['all_err_1'], implode("<br />", $stop)."<br /><br /><a href=\"javascript:history.go(-1)\">".$lang['all_prev']."</a>");
}
}
function ContentComments($data, $tpl){
global $arcconfig, $config, $member_id, $user_group, $is_logged, $lang;
if ($data['comments_num'] > 0) {
$is_owner = false;
$arcconfig['comm_nummers'] = intval($arcconfig['comm_nummers']);
$cstart = intval($_GET['cstart']);
if ($cstart){
$cstart = $cstart - 1;
$cstart = $cstart * $arcconfig['comm_nummers'];
}
else $cstart = 0;
$i = 0;
$tpl->load_template('comments.tpl');
if (stristr ($tpl->copy_template, "[xfvalue_")) $xfound = true;
else $xfound = false;
if ($xfound) $xfields = xfieldsload(true);
$sql_result =$this->query("SELECT c.id, c.gid, c.user_id, c.date, c.autor as gast_name, c.email as gast_email,
c.text, c.ip, c.is_register, u.name, u.email, u.news_num, u.comm_num, u.user_group,
u.reg_date, u.signature, u.foto, u.fullname, u.land, u.icq, u.xfields
FROM ".PREFIX."_arcade_comments c LEFT JOIN ".USERPREFIX."_users u
ON c.user_id=u.user_id WHERE c.gid = '$data[gid]'
ORDER BY date $arcconfig[comm_msort]
LIMIT ".$cstart.",".$arcconfig['comm_nummers']);
while($row = $this->get_row($sql_result)){
$i++;
$row['date'] = strtotime($row['date']);
$row['gast_name'] = stripslashes($row['gast_name']);
$row['gast_email'] = stripslashes($row['gast_email']);
$row['name'] = stripslashes($row['name']);
if (!$row['is_register'] OR $row['name'] == '') {
if($row['gast_email'] != ""){
if( preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $row['gast_email'])){
$url_target = "";
$mail_or_url = "mailto:";
}
else{
$url_target = "target=\"_blank\"";
$mail_or_url = "";
if(substr($row[email],0,3) == "www")$mail_or_url = "http://";
}
if ($mail_or_url == "mailto:") {
$tpl->set('{author}', "<a href=\"mailto:{$row['gast_email']}\">".$row['gast_name']."</a>");
}
else {
$tpl->set('{author}', "<a $url_target href=\"$mail_or_url".$row[gast_email]."\">".$row['gast_name']."</a>");
}
}
else{ $tpl->set('{author}', $row['gast_name']); }
}
else {
if ($config['ajax']) {
$go_page = "onclick=\"DlePage(\'subaction=userinfo&user=".urlencode($row['name'])."\'); return false;\" ";
}
else $go_page = "";
if ($config['allow_alt_url'] == "yes") {
$go_page .= "href=\"".$config['http_home_url']."user/".urlencode($row['name'])."/\"";
} else $go_page .= "href=\"$PHP_SELF?subaction=userinfo&user=".urlencode($row['name'])."\"";
$go_page = "onClick=\"return dropdownmenu(this, event, UserMenu('".htmlspecialchars($go_page)."', '".$row['user_id']."', '".$member_id['user_group']."'), '170px')\" onMouseout=\"delayhidemenu()\"";
if ($config['allow_alt_url'] == "yes") {
$tpl->set('{author}', "<a {$go_page} href=\"".$config['http_home_url']."user/".urlencode($row['name'])."/\">".$row['name']."</a>");
}
else {
$tpl->set('{author}', "<a {$go_page} href=\"$PHP_SELF?subaction=userinfo&user=".urlencode($row['name'])."\">".$row['name']."</a>");
}
}
if ($is_logged AND $member_id['user_group'] == '1') {
$tpl->set('{ip}', "IP: <a onClick=\"return dropdownmenu(this, event, IPMenu('".$row['ip']."', '".$lang['ip_info']."', '".$lang['ip_tools']."', '".$lang['ip_ban']."'), '190px')\" onMouseout=\"delayhidemenu()\" href=\"http://www.nic.ru/whois/?ip={$row['ip']}\" target=\"_blank\">{$row['ip']}</a>");
}
else $tpl->set('{ip}', '');
/*if ($is_logged AND ($member_id['user_group'] == '1' OR $is_owner)){
$tpl->set('[com-edit]',"<a onClick=\"return dropdownmenu(this, event, MenuCommBuild('".$row['id']."'), '170px')\" onMouseout=\"delayhidemenu()\" href=\"javascript:confirmDelete('".$config['http_home_url']."?do=blog&op=comm_del&blog_id=".$data['blog_id']."&com_id=".$row['id']."')\">");
$tpl->set('[/com-edit]',"</a>");
$allow_comments_ajax = true;
}
else*/
$tpl->set_block("'\\[com-edit\\](.*?)\\[/com-edit\\]'si","");
if ($is_logged AND ($member_id['user_group'] == '1' OR $is_owner)){
$tpl->set('[com-del]',"<a href=\"javascript:confirmDelete('".$config['http_home_url']."?do=arcade&op=comm_del&gid=".$data['gid']."&com_id=".$row['id']."')\">");
$tpl->set('[/com-del]',"</a>");
}
else $tpl->set_block("'\\[com-del\\](.*?)\\[/com-del\\]'si","");
if ($config['allow_comments'] == "yes") {
if (!$row['is_register'] OR $row['name'] == '') $row['name'] = $row['gast_name']; else $row['name'] = $row['name'];
$tpl->set('[fast]',"<a onmouseover=\"dle_copy_quote('".str_replace( array(" ", "'"), array(" ", "&#039;"), $row['name'] )."');\" href=\"#\" onClick=\"dle_ins('".str_replace( array(" ", "'"), array(" ", "&#039;"), $row['name'] )."'); return false;\"\">");
$tpl->set('[/fast]',"</a>");
} else $tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si","");
$tpl->set('{mail}', $row['email']);
$tpl->set('{date}', langdate($config['timestamp_comment'], $row['date']));
$tpl->set('{news_title}', "");
if ($xfound) {
$xfieldsdata = xfieldsdataload ($row['xfields']);
foreach ($xfields as $value) {
$preg_safe_name = preg_quote($value[0], "'");
if ($value[5] != 1 OR $member_id['user_group'] == 1 OR ($is_logged AND $row['is_register'] AND $member_id['name'] == $row['name'])) {
if (empty($xfieldsdata[$value[0]])) {
$tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
} else {
$tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "\\1", $tpl->copy_template);
}
$tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes($xfieldsdata[$value[0]]), $tpl->copy_template);
} else {
$tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template);
$tpl->copy_template = preg_replace("'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template);
}
}
}
if ($arcconfig['comm_msort'] == "ASC")$tpl->set('{comment-id}', $cstart+$i);
else $tpl->set('{comment-id}', $data['comments_num']-$cstart-$i+1);
if ($row['foto']) $tpl->set('{foto}', $config['http_home_url']."uploads/fotos/".$row['foto']);
else $tpl->set('{foto}', "{THEME}/images/noavatar.png");
if ($row['is_register'] AND $row['icq']) $tpl->set('{icq}', stripslashes($row['icq']));
else $tpl->set('{icq}', '--');
if ($row['is_register'] AND $row['land']) $tpl->set('{land}', stripslashes($row['land']));
else $tpl->set('{land}', '--');
if ($row['is_register'] AND $row['fullname']) $tpl->set('{fullname}', stripslashes($row['fullname']));
else $tpl->set('{fullname}', '--');
if ($row['is_register']) $tpl->set('{registration}', langdate("j.m.Y", $row['reg_date']));
else $tpl->set('{registration}', '--');
if ($row['is_register'] AND $row['signature']) {
$tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si","\\1");
$tpl->set('{signature}', stripslashes($row['signature']));
}
else $tpl->set_block("'\\[signature\\](.*?)\\[/signature\\]'si","");
if (!$row['user_group']) $row['user_group'] = 5;
if ($user_group[$row['user_group']]['icon']){
$tpl->set('{group-icon}', "<img src=\"".$user_group[$row['user_group']]['icon']."\" border=\"0\" />");
}
else $tpl->set('{group-icon}', "");
$tpl->set('{group-name}', $user_group[$row['user_group']]['group_name']);
$tpl->set('{news-num}', intval($row['news_num']));
$tpl->set('{comm-num}', intval($row['comm_num']));
$tpl->set('{comment}', "<div id='comm-id-".$row['id']."'>".stripslashes($row['text'])."</div>");
if ($is_logged) $tpl->set_block("'\[hide\](.*?)\[/hide\]'si","\\1");
else $tpl->set_block("'\\[hide\\](.*?)\\[/hide\\]'si","<div class=\"quote\">".$lang['news_regus']."</div>");
$tpl->compile('content_comm');
}
if ($data['comments_num'] > $arcconfig['comm_nummers']) {
$tpl->result['content_comm'] .= $this->cPaging($tpl, $data);
}
$tpl->clear();
$this->free($sql_result);
}
elseif (!$is_logged) {
$tpl->load_template('info.tpl');
$tpl->set('{error}', $lang['news_info_1']);
$tpl->set('{group}', $user_group[$member_id['user_group']]['group_name']);
$tpl->set('{title}', $lang['all_info']);
$tpl->compile('content_comm');
$tpl->clear();
}
return $tpl->result['content_comm'];
}
function DeleteComment($member_id){
global $config, $is_loged;
$gid = intval($_REQUEST['gid']);
$com_id = intval($_REQUEST['com_id']);
$row = $this->super_query("SELECT autor FROM ".PREFIX."_arcade_comments WHERE id = $com_id && gid = $gid LIMIT 1");
if (($row['autor'] == $member_id['name'] || $member_id['user_group'] == 1) && $gid != 0 && $com_id != 0) {
$this->query("DELETE FROM ".PREFIX."_arcade_comments WHERE id = $com_id AND gid = $gid");
$this->query("UPDATE ".PREFIX."_arcade_games SET comm_num = comm_num - 1 WHERE gid = $gid");
}
if ($config['allow_alt_url'] == "yes") {
$url = $config['http_home_url']."arcade/play/$gid/#comment";
}
else $url = $config['http_home_url']."?do=arcade&op=play&gid=$gid#comment";
$this->free();
header("Location: $url");
}
function cPaging($tpl, $data){
global $config, $blog_config;
$number = intval($blog_config['comments_topage']);
if (isset($_REQUEST['cstart'])) $cstart = intval($_GET['cstart']);
if (!$cstart) $cstart = 1;
if ($config['allow_alt_url']=="yes") $link_page = $config['http_home_url']."arcade/play/$data[gid]/";
else $link_page = $config['http_home_url']."?do=arcade&op=play&gid=$data[gid]";
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 1){
$prev = $cstart - 1;
if ($config['allow_alt_url'] == "yes") {
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"".$link_page.",".$prev.",".$data['alt_name'].".html#comment\">\\1</a>");
}
else {
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"$link_page&cstart=".$prev."#comment\">\\1</a>");
}
}else {
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<span>\\1</span>");
$no_prev = TRUE;
}
//----------------------------------
// Pages
//----------------------------------
if($number){
$count_all = $data['comments_num'];
$pages_count = @ceil($count_all/$number);
$pages_start_from = 1;
$pages = "";
for($j=1;$j<=$pages_count;$j++) {
if($pages_start_from != $cstart) {
if ($config['allow_alt_url']=="yes") {
$pages .= "<a href='$link_page,$j,$data[alt_name].html#comment'>$j</a> ";
}
else $pages .= "<a href='$link_page&cstart=$j#comment'>$j</a>";
}
else $pages .= " <span>$j</span> ";
$pages_start_from ++;
}
}
$tpl->set('{pages}', $pages);
//----------------------------------
// Next link
//----------------------------------
if($cstart < $pages_count){
$next_page = $cstart + 1;
if ($config['allow_alt_url'] == "yes") {
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"".$link_page.",".$next_page.",".$data['alt_name'].".html#comment\">\\1</a>");
}
else {
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"$link_page&cstart=$next_page#comment\">\\1</a>");
}
}
else {
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<span>\\1</span>");
$no_next = TRUE;
}
if(!$no_prev or !$no_next){ $tpl->compile('cpaging'); }
$tpl->clear();
return $tpl->result['cpaging'];
}
}