feed-collector-svn Mailing List for news collector and viewer (Page 3)
Status: Beta
Brought to you by:
c167
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
(9) |
Dec
(23) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(22) |
Feb
(1) |
Mar
|
Apr
|
May
(7) |
Jun
(15) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <c1...@us...> - 2006-12-20 21:45:17
|
Revision: 77
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=77&view=rev
Author: c167
Date: 2006-12-20 13:45:17 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/class/Feed_manager.php
trunk/class/Tag_manager.php
trunk/class/User_manager.php
Modified: trunk/class/Feed_manager.php
===================================================================
--- trunk/class/Feed_manager.php 2006-12-20 21:44:39 UTC (rev 76)
+++ trunk/class/Feed_manager.php 2006-12-20 21:45:17 UTC (rev 77)
@@ -39,6 +39,21 @@
################
/**
+ * Return the number of pages that have to be displayed
+ * @param Int $feedname The name of the feed
+ * @param Int $perPage How many feeds we should display per page
+ * @return Int
+ * @access public
+ */
+ public function getItemsMaxPages($feedname, $perPage = 30) {
+ $number = $this->stat_countItems($feedname);
+ if ($number <= $perPage) {
+ return 1;
+ }
+ return (int) ($number / $perPage) + 1;
+ }
+
+ /**
* Get items from a feed
*
* @param String $feedname The name of the feed
@@ -74,6 +89,39 @@
}
/**
+ * Get a block of items from a feed
+ *
+ * @param String $feedname The name of the feed
+ * @param Int $page The number of the page to get
+ * @param Int $count How many Items? default 30
+ * @return mixed
+ * @since 1.1 - 09.07.2006
+ * @version 1.2
+ * @access public
+ */
+ public function getItemsPerPage($feedname, $page = 1, $count = 30) {
+ $number_in_db = $this->stat_countItems($feedname);
+ if ($count > $number_in_db) {
+ $from = 0;
+ } else {
+ $from = $number_in_db - ($count * $page);
+ }
+ $feeds = $this->mdb->query("SELECT id,title,url,summary FROM f_$feedname GROUP BY id ASC LIMIT $from ,$count;");
+ if (PEAR :: isError($feeds)) {
+ return false;
+ }
+ $i = 0;
+ while ($row = $feeds->fetchRow()) {
+ $return[$i]['id'] = $row['id'];
+ $return[$i]['title'] = $row['title'];
+ $return[$i]['url'] = $row['url'];
+ $return[$i]['summary'] = $row['summary'];
+ $i++;
+ }
+ return $return;
+ }
+
+ /**
* Get items from a feed
*
* @param String $feedname The name of the feed
@@ -143,18 +191,19 @@
* @param int $count Feeds per Page
* @return int
*/
- public function getMaxPages($count = 30) {
+ public function getFeedsMaxPages($count = 30) {
$numberOfFeeds = $this->stat_countFeeds();
echo "a";
- if (($numberOfFeeds > $count) and ($numberOfFeeds < (2*$count))) {
+ if (($numberOfFeeds > $count) and ($numberOfFeeds < (2 * $count))) {
echo "b";
return 2;
- } elseif ($count <= $numberOfFeeds) {
+ }
+ elseif ($count <= $numberOfFeeds) {
echo "c";
return 1;
}
echo "d";
- return (int)($numberOfFeeds / $count);
+ return (int) ($numberOfFeeds / $count);
}
/**
@@ -251,7 +300,11 @@
else
return $query;
}
-
+
+ #############
+ # STATISTIC #
+ #############
+
/**
* STATISTIC
* Return the Number of feeds we have in our database
@@ -324,6 +377,10 @@
break;
case "RSS 2.0" :
return $this->mdb->queryOne("SELECT COUNT(*) FROM feeds WHERE feed_type = 'RSS 2.0';");
+ break;
+ case "RSS 1.0" :
+ return $this->mdb->queryOne("SELECT COUNT(*) FROM feeds WHERE feed_type = 'RSS 1.0';");
+ break;
}
}
Modified: trunk/class/Tag_manager.php
===================================================================
--- trunk/class/Tag_manager.php 2006-12-20 21:44:39 UTC (rev 76)
+++ trunk/class/Tag_manager.php 2006-12-20 21:45:17 UTC (rev 77)
@@ -5,7 +5,7 @@
* Created on 11.12.2006
*
* This file is used to
- * @since 64 - 11.12.2006
+ * @since 74 - 11.12.2006
* @author c167 <c1...@us...>
*/
@@ -17,7 +17,7 @@
* @since 1.1 - 09.07.2006
* @access protected
*/
- protected $mdb;
+ protected $db;
/**
* The standard-constructor
@@ -29,8 +29,8 @@
* @version 1.1
* @access public
*/
- public function __construct($mdb) {
- $this->mdb = $mdb;
+ public function __construct($db) {
+ $this->db = $db;
}
/**
@@ -42,7 +42,15 @@
* @access public
*/
public function addTag($tag, $by, $feed) {
-
+ $select = $this->db->queryOne("SELECT `tag` FROM `tags` WHERE tag = '$tag' AND feed = '$feed';");
+ if($select == $tag) {
+ return false;
+ }
+ $insert = $this->db->query("INSERT INTO `tags` ( `id` , `setBy` , `tag` , `feed` ) VALUES ( NULL , '$by', '$tag', '$feed');");
+ if(PEAR :: isError($insert)) {
+ return false;
+ }
+ return true;
}
/**
@@ -63,8 +71,34 @@
* @access public
*/
public function getTags($feed) {
-
+ $query = $this->db->query("SELECT tag FROM tags WHERE feed = '$feed';");
+ if(PEAR :: isError($query)) {
+ return false;
+ }
+ while($row = $query->fetchRow()) {
+ if(!isset($row['tag'])) {
+ return false;
+ }
+ $return[] = $row['tag'];
+ }
+ return $return;
}
+
+ /**
+ * Return all feeds that have a given tag
+ * @param String $tag The tag to search for
+ * @return mixed
+ * @access public
+ */
+ public function getFeedsByTag($tag) {
+ $query = $this->db->query("SELECT feed FROM tags WHERE tag = '$tag';");
+ if(PEAR :: isError($query)) {
+ return false;
+ }
+ while($row = $query->fetchRow()) {
+
+ }
+ }
/**
* Random number generator
Modified: trunk/class/User_manager.php
===================================================================
--- trunk/class/User_manager.php 2006-12-20 21:44:39 UTC (rev 76)
+++ trunk/class/User_manager.php 2006-12-20 21:45:17 UTC (rev 77)
@@ -18,38 +18,51 @@
/**
* LOGIN_WRONG_USERNAME
*/
-define('LOGIN_WRONG_USERNAME', 1);
+define('LOGIN_WRONG_VALUES', 1);
/**
* LOGIN_WRONG_PASSWD
*/
-define('LOGIN_WRONG_PASSWD', 2);
+define('LOGIN_INACTIVE', 2);
/**
- * LOGIN_NO_VALUES
+ * REGISTER_PASSWD_TOO_SHORT
*/
-define('LOGIN_NO_VALUES', 3);
+define('REGISTER_PASSWD_TOO_SHORT', 1);
/**
- * REGISTER_PASSWD_TOO_SHORT
+ * REGISTER_USERNAME_NOT_ALLOWED
*/
-define('REGISTER_PASSWD_TOO_SHORT', 1);
+define('REGISTER_USERNAME_NOT_ALLOWED', 2);
class User_Manager {
/**
* The database-object
*
* @var Object
- * @since 1.1 - 09.07.2006
* @access protected
*/
+ protected $mdb;
+
+
/**
+ * The userid
+ * @access protected
+ */
+ protected $uid = null;
+
+ /**
+ * The username
+ * @access protected
+ */
+ protected $username = null;
+
+ /**
* The standard-constructor
*
* @param Object $db The PEAR::MDB2
*
* @return void
- * @since 1.1 - 09.07.2006
* @version 1.1
* @access public
*/
@@ -145,22 +158,78 @@
* @access public
*/
public function loginUser($username, $passwd) {
- $query = $this->mdb->query("SELECT id,name,pass FROM users WHERE username = '$username';");
+ $query = $this->mdb->query("SELECT id,name,pass,state FROM users WHERE name = '$username';");
if (PEAR :: isError($query)) {
- $return['state'] = LOGIN_WRONG_USERNAME;
- return $return;
+ return array('state' => LOGIN_WRONG_VALUES);
}
$row = $query->fetchRow();
+ if($row['state'] == "inactive") {
+ return array('state' => LOGIN_INACTIVE);
+ }
if ($passwd == $row['pass']) {
+ $this->uid = $row['id'];
$return['state'] = LOGIN_SUCCESSFULL;
$return['id'] = $row['id'];
$return['username'] = $row['name'];
return $return;
} else {
return array (
- 'state' => LOGIN_WRONG_PASSWD
+ 'state' => LOGIN_WRONG_VALUES
);
}
}
+
+ /**
+ * Logs out a user
+ * @return boolean
+ */
+ public function logOut() {
+ if(is_null($this->uid)) {
+ return false;
+ }
+ $this->uid = null;
+ return true;
+ }
+
+ /**
+ * Sets the time of the users last action
+ * @return boolean
+ */
+ public function updateUserAction() {
+ if(is_null($this->uid)) {
+ return false;
+ }
+ $query = $this->mdb->query(sprintf("UPDATE `users` SET `last_action` = '%d' WHERE `users`.`ID` = %d LIMIT 1 ;", time(), $this->uid));
+ if(PEAR :: isError($query)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * returns the time of the users last action
+ * @return int
+ */
+ public function getUserActionTime() {
+ if(is_null($this->uid)) {
+ return false;
+ }
+ $query = $this->mdb->queryOne(sprintf("SELECT last_action FROM users WHERE id= %d LIMIT 1;", $this->uid));
+ }
+
+ /**
+ * Returns the username
+ * @return String/boolean on error
+ */
+ public function getUsername() {
+ if(is_null($this->uid)) {
+ return false;
+ }
+ if(is_null($this->username)) {
+ $this->username = $this->mdb2->queryOne("SELECT name FROM users WHERE id = $this->uid");
+ }
+ return $this->username;
+
+ }
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-20 21:44:41
|
Revision: 76
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=76&view=rev
Author: c167
Date: 2006-12-20 13:44:39 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/page_login.php
trunk/page_main.php
trunk/page_personal.php
trunk/page_show_all_feeds.php
trunk/page_show_feed.php
trunk/statistics.php
trunk/update_feeds.php
Modified: trunk/page_login.php
===================================================================
--- trunk/page_login.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/page_login.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -78,22 +78,17 @@
require_once "class/User_manager.php";
$user = new User_manager($db);
if (false === HTTP_Session :: get("logged_in", false)) {
- echo 1;
if (isset ($_POST['submit'])) {
- echo 2;
- print_r($_POST);
if (empty ($_POST['username']) or empty ($_POST['passwd'])) {
- echo 4;
- $main = displayLoginForm(LOGIN_NO_VALUES);
+ $main = displayLoginForm(LOGIN_WRONG_VALUES);
} else {
- echo 5;
$login = $user->loginUser($_POST['username'], md5($_POST['passwd']));
switch ($login['state']) {
case LOGIN_SUCCESSFULL :
- echo 6;
HTTP_Session :: set("logged_in", true);
HTTP_Session :: set("uid", $login['id']);
HTTP_Session :: set("username", $login['username']);
+ $user->updateUserAction();
if (isset ($_POST['cameFrom']) and true === in_array(basename($_POST['cameFrom']), $validPages)) {
HTTP :: redirect("./" . $_POST['cameFrom']);
die();
@@ -101,30 +96,25 @@
HTTP :: redirect("./page_main.php");
die();
}
-
break;
- case LOGIN_WRONG_USERNAME :
- echo 7;
- $main = displayLoginForm(LOGIN_WRONG_USERNAME);
+ case LOGIN_WRONG_VALUES :
+ $main = displayLoginForm(LOGIN_WRONG_VALUES);
HTTP_Session :: set("logged_in", false);
break;
- case LOGIN_WRONG_PASSWD :
- echo 8;
- $main = displayLoginForm(LOGIN_WRONG_PASSWD);
+ case LOGIN_INACTIVE :
+ $main = displayLoginForm(LOGIN_INACTIVE);
HTTP_Session :: set("logged_in", false);
break;
default :
- echo 9;
- $main = displayLoginForm(LOGIN_WRONG_USERNAME);
+ $main = displayLoginForm(LOGIN_WRONG_VALUES);
}
}
} else {
- echo 3;
$main = displayLoginForm(0);
}
} else {
- header("Location: http://localhost/~stefan/ws32/feed-collector/trunk/page_main.php");
+ HTTP :: redirect ("./page_main.php");
}
#####################
@@ -167,26 +157,17 @@
function displayLoginForm($error) {
switch ($error) {
- case LOGIN_WRONG_PASSWD :
- echo "a";
- $id_username = "ok";
+ case LOGIN_WRONG_VALUES :
+ $id_username = "error";
$id_password = "error";
- $message = sprintf(" <p>%s</p>\n", _("Wrong password!"));
+ $message = sprintf(" <p>%s</p>\n", _("Unknown username. If you don't have a username then please <a href=\"./page_register.pgp\">register</a> a new one"));
break;
- case LOGIN_WRONG_USERNAME :
- echo "b";
+ case LOGIN_INACTIVE :
$id_username = "error";
- $id_password = "ok";
- $message = sprintf(" <p>%s</p>\n", _("Unknown username. If you don't have a username then please <a href=\"./page_register.pgp\">register</a> a new one"));
+ $id_password = "error";
+ $message = sprintf(" <p>%s</p>\n", _("This useraccount is not active. You should have received a mail with an access-key. If not, please look at your spam-folder or send a mail to the site-admin."));
break;
- case LOGIN_NO_VALUES :
- echo "c";
- $id_username = "ok";
- $id_password = "ok";
- $message = "";
- break;
default :
- echo "d";
$id_username = "ok";
$id_password = "ok";
$message = sprintf(" <p>%s</p>\n", _("Please enter you username and your password to login. Cookies have to be enabled from this point."));
Modified: trunk/page_main.php
===================================================================
--- trunk/page_main.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/page_main.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -99,22 +99,22 @@
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=\"password\" name=\"password\" value=\"%s\" /><br />\n" .
+ " <input type=\"password\" name=\"passwd\" 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")));
+ " <div id=\"userinfo\">%s %s</div>", _("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(" <a href=\"./page_main.php\" class=\"highlight\">%s</a> |\n <a href=\"./page_show_feeds.php\">%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"));
+$navigation = sprintf(" <a href=\"./page_main.php\" class=\"highlight\">%s</a> |\n <a href=\"./page_show_feeds.php\">%s</a> |\n <a href=\"./page_search.php\">%s</a> |\n <a href=\"./page_show_all_feeds.php\">%s</a> |\n <a href=\"./page_show_feed_tag.php\">%s</a> |\n", _("Home"), _("Show Feeds"), _("Search"), _("Select a Feed"), _("TABs"));
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"));
+ $navigation .= sprintf(" <a href=\"./page_personal.php\">%s</a> |\n <a href=\"./page_logout.php\">%s</a>", _("Personal Page"), _("LogOut"));
}
$design = str_replace("<!-- navigation -->", $navigation, $design);
@@ -152,7 +152,7 @@
$design = str_replace("<!-- latest news -->", $latest_news, $design);
// box 1
-$box_1 = sprintf(" <h1>%s</h1>\n <p>%s %d<br />\n %s %d<br />\n %s %d<br />\n </p>\n <p>\n %s %d<br />\n %s %d<br />\n %s %d</p>", _("Statistic"), _("Fedds in the Database: "), $feed->stat_countFeeds(), _("Items over all:"), $feed->stat_countAllItems(), _("Average items per feed:"), $feed->stat_avgItemsPerFeed(), _("[ATOM 1.0] feeds:"), $feed->stat_countFeedTypes("ATOM 1.0"), _("[RDF 0.9] feeds:"), $feed->stat_countFeedTypes("RDF 0.9"), _("[RSS 2.0] feeds:"), $feed->stat_countFeedTypes("RSS 2.0"));
+$box_1 = sprintf(" <h1>%s</h1>\n <p>%s %d<br />\n %s %d<br />\n %s %d<br />\n </p>\n <p>\n %s %d<br />\n %s %d<br />\n %s %d<br />\n %s %d</p>", _("Statistic"), _("Fedds in the Database: "), $feed->stat_countFeeds(), _("Items over all:"), $feed->stat_countAllItems(), _("Average items per feed:"), $feed->stat_avgItemsPerFeed(), _("[ATOM 1.0] feeds:"), $feed->stat_countFeedTypes("ATOM 1.0"), _("[RDF 0.9] feeds:"), $feed->stat_countFeedTypes("RDF 0.9"), _("[RSS 2.0] feeds:"), $feed->stat_countFeedTypes("RSS 2.0"), _("[RSS 1.0] feeds"), $feed->stat_countFeedTypes("RSS 1.0"));
$design = str_replace("<!-- box 1 -->", $box_1, $design);
// box 2
@@ -160,7 +160,7 @@
$box_2 = sprintf(" <h1>%d %s</h1>\n <ul>\n", $biggestfeeds, _("biggest feeds"));
$biggest_feeds = $feed->getBiggestFeeds($biggestfeeds);
foreach ($biggest_feeds as $biggest) {
- $box_2 .= sprintf(" <li><a href=\"./index.php?page=show_feeds&feed=%s\">%s (%d%s)</a> </li>\n", $biggest['feed_db_name'], $biggest['feed_name'], $biggest['items'], _(" Items"));
+ $box_2 .= sprintf(" <li><a href=\"./page_show_feed.php?feed=%s\">%s (%d%s)</a> </li>\n", $biggest['feed_db_name'], $biggest['feed_name'], $biggest['items'], _(" Items"));
}
$box_2 .=" </ul>\n";
$design = str_replace("<!-- box 2 -->", $box_2, $design);
@@ -170,7 +170,7 @@
$box_3 = sprintf(" <h1>%d %s</h1>\n <ul>\n", $newestfeeds, _("random feeds"));
$random_feeds = $feed->getRandomFeeds($newestfeeds);
foreach ($random_feeds as $randfeed) {
- $box_3 .= sprintf(" <li><a href=\"./index.php?page=show_feeds&feed=%s\">%s (%d%s)</a> </li>\n", $randfeed['feed_db_name'], $randfeed['feed_name'], $randfeed['items'], _(" Items"));
+ $box_3 .= sprintf(" <li><a href=\"./page_show_feed.php?feed=%s\">%s (%d%s)</a> </li>\n", $randfeed['feed_db_name'], $randfeed['feed_name'], $randfeed['items'], _(" Items"));
}
$box_3 .= " </ul>\n";
@@ -180,7 +180,7 @@
$box_4 = sprintf(" <h1>%s</h1>\n <ul>\n", _("Newest feeds"));
$newest_feeds = $feed->getNewestFeeds(6);
foreach ($newest_feeds as $newest) {
- $box_4 .= sprintf(" <li><a href=\"./index.php?page=show_feeds&feed=%s\"><!--•-->%s</a> %s (%d%s)</li>\n", $newest['feed_db_name'], $newest['feed_name'], date(("m.d.y H:m:s"), $newest['added']), $newest['items'], _(" Items"));
+ $box_4 .= sprintf(" <li><a href=\"./page_show_feeds.php?feed=%s\"><!--•-->%s</a> %s (%d%s)</li>\n", $newest['feed_db_name'], $newest['feed_name'], date(("m.d.y H:m:s"), $newest['added']), $newest['items'], _(" Items"));
}
$box_4 .= " </ul>";
$design = str_replace("<!-- box 4 -->", $box_4, $design);
Modified: trunk/page_personal.php
===================================================================
--- trunk/page_personal.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/page_personal.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -71,7 +71,7 @@
//
// get the design
-$design = file_get_contents("styles/default/page_show_feed.tpl", "r");
+$design = file_get_contents("styles/default/page_personal.tpl", "r");
# Header
// title
@@ -91,13 +91,13 @@
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=\"password\" name=\"passwd\" 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")));
+ " <p id=\"userinfo\">%s %s</p>", _("Hello"), $user->getUsername(), _("Your last login was at"), date("H:m:i", HTTP_Session :: get("lastLogin")));
}
$design = str_replace("<!-- midHeader title right -->", $midHeader_title_right, $design);
Modified: trunk/page_show_all_feeds.php
===================================================================
--- trunk/page_show_all_feeds.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/page_show_all_feeds.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -73,7 +73,7 @@
require_once "class/User_manager.php";
$user = new User_manager($db);
-$maxpages = $feed->getMaxPages(10);
+$maxpages = $feed->getFeedsMaxPages(10);
$page = "main";
//
Modified: trunk/page_show_feed.php
===================================================================
--- trunk/page_show_feed.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/page_show_feed.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -65,18 +65,28 @@
require_once "class/User_manager.php";
$user = new User_manager($db);
-$page = "main";
+###############
+# Tag-Manager #
+###############
+require_once "class/Tag_manager.php";
+$tag_manager = new Tag_Manager($db);
+
+require_once "HTTP.php";
//
// Now we're going to replace the placeholders in the template with the important content
//
+if (!isset ($_GET['feed'])) {
+ //HTTP :: redirect("./page_show_all_feeds.php");
+} else {
+ $maxpages = $feed->getItemsMaxPages($_GET['feed']);
+ $main = createItemsTable($_GET['feed'], $feed, detectActualPage($maxpages), 30);
+}
-// 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
@@ -115,43 +125,27 @@
*/
# 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);
+$design = str_replace("<!-- main -->", $main, $design);
- ############
- # Column 2 #
- ############
- $main .= createColumn($cols, 2, $feed);
+// page-navigation
+$page_navigation = displayPageNavi($maxpages, detectActualPage($maxpages), $_GET['feed']);
+$design = str_replace("<!-- page-navigation -->", $page_navigation, $design);
- ############
- # Column 3 #
- ############
- $main .= createColumn($cols, 3, $feed);
+# sideBar
+// rightSideBar
+$feedinfo = $feed->getFeedInfo($_GET['feed']);
+$rightSideBar = sprintf(" <p class=\"sideBarTitle\">%s</p>\n\n <div class=\"sideBarText\"><strong>%s</strong><br />\n", _("Tags"), $feedinfo['feed_name']);
+$tags = $tag_manager->getTags($_GET['feed']);
+if (false == $tags) {
+$rightSideBar .= sprintf("%s <a href=\"./page_add_tag.php?feed=%s\">%s</a>", _("No tag submitted yet, you can add one "), $_GET['feed'], _("here!"));
} else {
- $main = "";
+ foreach ($tags as $tag) {
+ $rightSideBar .= sprintf(" <a href=\"./page_show_feed_tag.php?tag=%s\">%s</a>, \n", $tag, $tag);
+ }
}
-$design = str_replace("<!-- main -->", $main, $design);
+$rightSideBar .= "\n </div>";
+$design = str_replace("<!-- rightSideBar -->", $rightSideBar, $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"));
@@ -159,19 +153,20 @@
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";
+function createItemsTable($feedname, $feed, $count, $page) {
+ $items = $feed->getItemsPerPage($feedname, $count, $page);
+ if (false === $items) {
+ return "error!!!";
}
- $return .= " </div>\n";
+ $return = sprintf(" <table summary=\"%s\">\n", $feedname);
+ for ($i = count($items) - 1; $i >= 0; $i--) {
+ //foreach ($items as $list) {
+ $return .= sprintf(" <tr>\n" .
+ " <td><a id=\"n%d\" href=\"%s\">%s</a></td>\n" .
+ " </tr>\n", $items[$i]['id'], $items[$i]['url'], $items[$i]['title'], $items[$i]['summary']);
+ }
+
+ $return .= " </table>";
return $return;
}
@@ -188,4 +183,31 @@
$number = $a3;
return $number;
}
+
+function displayPageNavi($maxpages, $page, $feedname) {
+ $return = _("Page: ");
+ for ($i = 1; $i <= $maxpages; $i++) {
+ if ($i !== 1) {
+ $return .= " | ";
+ }
+ if ($i !== $page) {
+ $return .= sprintf(" [<a href=\"./page_show_feed.php?feed=%s&page=%d\">%d</a>]", $feedname, $i, $i);
+ } else {
+ $return .= sprintf(" [%d]", $i);
+ }
+ }
+ return $return;
+}
+
+function detectActualPage($maxpages) {
+ if (!isset ($_GET['page'])) {
+ return 1;
+ }
+ if ($maxpages < $_GET['page']) {
+ return $maxpages;
+ }
+ $page = $_GET['page'];
+ settype($page, 'int');
+ return $page;
+}
?>
\ No newline at end of file
Modified: trunk/statistics.php
===================================================================
--- trunk/statistics.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/statistics.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -1,41 +1,56 @@
<?php
+
/**
* This file is the main-control for the statistics.
* It is optional, so there is no need to make it work ;)
*/
+require_once "MDB2.php";
+require_once "Log.php"; // Logger
-require_once "XML/Feed/Parser.php"; # The PEAR::XML_PARSER
+// some other stuff
+require_once "inc/config.php";
+require_once "inc/definitions.php";
+$conf = array (
+ 'error_prepend' => "<tt>",
+ 'error_append' => "</tt>",
+ 'linebreak' => "<br />\n"
+);
+$log = & Log :: singleton('display', '', '', $conf, $update['loglevel']);
+$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
+);
-$feed_url = "http://www.heise.de/open/news/news-atom.xml";
-$feed_source = file_get_contents($feed_url);
-try {
-$feed = new XML_Feed_Parser($feed_source);
-} catch (XML_Feed_Parser_Exception $e) {
- die('Feed invalid: ' . $e->getMessage());
+$db = & MDB2 :: factory($dsn, $options);
+if (PEAR :: isError($db)) {
+ $log->log($db->getMessage(), PEAR_LOG_ALERT);
+ $log->log(sprintf(_("Script ended with error at %d"), time()), PEAR_LOG_NOTICE);
+ die();
+} else {
+ $log->log(_("Successfully connected to the database"), PEAR_LOG_NOTICE);
}
-print_r($feed);
-echo "<br /><br /><br /><br /><br />";
-foreach ($feed as $entry) {
- print $entry->title ."<br />\n";
-}
+$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
+$db->loadModule('Extended', null, false);
-echo "<br />Number of Items: ";
-$i = 0;
-foreach($feed as $entry) {
- $i++;
-}
-echo $i ."<br />";
-for($count = $i; $count >= 0; $count--) {
- echo "<br />";
- echo $feed->getEntryByOffset($count);
-}
-//echo "<br />" .count($feed);
-echo $a = $feed->getEntryByOffset(1);
-echo "<br />";
-echo $a->title ."<br />" .$a->id ."<br />" .$a->updated ."<br />" .$a->summary;
-//print_r($feed->);
-$feed->free();
-
+require_once "class/User_manager.php";
+$user = new User_Manager($db);
+require_once "class/Feed_manager.php";
+$feed = new Feed_Manager($db);
+require_once "class/Tag_manager.php";
+$tags = new Tag_Manager($db);
+$feedname = "heise_online_news";
+$count = 30;
+$page=1;
+print_r($tags->getTags($feedname, $count, $page));
+print_r($feed->getItemsPerPage($feedname, $page, $count));
?>
\ No newline at end of file
Modified: trunk/update_feeds.php
===================================================================
--- trunk/update_feeds.php 2006-12-20 21:43:59 UTC (rev 75)
+++ trunk/update_feeds.php 2006-12-20 21:44:39 UTC (rev 76)
@@ -11,10 +11,13 @@
* @author c167 <c1...@us...>
* @todo use different parsers for RSS and ATOM-feeds
*/
-echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
- \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
-echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"de\" xml:lang=\"de\">\n";
-echo "\t<head>\n\t\t<title>update</title>\n\t\t<meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\" />\n\t</head>\n\t<body>\n";
+$console = false;
+if (false === $console) {
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
+ \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
+ echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"de\" xml:lang=\"de\">\n";
+ echo "\t<head>\n\t\t<title>update</title>\n\t\t<meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\" />\n\t</head>\n\t<body>\n";
+}
error_reporting(E_ALL);
//error_reporting(E_STRICT);
@@ -22,19 +25,25 @@
require_once "MDB2.php";
require_once "Log.php"; // Logger
-
// some other stuff
require_once "inc/config.php";
require_once "inc/definitions.php";
-//$update['difference'] = 1;
###############################
# Configure and start logging #
###############################
-$conf = array (
- 'error_prepend' => "<tt>",
- 'error_append' => "</tt>",
- 'linebreak' => "<br />\n"
-);
+if (true === $console) {
+ $conf = array (
+ 'error_prepend' => "",
+ 'error_append' => "",
+ 'linebreak' => "\n"
+ );
+} else {
+ $conf = array (
+ 'error_prepend' => "<tt>",
+ 'error_append' => "</tt>",
+ 'linebreak' => "<br />\n"
+ );
+}
$log = & Log :: singleton('display', '', '', $conf, $update['loglevel']);
$time_now = time();
@@ -121,7 +130,7 @@
}
if (($time_now - $row['last_change']) < $update['difference']) {
- $log->log(sprintf(_("No Update: diff: %d -> %d"), ($time_now - $row['last_change']), date(("H:m:s"), ($time_now - $row['last_change']))), PEAR_LOG_WARNING);
+ $log->log(sprintf(_("No Update: diff: %d -> %d"), ($time_now - $row['last_change']), date(("h:i:s"), ($time_now - $row['last_change']))), PEAR_LOG_WARNING);
$log->log(sprintf(_("Not to update: %s"), $row['feed_name']), PEAR_LOG_NOTICE);
continue;
} else {
@@ -129,7 +138,7 @@
###################################
# Okay, this feed needs an update #
###################################
- $log->log(sprintf(_("Update: %s | diff: %s -> %s"), $row['feed_name'], ($time_now - $row['last_change']), date(("H:m:s"), ($time_now - $row['last_change']))), PEAR_LOG_WARNING);
+ $log->log(sprintf(_("Update: %s | diff: %s -> %s"), $row['feed_name'], ($time_now - $row['last_change']), date(("h:i:s"), ($time_now - $row['last_change']))), PEAR_LOG_WARNING);
##################################
# Swwitching to the right reader #
@@ -145,6 +154,10 @@
$log->log(_("Feed type is RDF 0.9, using RSS-Parser"), PEAR_LOG_NOTICE);
$feed = parseRSS($row['feed_url'], $log);
break;
+ case "RSS 1.0" :
+ $log->log(_("Feed type is RSS 1.0, using RSS-Parser"), PEAR_LOG_NOTICE);
+ $feed = parseRss($row['feed_url'], $log);
+ break;
case "RSS 2.0" :
$log->log(_("Feed type is RSS 2.0, using RSS-Parser"), PEAR_LOG_NOTICE);
$feed = parseRSS($row['feed_url'], $log);
@@ -162,7 +175,7 @@
}
$result = insertData($feed, $row['feed_db_name'], $log, $db);
-
+
$new_numberofitems = $db->queryOne(sprintf("SELECT COUNT(*) FROM f_%s;", $row['feed_db_name']));
$log->log(sprintf(_("We've got %d items in the feed, %d added"), $new_numberofitems, ($new_numberofitems - $numberofitems)), PEAR_LOG_NOTICE);
$log->log(sprintf(_("Feed \"%s\" is up to date now!"), $row['feed_name']), PEAR_LOG_NOTICE);
@@ -173,7 +186,7 @@
$log->log($settime->getDebugInfo(), PEAR_LOG_ALERT);
}
$settime->free();
-
+
}
}
$res->free();
@@ -186,15 +199,16 @@
$db->disconnect();
$log->log(_("Disconnected from the Database"), PEAR_LOG_NOTICE);
$log->log(sprintf(_("Script finished at %s"), microtime()), PEAR_LOG_NOTICE);
-$log->log(sprintf(_("Script needed %d seconds"), (time()-$time_now)), PEAR_LOG_NOTICE);
-echo "\t</body>\n</html>";
+$log->log(sprintf(_("Script needed %d seconds"), (time() - $time_now)), PEAR_LOG_NOTICE);
+if(false === $console) echo "\t</body>\n</html>";
+else echo "";
function insertData($data, $table_name, $log, $mdb2) {
$mdb2->loadModule('Extended');
$log->log(_("checking if the url's are already in the db."), PEAR_LOG_NOTICE);
$table_name = 'f_' . $table_name;
-
+ $data = array_reverse($data);
foreach ($data as $row) {
$fields_values = array (
@@ -224,8 +238,7 @@
$return['error'] = false;
}
}
-
-
+
return $return;
}
@@ -262,11 +275,6 @@
}
function parseRSS($feed_url, $log) {
- /* require_once "magpierss/rss_parse.inc";
-
- $feed = new MagpieRSS($feed_url, 'UTF-8');
- */
-
require_once "XML/RSS.php";
try {
@@ -293,19 +301,17 @@
$return[$i]['url'] = utf8_decode($item['link']);
if (isset ($item['description']))
$return[$i]['summary'] = utf8_decode($item['description']);
- if (isset ($item['updated']))
+ if (!isset ($item['updated']) or "" == $item['updated'] or is_null($item['updated'])) {
+ $return[$i]['updated'] = time();
+ } else {
$return[$i]['updated'] = utf8_decode($item['updated']);
- else
- $return[$i]['updated'] = time();
+ }
$return[$i]['hash'] = calculateHash("md5", utf8_decode($item['title']), utf8_decode($item['link']));
$log->log(sprintf(_("id: %d | subject: %s | URL: %s"), $i, $item['title'], $item['link']), PEAR_LOG_DEBUG);
$i++;
}
- for ($i = 0; $i < $items; $i++) {
- }
-
return $return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-20 21:43:59
|
Revision: 75
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=75&view=rev
Author: c167
Date: 2006-12-20 13:43:59 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/page_add_tag.php
Added: trunk/page_add_tag.php
===================================================================
--- trunk/page_add_tag.php (rev 0)
+++ trunk/page_add_tag.php 2006-12-20 21:43:59 UTC (rev 75)
@@ -0,0 +1,131 @@
+<?php
+
+
+/**
+ * Created on 30.08.2006
+ *
+ * @version 1
+ * @since 56 - 17.11.2006
+ * @author c167 <c1...@us...>
+ * @package feed-collector
+ */
+
+require_once "inc/functions.php";
+require_once "class/Feed_manager.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['user'],
+ '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)) {
+
+}
+$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 = new Feed_manager($db);
+
+if (true === HTTP_Session :: isNew()) {
+ HTTP_Session :: set("logged_in", false);
+
+}
+
+##############
+# HTTP-Class #
+##############
+require_once "HTTP.php";
+
+################
+# User-Manager #
+################
+require_once "class/User_manager.php";
+$user = new User_manager($db);
+/*
+if(false === HTTP_Session :: get("logged_in", false)) {
+ HTTP :: redirect("./page_login.php");
+}
+*/
+
+
+#####################
+# BUILD THE CONTENT #
+#####################
+
+// get the design
+$design = file_get_contents("styles/default/page_add_tag.tpl", "r");
+
+# Header
+// title
+$title = "Feed-Collector";
+$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 </div>", _("Feed-Collector"), _("{ stay up to date with all your news feeds! }"));
+$design = str_replace("<!-- midHeader title left -->", $midHeader_title_left, $design);
+
+// midHeader title right
+$midHeader_title_right = sprintf(" <span class=\"doNotDisplay\">%s</span>\n <a href=\"./index2.html\">view an alternative layout «</a>\n <span class=\"doNotDisplay\">|</span>\n <a style=\"cursor: help;\" title=\"Thanks to CSS, this page is already printer friendly!\">printer-friendly version «</a>", _("Tools:"));
+$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\">%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 <a href=\"./page_login.php\" class=\"highlight\">%s</a> |\n <a href=\"./page_register.php\">%s</a>", _("Home"), _("Show Feeds"), _("Search"), _("Show TAGs"), _("About"), _("Login"), _("Register"));
+$design = str_replace("<!-- navigation -->", $navigation, $design);
+
+// main
+$design = str_replace("<!-- main -->", $main, $design);
+
+# footer
+// footer
+$footer = sprintf(" <span class=\"doNotPrint\">\n For comments or questions about this website, please\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 •");
+$design = str_replace("<!-- footer -->", $footer, $design);
+
+echo $design;
+
+function filterInput($input, $type) {
+ $inhalt = trim($inhalt);
+ $inhalt = htmlspecialchars($inhalt);
+ switch ($type) {
+ case "username" :
+
+ break;
+ case "mail" :
+
+ break;
+ }
+
+ return $inhalt;
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-11 17:45:31
|
Revision: 74
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=74&view=rev
Author: C167
Date: 2006-12-11 09:45:13 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
added a Tag_manager
Added Paths:
-----------
trunk/class/Tag_manager.php
Added: trunk/class/Tag_manager.php
===================================================================
--- trunk/class/Tag_manager.php (rev 0)
+++ trunk/class/Tag_manager.php 2006-12-11 17:45:13 UTC (rev 74)
@@ -0,0 +1,88 @@
+<?php
+
+
+/**
+ * Created on 11.12.2006
+ *
+ * This file is used to
+ * @since 64 - 11.12.2006
+ * @author c167 <c1...@us...>
+ */
+
+class Tag_Manager {
+ /**
+ * The database-object
+ *
+ * @var Object
+ * @since 1.1 - 09.07.2006
+ * @access protected
+ */
+ protected $mdb;
+
+ /**
+ * The standard-constructor
+ *
+ * @param Object $db The PEAR::MDB2
+ *
+ * @return void
+ * @since 1.1 - 09.07.2006
+ * @version 1.1
+ * @access public
+ */
+ public function __construct($mdb) {
+ $this->mdb = $mdb;
+ }
+
+ /**
+ * Add a tag to a feed
+ * @param String $tag The tag itself
+ * @param String $by The username
+ * @param String $feed The feed name
+ * @return boolean
+ * @access public
+ */
+ public function addTag($tag, $by, $feed) {
+
+ }
+
+ /**
+ * Remove a tag from a feed
+ * @param String $tag The tag itself
+ * @param String $feed The feed name
+ * @return boolean
+ * @access public
+ */
+ public function removeTag($tag, $feed) {
+
+ }
+
+ /**
+ * Get the tags from a feed
+ * @param String $feed The feed name
+ * @return mixed
+ * @access public
+ */
+ public function getTags($feed) {
+
+ }
+
+ /**
+ * Random number generator
+ * @param Int $max upper end
+ * @param Int $min lower end, default 0
+ * @param Int $count number of random numbers to generate, default 5
+ * @return Int-Array
+ */
+ protected function generateRandomNumbers($max, $min, $count = 5) {
+ $rand = array ();
+ for ($i = 0; $i < $count;) {
+ $random = (int) (rand($min, $max));
+ if (!in_array($random, $rand)) {
+ $rand[$i] = $random;
+ $i++;
+ }
+ }
+ return $rand;
+ }
+}
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <C1...@us...> - 2006-12-04 21:40:09
|
Revision: 72
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=72&view=rev
Author: C167
Date: 2006-12-04 13:40:02 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
added
Added Paths:
-----------
trunk/page_personal.php
Added: trunk/page_personal.php
===================================================================
--- trunk/page_personal.php (rev 0)
+++ trunk/page_personal.php 2006-12-04 21:40:02 UTC (rev 72)
@@ -0,0 +1,8 @@
+<?php
+/**
+ * Created on 04.12.2006
+ *
+ *
+ * @author C167 <c1...@us...>
+ */
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:11:48
|
Revision: 71
http://svn.sourceforge.net/feed-collector/?rev=71&view=rev
Author: C167
Date: 2006-12-04 13:11:48 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Removed Paths:
-------------
trunk/page_show_feeds.php
trunk/show_feeds.php
trunk/styles/default/page_show_feeds-screen.css
trunk/styles/default/page_show_feeds.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:10:50
|
Revision: 70
http://svn.sourceforge.net/feed-collector/?rev=70&view=rev
Author: C167
Date: 2006-12-04 13:10:46 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/page_show_feeds.php
Removed Paths:
-------------
trunk/page_show_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:10:12
|
Revision: 69
http://svn.sourceforge.net/feed-collector/?rev=69&view=rev
Author: C167
Date: 2006-12-04 13:10:12 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/styles/default/page_personal-screen.css
trunk/styles/default/page_personal.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:09:43
|
Revision: 68
http://svn.sourceforge.net/feed-collector/?rev=68&view=rev
Author: C167
Date: 2006-12-04 13:09:41 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/styles/default/page_show_all_feeds-screen.css
trunk/styles/default/page_show_all_feeds.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:09:22
|
Revision: 67
http://svn.sourceforge.net/feed-collector/?rev=67&view=rev
Author: C167
Date: 2006-12-04 13:09:22 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/styles/default/page_show_feed-screen.css
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:09:08
|
Revision: 66
http://svn.sourceforge.net/feed-collector/?rev=66&view=rev
Author: C167
Date: 2006-12-04 13:09:07 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/styles/default/page_show_feed.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <C1...@us...> - 2006-12-04 21:07:17
|
Revision: 65
http://svn.sourceforge.net/feed-collector/?rev=65&view=rev
Author: C167
Date: 2006-12-04 13:07:17 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
moved
Added Paths:
-----------
trunk/page_show_feed.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-04 20:55:53
|
Revision: 64
http://svn.sourceforge.net/feed-collector/?rev=64&view=rev
Author: c167
Date: 2006-12-04 12:55:53 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/styles/default/page_show_feeds-screen.css
trunk/styles/default/page_show_feeds.tpl
Removed Paths:
-------------
trunk/styles/default/page_show_feeds-screen.css
trunk/styles/default/page_show_feeds.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-04 20:54:37
|
Revision: 63
http://svn.sourceforge.net/feed-collector/?rev=63&view=rev
Author: c167
Date: 2006-12-04 12:54:37 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/class/Feed_manager.php
trunk/class/User_manager.php
trunk/page_login.php
trunk/page_main.php
trunk/styles/default/page_login-screen.css
trunk/update_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-04 20:54:00
|
Revision: 62
http://svn.sourceforge.net/feed-collector/?rev=62&view=rev
Author: c167
Date: 2006-12-04 12:53:54 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/page_show_all_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-04 20:53:34
|
Revision: 61
http://svn.sourceforge.net/feed-collector/?rev=61&view=rev
Author: c167
Date: 2006-12-04 12:53:34 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
trunk/page_show_feeds.php
Removed Paths:
-------------
trunk/page_show_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-12-03 21:21:08
|
Revision: 60
http://svn.sourceforge.net/feed-collector/?rev=60&view=rev
Author: c167
Date: 2006-12-03 13:21:05 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
added 2 pictures (de_DE.gif and en_EN.gif), removed one (Germany.gif)
Added Paths:
-----------
trunk/pic/lang/de_DE.gif
trunk/pic/lang/en_EN.gif
Removed Paths:
-------------
trunk/pic/lang/Germany.gif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-28 22:38:35
|
Revision: 59
http://svn.sourceforge.net/feed-collector/?rev=59&view=rev
Author: c167
Date: 2006-11-28 14:38:35 -0800 (Tue, 28 Nov 2006)
Log Message:
-----------
some minor and some big changes ;-) xD
Modified Paths:
--------------
trunk/class/Feed_manager.php
trunk/inc/config.php
trunk/page_main.php
trunk/page_show_feeds.php
trunk/styles/default/page_main-screen.css
trunk/styles/default/page_register-screen.css
trunk/styles/default/page_show_feeds-screen.css
trunk/styles/default/page_show_feeds.tpl
trunk/update_feeds.php
Added Paths:
-----------
trunk/class/User_manager.php
trunk/dynamic.php
trunk/page_login.php
trunk/styles/default/page_login-screen.css
trunk/styles/default/page_login.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-25 13:41:43
|
Revision: 58
http://svn.sourceforge.net/feed-collector/?rev=58&view=rev
Author: c167
Date: 2006-11-25 05:41:41 -0800 (Sat, 25 Nov 2006)
Log Message:
-----------
some minor changes, still uses too much memory !!!
Modified Paths:
--------------
trunk/update_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-20 21:24:08
|
Revision: 57
http://svn.sourceforge.net/feed-collector/?rev=57&view=rev
Author: c167
Date: 2006-11-20 13:22:06 -0800 (Mon, 20 Nov 2006)
Log Message:
-----------
Modified Paths:
--------------
trunk/add_new_feed.php
trunk/class/Feed_manager.php
trunk/page_main.php
trunk/page_show_feeds.php
trunk/styles/default/page_main-screen.css
trunk/styles/default/page_main.tpl
trunk/update_feeds.php
Added Paths:
-----------
trunk/page_register.php
trunk/styles/default/page_register-screen.css
trunk/styles/default/page_register.tpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-13 17:21:41
|
Revision: 56
http://svn.sourceforge.net/feed-collector/?rev=56&view=rev
Author: c167
Date: 2006-11-13 09:21:23 -0800 (Mon, 13 Nov 2006)
Log Message:
-----------
design change nearly completed
Modified Paths:
--------------
trunk/styles/default/page_main.tpl
trunk/styles/default/page_show_feeds.tpl
Added Paths:
-----------
trunk/styles/default/page_show_feeds-screen.css
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-13 16:40:11
|
Revision: 55
http://svn.sourceforge.net/feed-collector/?rev=55&view=rev
Author: c167
Date: 2006-11-11 14:13:07 -0800 (Sat, 11 Nov 2006)
Log Message:
-----------
completed the mainpage template
Modified Paths:
--------------
trunk/styles/default/page_main.tpl
Added Paths:
-----------
trunk/styles/default/page_main-print.css
trunk/styles/default/page_main-screen-alt.css
trunk/styles/default/page_main-screen.css
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-02 15:38:57
|
Revision: 54
http://svn.sourceforge.net/feed-collector/?rev=54&view=rev
Author: c167
Date: 2006-11-02 07:38:46 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
some minor changes
Modified Paths:
--------------
trunk/update_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <c1...@us...> - 2006-11-02 10:09:50
|
Revision: 53
http://svn.sourceforge.net/feed-collector/?rev=53&view=rev
Author: c167
Date: 2006-11-02 02:09:44 -0800 (Thu, 02 Nov 2006)
Log Message:
-----------
now working for ATOM 1.0, no real error-handling, going to implement RSS-Parser
Modified Paths:
--------------
trunk/update_feeds.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|