// łączenie i dzielenie tematow } elseif(isset($_GET['step']) && $_GET['step'] == "split"){ if(isset($_POST['split_thread'])){ $toMove = ""; $i = 0; $firstPost = ""; foreach($_POST as $post=>$move){ if(!ereg("move_", $post) || !$move) continue; $toMove .= ($i > 0 ? " OR " : "")."post_id='".str_replace('move_', '', $post)."'"; if(!$i) $firstPost = dbarray(dbquery("select * from ".DB_POSTS." where post_id='".str_replace('move_', '', $post)."'")); $i++; } $subject = (isset($_POST['thread_subject']) ? addslash(stripinput($_POST['thread_subject'])) : ""); $forum = (isset($_POST['thread_forum']) && isNum($_POST['thread_forum']) ? $_POST['thread_forum'] : $_GET['forum_id']); $result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject, thread_author, thread_views, thread_lastpost, thread_lastpostid, thread_lastuser, thread_postcount, thread_poll, thread_sticky, thread_locked) VALUES('$forum', '$subject', '".$firstPost['post_author']."', '0', '".time()."', '0', '".$firstPost['post_author']."', '1', '0', '0', '0')"); $threadid = mysql_insert_id(); $result = dbquery("update ".DB_POSTS." set thread_id='$threadid', forum_id='$forum' where $toMove"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where thread_id='$threadid' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "thread_id='$threadid'"); $result = dbquery("update ".DB_THREADS." set thread_lastpost='".$lastPost['post_datestamp']."', thread_lastpostid='".$lastPost['post_id']."', thread_lastuser='".$lastPost['post_author']."', thread_postcount='$postCount' where thread_id='$threadid'"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where forum_id='$forum' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "forum_id='$forum'"); $result = dbquery("update ".DB_FORUMS." set forum_lastpost='".$lastPost['post_datestamp']."', forum_threadcount=forum_threadcount+1, forum_lastuser='".$lastPost['post_author']."', forum_postcount='$postCount' where forum_id='$forum'"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where thread_id='".$_GET['thread_id']."' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "thread_id='".$_GET['thread_id']."'"); $result = dbquery("update ".DB_THREADS." set thread_lastpost='".$lastPost['post_datestamp']."', thread_lastpostid='".$lastPost['post_id']."', thread_lastuser='".$lastPost['post_author']."', thread_postcount='$postCount' where thread_id='".$_GET['thread_id']."'"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where forum_id='".$_GET['forum_id']."' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "forum_id='".$_GET['forum_id']."'"); $result = dbquery("update ".DB_FORUMS." set forum_lastpost='".$lastPost['post_datestamp']."', forum_threadcount=forum_threadcount+1, forum_lastuser='".$lastPost['post_author']."', forum_postcount='$postCount' where forum_id='".$_GET['forum_id']."'"); opentable($locale['fb215']); echo "

".$locale['fb222']."
\n"; echo "".$locale['fb223']." :: \n"; echo "".$locale['fb224']." :: \n"; echo "".$locale['402']." :: \n"; echo "".$locale['403']."

\n"; } else { $possibleParents = ""; $c_res = dbquery("select * from ".$db_prefix."forums where forum_cat='0'"); while($c_data = dbarray($c_res)){ $possibleParents .= "\n"; $p_res = dbquery("SELECT * FROM ".DB_FORUMS." WHERE forum_cat='".$c_data['forum_id']."' ORDER BY forum_order"); while($p_data = dbarray($p_res)){ $sel = ($p_data['forum_id'] == $_GET['forum_id'] ? " SELECTED" : ""); $possibleParents .= "\n"; } $possibleParents .= "\n"; } opentable($locale['fb215']); echo "
\n"; echo "\n"; echo "\n\n\n\n"; echo "\n\n\n\n"; echo "
".$locale['fb216'].""; echo "
".$locale['fb217'].""; echo "
\n"; closetable(); tablebreak(); opentable($locale['fb218']); $result = dbquery("select * from ".DB_POSTS." p left join ".DB_USERS." u on u.user_id=p.post_author where p.thread_id='".$_GET['thread_id']."'"); $i = 0; while($data = dbarray($result)){ $i++; if($i < 2) continue; echo "\n"; echo "\n\n\n"; echo "\n\n\n"; echo "
".$locale['fb219']."".showdate("forumdate", $data['post_datestamp'])."".$locale['fb220']; echo "".$data['user_name']."\n"; echo " ".$locale['fb221']."
".nl2br(trimlink($data['post_message'], 120))."

