Useravatar auch in den privaten Nachrichten

Begonnen von Liu-Kang, 26 Dezember 2004, 12:46:21

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

Liu-Kang

Mir ist gerade aufgefallen, daß in den privaten Nachrichten nur die Standartavatare angezeigt werden statt den von den Usern hochgeladenen.
Wie kann man das in der read.php ändern?

NeMeSiSX2LC

Was für eine Version benutzt du bitte?? beim neuen MX gibt es keine read.php
CMS-Version: pragmaMx 0.1.8, 1.20.4.5/2006-03-10     
PHP-Version: 5.1.2
MySQL-Version: 5.0.15-max-log
Server-Version: Apache/2.0.55
phpMyAdmin-Version: 2.7.0-pl1

Liu-Kang

Ich benutze die vkpMX 2.1.
Ich hatte es in der read.php vermutet :).

NeMeSiSX2LC

Ja aber diese file gibt es nicht das read ist er operator ;) Aber eigentlich müsste das wiedergeben werden. Ahnung scheinst du ja zu haben. Deshalb guck dir mal die index.php vom PN an
CMS-Version: pragmaMx 0.1.8, 1.20.4.5/2006-03-10     
PHP-Version: 5.1.2
MySQL-Version: 5.0.15-max-log
Server-Version: Apache/2.0.55
phpMyAdmin-Version: 2.7.0-pl1

Liu-Kang


BowlingX

Also eigentlich sollten die Avatare angezeigt werden..müsste ich nochmal schauen...
Kein Support über Mail, (ungefragter) PN oder ICQ, ausschließlich direkt im Forum!

Liu-Kang

Also bei mir wird immer nur der Kerl mit der Tüte über dem Kopf dargestellt.
Image URL ist immer images/forum/avatar/040.gif

Musicman75

Unaufgeforderte Support PMs & Emails werden ignoriert

Immer erst die Boardsuche verwenden und gegebenenfalls einen neuen Threat eröffnen, wenn das Problem noch nicht behandelt wurde!

Musicman75

Habe das jetzt nochmal getestet. Wenn ein User ein Standartavatar hat, wir das auch korrekt angezeigt. Wenn ein User allerdings ein eigenes Avatar hochgeladen hat, wird die Tüte angezeigt.

Ich Code ist dieser Teil für die Avataranzeigt zuständig:

if (!empty($posterdata["user_avatar"]) && $posterdata["user_avatar"] != "blank.gif"){
if(mxIsAvatarUploaded($posterdata["uname"])) {
echo mxIsAvatarUploaded($posterdata["uname"],true);
}
else {
echo "<img src=\"$url_avatar/".$posterdata["user_avatar"]."\" alt=\"".$posterdata["uname"]."\"><br>\n";
}
}
else{
echo "<img src=\"$url_avatar/$blankavatar\" alt=\"".$posterdata["uname"]."\"><br>\n";
}


ich schau mal, ob ich da ne lösung finde.
Unaufgeforderte Support PMs & Emails werden ignoriert

Immer erst die Boardsuche verwenden und gegebenenfalls einen neuen Threat eröffnen, wenn das Problem noch nicht behandelt wurde!

Musicman75

ich habe die Lösung:

dieser code ist der funktionierende, der auskommentierte der orginale:

#############
if(mxIsAvatarUploaded($posterdata["uname"])) {

echo "".mxIsAvatarUploaded($posterdata["uname"],true);

}

else {

if (!empty($posterdata['user_avatar'])) echo "<img src='".MX_PATH_AVATAR."/".$posterdata['user_avatar']."' border=0>";

}
#############
# if (!empty($posterdata["user_avatar"]) && $posterdata["user_avatar"] != "blank.gif"){
# if(mxIsAvatarUploaded($posterdata["uname"])) {
# echo mxIsAvatarUploaded($posterdata["uname"],true);
# }
# else {
# echo "<img src=\"$url_avatar/".$posterdata["user_avatar"]."\" alt=\"".$posterdata["uname"]."\"><br>\n";
# }
# }
# else{
# echo "<img src=\"$url_avatar/$blankavatar\" alt=\"".$posterdata["uname"]."\"><br>\n";
# }


In der index.php bei den Funktionen: readmessage und  readsentmessage ändern, dann geht es.

Gruß
Steff
Unaufgeforderte Support PMs & Emails werden ignoriert

Immer erst die Boardsuche verwenden und gegebenenfalls einen neuen Threat eröffnen, wenn das Problem noch nicht behandelt wurde!

rinaldo2000at

Bei mir wird jetzt überhaupt kein Avatar mehr angezeigt nachdem ich diesen Code von Musicman75 verwendet habe, ist bei mir noch ein fehler drinnen?
Welche zeile stimmt nicht?

if (!defined("mxMainFileLoaded")) die ("You can't access this file directly...");
$module_name = basename(dirname(__FILE__));

// Link verwendet in Sprachdateien
if (!defined("_PMSBBCODELINK")) define("_PMSBBCODELINK","<a href=\"#\" onClick=\"window.open('modules.php?name=".$module_name."&file=bbcode','pmbbcode','left=10, top=10, width=640,height=480,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0'); return false;\">");

