示例#1
0
function render_mail_queue()
{
    $mysqli = db_connect();
    $html = render_header("Mail Queue");
    $mysqli = db_connect();
    $sql = "SELECT * FROM MailQueue ORDER BY Id";
    $result = $mysqli->query($sql);
    $html .= "<br/><table border='1' cellspacing='1' cellpadding='5' width='80%' style='margin:auto;'>\n";
    $i = 0;
    while ($row = @$result->fetch_assoc()) {
        $i++;
        if ($i == 1) {
            $html .= "<tr>\n";
            foreach ($row as $key => $val) {
                $html .= "<th>" . $key . "</th>\n";
            }
            $html .= "</tr>\n";
        }
        $html .= "<tr>\n";
        foreach ($row as $key => $val) {
            $html .= "<td>" . $val . "</td>\n";
        }
        $html .= "</tr>\n";
    }
    $html .= "</table>\n";
    $html .= "<p align='center'>" . $i . " items waiting in the queue.</p>\n";
    $html .= render_footer();
    return $html;
}
示例#2
0
function render_help_page()
{
    $html = render_header("Help");
    $html .= "<div class=\"page_wrapper\">\n" . "<div class=\"page\">\n" . "<h1>Help</h1>\n" . "<p>In the very likely event that you find something that doesn't work within the site, please send us an email and try to be as descriptive as possible about what you were doing, and what the site did.</p>\n" . "<p><a href=\"mailto:support@wetheusers.net\">support@wetheusers.net</a></p>\n" . "<p>Thankyou for your support!</p>\n" . "</div>\n" . "</div>\n";
    $html .= render_footer();
    return $html;
}
示例#3
0
function render_suggested_users($days = 7, $page = 1)
{
    $start = (intval($page) - 1) * 20;
    $html = render_header("Suggested Users");
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li class=\"selected\"><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $mysqli = db_connect();
    $html .= "<div id=\"header\">\n" . "<h1>Suggested Users</h1>\n" . "<p>Users with the most popular public content over the last " . $days . " days.</p>\n" . "</div>\n";
    $sql = "SELECT Users.*, COUNT(DISTINCT Posts.Id) AS PostCount, COUNT(DISTINCT Comments.Id) AS CommentCount, COUNT(DISTINCT Likes.Id) AS LikesCount, COUNT(DISTINCT Posts.Id) + COUNT(DISTINCT Comments.Id) + COUNT(DISTINCT Likes.Id) AS TotalCount\n" . " FROM Users" . " INNER JOIN Posts ON Posts.UserId=Users.Id AND Posts.Status=1 AND Posts.Privacy=0" . " LEFT OUTER JOIN Comments ON Posts.Id=Comments.PostId AND Comments.UserId<>Users.Id" . " LEFT OUTER JOIN Likes ON Posts.Id=Likes.PostId AND Likes.UserId<>Users.Id" . " WHERE Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '" . $mysqli->real_escape_string($days) . "' DAY)" . " GROUP BY Users.Id" . " ORDER BY TotalCount DESC" . " LIMIT " . $mysqli->real_escape_string($start) . ",20";
    $sql_count = "SELECT COUNT(DISTINCT Users.Id) AS NumUsers" . " FROM Users" . " INNER JOIN Posts ON Posts.UserId=Users.Id AND Posts.Status=1 AND Posts.Privacy=0" . " WHERE (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '" . $mysqli->real_escape_string($days) . "' DAY))";
    $user_result = $mysqli->query($sql);
    if ($user_result->num_rows > 0) {
        $html .= "<div class=\"directory_users\">\n";
        while ($user_row = @$user_result->fetch_assoc()) {
            $html .= render_user($user_row);
        }
        $html .= "<div class=\"clear\"></div>\n" . "</div>\n";
    }
    // fetch count for pagination
    $count_result = $mysqli->query($sql_count);
    $count_row = $count_result->fetch_assoc();
    $count = $count_row["NumUsers"];
    $html .= render_pagination("explore/suggested/" . $days, $page, $count, 20);
    $html .= render_footer();
    return $html;
}
示例#4
0
function render_firehose_page($numposts = 20, $page = 1)
{
    $start = (intval($page) - 1) * $numposts;
    $html = render_header("The Firehose");
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li class=\"selected\"><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $mysqli = db_connect();
    $sql = "";
    $count_sql = "";
    if (isset($_SESSION["user_id"])) {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,Likes.Id AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " LEFT OUTER JOIN Friends FriendsOfAuthor ON Posts.UserId=FriendsOfAuthor.UserId AND FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " WHERE" . " ((FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . "," . $mysqli->real_escape_string($numposts);
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsOfAuthor ON Posts.UserId=FriendsOfAuthor.UserId AND FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " WHERE" . " ((FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED;
    } else {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar, null AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . "," . $mysqli->real_escape_string($numposts);
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED;
    }
    // fetch count for pagination
    $count_result = $mysqli->query($sql_count);
    $count_row = $count_result->fetch_assoc();
    $count = $count_row["NumPosts"];
    $post_result = $mysqli->query($sql);
    $html .= "<div id=\"header\">\n" . "<h1>The Firehose</h1>\n" . "<p>Everything posted by everybody, across the entire site (well... everything they are choosing to let you see...)</p>\n" . "</div>";
    $html .= render_posts($mysqli, $post_result);
    /*
    $html .= "<div class=\"tiles\">\n";
    while ($post_row =@ $post_result->fetch_assoc()){
    	$html .= render_tile($mysqli,$post_row,false);
    }
    $html .= "</div> <!-- .tiles -->\n";
    */
    // Pagination
    $html .= render_pagination("explore/firehose/" . $numposts, $page, $count, $numposts);
    $html .= render_display_controls();
    $html .= render_footer();
    return $html;
}
示例#5
0
function render_tag_page($tag_name, $page)
{
    $start = (intval($page) - 1) * 20;
    $html = render_header($tag_name, "", true);
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li class=\"selected\"><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $mysqli = db_connect();
    $sql = "";
    $sql_count = "";
    if (isset($_SESSION["user_id"])) {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,Likes.Id AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " INNER JOIN PostTags ON Posts.Id=PostTags.PostId" . " INNER JOIN Tags ON PostTags.TagId=Tags.Id" . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'" . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " INNER JOIN PostTags ON Posts.Id=PostTags.PostId" . " INNER JOIN Tags ON PostTags.TagId=Tags.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'";
    } else {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " INNER JOIN PostTags ON Posts.Id=PostTags.PostId" . " INNER JOIN Tags ON PostTags.TagId=Tags.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'" . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " INNER JOIN PostTags ON Posts.Id=PostTags.PostId" . " INNER JOIN Tags ON PostTags.TagId=Tags.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'";
    }
    // fetch count for pagination
    $count_result = $mysqli->query($sql_count);
    $count_row = $count_result->fetch_assoc();
    $count = $count_row["NumPosts"];
    $post_result = $mysqli->query($sql);
    $html .= "<div id=\"header\"><h1>Posts tagged &#8216;<span>" . $tag_name . "</span>&#8217;</h1></div>\n";
    $html .= render_posts($mysqli, $post_result);
    $html .= render_pagination("explore/tag/" . $tag_name, $page, $count, 20);
    $html .= render_display_controls();
    $html .= render_footer();
    return $html;
}
示例#6
0
function render_popular_page($page)
{
    $start = (intval($page) - 1) * 20;
    $html = render_header("Popular Posts");
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li class=\"selected\"><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $mysqli = db_connect();
    if (isset($_SESSION["user_id"])) {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,Likes.Id AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '1' DAY))" . " ORDER BY (Posts.Likes + Posts.Comments) DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '1' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED;
    } else {
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar, null AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '1' DAY))" . " ORDER BY (Posts.Likes + Posts.Comments) DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '1' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED;
    }
    // fetch count for pagination
    $count_result = $mysqli->query($sql_count);
    $count_row = $count_result->fetch_assoc();
    $count = $count_row["NumPosts"];
    $post_result = $mysqli->query($sql);
    $html .= "<div id=\"header\">\n" . "<h1>Popular Posts</h1>\n" . "<p>The most popular content available to you of the last 24 hours, judged by comments and likes...</p>\n" . "</div>";
    $html .= render_posts($mysqli, $post_result);
    $html .= render_pagination("explore/popular", $page, $count, 20);
    $html .= render_display_controls();
    $html .= render_footer();
    return $html;
}
示例#7
0
function render_tags_page()
{
    $html = render_header("Tags");
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li class=\"selected\"><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $mysqli = db_connect();
    if (isset($_SESSION["user_id"])) {
        $sql = "SELECT Tags.Name AS TagName, COUNT(Tags.Id) AS TagCount FROM Tags" . " INNER JOIN PostTags ON Tags.Id=PostTags.TagId" . " INNER JOIN Posts ON PostTags.PostId=Posts.Id" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsOfAuthor ON Posts.UserId=FriendsOfAuthor.UserId AND FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " WHERE ((FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " GROUP BY Tags.Name" . " ORDER BY Tags.Name";
    } else {
        $sql = "SELECT Tags.Name AS TagName, COUNT(Tags.Id) AS TagCount FROM Tags" . " INNER JOIN PostTags ON Tags.Id=PostTags.TagId" . " INNER JOIN Posts ON PostTags.PostId=Posts.Id" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " GROUP BY Tags.Name" . " ORDER BY Tags.Name";
    }
    $tags_result_a = $mysqli->query($sql);
    $tags_result_b = $mysqli->query($sql);
    $html .= "<div id=\"header\">\n" . "<h1>Tags</h1>\n" . "<p>Explore the tags of posts from the last 7 days.</p>\n" . "</div>\n";
    // find the highest number of tags
    $max_tags = 0;
    while ($tags_row = @$tags_result_a->fetch_assoc()) {
        if (intval($tags_row["TagCount"]) > $max_tags) {
            $max_tags = intval($tags_row["TagCount"]);
        }
    }
    $range = 2;
    $html .= "<div id='tags_page'>\n" . "<div class=\"tags\">\n";
    while ($tags_row = @$tags_result_b->fetch_assoc()) {
        $tag_count = $tags_row["TagCount"];
        $ratio = $tag_count / $max_tags;
        $size = number_format(1 + $ratio * $range, 1);
        $html .= "<div class='tag' style='font-size:" . $size . "em !important;'><a title='" . addslashes($tags_row["TagName"]) . "' href='/explore/tag/" . $tags_row["TagName"] . "'>" . str_replace(" ", "&nbsp;", $tags_row["TagName"]) . "</a><br /><small>" . $tags_row["TagCount"] . " posts</small></div>\n";
    }
    $html .= "<div class='clear'></div>\n" . "</div> <!-- .tags -->\n" . "</div> <!-- #tags_page -->\n";
    $html .= render_footer();
    return $html;
}
示例#8
0
function render_search_page($search_terms = "", $page = 1)
{
    $start = (intval($page) - 1) * 20;
    $html = render_header("Search");
    $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/explore/firehose\" title=\"Firehose\">Firehose</a></li>\n" . "<li><a href=\"/explore/popular\" title=\"Popular\">Popular</a></li>\n" . "<li><a href=\"/explore/tags\" title=\"Tags\">Tags</a></li>\n" . "<li><a href=\"/explore/directory\" title=\"Directory\">Directory</a></li>\n" . "<li><a href=\"/explore/suggested\" title=\"Suggested Users\">Suggested</a></li>\n" . "<li class=\"selected\"><a href=\"/explore/search\" title=\"Search\">Search</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
    $html .= "<div id=\"header\">\n" . "<h1>Search</h1>\n" . "<p>Search the title and body of posts.</p>\n" . "<table id=\"search_form\" cellspacing=\"0\" cellpadding=\"5\"><tr>\n" . "<td><input type=\"text\" name=\"s\" id=\"search_text\" value=\"" . addslashes(urldecode($search_terms)) . "\" size=\"20\" onKeyPress=\"return checkSubmit(event)\"/></td>\n" . "<td><button id='search_submit_button' onClick=\"document.location.href = '/explore/search/' + \$('#search_text').val();\">Go</button></td>\n" . "</tr></table>";
    $html .= "<script>\n" . "\$(\"#search_text\").focus();\n" . "</script>\n";
    if ($search_terms != "") {
        $mysqli = db_connect();
        $sql = "";
        $count_sql = "";
        if (isset($_SESSION["user_id"])) {
            $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,Likes.Id AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "')" . " ORDER BY MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "') DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
            $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsA ON Posts.UserId=FriendsA.UserId" . " WHERE" . " ((FriendsA.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . ")" . " OR" . " (Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "')";
        } else {
            $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar, null AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "')" . " ORDER BY MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "') DESC LIMIT " . $mysqli->real_escape_string($start) . ",20";
            $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE" . " Posts.Privacy=" . POST_PRIVACY_PUBLIC . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND MATCH(Posts.Title, Posts.Body) AGAINST ('" . $mysqli->real_escape_string($search_terms) . "')";
        }
        // fetch count for pagination
        $count_result = $mysqli->query($sql_count);
        $count_row = $count_result->fetch_assoc();
        $count = $count_row["NumPosts"];
        $post_result = $mysqli->query($sql);
        $html .= "<p>" . $count . " posts found with '" . $search_terms . "' in the title, or body...</p>\n" . "</div> <!-- #header -->\n";
        $html .= render_posts($mysqli, $post_result);
        // Pagination
        $html .= render_pagination("explore/search/" . $search_terms, $page, $count, 20);
        $html .= render_display_controls();
    } else {
        $html .= "</div> <!-- #header -->\n";
    }
    $html .= render_footer();
    return $html;
}
示例#9
0
function render_faq()
{
    $html = render_header("Frequently Asked Questions");
    $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"faq\" class=\"page\">\n" . "<h1>Frequently Asked Questions</h1>\n" . "<br />\n" . "<p>This page will be updated regularly with answers to common questions. If you don't find an answer to your question, send an email to <a href=\"mailto:support@wetheusers.net\">support@wetheusers.net</a> and we'll do our best to answer quickly.</p>\n";
    $html .= file_get_contents("lib/html/faq.htm");
    $html .= "</div></div>\n";
    $html .= render_footer();
    return $html;
}
示例#10
0
function render_terms()
{
    $html = render_header("Terms and Conditions");
    $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"faq\" class=\"page\">\n" . "<h1>Terms and Conditions</h1>\n" . "<br />\n";
    $html .= file_get_contents("lib/html/terms.htm");
    $html .= "</div></div>\n";
    $html .= render_footer();
    return $html;
}
示例#11
0
function render_privacy()
{
    $html = render_header("Privacy Policy");
    $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"faq\" class=\"page\">\n" . "<h1>Privacy Policy</h1>\n" . "<br />\n";
    $html .= file_get_contents("lib/html/privacy.htm");
    $html .= "</div></div>\n";
    $html .= render_footer();
    return $html;
}
示例#12
0
function render_welcome_page()
{
    $html = render_header("Welcome to " . SITE_NAME . "!");
    $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"faq\" class=\"page\">\n" . "<h1>Welcome!</h1>\n" . "<h2 class=\"center\">Go check your email!</h2>" . "<br />\n";
    $html .= "<p>Your account has been successfully created, and a temporary password has been emailed to you that you can change later. Please note that some online email systems (we have noticed Yahoo and Outlook.com are the worst offenders) sometimes take a few minutes to receive machine generated emails. Gmail seems to be fine.</p>\n" . "<p>Once you have the email, head to the <a href=\"/login\">Login</a> page. Remember to check your spam folder if you don't think the email has arrived.</p>\n" . "<p>If you do not received the password, you can use the password reset form to have another one sent.</p>\n" . "<p>If you suspect you may have typed your email address incorrectly, please get in touch with <a href=\"mailto:support@wetheusers.net\">support@wetheusers.net</a>, and we'll help you out.</p>\n";
    $html .= "</div></div>\n";
    $html .= render_footer();
    return $html;
}
示例#13
0
function render_user_directory($tag_name = "", $page = 1)
{
    $start = (intval($page) - 1) * 20;
    $html = render_header("User Directory");
    $mysqli = db_connect();
    // check if a tag is passed in
    if ($tag_name == "") {
        // No tag - draw the tags
        $sql = "SELECT Tags.Name AS TagName, COUNT(Tags.Id) AS TagCount" . " FROM Tags" . " INNER JOIN UserTags ON Tags.Id=UserTags.TagId" . " INNER JOIN Users ON UserTags.UserId=Users.Id" . " GROUP BY Tags.Name" . " ORDER BY Tags.Name";
        // ." HAVING COUNT(Tags.Id)>1" - goes above ORDER BY
        $html .= "<div id=\"header\">\n" . "<h1>User Directory</h1>\n" . "<p>Explore the tags users have filed themselves under - edit your <a href=\"/account\">account</a> details to file yourself under some tags.</p>\n" . "</div>\n";
        $tags_result_a = $mysqli->query($sql);
        $tags_result_b = $mysqli->query($sql);
        // find the most tags to do sizing
        $max_tags = 0;
        while ($tags_row = @$tags_result_a->fetch_assoc()) {
            if (intval($tags_row["TagCount"]) > $max_tags) {
                $max_tags = intval($tags_row["TagCount"]);
            }
        }
        $range = 2;
        $html .= "<div id='tags_page'>\n" . "<div class=\"tags\">\n";
        while ($tags_row = @$tags_result_b->fetch_assoc()) {
            // math to work out size of font
            $tag_count = $tags_row["TagCount"];
            $ratio = $tag_count / $max_tags;
            $size = number_format(1 + $ratio * $range, 1);
            $html .= "<div class='tag' style='font-size:" . $size . "em !important;'><a title='" . addslashes($tags_row["TagName"]) . "' href='/directory/" . htmlspecialchars($tags_row["TagName"]) . "'>" . str_replace(" ", "&nbsp;", $tags_row["TagName"]) . "</a><br /><small>" . $tags_row["TagCount"] . " users</small></div>\n";
        }
        $html .= "<div class='clear'></div>\n" . "</div> <!-- .tags -->\n" . "</div> <!-- #tags_page -->\n";
    } else {
        $html .= "<div id=\"header\">\n" . "<h1>User Directory : &#8216;<span>" . $tag_name . "</span>&#8217;</h1>\n" . "<p>Here are the users that have filed themselves under the tag '" . $tag_name . "'</p>\n" . "</div>\n";
        // get all the users with a particular tag
        $sql = "SELECT Users.*, COUNT(DISTINCT Posts.Id) AS PostCount, COUNT(DISTINCT Comments.Id) AS CommentCount, COUNT(DISTINCT Likes.Id) AS LikesCount,COUNT(DISTINCT Posts.Id) + COUNT(DISTINCT Comments.Id) + COUNT(DISTINCT Likes.Id) AS TotalCount\n" . " FROM Users" . " INNER JOIN UserTags ON Users.Id=UserTags.UserId" . " INNER JOIN Tags ON Tags.Id=UserTags.TagId" . " LEFT OUTER JOIN Posts ON Posts.UserId=Users.Id AND Posts.Status=1 AND Posts.Privacy=0" . " LEFT OUTER JOIN Comments ON Posts.Id=Comments.PostId AND Comments.UserId<>Users.Id" . " LEFT OUTER JOIN Likes ON Posts.Id=Likes.PostId AND Likes.UserId<>Users.Id" . " WHERE Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'" . " GROUP BY Users.Id" . " ORDER BY TotalCount DESC" . " LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Users.Id) AS NumUsers" . " FROM Users" . " INNER JOIN UserTags ON Users.Id=UserTags.UserId" . " INNER JOIN Tags ON Tags.Id=UserTags.TagId" . " INNER JOIN Posts ON Posts.UserId=Users.Id AND Posts.Status=1 AND Posts.Privacy=0" . " LEFT OUTER JOIN Comments ON Posts.Id=Comments.PostId" . " LEFT OUTER JOIN Likes ON Posts.Id=Likes.PostId" . " WHERE Tags.Name='" . $mysqli->real_escape_string($tag_name) . "'" . " GROUP BY Users.Id";
        $user_result = $mysqli->query($sql);
        if ($user_result->num_rows > 0) {
            $html .= "<div class=\"directory_users\">\n";
            while ($user_row = @$user_result->fetch_assoc()) {
                $html .= render_user($user_row);
            }
            $html .= "</div>\n";
        } else {
            $html .= "<p>There are no users filed under the tag '" . $tag_name . "'</p>\n";
        }
        // fetch count for pagination
        $count_result = $mysqli->query($sql_count);
        $count_row = $count_result->fetch_assoc();
        $count = $count_row["NumUsers"];
        $html .= render_pagination("user_directory/" . $tag_name, $page, $count, 20);
    }
    $html .= render_footer();
    return $html;
}
示例#14
0
function render_chat_page()
{
    if (isset($_SESSION["user_id"])) {
        $html = render_header("Chat");
        $html .= "<div id=\"header\">\n" . "<h1>Chat</h1>\n" . "<p>IRC Chat powered by <a href=\"http://mibbit.com\">Mibbit</a> (server = irc.mibbit.com, channel = #WeTheUsers)</p>\n" . "</div>";
        $html .= "<iframe style=\"display:block;margin:0px auto 0px auto;\" frameborder=\"0\" width=\"90%\" height=\"80%\" scrolling=\"no\" src=\"http://widget.mibbit.com/?settings=9092067ea4c785ce94d25452be90e031&server=irc.mibbit.net&channel=%23WeTheUsers&nick=" . $_SESSION["user_name"] . "\"></iframe>";
        $html .= render_footer();
        return $html;
    } else {
        header("Location: /403");
    }
}
示例#15
0
function render_home_page($numposts = 20, $page = 1)
{
    $start = (intval($page) - 1) * $numposts;
    $html = render_header("Home");
    $mysqli = db_connect();
    if (isset($_SESSION["user_id"])) {
        // does the logged in user have any friends yet ?
        $friends_sql = "SELECT COUNT(*) AS NumFriends FROM Friends WHERE UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]);
        $friends_result = $mysqli->query($friends_sql);
        $friends_row = $friends_result->fetch_assoc();
        $friends_count = $friends_row["NumFriends"];
        if ($friends_count > 0) {
            // get the friends only posts by people who call you a friend
            // also get friends public posts
            // also get your own posts
            $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,Likes.Id AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsOfMe ON FriendsOfMe.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND FriendsOfMe.FriendId=Posts.UserId" . " LEFT OUTER JOIN Friends FriendsOfAuthor ON Posts.UserId=FriendsOfAuthor.UserId AND FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " WHERE" . " ((FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . " AND FriendsOfMe.FriendId=Posts.UserId)" . " OR" . " (FriendsOfMe.FriendId=Posts.UserId AND Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . "," . $mysqli->real_escape_string($numposts);
            $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " LEFT OUTER JOIN Friends FriendsOfMe ON FriendsOfMe.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND FriendsOfMe.FriendId=Posts.UserId" . " LEFT OUTER JOIN Friends FriendsOfAuthor ON Posts.UserId=FriendsOfAuthor.UserId AND FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " LEFT OUTER JOIN Likes ON Likes.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Likes.PostId=Posts.Id" . " WHERE" . " ((FriendsOfAuthor.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND Posts.Privacy=" . POST_PRIVACY_FRIENDS_ONLY . " AND FriendsOfMe.FriendId=Posts.UserId)" . " OR" . " (FriendsOfMe.FriendId=Posts.UserId AND Posts.Privacy=" . POST_PRIVACY_PUBLIC . ")" . " OR" . " (Posts.UserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . "))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED;
        } else {
            // no friends - fetch popular content from the last 7 days
            $html .= "<div id=\"header\">\n" . "<h1>Welcome to " . SITE_NAME . " - No Friends Yet?</h1>\n" . "<p>Here is some popular content from the last 7 days. You might also like to check out the <a href=\"/explore/firehose\">Firehose</a>.</p>\n" . "</div>\n";
            $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,null AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Posts.Privacy=" . POST_PRIVACY_PUBLIC . " ORDER BY Created DESC LIMIT " . $mysqli->real_escape_string($start) . "," . $mysqli->real_escape_string($numposts);
            $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Posts.Privacy=" . POST_PRIVACY_PUBLIC;
        }
    } else {
        // not logged in - fetch popular content from the last 7 days
        $html .= "<div id=\"header\">\n" . "<h1>Post, Friend, Follow, Like, Comment</h1>\n" . "<p>Welcome to a new social experience on the internet - <strong><a href=\"/register\">register</a></strong> now, and begin posting!</p>\n" . "</div>\n";
        $sql = "SELECT DISTINCT Posts.*,Users.Username,Users.Avatar,null AS LikeId FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Posts.Privacy=" . POST_PRIVACY_PUBLIC . " ORDER BY Posts.Likes DESC LIMIT " . $mysqli->real_escape_string($start) . "," . $mysqli->real_escape_string($numposts);
        $sql_count = "SELECT COUNT(DISTINCT Posts.Id) AS NumPosts FROM Posts" . " INNER JOIN Users ON Posts.UserId=Users.Id" . " WHERE (Posts.Created > (CURRENT_TIMESTAMP - INTERVAL '7' DAY))" . " AND Posts.Status=" . POST_STATUS_PUBLISHED . " AND Posts.Privacy=" . POST_PRIVACY_PUBLIC;
        //print "<p>".$sql;
        //print "<p>".$sql_count;
    }
    // fetch count for pagination
    $count_result = $mysqli->query($sql_count);
    $count_row = $count_result->fetch_assoc();
    $count = $count_row["NumPosts"];
    $post_result = $mysqli->query($sql);
    if (isset($_GET["debug"])) {
        print "<p><br /><br /><code>" . $sql . "</code></p>";
    }
    $html .= render_posts($mysqli, $post_result);
    $html .= render_pagination("home/" . $numposts, $page, $count, $numposts);
    $html .= render_display_controls();
    $html .= render_footer();
    // $html .= "<pre>".$sql."</pre>\n";
    return $html;
}
示例#16
0
function render_import_rss()
{
    if (isset($_SESSION["user_id"])) {
        // fetch the user row from the database to get the defaults from it
        $mysqli = db_connect();
        $user_result = $mysqli->query("SELECT * FROM Users WHERE Id=" . $mysqli->real_escape_string($_SESSION["user_id"]));
        $user_row = $user_result->fetch_assoc();
        $html = render_header("Directory");
        $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/account/import\" title=\"Import\">Import</a></li>\n" . "<li class=\"selected\"><a href=\"/account/import/rss\" title=\"RSS\">RSS</a></li>\n" . "<li><a href=\"/account/import/wordpress\" title=\"Wordpress\">Wordpress</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
        $html .= "<div id=\"header\">\n" . "<h1>Import RSS</h1>\n" . "<p>Fill out the form below to import an RSS feed. This is a one-hit operation - it will not update in the future, and running it repeatedly will duplicate posts.</p>\n" . "</div>\n";
        $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"account_form\" class=\"page\">\n" . "<form method=\"POST\" action=\"/api/account/import_feed/rss\">\n" . "<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">\n" . "<tr><th class=\"heading\" colspan=\"2\"><h3>RSS Feed</h3><p>Enter the full URL of the RSS feed, and the privacy of imported posts.</p></th></tr>\n" . "<tr><th>Feed URL</th><td><input type=\"text\" name=\"url\" /></td></tr>\n" . "<tr><th>Privacy</th><td><select name=\"privacy\">\n" . "  <option value=\"0\" " . ($user_row["DefaultPostPrivacy"] == 0 ? "selected" : "") . " >Public</option>\n" . "  <option value=\"1\" " . ($user_row["DefaultPostPrivacy"] == 1 ? "selected" : "") . " >Friends Only</option>\n" . "</select></td></tr>\n" . "<tr><td colspan='2' align='right'><input type='submit' value='Import' /></td></tr>\n" . "</table>\n" . "</div> <!-- #account_form -->\n" . "</div> <!-- .page_wrapper -->\n";
        $html .= render_footer();
        return $html;
    } else {
        header("Location: /403");
    }
}
示例#17
0
function invite_page()
{
    $html = render_header("Invite");
    $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"invite\" class=\"page\">\n" . "<h1>Invite</h1>\n" . "<br />\n";
    if (isset($_SESSION["user_id"])) {
        $html .= "<p>Use this page to invite people into the system - just paste text that includes email addresses into the box below, and hit Go - you don't have to clean the text up - the site will find all the valid looking email addresses for you.</p>\n";
        $raw_data = isset($_POST["raw_data"]) ? $_POST["raw_data"] : "";
        if (strpos($_SERVER["REQUEST_URI"], "finished") > 0) {
            $html .= "<br /><br /><h1>Finished!</h1><p>Your email invites have been sent.</p>\n\n";
        } else {
            $html .= "<form method=\"POST\" action=\"/api/invite\">\n" . "<textarea id=\"raw_data\" name=\"raw_data\" rows=\"10\" style=\"width:100%;\">\n" . $raw_data . "</textarea>\n" . "<input type=\"submit\" value=\"Go!\" />\n" . "</form>\n" . "<br /><p><small>WeTheUsers does not record invited email addresses.</small></p>\n";
        }
    } else {
        $html .= "<p>You must be logged in to use this feature.</p>\n";
    }
    $html .= "</div></div>\n";
    $html .= render_footer();
    return $html;
}
示例#18
0
/*
 * mysmilies.php - Show the user's moods
 *
 */
include_once 'constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
$fb = get_fb();
$user = $fb->require_login();
// The list of possible moods
$moods = get_moods();
// Your past moods are stored in a preference for simplicity
$mood_list = $fb->api_client->data_getUserPreference(0);
// This can be viewed as an app page or a tabs
if (!isset($_POST['is_tab'])) {
    echo render_header('Mine');
} else {
    echo render_inline_style();
}
echo '<div style="text-align: center">';
echo '<h2>' . '<fb:intl desc="Page header for list of someone\'s smilies">' . '<fb:name firstnameonly="true" useyou="false" possessive="true" ' . 'linked="false" uid="' . $user . '"/>' . ' Smilies' . '</fb:intl>' . '</h2>';
$user_name = '<fb:name useyou="false" uid="' . $fb->user . '"/>';
echo '<h3 style="padding: 7px 0px">' . '<fb:intl>' . 'We are pleased to announce that ' . $user_name . ' has been feeling:' . '</fb:intl>' . '</h3>';
echo '<div style="overflow:hidden"><div class="past">';
$n = max(3, count($mood_list));
for ($i = 0; $i < $n; $i++) {
    $v = intval($mood_list[$i]);
    $mood = $moods[$v];
    echo '<a class="box" href="smile.php?smile=' . $v . '"><div class="smiley">' . $mood[1] . '</div><div>' . '<fb:intl desc="Mood name for \'' . $mood[1] . '\'">' . $mood[0] . '</fb:intl>' . '</div></a>';
}
echo '</div></div>';
示例#19
0
<?php

/*
 * newsmiley.php - Create a new feed story
 *
 */
include_once 'constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
echo render_header('New');
$moods = get_moods();
echo '<h2>' . 'What\'s your mood today?' . '</h2>';
$fb = get_fb();
$set_count = $fb->api_client->data_getUserPreference(2);
if ($set_count > 0) {
    echo "<h3>You've set your mood {$set_count} time" . ($set_count > 1 ? 's' : '') . " in the past.</h3>";
}
$feed_handler = ROOT_LOCATION . '/handlers/feedHandler.php';
echo '<form fbtype="feedStory" action="' . $feed_handler . '">';
$js = 'final(' . FEED_STORY_1 . ',\'' . IMAGE_LOCATION . '\', \'http://apps.new.facebook.com/' . APP_SUFFIX . '\', \'' . ROOT_LOCATION . '\',';
echo render_emoticon_grid(get_moods(), $js);
echo '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="emoticon"></div>' . '</form></div>';
echo render_footer();
示例#20
0
function render_message_page($message_id, $in_reply_to = 0)
{
    if (isset($_SESSION["user_id"])) {
        $mysqli = db_connect();
        $overall_total_sql = "SELECT COUNT(Id) AS NumMessages FROM Messages WHERE ToUserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND ToStatus=0 AND ReadFlag=0";
        $overall_total_result = $mysqli->query($overall_total_sql);
        $overall_total_row = $overall_total_result->fetch_assoc();
        $overall_total = $overall_total_row["NumMessages"] > 0 ? " (" . $overall_total_row["NumMessages"] . ")" : "";
        $inbox_total_sql = "SELECT COUNT(Id) AS NumMessages FROM Messages WHERE ToUserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND ToStatus=0 AND Type=0 AND ReadFlag=0";
        $inbox_total_result = $mysqli->query($inbox_total_sql);
        $inbox_total_row = $inbox_total_result->fetch_assoc();
        $inbox_total = $inbox_total_row["NumMessages"] > 0 ? " (" . $inbox_total_row["NumMessages"] . ")" : "";
        $notification_total_sql = "SELECT COUNT(Id) AS NumMessages FROM Messages WHERE ToUserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " AND ToStatus=0 AND Type>0 AND ReadFlag=0";
        $notification_total_result = $mysqli->query($notification_total_sql);
        $notification_total_row = $notification_total_result->fetch_assoc();
        $notification_total = $notification_total_row["NumMessages"] > 0 ? " (" . $notification_total_row["NumMessages"] . ")" : "";
        $html = render_header("Message");
        $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/messages/compose\" title=\"Compose\">Compose</a></li>\n" . "<li><a href=\"/messages/all\" title=\"All\">All" . $overall_total . "</a></li>\n" . "<li><a href=\"/messages/inbox\" title=\"Inbox\">Inbox" . $inbox_total . "</a></li>\n" . "<li><a href=\"/messages/outbox\" title=\"Outbox\">Outbox</a></li>\n" . "<li><a href=\"/messages/notifications\" title=\"Notifications\">Notifications" . $notification_total . "</a></li>\n" . "<li><a href=\"/messages/trash\" title=\"Trash\">Trash</a></li>\n" . "<li class=\"selected\">Message</li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
        $html .= "<div id=\"header\">\n" . "<h1>Message</h1>\n" . "</div> <!-- #header -->\n" . "<div id=\"messages\">\n";
        // fetch the message
        $sql = "SELECT Messages.RootId" . " FROM Messages" . " WHERE Messages.Id=" . $mysqli->real_escape_string($message_id) . " AND (Messages.ToUserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " OR Messages.FromUserId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . ")";
        $message_result = $mysqli->query($sql);
        if ($message_result->num_rows > 0) {
            $message_row = $message_result->fetch_assoc();
            // get the messages matching the root id
            $sql = "SELECT Messages.*,FromUsers.Username As FromUsersUsername, FromUsers.Avatar AS FromUsersAvatar, ToUsers.Username As ToUsersUsername, ToUsers.Avatar AS ToUsersAvatar, ParentUsers.Username AS ParentUsersUsername, ParentMessages.Id AS ParentMessagesId" . " FROM Messages" . " INNER JOIN Users FromUsers ON Messages.FromUserId=FromUsers.Id" . " INNER JOIN Users ToUsers ON Messages.ToUserId=ToUsers.Id" . " LEFT OUTER JOIN Messages ParentMessages ON ParentMessages.Id=Messages.ParentId" . " LEFT OUTER JOIN Users ParentUsers ON ParentMessages.FromUserId=ParentUsers.Id" . " WHERE ((Messages.RootId=" . $mysqli->real_escape_string($message_row["RootId"]) . " AND Messages.Type=0) OR Messages.Id=" . $mysqli->real_escape_string($message_id) . ")" . " ORDER BY Created";
            $message_result = $mysqli->query($sql);
            $last_message_row = null;
            while ($message_row = @$message_result->fetch_assoc()) {
                $html .= "\n<div>\n\n" . render_message($message_row, false, $message_row["Id"] == $message_id ? true : false) . "</div> <!-- #messages -->\n";
                if ($message_row["FromUserId"] != $_SESSION["user_id"]) {
                    $last_message_row = $message_row;
                }
            }
            // Render the post message form
            $html .= "<form method=\"POST\" action=\"/api/message/send\" enctype=\"multipart/form-data\">\n" . "<input type=\"hidden\" name=\"to\" value=\"" . $last_message_row["FromUsersUsername"] . "\" />\n" . "<input type=\"hidden\" name=\"in_reply_to\" value=\"" . ($in_reply_to > 0 ? $in_reply_to : $last_message_row["Id"]) . "\" />\n" . "<div class=\"message_form_wrapper\">\n" . "<div class=\"message_form\">\n" . "<h3>Message</h3>\n" . "<p>Write your message here... (supports <a href=\"http://daringfireball.net/projects/markdown/\">markdown</a>)</p>\n" . "<div><textarea id=\"message_body\" name=\"body\" rows=\"10\"></textarea></div>\n" . "<input type=\"submit\" value=\"Send\" />\n" . "</div> <!-- .message_form -->\n" . "</div> <!-- .message_form_wrapper -->\n" . "</form>\n" . "<a name='form'></a>\n" . "<script>\n" . "\$(\"#message_body\").focus();\n" . "</script>\n";
            $html .= "</div> <!-- #messages -->\n";
        } else {
            // requested message not found
            $html .= "<div class=\"message_form_wrapper\"><div class=\"message_form\"><h4>Message not found</h4></div></div>\n";
        }
        $html .= render_footer();
    } else {
        header("Location: /403");
    }
    return $html;
}
示例#21
0
<?php unset($_SESSION['user']); ?>
<?php render_header(false); ?>
            <form id="login" method="post">
                <label for="username">username:</label><input type="text" name="username" id="username" /><br />
                <label for="password">password:</label><input type="password" name="password" id="password" /><br />

                <div class="buttons">
                    <?php
                    if(!empty($_SESSION['login_flash'])){
                        ?>
                        <div class="error"><?= $_SESSION['login_flash'] ?></div>
                        <?php
                        unset($_SESSION['login_flash']);
                    }
                    ?>
                    <input type="submit" value="login" />
                </div>
            </form>
            <script type="text/javascript">
            $(function(){
                $('#login').submit(function(){
                    var pass = $('#password'),
                        user = $('#username');
                    if(! user.val()){ user.focus(); return false; }
                    if(! pass.val()){ pass.focus(); return false; }
                }).find('input').eq(0).focus();
            })
            </script>
<?php render_footer(); ?>
示例#22
0
<?php

define(MAIN_PATH, realpath('.'));
include_once MAIN_PATH . '/init.php';
echo render_header();
$user = User::getLoggedIn();
if (!$user) {
    go_home();
}
$params = parse_http_args($_POST, array('save'));
if ($params['save']) {
    if ($user->disconnectFromFacebook()) {
        header('Location: account.php');
    } else {
        $error = 'Could not disconnect from Facebook for an unknown reason.';
    }
}
if ($error) {
    echo '<div class="error">' . $error . '</div>';
}
?>

<h3>Are you sure you want to disconnect your Facebook account?</h3>

<p>
Your Facebook information and friend connections will be deleted. Any information you entered on this site will remain.
</p>

<form action="disconnect.php" method="post">
  <input type="hidden" name="save" value="1" />
  <input type="submit" class="inputsubmit" value="Disconnect From Facebook" />
示例#23
0
文件: index.php 项目: R3vXX/Greyhole
function render_apply_changes_page() {
	global $user_id;
	$dir = str_replace('index.php', 'files', $_SERVER['SCRIPT_FILENAME']);
	render_header('Greyhole Configuration - Apply your changes');
	?>
	<span style="color:red">Your changes have not yet been applied.</span><br/>
	You'll need to execute the following command in a terminal or using SSH, logged as <em>root</em> on your server:
	<pre>/usr/bin/greyhole-config-update '<?php echo $dir ?>' <?php echo md5($user_id) ?></pre>
	<?php
	render_footer();
}
示例#24
0
<?php

require_once('couch.php');

$couch = new couchClient($config->database->connectionString, $config->database->name);
$results = $couch->key(date("m-d-Y"))->getView("views","pointsByDate");


render_header();
if($results->total_rows == 0 || empty($results->rows)){
  include('views/no_points.php');
} else {
  $points = $results->rows;
  include('views/points.php');
}
render_footer();
示例#25
0
<?php

include_once 'constants.php';
include_once LIB_PATH . 'util.php';
include_once LIB_PATH . 'ui.php';
$fb = get_fb();
$user = $fb->require_login();
echo render_header('Vote');
echo render_feedback_message($_REQUEST['result'], $_REQUEST['title']);
echo '<h2>推薦</h2>';
echo render_popular_foods($user);
echo render_footer();
示例#26
0
function render_account_followers_page($page)
{
    if (isset($_SESSION["user_id"])) {
        $start = (intval($page) - 1) * 20;
        $html = render_header("Friends");
        $mysqli = db_connect();
        $html .= "<div class=\"bg_menu_wrapper\">\n" . "<ul class=\"bg_menu\">\n" . "<li><a href=\"/account\" title=\"Account\">Account</a></li>\n" . "<li><a href=\"/account/style\" title=\"Style\">Style</a></li>\n" . "<li><a href=\"/account/friends\" title=\"Friends\">Friends</a></li>\n" . "<li class=\"selected\"><a href=\"/account/followers\" title=\"Followers\">Followers</a></li>\n" . "</ul>\n" . "<div class=\"clear\"></div>\n" . "</div>\n";
        $sql = "SELECT Users.*, COUNT(DISTINCT Posts.Id) AS PostCount, COUNT(DISTINCT Comments.Id) AS CommentCount, COUNT(DISTINCT Likes.Id) AS LikesCount,COUNT(DISTINCT Posts.Id) + COUNT(DISTINCT Comments.Id) + COUNT(DISTINCT Likes.Id) AS TotalCount\n" . " FROM Users" . " INNER JOIN Friends ON Users.Id=Friends.UserId" . " LEFT OUTER JOIN Posts ON Posts.UserId=Users.Id AND Posts.Status=1 AND Posts.Privacy=0" . " LEFT OUTER JOIN Comments ON Posts.Id=Comments.PostId AND Comments.UserId<>Users.Id" . " LEFT OUTER JOIN Likes ON Posts.Id=Likes.PostId AND Likes.UserId<>Users.Id" . " WHERE Friends.FriendId=" . $mysqli->real_escape_string($_SESSION["user_id"]) . " GROUP BY Users.Id" . " ORDER BY TotalCount DESC" . " LIMIT " . $mysqli->real_escape_string($start) . ",20";
        $sql_count = "SELECT COUNT(DISTINCT Users.Id) AS NumUsers" . " FROM Users" . " INNER JOIN Friends ON Users.Id=Friends.UserId" . " WHERE Friends.FriendId=" . $_SESSION["user_id"];
        // fetch count for pagination
        $count_result = $mysqli->query($sql_count);
        $count_row = $count_result->fetch_assoc();
        $count = $count_row["NumUsers"];
        $html .= "<div id=\"header\">\n" . "<h1>You have " . $count . " followers!</h1>\n" . "<p>This page lists the people that have marked you as a friend. To change your relationship with them, visit their profile page.</p>\n" . "</div>\n";
        $user_result = $mysqli->query($sql);
        if ($user_result->num_rows > 0) {
            $html .= "<div class=\"directory_users\">\n";
            while ($user_row = @$user_result->fetch_assoc()) {
                $html .= render_user($user_row);
            }
            $html .= "</div>\n";
        } else {
            $html .= "<div id=\"header\"><h3>Nobody has added you as a friend yet.</h3><p>Go explore the public posts, and get to know a few people :)</p></div>\n";
        }
        $html .= render_pagination("account/followers", $page, $count, 20);
        $html .= "</div> <!-- .page -->\n" . "</div> <!-- .page_wrapper -->\n";
        $html .= render_footer();
        return $html;
    } else {
        header("Location: /401");
    }
}
            $publish_result = "Error publishing story!";
        }
    }
    if ($_POST["status"] != "") {
        // PUBLISH STORY TO PROFILE FEED
        $status_success = $user->fbc_setStatus($_POST["status"]);
        if ($status_success) {
            $status_result = "Updated your status via PHP!";
        } else {
            $status_result = "Error updating your status!";
        }
    }
    echo render_header($user);
    // SHOW FACEBOOK STATUS
    echo render_status($user, $status_result);
    // POST FEED TO PROFILE
    echo render_feed_form($user, $publish_result);
    // SHOW ALL FRIENDS
    $friends = $user->fbc_get_all_friends(TRUE);
    echo render_friends_table_html($friends, 0, 10, "fbconnect_friend", "All Friends");
    // SHOW ALL CONNECTED FRIENDS TO APPLICATION
    $friends = $user->fbc_get_connected_friends(FALSE);
    echo render_friends_table_html($friends, 0, 10, "fbconnect_friend", "Connected Friends");
    // SHOW ALL UNCONNECTED FRIENDS TO APPLICATION
    $friends = $user->fbc_get_unconnected_friends_xfbml(TRUE);
    echo render_friends_table_xfbml($friends, 3, 5, "fbconnect_friend", "Unconnected Friends");
    echo render_footer();
} else {
    echo render_header($user);
    echo render_footer();
}
示例#28
0
<?php

include_once 'constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
$fb = get_fb();
if (!($user = $fb->get_loggedin_user())) {
    $user = $fb->get_canvas_user();
}
$prefill_user = null;
if (isset($_GET['to_user']) && $_GET['to_user'] != $user) {
    // you can't send a smiley to yourself
    $prefill_user = $_GET['to_user'];
}
echo render_header('Send');
if (!$prefill_user) {
    $ret = '<h2>Send a friend a smiley</h2>';
    $ret .= '<form fbtype="multiFeedStory" action="' . ROOT_LOCATION . '/handlers/multiFeedHandler.php">';
    $ret .= '<div class="input_row"> <fb:multi-friend-input /></div>';
    $ret .= render_emoticon_grid(get_other_moods());
    $ret .= '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="centerbutton" class="buttons"><input type="submit" id="mood" label="Send Smiley"></div>' . '<div id="emoticon"></div>' . '</form></div>';
} else {
    $ret = '<h2>Send <fb:name uid="' . $prefill_user . '" firstnameonly=1 /> a smiley</h2>';
    $ret .= '<form fbtype="multiFeedStory" action="' . ROOT_LOCATION . '/handlers/multiFeedHandler.php">';
    $ret .= render_emoticon_grid(get_other_moods());
    $ret .= '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="centerbutton" class="buttons"><input type="submit" fbuid="' . $prefill_user . '" id="mood" label="Send Smiley to %n"></div>' . '<div id="emoticon"></div>' . '</form></div>';
}
echo $ret;
示例#29
0
<?php

include "system/core.php";
render_header("Sistema de Acompanhamento Legislativo e Gestão de Gabinete");
?>


<div id="header">
	<?php 
render_menu();
?>
<div id="content">


<?php 
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, 'http://www.camara.gov.br/SitCamaraWS/Orgaos.asmx/ObterOrgaos');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
$xml = new SimpleXMLElement($query);
?>

