From: Lo?c C. <lo...@us...> - 2001-03-29 19:05:33
|
Update of /cvsroot/phpmychat/phpMyChat - 0.14/chat In directory usw-pr-cvs1:/tmp/cvs-serv28757 Modified Files: usersH.php3 Log Message: Arg, another (and best I hope) fix for Netscape ***** Bogus filespec: - ***** Bogus filespec: 0.14/chat Index: usersH.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat - 0.14/chat/usersH.php3,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** usersH.php3 2001/03/24 14:17:28 1.8 --- usersH.php3 2001/03/29 19:05:29 1.9 *************** *** 90,267 **** //** Build users list for the current room ** ! if(C_DB_TYPE == 'mysql') { ! $DbLink->query("SELECT ".C_USR_TBL.".username, ".C_USR_TBL.".latin1, status, gender FROM ".C_USR_TBL." LEFT JOIN ".C_REG_TBL." ON ".C_USR_TBL.".username = ".C_REG_TBL.".username WHERE room='$R' ORDER BY username"); ! echo("<B>".htmlspecialchars(stripslashes($R))."</B><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$DbLink->num_rows().")</SPAN><BR>\n"); ! echo("<DIV STYLE=\"margin-bottom: 10px\">\n"); ! while(list($User, $Latin1, $status, $gender) = $DbLink->next_record()) ! { ! // Put an icon when there is a profile for the user ! if($gender == 0) ! $gender = 'undefined'; ! elseif($gender == 1) ! $gender = 'boy'; ! elseif($gender == 2) ! $gender = 'girl'; ! else ! $gender = 'none'; ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") ! { ! $ImgNum++; ! $Cmd2Send = ($User == stripslashes($U) ? "'PROFILE',''" : "'WHOIS','".special_char2($User,$Latin1)."'"); ! echo('<a href="#" onClick="window.parent.runCmd('.$Cmd2Send.'); return false;" class="user"><img name="whoisImg'.$ImgNum.'" src="images/gender_'.$gender.'.gif" width="14" height="14" border="0" alt="'.L_PROFILE.'"></a> '); ! //echo("<A HREF=\"#\" onClick=\"window.parent.runCmd($Cmd2Send); return false;\" CLASS=\"user\" onmouseover=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOn.src\" onmouseout=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOff.src\"><IMG NAME=\"whoisImg$ImgNum\" SRC=\"images/whoisOff.gif\" WIDTH=5 HEIGHT=9 BORDER=0 ALT=\"".L_PROFILE."\"></A> "); ! } ! else ! { ! echo('<img name="whoisImg'.$ImgNum.'" src="images/gender_none.gif" width="14" height="14" border="0" alt="Pas de profil"> '); ! //echo("- "); ! }; ! if($User != stripslashes($U)) ! { ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($User,$Latin1)."',false);\" CLASS=\"user\">".special_char($User,$Latin1,$status)."</A><BR>\n"); ! } ! else ! { ! echo(special_char($User,$Latin1,$status)."<BR>\n"); ! } ! } ! echo("</DIV>\n"); ! $DbLink->clean_results(); ! //** Build users list for other rooms ** ! $AddPwd2Link = (isset($PWD_Hash) && $PWD_Hash != "") ? "&PWD_Hash=$PWD_Hash" : ""; ! $DbLink->query("SELECT DISTINCT room FROM ".C_MSG_TBL." WHERE room != '$R' AND type = 1 ORDER BY room"); ! if($DbLink->num_rows() > 0) ! { ! $i = 0; ! $ChildNb = Array(); ! $OthersUsers = new DB; ! while(list($Other) = $DbLink->next_record()) ! { ! $OthersUsers->query("SELECT ".C_USR_TBL.".username, ".C_USR_TBL.".latin1, status, gender FROM ".C_USR_TBL." LEFT JOIN ".C_REG_TBL." ON ".C_USR_TBL.".username = ".C_REG_TBL.".username WHERE room = '".addslashes($Other)."' ORDER BY username"); ! if($OthersUsers->num_rows() > 0) ! { ! $i++; ! $id = md5($Other); ! if ($i == 1) $FirstOtherRoom = "Parent".$id; ! echo("<DIV ID=\"Parent${id}\" CLASS=\"parent\" STYLE=\"margin-top: 5px; CURSOR: hand\">"); ! echo("<A HREF=\"#\" onClick=\"window.parent.expandIt('${id}'); return false\">"); ! echo("<IMG NAME=\"imEx\" SRC=\"images/closed.gif\" WIDTH=9 HEIGHT=9 BORDER=0 ALT=\"".L_EXPCOL."\"></A>"); ! echo(" <A HREF=\"$From?Ver=H&L=$L&U=".urlencode(stripslashes($U))."$AddPwd2Link&R1=".urlencode($Other)."&T=1&D=$D&N=$N&E=".urlencode(stripslashes($R))."&EN=$T\" TARGET=\"_parent\">".htmlspecialchars($Other)."</A><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$OthersUsers->num_rows().")</SPAN>"); ! echo("</DIV>\n"); ! echo("<DIV ID=\"Child${id}\" CLASS=\"child\" STYLE=\"margin-left: 12px\">\n"); ! $j = 0; ! while(list($OtherUser, $Latin1, $status, $gender) = $OthersUsers->next_record()) ! { ! $j++; ! // Put an icon when there is a profile for the user ! if($gender == 0) ! $gender = 'undefined'; ! elseif($gender == 1) ! $gender = 'boy'; ! elseif($gender == 2) ! $gender = 'girl'; ! else ! $gender = 'none'; ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") ! { ! $ImgNum++; ! //echo("<A HREF=\"#\" onClick=\"window.parent.runCmd('WHOIS','".special_char2($OtherUser,$Latin1)."'); return false;\" CLASS=\"user\" onmouseover=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOn.src\" onmouseout=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOff.src\"><IMG NAME=\"whoisImg$ImgNum\" SRC=\"images/whoisOff.gif\" WIDTH=5 HEIGHT=9 BORDER=0 ALT=\"".L_PROFILE."\"></A> "); ! echo('<a href="#" onClick="window.parent.runCmd(\'WHOIS\',\''.special_char2($OtherUser,$Latin1).'\'); return false;" class="user"><img name="whoisImg'.$ImgNum.'" src="images/gender_'.$gender.'.gif" width="14" height="14" border="0" alt="'.L_PROFILE.'"></a> '); ! } ! else ! { ! //echo("- "); ! echo('<img name="whoisImg'.$ImgNum.'" src="images/gender_none.gif" width="14" height="14" border="0" alt="Pas de profil"> '); ! }; ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($OtherUser,$Latin1)."',false);\" CLASS=\"user\">".special_char($OtherUser,$Latin1,$status)."</A><BR>\n"); ! }; ! echo("</DIV>\n"); ! $ChildNb[$id] = $j; ! } ! $OthersUsers->clean_results(); ! } } - $DbLink->clean_results(); - $DbLink->close(); } ! else { ! $DbLink->query("SELECT username, latin1, status FROM ".C_USR_TBL." WHERE room='$R' ORDER BY username"); ! echo("<B>".htmlspecialchars(stripslashes($R))."</B><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$DbLink->num_rows().")</SPAN><BR>\n"); ! echo("<DIV STYLE=\"margin-bottom: 10px\">\n"); ! while(list($User, $Latin1, $status, $gender) = $DbLink->next_record()) { ! // Put an icon when there is a profile for the user ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") { ! $ImgNum++; ! $Cmd2Send = ($User == stripslashes($U) ? "'PROFILE',''" : "'WHOIS','".special_char2($User,$Latin1)."'"); ! echo("<A HREF=\"#\" onClick=\"window.parent.runCmd($Cmd2Send); return false;\" CLASS=\"user\" onmouseover=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOn.src\" onmouseout=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOff.src\"><IMG NAME=\"whoisImg$ImgNum\" SRC=\"images/whoisOff.gif\" WIDTH=5 HEIGHT=9 BORDER=0 ALT=\"".L_PROFILE."\"></A> "); } else - { - echo("- "); - }; - if($User != stripslashes($U)) { ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($User,$Latin1)."',false);\" CLASS=\"user\">".special_char($User,$Latin1,$status)."</A><BR>\n"); } - else - { - echo(special_char($User,$Latin1,$status)."<BR>\n"); - } - } - echo("</DIV>\n"); - $DbLink->clean_results(); ! //** Build users list for other rooms ** ! $AddPwd2Link = (isset($PWD_Hash) && $PWD_Hash != "") ? "&PWD_Hash=$PWD_Hash" : ""; ! $DbLink->query("SELECT DISTINCT room FROM ".C_MSG_TBL." WHERE room != '$R' AND type = 1 ORDER BY room"); ! if($DbLink->num_rows() > 0) ! { ! $i = 0; ! $ChildNb = Array(); ! $OthersUsers = new DB; ! while(list($Other) = $DbLink->next_record()) { ! $OthersUsers->query("SELECT username, latin1, status FROM ".C_USR_TBL." WHERE room = '".addslashes($Other)."' ORDER BY username"); ! if($OthersUsers->num_rows() > 0) { ! $i++; ! $id = md5($Other); ! if ($i == 1) $FirstOtherRoom = "Parent".$id; ! echo("<DIV ID=\"Parent${id}\" CLASS=\"parent\" STYLE=\"margin-top: 5px; CURSOR: hand\">"); ! echo("<A HREF=\"#\" onClick=\"window.parent.expandIt('${id}'); return false\">"); ! echo("<IMG NAME=\"imEx\" SRC=\"images/closed.gif\" WIDTH=9 HEIGHT=9 BORDER=0 ALT=\"".L_EXPCOL."\"></A>"); ! echo(" <A HREF=\"$From?Ver=H&L=$L&U=".urlencode(stripslashes($U))."$AddPwd2Link&R1=".urlencode($Other)."&T=1&D=$D&N=$N&E=".urlencode(stripslashes($R))."&EN=$T\" TARGET=\"_parent\">".htmlspecialchars($Other)."</A><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$OthersUsers->num_rows().")</SPAN>"); ! echo("</DIV>\n"); ! echo("<DIV ID=\"Child${id}\" CLASS=\"child\" STYLE=\"margin-left: 12px\">\n"); ! $j = 0; ! while(list($OtherUser,$Latin1,$status) = $OthersUsers->next_record()) { ! $j++; ! // Put an icon when there is a profile for the user ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") ! { ! $ImgNum++; ! echo("<A HREF=\"#\" onClick=\"window.parent.runCmd('WHOIS','".special_char2($OtherUser,$Latin1)."'); return false;\" CLASS=\"user\" onmouseover=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOn.src\" onmouseout=\"document.images['whoisImg$ImgNum'].src = window.parent.imgWhoisOff.src\"><IMG NAME=\"whoisImg$ImgNum\" SRC=\"images/whoisOff.gif\" WIDTH=5 HEIGHT=9 BORDER=0 ALT=\"".L_PROFILE."\"></A> "); ! } ! else ! { ! echo("- "); ! }; ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($OtherUser,$Latin1)."',false);\" CLASS=\"user\">".special_char($OtherUser,$Latin1,$status)."</A><BR>\n"); ! }; ! echo("</DIV>\n"); ! $ChildNb[$id] = $j; } ! $OthersUsers->clean_results(); } } - $DbLink->clean_results(); - $DbLink->close(); } // Display all rest default rooms --- 90,235 ---- //** Build users list for the current room ** ! if (C_DB_TYPE == 'mysql') { ! $currentRoomQuery = 'SELECT usr.username, usr.latin1, usr.status, reg.gender ' ! . 'FROM ' . C_USR_TBL . ' usr LEFT JOIN ' . C_REG_TBL . ' reg ON usr.username = reg.username ' ! . 'WHERE usr.room = \'' . $R . '\' ' ! . 'ORDER BY usr.username'; ! } ! else if (C_DB_TYPE == 'pgsql') ! { ! $currentRoomQuery = 'SELECT usr.username, usr.latin1, usr.status, reg.gender ' ! . 'FROM ' . C_USR_TBL . ' usr, ' . C_REG_TBL . ' reg ' ! . 'WHERE usr.room = \'' . $R . '\' ' ! . 'UNION ' ! . 'SELECT usr.username, usr.latin1, usr.status, NULL ' ! . 'FROM ' . C_USR_TBL . ' usr ' ! . 'WHERE usr.username NOT IN (SELECT reg.username FROM ' . C_REG_TBL . ' reg) AND usr.room = \'' . $R . '\' ' ! . 'ORDER BY usr.username'; ! } ! else ! { ! $currentRoomQuery = 'SELECT usr.username, usr.latin1, usr.status, NULL ' ! . 'FROM ' . C_USR_TBL . ' usr ' ! . 'WHERE usr.room = \'' . $R . '\' ' ! . 'ORDER BY usr.username'; ! } ! $DbLink->query($currentRoomQuery); ! echo("<B>".htmlspecialchars(stripslashes($R))."</B><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$DbLink->num_rows().")</SPAN><BR>\n"); ! echo("<DIV STYLE=\"margin-bottom: 10px\">\n"); ! while(list($User, $Latin1, $status, $gender) = $DbLink->next_record()) ! { ! // Put an icon when there is a profile for the user ! if($gender == 0) ! $gender = 'undefined'; ! elseif($gender == 1) ! $gender = 'boy'; ! elseif($gender == 2) ! $gender = 'girl'; ! else ! $gender = 'none'; ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") ! { ! $ImgNum++; ! $Cmd2Send = ($User == stripslashes($U) ? "'PROFILE',''" : "'WHOIS','".special_char2($User,$Latin1)."'"); ! echo('<a href="#" onClick="window.parent.runCmd('.$Cmd2Send.'); return false;" class="user"><img name="whoisImg'.$ImgNum.'" src="images/gender_'.$gender.'.gif" width="14" height="14" border="0" alt="'.L_PROFILE.'"></a> '); ! } ! else ! { ! echo('<img name="whoisImg'.$ImgNum.'" src="images/gender_none.gif" width="14" height="14" border="0" alt="Pas de profil"> '); ! } ! if($User != stripslashes($U)) ! { ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($User,$Latin1)."',false);\" CLASS=\"user\">".special_char($User,$Latin1,$status)."</A><BR>\n"); ! } ! else ! { ! echo(special_char($User,$Latin1,$status)."<BR>\n"); } } ! echo("</DIV>\n"); ! $DbLink->clean_results(); ! ! //** Build users list for other rooms ** ! $AddPwd2Link = (isset($PWD_Hash) && $PWD_Hash != "") ? "&PWD_Hash=$PWD_Hash" : ""; ! $DbLink->query("SELECT DISTINCT room FROM ".C_MSG_TBL." WHERE room != '$R' AND type = 1 ORDER BY room"); ! if($DbLink->num_rows() > 0) { ! $i = 0; ! $ChildNb = Array(); ! $OthersUsers = new DB; ! while(list($Other) = $DbLink->next_record()) { ! if (C_DB_TYPE == 'mysql') { ! $otherRoomsQuery = 'SELECT usr.username, usr.latin1, usr.status, reg.gender ' ! . 'FROM ' . C_USR_TBL . ' usr LEFT JOIN ' . C_REG_TBL . ' reg ON usr.username = reg.username ' ! . 'WHERE usr.room = \'' . addslashes($Other) . '\' ' ! . 'ORDER BY usr.username'; ! } ! else if (C_DB_TYPE == 'pgsql') ! { ! $otherRoomsQuery = 'SELECT usr.username, usr.latin1, usr.status, reg.gender ' ! . 'FROM ' . C_USR_TBL . ' usr, ' . C_REG_TBL . ' reg ' ! . 'WHERE usr.room = \'' . addslashes($Other) . '\' ' ! . 'UNION ' ! . 'SELECT usr.username, usr.latin1, usr.status, 0 ' ! . 'FROM ' . C_USR_TBL . ' usr ' ! . 'WHERE usr.username NOT IN (SELECT reg.username FROM ' . C_REG_TBL . ' reg) AND usr.room = \'' . addslashes($Other) . '\' ' ! . 'ORDER BY usr.username'; } else { ! $otherRoomsQuery = 'SELECT usr.username, usr.latin1, usr.status, 0 ' ! . 'FROM ' . C_USR_TBL . ' usr ' ! . 'WHERE usr.room = \'' . addslashes($Other) . '\' ' ! . 'ORDER BY usr.username'; } ! $OthersUsers->query($otherRoomsQuery); ! if($OthersUsers->num_rows() > 0) { ! $i++; ! $id = md5($Other); ! if ($i == 1) $FirstOtherRoom = "Parent".$id; ! echo("<DIV ID=\"Parent${id}\" CLASS=\"parent\" STYLE=\"margin-top: 5px; CURSOR: hand\">"); ! echo("<A HREF=\"#\" onClick=\"window.parent.expandIt('${id}'); return false\">"); ! echo("<IMG NAME=\"imEx\" SRC=\"images/closed.gif\" WIDTH=9 HEIGHT=9 BORDER=0 ALT=\"".L_EXPCOL."\"></A>"); ! echo(" <A HREF=\"$From?Ver=H&L=$L&U=".urlencode(stripslashes($U))."$AddPwd2Link&R1=".urlencode($Other)."&T=1&D=$D&N=$N&E=".urlencode(stripslashes($R))."&EN=$T\" TARGET=\"_parent\">".htmlspecialchars($Other)."</A><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (".$OthersUsers->num_rows().")</SPAN>"); ! echo("</DIV>\n"); ! echo("<DIV ID=\"Child${id}\" CLASS=\"child\" STYLE=\"margin-left: 12px\">\n"); ! $j = 0; ! while(list($OtherUser, $Latin1, $status, $gender) = $OthersUsers->next_record()) { ! $j++; ! // Put an icon when there is a profile for the user ! if($gender == 0) ! $gender = 'undefined'; ! elseif($gender == 1) ! $gender = 'boy'; ! elseif($gender == 2) ! $gender = 'girl'; ! else ! $gender = 'none'; ! if ($status != "u" && $status != "k" && $status != "d" && $status != "b") { ! $ImgNum++; ! echo('<a href="#" onClick="window.parent.runCmd(\'WHOIS\',\''.special_char2($OtherUser,$Latin1).'\'); return false;" class="user"><img name="whoisImg'.$ImgNum.'" src="images/gender_'.$gender.'.gif" width="14" height="14" border="0" alt="'.L_PROFILE.'"></a> '); ! } ! else ! { ! echo('<img name="whoisImg'.$ImgNum.'" src="images/gender_none.gif" width="14" height="14" border="0" alt="Pas de profil"> '); ! } ! echo("<A HREF=\"javascript:window.parent.userClick('".special_char2($OtherUser,$Latin1)."',false);\" CLASS=\"user\">".special_char($OtherUser,$Latin1,$status)."</A><BR>\n"); } ! echo("</DIV>\n"); ! $ChildNb[$id] = $j; } + $OthersUsers->clean_results(); } } + $DbLink->clean_results(); + $DbLink->close(); // Display all rest default rooms *************** *** 270,279 **** $tmpRoom = stripslashes($DefaultChatRooms[$k]); $id = md5($tmpRoom); - if (!isset($FirstOtherRoom) && $k == 0) - $FirstOtherRoom = "Parent".$id; // Display this room name when it hadn't been displayed yet if (strcasecmp($tmpRoom, stripslashes($R)) != 0 && (!isset($ChildNb) || !isset($ChildNb[$id]))) { echo("<DIV ID=\"Parent${id}\" CLASS=\"parent\" STYLE=\"margin-top: 5px; CURSOR: hand\">"); echo("<A HREF=\"$From?Ver=H&L=$L&U=".urlencode(stripslashes($U))."$AddPwd2Link&R0=".urlencode($tmpRoom)."&T=1&D=$D&N=$N&E=".urlencode(stripslashes($R))."&EN=$T\" TARGET=\"_parent\">".htmlspecialchars($tmpRoom)."</A><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (0)</SPAN>"); --- 238,248 ---- $tmpRoom = stripslashes($DefaultChatRooms[$k]); $id = md5($tmpRoom); // Display this room name when it hadn't been displayed yet if (strcasecmp($tmpRoom, stripslashes($R)) != 0 && (!isset($ChildNb) || !isset($ChildNb[$id]))) { + if (!isset($FirstOtherRoom)) + $FirstOtherRoom = "Parent".$id; + echo("<DIV ID=\"Parent${id}\" CLASS=\"parent\" STYLE=\"margin-top: 5px; CURSOR: hand\">"); echo("<A HREF=\"$From?Ver=H&L=$L&U=".urlencode(stripslashes($U))."$AddPwd2Link&R0=".urlencode($tmpRoom)."&T=1&D=$D&N=$N&E=".urlencode(stripslashes($R))."&EN=$T\" TARGET=\"_parent\">".htmlspecialchars($tmpRoom)."</A><SPAN CLASS=\"small\"><BDO dir=\"${textDirection}\"></BDO> (0)</SPAN>"); |