######################################################################
function msgindex($uid){
global $prefix, $user_prefix, $module_name, $url_smiles, $subjectdefaulticon, $url_images, $url_button;
global $bgcolor1, $bgcolor2, $bgcolor3, $textcolor1, $textcolor2, $popupwidth,$poptableborder;
$uid = (int)$uid;
$qry="SELECT ".$prefix."_priv_msgs.*, UNIX_TIMESTAMP(msg_time) as msgtimestamp, ".$user_prefix."_users.uname as fromname "
."FROM ".$prefix."_priv_msgs LEFT JOIN ".$user_prefix."_users ON ".$prefix."_priv_msgs.from_userid = ".$user_prefix."_users.uid "
."WHERE (to_userid = $uid) and (from_userid > 1) order by msg_time desc;";
$result = sql_query($qry);
if (!$result) {
prvmsgerror(_ERRMSGDATABASE);
}
if (!$total_messages = sql_num_rows($result)) {
$havemessages=0;
}
else {
$havemessages=1;
printOverlibDiv();
$pm_overlib = new Overlib();
echo "<script language=\"javascript\" src=\"modules/$module_name/javascript.js\">\n</script>\n";
}
$count=0;
echo "<form name=\"prvmsg\" method=\"post\" action=\"modules.php\">\n";
echo "<input type=\"hidden\" name=\"name\" value=\"".$module_name."\">\n";
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" width=\"100%\" bgcolor=\"$bgcolor2\">\n";
if (!$havemessages) {
echo "<tr bgcolor=\"$bgcolor3\">\n\t<td colspan=\"6\" align=\"center\"><br><br><br><b>"._PMSDONTHAVESOME."</b><br><br><br></td>\n</tr>\n";
}
else {
echo "<tr bgcolor=\"$bgcolor2\">\n"
."\t<td bgcolor=\"$bgcolor2\" align=\"center\"><input name=\"allbox\" onclick=\"CheckAll();\" type=\"checkbox\" value=\""._PMSCHECKALL."\" style=\"background-color: transparent;\"></td>\n"
."\t<td bgcolor=\"$bgcolor2\" align=\"center\"><img src=\"$url_images/down.gif\" border=\"0\" alt=\""._PMSMSGSTATUS."\"></td>\n"
."\t<td bgcolor=\"$bgcolor2\" align=\"center\">&nbsp;</td>\n"
."\t<td><font class=\"content\" color=\"$textcolor2\"><b>"._PMSFROM."</b></font></td>\n"
."\t<td align=\"center\"><font class=\"content\" color=\"$textcolor2\"><b>"._PMSSUBJECT."</b></font></td>\n"
."\t<td align=\"center\"><font class=\"content\" color=\"$textcolor2\"><b>"._PMSDATE."</b></font></td>\n"
."</tr>\n";
while ($row = sql_fetch_array($result)) {
if (empty($row["msg_image"])) $row["msg_image"]=$subjectdefaulticon;
if (empty($row["fromname"])) $row["fromname"]="";
$postedtime= mx_strftime(_PMSTIMESTRING,$row["msgtimestamp"]);
$row["subject"] = strip_tags($row["subject"]);
$row["subject"] = smile($row["subject"]);

$row["msg_text"] = strip_tags($row["msg_text"],"<img><br><hr><b><i>");
#$row["msg_text"] = str_replace(array('&#41;','&#124;'),array(')','|'),$row["msg_text"]); /// macht mxSecureValue() rückgängig
$row["msg_text"] = pmPrepDisplay($row["msg_text"]);

$pm_overlib->ol_capicon=$url_smiles."/".$row["msg_image"];
$pm_overlib->ol_delay = 200;
$pm_overlib->ol_hauto = "True";
$pm_overlib->ol_vauto = "True";
$myover=$pm_overlib->vover(pmValueToText($row["msg_text"]),pmValueToText($row["subject"]));
echo "<tr>\n\t<td bgcolor=\"$bgcolor1\" width=\"2%\" align=\"center\"><input type=\"checkbox\" onclick=\"CheckCheckAll();\" name=\"msg_id[$count]\" value=\"".(int)$row["msg_id"]."\" style=\"background-color: transparent;\">";
echo "</td>\n";
echo "\t<td width=\"5%\" align=\"center\" bgcolor=\"$bgcolor1\">";
if ($row["read_msg"] == 1) {
echo "&nbsp;";
}
else {
echo "<img src=\"$url_images/read.gif\" border=\"0\" alt=\""._PMSNOTREAD."\">";
}
echo "</td>\n";
echo "\t<td bgcolor=\"$bgcolor3\" width=\"5%\" align=\"center\"><a href=\"modules.php?name=$module_name&op=read&id=".$row["msg_id"]."\"><img src=\"$url_smiles/".$row["msg_image"]."\" border=\"0\"></a></td>\n";
echo "\t<td bgcolor=\"$bgcolor1\" width=\"10%\"><font class=\"content\" color=\"$textcolor2\"><a href='modules.php?name=Userinfo&amp;uname=".$row["fromname"]."'>".$row["fromname"]."</a></font></td>\n";
echo "\t<td bgcolor=\"$bgcolor3\"><a href=\"modules.php?name=$module_name&op=read&id=".$row["msg_id"]."\"".$myover."><font class=\"tiny\" color=\"$textcolor2\">".$row["subject"]."</font></a></td>\n";
echo "\t<td bgcolor=\"$bgcolor1\" align=\"center\" width=\"18%\"><font class=\"tiny\" color=\"$textcolor2\">$postedtime</font></td>\n";
echo "</tr>\n";
$count++;
}
}
echo "<tr bgcolor=\"$bgcolor2\">\n\t<td colspan=\"6\">";
echo "<a href=\"modules.php?name=$module_name\"><img src=\"$url_button/index.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\" align=\"right\"></a> ";
echo "<a href=\"modules.php?name=$module_name&op=send\"><img src=\"$url_button/senden.gif\" border=0 width=\"103\" height=\"20\"></a> ";
if ($havemessages) {
echo "&nbsp;<input type=\"image\" src=\"$url_button/loeschen.gif\" name=\"delete_messages\" value=\"delete_messages\" border=\"0\" width=\"103\" height=\"20\" alt=\""._PMSDELETE."\">";
echo "<input type=\"hidden\" name=\"total_messages\" value=\"".(int)$total_messages."\">";
echo "<input type=\"hidden\" name=\"op\" value=\"delete_messages\">\n";
}
echo "</td>\n</tr>\n</table>\n</form>";
}