<legend> Lista todas as proposições presentes nas pautas das Comissões</legend>


	<table class="table table-striped">
		<thead>
			<tr>
示例#30
0
function render_post_edit_page($post_id)
{
    $html = "";
    if (isset($_SESSION["user_id"])) {
        // fetch the post to edit
        $mysqli = db_connect();
        $post_result = $mysqli->query("SELECT * FROM Posts WHERE Id=" . $mysqli->real_escape_string($post_id));
        if ($post_result->num_rows > 0) {
            $post_row = $post_result->fetch_assoc();
            // check if the logged in user wrote the post
            if ($_SESSION["user_id"] == $post_row["UserId"]) {
                // fetch the tags
                $tags = "";
                $tags_array = array();
                $tags_result = $mysqli->query("SELECT * FROM PostTags INNER JOIN Tags ON PostTags.TagId=Tags.Id WHERE PostTags.PostId=" . $mysqli->real_escape_string($post_id) . " ORDER BY Tags.Name");
                if ($tags_result->num_rows > 0) {
                    while ($row = @$tags_result->fetch_assoc()) {
                        $tags_array[] = $row["Name"];
                    }
                    $tags = implode(", ", $tags_array);
                }
                $html .= render_header("Edit Post");
                $html .= "<div class=\"page_wrapper\">\n" . "<div id=\"post_form\" class=\"page\">\n" . "<h1>Edit Post</h1>\n" . "<form method=\"POST\" action=\"/api/post/edit\" enctype=\"multipart/form-data\">\n" . "  <input type=\"hidden\" name=\"id\" value=\"" . $post_row["Id"] . "\" />\n" . "  <div class=\"form_field\">\n" . "  <div class=\"form_field_label\">Title <small>(required)</small></div>\n" . "\t\t<div class=\"form_field_control\"><input type=\"text\" name=\"title\"  value=\"" . htmlspecialchars($post_row["Title"]) . "\" /></div>\n" . "\t</div>\n" . "\t<div class=\"form_field\">\n";
                // <small>(optional) - <a href=\"lib/api.php?action=post_remove_image&id=".$post_row["Id"]."\">Remove Existing Photo</a>)</small>
                if ($post_row["Photo"] != "") {
                    $html .= "<div class=\"form_field_label\">Photo <small>(optional - 4Mb upload limit per image, jpg, png or gif)</small></div>\n" . "<div class=\"form_field_control\"><img src=\"/" . $post_row["Photo"] . "\" width=\"500\" /></div>\n" . "<div class=\"form_field_control\"><input type=\"file\" name=\"photo\" id=\"photo\" /> <small>(choose to replace current image)</small></div>\n";
                } else {
                    $html .= "<div class=\"form_field_control\"><input type=\"file\" name=\"photo\" id=\"photo\" /></div>\n";
                }
                $html .= "\t</div>\n" . "\t<div class=\"form_field\">\n" . "\t\t<div class=\"form_field_label\">Body <small>(supports <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>markdown</a>)</small></div>\n" . "\t\t<div class=\"form_field_control\"><textarea name=\"body\" rows=\"15\" >" . $post_row["Body"] . "</textarea></div>\n" . "\t</div>\n" . "\t<div class=\"form_field\">\n" . "\t\t<div class=\"form_field_label\">Tags <small>(comma separated)</small></div>\n" . "\t\t<div class=\"form_field_control\"><input type=\"text\" name=\"tags\" value=\"" . htmlspecialchars($tags) . "\" /></div>\n" . "\t</div>\n" . "\t<div class=\"form_field\">\n" . "\t\t<div class=\"form_field_label\">Privacy</div>\n" . "\t\t<div class=\"form_field_control\"><select name=\"privacy\">\n" . "\t\t\t<option value=\"0\" " . ($post_row["Privacy"] == 0 ? "selected" : "") . " >Public</option>\n" . "\t\t\t<option value=\"1\" " . ($post_row["Privacy"] == 1 ? "selected" : "") . " >Friends Only</option>\n" . "\t\t</select></div>\n" . "\t</div>\n" . "\t<div class=\"form_field\">\n" . "\t\t<div class=\"form_field_label\">Status</div>\n" . "\t\t<div class=\"form_field_control\"><select name=\"status\">\n" . "\t\t\t<option value=\"0\" " . ($post_row["Status"] == 0 ? "selected" : "") . " >Draft</option>\n" . "\t\t\t<option value=\"1\" " . ($post_row["Status"] == 1 ? "selected" : "") . " >Published</option>\n" . "\t\t</select></div>\n" . "\t</div>\n" . "\t<input type=\"submit\" value=\"Make Changes\" />\n" . "</form>\n" . "</div>\n" . "</div>\n";
            } else {
                header("Location: /401?reason=not_author&loggedin=" . $_SESSION["user_id"] . "&author=" . $row["UserId"]);
            }
            $html .= render_footer();
        } else {
            header("Location: /404?reason=post_not_found");
        }
    } else {
        header("Location: /401?reason=not_logged_in");
    }
    return $html;
}