function sendMessage($user_id, $other_user_id, $msg_text) { if (userExistsById($user_id) === true && userExistsById($other_user_id) === true) { $msg_text = trim($msg_text); if ($msg_text === "") { return false; } $msg_id = insertMsg($msg_text); if (isNum($msg_id)) { insertUserMessage($msg_id, $user_id, $other_user_id, "Sent"); insertUserMessage($msg_id, $other_user_id, $user_id, "Inbox"); return true; } return false; } else { return false; } }
function postCreate($topic_id, $author_id, $message, $flags) { global $database_cfg; $errors = array(); if (!userExistsById($author_id)) { $errors[] = "User marked as author (" . $author_id . ") not found"; } if (!topicExistsById($topic_id)) { $errors[] = "Topic marked as parent not found"; } if (postExists($topic_id, $message)) { $errors[] = "This post already exists in this topic"; } if (count($errors) > 0) { return $errors; } databaseQuery("insert into " . $database_cfg["prefix"] . "posts (topic_id, author_id, message, flags, created) values ('" . intval($topic_id) . "', '" . intval($author_id) . "', '" . stringEncode($message) . "', '" . $flags . "', '" . stringEncode(date("H:i, d.m.Y")) . "')"); databaseQuery("update " . $database_cfg["prefix"] . "topics set edited='" . stringEncode(date("H:i, d.m.Y")) . "' where id='" . intval($topic_id) . "'", "Can't update topic"); }
function topicCreateDiscussion($title, $author_id, $readers) { $flags = array("private"); foreach ($readers as $i) { if (is_numeric($i) && userExistsById($i)) { $flags[] = $i; } } topicCreate($title, $author_id, -1, $flags); }
function topicCreateDiscussion($title, $author_id, $readers = array()) { $flags = array("private"); $readers[] = $author_id; foreach ($readers as $i) { if (userExistsById($i)) { $flags[] = "[" . $i . "]"; } } topicCreate($title, $author_id, -1, $flags); }
function userDrop($user_id) { global $database_cfg; if (userExistsById($user_id)) { databaseQuery("delete from " . $database_cfg["prefix"] . "users where id='" . intval($post_id) . "'", "Can't delete user"); } }
echo "<a href=\"index.php?topic_id=" . $i["id"] . "\">" . stringDecode($i["title"]) . "</a><br />"; } } } } else { echo "<b>Error:</b> user not found"; } } else { $topics = topicGetByIdRange(-1, 0, 5); for ($i = 0; $i < count($topics); $i++) { if (!topicCheckPrivate($topics[$i]["id"]) || topicCheckReader($topics[$i]["id"], $user["id"])) { echo "<a href=\"index.php?topic_id=" . intval($topics[$i]["id"]) . "\">" . stringDecode($topics[$i]["title"]) . "</a> <br />"; } } $user = userGetLoggedIn(); if (userExistsById($user["id"])) { echo "<br /><br />"; echo "<p class=\"item_top\">Create new topic</p>"; echo "<form action=\"index.php?newtopic\" method=\"post\">"; echo "Title:<br /><input type=\"text\" name=\"title\" /><br />"; echo "Message:<br /><textarea name=\"message\"></textarea><br />"; echo "<input type=\"submit\" value=\"create\" />"; echo "</form>"; echo "<br /><br />"; } } } } } } }
<?php $page_title = "Welcome to TutorMe"; require_once "/html/html_header.html"; require_once CLASSES_PATH . "InfoManager.php"; if (isLoggedIn()) { redirectIn(); } if (isset($_POST["activate"])) { if (isset($_POST["user_id"])) { $user_id = $_POST["user_id"]; if (userExistsById($user_id) === true) { updateCode($user_id); if (accountActivation($user_id) === true) { $_SESSION["flash_msg"] = ACTIVATION_EMAIL_SUCCESS; } else { $_SESSION["flash_msg"] = ACTIVATION_EMAIL_FAIL; } } } } ?> <div class="my-nav"></div> <div id="content"> <div id="main-content"> <div class="centered"> <?php displayFlashMsg(); ?>