sibtracker/system/forum/sources/shapeshifter/forum_posts.php
2019-05-18 13:46:03 +08:00

154 lines
5.7 KiB
PHP
Raw Permalink Blame History

<?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}', "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ".$username."");
$tpl->set('{title_descr}', "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ".$count_all." <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
$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'], "<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
$metatags['title'] = '<27><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> &raquo; '.$forum_config['forum_title'];
if ($forum_config['forum_bar'])
{
$bbr_cid = $c_id;
$bbr_top = " &raquo; <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
?>