$button = 'Approve'; $caption = 'Approve Notes'; $name = 'approve'; if (isset($_GET['status']) && $_GET['status'] == 'approved') { $status = 'yes'; $action = 'updateApproved'; $title = 'Move Approved Notes to Pending'; $button = 'Make Pending'; $caption = 'Pending'; $name = 'pending'; } /** elseif (isset($_GET['status']) && $_GET['status'] == 'deleted') { $status = 'no'; $action = 'approveMass'; $title = 'Deleted notes'; $button = 'Un-Delete comments'; $caption = 'Deleted'; $name = 'undelete'; } */ if (isset($_GET['url']) && !empty($_GET['url'])) { $pendingComments = $manualNotes->getPageComments($_GET['url'], $status); } else { $pendingComments = $manualNotes->getPageComments('', $status, true); } $url = isset($_GET['url']) ? strip_tags($_GET['url']) : ''; if (!isset($error)) { $error = ''; } require PEARWEB_TEMPLATEDIR . '/notes/note-manage-admin.tpl.php';
$message = 'Comment(s) successfully '; $message .= isset($_POST['pending']) ? 'made pending' : 'deleted'; } $_GET = $_POST; $_GET['status'] = 'approved'; include dirname(__FILE__) . '/index.php'; exit; } else { $error = 'Neither pending nor delete was selected'; $_GET = $_POST; $_GET['status'] = 'approved'; include dirname(__FILE__) . '/index.php'; exit; } if (isset($_POST['url']) && !empty($_POST['url'])) { $pendingComments = $manualNotes->getPageComments($_POST['url'], 'yes'); } else { $pendingComments = $manualNotes->getPageComments('', 'yes', true); } $url = isset($_POST['url']) ? strip_tags($_POST['url']) : ''; $error = ''; require PEARWEB_TEMPLATEDIR . '/notes/note-manage-admin.tpl.php'; break; case 'approvemass': if (isset($_POST['noteIds']) && is_array($_POST['noteIds'])) { if (isset($_POST['approve']) || isset($_POST['undelete'])) { $notes = $manualNotes->updateCommentList($_POST['noteIds'], 'yes'); } elseif (isset($_POST['delete'])) { $notes = $manualNotes->updateCommentList($_POST['noteIds'], 'no'); } else { $notes = PEAR::raiseError('Neither delete nor un-delete nor approve was selected');
/** * Generates and returns the notes comments HTML. * * @param string $uri Manual page id * * @return string HTML */ function getComments($uri) { $output = ''; require_once 'notes/ManualNotes.class.php'; $manualNotes = new Manual_Notes(); $comments = $manualNotes->getPageComments($uri, auth_check('pear.dev')); if (empty($comments)) { $output .= 'There are no user contributed notes for this page.'; } foreach ($comments as $comment) { $manualNotes->display($comment); } return $output; }