######################################################################
function messagesheader(){
global $url_images, $module_name;
include_once("modules/Your_Account/navbar.php");
OpenTable();
nav();
CloseTable();
echo "<br>";
OpenTable();
$buddyalt=strip_tags(eregi_replace("<br>","\n",_PMSDISCRIBE));
$windowname=md5($GLOBALS['sitename']);
echo "<center>
<a href=\"#\" onClick=\"window.open('modules.php?name=".$module_name."&file=buddy','$windowname','left=180, top=150, width=240,height=350,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no');\">
<img src=\"$url_images/buddy.gif\" width=\"60\" height=\"23\" border=\"0\" alt=\"$buddyalt\" align=\"right\"></a>
<a href=\"modules.php?name=$module_name\"><img src=\"$url_images/pmessage.gif\" width=\"19\" height=\"19\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\" align=\"left\"></a>
<font class=\"title\"><b>"._PMSPRIVATEMESSAGES."</b>
</font>
</center>\n";
CloseTable();
#echo "<br>";
}

######################################################################
function prvmsgerror($error_msg) {
  global $header, $footer, $PHP_SELF, $bgcolor2, $url_button;
  if (!isset($header)) {
  include("header.php");
  }
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<TR BGCOLOR=\"$bgcolor2\" align=\"center\"><TD><br>";
  echo "<center><font class=\"title\"><b>"._PMSGERROR."</b></font><br><br>";
  OpenTable2();
  echo "<center><br>$error_msg<br><br></center>";
  CloseTable2();
  echo "<br><a href=\"javascript:history.go(-1)\"><img src=\"$url_button/zurueck.gif\" width=\"103\" height=\"20\" border=\"0\" alt=\""._PMSGOBACK."\"></a><br><br></center></TD></TR></table>";
  include("footer.php");
  die("");
}

