$ERRORS[] = 'Invalid thread specified.'; } else { // Load the board info. $board = new Board($db); $board = $board->findOneByBoardId($thread->getBoardId()); if ($board == null) { $ERRORS[] = 'Invalid board.'; } else { if ($board->hasAccess($User) == false) { $ERRORS[] = 'Invalid board.'; } } } // end thread is valid if (sizeof($ERRORS) > 0) { draw_errors($ERRORS); } else { $BOARD_DATA = array('category' => $board->getCategoryName(), 'id' => $board->getBoardId(), 'name' => $board->getBoardName(), 'locked' => $board->getBoardLocked($User)); $THREAD_DATA = array('id' => $thread->getBoardThreadId(), 'name' => $thread->getThreadName(), 'locked' => $thread->getLocked(), 'sticky' => $thread->getStickied(), 'can_edit' => $User->hasPermission('edit_post') == true ? true : false); // Generate the pagination. $pagination = pagination("thread/{$thread->getBoardThreadId()}", $thread->grabPosts(null, true), $max_items_per_page, $page_id); $POST_LIST = array(); $posts = $thread->grabPosts('ORDER BY board_thread_post.posted_datetime ASC', false, $start, $end); foreach ($posts as $post) { $POST_LIST[] = array('id' => $post->getBoardThreadPostId(), 'posted_at' => $User->formatDate($post->getPostedDatetime()), 'text' => $post->getPostText(), 'user_id' => $post->getUserId(), 'username' => $post->getUserName(), 'user_title' => $post->getUserTitle(), 'signature' => $post->getSignature(), 'avatar_url' => $post->getAvatarUrl(), 'avatar_name' => $post->getAvatarName(), 'user_post_count' => $post->getPostCount(), 'page' => $page_id, 'can_edit' => $User->hasPermission('edit_post') == true ? true : false); } // end thread loop $ADMIN_ACTIONS = array('' => 'Moderation...'); if ($User->hasPermission('delete_post') == true) { $ADMIN_ACTIONS['delete_post'] = 'Delete Post'; $ADMIN_ACTIONS['delete_thread'] = 'Delete Thread';
draw_errors($ERRORS); } else { switch ($_REQUEST['state']) { default: $BOARD = array('category' => $board->getCategoryName(), 'id' => $board->getBoardId(), 'name' => $board->getBoardName()); $THREAD = array('id' => $thread->getBoardThreadId(), 'name' => $thread->getThreadName(), 'sticky' => $thread->getStickied()); $renderer->assign('board', $BOARD); $renderer->assign('thread', $THREAD); $renderer->assign('page', $page); $renderer->assign('post_id', $post->getBoardThreadPostId()); $renderer->assign('text', $post->getPostText()); $renderer->display('boards/edit_post.tpl'); break; // end default // end default case 'save': $html = trim(clean_xhtml($_POST['post_text'])); if ($html == null) { draw_errors('You cannot blank the message out.'); } else { $post->setPostText($html); $post->save(); $_SESSION['board_notice'] = 'You have edited the post.'; redirect(null, null, "threads/{$thread->getBoardShortName()}/{$thread->getBoardThreadId()}/{$page}#p{$post->getBoardThreadPostId()}"); } break; // end save } // end state switch } // end no errors
* be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public * License for more details. * * You should have received a copy of the GNU General * Public License along with 'iTorrent'; if not, * write to the Free Software Foundation, Inc., 51 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nicholas 'Owl' Evans <*****@*****.**> * @copyright Nicolas Evans, 2007 * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @package iTorrent * @version 1.0.0 **/ $hash_id = stripinput($_POST['hash_id']); $torrent = Torrent::findOneByHash($APP_CONFIG['rpc_uri'], $hash_id); if ($torrent == null) { draw_errors('Invalid torrent hash specified.'); } else { $name = $torrent->getTitle(); $torrent->remove($APP_CONFIG['rpc_uri']); $_SESSION['torrents_alert'] = "{$name} was removed."; if ($UI_TYPE == 'iphone') { redirect(null, null, "torrents/#torrent_{$torrent->getHash()}"); } else { redirect('torrents'); } } // end change status
$_SESSION['board_notice'] = 'You have unlocked the thread.'; } else { $thread->setLocked('Y'); $_SESSION['board_notice'] = 'You have locked the thread.'; } $thread->save(); redirect(null, null, "thread/{$thread->getBoardThreadId()}/{$page}"); break; // end lock // end lock case 'stick': if ($thread->getStickied() == true) { $_SESSION['board_notice'] = 'You have unstuck the thread.'; $thread->setStickied(false); } else { $_SESSION['board_notice'] = 'You have stuck the thread.'; $thread->setStickied(true); } $thread->save(); redirect(null, null, "thread/{$thread->getBoardThreadId()}/{$page}"); break; // end stick // end stick default: draw_errors('Invalid action.'); break; // end default } // end action switch } // end permission wrapping
if ($_SESSION['event_notice'] != null) { $renderer->assign('event_notice', $_SESSION['event_notice']); unset($_SESSION['event_notice']); } // end event notice $renderer->assign('events', $NOTICE_LIST); $renderer->display('user/events.tpl'); break; // end default // end default case 'jump': $notice_id = stripinput($_REQUEST['notification_id']); $notice = new Notification($db); $notice = $notice->findOneBy(array('user_notification_id' => $notice_id, 'user_id' => $User->getUserId())); if ($notice == null) { draw_errors('Invalid notice specified.'); } else { $raw = $notice->getNotificationUrl(); $notice->destroy(); redirect(null, null, "/{$raw}"); } break; // end jump // end jump case 'clear': $User->clearNotifications(); $_SESSION['event_notice'] = 'You have cleared your notices.'; redirect('notice'); break; // end clear }
} if (sizeof($ERRORS) > 0) { draw_errors($ERRORS); } else { switch ($_REQUEST['state']) { default: $BOARD = array('category' => $board->getCategoryName(), 'id' => $board->getBoardId(), 'name' => $board->getBoardName()); $THREAD = array('id' => $thread->getBoardThreadId(), 'name' => $thread->getThreadName(), 'sticky' => $thread->getStickied()); $renderer->assign('board', $BOARD); $renderer->assign('thread', $THREAD); $renderer->assign('page', $page); $renderer->display('boards/edit_thread.tpl'); break; // end default // end default case 'save': $title = trim($_POST['thread']['title']); if ($title == null) { draw_errors('You cannot blank the topic out.'); } else { $thread->setThreadName($title); $thread->save(); $_SESSION['board_notice'] = 'You have edited the topic.'; redirect(null, null, "thread/{$thread->getBoardThreadId()}/{$page}"); } break; // end save } // end state switch } // end no errors
* * 'Kitto_Kitto_Kitto' is distributed in the hope that it will * be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public * License for more details. * * You should have received a copy of the GNU General * Public License along with 'Kitto_Kitto_Kitto'; if not, * write to the Free Software Foundation, Inc., 51 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * @author Nicholas 'Owl' Evans <*****@*****.**> * @copyright Nicolas Evans, 2007 * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @package Kitto_Kitto_Kitto * @subpackage Pets * @version 1.0.0 **/ $pet_id = stripinput($_REQUEST['pet_id']); $pet = new Pet($db); $pet = $pet->findOneByUserPetId($pet_id); if ($pet == null) { draw_errors('Invalid pet specified.'); } else { $owner = $pet->grabUser(); $PET = array('id' => $pet->getUserPetId(), 'name' => $pet->getPetName(), 'owner' => array('id' => $owner->getUserId(), 'name' => $owner->getUserName()), 'specie' => $pet->getSpecieName(), 'hunger' => $pet->getHungerText(), 'happiness' => $pet->getHappinessText(), 'birthdate' => $User->formatDate($pet->getCreatedAt()), 'profile' => $pet->getProfile(), 'image' => $pet->getImageUrl()); $renderer->assign('pet', $PET); $renderer->display('pets/profile.tpl'); } // end display pet
} if ($_SESSION['magic_game'] != null) { $renderer->assign('result', $_SESSION['magic_game']); unset($_SESSION['magic_game']); } $renderer->assign('cost', $cost); $renderer->assign('prize', $prize); $renderer->assign('cards', $CARD_LIST); $renderer->display('games/magic/wager.tpl'); break; // end default // end default case 'guess': $guess = stripinput($_POST['card']); if (in_array($guess, array_keys($CARDS)) == false) { draw_errors('You have to pick a card.'); } else { $random = array_rand($CARDS); $choice = $CARDS[$random]; if ($random == $guess) { $User->subtractCurrency($cost); $_SESSION['magic_game'] = "Got your card? Alright...I think you have the <strong>{$choice}</strong>! What, I'm right? Woohoo, that'll be " . format_currency($cost) . "!"; } else { $User->addCurrency($prize); $_SESSION['magic_game'] = "Got your card? Alright...I think you have the <strong>{$choice}</strong>! What, I'm wrong? Let me see..aww, shucks. I guess that's " . format_currency($prize) . " to you..."; } redirect('magic-game'); } // end card selected break; // end guess