[Feed-collector-svn] SF.net SVN: feed-collector: [73] trunk/page_personal.php
Status: Beta
Brought to you by:
c167
|
From: <C1...@us...> - 2006-12-04 21:41:45
|
Revision: 73
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=73&view=rev
Author: C167
Date: 2006-12-04 13:41:45 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
filled with content
Modified Paths:
--------------
trunk/page_personal.php
Modified: trunk/page_personal.php
===================================================================
--- trunk/page_personal.php 2006-12-04 21:40:02 UTC (rev 72)
+++ trunk/page_personal.php 2006-12-04 21:41:45 UTC (rev 73)
@@ -1,8 +1,191 @@
<?php
+
+
/**
- * Created on 04.12.2006
- *
- *
- * @author C167 <c1...@us...>
+ * Created on 30.08.2006
+ * This file is called if someone wants the main page or doesn't select any page
+ * @version 1
+ * @since 46 - 19.10.2006
+ * @author c167 <c1...@us...>
+ * @package feed-collector
*/
-?>
+
+require_once "inc/functions.php";
+
+require_once "inc/config.php";
+require_once "inc/definitions.php";
+error_reporting(E_ALL);
+############
+# DATABASE #
+############
+require_once "MDB2.php";
+$dsn = array (
+ 'phptype' => DB_TYPE,
+ 'username' => DB_LOGIN,
+ 'password' => DB_PASSWD,
+ 'hostspec' => DB_HOST,
+ 'database' => DB_DATABASE
+);
+$options = array (
+ 'debug' => 2,
+ 'result_buffering' => true,
+ 'portability' => MDB2_PORTABILITY_ALL
+);
+$db = & MDB2 :: factory($dsn, $options);
+if (PEAR :: isError($db)) {
+ echo $db->getMessage();
+ echo "<br />";
+ echo $db->getDebugInfo();
+}
+$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
+
+###########
+# SESSION #
+###########
+require_once "HTTP/Session.php";
+$options = array (
+ 'dsn' => & $db,
+ 'table' => $session['container']['tablename'],
+ 'autooptimize' => $session['container']['autooptimize']
+);
+HTTP_Session :: setContainer('MDB2', $options);
+HTTP_Session :: start();
+HTTP_Session :: setExpire($session['time']['expire']);
+HTTP_Session :: setIdle($session['time']['idle']);
+
+################
+# Feed-Manager #
+################
+require_once "class/Feed_manager.php";
+$feed = new Feed_manager($db);
+
+################
+# User-Manager #
+################
+require_once "class/User_manager.php";
+$user = new User_manager($db);
+
+$page = "main";
+//
+// Now we're going to replace the placeholders in the template with the important content
+//
+
+// get the design
+$design = file_get_contents("styles/default/page_show_feed.tpl", "r");
+
+# Header
+// title
+$title = "Feed-Collector";
+if (HTTP_Session :: get("personal_page", true));
+$design = str_replace("<!-- title -->", $title, $design);
+
+// related sites
+$related_sites = sprintf(" <span>%s</span>\n <a href=\"http://www.oswd.org\" title=\"The host of this design\">OSWD</a> |\n <a href=\"http://www.oswd.org/userinfo.phtml?user=haran\" title=\"Other designs by haran\">haran’s Designs</a>", _("Related Sites:"));
+$design = str_replace("<!-- related sites -->", $related_sites, $design);
+
+// midHeader title left
+$midHeader_title_left = sprintf(" <h1 class=\"headerTitle\">%s</h1>\n <div class=\"headerSubTitle\" title=\"Message'\">\n %s\n", _("Feed-Collector"), _("{ stay up to date with all your news feeds! }"));
+$design = str_replace("<!-- midHeader title left -->", $midHeader_title_left, $design);
+
+// midHeader title right
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $midHeader_title_right = sprintf(" <form action=\"./page_login.php\" method=\"post\"><span>%s</span> <input type=\"submit\" name=\"submit\" value=\"%s\" /><br />\n" .
+ " <input type=\"text\" name=\"username\" value=\"%s\" size=\"20\" /><br />\n" .
+ " <input type=\"text\" name=\"password\" value=\"%s\" /><br />\n" .
+ " <input type=\"hidden\" name=\"cameFrom\" value=\"%s\" />" .
+ " </form>\n" .
+ " </div>", _("Login:"), _("Submit!"), _("Username"), _("Password"), basename($_SERVER['PHP_SELF']));
+} else {
+ $midHeader_title_right = sprintf(" <span>%s %s</span><br />\n" .
+ " <p id=\"userinfo\">%s %s</p>", _("Hello"), HTTP_Session :: get("username"), _("Your last login was at"), date("H:m:i", HTTP_Session :: get("lastLogin")));
+}
+$design = str_replace("<!-- midHeader title right -->", $midHeader_title_right, $design);
+
+// navigation
+$navigation = sprintf(" <span class=\"doNotDisplay\">Navigation:</span>\n <a href=\"./page_main.php\">%s</a> |\n <a href=\"./page_show_feeds.php\" class=\"highlight\">%s</a> |\n <a href=\"./page_search.php\">%s</a> |\n <a href=\"./index.html\">%s</a> |\n <a href=\"./index.html\">%s</a> |\n", _("Home"), _("Show Feeds"), _("Search"), _("Show TAGs"), _("About"));
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $navigation .= sprintf(" <a href=\"./page_login.php\">%s</a> |\n <a href=\"./page_register.php\">%s</a>", _("Login"), _("Register"));
+} else {
+ $navigation .= sprintf(" <a href=\"./page_profile.php\">%s</a>", _("Profile"));
+}
+$design = str_replace("<!-- navigation -->", $navigation, $design);
+
+/*
+ * At this point we have to decide wether we display only one Feed or some more, perhaps loaded and movable by AJAX...
+ */
+# Main copy
+// main
+HTTP_Session :: set("uid", 0);
+if (HTTP_Session :: get("uid") >= 0 and HTTP_Session :: get("uid") < $user->getNumberOfUsers()) {
+ $cols = $user->getUserCols(HTTP_Session :: get("uid"), false);
+ $main = "";
+ ############
+ # Column 1 #
+ ############
+ $main .= createColumn($cols, 1, $feed);
+
+ ############
+ # Column 2 #
+ ############
+ $main .= createColumn($cols, 2, $feed);
+
+ ############
+ # Column 3 #
+ ############
+ $main .= createColumn($cols, 3, $feed);
+} else {
+ $main = "";
+}
+$design = str_replace("<!-- main -->", $main, $design);
+
+/*
+# sideBar
+// sideBarElement one
+$sideBarElement_one = sprintf(" <p class=\"sideBarTitle\">%s</p>\n\n <div class=\"sideBarText\"><strong>? May 03</strong><br />\n Submitted revised version of Gila to <a href=\"http://www.oswd.org\">OSWD</a></div>\n\n <div class=\"sideBarText\"><strong>3 Feb 03</strong><br />\n Original version of Gila submitted</div>\n\n <a href=\"./index.html\" class=\"more\">more news »</a>", _("News"));
+$design = str_replace("<!-- sideBarElement one -->", $sideBarElement_one, $design);
+
+// sideBarElement two
+$sideBarElement_two = sprintf(" <p class=\"sideBarTitle\">Downloads</p>\n\n <div class=\"sideBarText\"><strong>Product Delta</strong><br />\n <a href=\"./index.html\">info</a> | <a href=\"./index.html\">download</a></div>\n <div class=\"sideBarText\"><strong>Product Echo</strong><br />\n <a href=\"./index.html\">info</a> | <a href=\"./index.html\">download</a></div>\n <div class=\"sideBarText\"><strong>Product Foxtrot</strong><br />\n <a href=\"./index.html\">info</a> | <a href=\"./index.html\">download</a></div>");
+$design = str_replace("<!-- sideBarElement two -->", $sideBarElement_two, $design);
+
+// sideBarElement three
+$sideBarElement_three = sprintf(" <p class=\"sideBarTitle\">Validation</p>\n\n <div class=\"sideBarText\">Validate the <a href=\"http://validator.w3.org/check/referer\">XHTML</a>\n and <a href=\"http://jigsaw.w3.org/css-validator/check/referer\">CSS</a> of this page.</div>\n </div>");
+$design = str_replace("<!-- sideBarElement three -->", $sideBarElement_three, $design);
+*/
+# footer
+// footer
+$footer = sprintf(" <span class=\"doNotPrint\">\n %s\n <a href=\"mailto:c1...@us...\" title=\"the developsers email adress\">email the Webmaster</a><br />\n </span>\n\n <!-- <strong>URI »</strong> http://domain.is.invalid/prosimii/index.html -->\n • <strong>Updated »</strong> 2006-Oct-25 18:42 +1000 •", _("For comments or questions about this website, please"));
+$design = str_replace("<!-- footer -->", $footer, $design);
+
+echo $design;
+
+function createColumn($cols, $number, $feed) {
+ $return = " <div class=\"column$number\">\n";
+ foreach ($cols["column$number"] as $col) {
+ $return .= " <div id=\"$col\">\n";
+ $feed_info = $feed->getFeedInfo($col);
+ $return .= sprintf(" <div class=\"feed_headline\">\n <a href=\"%s\">%s</a>\n </div>\n <ul>\n", $feed_info['site_url'], $feed_info['feed_name']);
+ $items = $feed->getNewestItems($col, 10);
+ for ($i = 0; $i < count($items); $i++) {
+ $return .= sprintf(" <li><a href=\"%s\">%s</a></li>\n", $items[$i]['url'], $items[$i]['title']);
+ }
+ $return .= " </ul>\n </div>\n";
+ }
+ $return .= " </div>\n";
+ return $return;
+}
+
+function findBiggestArray($a1, $a2, $a3) {
+ $a1 = count($a1);
+ $a2 = count($a2);
+ $a3 = count($a3);
+ $number = 0;
+ if ($a1 > $number)
+ $number = $a1;
+ if ($a2 > $number)
+ $number = $a2;
+ if ($a3 > $number)
+ $number = $a3;
+ return $number;
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|