######################################################################
function readmessage($id, $uid){
global $prefix, $user_prefix, $module_name, $url_smiles, $url_avatar, $url_images, $blankavatar;
global $allow_bbcode, $allow_html ;
global $bgcolor1, $bgcolor2, $bgcolor3, $textcolor1, $textcolor2, $url_button;
list($id,$uid) = mxForceInteger($id,$uid);  // by AE
$qry="SELECT ".$prefix."_priv_msgs.*, UNIX_TIMESTAMP(msg_time) as msgtimestamp FROM ".$prefix."_priv_msgs WHERE (to_userid=$uid) and (msg_id=$id);";
$result = sql_query($qry);
if (!$result) {prvmsgerror(_ERRMSGDATABASE);}
$row = sql_fetch_array($result);
if (!$row["msg_id"]) {
msgindex($uid);
}
else {
$posterdata = get_userdata_from_id($row["from_userid"]);
$postedtime = mx_strftime(_PMSTIMESTRING,$row["msgtimestamp"]);

$replymsg = pmUndoPrepDisplay($row['msg_text']);
$replymsg = "[quote][i]"._ON." ".$postedtime.", "._PMSWROTE." ".$posterdata['uname'].":[/i]\n".$replymsg."\n[/quote]\n";

$row["msg_text"] = pmPrepDisplay($row["msg_text"]);

$qry = "SELECT msg_id FROM ".$prefix."_priv_msgs WHERE to_userid=$uid and msg_time>'".$row["msg_time"]."' and msg_id<>'".$row["msg_id"]."' and (from_userid is not null) order by msg_time asc LIMIT 0,1";
list($next) = sql_fetch_row(sql_query($qry));
$qry = "SELECT msg_id FROM ".$prefix."_priv_msgs WHERE to_userid=$uid and msg_time<'".$row["msg_time"]."' and msg_id<>'".$row["msg_id"]."' and (from_userid is not null) order by msg_time desc LIMIT 0,1";
list($previous) = sql_fetch_row(sql_query($qry));
$qry = "UPDATE ".$prefix."_priv_msgs SET read_msg=1 WHERE msg_id=".$row["msg_id"]."";
$result = sql_query($qry);
if (!$result) {prvmsgerror(_ERRMSGDATABASE);}

if (empty($posterdata["user_sig"])){
$rowspan = "2";
}
else {
$rowspan = "3";
$posterdata["user_sig"] = pmPrepDisplay($posterdata["user_sig"]);
}

messagesheader();

echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">";
echo "<tr bgcolor=\"$bgcolor1\"><td COLSPAN=\"2\"><font color=\"$textcolor1\" class=\"content\">"
."<a href=\"modules.php?name=$module_name\"><img src=\"$url_button/index.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\"></a> &nbsp;";
if ($previous) {
echo "<a href=\"modules.php?name=$module_name&op=read&id=$previous\"><img src=\"$url_button/vorherige.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSPREVIOUS."\"></a> &nbsp;";
}
else {
echo "<img src=\"$url_button/vorherige.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSPREVIOUS."\"> &nbsp;";
}
if ($next) {
echo "<a href=\"modules.php?name=$module_name&op=read&id=$next\"><img src=\"$url_button/naechste.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSNEXT."\"></a>";
}
else {
echo "<img src=\"$url_button/naechste.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSNEXT."\">";
}
echo "</font></td></tr>"
."<tr bgcolor=\"$bgcolor2\">"
."<td colspan=\"2\"><font class=\"title\" color=\"$textcolor2\">"._PMSPRIVATEMESSAGE.": &nbsp;&nbsp;<b><i>".smile($row["subject"])."</i></b></font></td>"
."</tr>"
."<tr bgcolor=\"$bgcolor3\">\n"
."<td valign=\"top\" rowspan=\"".$rowspan."\" width=\"20%\">"._PMSFROM.": <b>".$posterdata["uname"]."</b><br><br>\n";

if (!empty($posterdata["user_avatar"]) && $posterdata["user_avatar"] != "blank.gif"){
if(mxIsAvatarUploaded($posterdata["uname"])) {

echo "".mxIsAvatarUploaded($posterdata["uname"],true);

}

else {

if (!empty($posterdata['user_avatar'])) echo "<img src='".MX_PATH_AVATAR."/".$posterdata['user_avatar']."' border=0>";

}

if (!empty($posterdata["user_avatar"]) && $posterdata["user_avatar"] != "blank.gif"){
if(mxIsAvatarUploaded($posterdata["uname"])) {
echo mxIsAvatarUploaded($posterdata["uname"],true);
}
else {
echo "<img src=\"$url_avatar/".$posterdata["user_avatar"]."\" alt=\"".$posterdata["uname"]."\"><br>\n";
}
}
else{
echo "<img src=\"$url_avatar/$blankavatar\" alt=\"".$posterdata["uname"]."\"><br>\n";
}
echo "<img src=\"$url_avatar/$blankavatar\" alt=\"".$posterdata["uname"]."\"><br>\n";
}
echo "<br><a href=\"modules.php?name=Userinfo&amp;uname=".$posterdata["uname"]."\"><img src=\"$url_images/profile.gif\" border=\"0\" alt=\""._PMSPROFILE."\"><font class=\"tiny\">"._PMSPROFILE."</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n"
.get_onlinestatus($posterdata["uname"])
."</td>"
."<td width='80%' height='10' valign='top'><img src=\"".$url_smiles."/".$row["msg_image"]."\" alt=\"\">&nbsp;<font class=\"content\">"._PMSSENT.": $postedtime</font></td></tr>"
."<tr bgcolor=\"$bgcolor1\"><td width='80%' height='80' valign='top'>".$row["msg_text"]."<br><br></td></tr>";

if (!empty($posterdata["user_sig"])){
echo "<tr bgcolor=\"$bgcolor3\"><td width='80%' height='10'><font class=\"tiny\">".$posterdata["user_sig"]."</font></td></tr>\n";
}

echo "<tr bgcolor=\"$bgcolor2\"><td COLSPAN=\"2\">"
."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"
."<td><a href=\"modules.php?name=$module_name&op=reply&id=".$row["msg_id"]."\"><img src=\"$url_button/antworten.gif\" border=\"0\" alt=\""._PMSREPLY."\" width=\"103\" height=\"20\"></a>\n"
."&nbsp;<a href=\"modules.php?name=$module_name&op=delete&msg_id=".$row["msg_id"]."\"><img src=\"$url_button/loeschen.gif\" border=\"0\" alt=\""._PMSDELETE."\" width=\"103\" height=\"20\"></a>\n</td>\n"
."<td align=\"right\">"
."<a href=\"modules.php?name=$module_name\"><img src=\"$url_button/index.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\"></a> &nbsp;";
if ($previous) {
echo "<a href=\"modules.php?name=$module_name&op=read&id=$previous\"><img src=\"$url_button/vorherige.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSPREVIOUS."\"></a> &nbsp;";
}
else {
echo "<img src=\"$url_button/vorherige.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSPREVIOUS."\"> &nbsp;";
}
if ($next) {
echo "<a href=\"modules.php?name=$module_name&op=read&id=$next\"><img src=\"$url_button/naechste.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSNEXT."\"></a>";
}
else {
echo "<img src=\"$url_button/naechste.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSNEXT."\">";
}
echo "</td></tr></table>"
."</td></tr></table>";
###########################

echo "<script language=\"javascript\" src=\"modules/$module_name/javascript.js\">\n</script>\n";
echo "<FORM ACTION=\"modules.php\" METHOD=\"POST\" NAME=\"pmsubmit\">";
echo "<input type=\"hidden\" name=\"name\" value=\"".$module_name."\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"submit\">\n";
echo "<br><table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<tr bgcolor=\"$bgcolor2\">"
."<td colspan=\"2\"><font class=\"title\" color=\"$textcolor2\"><b>".$posterdata["uname"]."&nbsp;"._PMSREPLY.":</b></font></td>"
."</tr>";
if (mxIsAdmin()) {
echo "<TR>"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSTOALL1.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\"><input type='checkbox' name='to_all' value='1'> <span class=\"tiny\">"._PMSTOALL2."</span></td>"
."</TR>";
}
echo "<TR>"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSSUBJECT.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\"><INPUT TYPE=\"TEXT\" NAME=\"subject\" value=\"".mxPrepareToDisplay(desmile($row["subject"]))."\" SIZE=\"50\" MAXLENGTH=\"100\"></TD>"
."</TR>"
."<TR VALIGN=\"TOP\">"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSMESSAGEICON.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\">"
."<table border=0 cellpadding=0 cellspacing=0><tr>";
$count = 0;
$handle=opendir($url_smiles);
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($key, $file) = each ($filelist)) {
if (ereg(".gif|.jpg",$file)) {
if ($file == $row["msg_image"]) {
$sel = " checked";
}
else {
$sel = "";
}
echo "<td><INPUT TYPE=\"radio\" NAME=\"image\" VALUE=\"$file\"$sel style=\"background-color: transparent;\"><img src=\"$url_smiles/$file\" alt=\"\" width=\"17\" height=\"17\" border=\"0\"></td>";
$count++;
if ($count >= 10) {
$count=0;
echo "</tr><tr>";
}
}
}
echo "</tr></table></TD>"
."</TR>"
."<TR VALIGN=\"TOP\">"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSMESSAGE.":</b><br><br>"
."<font class=\"content\">";
if($allow_html == 1) {
echo ""._PMSHTML.": "._PMSPMON."<BR>\n";
}
else {
echo ""._PMSHTML.": "._PMSOFF."<BR>\n";
}
if($allow_bbcode == 1) {
echo ""._PMSBBCODELINK.""._PMSBBCODE."</a>:"._PMSPMON."<br>\n";
}
else {
echo ""._PMSBBCODE.":"._PMSOFF."<BR>\n";
}
echo "</font></TD>"
."<TD BGCOLOR=\"$bgcolor1\">"
."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"
."<td><TEXTAREA NAME=\"message\" ID=\"message\" ROWS=\"10\" COLS=\"45\" ONSELECT=\"storeCaret(this);\" ONCLICK=\"storeCaret(this);\" ONKEYUP=\"storeCaret(this);\">".mxPrepareToDisplay($replymsg)."</TEXTAREA></td>"
."<td>";
if($allow_bbcode == 1) {
printsmilies();
}
echo "</td></tr></table>";
if($allow_bbcode == 1) {
putitems();
}
echo "</TD></TR>"
."<TR><TD BGCOLOR=\"$bgcolor1\" colspan=\"2\" ALIGN=\"CENTER\">\n"
."<INPUT TYPE=\"HIDDEN\" NAME=\"to_user\" value=\"".mxPrepareToDisplay($posterdata["uname"])."\">"
."<INPUT TYPE=\"HIDDEN\" NAME=\"msg_id\" VALUE=\"".(int)$row["msg_id"]."\">\n"
."<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\""._PMSSUBMIT."\">&nbsp;\n"
."<INPUT TYPE=\"RESET\" VALUE=\""._PMSCLEAR."\">\n"
."</TD></TR>"
."</TABLE>"
."</FORM>";
}
}

