当前位置: 首页>>代码示例>>PHP>>正文


PHP render_header函数代码示例

本文整理汇总了PHP中render_header函数的典型用法代码示例。如果您正苦于以下问题:PHP render_header函数的具体用法?PHP render_header怎么用?PHP render_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_mail_queue

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:29,代码来源:mail_queue.php

示例2: render_help_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:7,代码来源:common.php

示例3: render_suggested_users

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:25,代码来源:suggested_users.php

示例4: render_firehose_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:35,代码来源:firehose.php

示例5: render_tag_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:27,代码来源:tag.php

示例6: render_popular_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:25,代码来源:popular.php

示例7: render_tags_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:32,代码来源:tags.php

示例8: render_search_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:34,代码来源:search.php

示例9: render_faq

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:9,代码来源:faq.php

示例10: render_terms

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:9,代码来源:terms.php

示例11: render_privacy

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:9,代码来源:privacy.php

示例12: render_welcome_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:9,代码来源:welcome.php

示例13: render_user_directory

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:54,代码来源:user_directory.php

示例14: render_chat_page

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");
    }
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:12,代码来源:chat.php

示例15: render_home_page

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;
}
开发者ID:jonbeckett,项目名称:wetheusers,代码行数:46,代码来源:home.php


注:本文中的render_header函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。