message
This commit is contained in:
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>");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user