######################################################################
function sendmessage($msg_id, $uid, $to_user=""){
global $allow_bbcode, $allow_html;
global $prefix, $user_prefix, $module_name, $url_smiles, $url_button, $subjectdefaulticon;
global $bgcolor1, $bgcolor2, $bgcolor3, $textcolor1, $textcolor2;
list($msg_id, $uid) = mxForceInteger($msg_id, $uid);
$count = 0;
$userlistlink="[ <a href=\"#\" onClick=\"window.open('modules.php?name=$module_name&amp;op=userslist','pmuserslist','left=200, top=200, width=240,height=200,toolbar=no,location=no,directories=no,statusbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no'); return false;\">"._PMSUSERSLIST."</a> ]";
if ($msg_id){
$qry="SELECT msgs.msg_image, msgs.subject, msgs.to_userid, UNIX_TIMESTAMP(msg_time), msgs.msg_text, fromuser.uname "
."FROM ".$prefix."_priv_msgs AS msgs LEFT JOIN ".$user_prefix."_users AS fromuser ON msgs.from_userid = fromuser.uid "
."WHERE ((to_userid=$uid) AND (msg_id=$msg_id) and (from_userid is not null));";
$result = sql_query($qry);
if (!$result) {prvmsgerror(_ERRMSGDATABASE);}
    list($msg_image, $subject, $to_userid, $msg_time, $msg_text, $to_user) = sql_fetch_row($result);
$msg_time = mx_strftime(_PMSTIMESTRING,$msg_time);
if(!$msg_image) {$msg_image=$subjectdefaulticon;}
$subject = ""._PMSRE.": ".desmile($subject)."";
$subject  = str_replace(""._PMSRE.": "._PMSRE.": ", _PMSRE.": ", $subject);
$msg_text = pmUndoPrepDisplay($msg_text);
$msg_text = "[quote][i]"._ON." ".$msg_time.", "._PMSWROTE." ".$to_user.":[/i]\n".$msg_text."\n[/quote]\n";
}
else{
if(is_numeric($uid) && empty($to_user)){
$qry="SELECT uid, uname from ".$user_prefix."_users where uid=$uid and uid<>1 and uname<>'".$GLOBALS['anonymous']."';";
$result = sql_query($qry);
    list($uid,$to_user) = sql_fetch_row($result);
}
else{
$to_user = (empty($to_user)) ? $uid : $to_user;
}
$msg_image=$subjectdefaulticon;
$subject="";
$msg_text="";
}
$handle=opendir($url_smiles);
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
echo "<script language=\"javascript\" src=\"modules/$module_name/javascript.js\">\n</script>\n";
echo "<FORM ACTION=\"modules.php\" METHOD=\"POST\" NAME=\"pmsubmit\">";
echo "<input type=\"hidden\" name=\"name\" value=\"".$module_name."\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"submit\">\n";
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<TR BGCOLOR=\"$bgcolor2\">"
."<TD colspan=\"2\"><a href=\"modules.php?name=$module_name\"><img src=\"$url_button/index.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\" align=\"right\"></a>"
."<FONT COLOR=\"$textcolor2\" class=\"title\"><b>"._PMSPRIVATEMESSAGESEND."</b></FONT></a></TD>"
."</TR>"
."<TR>"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSTO.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\"><INPUT NAME=\"to_user\" SIZE=\"26\" maxlength=\"25\" value=\"".mxPrepareToDisplay($to_user)."\">&nbsp;&nbsp;&nbsp;".$userlistlink."</td>"
."</TR>";
if (mxIsAdmin()) {
echo "<TR>"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSTOALL1.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\"><input type='checkbox' name='to_all' value='1'> <span class=\"tiny\">"._PMSTOALL2."</span></td>"
."</TR>";
}
echo "<TR>"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSSUBJECT.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\"><INPUT TYPE=\"TEXT\" NAME=\"subject\" value=\"".mxPrepareToDisplay($subject)."\" SIZE=\"50\" MAXLENGTH=\"100\"></TD>"
."</TR>"
."<TR VALIGN=\"TOP\">"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSMESSAGEICON.":</b></TD>"
."<TD BGCOLOR=\"$bgcolor1\">"
."<table border=0 cellpadding=0 cellspacing=0><tr>";
while (list ($key, $file) = each ($filelist)) {
if (ereg(".gif|.jpg",$file)) {
if ($file == $msg_image) {
$sel = " checked";
}
else {
$sel = "";
}
echo "<td><INPUT TYPE=\"radio\" NAME=\"image\" VALUE=\"$file\"$sel style=\"background-color: transparent;\"><img src=\"$url_smiles/$file\" alt=\"\" width=\"17\" height=\"17\" border=\"0\"></td>";
$count++;
if ($count >= 10) {
$count=0;
echo "</tr><tr>";
}
}
}
echo "</tr></table></TD>"
."</TR>"
."<TR VALIGN=\"TOP\">"
."<TD BGCOLOR=\"$bgcolor3\" width=\"25%\"><b>"._PMSMESSAGE.":</b><br><br>"
."<font class=\"content\">";
if($allow_html == 1) {
echo ""._PMSHTML.": "._PMSPMON."<BR>\n";
}
else {
echo ""._PMSHTML.": "._PMSOFF."<BR>\n";
}
if($allow_bbcode == 1) {
echo ""._PMSBBCODELINK.""._PMSBBCODE."</a>:"._PMSPMON."<br>\n";
}
else {
echo ""._PMSBBCODE.":"._PMSOFF."<BR>\n";
}
echo "</font></TD>"
."<TD BGCOLOR=\"$bgcolor1\">"
."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"
."<td><TEXTAREA NAME=\"message\" ID=\"message\" ROWS=\"10\" COLS=\"45\" ONSELECT=\"storeCaret(this);\" ONCLICK=\"storeCaret(this);\" ONKEYUP=\"storeCaret(this);\">".mxPrepareToDisplay($msg_text)."</TEXTAREA></td>"
."<td>";
if($allow_bbcode == 1) {
printsmilies();
}
echo "</td></tr></table>";
if($allow_bbcode == 1) {
putitems();
}
echo "</TD></TR>"
."<TR><TD BGCOLOR=\"$bgcolor1\" colspan=\"2\" ALIGN=\"CENTER\">\n"
."<INPUT TYPE=\"HIDDEN\" NAME=\"msg_id\" VALUE=\"".(int)$msg_id."\">\n"
."<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\""._PMSSUBMIT."\">&nbsp;\n"
."<INPUT TYPE=\"RESET\" VALUE=\""._PMSCLEAR."\">\n"
."&nbsp;<INPUT TYPE=\"SUBMIT\" NAME=\"cancel\" VALUE=\""._PMSCANCELSEND."\">\n"
."</TD></TR>"
."</TABLE>"
."</FORM>"
."<BR>";
}

