Changeset 374 for minimanager/forum.php
- Timestamp:
- Sep 11, 2008, 9:10:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/forum.php
r307 r374 93 93 require_once("scripts/forum.conf.php"); 94 94 require_once("scripts/extra_lib.php"); 95 valid_login( 0);95 valid_login($action_permission['read']); 96 96 97 97 if (isset($_COOKIE["lang"])){ 98 98 $forumlang = $_COOKIE["lang"]; 99 if (!file_exists("lang/ Forum_$forumlang.php")) $forumlang = $language;99 if (!file_exists("lang/forum_$forumlang.php")) $forumlang = $language; 100 100 } else $forumlang = $language; 101 require_once("lang/ Forum_$forumlang.php");101 require_once("lang/forum_$forumlang.php"); 102 102 103 103 foreach($forum_skeleton as $cid => $category){ … … 118 118 // ####################################################################################################### 119 119 function forum_index(){ 120 global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $output, $realm_db ;120 global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $output, $realm_db, $mmfpm_db; 121 121 if($enablesidecheck) 122 122 $side = get_side(); 123 123 $mysql = new SQL; 124 $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);125 $result = $mysql->query("SELECT `authorname`,`id`,`name`,`time`,`forum` FROM ` posts` WHERE `id` IN (SELECT MAX(`id`) FROM `posts` GROUP BY `forum`) ORDER BY `forum`;");124 $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 125 $result = $mysql->query("SELECT `authorname`,`id`,`name`,`time`,`forum` FROM `forum_posts` WHERE `id` IN (SELECT MAX(`id`) FROM `forum_posts` GROUP BY `forum`) ORDER BY `forum`;"); 126 126 $lasts = array(); 127 127 if($mysql->num_rows($result) > 0){ … … 154 154 } 155 155 } 156 $totaltopics = $mysql->query("SELECT id FROM posts WHERE forum = '$id' AND id = `topic`;");156 $totaltopics = $mysql->query("SELECT id FROM forum_posts WHERE forum = '$id' AND id = `topic`;"); 157 157 $numtopics = $mysql->num_rows($totaltopics); 158 $totalreplies = $mysql->query("SELECT id FROM posts WHERE forum = '$id';");158 $totalreplies = $mysql->query("SELECT id FROM forum_posts WHERE forum = '$id';"); 159 159 $numreplies = $mysql->num_rows($totalreplies); 160 160 $output .= "<tr><td align=\"left\"><a href=\"forum.php?action=view_forum&id=$id\">{$forum["name"]}</a><br />{$forum["desc"]}</td> … … 179 179 // ####################################################################################################### 180 180 function forum_view_forum(){ 181 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $output, $ realm_db;181 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $output, $mmfpm_db; 182 182 if($enablesidecheck) $side = get_side(); 183 183 $mysql = new SQL; 184 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);184 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 185 185 if(!isset($_GET["id"])) error($forum_lang["no_such_forum"]); 186 186 else $id = $mysql->quote_smart($_GET["id"]); … … 216 216 $output .= "<div class=\"top\"><h1>{$forum_lang["forums"]}</h1>{$forum_lang["you_are_here"]} : <a href=\"forum.php\">{$forum_lang["forum_index"]}</a> -> <a href=\"forum.php?action=view_forum&id={$id}\">{$forum["name"]}</a></div> 217 217 <center><table class=\"lined\">"; 218 $topics = $mysql->query("SELECT id, authorid, authorname, name, annouced, sticked, closed FROM posts WHERE (forum = '$id' AND id = `topic`) OR annouced = 1 AND id = `topic` ORDER BY annouced DESC, sticked DESC, lastpost DESC LIMIT $start, $maxqueries;");219 $result = $mysql->query("SELECT `topic` as curtopic,(SELECT count(`id`)-1 FROM posts WHERE `topic` = `curtopic`) AS replies,lastpost as curlastpost,(SELECT authorname FROM posts WHERE id = curlastpost) as authorname,(SELECT time FROM posts WHERE id = curlastpost) as time FROM `posts` WHERE (`forum` = $id AND `topic` = `id` ) OR annouced = 1;");218 $topics = $mysql->query("SELECT id, authorid, authorname, name, annouced, sticked, closed FROM forum_posts WHERE (forum = '$id' AND id = `topic`) OR annouced = 1 AND id = `topic` ORDER BY annouced DESC, sticked DESC, lastpost DESC LIMIT $start, $maxqueries;"); 219 $result = $mysql->query("SELECT `topic` as curtopic,(SELECT count(`id`)-1 FROM forum_posts WHERE `topic` = `curtopic`) AS replies,lastpost as curlastpost,(SELECT authorname FROM forum_posts WHERE id = curlastpost) as authorname,(SELECT time FROM forum_posts WHERE id = curlastpost) as time FROM `forum_posts` WHERE (`forum` = $id AND `topic` = `id` ) OR annouced = 1;"); 220 220 $lasts = array(); 221 221 if($mysql->num_rows($result) > 0){ … … 251 251 </tr>"; 252 252 } 253 $totaltopics = $mysql->query("SELECT id FROM posts WHERE forum = '$id' AND id = `topic`;"); //My page system is so roxing, i can' t break this query xD253 $totaltopics = $mysql->query("SELECT id FROM forum_posts WHERE forum = '$id' AND id = `topic`;"); //My page system is so roxing, i can' t break this query xD 254 254 $pages = ceil($mysql->num_rows($totaltopics)/$maxqueries); 255 255 $output .= "<tr><td align=\"right\" colspan=\"4\">{$forum_lang["pages"]} : "; … … 271 271 function forum_view_topic(){ 272 272 273 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $realm_db, $characters_db, $realm_id ;273 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $realm_db, $characters_db, $realm_id, $mmfpm_db; 274 274 275 275 if($enablesidecheck) $side = get_side(); // Better to use it here instead of call it many time in the loop :) 276 276 277 277 $mysql = new SQL; 278 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);278 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 279 279 280 280 if(isset($_GET["id"])){ … … 297 297 298 298 if(!$post){ 299 $posts = $mysql->query("SELECT id,authorid,authorname,forum,name,text,time,annouced,sticked,closed FROM posts WHERE topic = '$id' ORDER BY id ASC LIMIT $start, $maxqueries;");299 $posts = $mysql->query("SELECT id,authorid,authorname,forum,name,text,time,annouced,sticked,closed FROM forum_posts WHERE topic = '$id' ORDER BY id ASC LIMIT $start, $maxqueries;"); 300 300 301 301 // Thx qsa for the query structure 302 303 $link = $mysql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); 304 302 305 $query = "SELECT account,name,SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ', 37),' ',-1) AS gen,race,class, 303 306 SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',35),' ',-1) AS level,(SELECT gmlevel FROM `{$realm_db['name']}`.account WHERE `{$realm_db['name']}`.account.id = `{$characters_db[$realm_id]['name']}`.characters.account) as gmlevel … … 454 457 } 455 458 456 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);457 458 $totalposts = $mysql->query("SELECT id FROM posts WHERE topic = '$id';");459 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 460 461 $totalposts = $mysql->query("SELECT id FROM forum_posts WHERE topic = '$id';"); 459 462 $totalposts = $mysql->num_rows($totalposts); 460 463 … … 520 523 $output .= "<div class=\"top\"><h1>Stand by...</h1></div>"; 521 524 522 $post = $mysql->query("SELECT topic, id FROM posts WHERE id = '$id'"); // Get our post id525 $post = $mysql->query("SELECT topic, id FROM forum_posts WHERE id = '$id'"); // Get our post id 523 526 if($mysql->num_rows($post)==0) 524 527 error($forum_lang["no_such_topic"]); … … 527 530 redirect("forum.php?action=view_topic&id=$id"); 528 531 $topic = $post[0]; 529 $posts = $mysql->query("SELECT id FROM posts WHERE topic = '$topic';"); // Get posts in our topic532 $posts = $mysql->query("SELECT id FROM forum_posts WHERE topic = '$topic';"); // Get posts in our topic 530 533 $replies = $mysql->num_rows($posts); 531 534 if($replies==0) … … 547 550 } 548 551 function forum_do_edit_close(){ 549 global $forum_lang, $user_lvl, $ realm_db;550 $mysql = new SQL; 551 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);552 global $forum_lang, $user_lvl, $mmfpm_db; 553 $mysql = new SQL; 554 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 552 555 553 556 if($user_lvl == 0) … … 560 563 else $state = $mysql->quote_smart($_GET["state"]); 561 564 562 $mysql->query("UPDATE posts SET closed = '$state' WHERE id = '$id'");565 $mysql->query("UPDATE forum_posts SET closed = '$state' WHERE id = '$id'"); 563 566 $mysql->close(); 564 567 redirect("forum.php?action=view_topic&id=$id"); … … 566 569 } 567 570 function forum_do_edit_announce(){ 568 global $forum_lang, $user_lvl, $ realm_db;569 $mysql = new SQL; 570 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);571 global $forum_lang, $user_lvl, $mmfpm_db; 572 $mysql = new SQL; 573 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 571 574 572 575 if($user_lvl == 0) … … 579 582 else $state = $mysql->quote_smart($_GET["state"]); 580 583 581 $mysql->query("UPDATE posts SET annouced = '$state' WHERE id = '$id'");584 $mysql->query("UPDATE forum_posts SET annouced = '$state' WHERE id = '$id'"); 582 585 $mysql->close(); 583 586 redirect("forum.php?action=view_topic&id=$id"); … … 585 588 } 586 589 function forum_do_edit_stick(){ 587 global $forum_lang, $user_lvl, $ realm_db;588 $mysql = new SQL; 589 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);590 global $forum_lang, $user_lvl, $mmfpm_db; 591 $mysql = new SQL; 592 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 590 593 591 594 if($user_lvl == 0) … … 598 601 else $state = $mysql->quote_smart($_GET["state"]); 599 602 600 $mysql->query("UPDATE posts SET sticked = '$state' WHERE id = '$id'");603 $mysql->query("UPDATE forum_posts SET sticked = '$state' WHERE id = '$id'"); 601 604 $mysql->close(); 602 605 redirect("forum.php?action=view_topic&id=$id"); … … 604 607 } 605 608 function forum_delete_post(){ 606 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $ realm_db;607 $mysql = new SQL; 608 609 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);609 global $enablesidecheck, $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $mmfpm_db; 610 $mysql = new SQL; 611 612 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 610 613 if(!isset($_GET["id"])) error($forum_lang["no_such_post"]); 611 614 else $id = $mysql->quote_smart($_GET["id"]); 612 615 613 $topic = $mysql->query("SELECT id,topic,authorid,forum FROM posts WHERE id = '$id';");616 $topic = $mysql->query("SELECT id,topic,authorid,forum FROM forum_posts WHERE id = '$id';"); 614 617 if($mysql->num_rows($topic)==0) error($forum_lang["no_such_post"]); 615 618 $topic = $mysql->fetch_row($topic); … … 617 620 $fid = $topic[3]; 618 621 619 $topic2 = $mysql->query("SELECT name FROM posts WHERE id = '{$topic[1]}';");622 $topic2 = $mysql->query("SELECT name FROM forum_posts WHERE id = '{$topic[1]}';"); 620 623 $name = $mysql->fetch_row($topic2); 621 624 … … 642 645 } 643 646 function forum_do_delete_post(){ 644 global $forum_lang, $forum_skeleton, $maxqueries, $user_lvl, $user_id, $output, $ realm_db;645 646 $mysql = new SQL; 647 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);647 global $forum_lang, $forum_skeleton, $maxqueries, $user_lvl, $user_id, $output, $mmfpm_db; 648 649 $mysql = new SQL; 650 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 648 651 649 652 if(!isset($_GET["id"])) error($forum_lang["no_such_post"]); 650 653 else $id = $mysql->quote_smart($_GET["id"]); 651 654 652 $topic = $mysql->query("SELECT id,topic,name,authorid,forum FROM posts WHERE id = '$id';");655 $topic = $mysql->query("SELECT id,topic,name,authorid,forum FROM forum_posts WHERE id = '$id';"); 653 656 if($mysql->num_rows($topic)==0) error($forum_lang["no_such_post"]); 654 657 $topic = $mysql->fetch_row($topic); … … 657 660 658 661 if($id==$topic[1]){ 659 $mysql->query("DELETE FROM posts WHERE topic = '$id'");662 $mysql->query("DELETE FROM forum_posts WHERE topic = '$id'"); 660 663 redirect("forum.php?action=view_forum&id=$fid"); 661 664 } 662 665 else 663 666 { 664 $mysql->query("DELETE FROM posts WHERE id = '$id'");665 $result = $mysql->query("SELECT id FROM posts WHERE topic = '{$topic[1]}' ORDER BY id DESC LIMIT 1;"); // get last post id667 $mysql->query("DELETE FROM forum_posts WHERE id = '$id'"); 668 $result = $mysql->query("SELECT id FROM forum_posts WHERE topic = '{$topic[1]}' ORDER BY id DESC LIMIT 1;"); // get last post id 666 669 $lastpostid = $mysql->fetch_row($result); 667 670 $lastpostid = $lastpostid[0]; 668 $mysql->query("UPDATE posts SET lastpost = '$lastpostid' WHERE id = '{$topic[1]}'"); // update topic' s last post id671 $mysql->query("UPDATE forum_posts SET lastpost = '$lastpostid' WHERE id = '{$topic[1]}'"); // update topic' s last post id 669 672 redirect("forum.php?action=view_topic&id={$topic[1]}"); 670 673 } … … 673 676 674 677 function forum_add_topic(){ 675 global $enablesidecheck, $forum_lang, $forum_skeleton, $maxqueries, $minfloodtime, $user_lvl, $user_id, $output, $ realm_db;678 global $enablesidecheck, $forum_lang, $forum_skeleton, $maxqueries, $minfloodtime, $user_lvl, $user_id, $output, $mmfpm_db; 676 679 677 680 if($enablesidecheck) $side = get_side(); // Better to use it here instead of call it many time in the loop :) 678 681 $mysql = new SQL; 679 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);682 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 680 683 681 684 if($minfloodtime > 0) 682 685 { 683 $userposts = $mysql->query("SELECT time FROM posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;");686 $userposts = $mysql->query("SELECT time FROM forum_posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;"); 684 687 if($mysql->num_rows($userposts) != 0) 685 688 { … … 766 769 } 767 770 function forum_do_add_topic(){ 768 global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $user_name, $user_id, $ realm_db, $minfloodtime;771 global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $user_name, $user_id, $mmfpm_db, $minfloodtime; 769 772 770 773 if($enablesidecheck) $side = get_side(); // Better to use it here instead of call it many time in the loop :) 771 774 772 775 $mysql = new SQL; 773 $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);776 $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 774 777 775 778 776 779 { 777 $userposts = $mysql->query("SELECT time FROM posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;");780 $userposts = $mysql->query("SELECT time FROM forum_posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;"); 778 781 if($mysql->num_rows($userposts) != 0) 779 782 { … … 839 842 $time = date("m/d/y H:i:s"); 840 843 841 $mysql->query("INSERT INTO posts (authorid, authorname, forum, name, text, time) VALUES ('$user_id', '$user_name', '$forum', '$name', '$msg', '$time');");844 $mysql->query("INSERT INTO forum_posts (authorid, authorname, forum, name, text, time) VALUES ('$user_id', '$user_name', '$forum', '$name', '$msg', '$time');"); 842 845 $id = $mysql->insert_id(); 843 $mysql->query("UPDATE posts SET topic = '$id', lastpost = '$id' WHERE id = '$id';");846 $mysql->query("UPDATE forum_posts SET topic = '$id', lastpost = '$id' WHERE id = '$id';"); 844 847 845 848 $mysql->close(); … … 849 852 } 850 853 function forum_do_add_post(){ 851 global $enablesidecheck, $forum_skeleton, $forum_lang, $minfloodtime, $user_lvl, $user_name, $user_id, $ realm_db;854 global $enablesidecheck, $forum_skeleton, $forum_lang, $minfloodtime, $user_lvl, $user_name, $user_id, $mmfpm_db; 852 855 853 856 if($enablesidecheck) $side = get_side(); // Better to use it here instead of call it many time in the loop :) 854 857 855 858 $mysql = new SQL; 856 $link = $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);859 $link = $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 857 860 858 861 if($minfloodtime > 0) 859 862 { 860 $userposts = $mysql->query("SELECT time FROM posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;");863 $userposts = $mysql->query("SELECT time FROM forum_posts WHERE authorid = '$user_id' ORDER BY id DESC LIMIT 1;"); 861 864 if($mysql->num_rows($userposts) != 0) 862 865 { … … 912 915 } 913 916 914 $name = $mysql->query("SELECT name FROM posts WHERE id = '$topic';");917 $name = $mysql->query("SELECT name FROM forum_posts WHERE id = '$topic';"); 915 918 $name = $mysql->fetch_row($name); 916 919 $name = $mysql->quote_smart($name[0]); … … 918 921 $time = date("m/d/y H:i:s"); 919 922 920 $mysql->query("INSERT INTO posts (authorid, authorname, forum, topic, name, text, time) VALUES ('$user_id', '$user_name', '$forum', $topic, '$name', '$msg', '$time');");923 $mysql->query("INSERT INTO forum_posts (authorid, authorname, forum, topic, name, text, time) VALUES ('$user_id', '$user_name', '$forum', $topic, '$name', '$msg', '$time');"); 921 924 $id = @mysql_insert_id($link); 922 $mysql->query("UPDATE posts SET lastpost = $id WHERE id = $topic;");925 $mysql->query("UPDATE forum_posts SET lastpost = $id WHERE id = $topic;"); 923 926 924 927 $mysql->close(); … … 929 932 930 933 function forum_edit_post(){ 931 global $forum_skeleton, $forum_lang, $maxqueries, $minfloodtime, $user_lvl, $user_id, $output, $ realm_db;932 933 $mysql = new SQL; 934 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);934 global $forum_skeleton, $forum_lang, $maxqueries, $minfloodtime, $user_lvl, $user_id, $output, $mmfpm_db; 935 936 $mysql = new SQL; 937 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 935 938 936 939 if(!isset($_GET["id"])) error($forum_lang["no_such_post"]); 937 940 else $id = $mysql->quote_smart($_GET["id"]); 938 941 939 $post = $mysql->query("SELECT id,topic,authorid,forum,name,text FROM posts WHERE id = '$id';");942 $post = $mysql->query("SELECT id,topic,authorid,forum,name,text FROM forum_posts WHERE id = '$id';"); 940 943 if($mysql->num_rows($post)==0) error($forum_lang["no_such_post"]); 941 944 $post = $mysql->fetch_row($post); … … 1008 1011 } 1009 1012 function forum_do_edit_post(){ 1010 global $forum_lang, $user_lvl, $user_name, $user_id, $ realm_db;1011 1012 $mysql = new SQL; 1013 $link = $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);1013 global $forum_lang, $user_lvl, $user_name, $user_id, $mmfpm_db; 1014 1015 $mysql = new SQL; 1016 $link = $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 1014 1017 1015 1018 if(!isset($_POST['forum'])) error($forum_lang["no_such_forum"]); … … 1045 1048 // $msg = str_replace('\r', '<br />', $msg); 1046 1049 1047 $result = $mysql->query("SELECT topic FROM posts WHERE id = $post;");1050 $result = $mysql->query("SELECT topic FROM forum_posts WHERE id = $post;"); 1048 1051 $topicid = $mysql->fetch_row($result); 1049 1052 1050 $mysql->query("UPDATE posts SET text = '$msg' WHERE id = $post;");1053 $mysql->query("UPDATE forum_posts SET text = '$msg' WHERE id = $post;"); 1051 1054 1052 1055 if($topic == 1){ 1053 $mysql->query("UPDATE posts SET name = '$name' WHERE topic = {$topicid[0]};");1054 } 1055 1056 $result = $mysql->query("SELECT topic FROM posts WHERE id = $post;");1056 $mysql->query("UPDATE forum_posts SET name = '$name' WHERE topic = {$topicid[0]};"); 1057 } 1058 1059 $result = $mysql->query("SELECT topic FROM forum_posts WHERE id = $post;"); 1057 1060 $topicid = $mysql->fetch_row($result); 1058 1061 … … 1063 1066 1064 1067 function forum_move_topic(){ 1065 global $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $ realm_db;1066 $mysql = new SQL; 1067 1068 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);1068 global $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $mmfpm_db; 1069 $mysql = new SQL; 1070 1071 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 1069 1072 if(!isset($_GET["id"])) error($forum_lang["no_such_topic"]); 1070 1073 else $id = $mysql->quote_smart($_GET["id"]); 1071 1074 1072 $topic = $mysql->query("SELECT id,topic,authorid,forum, name FROM posts WHERE id = '$id';");1075 $topic = $mysql->query("SELECT id,topic,authorid,forum, name FROM forum_posts WHERE id = '$id';"); 1073 1076 // 0 1 2 3 4 1074 1077 if($mysql->num_rows($topic)==0) error($forum_lang["no_such_topic"]); … … 1108 1111 } 1109 1112 function forum_do_move_topic(){ 1110 global $forum_lang, $forum_skeleton, $maxqueries, $user_lvl, $user_id, $output, $ realm_db;1111 1112 $mysql = new SQL; 1113 $link = $mysql->connect($ realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);1113 global $forum_lang, $forum_skeleton, $maxqueries, $user_lvl, $user_id, $output, $mmfpm_db; 1114 1115 $mysql = new SQL; 1116 $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); 1114 1117 1115 1118 if(!isset($_POST['forum'])) error($forum_lang["no_such_forum"]); … … 1118 1121 else $id = $mysql->quote_smart($_POST['id']); 1119 1122 1120 $mysql->query("UPDATE posts SET forum = '$forum' WHERE topic = '$id'"); // update topic' s last post id1123 $mysql->query("UPDATE forum_posts SET forum = '$forum' WHERE topic = '$id'"); // update topic' s last post id 1121 1124 redirect("forum.php?action=view_topic&id=$id"); 1122 1125 // Queries : 1
Note:
See TracChangeset
for help on using the changeset viewer.