deleteEntry('posts', $post); foreach ($postEntry['tags'] as $tag) { $tagEntry = readEntry('tags', $tag); unset($tagEntry['posts'][$post]); saveEntry('tags', $tag, $tagEntry); } foreach ($postEntry['comment'] as $comment) { deleteEntry('comments', $comment); } home(); } else { if (isGET('draft') && isAdmin()) { deleteEntry('drafts', GET('draft')); home(); } else { if (isGET('comment') && (isAdmin() || isAuthor(GET('comment')))) { $comment = GET('comment'); $commentEntry = readEntry('comments', $comment); deleteEntry('comments', $comment); $postEntry = readEntry('posts', $commentEntry['post']); unset($postEntry['comments'][$comment]); saveEntry('posts', $commentEntry['post'], $postEntry); redirect('view.php?post=' . $commentEntry['post'] . '#comments'); } else { if (isGET('link') && isAdmin()) { deleteEntry('links', GET('link')); home(); } else { if (isGET('tag') && isAdmin()) { $tag = GET('tag'); $tagEntry = readEntry('tags', $tag);
function isVisible($recipe_id) { $visibility = getVisibility($recipe_id); if ($visibility == 'PRIVATE') { return isset($_SESSION["loggedin"]) and isAuthor($recipe_id); } else { if ($visibility == 'PUBLIC') { return true; } else { if ($visibility == 'REGISTERED') { return isset($_SESSION["loggedin"]) and $_SESSION["loggedin"]; } else { if ($visibility == 'FRIENDLY') { return isset($_SESSION["loggedin"]) and isAuthor($recipe_id) or isFriend($recipe_id); } } } } }
function manageComment($comment) { return isAdmin() || isAuthor($comment) ? '<a href="./edit.php?comment=' . $comment . '" class="edit"></a><a href="./delete.php?comment=' . $comment . '" class="delete"></a>' : ''; }
if (check('title') && check('content')) { $draftEntry['title'] = clean(cleanMagic($_POST['title'])); $draftEntry['content'] = cleanMagic($_POST['content']); saveEntry('drafts', $draft, $draftEntry); redirect('view.php?draft=' . $draft); } else { $out['title'] = $lang['editDraft'] . ': ' . $draftEntry['title']; $out['content'] .= '<form action="./edit.php?draft=' . $draft . '" method="post"> <p>' . text('title', $draftEntry['title']) . '</p> <p>' . textarea('content', clean($draftEntry['content'])) . '</p> <p>' . submitAdmin($lang['confirm']) . '</p> </form>'; $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : ''; } } else { if (isGET('comment') && (isAdmin() || isAuthor(GET('comment'))) && isValidEntry('comments', GET('comment'))) { $comment = GET('comment'); $commentEntry = readEntry('comments', $comment); if (checkBot() && check('content', $config['maxCommentLength'])) { $commentEntry['content'] = clean(cleanMagic($_POST['content'])); saveEntry('comments', $comment, $commentEntry); $postEntry = readEntry('posts', $commentEntry['post']); redirect('view.php?post=' . $commentEntry['post'] . '/pages/' . pageOf($comment, $postEntry['comment']) . '#' . $comment); } else { $out['title'] = $lang['editComment']; $out['content'] .= '<form action="./edit.php?comment=' . $comment . '" method="post"> <p>' . textarea('content', $commentEntry['content']) . '</p> <p>' . submitSafe($lang['confirm']) . '</p> </form>'; $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : ''; }
$postVals['post_entry'] = $_POST['post']; $forum->postUpdate($postInfo['post_id'], $postVals); $e107cache->clear('newforumposts'); $url = $e107->url->create('forum/thread/post', "id={$postInfo['post_id']}", 'encode=0&full=1'); // XXX what data is available, find thread name header('location:' . $url); exit; } } require_once HEADERF; if ($error) { $ns->tablerender(LAN_20, $error); } if ($action == 'edit' || $action == 'quote') { if ($action == 'edit') { if (!isAuthor()) { $ns->tablerender(LAN_95, "<div style='text-align:center'>" . LAN_96 . '</div>'); require_once FOOTERF; exit; } } if (!isset($_POST['fpreview'])) { $post = $e107->tp->toForm($postInfo['post_entry']); if ($postInfo['post_datestamp'] == $postInfo['thread_datestamp']) { $subject = $e107->tp->toForm($postInfo['thread_name']); } } if ($action == 'quote') { //remote [hide] bbcode, or else it doesn't hide stuff too well :) $post = preg_replace('#\\[hide].*?\\[/hide]#s', '', $post); $quoteName = $postInfo['user_name'] ? $postInfo['user_name'] : $postInfo['post_user_anon'];