######################################################################
function cancelsubmit($msg_id, $uid){
list($msg_id, $uid) = mxForceInteger($msg_id, $uid);
if ($msg_id){
readmessage($msg_id, $uid);
}
else{
msgindex($uid);
}
}

######################################################################
function submitmessage($arrpostdata, $uid){
global $prefix, $user_prefix, $PHP_SELF, $module_name, $refresh, $bgcolor2;
$uid = (int)$uid;
if(empty($arrpostdata["to_user"]) && empty($arrpostdata["to_all"]) || (!empty($arrpostdata["to_all"]) && !mxIsAdmin())) {
prvmsgerror(_ERRMSGNOUSER);
}
if (empty($arrpostdata["to_all"])) {
$result = sql_query("select uid from ".$user_prefix."_users where uname=\"".mxAddSlashesForSQL($arrpostdata["to_user"])."\"");
list($to_userid) = sql_fetch_row($result);
if (!$to_userid) {
prvmsgerror(_PMSUSERNOTINDB);
}
}
if(!($arrpostdata["subject"])) {
prvmsgerror(_ERRMSGNOSUBJECT);
}
if (strip_tags($arrpostdata["subject"]) != $arrpostdata["subject"]) {
prvmsgerror(_ERRMSGNOHTMLINSUBJECT);
}
if(!($arrpostdata["image"])) {
prvmsgerror(_ERRMSGNOICON);
}
if(!($arrpostdata["message"])) {
prvmsgerror(_ERRMSGNOMESSAGE);
}
$arrpostdata["message"] = mxAddSlashesForSQL($arrpostdata["message"]);
$arrpostdata["subject"] = mxAddSlashesForSQL(strip_tags($arrpostdata["subject"]));

$qry1 = "INSERT INTO ".$prefix."_priv_msgs (msg_image, subject, from_userid, to_userid, msg_time, msg_text) ";
if (empty($arrpostdata["to_all"])) {
$qry1 .= "VALUES ('".$arrpostdata["image"]."', '".$arrpostdata["subject"]."', ".$uid.", ".$to_userid.", now(), '".$arrpostdata["message"]."')";
if(!$result = sql_query($qry1)) {
prvmsgerror(_ERRMSGNOSUBMIT);
}
}
else {
if (mxIsAdmin()) {
$i = 0;
$result = sql_query("select uid from ".$user_prefix."_users where user_stat=1 AND uid>1");
while(list($to_userid) = sql_fetch_row($result)) {
$qry2 = $qry1." VALUES ('".$arrpostdata["image"]."', '".$arrpostdata["subject"]."', ".$uid.", ".$to_userid.", now(), '".$arrpostdata["message"]."')";
$result2 = sql_query($qry2);
if ($result2) $i++;
}
}
}
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<TR BGCOLOR=\"$bgcolor2\">"
."<TD><br><center>"._PMSMSGPOSTED." ".((isset($i)) ? " (".$i." User)" : "")."<br><a href=\"modules.php?name=$module_name\">"._PMSRETURNTOPMSG."</a></center><br></TD>"
."</TR></table>";
echo "<META http-equiv=\"Refresh\" content=\"".((isset($i)) ? ($refresh*4) : $refresh).";URL=modules.php?name=$module_name\">";
}

