' . oc_('All Threads') . ' » '; printHeader($hdr, $access); // Display paper info print '

'; if (!empty($paperLink)) { print '' . $_REQUEST['thread'] . '. ' . safeHTMLstr($paper['title']) . ''; } else { print $_REQUEST['thread'] . '. ' . safeHTMLstr($paper['title']); } print '

'; // Submit? if (isset($_POST['submit']) && ($uid == 0) && ($_POST['submit'] == 'Delete Checked Posts')) { if (isset($_POST['posts']) && is_array($_POST['posts']) && !empty($_POST['posts'])) { foreach ($_POST['posts'] as $p) { if (ctype_digit($p)) { issueSQL("DELETE FROM `" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "` WHERE `postid`='" . safeSQLstr($p) . "'"); } } } } // Get posts $q = "SELECT `" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "`.*, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_REVIEWER . "`.`email` FROM `" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "` LEFT JOIN (`" . OCC_TABLE_REVIEWER . "`) ON (`" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "`.`accountid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`) WHERE `" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "`.`paperid`='" . $_REQUEST['thread'] . "' ORDER BY `" . OCC_TABLE_MODULE_OC_DISCUSSION_POST . "`.`time` ASC"; $r = ocsql_query($q) or err('Unable to retrieve posts'); if (mysql_num_rows($r) == 0) { print '

' . oc_('No comments have been posted yet.') . '

'; } else { print '

'; // Display posts $lastpost = 0; // track last post while ($l = mysql_fetch_assoc($r)) { $lastpost = $l['postid']; print '
' . strftime('%c',$l['time']); // show delete checkboxes if chair if ($uid == 0) { print '   '; } print '
' . nl2br(safeHTMLstr($l['content'])) . '
'; } if ($uid == 0) { print '
'; } print '
'; // Update lastread - Yes, INSERT ON DUPLICATE KEY UPDATE would have been nice $q = "DELETE FROM `" . OCC_TABLE_MODULE_OC_DISCUSSION_READ . "` WHERE `accountid`='" . $uid . "' AND `paperid`='" . $_REQUEST['thread'] . "'"; $r = ocsql_query($q) or err('Unable to update last read post'); $q = "INSERT INTO `" . OCC_TABLE_MODULE_OC_DISCUSSION_READ . "` SET `lastread`='" . $lastpost . "', `accountid`='" . $uid . "', `paperid`='" . $_REQUEST['thread'] . "'"; $r = ocsql_query($q) or err('Unable to update last read post (2)'); } // Display post entry box print '
' . oc_('Add a Comment') . '
   
' . sprintf(oc_('All times are UTC %1$s. The time now is %2$s'), date('O'), strftime('%X')) . '
'; // Display reviews if ($OC_configAR['OC_DISCUSSION_displayReviews']) { $q = "SELECT " . OCC_TABLE_PAPERREVIEWER . ".*, CONCAT_WS(' '," . OCC_TABLE_REVIEWER . ".name_first," . OCC_TABLE_REVIEWER . ".name_last) as name FROM " . OCC_TABLE_PAPERREVIEWER . ", " . OCC_TABLE_REVIEWER . " WHERE " . OCC_TABLE_PAPERREVIEWER . ".paperid='" . $_REQUEST['thread'] . "' AND " . OCC_TABLE_PAPERREVIEWER . ".reviewerid=" . OCC_TABLE_REVIEWER . ".reviewerid"; $r = ocsql_query($q) or err("Unable to get information ".mysql_errno()); if (mysql_num_rows($r) == 0) { warn(oc_('No reviews found')); } require_once OCC_REVIEW_INC_FILE; displayReviews($_REQUEST['thread'],$r); } printFooter();