1. <?php
  2. require("ipcheck.php");
  3. require("./lib/killtags.lib.php");
  4.  
  5. /**********************************************************
  6.  ******* *********
  7.  ******* These lines are commented out as a test. *********
  8.  ******* It is likely that they are not needed, *********
  9.  ******* and are a major contributor to the all *********
  10.  ******* of the chat's security vulnerabilites. *********
  11.  ******* *********
  12.  **********************************************************/
  13.  
  14. // Get the names and values for vars sent by index.lib.php3
  15. //if (isset($HTTP_GET_VARS))
  16. //{
  17. // while(list($name,$value) = each($HTTP_GET_VARS))
  18. // {
  19. // $$name = killtags($value);
  20. // };
  21. //};
  22. //
  23. // *********** END TEST ***********************************
  24.  
  25. // Get the names and values for post vars
  26. if (isset($HTTP_POST_VARS))
  27. {
  28. while(list($name,$value) = each($HTTP_POST_VARS))
  29. {
  30. $$name = killtags($value);
  31. };
  32. };
  33.  
  34. require("./config/config.lib.php3");
  35. require("./localization/english/localized.chat.php3");
  36. require("./lib/release.lib.php3");
  37. require("./lib/database/".C_DB_TYPE.".lib.php3");
  38. require("./lib/clean.lib.php3");
  39. require("sanitize.inc");
  40.  
  41. header("Content-Type: text/html; charset=${Charset}");
  42.  
  43. // avoid server configuration for magic quotes
  44. set_magic_quotes_runtime(0);
  45.  
  46. $U = urldecode($U);
  47. $R = urldecode($R);
  48. $P = urldecode($P);
  49.  
  50. $R = str_replace("*", "", $R);
  51. if ($T != 0 && $T != 1) $T = 1;
  52.  
  53. // Translate to html special characters, and entities if message was sent with a latin 1 charset
  54. $Latin1 = ($Charset == "iso-8859-1");
  55. function special_char($str,$lang)
  56. {
  57. return addslashes($lang ? htmlentities(stripslashes($str)) : htmlspecialchars(stripslashes($str)));
  58. };
  59.  
  60. $DbLink = new DB;
  61.  
  62. // ** Updates user info in connected users tables and fix some security issues **
  63. // Fixed a security issue thanks to SeazoN
  64. if (C_REQUIRE_REGISTER && (!isset($PWD_Hash) || $PWD_Hash == ''))
  65. {
  66. header("Location: index.php?KICKED=5");
  67. }
  68. else if (isset($PWD_Hash) && $PWD_Hash != '')
  69. {
  70. $DbLink->query( 'SELECT ' . C_USR_TBL . '.room, ' . C_USR_TBL . '.status, ' . C_USR_TBL . '.timeout, ' . C_USR_TBL. '.ip'
  71. . ' FROM ' . C_USR_TBL . ', ' . C_REG_TBL
  72. . ' WHERE ' . C_USR_TBL . '.username = \'' . addslashes($U) . '\''
  73. . ' AND ' . C_REG_TBL . '.username = \'' . addslashes($U) . '\''
  74. . ' AND ' . C_REG_TBL . '.password = \'' . addslashes($PWD_Hash) . '\''
  75. . ' LIMIT 1');
  76. }
  77. else // C_REQUIRE_REGISTER == 0 && $PWD_Hash is empty
  78. {
  79. $DbLink->query('SELECT username FROM ' . C_REG_TBL . ' WHERE username = \'' . addslashes($U) . '\' LIMIT 1');
  80. if ($DbLink->num_rows() == 0)
  81. {
  82. $DbLink->query('SELECT room, status, timeout, ip FROM ' . C_USR_TBL . ' WHERE username = \'' . addslashes($U) . '\' LIMIT 1');
  83. }
  84. else
  85. {
  86. $DbLink->clean_results();
  87. $DbLink->close();
  88. // exit(); // hack attack
  89. header("Location: index.php?KICKED=5");
  90. }
  91. }
  92. // End of SeazoN Fix
  93.  
  94. // ** Updates user info in connected users tables **
  95. //$DbLink->query("SELECT room,status,timeout FROM ".C_USR_TBL." WHERE username = '" . addslashes($U) . "' LIMIT 1");
  96. if ($DbLink->num_rows() != 0)
  97. {
  98. list($room,$status,$timeout) = $DbLink->next_record();
  99. //$DbLink->clean_results();
  100. $kicked = 0;
  101.  
  102. if (in_array($R, $LimitUsersIn))
  103. {
  104. // Count the number of users currently in the room the user wants to enter
  105. $DbLink->query("SELECT * FROM " . C_USR_TBL . " WHERE room = '" . addslashes($R) . "' AND status != 'g' AND status != 'a' AND status != 'o'");
  106. $MinReached = $DbLink->num_rows();
  107.  
  108. // If the user count is equal to the min number of users, engage the autokick.
  109. if ($MinReached >= AUTOKICK_MIN_USRS)
  110. {
  111. if ($status != "o" && $status != "a" && $status != "g")
  112. {
  113. if ($timeout < time())
  114. {
  115. $status = "t";
  116. }
  117. }
  118. }
  119. }
  120.  
  121. if ( isset($R) && ($room != stripslashes($R))) // Same nick in another room
  122. {
  123. // Add an exit notification if room is not in $NoNotifyRooms array
  124. if (!in_array($R, $NoNotifyRooms))
  125. {
  126. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', 'SYS exit', '', ".time().", '', 'sprintf(L_EXIT_ROM, \"".special_char($U,$Latin1)."\")','','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  127. };
  128.  
  129. unset($P);
  130. $kicked = 3;
  131. }
  132. elseif ($status == "k") // Kicked by a moderator or the admin.
  133. {
  134. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', 'SYS exit', '', ".time().", '', 'sprintf(L_KICKED, \"".special_char($U,$Latin1)."\")','','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  135. unset($P);
  136. $kicked = 1;
  137. }
  138. elseif ($status == "d") // The admin just deleted the room
  139. {
  140. unset($P);
  141. $kicked = 2;
  142. }
  143. elseif ($status == "b") // Banished by a moderator or the admin.
  144. {
  145. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', 'SYS exit', '', ".time().", '', 'sprintf(L_BANISHED, \"".special_char($U,$Latin1)."\")','','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  146. unset($P);
  147. $kicked = 4;
  148. }
  149. elseif ($status == "t") // User timed out due to no activity.
  150. {
  151. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', 'SYS exit', '', ".time().", '', 'sprintf(L_TIMEOUT, \"".special_char($U,$Latin1,1)."\")','','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  152. unset($P);
  153. $kicked = 5;
  154. };
  155. /* Rhonda ban fix 1/24/10 */
  156. if ($kicked > 0)
  157. {
  158. // Kick the user from the current room
  159.  
  160. // see rhonda.functions.php
  161. destroyUser();
  162.  
  163. ?>
  164. <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
  165. <!--
  166. window.parent.window.location = '<?php echo("$From?L=$L&U=".urlencode(stripslashes($U))."&P=".urlencode(stripslashes($P))."&E=".urlencode(stripslashes($R))."&KICKED=${kicked}"); ?>';
  167. // -->
  168. </SCRIPT>
  169. <?php
  170. $DbLink->close();
  171. exit;
  172. }
  173. /* End Rhonda ban fix */
  174. }
  175. else
  176. {
  177. exit();
  178. }
  179.  
  180.  
  181. // ** Send formated messages to the message table **
  182. function AddMessage($M, $T, $R, $U, $C, $Private, $P="")
  183. {
  184. global $DbLink;
  185. global $Latin1;
  186. global $status;
  187.  
  188. // Text formating tags
  189.  
  190.  
  191.  
  192.  
  193. //USELESS FUCKING REGEX. GRRRRR - RHONDA
  194.  
  195. // keep U, B and I tags
  196. $M = str_replace("<", "<", $M);
  197. $M = str_replace(">", ">", $M);
  198.  
  199. if(function_exists("preg_match"))
  200. {
  201. while(preg_match("/<([ubi]?)>(.*?)<(\/\\1)>/i",$M))
  202. {
  203. $M = preg_replace("/<([ubi]?)>(.*?)<(\/\\1)>/i","<\\1>\\2<\\3>",$M);
  204. }
  205.  
  206. }
  207.  
  208.  
  209.  
  210. // URL
  211. $M = eregi_replace('([[:space:]]|^)(www)', '\\1http://\\2', $M); // no prefix (www.myurl.ext)
  212. $prefix = '(http|https|ftp|telnet|news|gopher|file|wais)://';
  213. $pureUrl = '([[:alnum:]/\n+-=%&:_.~?]+[#[:alnum:]+]*)';
  214. $M = eregi_replace($prefix . $pureUrl, '<a href="\\1://\\2" target="_blank">\\1://\\2</a>', $M);
  215.  
  216. // e-mail addresses
  217. $M = eregi_replace('([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)', '<a href="mailto:\\1">\\1</a>', $M);
  218.  
  219.  
  220. // Fix for Broken Tags in URLs
  221. // Counts occurrences of simple HTML tags (<u><b><i>). Then counts occurrences of closing tags.
  222. // If the number of opening tags does not match the number of closing tags, the missing closing
  223. // tags are added automatically. Since this problem only occurs when entering URL links, the
  224. // </a> tag is also added, even though it's not absolutely needed.
  225. // Written without using RegExps for simplicity.
  226. $b_lower_count = substr_count($M, '<b>');
  227. $b_upper_count = substr_count($M, '<B>');
  228.  
  229. $u_lower_count = substr_count($M, '<u>');
  230. $u_upper_count = substr_count($M, '<U>');
  231.  
  232. $i_lower_count = substr_count($M, '<i>');
  233. $i_upper_count = substr_count($M, '<I>');
  234.  
  235. $b_lower_close_count = substr_count($M, '</b>');
  236. $b_upper_close_count = substr_count($M, '</B>');
  237.  
  238. $u_lower_close_count = substr_count($M, '</u>');
  239. $u_upper_close_count = substr_count($M, '</U>');
  240.  
  241. $i_lower_close_count = substr_count($M, '</i>');
  242. $i_upper_close_count = substr_count($M, '</I>');
  243.  
  244. If ($b_lower_count != $b_lower_close_count) $M = $M . "</b></a>";
  245. If ($u_lower_count != $u_lower_close_count) $M = $M . "</u></a>";
  246. If ($i_lower_count != $i_lower_close_count) $M = $M . "</i></a>";
  247.  
  248. If ($b_upper_count != $b_upper_close_count) $M = $M . "</b></a>";
  249. If ($u_upper_count != $u_upper_close_count) $M = $M . "</u></a>";
  250. If ($i_upper_count != $i_upper_close_count) $M = $M . "</i></a>";
  251. //
  252. // End Fix
  253.  
  254. // Rhonda's fix for HTML tags [3/12/10]
  255. // Allow font [and 'color'] tag to be used
  256. $M = strip_tags($M, '<b><i><u><font>');
  257.  
  258. // End Rhonda's fix
  259.  
  260.  
  261. // Smilies
  262. if (C_USE_SMILIES == 1)
  263. {
  264. include("./lib/smilies.lib.php3");
  265. Check4Smilies($M,$SmiliesTbl);
  266. unset($SmiliesTbl);
  267. };
  268.  
  269. // transform ISO-8859-1 special characters
  270. if ($Latin1)
  271. {
  272. global $MsgTo;
  273. ereg("(.*)(".$MsgTo."(>)?)(.*)",$M,$Regs);
  274. if ($MsgTo != "" && ($Regs[1] == "" && $Regs[4] == "")) $Regs[4] = $M;
  275. if (!ereg("&[[:alnum:]]{1,10};",$Regs[1]) && !ereg("&[[:alnum:]]{1,10};",$Regs[4]))
  276. {
  277. for ($i = 1; $i <= 4; $i++)
  278. {
  279. if (($i != 1 && $i != 4) || $Regs[$i] == "") continue;
  280. $part = $Regs[$i];
  281. $part = htmlentities($part);
  282. $part = str_replace("<", "<", $part);
  283. $part = str_replace(">", ">", $part);
  284. $part = str_replace("&lt;", "<", $part);
  285. $part = str_replace("&gt;", ">", $part);
  286. $part = str_replace(""","\"", $part);
  287. $part = ereg_replace("&(#[[:digit:]]{2,5};)", "&\\1", $part);
  288. $Regs[$i] = $part;
  289. }
  290. $M = $Regs[1].$Regs[2].$Regs[4];
  291. }
  292. }
  293.  
  294. if (isset($C) and $C != "")
  295. {
  296. // Red colors are reserved to the admin or a moderator for the current room
  297. if ((ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $C))
  298. && !($status == "a" || $status == "m" || $status == "g" || $status == "o")) // MODIFIED FOR GLOBAL MOD
  299. $C = "#00FF00";
  300. $M = "<FONT COLOR=\"".$C."\"> ".$M." </FONT>";
  301. };
  302.  
  303. // Get user's current alias
  304. $DbLink->clean_results();
  305. $DbLink->query("SELECT alias FROM ".C_USR_TBL." WHERE username='" . addslashes($U) . "' LIMIT 1");
  306. $found = ($DbLink->num_rows() != 0);
  307. if ($found) {
  308. list($A) = $DbLink->next_record();
  309. } else {
  310. $A = "";
  311. }
  312. //$DbLink->clean_results();
  313.  
  314. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', '".addslashes($U)."', '$Latin1', ".time().", '$Private', '".addslashes($M)."','" . addslashes($A) . "','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  315.  
  316. // Update the user's "timeout" value
  317. $DbLink->query("UPDATE " . C_USR_TBL . " SET timeout = " . (time() + (C_USR_TIMEOUT*60)) . " WHERE username = '" . addslashes($U) . "'");
  318.  
  319. // Experimental
  320. $namearray = array('karma');
  321. if (in_array(strtolower($U), $namearray) || in_array(strtolower($Private), $namearray) || in_array(strtolower($A), $namearray))
  322. {
  323. // Log activity
  324. $LogFile = "/home/roleplay/cosmos-rp.com/administrative/panel/commlogs/export.php";
  325.  
  326. $FileStream = fopen($LogFile, "a");
  327. if (!$FileStream)
  328. {
  329. echo("Could not open the log file. Contact the SysOp.");
  330. exit;
  331. }
  332.  
  333. $ToWrite = "\n" . $T . "\n" . $R . "\n" . $U. "\n" . $_SERVER["REMOTE_ADDR"] . "\n" . date("H:i:s", time()) . "\n" . $Private . "\n" . $M . "\n" . $A . $P;
  334. $ToWrite .= "\n\n";
  335.  
  336. fwrite($FileStream, $ToWrite);
  337. fclose($FileStream);
  338. };
  339. // End Experimental
  340.  
  341. // Record Moderated rooms to their own table.
  342. if( $R == "MainStage" )
  343. {
  344. $DbLink->query("INSERT INTO c_messages_mainstage VALUES ($T, '" . addslashes($R) . "', '".addslashes($U)."', '$Latin1', ".time().", '$Private', '".addslashes($M)."','" . addslashes($A) . "','" . addslashes($P) . "')");
  345. };
  346. if( $R == "StageLeft" )
  347. {
  348. $DbLink->query("INSERT INTO c_messages_stageleft VALUES ($T, '" . addslashes($R) . "', '".addslashes($U)."', '$Latin1', ".time().", '$Private', '".addslashes($M)."','" . addslashes($A) . "','" . addslashes($P) . "')");
  349. };
  350. }
  351.  
  352. // ** Define the default color that will be used for messages **
  353. if (isset($HTTP_COOKIE_VARS["CookieColor".$U])) $CookieColor = $HTTP_COOKIE_VARS["CookieColor".$U];
  354. if (isset($CookieColor) && $CookieColor != "") $C = $CookieColor; // ADDED FOR COLOR SAVE ACROSS ROOMS AND LOGOUT
  355. if(!isset($C))
  356. {
  357. if(!isset($CookieColor))
  358. {
  359. // set default color to white
  360. $C = "#efeeee";
  361. }
  362. elseif (ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $CookieColor))
  363. {
  364. // Red colors are reserved to the admin or a moderator for the current room
  365. if (!(isset($status) && ($status == "a" || $status == "m"))) $C = "#efeeee";
  366. }
  367.  
  368. if (!isset($C))
  369. {
  370. $C = $CookieColor;
  371. }
  372. }
  373. setcookie("CookieColor".$U, $C, time() + 60*60*24*365); // cookie expires in one year
  374.  
  375. // ** Test for online commands and swear words **
  376. $IsCommand = false;
  377. $RefreshMessages = false;
  378. $IsPopup = false;
  379. $IsM = false;
  380. if (isset($M) && trim($M) != "" && ereg("^(\/|\:)", $M)) include("./lib/commands.lib.php3");
  381. if (isset($M) && ereg("^(\/|\:)", $M) && !($IsCommand) && !isset($Error)) $Error = L_BAD_CMD;
  382. if (isset($M) && trim($M) != "" && (!isset($M0) || ($M != $M0)) && !($IsCommand || isset($Error)))
  383. {
  384.  
  385. /***********************************
  386. // If moderated room - don't allow
  387. global $DefaultModRooms;
  388. global $DbLink;
  389. $isModerated = false;
  390. for ($i = 0; $i < count($DefaultModRooms); $i++)
  391. {
  392. if( $R == $DefaultModRooms[$i] )
  393. {
  394. $isModerated = true;
  395. break;
  396. };
  397. };
  398. if( $isModerated )
  399. {
  400. // Verify that this is not a moderator or admin
  401. $DbLink->query("SELECT perms,rooms FROM ".C_REG_TBL." WHERE username='" . addslashes($U) . "' LIMIT 1");
  402. $reguser = ($DbLink->num_rows() != 0);
  403. if ($reguser) list($perms,$rooms) = $DbLink->next_record();
  404. //$DbLink->clean_results();
  405. // Get user status
  406. if ($reguser)
  407. {
  408. switch ($perms)
  409. {
  410. case 'admin':
  411. $isModerated = false;
  412. break;
  413. // ADDED FOR GLOBAL MOD
  414. case 'globalmod':
  415. $isModerated = false;
  416. break;
  417. // END GLOBAL MOD ADD
  418. case 'sysop':
  419. $isModerated = false;
  420. break;
  421. case 'moderator':
  422. $roomsTab = explode(",",$rooms);
  423. for (reset($roomsTab); $room_name=current($roomsTab); next($roomsTab))
  424. {
  425. if (strcasecmp(stripslashes($R), $room_name) == 0)
  426. {
  427. $isModerated = false;
  428. break;
  429. };
  430. };
  431. };
  432. };
  433. }
  434. if( $isModerated )
  435. {
  436. $Error = L_ERR_USR_22;
  437. } else
  438. {
  439. *******************************/
  440. // Normal Talk
  441. // Bob Dickow Custom code for /away command modification:
  442. if (C_NO_SWEAR == 1 || in_array($R, $FilteredRooms))
  443. {
  444. include("./lib/swearing.lib.php3");
  445. $M = checkwords($M, false);
  446. }
  447.  
  448. // Check for all caps
  449. if (in_array($R, $NoCapRooms))
  450. {
  451. include("./lib/captest.lib.php");
  452. $M = checkCaps($M);
  453. };
  454.  
  455. $DbLink->query("SELECT awaystat FROM ".C_USR_TBL." WHERE username='" . addslashes($U) . "'");
  456.  
  457. if ($DbLink->num_rows() != 0)
  458. {
  459. list($awaystat) = $DbLink->next_record();
  460. }
  461. //$DbLink->clean_results();
  462.  
  463. if ($awaystat == '1') {
  464. $Msg = sprintf(L_BACK . C_UPDTUSRS, special_char($U,$Latin1));
  465. $Msg = " <B>$Msg</B>";
  466. $awaystat = '0';
  467. $C = sanitize($C);
  468. AddMessage(stripslashes($M), $T, $R, $U, $C, "",$P);
  469. $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '" . addslashes($R) . "', '".addslashes($U)."', '$Latin1', ".time().", '$Private', '".addslashes($Msg)."', '" . addslashes($A) . "','" . addslashes($P) . "','" . $_SERVER['REMOTE_ADDR'] . "')");
  470. $DbLink->query("UPDATE ".C_USR_TBL." SET awaystat='0' WHERE username='" . addslashes($U) . "'");
  471. } else {
  472. AddMessage(stripslashes($M), $T, $R, $U, $C, "",$P);
  473. }
  474. $RefreshMessages = true;
  475. // END Bob Dickow custom code for /away command modification.
  476. /****
  477. } // moderation
  478. ****/
  479.  
  480. }
  481.  
  482. $DbLink->close();
  483. ?>
  484. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  485. <HTML dir="<?php echo(($Charset == "windows-1256") ? "RTL" : "LTR"); ?>">
  486.  
  487. <HEAD>
  488. <TITLE>Hidden Input frame</TITLE>
  489. <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.2">
  490. <!--
  491. if (typeof(window.parent.frames['input']) != 'undefined'
  492. && typeof(window.parent.frames['input'].window.document.forms['MsgForm']) != 'undefined'
  493. && window.parent.frames['input'].window.document.forms['MsgForm'].elements['sent'] != '0')
  494. {
  495.  
  496. /* Udate the Form at the 'input' frame */
  497. with (window.parent.frames['input'].window.document.forms['MsgForm'])
  498. {
  499. elements['D'].value = "<?php echo($D); ?>";
  500. elements['N'].value = "<?php echo($N); ?>";
  501. elements['O'].value = "<?php echo($O); ?>";
  502. elements['ST'].value = "<?php echo($ST); ?>";
  503. elements['NT'].value = "<?php echo($NT); ?>";
  504. elements['Ign'].value = "<?php echo(isset($Ign) ? htmlspecialchars(stripslashes($Ign)) : ""); ?>";
  505. elements['M0'].value = "<?php echo(isset($M) ? htmlspecialchars(stripslashes($M)) : ""); ?>";
  506.  
  507. // Get the value to put in the message box : previous M0 field value for /! command,
  508. // previous entry if it was an erroneous command, else nothing;
  509. <?php
  510. $ValM = $IsM ? $M0 : "";
  511. if (isset($Error) && !($IsCommand)) $ValM = $M;
  512. ?>
  513. elements['M'].value = "<?php echo(htmlspecialchars(stripslashes($ValM))); ?>";
  514.  
  515. elements['MsgTo'].value = "";
  516. elements['C'].value = "<?php echo($C); ?>";
  517. elements['P'].value = "<?php echo($P); ?>";
  518. elements['sent'].value = "0";
  519.  
  520. if (document.all) elements['sendForm'].disabled = false;
  521. };
  522.  
  523. <?php
  524. if ($RefreshMessages)
  525. {
  526. $Tmp = (isset($Ign) && $Ign != "") ? "&Ign=".urlencode(stripslashes($Ign)) : "";
  527. $First = isset($First) ? $First : 0;
  528. ?>
  529. /* Refresh the message frame or append messages to it */
  530. <?php
  531. if ($First) echo("window.parent.frames['messages'].window.document.close();\n\twindow.parent.connect = 0;\n");
  532. ?>
  533. if (window.parent.connect == 0)
  534. {
  535. window.parent.refresh_query = "<?php echo("From=".urlencode($From)."&L=$L&U=".urlencode(stripslashes($U))."&P=".urlencode(stripslashes($P))."&R=".urlencode(stripslashes($R))."&T=$T&D=$D&N=$N&ST=$ST&NT=$NT".$Tmp."&First=$First"); ?>";
  536. window.parent.force_refresh();
  537. };
  538. <?php
  539. };
  540.  
  541. if(isset($Error))
  542. {
  543. ?>
  544. /* Display a JavaScript alert box with the error message */
  545. window.parent.frames['input'].window.document.forms['MsgForm'].elements['M'].select();
  546. alert("<?php echo(str_replace("\\\\n","\\n",addslashes($Error))); ?>");
  547. <?php
  548. };
  549. ?>
  550.  
  551. <?php
  552. $posted_var_list = "From=$From&Ver=$Ver&L=$L&U=$U&P=$P&R=$R&T=$T&D=$D&N=$N&O=$O&ST=$ST&NT=$NT";
  553. if (isset($PWD_Hash) && $PWD_Hash != "") $posted_var_list .= "&PWD_Hash=$PWD_Hash";
  554. $posted_var_list .= "&dummy=".uniqid(""); // Force reload from the server (not from the cache)
  555.  
  556. if (isset($status) && ($status == "m" || $status == "g" || $status == "o")) // MODIFIED FOR GLOBAL MOD
  557. {
  558. ?>
  559. /* Add the red color when the user has been promoted to moderator */
  560. if (!window.parent.isModerator)
  561. {
  562. window.parent.frames['input'].window.location.replace("input.php3?<?php echo($posted_var_list); ?>");
  563. window.parent.isModerator = 1;
  564. }
  565. <?php
  566. }
  567. elseif (!isset($status) || ($status != "a" && $status != "g" && $status != "o")) // MODIFIED FOR GLOBAL MOD
  568. {
  569. ?>
  570. /* Remove the red color when the user has became a 'simple user */
  571. if (window.parent.isModerator)
  572. {
  573. window.parent.frames['input'].window.location.replace("input.php3?<?php echo($posted_var_list); ?>");
  574. window.parent.isModerator = 0;
  575. }
  576. <?php
  577. };
  578. ?>
  579. };
  580. // -->
  581. </SCRIPT>
  582. </HEAD>
  583.  
  584. <BODY>
  585. <?php
  586. // Display JavaScript instructions that commands may have set
  587. if (isset($jsTbl))
  588. {
  589. for (reset($jsTbl); $jsInst=current($jsTbl); next($jsTbl))
  590. {
  591. echo("$jsInst\n");
  592. };
  593. unset($jsTbl);
  594. }
  595. else
  596. {
  597. echo("\t<!-- Not a blank document ;) -->\n");
  598. };
  599. ?>
  600. </BODY>
  601.  
  602. </HTML>
  603.