######################################################################
function deletemessage($msg_id, $uid){
global $prefix, $user_prefix, $PHP_SELF, $module_name, $refresh, $bgcolor2, $url_button;
list($msg_id, $uid) = mxForceInteger($msg_id, $uid);
$qry = "SELECT msg_time FROM ".$prefix."_priv_msgs WHERE (to_userid=$uid) and (msg_id=$msg_id) and (from_userid is not null) LIMIT 0,1";
list($time) = sql_fetch_row(sql_query($qry));
$qry = "SELECT msg_id FROM ".$prefix."_priv_msgs WHERE (to_userid=$uid) and (msg_time>'$time') and (msg_id<>$msg_id) and (from_userid is not null) order by msg_time asc LIMIT 0,1";
list($nextid) = sql_fetch_row(sql_query($qry));
  $qry = "DELETE FROM ".$prefix."_priv_msgs WHERE (msg_id=$msg_id) AND (to_userid=$uid) or (from_userid is null)";
  if(!sql_query($qry)) {
prvmsgerror(_ERRMSGNODELETE);
  }
else {
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<TR BGCOLOR=\"$bgcolor2\" align=\"center\"><TD><br>"._PMSMSGDELETED."<br><br>";
if ($nextid){
    $xrefresh = $refresh*2;
echo "<a href=\"modules.php?name=$module_name&op=index\"><img src=\"$url_button/index.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSRETURNTOPMSG."\"></a> &nbsp; <a href=\"modules.php?name=$module_name&op=read&id=$nextid\"><img src=\"$url_button/naechste.gif\" width=\"55\" height=\"12\" border=\"0\" alt=\""._PMSNEXT."\"></a>";
echo "<META http-equiv=\"Refresh\" content=\"$xrefresh;URL=modules.php?name=$module_name&op=read&id=$nextid\">";
}
else {
    echo "<a href=\"modules.php?name=$module_name\">"._PMSRETURNTOPMSG."</a>";
echo "<META http-equiv=\"Refresh\" content=\"$refresh;URL=modules.php?name=$module_name\">";
}
echo "<br><br></TD></TR></table>";
    }
}

