message
This commit is contained in:
142
system/forum/sources/category.php
Normal file
142
system/forum/sources/category.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
if (intval($cid))
|
||||
{
|
||||
if ($forum_config['hide_forum'])
|
||||
{
|
||||
$access_hide = "and access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$access_hide = "";
|
||||
}
|
||||
|
||||
$category_name = stripslashes($cats_array[$cid]['cat_name']);
|
||||
|
||||
if ($category_name)
|
||||
{
|
||||
$result = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE main_id = $cid and parentid = 0 {$access_hide} ORDER by position");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
if (!$fcache->open('sub-'.$row['id']))
|
||||
{
|
||||
if ($sub_forums_array != 'empty')
|
||||
{
|
||||
foreach ($sub_forums_array as $value)
|
||||
{
|
||||
if ($row['id'] == $value['parentid'])
|
||||
{
|
||||
$symbol_count++;
|
||||
|
||||
if ($symbol_count > 1) $symbol = ", ";
|
||||
|
||||
$sub_forums .= link_forum($value['id'], $value['name'], $symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fcache->save('sub-'.$row['id'], $sub_forums);
|
||||
}
|
||||
else { $sub_forums = $fcache->open('sub-'.$row['id']); }
|
||||
|
||||
if (!$fcache->open('moder-'.$row['id']))
|
||||
{
|
||||
foreach ($forum_moderators as $moderators)
|
||||
{
|
||||
if ($moderators['forum_id'] == $row['id'] and $moderators['member_name'])
|
||||
{
|
||||
$mod_count++;
|
||||
|
||||
if ($mod_count > 1) $mod_symbol = ", ";
|
||||
|
||||
$moderators_list .= $mod_symbol . link_user($moderators['member_name']);
|
||||
}
|
||||
}
|
||||
|
||||
$fcache->save('moder-'.$row['id'], $moderators_list);
|
||||
}
|
||||
else { $moderators_list = $fcache->open('moder-'.$row['id']); }
|
||||
|
||||
$tpl->load_template($tpl_dir.'forums.tpl');
|
||||
|
||||
$tpl->set('{status}', forum_status ($row['f_last_date'], $row['password'], $row['icon']));
|
||||
|
||||
$tpl->set('{name}', link_forum($row['id'], $row['name']));
|
||||
|
||||
$tpl->set('{description}', stripslashes($row['description']));
|
||||
|
||||
if ($sub_forums)
|
||||
{
|
||||
$tpl->set('{forums}', '<br />'.$forum_config['forum_pr_sub'].' '.$sub_forums);
|
||||
}
|
||||
else { $tpl->set('{forums}', ''); }
|
||||
|
||||
if ($moderators_list)
|
||||
{
|
||||
$tpl->set('{moderators}', '<br />' . $f_lang['moderators'] . ' ' . $moderators_list);
|
||||
}
|
||||
else { $tpl->set('{moderators}', ''); }
|
||||
|
||||
$tpl->set('{topics}', $row['topics']);
|
||||
|
||||
$tpl->set('{post}', $row['posts']);
|
||||
|
||||
$tpl->set('{forum_id_rss}', $forum_url."/rss/forum_".$row['id'].".xml");
|
||||
|
||||
$tpl->set('{last}', forum_last ($row['f_last_tid'], $row['f_last_title'], $row['f_last_poster_name'], $row['f_last_date'], $row['password'], $row['id'], $row['access_read'], $row['last_post_id']));
|
||||
|
||||
$tpl->compile('forums');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
unset ($sub_forums);
|
||||
|
||||
unset ($symbol_count);
|
||||
|
||||
unset ($symbol);
|
||||
|
||||
unset ($moderators_list);
|
||||
|
||||
unset ($mod_count);
|
||||
|
||||
unset ($mod_symbol);
|
||||
}
|
||||
|
||||
$tpl->load_template($tpl_dir.'category.tpl');
|
||||
|
||||
$tpl->set('{category}', $category_name);
|
||||
|
||||
$tpl->set('{forums}', $tpl->result['forums']);
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
$metatags['title'] = $forum_config['forum_title'].' » '.$category_name;
|
||||
|
||||
if ($forum_config['forum_bar'])
|
||||
{
|
||||
$bbr_cid = $cid;
|
||||
$bbr_name = $category_name;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
@header("HTTP/1.0 404 Not Found");
|
||||
|
||||
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
@header("HTTP/1.0 404 Not Found");
|
||||
|
||||
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
|
||||
}
|
||||
?>
|
||||
48
system/forum/sources/components/attachment.php
Normal file
48
system/forum/sources/components/attachment.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
$get_attachment = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE topic_id = '$tid' and file_attach = '1'");
|
||||
|
||||
while ($row = $db->get_row($get_attachment))
|
||||
{
|
||||
if ($row['file_type'] == "image")
|
||||
{
|
||||
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
|
||||
|
||||
$attachment = "<img src=\"{$img_full}\" border=\"0\">";
|
||||
}
|
||||
|
||||
elseif ($row['file_type'] == "thumb")
|
||||
{
|
||||
$img_full = $config['http_home_url'].'uploads/forum/images/'.$row['onserver'];
|
||||
|
||||
$img_thumb = $config['http_home_url'].'uploads/forum/thumbs/'.$row['onserver'];
|
||||
|
||||
$hs_expand = "onClick=\"return hs.expand(this)\"";
|
||||
|
||||
$attachment = "<a href=\"{$img_full}\" {$hs_expand}><img src=\"{$img_thumb}\" border=\"0\"></a>";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$attachment_down = $a_forum_url."act=attachment&id=".$row['file_id'];
|
||||
|
||||
$attachment = "<a href=\"$attachment_down\">{$row['file_name']}</a> ({$row['dcount']} | ".mksize($row['file_size']).")";
|
||||
|
||||
//$onserver_url = "{$config['http_home_url']}uploads/forum/files/{$row['onserver']}";
|
||||
}
|
||||
|
||||
if (!$ajax_edit_attach){
|
||||
$tpl->result['posts'] = str_replace('[attachment='.$row['file_id'].']', $attachment, $tpl->result['posts']);
|
||||
//$tpl->result['posts'] = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $tpl->result['posts']);
|
||||
}
|
||||
else{
|
||||
$post_text = str_replace('[attachment='.$row['file_id'].']', $attachment, $post_text);
|
||||
//$post_text = preg_replace("#\[attachment={$row['file_id']}:(.*)\]#i", $onserver_url, $post_text);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
179
system/forum/sources/components/bbcode.php
Normal file
179
system/forum/sources/components/bbcode.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
if (!defined('FORUM_SUB_DOMAIN'))
|
||||
{
|
||||
$color_html_dir = "{THEME}/bbcodes";
|
||||
|
||||
} else
|
||||
{
|
||||
$color_html_dir = $forum_config['forum_url']."/ajax";
|
||||
}
|
||||
|
||||
$uploads_script_dir = $config['http_home_url']."system/forum/sources/modules";
|
||||
|
||||
if (!$upload_var['bb_width']) $bb_width = "460px";
|
||||
|
||||
else $bb_width = $upload_var['bb_width'];
|
||||
|
||||
$i = 0;
|
||||
$output = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"120\"><tr>";
|
||||
|
||||
$smilies = explode(",", $config['smilies']);
|
||||
foreach($smilies as $smile)
|
||||
{
|
||||
$i++; $smile = trim($smile);
|
||||
|
||||
$output .= "<td style=\"padding:2px;\" align=\"center\"><a href=\"#\" onClick=\"ins_smile(':$smile:'); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"".$config['http_home_url']."system/data/emoticons/$smile.gif\" /></a></td>";
|
||||
|
||||
if ($i%3 == 0) $output .= "</tr><tr>";
|
||||
|
||||
}
|
||||
|
||||
$output .= "</tr></table>";
|
||||
|
||||
if ($ajax_post_id)
|
||||
{
|
||||
$ajax_post_id = '_'.$ajax_post_id;
|
||||
|
||||
$addform = "document.forum_post_form".$ajax_post_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$addform = "document.getElementById( 'forum-post-form' )";
|
||||
}
|
||||
|
||||
$startform = "post_text".$ajax_post_id;
|
||||
|
||||
$add_id = false;
|
||||
|
||||
if ($access_upload AND $forum_config['tools_upload'] OR $access_upload AND $forum_config['img_upload'])
|
||||
{
|
||||
$tag_upload = "<div id=\"b_code\" class=\"editor_button\" onclick=\"window_upload()\"><img title=\"Çàãðóçêà ôàéëîâ è èçîáðàæåíèé íà ñåðâåð\" src=\"{THEME}/bbcodes/upload.gif\" width=\"23\" height=\"25\" border=\"0\"></div>";
|
||||
}
|
||||
|
||||
if (!$upload_var['reply']){
|
||||
|
||||
$code = <<<HTML
|
||||
<div style="width:{$bb_width}; height:50px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/bg.gif');">
|
||||
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/b.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/i.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/u.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_s" class="editor_button" onclick="simpletag('s')"><img title="$lang[bb_t_s]" src="{THEME}/bbcodes/s.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_emo" class="editor_button" onclick="ins_emo();"><img title="$lang[bb_t_emo]" src="{THEME}/bbcodes/emo.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/color.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_url()"><img title="$lang[bb_t_url]" src="{THEME}/bbcodes/link.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/email.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick=tag_image()><img title="$lang[bb_b_img]" src="{THEME}/bbcodes/image.gif" width="23" height="25" border="0"></div>
|
||||
{$tag_upload}
|
||||
<div class="editor_button" onclick="tag_video()"><img title="$lang[bb_t_video]" src="{THEME}/bbcodes/mp.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_audio()"><img src="{THEME}/bbcodes/mp3.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_flash()"><img src="{THEME}/bbcodes/flash.gif" width="23" height="25" border="0" alt="" /></div>
|
||||
<div class="editor_button" onclick="tag_media()"><img src="{THEME}/bbcodes/youtube.gif" width="23" height="25" border="0" alt="" /></div>
|
||||
<div class="editor_button" style="padding-top:4px;width:120px;"><select name="bbfont" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'font')"><option value='0'>{$lang['bb_t_font']}</option><option value='Arial'>Arial</option><option value='Arial Black'>Arial Black</option><option value='Century Gothic'>Century Gothic</option><option value='Courier New'>Courier New</option><option value='Georgia'>Georgia</option><option value='Impact'>Impact</option><option value='System'>System</option><option value='Tahoma'>Tahoma</option><option value='Times New Roman'>Times New Roman</option><option value='Verdana'>Verdana</option></select></div>
|
||||
<div class="editor_button" style="padding-top:4px;width:65px;"><select name="bbsize" class="editor_button" onchange="insert_font(this.options[this.selectedIndex].value, 'size')"><option value='0'>{$lang['bb_t_size']}</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option></select></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_left" class="editor_button" onclick="simpletag('left')"><img title="$lang[bb_t_l]" src="{THEME}/bbcodes/l.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_center" class="editor_button" onclick="simpletag('center')"><img title="$lang[bb_t_c]" src="{THEME}/bbcodes/c.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_right" class="editor_button" onclick="simpletag('right')"><img title="$lang[bb_t_r]" src="{THEME}/bbcodes/r.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/quote.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_code" class="editor_button" onclick="simpletag('code')"><img title="$lang[bb_t_code]" src="{THEME}/bbcodes/code.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/hide.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_spoiler" class="editor_button" onclick="spoiler()"><img src="{THEME}/bbcodes/spoiler.gif" width="23" height="25" border="0"></div>
|
||||
<iframe width="154" height="104" id="cp" src="{$color_html_dir}/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
|
||||
<div id="dle_emo" style="visibility:hidden; display: none; position: absolute; width:140px; height: 124px; overflow: auto; border: 1px solid #BBB; background:#E9E8F2;filter: alpha(opacity=95, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3);">{$output}</div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$code = <<<HTML
|
||||
<div style="width:{$bb_width}; height:25px; border:1px solid #BBB; background-image:url('{THEME}/bbcodes/bg.gif');">
|
||||
<div id="b_b" class="editor_button" onclick="simpletag('b')"><img title="$lang[bb_t_b]" src="{THEME}/bbcodes/b.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_i" class="editor_button" onclick="simpletag('i')"><img title="$lang[bb_t_i]" src="{THEME}/bbcodes/i.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_u" class="editor_button" onclick="simpletag('u')"><img title="$lang[bb_t_u]" src="{THEME}/bbcodes/u.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_emo" class="editor_button" onclick="ins_emo();"><img title="$lang[bb_t_emo]" src="{THEME}/bbcodes/emo.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_color" class="editor_button" onclick="ins_color();"><img src="{THEME}/bbcodes/color.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_url()"><img title="$lang[bb_t_url]" src="{THEME}/bbcodes/link.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick="tag_email()"><img title="$lang[bb_t_m]" src="{THEME}/bbcodes/email.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div class="editor_button" onclick=tag_image()><img title="$lang[bb_b_img]" src="{THEME}/bbcodes/image.gif" width="23" height="25" border="0"></div>
|
||||
{$tag_upload}
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_quote" class="editor_button" onclick="simpletag('quote')"><img title="$lang[bb_t_quote]" src="{THEME}/bbcodes/quote.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_code" class="editor_button" onclick="simpletag('code')"><img title="$lang[bb_t_code]" src="{THEME}/bbcodes/code.gif" width="23" height="25" border="0"></div>
|
||||
<div id="b_hide" class="editor_button" onclick="simpletag('hide')"><img title="$lang[bb_t_hide]" src="{THEME}/bbcodes/hide.gif" width="23" height="25" border="0"></div>
|
||||
<div class="editor_button"><img src="{THEME}/bbcodes/brkspace.gif" width="5" height="25" border="0"></div>
|
||||
<div id="b_spoiler" class="editor_button" onclick="spoiler()"><img src="{THEME}/bbcodes/spoiler.gif" width="23" height="25" border="0"></div>
|
||||
<iframe width="154" height="104" id="cp" src="{$color_html_dir}/color.html" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="visibility:hidden; display: none; position: absolute;"></iframe>
|
||||
<div id="dle_emo" style="visibility:hidden; display: none; position: absolute; width:140px; height: 124px; overflow: auto; border: 1px solid #BBB; background:#E9E8F2;filter: alpha(opacity=95, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3);">{$output}</div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
if ( stristr( $_SERVER['REQUEST_URI'], "pages.php" ) ) {
|
||||
|
||||
$script_code = @file_get_contents(SYSTEM_DIR."/ajax/bbcodes.js");
|
||||
$script_code .= <<<HTML
|
||||
|
||||
-->
|
||||
</SCRIPT>
|
||||
HTML;
|
||||
|
||||
} else {
|
||||
|
||||
$script_code = <<<HTML
|
||||
-->
|
||||
</SCRIPT>
|
||||
<script type="text/javascript" src="{$config['http_home_url']}system/ajax/bbcodes.js"></script>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
$bb_code = <<<HTML
|
||||
<SCRIPT type=text/javascript>
|
||||
<!--
|
||||
var text_enter_url = "$lang[bb_url]";
|
||||
var text_enter_page = "$lang[bb_page]";
|
||||
var text_enter_url_name = "$lang[bb_url_name]";
|
||||
var text_enter_page_name = "$lang[bb_page_name]";
|
||||
var text_enter_image = "$lang[bb_image]";
|
||||
var text_enter_email = "$lang[bb_email]";
|
||||
var text_code = "$lang[bb_code]";
|
||||
var text_quote = "$lang[bb_quote]";
|
||||
var error_no_url = "$lang[bb_no_url]";
|
||||
var error_no_title = "$lang[bb_no_title]";
|
||||
var error_no_email = "$lang[bb_no_email]";
|
||||
var prompt_start = "$lang[bb_prompt_start]";
|
||||
var img_title = "$lang[bb_img_title]";
|
||||
var email_title = "$lang[bb_email_title]";
|
||||
var text_pages = "$lang[bb_bb_page]";
|
||||
var image_align = "{$config['image_align']}";
|
||||
|
||||
var selField = "{$startform}";
|
||||
var fombj = {$addform};
|
||||
|
||||
function window_upload()
|
||||
{
|
||||
|
||||
uploadsform('{$uploads_script_dir}/uploads.php?area={$upload_var['area']}&fid={$upload_var['forum_id']}&tid={$upload_var['topic_id']}&pid={$upload_var['post_id']}');
|
||||
|
||||
}
|
||||
|
||||
{$script_code}
|
||||
{$code}
|
||||
HTML;
|
||||
|
||||
?>
|
||||
104
system/forum/sources/components/edit_options.php
Normal file
104
system/forum/sources/components/edit_options.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
if ($check_moderator)
|
||||
{
|
||||
if (moderator_value('edit_topic', $forum_id, $m_member))
|
||||
{
|
||||
$topic_option .= "<option value=\"04\"> - Ðåäàêòèðîâàòü çàãîëîâîê</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('move_topic', $forum_id, $m_member))
|
||||
{
|
||||
$topic_option .= "<option value=\"05\"> - Ïåðåìåñòèòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('close_topic', $forum_id, $m_member) and !$row_topic['topic_status'])
|
||||
{
|
||||
$topic_option .= "<option value=\"02\"> - Çàêðûòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('open_topic', $forum_id, $m_member) and $row_topic['topic_status'])
|
||||
{
|
||||
$topic_option .= "<option value=\"01\"> - Îòêðûòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('pin_topic', $forum_id, $m_member) and $row_topic['fixed'])
|
||||
{
|
||||
$topic_option .= "<option value=\"08\"> - Çàêðåïèòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('unpin_topic', $forum_id, $m_member) and !$row_topic['fixed'])
|
||||
{
|
||||
$topic_option .= "<option value=\"09\"> - Îòêðåïèòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (!$row_topic['hidden'])
|
||||
{
|
||||
$topic_option .= "<option value=\"06\"> - Ñêðûòü òåìó</option>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic_option .= "<option value=\"07\"> - Îïóáëèêîâàòü òåìó</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('delete_topic', $forum_id, $m_member))
|
||||
{
|
||||
$topic_option .= "<option value=\"03\"> - Óäàëèòü òåìó</option>";
|
||||
}
|
||||
|
||||
if($topic_option)
|
||||
{
|
||||
$topic_option = "<option value=\"-1\">Îïöèè ìîäåðàòîðà</option>".$topic_option;
|
||||
}
|
||||
|
||||
$posts_option = "<option value=\"00\">Ñîîáùåíèÿ</option>";
|
||||
|
||||
if (moderator_value('combining_post', $forum_id, $m_member))
|
||||
{
|
||||
$posts_option .= "<option value=\"07\"> - Îáúåäèíèòü ñîîáùåíèÿ</option>";
|
||||
}
|
||||
|
||||
if (moderator_value('move_post', $forum_id, $m_member))
|
||||
{
|
||||
$posts_option .= "<option value=\"08\"> - Ïåðåìåñòèòü ñîîáùåíèÿ</option>";
|
||||
}
|
||||
|
||||
$posts_option .= "<option value=\"05\"> - Îïóáëèêîâàòü ñîîáùåíèÿ</option>";
|
||||
$posts_option .= "<option value=\"06\"> - Ñêðûòü ñîîáùåíèÿ</option>";
|
||||
|
||||
if (moderator_value('mass_prune', $forum_id, $m_member))
|
||||
{
|
||||
$posts_option .= "<option value=\"04\"> - Óäàëèòü ñîîáùåíèÿ</option>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($user_group[$member_id['user_group']]['forum_topic_edit'] AND $member_id['name'] == $row_topic['author_topic'])
|
||||
{
|
||||
$topic_option .= "<option value=\"04\"> - Ðåäàêòèðîâàòü çàãîëîâîê</option>";
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_topic_set'] AND $member_id['name'] == $row_topic['author_topic']){
|
||||
if ($row_topic['topic_status']){
|
||||
$topic_option .= "<option value=\"01\"> - Îòêðûòü òåìó</option>";
|
||||
}else{
|
||||
$topic_option .= "<option value=\"02\"> - Çàêðûòü òåìó</option>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_topic_del'] AND $member_id['name'] == $row_topic['author_topic'])
|
||||
{
|
||||
$topic_option .= "<option value=\"03\"> - Óäàëèòü òåìó</option>";
|
||||
}
|
||||
|
||||
if ($topic_option)
|
||||
{
|
||||
$topic_option = "<option value=\"-1\">Îïöèè ìîäåðàòîðà</option>".$topic_option;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
777
system/forum/sources/components/functions.php
Normal file
777
system/forum/sources/components/functions.php
Normal file
@@ -0,0 +1,777 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM sessions
|
||||
// ********************************************************************************
|
||||
function forum_sessions ($act_forum = 0, $act_topic = 0)
|
||||
{
|
||||
global $db, $act, $forum_config, $member_id;
|
||||
|
||||
$id = $db->safesql($_COOKIE['dle_forum_sessions']);
|
||||
|
||||
$ip = $db->safesql($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (!$id) { $id = session_id(); }
|
||||
|
||||
$browser = $db->safesql($_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
$member_name = $member_id['name'];
|
||||
|
||||
$BOT_AGENT = array(
|
||||
'Googlebot' => "Google Bot",
|
||||
'Mediapartners' => "Google MP",
|
||||
'msnbot' => "MSN Bot",
|
||||
'yahoo' => "Yahoo Bot",
|
||||
'yandex' => "Yandex Bot",
|
||||
'rambler' => "Rambler Bot",
|
||||
'aport' => "Aport Bot",
|
||||
'webalta' => "WebAlta Bot",
|
||||
);
|
||||
|
||||
if (intval($member_id['user_group']) == "0"){ $member_id['user_group'] = "5"; }
|
||||
|
||||
if ($member_id['user_group'] == "5" and $forum_config['bot_agent'])
|
||||
{
|
||||
foreach ($BOT_AGENT as $bot => $bot_name)
|
||||
{
|
||||
if ( stristr ($browser, $bot) )
|
||||
{
|
||||
$member_name = $bot_name;
|
||||
|
||||
$id = md5 ($bot);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$time = time();
|
||||
|
||||
$stime = time() - ($forum_config['session_time'] * 60);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$row = $db->super_query("SELECT id FROM " . PREFIX . "_forum_sessions WHERE id = '$id' AND ip = '$ip'");
|
||||
}
|
||||
|
||||
if (!$row['id'])
|
||||
{
|
||||
set_cookie ('dle_forum_sessions', session_id(), 365);
|
||||
|
||||
$where_mn = $member_name ? " OR member_name = '$member_name'" : "";
|
||||
|
||||
$db->query("DELETE FROM " . PREFIX . "_forum_sessions WHERE running_time < '$stime' OR id = '$id'".$where_mn);
|
||||
|
||||
$db->query("INSERT INTO " . PREFIX . "_forum_sessions (id, member_name, member_id, user_group, ip, browser, running_time, location, act_forum, act_topic) VALUES ('$id', '$member_name', '$member_id[user_id]', '$member_id[user_group]', '$ip', '$browser', '$time', '$act', '$act_forum', '$act_topic')");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE " . PREFIX . "_forum_sessions SET member_name = '$member_name', member_id = '$member_id[user_id]', user_group = '$member_id[user_group]', running_time = '$time', location = '$act', act_forum = '$act_forum', act_topic = '$act_topic' WHERE id = '$id'");
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM Online
|
||||
// ********************************************************************************
|
||||
function get_forum_online ($type = false, $value = false)
|
||||
{
|
||||
global $db, $forum_config, $user_group, $forum_online;
|
||||
|
||||
$stime = time() - ($forum_config['session_time'] * 60);
|
||||
|
||||
if ($type and $value)
|
||||
{
|
||||
$WHERE = "".$type." = '$value' and";
|
||||
}
|
||||
|
||||
$sessions = $db->query("SELECT member_name, user_group FROM " . PREFIX . "_forum_sessions WHERE {$WHERE} running_time > '$stime'");
|
||||
|
||||
$forum_online['member_count'] = 0;
|
||||
|
||||
$forum_online['guest_count'] = 0;
|
||||
|
||||
while ($row = $db->get_row($sessions))
|
||||
{
|
||||
$forum_online['all_count']++;
|
||||
|
||||
if ($row['member_name'] AND $row['user_group'] !== "5")
|
||||
{
|
||||
$forum_online['member_count']++;
|
||||
|
||||
$symbol_count++;
|
||||
|
||||
if ($symbol_count > 1) $symbol = ", ";
|
||||
|
||||
$group_span = $user_group[$row['user_group']]['colour'];
|
||||
$forum_online['member_list'] .= $symbol.link_user($row['member_name'], "<span style=\"color:{$group_span}\">".$row['member_name']."</span>");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$forum_online['guest_count']++;
|
||||
|
||||
if ($row['member_name'])
|
||||
{
|
||||
$symbol_count++;
|
||||
|
||||
if ($symbol_count > 1) $symbol = ", ";
|
||||
|
||||
$forum_online['member_list'] .= $symbol . $row['member_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($forum_online['all_count'] > $forum_config['_max_online_'])
|
||||
{
|
||||
global $fcache;
|
||||
|
||||
$max_online = array ('count' => $forum_online['all_count'], 'time' => $GLOBALS['_TIME']);
|
||||
|
||||
$fcache->set('online', $max_online);
|
||||
|
||||
$fcache->delete('stats');
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// SHOW DATE
|
||||
// ********************************************************************************
|
||||
function show_date ($date)
|
||||
{
|
||||
global $f_lang, $forum_config, $_TIME;
|
||||
|
||||
if (date(Ymd, $date) == date(Ymd, $_TIME))
|
||||
{
|
||||
$show_date = $f_lang['time_heute'].langdate(", H:i", $date);
|
||||
}
|
||||
elseif (date(Ymd, $date) == date(Ymd, ($_TIME - 86400)))
|
||||
{
|
||||
$show_date = $f_lang['time_gestern'].langdate(", H:i", $date);
|
||||
}
|
||||
else
|
||||
{
|
||||
$show_date = langdate($forum_config['timestamp'], $date);
|
||||
}
|
||||
|
||||
return ($show_date);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM STATUS
|
||||
// ********************************************************************************
|
||||
function forum_status ($last_date, $close = false, $icon = false)
|
||||
{
|
||||
global $member_id, $lasttime, $f_lang;
|
||||
|
||||
$last_date = strtotime($last_date);
|
||||
|
||||
if ($icon)
|
||||
{
|
||||
$icon = "_".$icon;
|
||||
}
|
||||
|
||||
if ($last_date > $lasttime)
|
||||
{
|
||||
if (!$close)
|
||||
{
|
||||
$image = "f_new{$icon}.gif"; $alt = $f_lang['fs_new'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = "fc_new{$icon}.gif"; $alt = $f_lang['fs_new'];
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (!$close)
|
||||
{
|
||||
$image = "f_nonew{$icon}.gif"; $alt = $f_lang['fs_nonew'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = "fc_nonew{$icon}.gif"; $alt = $f_lang['fs_nonew'];
|
||||
}
|
||||
}
|
||||
|
||||
$topic_info = "<img src='{THEME}/forum/images/".$image."' border='0' alt='$alt'>";
|
||||
|
||||
return($topic_info);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM LAST
|
||||
// ********************************************************************************
|
||||
function forum_last ($topic_id, $title, $last_user, $last_date, $password = false, $fid = false, $access_read = false, $last_pid = 0)
|
||||
{
|
||||
global $forum_config, $f_lang, $_TIME, $member_id;
|
||||
|
||||
$title = stripslashes($title);
|
||||
|
||||
$last_date = strtotime($last_date);
|
||||
|
||||
$last_date_info = show_date($last_date);
|
||||
|
||||
$h_title = $f_lang['topic_last_p'].' '.$title;
|
||||
|
||||
if ($forum_config['last_abc'])
|
||||
{
|
||||
if (strlen($title) > $forum_config['last_abc'])
|
||||
{
|
||||
$title = substr($title, 0, $forum_config['last_abc']).'...';
|
||||
}
|
||||
}
|
||||
|
||||
if ($password AND md5($password) !== $_COOKIE["dle_forum_{$fid}"])
|
||||
{
|
||||
$link_topic = $f_lang['fl_c_forum'];
|
||||
}
|
||||
elseif (!check_access($access_read))
|
||||
{
|
||||
$link_topic = $f_lang['fl_c_forum'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($forum_config['mod_rewrite']) { $p_sn = "/last#post-{$last_pid}"; } else { $p_sn = "&lastpost=1#post-{$last_pid}"; }
|
||||
|
||||
$link_topic = link_topic($topic_id . $p_sn, $title, $h_title);
|
||||
}
|
||||
|
||||
$last_date_info .= $f_lang['fl_topic'].' '.$link_topic;
|
||||
|
||||
$last_date_info .= $f_lang['fl_author'].' '.link_user($last_user);
|
||||
|
||||
if (!$last_user or !$last_date){ $last_date_info = $f_lang['fl_nopost']; }
|
||||
|
||||
return($last_date_info);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TOPIC STATUS
|
||||
// ********************************************************************************
|
||||
function topic_status ($topic_id, $last_date, $post, $topic_status, $frage)
|
||||
{
|
||||
global $topic_views, $forum_config, $member_id, $f_lang, $topic_a_time;
|
||||
|
||||
$last_date = strtotime($last_date);
|
||||
|
||||
if ($last_date > $topic_a_time AND $last_date > $member_id['forum_time']) $topic_views_time = 1;
|
||||
|
||||
if ($post >= $forum_config['topic_hot']) $topic_hot = 1;
|
||||
|
||||
if (!$topic_views[$topic_id] AND $topic_views_time)
|
||||
{
|
||||
$image = 'topic.gif'; $alt = $f_lang['topic_yes'];
|
||||
|
||||
if ($topic_hot) $image = 'hot_topic.gif'; $alt = $f_lang['topic_yes'];
|
||||
|
||||
if ($frage) $image = 'dlet_poll.gif'; $alt = $f_lang['topic_yes'];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$image = 'new_topic.gif'; $alt = $f_lang['topic_no'];
|
||||
|
||||
if ($topic_hot) $image = 'hot_topic_no.gif'; $alt = $f_lang['topic_no'];
|
||||
|
||||
if ($frage) $image = 'dlet_poll_no.gif'; $alt = $f_lang['topic_no'];
|
||||
}
|
||||
|
||||
if ($topic_status == 1){$image = 'dlet_closed.gif'; $alt = $f_lang['topic_closed'];}
|
||||
|
||||
return ("<img src='{THEME}/forum/images/".$image."' border='0' alt='$alt'>");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TOPIC LAST
|
||||
// ********************************************************************************
|
||||
function topic_last ($topic_id, $last_user, $last_date, $posts, $last_pid = 0)
|
||||
{
|
||||
global $forum_config, $f_lang, $_TIME;
|
||||
|
||||
$last_date = strtotime($last_date);
|
||||
|
||||
$last_date_info = show_date($last_date);
|
||||
|
||||
if ($forum_config['last_plink'])
|
||||
{
|
||||
$last_page = @ceil(($posts + 1) / $forum_config['post_inpage']);
|
||||
|
||||
if (!$last_page) $last_page = 1;
|
||||
|
||||
if ($forum_config['mod_rewrite']) { $p_sn = '/'; } else { $p_sn = '&cstart='; }
|
||||
|
||||
$last_date_info .= "<br />".link_topic($topic_id . $p_sn . $last_page . "#post-{$last_pid}", $f_lang['last_post'])." ".link_user($last_user)."<br />";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$last_date_info .= "<br />{$f_lang['last_post']} ".link_user($last_user)."<br />";
|
||||
}
|
||||
|
||||
if (!$last_user or !$last_date){$last_date_info = $f_lang['fl_nopost'];}
|
||||
|
||||
return($last_date_info);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// CHECK ACCESS
|
||||
// ********************************************************************************
|
||||
function check_access ($value = false)
|
||||
{
|
||||
global $member_id;
|
||||
|
||||
$value = explode(":", $value);
|
||||
|
||||
$check = in_array($member_id['user_group'], $value);
|
||||
|
||||
if ($check) return true;
|
||||
|
||||
else return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// CHECK MODERATOR
|
||||
// ********************************************************************************
|
||||
function check_moderator($value, $moderators)
|
||||
{
|
||||
global $member_id, $m_member;
|
||||
|
||||
$value = explode(":", $value);
|
||||
|
||||
$check = in_array($member_id['user_group'], $value);
|
||||
|
||||
if (!$check and $moderators)
|
||||
{
|
||||
$moderators = explode(":", $moderators);
|
||||
|
||||
$check = in_array($member_id['user_id'], $moderators);
|
||||
|
||||
$m_member = true;
|
||||
}
|
||||
|
||||
if ($check) return true;
|
||||
|
||||
else return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// MODERATOR VALUE
|
||||
// ********************************************************************************
|
||||
function moderator_value($value, $forum_id, $m_member = false)
|
||||
{
|
||||
global $member_id, $forum_moderators;
|
||||
|
||||
if ($forum_moderators == "a:0:{}") return false;
|
||||
|
||||
if ($forum_moderators)
|
||||
{
|
||||
if ($m_member)
|
||||
{
|
||||
$search = 'member_id';
|
||||
|
||||
$search_value = $member_id['user_id'];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$search = 'group_id';
|
||||
|
||||
$forum_id = '0';
|
||||
|
||||
$search_value = $member_id['user_group'];
|
||||
}
|
||||
|
||||
foreach ($forum_moderators as $key => $val)
|
||||
{
|
||||
if ($forum_moderators[$key]['forum_id'] == $forum_id)
|
||||
{
|
||||
if ($forum_moderators[$key][$search] == $search_value)
|
||||
{
|
||||
if ($forum_moderators[$key][$value])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// IS MODERATION
|
||||
// ********************************************************************************
|
||||
function is_moderation($forum_id = 0, $topic_id = 0, $post_id = 0, $value = '')
|
||||
{
|
||||
global $db, $member_id, $user_group, $m_member, $is_mod; //$forum_id
|
||||
|
||||
$forum_id = intval($forum_id);
|
||||
|
||||
$topic_id = intval($topic_id);
|
||||
|
||||
$post_id = intval($post_id);
|
||||
|
||||
if ($post_id)
|
||||
{
|
||||
$get_post = $db->super_query("SELECT * FROM " . PREFIX . "_forum_posts WHERE pid = '$post_id'");
|
||||
|
||||
$topic_id = $get_post['topic_id'];
|
||||
|
||||
$is_mod['topic_id'] = $get_post['topic_id'];
|
||||
|
||||
$is_mod['author'] = $get_post['post_author'];
|
||||
|
||||
if ($member_id['name'] == $get_post['post_author'] AND $user_group[$member_id['user_group']][$value] AND !$get_post['hidden'])
|
||||
{
|
||||
return true;
|
||||
|
||||
$topic_id = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($topic_id)
|
||||
{
|
||||
if (!$forum_id)
|
||||
{
|
||||
$get_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
|
||||
|
||||
if ($get_topic['tid'] != $topic_id) return false;
|
||||
|
||||
$forum_id = $get_topic['forum_id'];
|
||||
}
|
||||
|
||||
$is_mod['forum_id'] = $get_topic['forum_id'];
|
||||
|
||||
$get_forum = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$forum_id'");
|
||||
|
||||
if (check_moderator($get_forum['access_mod'], $get_forum['moderators']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$post_id and !$topic_id)
|
||||
{
|
||||
$get_forum = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$forum_id'");
|
||||
|
||||
if (check_moderator($get_forum['access_mod'], $get_forum['moderators']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// GROUP MODERATION
|
||||
// ********************************************************************************
|
||||
function group_moderation ($topic_id = 0, $value = false)
|
||||
{
|
||||
global $db, $member_id, $user_group;
|
||||
|
||||
if (intval($topic_id))
|
||||
{
|
||||
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = '$topic_id'");
|
||||
|
||||
if ($member_id['name'] == $row['author_topic'])
|
||||
{
|
||||
foreach ($user_group as $key => $val)
|
||||
{
|
||||
if ($user_group[$key]['id'] == $member_id['user_group'])
|
||||
{
|
||||
if ($user_group[$key][$value])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM MSG
|
||||
// ********************************************************************************
|
||||
function forum_msg($title, $msg_text, $tpl_found = false, $tpl_set = false)
|
||||
{
|
||||
global $tpl, $tpl_dir;
|
||||
|
||||
$tpl->load_template($tpl_dir.'msg.tpl');
|
||||
|
||||
$tpl->set('{title}', $title);
|
||||
|
||||
$tpl->set('{msg}', $msg_text);
|
||||
|
||||
if ($tpl_found)
|
||||
{
|
||||
$tpl->set("{".$tpl_found."}", $tpl_set);
|
||||
}
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Get Salt
|
||||
// ********************************************************************************
|
||||
function get_salt()
|
||||
{
|
||||
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
|
||||
|
||||
srand((double)microtime()*1000000);
|
||||
|
||||
for($i=0;$i < 9; $i++)
|
||||
{
|
||||
$key_salt .= $salt{rand(0,33)};
|
||||
}
|
||||
|
||||
return ($key_salt);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Strip Data
|
||||
// ********************************************************************************
|
||||
function strip_data ($text)
|
||||
{
|
||||
$quotes = array( "\x27", "\x22", "\x60", "\t","\n","\r","'",",","/","\\","¬",";",":","@","~","[","]","{","}","=",")","(","*","&","^","%","$","<",">","?","!", '"' );
|
||||
$text = trim(strip_tags ($text));
|
||||
$text = str_replace($quotes, '', $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// hilites
|
||||
// ********************************************************************************
|
||||
function hilites ($search, $txt)
|
||||
{
|
||||
$r = preg_split('((>)|(<))', $txt, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
for ($i = 0; $i < count($r); $i++)
|
||||
{
|
||||
if ($r[$i] == "<")
|
||||
{
|
||||
$i++; continue;
|
||||
}
|
||||
|
||||
$r[$i] = preg_replace("#($search)#i", "<span style='background-color:yellow;'><font color='red'>\\1</font></span>", $r[$i]);
|
||||
}
|
||||
|
||||
return join("", $r);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM LIST
|
||||
// ********************************************************************************
|
||||
function forum_list(){
|
||||
global $db;
|
||||
|
||||
$select_list = "<select name=\"move_fid\">";
|
||||
|
||||
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id ORDER BY posi, position");
|
||||
|
||||
for ($i = 0, $totalcount = 0; $row = $db->get_row($result); $i = $row['sid'], $chcount++)
|
||||
{
|
||||
if ($row['sid'] != $i)
|
||||
{
|
||||
$row['cat_name'] = stripslashes($row['cat_name']);
|
||||
|
||||
$select_list .= "<option value=\"0\">{$row['cat_name']}</option>";
|
||||
}
|
||||
|
||||
if ($row['name'])
|
||||
{
|
||||
$row['name'] = stripslashes($row['name']);
|
||||
|
||||
$select_list .= "<option value=\"{$row['id']}\"> -- {$row['name']}</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$select_list .= "</select>";
|
||||
|
||||
return ($select_list);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// CHECK ATTACHMENT
|
||||
// ********************************************************************************
|
||||
function check_attachment($post_id, $sources)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$post_id = intval($post_id);
|
||||
|
||||
if (!$post_id OR !$sources) return false;
|
||||
|
||||
$query = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE post_id = '$post_id'");
|
||||
|
||||
while ($row = $db->get_row($query))
|
||||
{
|
||||
if (stristr($sources, "[attachment={$row['file_id']}]") OR stristr($sources, "/forum/files/{$row['onserver']}"))
|
||||
{
|
||||
$file_attach_y[] = $row['file_id'];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$file_attach_n[] = $row['file_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($file_attach_y)
|
||||
{
|
||||
$update_list_y = implode(',', $file_attach_y);
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_forum_files SET file_attach = '1' WHERE file_id IN ({$update_list_y})");
|
||||
}
|
||||
|
||||
if ($file_attach_n)
|
||||
{
|
||||
$update_list_n = implode(',', $file_attach_n);
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_forum_files SET file_attach = '0' WHERE file_id IN ({$update_list_n})");
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// File Type
|
||||
// ********************************************************************************
|
||||
function file_type($name)
|
||||
{
|
||||
$type = explode ('.', $name);
|
||||
|
||||
$type = end ($type);
|
||||
|
||||
return ($type);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Auto Wrap
|
||||
// ********************************************************************************
|
||||
function auto_wrap($post)
|
||||
{
|
||||
global $forum_config;
|
||||
|
||||
if (!$forum_config['auto_wrap']) return $post;
|
||||
|
||||
$post = preg_split('((>)|(<))', $post, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
$n = count($post);
|
||||
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
{
|
||||
if ($post[$i] == "<")
|
||||
{
|
||||
$i++; continue;
|
||||
}
|
||||
|
||||
$post[$i] = preg_replace("#([^\s\n\r]{".intval($forum_config['auto_wrap'])."})#i", "\\1<br />", $post[$i]);
|
||||
}
|
||||
|
||||
$post = join("", $post);
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Forum Metatags
|
||||
// ********************************************************************************
|
||||
function forum_metatags($story)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$keyword_count = 20;
|
||||
$newarr = array ();
|
||||
$headers = array ();
|
||||
$quotes = array ("\x27", "\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', "'", ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "&", "^", "%", "$", "<", ">", "?", "!", '"' );
|
||||
$fastquotes = array ("\x27", "\x22", "\x60", "\t", "\n", "\r", '"', "'", '\r', '\n', "/", "\\", "{", "}", "[", "]" );
|
||||
|
||||
$story = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "", $story );
|
||||
$story = preg_replace( "'\[attachment=(.*?)\]'si", "", $story );
|
||||
|
||||
$story = str_replace( '<br />', ' ', $story );
|
||||
$story = trim( strip_tags( $story ) );
|
||||
|
||||
$story = str_replace( $fastquotes, '', $story );
|
||||
$headers['description'] = $db->safesql( substr( $story, 0, 190 ) );
|
||||
|
||||
$story = str_replace( $quotes, '', $story );
|
||||
|
||||
$arr = explode( " ", $story );
|
||||
|
||||
foreach ( $arr as $word )
|
||||
{
|
||||
if( strlen( $word ) > 4 ) $newarr[] = $word;
|
||||
}
|
||||
|
||||
$arr = array_count_values( $newarr );
|
||||
arsort( $arr );
|
||||
|
||||
$arr = array_keys( $arr );
|
||||
|
||||
$total = count( $arr );
|
||||
|
||||
$offset = 0;
|
||||
|
||||
$arr = array_slice( $arr, $offset, $keyword_count );
|
||||
|
||||
$headers['keywords'] = $db->safesql( implode( ", ", $arr ) );
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
function set_first_post_id ($tid, $pid = 0)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$tid = intval($tid);
|
||||
|
||||
if (!$pid)
|
||||
{
|
||||
$row = $db->super_query("SELECT pid FROM " . PREFIX . "_forum_posts WHERE topic_id = $tid");
|
||||
|
||||
$pid = $row['pid'];
|
||||
}
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_forum_topics SET first_post = '$pid', last_post_id = '$pid' WHERE tid = '$tid'");
|
||||
|
||||
return $pid;
|
||||
}
|
||||
|
||||
function calk_topic_del ($topic_id, $del_count = 0, $act = '-')
|
||||
{
|
||||
global $db, $forum_config;
|
||||
|
||||
if (!$topic_id) return false;
|
||||
|
||||
$row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = $topic_id");
|
||||
|
||||
if (!$forum_config['set_topic_post']) $row['count'] = ($row['count'] - 1);
|
||||
|
||||
$new_result = $db->super_query("SELECT * FROM ". PREFIX ."_forum_posts WHERE topic_id = $topic_id ORDER by post_date DESC");
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_forum_topics SET post = '{$row['count']}', last_date = '$new_result[post_date]', last_poster_name = '$new_result[post_author]' WHERE tid = $topic_id");
|
||||
|
||||
$row2 = $db->super_query("SELECT forum_id FROM " . PREFIX . "_forum_topics WHERE tid = $topic_id");
|
||||
|
||||
$new_f_r = $db->super_query("SELECT * FROM ". PREFIX ."_forum_topics WHERE forum_id = {$row2['forum_id']} ORDER by last_date DESC");
|
||||
|
||||
if ($del_count)
|
||||
{
|
||||
$db->query("UPDATE " . PREFIX . "_forum_forums SET posts = posts{$act}{$del_count}, f_last_date = '$new_f_r[last_date]', f_last_poster_name = '$new_f_r[last_poster_name]' WHERE id = {$row2['forum_id']}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
471
system/forum/sources/components/init.php
Normal file
471
system/forum/sources/components/init.php
Normal file
@@ -0,0 +1,471 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
@include SYSTEM_DIR.'/data/forum_config.php';
|
||||
include_once SYSTEM_DIR.'/forum/language/'.$config['langs'].'/forum.lng';
|
||||
require_once SYSTEM_DIR.'/classes/cache.class.php';
|
||||
$fcache = new cache($dir = ROOT_DIR . '/cache/forum');
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/functions.php';
|
||||
|
||||
define('UPLOAD_DIR', ROOT_DIR."/uploads/forum/");
|
||||
|
||||
// ********************************************************************************
|
||||
// USER UPDATE
|
||||
// ********************************************************************************
|
||||
|
||||
if ($is_logged and $forum_config['set_post_num_day'] and !$_SESSION['forum_update'])
|
||||
{
|
||||
if (!$member_id['forum_update'])
|
||||
{
|
||||
$db->query("UPDATE " . PREFIX . "_users SET forum_update = '".time()."' WHERE user_id = {$member_id['user_id']}");
|
||||
}
|
||||
|
||||
$up_days = ($forum_config['set_post_num_day'] * 8640);
|
||||
|
||||
if ((time() + $up_days) > $member_id['forum_update'])
|
||||
{
|
||||
if ($forum_config['set_topic_post'])
|
||||
{
|
||||
$topic = $db->super_query("SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics WHERE author_topic = '$member_id[name]'");
|
||||
|
||||
$topic_num = $topic['count'];
|
||||
}
|
||||
|
||||
$post = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts
|
||||
WHERE post_author = '$member_id[name]' and is_count");
|
||||
|
||||
$post_num = $post['count'];
|
||||
|
||||
$update = $forum_config['set_topic_post'] ? ($topic_num + $post_num) : $post_num;
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_users SET forum_post = '$update' WHERE name = '$member_id[name]'");
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_users SET forum_update = '".time()."' WHERE user_id = {$member_id['user_id']}");
|
||||
|
||||
$_SESSION['forum_update'] = "1";
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// SET MOD REWRITE
|
||||
// ********************************************************************************
|
||||
if (!defined('FORUM_SUB_DOMAIN'))
|
||||
{
|
||||
if ($forum_config['mod_rewrite'])
|
||||
{
|
||||
$forum_url = $config['http_home_url']."forum";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$forum_url = $config['http_home_url']."index.php?do=forum&";
|
||||
}
|
||||
|
||||
$a_forum_url = $config['http_home_url']."index.php?do=forum&";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ($forum_config['mod_rewrite'])
|
||||
{
|
||||
$forum_url = $forum_config['forum_url'];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$forum_url = $forum_config['forum_url']."/index.php?";
|
||||
}
|
||||
|
||||
$a_forum_url = $forum_config['forum_url']."/index.php?";
|
||||
}
|
||||
|
||||
$forum_link_array = array();
|
||||
|
||||
if ($forum_config['mod_rewrite'])
|
||||
{
|
||||
$forum_link_array['search'] = $forum_url."/search/";
|
||||
|
||||
$forum_link_array['getnew'] = $forum_url."/getnew/";
|
||||
|
||||
$forum_link_array['subscription'] = $forum_url."/subscription/";
|
||||
|
||||
$forum_link_array['textversion'] = $forum_url."/textversion.html";
|
||||
|
||||
function link_category($id, $name)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
return ("<a href='{$forum_url}/category_{$id}'>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_forum($id, $name, $symbol=false)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
$name = stripslashes($name);
|
||||
|
||||
return ($symbol."<a href='{$forum_url}/forum_{$id}'>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_topic($id, $name, $title = false)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
if ($title) $title = " title='$title'";
|
||||
|
||||
return ("<a href='{$forum_url}/topic_{$id}'{$title}>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_user($user, $title = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!$title) $title = $user;
|
||||
|
||||
return("<a href='{$config['http_home_url']}user/".urlencode($user)."/'>{$title}</a>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$forum_link_array['search'] = $forum_url."act=search";
|
||||
|
||||
$forum_link_array['getnew'] = $forum_url."act=getnew";
|
||||
|
||||
$forum_link_array['subscription'] = $forum_url."act=subscription";
|
||||
|
||||
$forum_link_array['textversion'] = $config['http_home_url']."system/forum/textversion.php";
|
||||
|
||||
function link_category($id, $name)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
return ("<a href='{$forum_url}category={$id}'>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_forum($id, $name, $symbol=false)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
$name = stripslashes($name);
|
||||
|
||||
return ($symbol."<a href='{$forum_url}showforum={$id}'>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_topic($id, $name, $title = false)
|
||||
{
|
||||
global $forum_url;
|
||||
|
||||
if ($title) $title = " title='$title'";
|
||||
|
||||
return ("<a href='{$forum_url}showtopic={$id}'{$title}>{$name}</a>");
|
||||
}
|
||||
|
||||
function link_user($user, $title = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!$title) $title = $user;
|
||||
|
||||
return("<a href='{$config['http_home_url']}?subaction=userinfo&user=".urlencode($user)."'>{$title}</a>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$tpl_dir = 'forum/';
|
||||
|
||||
$metatags['title'] = $forum_config['forum_title'];
|
||||
|
||||
$start_id = $fcache->get('start_id');
|
||||
|
||||
if (!$start_id)
|
||||
{
|
||||
$row_start = $db->super_query("SELECT sid FROM " . PREFIX . "_forum_category ORDER BY posi LIMIT 1");
|
||||
|
||||
$start_id = $row_start['sid'];
|
||||
|
||||
$fcache->set('start_id', $start_id);
|
||||
}
|
||||
|
||||
$cats_array = $fcache->get('cats_array');
|
||||
|
||||
if (!$cats_array)
|
||||
{
|
||||
$cats_array = array();
|
||||
|
||||
$result = $db->query("SELECT sid, cat_name FROM ". PREFIX ."_forum_category ORDER by posi");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
$cats_array[$row['sid']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$cats_array[$row['sid']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$cats_array) $cats_array = 'empty';
|
||||
|
||||
$fcache->set('cats_array', $cats_array);
|
||||
}
|
||||
|
||||
$forums_array = $fcache->get('forums_array');
|
||||
|
||||
if (!$forums_array)
|
||||
{
|
||||
$forums_array = array();
|
||||
|
||||
$result = $db->query("SELECT id, parentid, main_id, name, access_read, access_write, access_topic, access_mod, access_upload, access_download, password, moderators, postcount, fixpost, banner, q_reply, i_edit FROM ". PREFIX ."_forum_forums ORDER by position");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
$forums_array[$row['id']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$forums_array[$row['id']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$fcache->set('forums_array', $forums_array);
|
||||
}
|
||||
|
||||
$sub_forums_array = $fcache->get('sub_forums_array');
|
||||
|
||||
if (!$sub_forums_array)
|
||||
{
|
||||
$sub_forums_array = array();
|
||||
|
||||
$result = $db->query("SELECT id, parentid, name FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
$sub_forums_array[$row['id']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$sub_forums_array[$row['id']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$sub_forums_array) $sub_forums_array = 'empty';
|
||||
|
||||
$fcache->set('sub_forums_array', $sub_forums_array);
|
||||
}
|
||||
|
||||
$sub_parentid = $fcache->get('sub_parentid');
|
||||
|
||||
if (!$sub_parentid)
|
||||
{
|
||||
$sub_parentid = array();
|
||||
|
||||
$result = $db->query("SELECT parentid FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
$sub_parentid[$row['parentid']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$sub_parentid[$row['parentid']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$sub_parentid) $sub_parentid = 'empty';
|
||||
|
||||
$fcache->set('sub_parentid', $sub_parentid);
|
||||
}
|
||||
|
||||
$forum_moderators = $fcache->get('forum_moderators');
|
||||
|
||||
if (!$forum_moderators)
|
||||
{
|
||||
$get_moderators = $db->query("SELECT * FROM " . PREFIX . "_forum_moderators ORDER BY mid ASC");
|
||||
|
||||
$forum_moderators = array();
|
||||
|
||||
while ($row = $db->get_row($get_moderators))
|
||||
{
|
||||
$forum_moderators[$row['mid']] = array();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$forum_moderators[$row['mid']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$fcache->set('forum_moderators', $forum_moderators);
|
||||
}
|
||||
|
||||
$rank_array = $fcache->get('rank_array');
|
||||
|
||||
if (!$rank_array)
|
||||
{
|
||||
$rank_array = array();
|
||||
|
||||
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_titles");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
$rank_array[$row['id']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$rank_array[$row['id']][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$rank_array) $rank_array = 'empty';
|
||||
|
||||
$fcache->set('rank_array', $rank_array);
|
||||
}
|
||||
|
||||
$date_cron = $fcache->get('date_cron');
|
||||
|
||||
//@TODO Êîñÿê â èçîáðàæåíèè
|
||||
$compile_php = "/inc/forum/ico/dle_forum.png";
|
||||
|
||||
if (!$date_cron OR $date_cron != date('d'))
|
||||
{
|
||||
$lim_time = (time() - 86400);
|
||||
|
||||
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_date < '$lim_time' AND file_attach = 0");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
if ($row['file_type'] == "file")
|
||||
{
|
||||
unlink(UPLOAD_DIR."files/".$row['onserver']);
|
||||
}
|
||||
|
||||
elseif ($row['file_type'] == "thumb")
|
||||
{
|
||||
unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
|
||||
|
||||
unlink(UPLOAD_DIR."images/".$row['onserver']);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
unlink(UPLOAD_DIR."images/".$row['onserver']);
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = {$row['file_id']}");
|
||||
}
|
||||
|
||||
$fcache->set('date_cron', date('d'));
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// MAX ONLINE STATS
|
||||
// ********************************************************************************
|
||||
$max_online = $fcache->get('online');
|
||||
|
||||
$forum_config['_max_online_'] = $max_online['count'];
|
||||
|
||||
// ********************************************************************************
|
||||
// IF OFFLINE
|
||||
// ********************************************************************************
|
||||
if ($forum_config['offline'] AND !$user_group[$member_id['user_group']]['allow_offline'] AND !$ajax_start)
|
||||
{
|
||||
die ("<center><hr><h2>Forum - offline</h2><hr></center>");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// REQUREST
|
||||
// ********************************************************************************
|
||||
if ($_REQUEST['category'])
|
||||
{
|
||||
$act = 'category';
|
||||
|
||||
$cid = intval($_REQUEST['category']);
|
||||
|
||||
$t_act = '?c' . $cid;
|
||||
}
|
||||
|
||||
if ($_REQUEST['showforum'])
|
||||
{
|
||||
$act = 'forum';
|
||||
|
||||
$fid = intval($_REQUEST['showforum']);
|
||||
|
||||
$t_act = '?f' . $fid;
|
||||
}
|
||||
|
||||
if ($_REQUEST['showtopic'])
|
||||
{
|
||||
$act = 'topic';
|
||||
|
||||
$tid = intval($_REQUEST['showtopic']);
|
||||
|
||||
$t_act = '?t' . $tid;
|
||||
}
|
||||
|
||||
if ($forum_config['sessions_log'] AND $act != 'forum' AND $act != 'topic' AND !$not_forum_sessions AND !$ajax_start)
|
||||
{
|
||||
forum_sessions();
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TIME
|
||||
// ********************************************************************************
|
||||
$topic_a_time = time() - ($forum_config['topic_new_day'] * 86400);
|
||||
|
||||
if ($is_logged)
|
||||
{
|
||||
if (!$_SESSION['forum_last'])
|
||||
{
|
||||
@session_register('forum_last');
|
||||
|
||||
$_SESSION['forum_last'] = $member_id['forum_last'];
|
||||
|
||||
if (($member_id['forum_last'] + (3600*4)) < $_TIME)
|
||||
{
|
||||
$db->query("UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET forum_last='{$_TIME}' where user_id={$member_id['user_id']}");
|
||||
}
|
||||
}
|
||||
|
||||
$lasttime = $_SESSION['forum_last'];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (!$_COOKIE['forum_last'])
|
||||
{
|
||||
set_cookie ('forum_last', $_TIME, 365);
|
||||
|
||||
$_COOKIE['forum_last'] = $_TIME;
|
||||
}
|
||||
|
||||
if (!$_SESSION['guest_forum_last'])
|
||||
{
|
||||
@session_register('guest_forum_last');
|
||||
|
||||
$_SESSION['guest_forum_last'] = $_COOKIE['forum_last'];
|
||||
|
||||
if (($_COOKIE['forum_last'] + (3600*4)) < $_TIME)
|
||||
{
|
||||
set_cookie ('forum_last', $_TIME, 365);
|
||||
}
|
||||
}
|
||||
|
||||
$lasttime = $_SESSION['guest_forum_last'];
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// Last Visit
|
||||
// ********************************************************************************
|
||||
if (!$act and $lasttime)
|
||||
{
|
||||
$dle_forum_last_visit = $f_lang['last_visit'] .' '. show_date ($lasttime);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dle_forum_last_visit = "";
|
||||
}
|
||||
?>
|
||||
1
system/forum/sources/components/licence.odf
Normal file
1
system/forum/sources/components/licence.odf
Normal file
File diff suppressed because one or more lines are too long
159
system/forum/sources/components/navigation.php
Normal file
159
system/forum/sources/components/navigation.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/*
|
||||
=====================================================
|
||||
DLE Forum - by DLE Files Group
|
||||
-----------------------------------------------------
|
||||
http://dle-files.ru/
|
||||
-----------------------------------------------------
|
||||
File: navigation.php
|
||||
=====================================================
|
||||
Copyright (c) 2008,2010 DLE Files Group
|
||||
=====================================================
|
||||
*/
|
||||
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
$tpl->load_template($tpl_dir.'navigation.tpl');
|
||||
|
||||
//----------------------------------
|
||||
// Previous
|
||||
//----------------------------------
|
||||
$no_prev = false;
|
||||
$no_next = false;
|
||||
|
||||
if(isset($cstart) and $cstart != "" and $cstart > 0)
|
||||
{
|
||||
$prev = $cstart / $config_inpage;
|
||||
|
||||
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "<a href=\"".$icat."".$prev."/\">\\1</a>");
|
||||
}
|
||||
|
||||
else $tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1"); $no_prev = TRUE;
|
||||
|
||||
//----------------------------------
|
||||
// Pages
|
||||
//----------------------------------
|
||||
if($config_inpage)
|
||||
{
|
||||
if ($count_all > $config_inpage){$tpl_nav = true;} // tpl compile //
|
||||
|
||||
$pages_count = @ceil($count_all / $config_inpage);
|
||||
$pages_start_from = 0;
|
||||
$pages = "";
|
||||
$pages_per_section = 3;
|
||||
|
||||
if($pages_count > 10)
|
||||
{
|
||||
for($j = 1; $j <= $pages_per_section; $j++)
|
||||
{
|
||||
if($pages_start_from != $cstart)
|
||||
{
|
||||
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= " <span>$j</span> ";
|
||||
}
|
||||
|
||||
$pages_start_from += $config_inpage;
|
||||
}
|
||||
|
||||
if(((($cstart / $config_inpage) + 1) > 1) && ((($cstart / $config_inpage) + 1) < $pages_count))
|
||||
{
|
||||
$pages .= ((($cstart / $config_inpage) + 1) > ($pages_per_section + 2)) ? '... ' : ' ';
|
||||
$page_min = ((($cstart / $config_inpage) + 1) > ($pages_per_section + 1)) ? ($cstart / $config_inpage) : ($pages_per_section + 1);
|
||||
|
||||
$page_max = ((($cstart / $config_inpage) + 1) < ($pages_count - ($pages_per_section + 1))) ? (($cstart / $config_inpage) + 1) : $pages_count - ($pages_per_section + 1);
|
||||
|
||||
$pages_start_from = ($page_min - 1) * $config_inpage;
|
||||
|
||||
for($j = $page_min; $j < $page_max + ($pages_per_section - 1); $j++)
|
||||
{
|
||||
if($pages_start_from != $cstart)
|
||||
{
|
||||
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= " <span>$j</span> ";
|
||||
}
|
||||
|
||||
$pages_start_from += $config_inpage;
|
||||
}
|
||||
|
||||
$pages .= ((($cstart / $config_inpage) + 1) < $pages_count - ($pages_per_section + 1)) ? '... ' : ' ';
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= '... ';
|
||||
}
|
||||
|
||||
$pages_start_from = ($pages_count - $pages_per_section) * $config_inpage;
|
||||
|
||||
for($j=($pages_count - ($pages_per_section - 1)); $j <= $pages_count; $j++)
|
||||
{
|
||||
if($pages_start_from != $cstart)
|
||||
{
|
||||
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= " <span>$j</span> ";
|
||||
}
|
||||
|
||||
$pages_start_from += $config_inpage;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for($j=1;$j<=$pages_count;$j++)
|
||||
{
|
||||
if($pages_start_from != $cstart)
|
||||
{
|
||||
$pages .= "<a href=\"".$icat."".$j."\">$j</a> ";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= " <span>$j</span> ";
|
||||
}
|
||||
|
||||
$pages_start_from += $config_inpage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->set('{pages}', $pages);
|
||||
|
||||
$tpl->set('{pages_count}', $pages_count);
|
||||
|
||||
$tpl->set_block("'\[page-link\](.*?)\[/page-link\]'si", "<a href=\"JavaScript:navigation('{$pages_count}', '{$icat}');\">\\1</a>");
|
||||
|
||||
//----------------------------------
|
||||
// Next
|
||||
//----------------------------------
|
||||
$i = (($cstart / $config_inpage));
|
||||
|
||||
if($i < $pages_count-1)
|
||||
{
|
||||
$next_page = $cstart / $config_inpage + 2;
|
||||
|
||||
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "<a href=\"".$icat."".$next_page."/\">\\1</a>");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
|
||||
}
|
||||
|
||||
if ($tpl_nav){$tpl->compile('navigation');}
|
||||
|
||||
$tpl->clear();
|
||||
?>
|
||||
159
system/forum/sources/components/poll.php
Normal file
159
system/forum/sources/components/poll.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
$topic_id = $tid;
|
||||
|
||||
function get_votes ($all) {
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($all != "") {
|
||||
$all = explode("|", $all);
|
||||
|
||||
foreach ($all as $vote) {
|
||||
list($answerid, $answervalue) = explode(":", $vote);
|
||||
$data[$answerid] = intval($answervalue);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if ($is_logged)
|
||||
$log_id = intval($member_id['user_id']);
|
||||
else
|
||||
$log_id = $_IP;
|
||||
|
||||
$log = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_poll_log WHERE topic_id = '$topic_id' AND member ='{$log_id}'");
|
||||
|
||||
$row_topic['poll_title'] = stripslashes($row_topic['poll_title']);
|
||||
$row_topic['frage'] = stripslashes($row_topic['frage']);
|
||||
$body = explode("<br />", stripslashes($row_topic['poll_body']));
|
||||
|
||||
$tpl->load_template($tpl_dir.'poll.tpl');
|
||||
|
||||
$tpl->set('{vote_title}', $row_topic['poll_title']);
|
||||
$tpl->set('{question}', $row_topic['frage']);
|
||||
$tpl->set('{vote_count}', $row_topic['poll_count']);
|
||||
|
||||
$list = "<div id=\"dle-poll-list\">";
|
||||
|
||||
if (!$log['count'] AND $check_write) {
|
||||
if (!$row_topic['multiple']){
|
||||
|
||||
for ($v = 0; $v < sizeof($body); $v++) {
|
||||
if (!$v) $sel = "checked"; else $sel = "";
|
||||
|
||||
$list .= <<<HTML
|
||||
<div><input name="dle_poll_votes" id="dle_poll_votes" type="radio" $sel value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
for ($v = 0; $v < sizeof($body); $v++) {
|
||||
|
||||
$list .= <<<HTML
|
||||
<div><input name="dle_poll_votes[]" id="dle_poll_votes" type="checkbox" value="{$v}"><label for="dle_poll_votes">{$body[$v]}</label></div>
|
||||
HTML;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$allcount = 0;
|
||||
|
||||
} else {
|
||||
|
||||
$answer = get_votes ($row_topic['answer']);
|
||||
$allcount = $row_topic['poll_count'];
|
||||
$pn = 0;
|
||||
|
||||
for ($v = 0; $v < sizeof($body); $v++) {
|
||||
|
||||
$num = $answer[$v];
|
||||
++$pn; if ($pn > 5) $pn = 1;
|
||||
|
||||
if (!$num) $num = 0;
|
||||
|
||||
if ($allcount != 0) $proc = (100 * $num) / $allcount;
|
||||
else $proc = 0;
|
||||
|
||||
$proc = round($proc, 0);
|
||||
|
||||
$list .= <<<HTML
|
||||
{$body[$v]} - {$num} ({$proc}%)<br />
|
||||
<img src="{$config['http_home_url']}templates/{$config['skin']}/images/poll{$pn}.gif" height="10" width="{$proc}%" style="border:1px solid black"><br />
|
||||
HTML;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$allcount = 1;
|
||||
|
||||
}
|
||||
|
||||
$list .= "</div>";
|
||||
|
||||
$tpl->set('{vote_body}',$list);
|
||||
|
||||
if (!defined('FORUM_SUB_DOMAIN'))
|
||||
{
|
||||
$ajax_poll_php = "system/forum/";
|
||||
}
|
||||
|
||||
$ajax_script = <<<HTML
|
||||
<script type="text/javascript">
|
||||
var dle_poll_result = 0;
|
||||
var dle_poll_voted = {$allcount};
|
||||
function doPoll( event ){
|
||||
|
||||
var frm = document.dlepollform;
|
||||
var vote_check = '';
|
||||
var topic_id = frm.topic_id.value;
|
||||
|
||||
if (dle_poll_voted == 1) { return; }
|
||||
|
||||
if (event != 'results' && dle_poll_result != 1) {
|
||||
for (var i=0;i < frm.elements.length;i++) {
|
||||
var elmnt = frm.elements[i];
|
||||
if (elmnt.type=='radio') {
|
||||
if(elmnt.checked == true){ vote_check = elmnt.value; break;}
|
||||
}
|
||||
if (elmnt.type=='checkbox') {
|
||||
if(elmnt.checked == true){ vote_check = vote_check + elmnt.value + ' ';}
|
||||
}
|
||||
}
|
||||
|
||||
if (event == 'vote' && vote_check == '') { alert ('{$lang['poll_failed']}'); return; }
|
||||
|
||||
dle_poll_voted = 1;
|
||||
|
||||
} else { dle_poll_result = 1; }
|
||||
|
||||
if (dle_poll_result == 1 && event == 'vote') { dle_poll_result = 0; event = 'list'; }
|
||||
|
||||
ShowLoading('');
|
||||
$.post(dle_root + "{$ajax_poll_php}ajax/poll.php", { vote_skin: "{$config['skin']}", topic_id: topic_id, action: event, answer: vote_check }, function(data){
|
||||
|
||||
HideLoading('');
|
||||
|
||||
$("#dle-poll-list").fadeOut(500, function() {
|
||||
$(this).html(data);
|
||||
$(this).fadeIn(500);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
HTML;
|
||||
|
||||
$tpl->copy_template = $ajax_script."<form method=\"post\" name=\"dlepollform\" id=\"dlepollform\" action=\"\">".$tpl->copy_template."<input type=\"hidden\" name=\"topic_id\" id=\"topic_id\" value=\"".$topic_id."\" /></form>";
|
||||
|
||||
$tpl->compile('topic_poll');
|
||||
$tpl->clear();
|
||||
|
||||
?>
|
||||
124
system/forum/sources/components/text_skin.php
Normal file
124
system/forum/sources/components/text_skin.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
function tpl_main ($tpl){
|
||||
|
||||
global $config, $forum_config;
|
||||
|
||||
$textversion = <<<HTML
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset={$tpl['charset']}" />
|
||||
<link rel="stylesheet" rev="stylesheet" href="{$config['http_home_url']}/system/forum/textscreen.css" media="screen" />
|
||||
<title>{$tpl['title']}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id='wrapper'>
|
||||
<div id='largetext'>Ïîëíàÿ âåðñèÿ ýòîé ñòðàíèöû: <a href='{$tpl['full_version_link']}'>{$tpl['full_version']}</a></div>
|
||||
<div class='nav'>{$tpl['nav']}</div>
|
||||
{$tpl['pages']}
|
||||
<div id='content'>
|
||||
{$tpl['content']}
|
||||
</div>
|
||||
{$tpl['pages']}
|
||||
<div class='smalltext'>Äëÿ ïðîñìîòðà ïîëíîé âåðñèè ýòîé ñòðàíèöû, ïîæàëóéñòà, <a href='{$tpl['full_version_link']}'>ïðîéäèòå ïî ññûëêå</a>.</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
|
||||
echo $textversion;
|
||||
|
||||
}
|
||||
|
||||
function tpl_forums_page ($forums)
|
||||
{
|
||||
return <<<HTML
|
||||
<div class='forumwrap'>
|
||||
<ul>
|
||||
$forums
|
||||
</ul>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
function tpl_forum_page ($topics)
|
||||
{
|
||||
return <<<HTML
|
||||
<div class='topicwrap'>
|
||||
<ol>
|
||||
$topics
|
||||
</ol>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
function tpl_pages ($cstart, $count_all, $inpage, $url)
|
||||
{
|
||||
$pages_count = @ceil($count_all / $inpage);
|
||||
|
||||
$pages_start_from = 0;
|
||||
$pages = "";
|
||||
|
||||
for ($j=1; $j <= $pages_count; $j++)
|
||||
{
|
||||
if ($pages_start_from != $cstart)
|
||||
{
|
||||
$pages .= "<a href=\"{$url}-{$j}\">{$j}</a> ";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$pages .= " <b>{$j}</b> ";
|
||||
}
|
||||
|
||||
$pages_start_from += $inpage;
|
||||
}
|
||||
|
||||
return ("<div class='pagespan'><b>Ñòðàíèöû:</b> {$pages}</div>");
|
||||
}
|
||||
|
||||
function tpl_category ($id, $name)
|
||||
{
|
||||
return ("\n<li><strong><a href='?c{$id}'>{$name}</a></strong></li>\n<ul>");
|
||||
}
|
||||
|
||||
function tpl_category_end ()
|
||||
{
|
||||
return ("\n</ul></li>");
|
||||
}
|
||||
|
||||
function tpl_forum ($id, $name, $post, $sub = false)
|
||||
{
|
||||
if ($sub)
|
||||
{
|
||||
$sub_tpl = "\n<li><ul>{$sub}</ul></li>\n";
|
||||
}
|
||||
|
||||
return ("\n<li><a href='?f{$id}'>{$name}</a> <span class='desc'>({$post} ñîîáùåíèé)</span></li>".$sub_tpl);
|
||||
}
|
||||
|
||||
function tpl_forum_sub ($id, $name)
|
||||
{
|
||||
return ("\n<li><a href='?f{$id}'>{$name}</a></li>");
|
||||
}
|
||||
|
||||
function tpl_post ($post, $author, $date)
|
||||
{
|
||||
return <<<HTML
|
||||
<div class='postwrapper'>
|
||||
<div class='posttopbar'>
|
||||
<div class='postname'>{$author}</div>
|
||||
<div class='postdate'>{$date}</div>
|
||||
</div>
|
||||
<div class='postcontent'>{$post}</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
function tpl_topic_list ($id, $n_pre, $name, $post)
|
||||
{
|
||||
return ("\n<li>{$n_pre}<a href='?t{$id}'>{$name}</a> <span class='desc'>({$post} îòâåòîâ)</span></li>");
|
||||
}
|
||||
|
||||
?>
|
||||
96
system/forum/sources/modules/getnew.php
Normal file
96
system/forum/sources/modules/getnew.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
if ($is_logged)
|
||||
{
|
||||
if ($_REQUEST['code'] == "01")
|
||||
{
|
||||
$db->query("UPDATE " . PREFIX . "_users SET forum_last = '$_TIME', forum_time = '$_TIME' WHERE name = '$member_id[name]'");
|
||||
|
||||
$db->query("DELETE FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
|
||||
|
||||
$_SESSION['forum_last'] = $_TIME;
|
||||
|
||||
@header("Location: {$forum_url}");
|
||||
}
|
||||
|
||||
if ($cstart)
|
||||
{
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['topic_inpage'];
|
||||
}
|
||||
|
||||
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
|
||||
|
||||
$topic_views = array();
|
||||
|
||||
while ($row = $db->get_row($row_views))
|
||||
{
|
||||
$topic_views[$row['topic_id']] = '1';
|
||||
}
|
||||
|
||||
$config_inpage = $forum_config['topic_inpage'];
|
||||
|
||||
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0 LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
|
||||
|
||||
if (!$is_topics)
|
||||
{
|
||||
$msg_info = $f_lang['is_topics'];
|
||||
}
|
||||
|
||||
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE UNIX_TIMESTAMP(last_date) > '$lasttime' and hidden = 0");
|
||||
|
||||
$count_all = $get_count['count'];
|
||||
|
||||
$icat = $forum_url."/getnew/";
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
|
||||
|
||||
$tpl->load_template($tpl_dir.'forum.tpl');
|
||||
|
||||
$tpl->set('{banner}', '');
|
||||
|
||||
$tpl->set('{forum}', $f_lang['getnew_title']);
|
||||
|
||||
$tpl->set('{subforums}','');
|
||||
|
||||
$tpl->set('{topics}', $tpl->result['topics']);
|
||||
|
||||
$tpl->set('{info}', $msg_info);
|
||||
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
|
||||
$all_read_link = "<a href=\"{$a_forum_url}act=getnew&code=01\">{$f_lang['all_read_link']}</a>";
|
||||
|
||||
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", $all_read_link);
|
||||
|
||||
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$group_name = $user_group[$member_id['user_group']]['group_name'];
|
||||
|
||||
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
|
||||
}
|
||||
|
||||
$bbr_app = $f_lang['app_getnew'];
|
||||
|
||||
?>
|
||||
250
system/forum/sources/modules/search.php
Normal file
250
system/forum/sources/modules/search.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['search_text']))
|
||||
{
|
||||
$search_text = substr ( strip_data( $_REQUEST['search_text'] ), 0, 90 );
|
||||
|
||||
$search_text_explode = explode (' ', $search_text);
|
||||
|
||||
if (count($search_text_explode))
|
||||
{
|
||||
foreach ($search_text_explode as $key => $value)
|
||||
{
|
||||
$value = trim ($value);
|
||||
|
||||
if ($value !== "" and strlen($value) > 3)
|
||||
{
|
||||
$search_text_array[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($search_text_array))
|
||||
{
|
||||
$search_list = implode('|', $search_text_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$search_fid = $_REQUEST['search_fid'];
|
||||
|
||||
$count_all = intval($_REQUEST['count_all']);
|
||||
|
||||
if ($forum_config['search_captcha'])
|
||||
{
|
||||
$search_captcha = check_access($forum_config['search_captcha']);
|
||||
}
|
||||
|
||||
if ($search_captcha)
|
||||
{
|
||||
if ($_REQUEST['sec_code'])
|
||||
{
|
||||
$_SESSION['captcha_search'] = $_REQUEST['sec_code'];
|
||||
}
|
||||
|
||||
if ($_SESSION['captcha_search'] == $_SESSION['sec_code_session'])
|
||||
{
|
||||
$search_captcha_true = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$search_captcha_true = TRUE;
|
||||
}
|
||||
|
||||
if ($search_list AND $search_captcha_true)
|
||||
{
|
||||
if ($search_fid)
|
||||
{
|
||||
$_SESSION['search_fid'] = $search_fid;
|
||||
}
|
||||
|
||||
if ($is_logged)
|
||||
{
|
||||
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
|
||||
|
||||
$topic_views = array();
|
||||
|
||||
while ($row = $db->get_row($row_views))
|
||||
{
|
||||
$topic_views[$row['topic_id']] = '1';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row_views = explode(",", $_COOKIE['dle_forum_views']);
|
||||
|
||||
foreach ($row_views as $value)
|
||||
{
|
||||
$topic_views[$value] = '1';
|
||||
}
|
||||
}
|
||||
|
||||
if ($cstart){
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['topic_inpage'];
|
||||
}
|
||||
|
||||
$config_inpage = $forum_config['topic_inpage'];
|
||||
|
||||
if ($search_fid)
|
||||
{
|
||||
if (is_array($search_fid))
|
||||
{
|
||||
$hole_arr = array();
|
||||
foreach ($search_fid as $hole)
|
||||
{
|
||||
$hole_arr[] = intval($hole);
|
||||
}
|
||||
$fid_list = implode(',', $hole_arr);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$fid_list = intval($search_fid);
|
||||
}
|
||||
}
|
||||
|
||||
$fid_q = $fid_list ? "and forum_id IN ({$fid_list}) " : "";
|
||||
|
||||
if ($_REQUEST['search_in'] == "titles")
|
||||
{
|
||||
$mysql_query = "SELECT * FROM " . PREFIX . "_forum_topics
|
||||
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
|
||||
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
|
||||
|
||||
$count_query = "SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics
|
||||
WHERE title REGEXP ('$search_list') ".$fid_q."and hidden = 0
|
||||
OR topic_descr REGEXP ('$search_list') ".$fid_q."and hidden = 0";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$mysql_query = "SELECT p.*, t.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t ON t.tid = p.topic_id
|
||||
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
|
||||
|
||||
$count_query = "SELECT SQL_CALC_FOUND_ROWS * FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . PREFIX . "_forum_topics AS t
|
||||
ON t.tid = p.topic_id
|
||||
WHERE p.post_text REGEXP ('$search_list') ".$fid_q."and p.hidden = 0 GROUP BY t.tid";
|
||||
}
|
||||
|
||||
$result_topics = $db->query("" . $mysql_query . " LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
|
||||
|
||||
if (!$count_all)
|
||||
{
|
||||
if ($_REQUEST['search_in'] == "titles")
|
||||
{
|
||||
$count_get = $db->super_query ($count_query);
|
||||
|
||||
$count_all = $count_get['count'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$count_all = $db->num_rows($db->query($count_query));
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_all){
|
||||
|
||||
if ($forum_config['mod_rewrite'])
|
||||
{
|
||||
$icat = $forum_url . "/search/" . $count_all . "-" . urlencode($search_text) ."/";
|
||||
}
|
||||
else
|
||||
{
|
||||
$icat = $forum_url."act=search&count_all=".$count_all."&search_text=".urlencode($search_text)."&cstart=";
|
||||
}
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
|
||||
|
||||
$tpl->load_template($tpl_dir.'forum.tpl');
|
||||
|
||||
$tpl->set('{forum}', $f_lang['search_result']);
|
||||
|
||||
$tpl->set('{subforums}','');
|
||||
|
||||
$tpl->set('{topics}', $tpl->result['topics']);
|
||||
|
||||
$tpl->set('{info}', $msg_info);
|
||||
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
|
||||
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si", '');
|
||||
|
||||
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
forum_msg($f_lang['f_msg'], $f_lang['search_nresult']);
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($_REQUEST['search_text'] and $search_maxlen)
|
||||
{
|
||||
forum_msg($f_lang['f_msg'], $f_lang['search_error']);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$_SESSION['search_fid'] = "";
|
||||
|
||||
$tpl->load_template($tpl_dir.'search.tpl');
|
||||
|
||||
$tpl->copy_template = "<form method=\"post\" action=\"\">".$tpl->copy_template."</form>";
|
||||
|
||||
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id ORDER BY posi, position");
|
||||
|
||||
$select_list = "<select name='search_fid[]' size='10' multiple='multiple'>";
|
||||
|
||||
$select_list .= "<option value='0' selected='selected'>» Âñå ôîðóìû</option>";
|
||||
|
||||
for ($i = 0, $totalcount = 0; $row = $db->get_row($result); $i = $row['sid'], $chcount++)
|
||||
{
|
||||
if ($row['sid'] != $i)
|
||||
{
|
||||
$row['cat_name'] = stripslashes($row['cat_name']);
|
||||
|
||||
$select_list .= "<optgroup label=\"{$row['cat_name']}\">";
|
||||
}
|
||||
|
||||
if ($row['name'])
|
||||
{
|
||||
$row['name'] = stripslashes($row['name']);
|
||||
|
||||
$select_list .= "<option value=\"{$row['id']}\"> -- {$row['name']}</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$select_list .= "</select>";
|
||||
|
||||
$tpl->set('{forum_select}',$select_list);
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
$bbr_app = $f_lang['app_search'];
|
||||
|
||||
?>
|
||||
113
system/forum/sources/modules/stats.php
Normal file
113
system/forum/sources/modules/stats.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
$act = $_REQUEST['act'];
|
||||
|
||||
if ($forum_config['stats'] AND !$act)
|
||||
{
|
||||
$stats_array = array();
|
||||
|
||||
$today_date = date('d');;
|
||||
|
||||
$stats_array = $fcache->get('stats');
|
||||
|
||||
if (!$stats_array OR $stats_array['date'] != $today_date)
|
||||
{
|
||||
$stats_array = FALSE;
|
||||
|
||||
$stats_array = array();
|
||||
|
||||
$row_post = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts");
|
||||
|
||||
$stats_array['posts'] = $row_post['count'];
|
||||
|
||||
$row_topic = $db->super_query("SELECT COUNT(tid) as count FROM " . PREFIX . "_forum_topics");
|
||||
|
||||
$stats_array['topics'] = $row_topic['count'];
|
||||
|
||||
$row_users_reg = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users");
|
||||
|
||||
$stats_array['users_reg'] = $row_users_reg['count'];
|
||||
|
||||
$row_users = $db->super_query("SELECT COUNT(user_id) as count FROM " . PREFIX . "_users WHERE forum_post");
|
||||
|
||||
$stats_array['users'] = $row_users['count'];
|
||||
|
||||
$result_users = $db->query("SELECT * FROM " . PREFIX . "_users WHERE forum_post ORDER BY forum_post DESC LIMIT 10");
|
||||
|
||||
while ($row = $db->get_row($result_users))
|
||||
{
|
||||
$top_count++;
|
||||
|
||||
if ($top_count > 1)
|
||||
{
|
||||
$symbol = ", ";
|
||||
}
|
||||
|
||||
$group_span = $user_group[$row['user_group']]['colour'];
|
||||
|
||||
$a_top_users = "{$config['http_home_url']}user/".urlencode($row['name'])."/";
|
||||
|
||||
$stats_array['top_users'] .= $symbol."<a href=\"{$a_top_users}\"><span style=\"color:{$group_span}\">$row[name]</span></a>";
|
||||
}
|
||||
|
||||
if (!$stats_array['top_users'])
|
||||
{
|
||||
$stats_array['top_users'] = "--";
|
||||
}
|
||||
|
||||
$stats_array['date'] = $today_date;
|
||||
|
||||
$last_user_row = $db->super_query("SELECT * FROM " . PREFIX . "_users ORDER BY user_id DESC LIMIT 1");
|
||||
|
||||
$stats_array['last_user'] = link_user($last_user_row['name']);
|
||||
|
||||
$stats_array['max_online'] = $max_online['count'];
|
||||
$stats_array['max_online_time'] = langdate('j F Y, H:i', $max_online['time']);
|
||||
|
||||
$fcache->set('stats', $stats_array);
|
||||
}
|
||||
|
||||
// tpl compile //
|
||||
$tpl->load_template($tpl_dir.'stats.tpl');
|
||||
|
||||
if ($forum_config['online'] and $forum_config['sessions_log'])
|
||||
{
|
||||
get_forum_online();
|
||||
|
||||
$tpl->set('[online-stats]','');
|
||||
$tpl->set('[/online-stats]','');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[online-stats\\](.*?)\\[/online-stats\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->set('{post-num}', $stats_array['posts']);
|
||||
$tpl->set('{topic-num}', $stats_array['topics']);
|
||||
$tpl->set('{all-users}', $stats_array['users_reg']);
|
||||
$tpl->set('{forum-users}', $stats_array['users']);
|
||||
$tpl->set('{top-users}', $stats_array['top_users']);
|
||||
|
||||
$tpl->set('{online-num}', $forum_online['all_count']);
|
||||
$tpl->set('{member_count}', $forum_online['member_count']);
|
||||
$tpl->set('{guest_count}', $forum_online['guest_count']);
|
||||
$tpl->set('{online_time}', $forum_config['session_time']);
|
||||
|
||||
if (!$forum_online['member_list'])
|
||||
{
|
||||
$forum_online['member_list'] = ""; // default value: --
|
||||
}
|
||||
|
||||
$tpl->set('{member_online}', $forum_online['member_list']);
|
||||
|
||||
$tpl->set('{last_user}', $stats_array['last_user']);
|
||||
$tpl->set('{max_online}', $stats_array['max_online']);
|
||||
$tpl->set('{max_online_time}', $stats_array['max_online_time']);
|
||||
|
||||
$tpl->compile('forum_stats');
|
||||
$tpl->clear();
|
||||
}
|
||||
?>
|
||||
154
system/forum/sources/modules/subscription.php
Normal file
154
system/forum/sources/modules/subscription.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
$code = $_REQUEST['code'];
|
||||
|
||||
$tid = intval($_REQUEST['tid']);
|
||||
|
||||
$selected_id = $_REQUEST['selected_id'];
|
||||
|
||||
if ($is_logged)
|
||||
{
|
||||
switch ($code)
|
||||
{
|
||||
// ********************************************************************************
|
||||
// ADD
|
||||
// ********************************************************************************
|
||||
case "add":
|
||||
|
||||
$db->query("SELECT * FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$tid' and user_id = '{$member_id['user_id']}'");
|
||||
|
||||
if (!$db->num_rows() and $tid)
|
||||
{
|
||||
$db->query("INSERT INTO " . PREFIX . "_forum_subscription (user_id, topic_id) values ('{$member_id['user_id']}', '$tid')");
|
||||
}
|
||||
|
||||
header("Location: $_SERVER[HTTP_REFERER]");
|
||||
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// DEL
|
||||
// ********************************************************************************
|
||||
case "del":
|
||||
|
||||
if ($selected_id)
|
||||
{
|
||||
$selected_id = explode(",", $selected_id);
|
||||
|
||||
foreach ($selected_id as $topic_id)
|
||||
{
|
||||
$db->query("DELETE FROM " . PREFIX . "_forum_subscription WHERE topic_id = '$topic_id' and user_id = '{$member_id['user_id']}'");
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: $_SERVER[HTTP_REFERER]");
|
||||
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// SUBSCRIPTION
|
||||
// ********************************************************************************
|
||||
default:
|
||||
|
||||
if ($cstart)
|
||||
{
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['topic_inpage'];
|
||||
}
|
||||
|
||||
if ($forum_config['topic_sort'])
|
||||
{
|
||||
$sort_type = "last_date";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$sort_type = "tid";
|
||||
}
|
||||
|
||||
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = '$member_id[user_id]'");
|
||||
|
||||
$topic_views = array();
|
||||
|
||||
while ($row = $db->get_row($row_views))
|
||||
{
|
||||
$topic_views[$row['topic_id']] = '1';
|
||||
}
|
||||
|
||||
$config_inpage = $forum_config['topic_inpage'];
|
||||
|
||||
$result_count = $db->super_query("SELECT count(*) as count FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
|
||||
|
||||
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_subscription LEFT JOIN " . PREFIX . "_forum_topics ON " . PREFIX . "_forum_subscription.topic_id = " . PREFIX . "_forum_topics.tid WHERE " . PREFIX . "_forum_subscription.user_id = '{$member_id['user_id']}'");
|
||||
|
||||
$mass_prune = true;
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
|
||||
|
||||
if (!$is_topics)
|
||||
{
|
||||
$msg_info = $f_lang['subscr_not'];
|
||||
}
|
||||
|
||||
$tpl->load_template($tpl_dir.'forum.tpl');
|
||||
|
||||
$tpl->set('{banner}', '');
|
||||
|
||||
$tpl->set('{forum}', $f_lang['app_subscr']);
|
||||
|
||||
$tpl->set('{subforums}','');
|
||||
|
||||
$tpl->set('{topics}', $tpl->result['topics']);
|
||||
|
||||
$tpl->set('{info}', $msg_info);
|
||||
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
|
||||
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si","");
|
||||
|
||||
$tpl->set('[selected]',"");
|
||||
$tpl->set('[/selected]',"");
|
||||
|
||||
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
|
||||
|
||||
$tpl->set_block("'\\[fast-search\\](.*?)\\[/fast-search\\]'si","");
|
||||
|
||||
$tpl->set('[moderation]',"<form name=\"modform\" method=\"post\" action=\"\">"); //{$a_forum_url}act=subscription
|
||||
$moderation = "<select name=\"code\">";
|
||||
|
||||
$moderation .= "<option value=\"del\">Îòïèñàòüñÿ</option>";
|
||||
|
||||
$moderation .= "</select>";
|
||||
|
||||
$tpl->set('{moderation}', $moderation);
|
||||
|
||||
$tpl->set('[/moderation]',"<input type=\"hidden\" value=\"\" name=\"selected_id\" /></form>");
|
||||
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$group_name = $user_group[$member_id['user_group']]['group_name'];
|
||||
|
||||
forum_msg($f_lang['f_msg'], $f_lang['page_deny'], 'user_group', $group_name);
|
||||
}
|
||||
|
||||
if ($forum_config['forum_bar'])
|
||||
{
|
||||
$bbr_app = $f_lang['app_subscr'];
|
||||
}
|
||||
?>
|
||||
375
system/forum/sources/modules/uploads.php
Normal file
375
system/forum/sources/modules/uploads.php
Normal file
@@ -0,0 +1,375 @@
|
||||
<?php
|
||||
@session_start();
|
||||
|
||||
error_reporting(7);
|
||||
|
||||
ini_set('display_errors', true);
|
||||
ini_set('html_errors', false);
|
||||
|
||||
define('DATALIFEENGINE', true);
|
||||
define('ROOT_DIR', '../../../..');
|
||||
define('SYSTEM_DIR', ROOT_DIR.'/system');
|
||||
|
||||
define('UPLOAD_DIR', ROOT_DIR."/uploads/forum/");
|
||||
|
||||
require SYSTEM_DIR."/data/config.php";
|
||||
require_once SYSTEM_DIR.'/classes/mysql.php';
|
||||
require_once SYSTEM_DIR."/data/dbconfig.php";
|
||||
require_once SYSTEM_DIR."/modules/functions.php";
|
||||
|
||||
require_once SYSTEM_DIR.'/data/forum_config.php';
|
||||
|
||||
$allowed_video = array("avi", "mp4", "wmv", "mpg", "flv");
|
||||
|
||||
// ********************************************************************************
|
||||
// File Type
|
||||
// ********************************************************************************
|
||||
function file_type($name){
|
||||
$type = explode ('.', $name);
|
||||
$type = end ($type);
|
||||
return ($type);
|
||||
}
|
||||
|
||||
check_xss ();
|
||||
|
||||
$area = $_REQUEST['area'];
|
||||
|
||||
$do = $_REQUEST['do'];
|
||||
|
||||
$fid = intval($_REQUEST['fid']);
|
||||
|
||||
$tid = intval($_REQUEST['tid']);
|
||||
|
||||
$pid = intval($_REQUEST['pid']);
|
||||
|
||||
$del = $_REQUEST['del'];
|
||||
|
||||
$user_group = $cache->get ("usergroup");
|
||||
|
||||
if (!$user_group) {
|
||||
$user_group = array ();
|
||||
|
||||
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
|
||||
|
||||
while($row = $db->get_row()){
|
||||
|
||||
$user_group[$row['id']] = array ();
|
||||
|
||||
foreach ($row as $key => $value)
|
||||
{
|
||||
$user_group[$row['id']][$key] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
$cache->set ("usergroup", $user_group);
|
||||
$db->free();
|
||||
}
|
||||
|
||||
include_once SYSTEM_DIR.'/modules/sitelogin.php';
|
||||
$result = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = '$fid'");
|
||||
$access_upload = $result['access_upload'];
|
||||
$access_upload = explode(":", $access_upload);
|
||||
if (!in_array($member_id['user_group'], $access_upload)){die("Hacking attempt!");}
|
||||
$access_mod = $result['access_mod'];
|
||||
$access_mod = explode(":", $access_mod);
|
||||
|
||||
if (!in_array($member_id['user_group'], $access_mod))
|
||||
{
|
||||
$db_file_author = " AND file_author = '{$member_id['name']}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$db_file_author = "";
|
||||
}
|
||||
|
||||
$forum_config['tools_upload'] = explode (':', $forum_config['tools_upload']);
|
||||
|
||||
if ($forum_config['tools_upload'])
|
||||
{
|
||||
if (in_array($member_id['user_group'], $forum_config['tools_upload']))
|
||||
{
|
||||
$upload_file_access = TRUE;
|
||||
} else
|
||||
{
|
||||
$upload_file_access = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// TPL //
|
||||
echo <<<HTML
|
||||
<html>
|
||||
<head>
|
||||
<title>Uploads</title>
|
||||
</head>
|
||||
<style type="text/css" media="all">
|
||||
.dle_forum {
|
||||
background-color: #FFF;
|
||||
font-family: verdana;
|
||||
font-size: 11px;
|
||||
color: #222;
|
||||
}
|
||||
.dle_forum a:link, .dle_forum a:active, .dle_forum a:visited {
|
||||
color: #222;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.dle_forum a:hover {
|
||||
color: #34498B;
|
||||
}
|
||||
.button {
|
||||
background-color: #fff;
|
||||
border: 1px solid #B4B4B4;
|
||||
color: #000;
|
||||
font-family: verdana;
|
||||
font-size: 11px;
|
||||
padding: 1px;
|
||||
}
|
||||
.forum_input {
|
||||
background-color: #fff;
|
||||
border: 1px solid #B4B4B4;
|
||||
color: #000;
|
||||
font-family: verdana;
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
<body class="dle_forum">
|
||||
HTML;
|
||||
|
||||
echo <<<HTML
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function insertfile(selected_id)
|
||||
{
|
||||
attachment = "[attachment=" + selected_id + "]";
|
||||
parent.doInsert(attachment, '', false); window.focus();
|
||||
};
|
||||
|
||||
function insertaudio(onserver)
|
||||
{
|
||||
audio = "[audio=" + onserver + "]";
|
||||
parent.doInsert(audio, '', false); window.focus();
|
||||
};
|
||||
|
||||
function insertvideo(onserver)
|
||||
{
|
||||
video = "[video=" + onserver + "]";
|
||||
parent.doInsert(video, '', false); window.focus();
|
||||
};
|
||||
|
||||
</script>
|
||||
HTML;
|
||||
|
||||
$DIR = 0;
|
||||
$is_file = 0;
|
||||
$is_image = 0;
|
||||
|
||||
$send_link = "?area=$area&fid=$fid&tid=$tid&pid=$pid";
|
||||
$maxupload = mksize($forum_config['img_size']*1024);
|
||||
|
||||
if ($do == "add")
|
||||
{
|
||||
$allowed_images = array("gif", "jpg", "png", "jpe", "jpeg");
|
||||
$allowed_files = explode(',', $forum_config['upload_type']);
|
||||
|
||||
$file_name = totranslit($_FILES['attachment']['name']);
|
||||
|
||||
$file_explode = explode(".",$file_name);
|
||||
$file_type = strtolower(end($file_explode));
|
||||
$attachment_size = $_FILES['attachment']['size'];
|
||||
|
||||
if (in_array($file_type, $allowed_images) AND $forum_config['img_upload']){
|
||||
if ($attachment_size < ($forum_config['img_size']*1024)){
|
||||
$is_image = TRUE;
|
||||
$DIR = "images/";
|
||||
}else{
|
||||
$image_size_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($file_type, $allowed_files) AND $upload_file_access){
|
||||
$is_file = TRUE;
|
||||
$DIR = "files/";
|
||||
}
|
||||
|
||||
if ($is_file OR $is_image){
|
||||
$uploadfile = UPLOAD_DIR.$DIR.basename($file_name);
|
||||
|
||||
if (move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile)){
|
||||
$file_name = totranslit($_FILES['attachment']['name']);
|
||||
$file_size = $_FILES['attachment']['size'];
|
||||
}
|
||||
|
||||
if (file_exists(UPLOAD_DIR . $DIR . $file_name)){
|
||||
|
||||
if ($is_file){
|
||||
$ftype = 'file';
|
||||
$file_rename = time()."_".totranslit($file_name);
|
||||
}else{
|
||||
$ftype = 'image';
|
||||
$file_rename = time().".".$file_type;
|
||||
}
|
||||
|
||||
rename(UPLOAD_DIR . $DIR . $file_name, UPLOAD_DIR . $DIR . $file_rename);
|
||||
|
||||
if ($is_image)
|
||||
{
|
||||
include_once SYSTEM_DIR.'/classes/thumb.class.php';
|
||||
|
||||
$thumb = new thumbnail(UPLOAD_DIR.$DIR.$file_rename);
|
||||
|
||||
if ($thumb->size_auto($forum_config['thumb_size']))
|
||||
{
|
||||
$thumb->jpeg_quality($forum_config['jpeg_quality']);
|
||||
|
||||
$thumb->save(UPLOAD_DIR."thumbs/".$file_rename);
|
||||
|
||||
$ftype = 'thumb';
|
||||
|
||||
@chmod (UPLOAD_DIR."thumbs/".$file_rename, 0666);
|
||||
}
|
||||
}
|
||||
|
||||
$db->query("INSERT INTO " . PREFIX . "_forum_files (file_type, forum_id, topic_id, post_id, file_name, onserver, file_author, file_date, file_size) values ('$ftype', '$fid', '$tid', '$pid', '$file_name', '$file_rename', '$member_id[name]' , '".time()."', '$file_size')");
|
||||
|
||||
@chmod (UPLOAD_DIR.$DIR.$file_rename, 0666);
|
||||
|
||||
$upload_info = "<font color=\"green\">Ôàéë <b>$file_name</b> çàãðóæåí.</font>";
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$upload_info = "<font color=\"red\">Íåâîçìîæíî çàãðóçèòü ôàéë íà ñåðâåð!</font>";
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ($image_size_error)
|
||||
{
|
||||
$upload_info = "<font color=\"red\">Ñëèøêîì áîëüøîå èçîáðàæåíèå!</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_info = "<font color=\"red\">Íå äîïóñòèìûé ôîðìàò ôàéëà!</font>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($do == "del" and $del)
|
||||
{
|
||||
foreach ($del as $file_id)
|
||||
{
|
||||
$file_id = intval($file_id);
|
||||
if ($file_id) $del_id[$file_id] = $file_id;
|
||||
}
|
||||
|
||||
$del_list = implode(',', $del_id);
|
||||
|
||||
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE file_id IN ({$del_list})".$db_file_author);
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
if ($row['file_type'] == "file")
|
||||
{
|
||||
unlink(UPLOAD_DIR."files/".$row['onserver']);
|
||||
}
|
||||
|
||||
elseif ($row['file_type'] == "thumb")
|
||||
{
|
||||
unlink(UPLOAD_DIR."thumbs/".$row['onserver']);
|
||||
|
||||
unlink(UPLOAD_DIR."images/".$row['onserver']);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
unlink(UPLOAD_DIR."images/".$row['onserver']);
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE file_id = '$row[file_id]' LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
echo "<fieldset>";
|
||||
|
||||
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=add\"><br />";
|
||||
|
||||
echo "<input class=\"forum_input\" name=\"attachment\" type=\"file\" style=\"width:200px\" />";
|
||||
|
||||
echo " ";
|
||||
|
||||
echo "<input class=\"button\" value=\"Çàãðóçèòü\" type=\"submit\" style=\"background-color:#53E490;\" />";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
if (!$upload_info) $upload_info = "Ìàêñèìàëüíûé ðàçìåð äëÿ îäíîãî ôàéëà: <b>$maxupload</b>";
|
||||
|
||||
echo "<p>$upload_info</p>";
|
||||
|
||||
echo "</fieldset><br />";
|
||||
|
||||
echo "<fieldset><legend><strong>Çàãðóæåííûå ôàéëû</strong></legend>";
|
||||
|
||||
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"$send_link&do=del\">";
|
||||
|
||||
echo "<table class=\"dle_forum\" width=\"100%\">";
|
||||
|
||||
$db->query("SELECT * FROM " . PREFIX . "_forum_files
|
||||
WHERE topic_id = '$tid' AND file_attach = '0'".$db_file_author." OR post_id = '$pid'".$db_file_author);
|
||||
|
||||
while ($row = $db->get_row())
|
||||
{
|
||||
$file_title = mksize($row['file_size'])." (Çàãðóçèë: {$row['file_author']})";
|
||||
|
||||
$on_server = $config['http_home_url'].'uploads/forum/files/'.$row['onserver'];
|
||||
|
||||
$type = file_type($row['onserver']);
|
||||
|
||||
if ($type == 'mp3')
|
||||
{
|
||||
$insert_ob = " <a OnClick=\"insertaudio('".$on_server."')\" href=\"#\">[audio]</a>";
|
||||
}
|
||||
elseif(in_array($type, $allowed_video))
|
||||
{
|
||||
$insert_ob = " <a OnClick=\"insertvideo('".$on_server."')\" href=\"#\">[video]</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$insert_ob = "";
|
||||
}
|
||||
|
||||
echo "<tr>
|
||||
<td width=\"85%\"><a title=\"$file_title\" OnClick=\"insertfile('".$row['file_id']."')\" href=\"#\">$row[file_name]</a>{$insert_ob}</td>
|
||||
<td width=\"10%\"> </td>
|
||||
<td width=\"5%\"><input type=checkbox name=\"del[".$row['file_id']."]\" value=\"".$row['file_id']."\"></td>
|
||||
</tr>";
|
||||
|
||||
$row_count++;
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
if ($row_count){
|
||||
|
||||
echo "<hr /><div align=\"right\"><input class=\"button\" value=\"Óäàëèòü\" type=\"submit\" style=\"background-color:#FF9999;\" /></div>";
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo "<br />Íè îäíîãî ôàéëà íå çàãðóæåíî.";
|
||||
}
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "</fieldset>";
|
||||
|
||||
echo <<<HTML
|
||||
</body>
|
||||
|
||||
</html>
|
||||
HTML;
|
||||
|
||||
?>
|
||||
154
system/forum/sources/shapeshifter/forum_posts.php
Normal file
154
system/forum/sources/shapeshifter/forum_posts.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
$username = $db->safesql( htmlspecialchars( urldecode( $_REQUEST['name'] ) ) );
|
||||
if ($username)
|
||||
{
|
||||
$cstart = intval($_REQUEST['cstart']);
|
||||
if ($cstart < 0)
|
||||
$cstart = 0;
|
||||
|
||||
if ($cstart){
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['post_inpage'];
|
||||
}
|
||||
|
||||
$i = $cstart;
|
||||
|
||||
$config_inpage = $forum_config['post_inpage'];
|
||||
|
||||
switch ($_REQUEST['code'])
|
||||
{
|
||||
case "search":
|
||||
$search_text = strip_data($_REQUEST['search_text']);
|
||||
if ($search_text)
|
||||
{
|
||||
$_SESSION['search_text_'.$tid] = $search_text;
|
||||
}
|
||||
$search_text = $_SESSION['search_text_'.$tid];
|
||||
if ($search_text)
|
||||
{
|
||||
$search_page = 0;
|
||||
if (intval($_REQUEST['search_page']) == "1")
|
||||
$cstart = 0;
|
||||
|
||||
$search_text_topic = true;
|
||||
$access_forum = "(ff.access_read LIKE '%:".$member_id['user_group']."' OR ff.access_read LIKE '%:".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group']."')";
|
||||
$result_posts = $db->query("SELECT SQL_CALC_FOUND_ROWS forum_posts.*, ff.*, ff.id AS ffid, ff.name AS f_name, ".PREFIX."_forum_topics.*, users.* FROM `".PREFIX."_forum_posts` AS `forum_posts`, `".USERPREFIX."_users` AS `users`, `".PREFIX."_forum_forums` AS `ff`, `".PREFIX."_forum_topics` WHERE users.name = forum_posts.post_author AND forum_posts.post_author = '".$username."' AND tid = topic_id AND forum_posts.hidden = '0' AND (".$access_forum." AND ff.id = forum_id) ".$where." {$where_sort} ORDER BY post_date DESC LIMIT ".$cstart.",".$forum_config['post_inpage']."");
|
||||
$sql_count = "SELECT FOUND_ROWS() as count";
|
||||
$row = $db->super_query($sql_count);
|
||||
$count_all = $row['count'] + 1;
|
||||
|
||||
$a_href_reply = $config['http_home_url']."user/".$username."/posts/";
|
||||
|
||||
$icat = $config['http_home_url']."?do=forum&act=user_posts&name=".$username."&code=search&cstart=";
|
||||
$icat_prov = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$access_forum = "(ff.access_read LIKE '%:".$member_id['user_group']."' OR ff.access_read LIKE '%:".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group']."')";
|
||||
$result_posts = $db->query("SELECT SQL_CALC_FOUND_ROWS forum_posts.*, ff.*, ff.id AS ffid, ff.name AS f_name, ".PREFIX."_forum_topics.*, users.* FROM `".PREFIX."_forum_posts` AS `forum_posts`, `".USERPREFIX."_users` AS `users`, `".PREFIX."_forum_forums` AS `ff`, `".PREFIX."_forum_topics` WHERE users.name = forum_posts.post_author AND forum_posts.post_author = '".$username."' AND tid = topic_id AND forum_posts.hidden = '0' AND (".$access_forum." AND ff.id = forum_id) ".$where." ORDER BY post_date DESC LIMIT ".$cstart.",".$forum_config['post_inpage']."");
|
||||
$sql_count = "SELECT FOUND_ROWS() as count";
|
||||
$row = $db->super_query($sql_count);
|
||||
$count_all = $row['count'] + 1;
|
||||
$search_page = 1;
|
||||
$search_text_topic = false;
|
||||
|
||||
$icat = $config['http_home_url']."user/".$username."/posts/page";
|
||||
$a_href_reply = $config['http_home_url']."user".$username."/";
|
||||
|
||||
$icat_prov = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($count_all)
|
||||
{
|
||||
require_once SYSTEM_DIR.'/forum/sources/shapeshifter/showallposts.php';
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
|
||||
}
|
||||
|
||||
if ($post_num_id)
|
||||
{
|
||||
$tpl->load_template($tpl_dir.'topic.tpl');
|
||||
|
||||
$tpl->set('{banner}', stripslashes($forums_array[$forum_id]['banner']));
|
||||
|
||||
$tpl->set('{addpost}', "");
|
||||
$tpl->set('{title}', "Ïîñëåäíèå ïîñòû ïîëüçîâàòåëÿ: ".$username."");
|
||||
$tpl->set('{title_descr}', "Âñåãî íàéäåíî ".$count_all." ïîñòîâ");
|
||||
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
$tpl->set_block("'\\[options\\](.*?)\\[/options\\]'si","");
|
||||
|
||||
$tpl->set('{topic_subscription}', "");
|
||||
$tpl->set('{say_friend}', "");
|
||||
$tpl->set('{topic_pechat}', "");
|
||||
|
||||
$tpl->set_block("'\\[new_topic\\](.*?)\\[/new_topic\\]'si","");
|
||||
$tpl->set_block("'\\[poll\\](.*?)\\[/poll\\]'si","");
|
||||
$tpl->set_block("'\\[reply\\](.*?)\\[/reply\\]'si","");
|
||||
$tpl->set('{s_reply}', "");
|
||||
|
||||
if ($search_text_topic)
|
||||
{
|
||||
$tpl->set('{search_link}', $config['http_home_url']."user/".$username."/posts/");
|
||||
$tpl->set('{search_num}', $count_all);
|
||||
$tpl->set('[search_link]','');
|
||||
$tpl->set('[/search_link]','');
|
||||
}
|
||||
else
|
||||
$tpl->set_block("'\\[search_link\\](.*?)\\[/search_link\\]'si","");
|
||||
|
||||
if ($forum_config['ses_topic'] and $forum_config['sessions_log'])
|
||||
{
|
||||
forum_sessions($forum_id, $tid);
|
||||
get_forum_online('act_topic', $tid);
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","\\1");
|
||||
$tpl->set('{all_count}', $forum_online['all_count']);
|
||||
$tpl->set('{guest_count}', $forum_online['guest_count']);
|
||||
$tpl->set('{member_count}', $forum_online['member_count']);
|
||||
$tpl->set('{member_list}', $forum_online['member_list']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->set('{forum_name}', link_forum($forum_id, $forum_name));
|
||||
$tpl->set_block("'\\[old-topic\\](.*?)\\[/old-topic\\]'si","");
|
||||
$tpl->set_block("'\\[new-topic\\](.*?)\\[/new-topic\\]'si","");
|
||||
|
||||
$tpl->set('[fast-search]',"<form action=\"\" method=\"post\">");
|
||||
$tpl->set('[/fast-search]',"<input type=\"hidden\" name=\"code\" value=\"search\" /><input type=\"hidden\" name=\"search_page\" value=\"".$search_page."\" /></form>");
|
||||
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
|
||||
|
||||
$tpl->set('{posts}', $tpl->result['posts']);
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
$tpl->clear();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
forum_msg($f_lang['search_result'], $f_lang['search_topic']);
|
||||
}
|
||||
}
|
||||
else
|
||||
forum_msg($f_lang['search_result'], "Âû íå âûáðàëè ïîëüçîâàòåëÿ.");
|
||||
|
||||
$metatags['title'] = 'Âñå ïîñòû ïîëüçîâàòåëÿ » '.$forum_config['forum_title'];
|
||||
|
||||
if ($forum_config['forum_bar'])
|
||||
{
|
||||
$bbr_cid = $c_id;
|
||||
$bbr_top = " » Âñå ïîñòû ïîëüçîâàòåëÿ";
|
||||
}
|
||||
|
||||
?>
|
||||
112
system/forum/sources/shapeshifter/forum_rss.php
Normal file
112
system/forum/sources/shapeshifter/forum_rss.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?PHP
|
||||
|
||||
define( 'DATALIFEENGINE', true );
|
||||
define( 'ROOT_DIR', '../../../..' );
|
||||
define( 'SYSTEM_DIR', '../../..' );
|
||||
@error_reporting( E_ALL ^ E_NOTICE );
|
||||
@ini_set( 'display_errors', true );
|
||||
@ini_set( 'html_errors', false );
|
||||
@ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
|
||||
|
||||
if (! defined ( 'DATALIFEENGINE' ))
|
||||
die ( "Hacking attempt!" );
|
||||
|
||||
$forum_id = intval ( $_REQUEST ['fid']);
|
||||
|
||||
if ($forum_id != "" AND $forum_id != 0) {
|
||||
|
||||
include SYSTEM_DIR . '/data/config.php';
|
||||
require_once SYSTEM_DIR . '/classes/mysql.php';
|
||||
include_once SYSTEM_DIR . '/data/dbconfig.php';
|
||||
include_once SYSTEM_DIR . '/modules/functions.php';
|
||||
//require_once ENGINE_DIR . '/classes/templates.class.php';
|
||||
include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
|
||||
|
||||
require_once SYSTEM_DIR . '/modules/sitelogin.php';
|
||||
if( ! $is_logged )
|
||||
{
|
||||
$member_id['user_group'] = 5;
|
||||
}
|
||||
|
||||
$opisanie = "Ôîðóì Files-Sib.NET"; // êîðîòêîå îïèñàíèå ñàéòà
|
||||
$adres_1 = "Files-Sib.NET"; // èìÿ äîìåíà
|
||||
$adres_2 = "http://files-sib.net/"; // àäðåñ âàøåãî ñàéòà
|
||||
$nazvanir_f = "Ôîðóì Files-Sib.NET"; // íàçâàíèå âàøåãî ôîðóìà
|
||||
$url_logo = "http://files-sib.net/templates/default/images/logo.png"; // ññûëêà íà ëîãî âàøåãî ñàéòà
|
||||
$f_info = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums where id = '$forum_id'");
|
||||
if ($f_info['id'] == $forum_id AND $f_info['id'] != "") // ïðîâåðêà íà ID íàéäåííîãî ôîðóìà
|
||||
{
|
||||
check_xss();
|
||||
$title = htmlspecialchars ( strip_tags ( stripslashes ( $f_info['name'] ) ) );
|
||||
$site = $config['http_home_url'];//3
|
||||
$rss_content = <<<XML
|
||||
<?xml version="1.0" encoding="{$config['charset']}"?>
|
||||
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title>{$nazvanir_f} » {$title}</title>
|
||||
<link>{$site}</link>
|
||||
<language>ru</language>
|
||||
<description>{$config['description']}</description>
|
||||
<copyright>{$opisanie}</copyright>
|
||||
<generator>{$adres_1}</generator>
|
||||
<image>
|
||||
<title>{$opisanie}</title>
|
||||
<url>{$url_logo}</url>
|
||||
<link>{$adres_2}</link>
|
||||
</image>
|
||||
|
||||
XML;
|
||||
|
||||
$access_forum = "(ff.access_read LIKE '%:".$member_id['user_group']."' OR ff.access_read LIKE '%:".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group'].":%' OR ff.access_read LIKE '".$member_id['user_group']."')";
|
||||
$sql_result = $db->query("SELECT * FROM `".PREFIX."_forum_posts` AS `forum_posts`, `".PREFIX."_forum_forums` AS `ff`, `".PREFIX."_forum_topics` WHERE tid = forum_posts.topic_id AND ff.id = '$f_info[id]' AND forum_posts.hidden = '0' AND (".$access_forum." AND ff.id = ".PREFIX."_forum_topics.forum_id) AND ".PREFIX."_forum_topics.hidden = '0' ORDER BY forum_posts.post_date DESC LIMIT 0,30");
|
||||
while($row = $db->get_row($sql_result))
|
||||
{
|
||||
$t_title = htmlspecialchars ( strip_tags ( stripslashes ( $row['title'] ) ) );
|
||||
|
||||
$rss_content .= <<<XML
|
||||
<item>
|
||||
<title>{$t_title}</title>
|
||||
|
||||
XML;
|
||||
$url = $config['http_home_url']."forum/topic_".$row['tid'];
|
||||
$rss_content .= "<link>{$url}</link>\n";
|
||||
$row['post_text'] = preg_replace ( "'\\[hide\\](.*?)\\[/hide\\]'ies", "", $row['post_text'] );
|
||||
$author = "<a {$go_page} href=\"".$config['http_home_url']."user/".urlencode($row['post_author'])."/\">".$row['post_author']."</a>";
|
||||
|
||||
$rss_content2 = <<<HTML
|
||||
{$row['post_text']}<br>
|
||||
<b>Îïóáëèêîâàë:</b> {$author}<hr>
|
||||
HTML;
|
||||
|
||||
$rss_content3 = stripslashes(str_replace("<br />", "<br>", $rss_content2));
|
||||
|
||||
$rss_content .= <<<XML
|
||||
<description>
|
||||
<![CDATA[ {$rss_content3} ]]>
|
||||
</description>
|
||||
<category>undefined</category>
|
||||
<dc:creator>{$row['post_author']}</dc:creator>
|
||||
<pubDate>{$row['post_date']}</pubDate>
|
||||
</item>
|
||||
|
||||
XML;
|
||||
|
||||
}
|
||||
|
||||
$rss_content .= <<<XML
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
XML;
|
||||
header ( 'Content-type: application/xml' );
|
||||
echo $rss_content;
|
||||
|
||||
}
|
||||
else
|
||||
header( "Location: {$config['http_home_url']}" );
|
||||
}
|
||||
else
|
||||
header( "Location: {$config['http_home_url']}" );
|
||||
|
||||
exit ();
|
||||
?>
|
||||
259
system/forum/sources/shapeshifter/showallposts.php
Normal file
259
system/forum/sources/shapeshifter/showallposts.php
Normal file
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
if ($cstart) $post_num_id = $cstart;
|
||||
|
||||
while ($row = $db->get_row($result_posts))
|
||||
{
|
||||
|
||||
$forum_id = $row['forum_id'];
|
||||
$tid = $row['tid'];
|
||||
|
||||
$check_read = check_access($forums_array[$forum_id]['access_read']);
|
||||
$check_moderator = check_moderator($forums_array[$forum_id]['access_mod'], $forums_array[$forum_id]['moderators']);
|
||||
$check_write = check_access($forums_array[$forum_id]['access_write']);
|
||||
|
||||
if ($check_moderator){
|
||||
$deny_edit_post = moderator_value('edit_post', $forum_id, $m_member);
|
||||
$deny_del_post = moderator_value('delete_post', $forum_id, $m_member);
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_post_edit']){
|
||||
$group_post_edit = true;
|
||||
}else{
|
||||
$group_post_edit = false;
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_post_del']){
|
||||
$group_post_del = true;
|
||||
}else{
|
||||
$group_post_del = false;
|
||||
}
|
||||
|
||||
$post_num_id++;
|
||||
$i++;
|
||||
|
||||
if($is_logged) {
|
||||
$tpl->set( '[not-logged]', "" );
|
||||
$tpl->set( '[/not-logged]', "" );
|
||||
} else $tpl->set_block( "'\\[not-logged\\](.*?)\\[/not-logged\\]'si", "" );
|
||||
|
||||
if (!$row['user_group']) $row['user_group'] = 5;
|
||||
|
||||
if ($ajax_adds) $post_num_id = "--";
|
||||
|
||||
$row['post_text'] = stripslashes( $row['post_text'] );
|
||||
|
||||
if ($row['hidden']){
|
||||
if ($check_moderator){
|
||||
$row['post_text'] = "<div class=\"hidden_post\">{$f_lang['h_post']}:<br />".$row['post_text']."</div>";
|
||||
}else{
|
||||
$row['post_text'] = "<div class=\"hidden_post\">{$f_lang['h_post']}</div>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_text){$row['post_text'] = hilites($search_text, $row['post_text']);}
|
||||
|
||||
// ********************************************************************************
|
||||
// LOAD TEMPLATE
|
||||
// ********************************************************************************
|
||||
|
||||
$tpl->load_template($tpl_dir.'post.tpl');
|
||||
|
||||
if( strlen( $row['title'] ) > 15 ) $title = substr( $row['title'], 0, 15 ) . " ...";
|
||||
else $title = $row['title'];
|
||||
|
||||
$tpl->set( '{topic_url}', " Òåìà: <a href=\"".$config['http_home_url']."forum/topic_".$row['tid']."/last#reply\">".$row['title']."</a>, ");
|
||||
|
||||
$tpl->set('{post_id}', "<a href=\"javascript:PostLink($post_num_id);\" name=\"post-{$post_num_id}\">{$post_num_id}</a>");
|
||||
|
||||
if ($row['edit_time']) $tpl->set('{edit-info}', "<br /><span class='edit-info'>{$f_lang['edit_info']} <b>{$row['edit_user']}</b> - ".show_date($row['edit_time'])."</span>");
|
||||
else $tpl->set('{edit-info}', "");
|
||||
|
||||
$go_page = "onClick=\"return dropdownmenu(this, event, FUserMenu('".urlencode($row['name'])."', '".$row['user_id']."', '".$member_id['user_group']."', '$a_forum_url'), '170px')\" onMouseout=\"delayhidemenu()\"";
|
||||
|
||||
$group_span = $user_group[$row['user_group']]['colour'];
|
||||
|
||||
if ($row['is_register'])
|
||||
{
|
||||
if ($config['skin'] == "Lite" OR $config['skin'] == "Wap")
|
||||
$tpl->set('{author}', "<a href=\"".$config['http_home_url']."user/".urlencode($row['name'])."/\"><span style=\"color:{$group_span}\">{$row['post_author']}</span></a>");
|
||||
else
|
||||
$tpl->set('{author}', "<a {$go_page} href=\"#\"><span style=\"color:{$group_span}\">{$row['post_author']}</span></a>");
|
||||
}
|
||||
else $tpl->set('{author}', "<a href=\"mailto:".$row['e_mail']."\">{$row['post_author']}</a>");
|
||||
|
||||
$grav_url = 'http://gravatar.com/avatar/' . md5( stripslashes( $row['email'] ) ) . "?s=100&r=g&d=" . $config['http_home_url'] . 'templates/' . $config['skin'] . '/images/noavatar.png';
|
||||
if ($row['foto'])
|
||||
$tpl->set('{foto}', $config['http_home_url']."uploads/fotos/".$row['foto']);
|
||||
else
|
||||
$tpl->set('{foto}', $grav_url);
|
||||
|
||||
if ($row['icq']) $tpl->set('{icq}', stripslashes($row['icq']));
|
||||
else $tpl->set('{icq}', '--');
|
||||
|
||||
if ($row['land']) $tpl->set('{land}', stripslashes($row['land']));
|
||||
else $tpl->set('{land}', '--');
|
||||
|
||||
if ($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 ($user_group[$row['user_group']]['colour']){
|
||||
$group_span = $user_group[$row['user_group']]['colour'];
|
||||
$group_name = "<span style=\"color:{$group_span}\">".$user_group[$row['user_group']]['group_name']."</span>";
|
||||
}else{
|
||||
$group_name = $user_group[$row['user_group']]['group_name'];
|
||||
}
|
||||
|
||||
if ($row['banned'])
|
||||
{
|
||||
$group_name = "BANNED";
|
||||
}
|
||||
|
||||
$tpl->set('{group-name}', $group_name);
|
||||
|
||||
$tpl->set('{post-num}', intval($row['forum_post']));
|
||||
$tpl->set('{news-num}', intval($row['news_num']));
|
||||
$tpl->set('{comm-num}', intval($row['comm_num']));
|
||||
|
||||
|
||||
// ********************************************************************************
|
||||
// POST SELECTED
|
||||
// ********************************************************************************
|
||||
$tpl->set('{selected}', "");
|
||||
|
||||
// ********************************************************************************
|
||||
// POST DATE
|
||||
// ********************************************************************************
|
||||
$row['post_date'] = strtotime($row['post_date']);
|
||||
|
||||
$tpl->set('{post-date}', show_date($row['post_date']));
|
||||
|
||||
if (!$forum_config['mod_report'] and $is_logged)
|
||||
{
|
||||
$tpl->set('[report]',"<a href=\"{$a_forum_url}act=_topic&code=report&tid={$tid}&pid={$post_num_id}\">");
|
||||
$tpl->set('[/report]',"</a>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[report\\](.*?)\\[/report\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FAST
|
||||
// ********************************************************************************
|
||||
|
||||
$tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si","");
|
||||
|
||||
// ********************************************************************************
|
||||
// RANK
|
||||
// ********************************************************************************
|
||||
if ($forum_config['mod_rank'] and $rank_array != 'empty')
|
||||
{
|
||||
if (!$row['forum_post']) $row['forum_post'] = 0;
|
||||
|
||||
foreach ($rank_array as $value)
|
||||
{
|
||||
if ($row['forum_post'] >= $value['posts'])
|
||||
{
|
||||
$rank_title = $value['title'];
|
||||
|
||||
$rank_num = $value['pips'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['forum_rank']) $rank_title = $row['forum_rank'];
|
||||
|
||||
if ($row['forum_pips']) $rank_num = $row['forum_pips'];
|
||||
|
||||
$rating = $rank_num * 17;
|
||||
|
||||
$rank_image = "<div class=\"rank\" style=\"display:inline;\">
|
||||
<ul class=\"unit-rank\">
|
||||
<li class=\"current-rank\" style=\"width:{$rating}px;\">{$rating}</li>
|
||||
</ul>
|
||||
</div>";
|
||||
}
|
||||
|
||||
$tpl->set('{rank-title}', $rank_title);
|
||||
|
||||
$tpl->set('{rank-image}', $rank_image);
|
||||
|
||||
// ********************************************************************************
|
||||
// REPUTATION
|
||||
// ********************************************************************************
|
||||
|
||||
@include (SYSTEM_DIR.'/modules/reputation.php');
|
||||
|
||||
if ($check_moderator)
|
||||
$tpl->set('{ip}', "IP: <a onClick=\"return dropdownmenu(this, event, IPMenu('".$row['post_ip']."', '".$lang['ip_info']."', '".$lang['ip_tools']."', '".$lang['ip_ban']."'), '190px')\" onMouseout=\"delayhidemenu()\" href=\"http://www.nic.ru/whois/?ip={$row['post_ip']}\" target=\"_blank\">{$row['post_ip']}</a>");
|
||||
else $tpl->set('{ip}', '');
|
||||
|
||||
if ($num_post_tid > 0)
|
||||
$del_post = true;
|
||||
else
|
||||
$del_post = false;
|
||||
|
||||
// ********************************************************************************
|
||||
// POST EDIT
|
||||
// ********************************************************************************
|
||||
if (($member_id['name'] == $row['post_author']) AND $group_post_edit OR $deny_edit_post)
|
||||
{
|
||||
$tpl->set('[post-edit]',"<a onClick=\"return dropdownmenu(this, event, PostEditMenu('$row[pid]', '$a_forum_url', '$post_num_id'), '170px')\" onMouseout=\"delayhidemenu()\" href=\"#\">");
|
||||
$tpl->set('[/post-edit]',"</a>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[post-edit\\](.*?)\\[/post-edit\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// POST DEL
|
||||
// ********************************************************************************
|
||||
|
||||
$tpl->set_block("'\\[post-del\\](.*?)\\[/post-del\\]'si","");
|
||||
|
||||
// ********************************************************************************
|
||||
// POST TEXT
|
||||
// ********************************************************************************
|
||||
$tpl->set('{text}', "<div id='post-id-".$row['pid']."'>".stripslashes($row['post_text'])."</div>");
|
||||
|
||||
// ********************************************************************************
|
||||
// HIDE
|
||||
// ********************************************************************************
|
||||
if ($member_id['forum_post'] >= $forum_config['post_hide'])
|
||||
{
|
||||
$tpl->set_block("'\[hide\](.*?)\[/hide\]'si","\\1");
|
||||
}
|
||||
else
|
||||
{
|
||||
$hide_info = "Âíèìàíèå! Ó âàñ íåò ïðàâ, äëÿ ïðîñìîòðà ñêðûòîãî òåêñòà. Íåîáõîäèìî $forum_config[post_hide] ñîîáùåíèé.";
|
||||
|
||||
$tpl->set_block("'\\[hide\\](.*?)\\[/hide\\]'si","<div class=\"quote\">".$hide_info."</div>");
|
||||
}
|
||||
|
||||
$tpl->compile('posts');
|
||||
|
||||
if (stristr ($tpl->result['posts'], "[attachment="))
|
||||
{
|
||||
$tid = $row['tid'];
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/attachment.php';
|
||||
}
|
||||
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
$ban_short = array ();
|
||||
unset( $ban_short );
|
||||
|
||||
?>
|
||||
328
system/forum/sources/showforum.php
Normal file
328
system/forum/sources/showforum.php
Normal file
@@ -0,0 +1,328 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
if (intval($fid))
|
||||
{
|
||||
$row_forum = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE id = $fid");
|
||||
|
||||
$check_moderator = check_moderator($row_forum['access_mod'], $row_forum['moderators']);
|
||||
$check_read = check_access($row_forum['access_read']);
|
||||
|
||||
if ($check_moderator){$mass_prune = moderator_value('mass_prune', $fid, $m_member);}
|
||||
|
||||
// ********************************************************************************
|
||||
// PASSWORD
|
||||
// ********************************************************************************
|
||||
$password = $row_forum['password'];
|
||||
|
||||
if ($password)
|
||||
{
|
||||
$forum_cookie = $_COOKIE["dle_forum_{$fid}"];
|
||||
|
||||
unset ($check_read); // âõîä ïî ïàðîëþ äëÿ âñåõ
|
||||
|
||||
if ($_REQUEST['password']){
|
||||
if ($password == $_REQUEST['password']){
|
||||
set_cookie ("dle_forum_{$fid}", md5($_REQUEST['password']), 365);
|
||||
$check_read = true;
|
||||
}
|
||||
} else {
|
||||
if (md5($password) == $forum_cookie)
|
||||
{
|
||||
$check_read = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// SHOW FORUM
|
||||
// ********************************************************************************
|
||||
$c_id = $row_forum['main_id'];
|
||||
|
||||
if ($row_forum['id'] and $check_read)
|
||||
{
|
||||
$forum_name = stripslashes($row_forum['name']);
|
||||
|
||||
if ($sub_parentid[$fid] and $sub_parentid != 'empty')
|
||||
{
|
||||
if ($forum_config['hide_forum'])
|
||||
{
|
||||
$access_hide = "and access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
|
||||
} else
|
||||
{
|
||||
$access_hide = "";
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE parentid = $fid {$access_hide} ORDER by position");
|
||||
|
||||
while ($row = $db->get_row($result))
|
||||
{
|
||||
if (!$fcache->open('moder-'.$row['id']))
|
||||
{
|
||||
foreach ($forum_moderators as $moderators)
|
||||
{
|
||||
if ($moderators['forum_id'] == $row['id'] and $moderators['member_name'])
|
||||
{
|
||||
$mod_count++;
|
||||
|
||||
if ($mod_count > 1) $mod_symbol = ", ";
|
||||
|
||||
$moderators_list .= $mod_symbol . link_user($moderators['member_name']);
|
||||
}
|
||||
}
|
||||
|
||||
$fcache->save('moder-'.$row['id'], $moderators_list);
|
||||
}
|
||||
else { $moderators_list = $fcache->open('moder-'.$row['id']); }
|
||||
|
||||
$tpl->load_template($tpl_dir.'forums.tpl');
|
||||
|
||||
$tpl->set('{status}', forum_status ($row['f_last_date'], $row['password'], $row['icon']));
|
||||
$tpl->set('{name}', link_forum($row['id'], $row['name']));
|
||||
$tpl->set('{description}', stripslashes($row['description']));
|
||||
$tpl->set('{forum_id_rss}', $forum_url."/rss/forum_".$row['id'].".xml");
|
||||
$tpl->set('{forums}', '');
|
||||
|
||||
if ($moderators_list)
|
||||
{
|
||||
$tpl->set('{moderators}', '<br />' . $f_lang['moderators'] . ' ' . $moderators_list);
|
||||
}
|
||||
else { $tpl->set('{moderators}', ''); }
|
||||
|
||||
$tpl->set('{topics}', $row['topics']);
|
||||
$tpl->set('{post}', $row['posts']);
|
||||
$tpl->set('{last}', forum_last($row['f_last_tid'], $row['f_last_title'], $row['f_last_poster_name'], $row['f_last_date'], $row['password'], $row['id'], $row['access_read']));
|
||||
|
||||
$tpl->compile('forums');
|
||||
$tpl->clear();
|
||||
|
||||
unset ($moderators_list);
|
||||
unset ($mod_count);
|
||||
unset ($mod_symbol);
|
||||
}
|
||||
|
||||
$tpl->load_template($tpl_dir.'category.tpl');
|
||||
|
||||
$tpl->set('{category}', $forum_name.$f_lang['subforums']);
|
||||
$tpl->set('{forums}', $tpl->result['forums']);
|
||||
|
||||
$tpl->compile('subforums');
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TOPIC VIEWS
|
||||
// ********************************************************************************
|
||||
if ($is_logged){
|
||||
$row_views = $db->query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE user_id = $member_id[user_id] and forum_id = $fid");
|
||||
|
||||
$topic_views = array();
|
||||
|
||||
while ($row = $db->get_row($row_views))
|
||||
{
|
||||
$topic_views[$row['topic_id']] = '1';
|
||||
}
|
||||
} else {
|
||||
$row_views = explode(",", $_COOKIE['dle_forum_views']);
|
||||
|
||||
foreach ($row_views as $value)
|
||||
{
|
||||
$topic_views[$value] = '1';
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// CSTART
|
||||
// ********************************************************************************
|
||||
if ($cstart){
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['topic_inpage'];
|
||||
}
|
||||
|
||||
if ($forum_config['topic_sort']){
|
||||
$sort_type = "last_date";
|
||||
} else {
|
||||
$sort_type = "tid";
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// SWITCH
|
||||
// ********************************************************************************
|
||||
if (!$check_moderator) $q_hidden = " and hidden = 0"; else $q_hidden = "";
|
||||
|
||||
switch ($_REQUEST['code'])
|
||||
{
|
||||
// ********************************************************************************
|
||||
// HIDDEN
|
||||
// ********************************************************************************
|
||||
case "hidden":
|
||||
|
||||
if ($check_moderator){
|
||||
$WHERE = "and hidden = 1";
|
||||
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE forum_id = $fid and hidden = 1");
|
||||
$count_all = $get_count['count'];
|
||||
$icat = $a_forum_url."showforum={$fid}&code=hidden&cstart=";
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// TODAY
|
||||
// ********************************************************************************
|
||||
case "today":
|
||||
$today_date = date('Y-m-d');;
|
||||
$WHERE = "{$q_hidden} and last_date >= DATE_ADD(NOW(), INTERVAL -1 DAY)";
|
||||
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE forum_id = $fid {$WHERE}");
|
||||
$count_all = $get_count['count'];
|
||||
$icat = $a_forum_url."showforum={$fid}&code=today&cstart=";
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// NOREPLY
|
||||
// ********************************************************************************
|
||||
case "noreply":
|
||||
$WHERE = "{$q_hidden} and post = '0'";
|
||||
$get_count = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics WHERE forum_id = $fid {$WHERE}");
|
||||
$count_all = $get_count['count'];
|
||||
$icat = $a_forum_url."showforum={$fid}&code=noreply&cstart=";
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// SEARCH
|
||||
// ********************************************************************************
|
||||
case "search":
|
||||
if ($_POST['search_text']){}
|
||||
break;
|
||||
|
||||
// ********************************************************************************
|
||||
// DEFAULT
|
||||
// ********************************************************************************
|
||||
default:
|
||||
$count_all = $row_forum['topics'];
|
||||
$icat = $forum_url."/forum_{$fid}/";
|
||||
if (!$check_moderator) $WHERE = "and hidden = 0"; else $WHERE = "";
|
||||
break;
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// DLE Forum
|
||||
// ********************************************************************************
|
||||
$config_inpage = $forum_config['topic_inpage'];
|
||||
|
||||
$result_topics = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE forum_id = $fid ".$WHERE." ORDER BY fixed, ".$sort_type." DESC LIMIT ".$cstart.",".$forum_config['topic_inpage']."");
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/showtopics.php';
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
|
||||
|
||||
if (!$is_topics){$msg_info = $f_lang['is_topics'];}
|
||||
|
||||
$tpl->load_template($tpl_dir.'forum.tpl');
|
||||
|
||||
$tpl->set('{banner}', stripslashes($row_forum['banner']));
|
||||
$tpl->set('{forum}', $forum_name);
|
||||
$tpl->set('{subforums}', $tpl->result["subforums"]);
|
||||
$tpl->set('{info}', $msg_info);
|
||||
|
||||
if ($row_forum['rules_title']){
|
||||
$tpl->set('[rules]',"");
|
||||
$tpl->set('{rules-name}', $row_forum['rules_title']);
|
||||
$tpl->set('{rules-text}', $row_forum['rules']);
|
||||
$tpl->set('[/rules]',"");
|
||||
} else {
|
||||
$tpl->set_block("'\\[rules\\](.*?)\\[/rules\\]'si","");
|
||||
}
|
||||
|
||||
if($is_logged){
|
||||
$a_new_topic = $forum_url."/forum_{$fid}/add/";
|
||||
$tpl->set('[new_topic]',"<a href=\"{$a_new_topic}\">");
|
||||
$tpl->set('[/new_topic]',"</a>");
|
||||
} else {
|
||||
$tpl->set('[new_topic]',"");
|
||||
$tpl->set('[/new_topic]',"");
|
||||
}
|
||||
|
||||
$tpl->set('[options]',"<a onClick=\"return dropdownmenu(this, event, ForumMenu('$fid', '$check_moderator', '$a_forum_url'), '180px')\" onMouseout=\"delayhidemenu()\" href='#'\">");
|
||||
$tpl->set('[/options]',"</a>");
|
||||
|
||||
$tpl->set('[fast-search]',"<form method=\"post\" action=\"{$a_forum_url}act=search&search_fid={$fid}\">");
|
||||
$tpl->set('[/fast-search]',"</form>");
|
||||
|
||||
if ($mass_prune){
|
||||
$tpl->set('[selected]',"");
|
||||
$tpl->set('[/selected]',"");
|
||||
|
||||
$tpl->set('[moderation]',"<form name=\"modform\" method=\"post\" action=\"{$a_forum_url}act=moderation\">");
|
||||
|
||||
$moderation = "<select name=\"code\">";
|
||||
$moderation .= "<option value=\"-1\">{$f_lang['mtf_op']}</option>";
|
||||
$moderation .= "<option value=\"02\">{$f_lang['mtf_02']}</option>";
|
||||
$moderation .= "<option value=\"01\">{$f_lang['mtf_01']}</option>";
|
||||
$moderation .= "<option value=\"08\">{$f_lang['mtf_08']}</option>";
|
||||
$moderation .= "<option value=\"09\">{$f_lang['mtf_09']}</option>";
|
||||
$moderation .= "<option value=\"05\">{$f_lang['mtf_05']}</option>";
|
||||
$moderation .= "<option value=\"07\">{$f_lang['mtf_07']}</option>";
|
||||
$moderation .= "<option value=\"06\">{$f_lang['mtf_06']}</option>";
|
||||
$moderation .= "<option value=\"03\">{$f_lang['mtf_03']}</option>";
|
||||
$moderation .= "</select>";
|
||||
|
||||
$tpl->set('{moderation}', $moderation);
|
||||
|
||||
$tpl->set('[/moderation]',"<input type=\"hidden\" value=\"\" name=\"selected_id\" /></form>");
|
||||
} else {
|
||||
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
|
||||
}
|
||||
|
||||
if ($forum_config['ses_forum'] and $forum_config['sessions_log']){
|
||||
forum_sessions($fid);
|
||||
|
||||
get_forum_online("act_forum", $fid);
|
||||
|
||||
$tpl->set('[online]',"");
|
||||
|
||||
$tpl->set('{all_count}', $forum_online['all_count']);
|
||||
$tpl->set('{guest_count}', $forum_online['guest_count']);
|
||||
$tpl->set('{member_count}', $forum_online['member_count']);
|
||||
$tpl->set('{member_list}', $forum_online['member_list']);
|
||||
|
||||
$tpl->set('[/online]',"");
|
||||
} else {
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->set('{topics}', $tpl->result['topics']);
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
$tpl->clear();
|
||||
|
||||
} else {
|
||||
if (!$check_read){
|
||||
if (!$password){
|
||||
$group_name = $user_group[$member_id['user_group']]['group_name'];
|
||||
forum_msg($f_lang['f_msg'], $f_lang['forum_read'], 'user_group', $group_name);
|
||||
} else {
|
||||
$password_form = "<form method=\"post\" action=\"\">Ïàðîëü: <input class=\"bbcodes\" type=\"text\" name=\"password\"><input class=\"bbcodes\" type=\"submit\" value=\"Ok\"></form>";
|
||||
forum_msg($f_lang['f_msg'], $password_form);
|
||||
}
|
||||
} else {
|
||||
@header("HTTP/1.0 404 Not Found");
|
||||
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
|
||||
}
|
||||
}
|
||||
|
||||
$metatags['title'] = $forum_config['forum_title'].' » ' . stripslashes($row_forum['name']);
|
||||
|
||||
if ($forum_config['forum_bar']){
|
||||
$bbr_cid = $c_id;
|
||||
$bbr_name = $cats_array[$c_id]['cat_name'];
|
||||
$bbr_fid = $fid;
|
||||
$bbr_fname = $row_forum['name'];
|
||||
}
|
||||
} else {
|
||||
@header("HTTP/1.0 404 Not Found");
|
||||
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
|
||||
}
|
||||
?>
|
||||
223
system/forum/sources/showposts.php
Normal file
223
system/forum/sources/showposts.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
if ($cstart) { $post_num_id = $cstart; }
|
||||
|
||||
if ($fixpost and $cstart)
|
||||
{
|
||||
$post_num_id = $post_num_id - 1;
|
||||
}
|
||||
|
||||
if ($check_moderator)
|
||||
{
|
||||
$deny_edit_post = moderator_value('edit_post', $forum_id, $m_member);
|
||||
|
||||
$deny_del_post = moderator_value('delete_post', $forum_id, $m_member);;
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_post_edit']){
|
||||
$group_post_edit = true;
|
||||
}else{
|
||||
$group_post_edit = false;
|
||||
}
|
||||
|
||||
if ($user_group[$member_id['user_group']]['forum_post_del']){
|
||||
$group_post_del = true;
|
||||
}else{
|
||||
$group_post_del = false;
|
||||
}
|
||||
|
||||
$posts_found = false;
|
||||
|
||||
while ($row = $db->get_row($result_posts))
|
||||
{
|
||||
$post_num_id++;
|
||||
|
||||
if (!$row['user_group']) $row['user_group'] = 5;
|
||||
|
||||
if ($ajax_adds) $post_num_id = "--";
|
||||
|
||||
if ($row['hidden'] == "1")
|
||||
{
|
||||
if ($check_moderator)
|
||||
{
|
||||
$row['post_text'] = "<div class=\"hidden_post\">{$f_lang['h_post']}:<br />".$row['post_text']."</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['post_text'] = "<div class=\"hidden_post\">{$f_lang['h_post']}</div>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_text)
|
||||
{
|
||||
$row['post_text'] = hilites($search_text, $row['post_text']);
|
||||
}
|
||||
|
||||
//start Õàê ÒÑ by SaNcHeS
|
||||
|
||||
if($row['post_author'] == $row_topic['author_topic'])
|
||||
{
|
||||
$ts = "<b>Àâòîð òåìû</b><br><br>";
|
||||
}
|
||||
//end Õàê ÒÑ by SaNcHeS
|
||||
|
||||
// ********************************************************************************
|
||||
// LOAD TEMPLATE
|
||||
// ********************************************************************************
|
||||
$tpl->load_template($tpl_dir.'post.tpl');
|
||||
|
||||
if ($row['pid'] == $first_post){
|
||||
$tpl->set('{post_id}', "<a href=\"javascript:PostLink({$row['pid']});\" name=\"post-{$row['pid']}\">1</a>");
|
||||
} else {
|
||||
$tpl->set('{post_id}', "<a href=\"javascript:PostLink({$row['pid']});\" name=\"post-{$row['pid']}\">{$post_num_id}</a>");
|
||||
}
|
||||
|
||||
if ($row['edit_time'] and $show_edit_info)
|
||||
$tpl->set('{edit-info}', "<br /><span class='edit-info'>{$f_lang['edit_info']} <b>{$row['edit_user']}</b> - ".show_date($row['edit_time'])."</span>");
|
||||
else $tpl->set('{edit-info}', "");
|
||||
|
||||
$go_page = "onClick=\"return dropdownmenu(this, event, FUserMenu('".urlencode($row['name'])."', '".$row['user_id']."', '".$member_id['user_group']."', '$a_forum_url'), '170px')\" onMouseout=\"delayhidemenu()\"";
|
||||
|
||||
if ($row['is_register'])
|
||||
$tpl->set('{author}', "<a {$go_page} href=\"#\">{$row['post_author']}</a>");
|
||||
else $tpl->set('{author}', "<a href=\"mailto:".$row['e_mail']."\">{$row['post_author']}</a>");
|
||||
|
||||
$tpl->set( '{topic_url}', "");
|
||||
|
||||
if( $row['foto'] and (file_exists( ROOT_DIR . "/uploads/fotos/" . $row['foto'] )) ) $tpl->set( '{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto'] );
|
||||
else $tpl->set( '{foto}', "{THEME}/images/noavatar.png" );
|
||||
|
||||
if ($row['icq']) $tpl->set('{icq}', stripslashes($row['icq']));
|
||||
else $tpl->set('{icq}', '--');
|
||||
|
||||
//start Õàê ÒÑ by SaNcHeS
|
||||
if ($ts) $tpl->set('{ts}', '');
|
||||
if($row['post_author'] == $row_topic['author_topic']){
|
||||
if ($ts) $tpl->set('{ts}', $ts);
|
||||
else $tpl->set('{ts}');
|
||||
}
|
||||
//end Õàê ÒÑ by SaNcHeS
|
||||
|
||||
if ($row['land']) $tpl->set('{land}', stripslashes($row['land']));
|
||||
else $tpl->set('{land}', '--');
|
||||
|
||||
if ($row['fullname']) $tpl->set('{fullname}', stripslashes($row['fullname']));
|
||||
else $tpl->set('{fullname}', '--');
|
||||
|
||||
if ($row['reg_date']) $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 ($user_group[$row['user_group']]['colour']){
|
||||
$group_span = $user_group[$row['user_group']]['colour'];
|
||||
$group_name = "<span style=\"color:{$group_span}\">".$user_group[$row['user_group']]['group_name']."</span>";
|
||||
}else{
|
||||
$group_name = $user_group[$row['user_group']]['group_name'];
|
||||
}
|
||||
|
||||
if ($row['banned']){$group_name = "BANNED";}
|
||||
$tpl->set('{group-name}', $group_name);
|
||||
$tpl->set('{post-num}', intval($row['forum_post']));
|
||||
$tpl->set('{news-num}', intval($row['news_num']));
|
||||
$tpl->set('{comm-num}', intval($row['comm_num']));
|
||||
|
||||
// ********************************************************************************
|
||||
// POST SELECTED
|
||||
// ********************************************************************************
|
||||
if ($check_moderator AND $post_num_id != 1) $tpl->set('{selected}', "<input OnClick=\"select_id('{$row['pid']}');\" type='checkbox' name=\"sid[{$row['pid']}]\" value=\"{$row['pid']}\">");
|
||||
else $tpl->set('{selected}', "");
|
||||
|
||||
// ********************************************************************************
|
||||
// POST DATE
|
||||
// ********************************************************************************
|
||||
$row['post_date'] = strtotime($row['post_date']);
|
||||
|
||||
$tpl->set('{post-date}', show_date($row['post_date']));
|
||||
|
||||
if (!$forum_config['mod_report'] and $is_logged){
|
||||
$tpl->set('[report]',"<a href=\"{$a_forum_url}act=_topic&code=report&tid={$tid}&pid={$post_num_id}\">");
|
||||
$tpl->set('[/report]',"</a>");
|
||||
} else {
|
||||
$tpl->set_block("'\\[report\\](.*?)\\[/report\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// FAST
|
||||
// ********************************************************************************
|
||||
if ($check_write AND !$row['hidden'])
|
||||
{
|
||||
$tpl->set('[fast]',"<a onmouseover=\"dle_copy_quote('".str_replace( array(" ", "'"), array(" ", "&#039;"), $row['post_author'] )."');\" href=\"#\" onClick=\"forum_ins('".str_replace( array(" ", "'"), array(" ", "&#039;"), $row['post_author'] )."'); ShowHide('sreply', 'open'); return false;\"\">");
|
||||
$tpl->set('[/fast]',"</a>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[fast\\](.*?)\\[/fast\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// REPUTATION
|
||||
// ********************************************************************************
|
||||
@include (SYSTEM_DIR.'/modules/reputation.php');
|
||||
|
||||
if ($check_moderator)
|
||||
$tpl->set('{ip}', "IP: <a onClick=\"return dropdownmenu(this, event, IPMenu('".$row['post_ip']."', '".$lang['ip_info']."', '".$lang['ip_tools']."', '".$lang['ip_ban']."'), '190px')\" onMouseout=\"delayhidemenu()\" href=\"http://www.nic.ru/whois/?ip={$row['post_ip']}\" target=\"_blank\">{$row['post_ip']}</a>");
|
||||
else $tpl->set('{ip}', '');
|
||||
|
||||
// ********************************************************************************
|
||||
// POST EDIT
|
||||
// ********************************************************************************
|
||||
if (($member_id['name'] == $row['post_author']) AND $group_post_edit AND !$row['hidden'] OR $deny_edit_post){
|
||||
$tpl->set('[post-edit]',"<a onClick=\"return dropdownmenu(this, event, PostEditMenu('$row[pid]', '$a_forum_url', '$page', '$post_num_id'), '170px')\" onMouseout=\"delayhidemenu()\" href=\"#\">");
|
||||
$tpl->set('[/post-edit]',"</a>");
|
||||
}else{
|
||||
$tpl->set_block("'\\[post-edit\\](.*?)\\[/post-edit\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// POST DEL
|
||||
// ********************************************************************************
|
||||
if (($member_id['name'] == $row['post_author']) AND $group_post_del AND !$row['hidden'] OR $deny_del_post)
|
||||
{
|
||||
if ($post_num_id != 1)
|
||||
{
|
||||
$tpl->set('[post-del]',"<a href=\"javascript:postDelete('".$a_forum_url."act=post&code=04&selected_id=".$row['pid']."')\">");
|
||||
$tpl->set('[/post-del]',"</a>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[post-del\\](.*?)\\[/post-del\\]'si","");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[post-del\\](.*?)\\[/post-del\\]'si","");
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// POST TEXT
|
||||
// ********************************************************************************
|
||||
$tpl->set('{text}', "<div id='post-id-".$row['pid']."'>".stripslashes($row['post_text'])."</div>");
|
||||
|
||||
$tpl->compile('posts');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
$posts_found = true;
|
||||
}
|
||||
|
||||
if (stristr ($tpl->result['posts'], "[attachment="))
|
||||
{
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/attachment.php';
|
||||
}
|
||||
|
||||
$tpl->result['posts'] .= "\n<span id='ajax-post'></span>\n";
|
||||
?>
|
||||
397
system/forum/sources/showtopic.php
Normal file
397
system/forum/sources/showtopic.php
Normal file
@@ -0,0 +1,397 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
|
||||
|
||||
if (intval($tid)){
|
||||
$row_topic = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE tid = $tid");
|
||||
$forum_id = $row_topic['forum_id'];
|
||||
$last_date = $row_topic['last_date'];
|
||||
|
||||
if ($forum_config['meta_topic'] and $row_topic['meta_descr']){
|
||||
$metatags['description'] = $row_topic['meta_descr'];
|
||||
$metatags['keywords'] = $row_topic['meta_keywords'];
|
||||
|
||||
$meta_topic = true;
|
||||
}
|
||||
|
||||
else { $meta_topic = false; }
|
||||
|
||||
$page = $cstart;
|
||||
|
||||
// ********************************************************************************
|
||||
// GET LAST POST
|
||||
// ********************************************************************************
|
||||
if ($_REQUEST['lastpost']){
|
||||
$last_page = @ceil(($row_topic['post'] + 1) / $forum_config['post_inpage']);
|
||||
|
||||
if ($last_page > 1){
|
||||
$last_page = $forum_url."/topic_$tid/$last_page#post-{$row_topic['last_post_id']}";
|
||||
header("Location: $last_page");
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// CHECK ACCESS
|
||||
// ********************************************************************************
|
||||
$check_read = check_access($forums_array[$forum_id]['access_read']);
|
||||
$check_moderator = check_moderator($forums_array[$forum_id]['access_mod'], $forums_array[$forum_id]['moderators']);
|
||||
$check_write = check_access($forums_array[$forum_id]['access_write']);
|
||||
$fixpost = $forums_array[$forum_id]['fixpost'];
|
||||
|
||||
if ($row_topic['hidden'] and !$check_moderator)
|
||||
{
|
||||
$check_read = false;
|
||||
}
|
||||
|
||||
if ($forums_array[$forum_id]['password'] and md5($forums_array[$forum_id]['password']) !== $_COOKIE["dle_forum_{$forum_id}"])
|
||||
{
|
||||
$check_read = false;
|
||||
}
|
||||
|
||||
$forum_name = $forums_array[$forum_id]['name'];
|
||||
|
||||
if ($_REQUEST['view'] and $check_read)
|
||||
{
|
||||
if ($_REQUEST['view'] == "new")
|
||||
{
|
||||
$q_view = '>';
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$q_view = '<';
|
||||
}
|
||||
|
||||
$view_tid = $db->super_query("SELECT * FROM " . PREFIX . "_forum_topics WHERE forum_id = $forum_id and last_date {$q_view} '$last_date'");
|
||||
|
||||
$open_topic = $forum_url."/topic_{$view_tid['tid']}/";
|
||||
|
||||
if ($view_tid['tid'])
|
||||
{
|
||||
header("Location: {$open_topic}");
|
||||
}
|
||||
}
|
||||
|
||||
if ($row_topic['tid'] and $check_read)
|
||||
{
|
||||
// ********************************************************************************
|
||||
// TOPIC VIEWS
|
||||
// ********************************************************************************
|
||||
if (!$_SESSION["topic_views_{$tid}"]){
|
||||
$db->query("UPDATE " . PREFIX . "_forum_topics SET views = views+1 WHERE tid = $tid");
|
||||
$_SESSION["topic_views_{$tid}"] = "1";
|
||||
}
|
||||
|
||||
if ($is_logged)
|
||||
{
|
||||
$rowt = $db->super_query("SELECT topic_id FROM " . PREFIX . "_forum_views WHERE topic_id = $tid and user_id = {$member_id[user_id]}");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$topic_views = $_COOKIE['dle_forum_views'];
|
||||
}
|
||||
|
||||
if (!$rowt['topic_id'] AND $is_logged){
|
||||
$_TIME = time()+($config['date_adjust']*60);
|
||||
$db->query("INSERT INTO " . PREFIX . "_forum_views (topic_id, forum_id, user_id, time) values ('$tid', '$forum_id', '$member_id[user_id]', '$_TIME')");
|
||||
} else {
|
||||
$topic_views = $topic_views.",".$tid;
|
||||
set_cookie ("dle_forum_views", $topic_views, 365);
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TOPIC READ
|
||||
// ********************************************************************************
|
||||
if ($cstart){
|
||||
$cstart = $cstart - 1;
|
||||
$cstart = $cstart * $forum_config['post_inpage'];
|
||||
}
|
||||
|
||||
switch ($_REQUEST['code'])
|
||||
{
|
||||
case "search":
|
||||
|
||||
$search_text = strip_data($_REQUEST['search_text']);
|
||||
|
||||
if ($search_text)
|
||||
{
|
||||
$_SESSION['search_text_'.$tid] = $search_text;
|
||||
}
|
||||
|
||||
$search_text = $_SESSION['search_text_'.$tid];
|
||||
|
||||
if ($search_text)
|
||||
{
|
||||
$result_posts = $db->query("SELECT p.*, u.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . USERPREFIX . "_users AS u ON p.post_author=u.name WHERE p.topic_id = $tid AND post_text LIKE '%{$search_text}%' ORDER by pid LIMIT ".$cstart.",".$forum_config['post_inpage']."");
|
||||
|
||||
$result_count = $db->super_query("SELECT count(*) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = $tid AND post_text LIKE '%{$search_text}%'");
|
||||
|
||||
$count_all = $result_count['count'];
|
||||
|
||||
$a_href_reply = $forum_url."/topic_{$tid}/reply/";
|
||||
$a_new_topic = $forum_url."/forum_{$forum_id}/add/";
|
||||
|
||||
$icat = $a_forum_url . "showtopic={$tid}&code=search&cstart=";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$fp_query = "";
|
||||
|
||||
if ($fixpost and $cstart)
|
||||
{
|
||||
$first_post = $row_topic['first_post'] ? $row_topic['first_post'] : set_first_post_id ($tid);
|
||||
$fp_query = "(SELECT p.*, u.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . USERPREFIX . "_users AS u ON p.post_author = u.name WHERE p.pid = $first_post) UNION ";
|
||||
}
|
||||
|
||||
$posts_query = "SELECT p.*, u.* FROM " . PREFIX . "_forum_posts AS p LEFT JOIN " . USERPREFIX . "_users AS u ON p.post_author=u.name WHERE p.topic_id = $tid ORDER by pid LIMIT ".$cstart.",".$forum_config['post_inpage']."";
|
||||
|
||||
if ($fp_query) { $posts_query = "({$posts_query})"; }
|
||||
|
||||
$result_posts = $db->query($fp_query . $posts_query);
|
||||
|
||||
$count_all = ($row_topic['post'] + 1);
|
||||
|
||||
$icat = $forum_url."/topic_{$tid}/";
|
||||
|
||||
$a_href_reply = $forum_url."/topic_{$tid}/reply/";
|
||||
|
||||
$a_new_topic = $forum_url."/forum_{$forum_id}/add/";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($count_all)
|
||||
{
|
||||
$show_edit_info = $forums_array[$forum_id]['i_edit'];
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/showposts.php';
|
||||
|
||||
if (!$posts_found and $_SESSION['post_num_update_'.$tid] < 5)
|
||||
{
|
||||
$post_row = $db->super_query("SELECT COUNT(pid) as count FROM " . PREFIX . "_forum_posts WHERE topic_id = $tid");
|
||||
|
||||
$post_row['count'] = ($post_row['count'] - 1);
|
||||
|
||||
$db->query("UPDATE " . PREFIX . "_forum_topics SET post = '{$post_row['count']}' WHERE tid = $tid");
|
||||
|
||||
$_SESSION['post_num_update_'.$tid]++;
|
||||
|
||||
header("Location: {$icat}");
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$config_inpage = $forum_config['post_inpage'];
|
||||
|
||||
require_once SYSTEM_DIR.'/forum/sources/components/navigation.php';
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// POLL
|
||||
// ********************************************************************************
|
||||
if ($row_topic['poll_title'] AND $row_topic['frage'] AND $row_topic['poll_body']){
|
||||
$dle_forum_poll = TRUE;
|
||||
include_once SYSTEM_DIR.'/forum/sources/components/poll.php';
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// REPLY
|
||||
// ********************************************************************************
|
||||
if ($check_write and !$row_topic['topic_status'] and $forums_array[$forum_id]['q_reply']){
|
||||
$access_upload = check_access($forums_array[$forum_id]['access_upload']);
|
||||
$upload_var = array('area'=>"post", 'forum_id'=>$forum_id, 'topic_id'=>$tid, 'post_id'=>get_salt());
|
||||
$upload_var['reply'] = "reply";
|
||||
$tpl->load_template($tpl_dir.'ajax_addpost.tpl');
|
||||
$tpl->set('{title}', $f_lang['f_reply']);
|
||||
|
||||
$tpl->set('[not-wysywyg]', "");
|
||||
$tpl->set('{wysiwyg}','');
|
||||
$tpl->set('[/not-wysywyg]',"");
|
||||
|
||||
include_once SYSTEM_DIR.'/forum/sources/components/bbcode.php';
|
||||
|
||||
if (!$is_logged){
|
||||
$tpl->set('[not-logged]','');
|
||||
$tpl->set('[/not-logged]','');
|
||||
}else{
|
||||
$tpl->set_block("'\\[not-logged\\](.*?)\\[/not-logged\\]'si","");
|
||||
}
|
||||
$tpl->set('{bbcode}',$bb_code);
|
||||
$tpl->set('{text}',"");
|
||||
|
||||
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 = "";
|
||||
|
||||
$topic_title_last = urlencode(stripslashes($row_topic['title']));
|
||||
|
||||
$tpl->copy_template = "<form method=\"post\" name=\"forum-post-form\" id=\"forum-post-form\" action=\"{$_SESSION['referrer']}\" onkeypress=\"CtrlEnter(event, this);\">".$tpl->copy_template."{$hidden}
|
||||
<input type=\"hidden\" name=\"topic_title\" id=\"topic_title\" value=\"{$topic_title_last}\" />
|
||||
<input type=\"hidden\" name=\"topic_id\" id=\"topic_id\" value=\"{$tid}\" />
|
||||
<input type=\"hidden\" name=\"forum_id\" id=\"forum_id\" value=\"{$forum_id}\" />
|
||||
<input type=\"hidden\" name=\"post_id\" id=\"post_id\" value=\"{$upload_var[post_id]}\" /></form>
|
||||
<div id=\"uploads-form\"></div>";
|
||||
|
||||
$tpl->compile('addpost');
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$tpl->load_template($tpl_dir.'msg.tpl');
|
||||
$tpl->set('{title}', $f_lang['all_info']);
|
||||
$tpl->set('{msg}', $f_lang['topic_write']);
|
||||
$tpl->set('{user_group}', $user_group[$member_id['user_group']]['group_name']);
|
||||
$tpl->compile('addpost');
|
||||
$tpl->clear();
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
// TOPIC TEMPLATE
|
||||
// ********************************************************************************
|
||||
if ($post_num_id){
|
||||
|
||||
$tpl->load_template($tpl_dir.'topic.tpl');
|
||||
|
||||
$tpl->set('{banner}', stripslashes($forums_array[$forum_id]['banner']));
|
||||
|
||||
if ($row_topic['topic_descr']){
|
||||
$row_topic['title'] = $row_topic['title'].', '.$row_topic['topic_descr'];
|
||||
}
|
||||
|
||||
$tpl->set('{title}', stripslashes($row_topic['title']));
|
||||
$tpl->set('{navigation}', $tpl->result['navigation']);
|
||||
|
||||
$tpl->set('[options]',"<a onClick=\"return dropdownmenu(this, event, TopicMenu('$tid', '$a_forum_url', '$check_moderator'), '170px')\" onMouseout=\"delayhidemenu()\" href='#'\">");
|
||||
$tpl->set('[/options]',"</a>");
|
||||
|
||||
$tpl->set('[new_topic]',"<a href=\"{$a_new_topic}\">");
|
||||
$tpl->set('[/new_topic]',"</a>");
|
||||
|
||||
if ($dle_forum_poll){
|
||||
$tpl->set_block("'\\[poll\\](.*?)\\[/poll\\]'si","\\1");
|
||||
$tpl->set('{topic_poll}', $tpl->result["topic_poll"]);
|
||||
}else{
|
||||
$tpl->set_block("'\\[poll\\](.*?)\\[/poll\\]'si","");
|
||||
}
|
||||
|
||||
if(!$row_topic['topic_status']){
|
||||
$tpl->set('[reply]',"<a href='{$a_href_reply}'\">");
|
||||
$tpl->set('[/reply]',"</a>");
|
||||
|
||||
if ($forums_array[$forum_id]['q_reply']){
|
||||
$tpl->set('{s_reply}', "<a href=\"javascript:ShowHide('sreply');\"><img src=\"{THEME}/forum/images/s_reply.gif\" border=\"0\" alt=\"Áûñòðûé îòâåò\"></a>");
|
||||
}else{
|
||||
$tpl->set('{s_reply}', "");
|
||||
$tpl->result['addpost'] = "";
|
||||
}
|
||||
|
||||
}else{
|
||||
$tpl->set_block("'\\[reply\\](.*?)\\[/reply\\]'si","");
|
||||
$tpl->set('{s_reply}', "<a href=\"{$a_href_reply}\"><img src=\"{THEME}/forum/images/closed.gif\" border=\"0\" alt=\"Òåìà çàêðûòà\"></a>");
|
||||
}
|
||||
|
||||
$tpl->set('{addpost}', $tpl->result['addpost']);
|
||||
|
||||
if ($forum_config['ses_topic'] and $forum_config['sessions_log']){
|
||||
forum_sessions($forum_id, $tid);
|
||||
|
||||
get_forum_online('act_topic', $tid);
|
||||
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","\\1");
|
||||
|
||||
$tpl->set('{all_count}', $forum_online['all_count']);
|
||||
$tpl->set('{guest_count}', $forum_online['guest_count']);
|
||||
$tpl->set('{member_count}', $forum_online['member_count']);
|
||||
$tpl->set('{member_list}', $forum_online['member_list']);
|
||||
}else{
|
||||
$tpl->set_block("'\\[online\\](.*?)\\[/online\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->set('[new-topic]',"<a href='{$a_forum_url}showtopic={$tid}&view=new'>");
|
||||
$tpl->set('[/new-topic]',"</a>");
|
||||
|
||||
$tpl->set('{forum_name}', link_forum($forum_id, $forum_name));
|
||||
|
||||
$tpl->set('[old-topic]',"<a href='{$a_forum_url}showtopic={$tid}&view=old'>");
|
||||
$tpl->set('[/old-topic]',"</a>");
|
||||
|
||||
$tpl->set('[fast-search]',"<form action=\"\" method=\"post\">");
|
||||
$tpl->set('[/fast-search]',"<input type=\"hidden\" name=\"code\" value=\"search\" /></form>");
|
||||
|
||||
include_once SYSTEM_DIR.'/forum/sources/components/edit_options.php';
|
||||
|
||||
if ($topic_option or $posts_option)
|
||||
{
|
||||
if ($topic_option)
|
||||
{
|
||||
$topic_moderation = "<form method=\"POST\" action=\"{$a_forum_url}act=moderation\">";
|
||||
$topic_moderation .= "<select name=\"code\">{$topic_option}</select>";
|
||||
$topic_moderation .= "<input type=\"hidden\" value=\"{$tid}\" name=\"selected_id\" /><input type=\"submit\" class=\"button\" value=\">\"/></form>";
|
||||
|
||||
$tpl->set('{moderation}', $topic_moderation);
|
||||
}else{
|
||||
$tpl->set('{moderation}', '');
|
||||
}
|
||||
|
||||
if ($posts_option){
|
||||
$posts_moderation = "<form method=\"POST\" name=\"modform\" action=\"{$a_forum_url}act=post\">";
|
||||
$posts_moderation .= "<select name=\"code\">{$posts_option}</select>";
|
||||
$posts_moderation .= "<input type=\"hidden\" value=\"\" name=\"selected_id\" /><input type=\"submit\" class=\"button\" value=\"Ok\"/></form>";
|
||||
|
||||
$tpl->set('{post_moderation}', $posts_moderation);
|
||||
}else{
|
||||
$tpl->set('{post_moderation}', '');
|
||||
}
|
||||
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","\\1");
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[moderation\\](.*?)\\[/moderation\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->set('{posts}', $tpl->result['posts']);
|
||||
|
||||
$tpl->compile('dle_forum');
|
||||
$tpl->clear();
|
||||
|
||||
// ********************************************************************************
|
||||
// HIDE
|
||||
// ********************************************************************************
|
||||
if ($member_id['forum_post'] >= $forum_config['post_hide']) { $tpl->result['dle_forum'] = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "\\1", $tpl->result['dle_forum']); }
|
||||
else { $tpl->result['dle_forum'] = preg_replace ( "'\[hide\](.*?)\[/hide\]'si", "<div class=\"quote\">" . $lang['news_regus'] . "</div>", $tpl->result['dle_forum'] ); }
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
forum_msg($f_lang['search_result'], $f_lang['search_topic']);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$group_name = $user_group[$member_id['user_group']]['group_name'];
|
||||
|
||||
forum_msg($f_lang['f_msg'], $f_lang['topic_read'], 'user_group', $group_name);
|
||||
}
|
||||
|
||||
$metatags['title'] = $forum_config['forum_title'].' » '.stripslashes($row_topic['title']);
|
||||
|
||||
// ********************************************************************************
|
||||
// FORUM BAR
|
||||
// ********************************************************************************
|
||||
if ($forum_config['forum_bar'])
|
||||
{
|
||||
$bbr_fid = $forum_id;
|
||||
$bbr_fname = $forum_name;
|
||||
|
||||
$c_id = $forums_array[$forum_id]['main_id'];
|
||||
|
||||
$bbr_cid = $c_id;
|
||||
$bbr_name = $cats_array[$c_id]['cat_name'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
82
system/forum/sources/showtopics.php
Normal file
82
system/forum/sources/showtopics.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
if(!defined('DATALIFEENGINE'))
|
||||
{
|
||||
die("Hacking attempt!");
|
||||
}
|
||||
|
||||
while ($row = $db->get_row($result_topics))
|
||||
{
|
||||
if ($forum_config['topic_abc'])
|
||||
{
|
||||
if (strlen($row['title']) > $forum_config['topic_abc'])
|
||||
{
|
||||
$row['title'] = substr ($row['title'], 0, $forum_config['topic_abc']).'...';
|
||||
}
|
||||
|
||||
if (strlen($row['topic_descr']) > $forum_config['topic_abc'])
|
||||
{
|
||||
$row['topic_descr'] = substr ($row['topic_descr'], 0, $forum_config['topic_abc']).'...';
|
||||
}
|
||||
}
|
||||
|
||||
$topic_link = link_topic($row['tid'], $row['title']);
|
||||
|
||||
if ($row['hidden']){$topic_link = $forum_config['forum_pr_modr'].' '.$topic_link;}
|
||||
if (!$row['fixed']){$topic_link = $forum_config['forum_pr_imp'].' '.$topic_link;}
|
||||
if ($row['frage']){$topic_link = $forum_config['forum_pr_vote'].' '.$topic_link;}
|
||||
|
||||
$tpl->load_template($tpl_dir.'topics.tpl');
|
||||
|
||||
$tpl->set('{status}', topic_status($row['tid'], $row['last_date'], $row['post'], $row['topic_status'], $row['frage']));
|
||||
$tpl->set('{title}', stripslashes($topic_link));
|
||||
$tpl->set('{description}', stripslashes($row['topic_descr']));
|
||||
$tpl->set('{show}', $row['views']);
|
||||
$tpl->set('{post}', $row['post']);
|
||||
|
||||
$str='';
|
||||
$nom='';
|
||||
$str=ceil($row['post']/$forum_config['post_inpage']);
|
||||
if ($str>1) {
|
||||
if ($str<=5) {
|
||||
for ($i = 1; $i <= $str; $i++) {
|
||||
$topic_linker="/forum/topic_".$row['tid']."/".$i."/";
|
||||
$nom.="<a id=\"pagen\" href='$topic_linker'>$i</a> ";}
|
||||
$tpl->set('{str}', $nom);
|
||||
}
|
||||
if ($str>5){
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$topic_linker="/forum/topic_".$row['tid']."/".$i."/";
|
||||
$nom.="<a id=\"pagen\" href='$topic_linker'>$i</a> ";
|
||||
}
|
||||
$nom.="...";
|
||||
$topic_linker="/forum/topic_".$row['tid']."/".$str."/";
|
||||
$nom.="<a id=\"pagen\" href='$topic_linker'>$str</a>";
|
||||
$tpl->set('{str}', $nom);
|
||||
}
|
||||
} else $tpl->set('{str}', '');
|
||||
|
||||
$tpl->set('{author}', link_user($row['author_topic']));
|
||||
|
||||
$tpl->set('{last}', topic_last ($row['tid'], $row['last_poster_name'], $row['last_date'], $row['post'], $row['last_post_id']));
|
||||
|
||||
if ($mass_prune)
|
||||
{
|
||||
$tpl->set('[selected]',"");
|
||||
|
||||
$tpl->set('{selected}', "<input OnClick=\"select_id('{$row['tid']}');\" type='checkbox' name=\"sid[{$row['tid']}]\" value=\"{$row['tid']}\">");
|
||||
|
||||
$tpl->set('[/selected]',"");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$tpl->set_block("'\\[selected\\](.*?)\\[/selected\\]'si","");
|
||||
}
|
||||
|
||||
$tpl->compile('topics');
|
||||
|
||||
$tpl->clear();
|
||||
|
||||
$is_topics = 1;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user