From: Sascha E. <kar...@us...> - 2002-03-04 23:12:19
|
Update of /cvsroot/pn-modules/PN_Journal/html/modules/PN_Journal In directory usw-pr-cvs1:/tmp/cvs-serv32049 Modified Files: display.php Log Message: Converted mysql calls to adodb Index: display.php =================================================================== RCS file: /cvsroot/pn-modules/PN_Journal/html/modules/PN_Journal/display.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** display.php 4 Mar 2002 01:35:37 -0000 1.3 --- display.php 4 Mar 2002 23:12:16 -0000 1.4 *************** *** 46,69 **** modules_get_language(); include 'header.php'; include "modules/$ModName/core.php"; $index = 0; member_check(); j_nav(); echo "<br />"; - $sql = "SELECT * FROM ".$prefix."_users WHERE uname = '$username'"; - $result = mysql_query($sql); - while ($row = mysql_fetch_array($result)) - { - $aid = $row['uid']; - } - /** * Display journal entry owner details. */ ! ! $sql = "SELECT * FROM ".$prefix."_journal_posts WHERE jid = '$send'"; ! $result = mysql_query($sql); ! while ($row = mysql_fetch_array($result)) { /** --- 46,70 ---- modules_get_language(); include 'header.php'; + include "modules/$ModName/tables.php"; include "modules/$ModName/core.php"; $index = 0; member_check(); j_nav(); + $aid = user_id(); echo "<br />"; /** * Display journal entry owner details. */ ! $sql = "SELECT a.aid, a.time_now, a.status, a.mood, a.title, a.body, a.thoughts,"; ! $sql.= " a.music, a.ud_time, b.uname, b.user_avatar"; ! $sql.= " FROM $pntable[journal_posts] a, $pntable[users] b"; ! $sql.= " WHERE a.jid = '$send' AND b.uid = '$aid'"; ! $result = $dbconn->Execute($sql); ! if ($result === false) ! { ! PN_DBMsgError($dbconn, FILE, LINE, "Error accessing database"); ! } ! while (list($caid, $time_now, $status, $mood, $title, $body, $thoughts, $music, $ud_time, $uname, $user_avatar) = $result->fields) { /** *************** *** 72,79 **** * curent user is *not* the author, then stop the page. */ ! ! if ($row['status'] == "Private") { ! if ($aid != $row['aid']) { openTable2(); --- 73,80 ---- * curent user is *not* the author, then stop the page. */ ! ! if ($status == "Private") { ! if ($aid != $caid) { openTable2(); *************** *** 86,94 **** /** ! * We need to check and see if the current viewer is the ! * author of this post. */ ! ! if ($row['aid'] == $aid) { $author = True; --- 87,94 ---- /** ! * We need to check and see if the current viewer is the author of this post. */ ! ! if ($caid == $aid) { $author = True; *************** *** 98,102 **** * Display author edit links if this is indeed the author. */ ! if ($author == True) { --- 98,102 ---- * Display author edit links if this is indeed the author. */ ! if ($author == True) { *************** *** 112,154 **** * author ID, display the journal entry. */ ! openTable(); openTable2(); echo "<table width=\"100%\" cellpadding=\"2\">\n" ."<tr>\n" ! ."<td bgcolor=\"$bgcolor2\" align=\"center\" valign=\"top\">\n"; ! ! /** ! * Sub Query the user table for author details. ! */ - $owner = $row['aid']; - $details = "SELECT * FROM ".$prefix."_users WHERE uid = '$owner'"; - $stats = mysql_query($details); - while ($data = mysql_fetch_array($stats)) - { - printf ("<a href=\"user.php?op=userinfo&uname=%s\">%s</a><br /><img src=\"images/avatar/%s\"><br />\n", $data['uname'], $data['uname'], $data['user_avatar']); - } - /** * Start pulling the actual data from the journal_post * post table and format it for viewing. ! */ ! ! echo "</td><td valign=\"top\" align=\"center\">"; ! ! /** * Strip slashes from title if quotes were used. */ ! ! $title = stripslashes($row['title']); ! printf ("<h3>%s</h3>", $title); /** * Display (Mood - date/time - Mood) */ ! ! printf ("<img src=\"modules/$ModName/images/moods/%s\"> - %s - <img src=\"modules/$ModName/images/moods/%s\">", $row['mood'], $row['time_now'], $row['mood']); ! echo "</td>\n" ."</tr>\n" ."</table>\n"; --- 112,142 ---- * author ID, display the journal entry. */ ! openTable(); openTable2(); echo "<table width=\"100%\" cellpadding=\"2\">\n" ."<tr>\n" ! ."<td bgcolor=\"$bgcolor2\" align=\"center\" valign=\"top\">\n" ! ."<a href=\"user.php?op=userinfo&uname=$uname\">$uname</a><br />\n" ! ."<img src=\"images/avatar/$user_avatar\"><br />\n" ! ."</td><td valign=\"top\" align=\"center\">\n"; /** * Start pulling the actual data from the journal_post * post table and format it for viewing. ! * * Strip slashes from title if quotes were used. */ ! ! $title = stripslashes($title); ! echo "<h3>$title</h3>"; /** * Display (Mood - date/time - Mood) */ ! ! echo "<img src=\"modules/$ModName/images/moods/$mood\" /> - $time_now -\n" ! ."<img src=\"modules/$ModName/images/moods/$mood\" />\n" ! ."</td>\n" ."</tr>\n" ."</table>\n"; *************** *** 160,167 **** * Strip slashes from journal body and display it. */ ! ! $body = stripslashes($row['body']); ! printf ("<h4 align=\"center\">"._PNJJENTRY."</h4>%s", $body); ! print ("<br /><div align=\"center\">"); /** --- 148,155 ---- * Strip slashes from journal body and display it. */ ! ! $body = stripslashes($body); ! echo "<h4 align=\"center\">"._PNJJENTRY."</h4>$body\n" ! ."<br /><div align=\"center\">\n"; /** *************** *** 169,176 **** */ ! $thoughts = stripslashes($row['thoughts']); ! if ($thoughts != "") { ! printf ("<h4>"._PNJTHOUGHTS."</h4>%s<br /><br />", $thoughts); } --- 157,164 ---- */ ! $thoughts = stripslashes($thoughts); ! if ($thoughts != '') { ! echo "<h4>"._PNJTHOUGHTS."</h4>$thoughts<br /><br />\n"; } *************** *** 179,190 **** */ ! $music = stripslashes($row['music']); ! if ($music != "") { ! printf ("<b>"._PNJMUSIC."</b> : %s", $music); } ! print ("</div>"); closeTable2(); ! print ("<br />"); openTable2(); --- 167,178 ---- */ ! $music = stripslashes($music); ! if ($music != '') { ! echo "<b>"._PNJMUSIC."</b>: $music"; } ! echo "<div>\n"; closeTable2(); ! echo "<br />\n"; openTable2(); *************** *** 192,198 **** * Display last updated time and date. */ ! ! printf (""._PNLASTUPD.": %s", $row['ud_time']); closeTable2(); } closeTable(); --- 180,187 ---- * Display last updated time and date. */ ! ! echo _PNLASTUPD.": $ud_time\n"; closeTable2(); + $result->MoveNext(); } closeTable(); *************** *** 214,253 **** */ ! $sql = "SELECT * FROM ".$prefix."_journal_comments WHERE jid = '$send' ORDER BY cid"; ! $result = mysql_query($sql); ! while ($row = mysql_fetch_array($result)) { echo "<br />\n"; openTable(); ! $body = stripslashes($row['body']); ! $time_now = $row['time_now']; ! $owner = $row['aid']; ! $details = "SELECT * FROM ".$prefix."_users WHERE uid = '$owner'"; ! $stats = mysql_query($details); ! while ($data = mysql_fetch_array($stats)) { ! $name = $data['uname']; ! $avatar = $data['user_avatar']; } ! echo "<table width=\"100%\" cellpadding=\"2\">\n" ! ."<tr>\n" ! ."<td valign=\"top\" align=\"center\" width=\"130\" bgcolor=\"#bgcolor2\">"._POSTEDBY."<br />\n" ! ."<a href=\"user.php?op=userinfo&uname=$name\">$name</a><br />\n" ! ."<img src=\"images/avatar/$avatar\"><br />$time_now\n"; ! /** ! * If the current viewer is the owner of this journal entry ! * then allow them to remove this comment. ! */ ! $cid = $row['cid']; ! if ($author == True) { ! echo "<br />[ <a href=\"modules.php?op=modload&name=$ModName&file=comment_remove&cid=$cid&send=$send\">"._DELETE." "._COMMENT."</a> ]"; } - echo "</td>\n" - ."<td valign=\"top\">$body</td>\n" - ."</tr>\n" - ."</table>\n"; $was_commented = 1; closeTable(); } --- 203,254 ---- */ ! $sql = "SELECT cid, aid, time_now, body"; ! $sql.= " FROM $pntable[journal_comments]"; ! $sql.= " WHERE jid = '$send'"; ! $sql.= " ORDER BY cid"; ! $result = $dbconn->Execute($sql); ! if ($result === false) ! { ! PN_DBMsgError($dbconn, FILE, LINE, "Error accessing database"); ! } ! while (list($cid, $owner, $time_now, $body) = $result->fields) { echo "<br />\n"; openTable(); ! $body = stripslashes($body); ! $column = &$pntable['users_column']; ! $sql = "SELECT $column[uname], $column[user_avatar]"; ! $sql.= " FROM $pntable[users]"; ! $sql.= " WHERE $column[uid] = '$owner'"; ! $user = $dbconn->Execute($sql); ! if ($user === false) { ! PN_DBMsgError($dbconn, FILE, LINE, "Error accessing database"); } ! while (list($name, $avatar) = $user->fields) { ! echo "<table width=\"100%\" cellpadding=\"2\">\n" ! ."<tr>\n" ! ."<td valign=\"top\" align=\"center\" width=\"130\" bgcolor=\"#bgcolor2\">"._POSTEDBY."<br />\n" ! ."<a href=\"user.php?op=userinfo&uname=$name\">$name</a><br />\n" ! ."<img src=\"images/avatar/$avatar\"><br />$time_now\n"; ! ! /** ! * If the current viewer is the owner of this journal entry ! * then allow them to remove this comment. ! */ ! if ($author == True) ! { ! echo "<br />[ <a href=\"modules.php?op=modload&name=$ModName&file=comment_remove&cid=$cid&send=$send\">"._DELETE." "._COMMENT."</a> ]"; ! } ! echo "</td>\n" ! ."<td valign=\"top\">$body</td>\n" ! ."</tr>\n" ! ."</table>\n"; ! $user->MoveNext(); } $was_commented = 1; closeTable(); + $result->MoveNext(); } |