######################################################################
function deletemessages($arrformvars, $uid){
global $prefix, $refresh, $module_name, $bgcolor2;
$status =0; $delmess = array();
$uid = (int)$uid;
if (isset($arrformvars["msg_id"])){
foreach ($arrformvars["msg_id"] as $key => $val) {
$delmess[] = (int)$val;
$status++;
}
if (count($delmess)) {
$delmess = implode(',',$delmess);
$qry="DELETE FROM ".$prefix."_priv_msgs WHERE (msg_id IN (".$delmess.")) AND (to_userid=".$uid.") AND (read_msg <> 0) OR (from_userid = 0) OR (msg_text IS NULL) OR (subject IS NULL) OR (msg_text='') OR (subject='')";
sql_query($qry);
$qry="SELECT COUNT(msg_id) FROM ".$prefix."_priv_msgs WHERE (to_userid = ".$uid.") and (from_userid > 1) AND msg_id IN (".$delmess.")";
$result = sql_query($qry);
list($delmess) = sql_fetch_row($result);
$status = $status - ((int)$delmess);
}
}
messagesheader();
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" bgcolor=\"$bgcolor2\">"
."<TR BGCOLOR=\"$bgcolor2\" align=\"center\"><TD><br>";
if ($status){
echo _PMSMSGDELETED2." (".$status."x)";
}
else {
    echo _PMSMSGNOTODELETE;
}
echo "<br><br><a href=\"modules.php?name=$module_name\">"._PMSRETURNTOPMSG."</a><br><br></TD></TR></table>";
echo "<META http-equiv=\"Refresh\" content=\"$refresh;URL=modules.php?name=$module_name\">";
}

######################################################################
# mainprog ###########################################################

$module_name = basename(dirname(__FILE__));
if (!mxIsUser()) {
Header("Location: modules.php?name=Your_Account&op=login");
exit;
}
else {
$userdata = getusrinfo($user);

$_REQUEST["op"] = (empty($_REQUEST["op"])) ? "index" : $_REQUEST["op"];
$_REQUEST["uname"] = (empty($_REQUEST["uname"])) ? $userdata["uid"] : $_REQUEST["uname"];
$_REQUEST["to_user"] = (empty($_REQUEST["to_user"])) ? $userdata["uname"] : $_REQUEST["to_user"];

include_once("modules/".$module_name."/config.php");
if (@file_exists('modules/'.$module_name.'/bbfunctions.php')) include_once("modules/".$module_name."/bbfunctions.php");
include_once("modules/".$module_name."/functions.php");
mxGetLangfile($module_name);

if ($op=="userslist"){
userslist();
exit;
}

include('header.php');
echo "\n\n<!-- beginn $module_name output -->\n";

if (isset($_REQUEST['mode']) && isset($_REQUEST['u'])) {
$_REQUEST['op'] = $_REQUEST['mode'];
$xinfo = mxGetUserDataFromUid($_REQUEST['u']);
$_REQUEST["to_user"] = $xinfo['uname'];
}

switch($_REQUEST['op']) {

case "read":
readmessage($_REQUEST["id"], $userdata["uid"]);
    break;
case "reply":
sendmessage($_REQUEST["id"], $userdata["uid"]);
    break;
case "send":
sendmessage(0, $_REQUEST["uname"]);
    break;
case "post":
case "send_to":
sendmessage(0, $_REQUEST["uname"], $_REQUEST["to_user"]);
    break;
case "submit":
if (isset($_REQUEST["submit"])){
submitmessage($_REQUEST, $userdata["uid"]);
}
else{
cancelsubmit($_REQUEST["msg_id"], $userdata["uid"]);
}
    break;
case "delete":
deletemessage($_REQUEST["msg_id"], $userdata["uid"]);
    break;
case "delete_messages":
deletemessages($_REQUEST, $userdata["uid"]);
    break;
Default:
msgindex($userdata["uid"]);
    break;
}
echo "\n<!-- end $module_name output -->\n\n";
include('footer.php');
}
/* CVS-Log:
$Log: index.php,v $
Revision 20.11  2003/11/14 19:58:34  EllselAn
fehler beim löschen von mehreren Nachrichten gefixt

Revision 20.10  2003/11/10 00:44:40  EllselAn
Rahmen um Usernavigation

Revision 20.9  2003/11/07 17:20:06  EllselAn
fixes gegen sql-Injection

Revision 20.8  2003/11/05 18:51:09  EllselAn
umbenannte usermenu.php geändert in navbar.php

Revision 20.7  2003/11/05 16:29:55  EllselAn
kompatibilität mit fremdmodulen

Revision 20.6  2003/10/02 22:28:55  EllselAn
Zeilenumbruch nach scriptende entfernt

Revision 20.5  2003/10/01 12:00:51  EllselAn
problem mit file_exists bei safe_mode=on

Revision 20.4  2003/09/12 11:53:39  EllselAn
Löschen der Nachrichten überarbeitet

Revision 20.3  2003/09/06 00:18:20  EllselAn
strftime ersetzt durch mx_strftime

Revision 20.2  2003/09/01 14:51:31  EllselAn
Problem mit falsch angezeigten quotes gefixt


*/