\n"; } echo "
\n
\n"; } closetable(); } elseif(isset($_GET['step']) && $_GET['step'] == "merge"){ if(isset($_POST['merge_thread'])){ $toMove = ""; $i = 0; foreach($_POST as $post=>$move){ if(!ereg("move_", $post) || !$move) continue; $toMove .= ($i > 0 ? " OR " : "")."post_id='".str_replace('move_', '', $post)."'"; $i++; } $merge_id = (isset($_POST['merge_id']) && isNum($_POST['merge_id']) ? $_POST['merge_id'] : 0); $result = dbquery("select * from ".DB_THREADS." where thread_id='$merge_id'"); if(!dbrows($result)) redirect(FUSION_SELF."?step=merge&thread_id=".$_GET['thread_id']."&forum_id=".$_GET['forum_id']."&status=notfound"); $data = dbarray($result); $threadid = $data['thread_id']; $result = dbquery("update ".DB_POSTS." set thread_id='$threadid', forum_id='".$data['forum_id']."' where $toMove"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where thread_id='$threadid' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "thread_id='$threadid'"); $result = dbquery("update ".DB_THREADS." set thread_lastpost='".$lastPost['post_datestamp']."', thread_lastpostid='".$lastPost['post_id']."', thread_lastuser='".$lastPost['post_author']."', thread_postcount='$postCount' where thread_id='$threadid'"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where forum_id='".$data['forum_id']."' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "forum_id='".$data['forum_id']."'"); $result = dbquery("update ".DB_FORUMS." set forum_lastpost='".$lastPost['post_datestamp']."', forum_lastuser='".$lastPost['post_author']."', forum_postcount='$postCount' where forum_id='".$data['forum_id']."'"); $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where thread_id='".$_GET['thread_id']."' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "thread_id='".$_GET['thread_id']."'"); $result = dbquery("update ".DB_THREADS." set thread_lastpost='".$lastPost['post_datestamp']."', thread_lastpostid='".$lastPost['post_id']."', thread_lastuser='".$lastPost['post_author']."', thread_postcount='$postCount' where thread_id='".$_GET['thread_id']."'"); if(!dbcount("(post_id)", DB_POSTS, "thread_id='".$_GET['thread_id']."'")){ $result = dbquery("delete from ".DB_THREADS." where thread_id='".$_GET['thread_id']."'"); $result = dbquery("delete from ".DB_THREAD_NOTIFY." where thread_id='".$_GET['thread_id']."'"); $delete=true; } else { $delete=false; } $lastPost = dbarray(dbquery("select * from ".DB_POSTS." where forum_id='".$_GET['forum_id']."' order by post_id desc limit 1")); $postCount = dbcount("(post_id)", DB_POSTS, "forum_id='".$_GET['forum_id']."'"); $result = dbquery("update ".DB_FORUMS." set forum_lastpost='".$lastPost['post_datestamp']."', forum_lastuser='".$lastPost['post_author']."', forum_postcount='$postCount' where forum_id='".$_GET['forum_id']."'"); opentable($locale['fb225']); echo "

".$locale['fb231']."
\n"; if(!$delete) echo "".$locale['fb232']." :: \n"; echo "".$locale['fb233']." :: \n"; echo "".$locale['402']." :: \n"; echo "".$locale['403']."

\n"; } else { opentable($locale['fb225']); if(isset($_GET['status']) && $_GET['status'] == "notfound") echo "
".$locale['fb234']."

\n"; echo "
\n"; echo "\n"; echo "\n\n\n\n"; echo "
".$locale['fb226'].""; echo "
\n"; closetable(); tablebreak(); opentable($locale['fb218']); $result = dbquery("select * from ".DB_POSTS." p left join ".DB_USERS." u on u.user_id=p.post_author where p.thread_id='".$_GET['thread_id']."'"); while($data = dbarray($result)){ echo "\n"; echo "\n\n\n"; echo "\n\n\n"; echo "
".$locale['fb219']."".showdate("forumdate", $data['post_datestamp'])."".$locale['fb220']; echo "".$data['user_name']."\n"; echo " ".$locale['fb221']."
".nl2br(trimlink($data['post_message'], 120))."

\n"; } echo "
\n
\n"; } closetable(); } else { redirect("index.php"); } // require_once THEMES."templates/footer.php"; ?>