[Feed-collector-svn] SF.net SVN: feed-collector: [86] trunk
Status: Beta
Brought to you by:
c167
From: <c1...@us...> - 2007-01-03 16:51:46
|
Revision: 86 http://feed-collector.svn.sourceforge.net/feed-collector/?rev=86&view=rev Author: c167 Date: 2007-01-03 08:51:39 -0800 (Wed, 03 Jan 2007) Log Message: ----------- some changes Modified Paths: -------------- trunk/class/User_manager.php trunk/page_main.php trunk/page_personal.php trunk/page_show_all_feeds.php trunk/styles/default/page_show_all_feeds-screen.css Modified: trunk/class/User_manager.php =================================================================== --- trunk/class/User_manager.php 2007-01-02 14:57:23 UTC (rev 85) +++ trunk/class/User_manager.php 2007-01-03 16:51:39 UTC (rev 86) @@ -83,19 +83,15 @@ * @return mixed */ public function getUserCols($id, $serialised = false) { - $info = $this->mdb->query("SELECT col1,col2,col3 FROM users WHERE id = \"$id\";"); + $info = $this->mdb->query("SELECT columns FROM users WHERE id = \"$id\";"); if (PEAR :: isError($info)) { return false; } $row = $info->fetchRow(); if (true === $serialised) { - $return['column1'] = $row['col1']; - $return['column2'] = $row['col2']; - $return['column3'] = $row['col3']; + $return = $row['columns']; } else { - $return['column1'] = unserialize($row['col1']); - $return['column2'] = unserialize($row['col2']); - $return['column3'] = unserialize($row['col3']); + $return = explode("|", $row['columns']); } return $return; } @@ -103,23 +99,11 @@ /** * Updates the users personal page colums * @param int $userid - * @param Array/String $col1 - * @param Array/String $col2 - * @param Array/String $col4 + * @param String $column * @return boolean */ - public function updateUserCols($userid, $col1, $col2, $col3) { - if (true === is_array($col1)) { - $col1 = serialize($col1); - } - if (true === is_array($col2)) { - $col2 = serialize($col2); - } - if (true === is_array($col3)) { - $col3 = serialize($col3); - } - - $cols = $this->mdb->query("UPDATE `users` SET `col1` = '$col1', `col2` = '$col2', `col3` = '$col3' WHERE `users`.`ID` = $userid LIMIT 1 ;"); + public function updateUserCols($userid, $column) { + $cols = $this->mdb->query("UPDATE `users` SET `columns` = '$column' WHERE `users`.`ID` = '$userid'LIMIT 1 ;"); if (PEAR :: isError($cols)) { return false; } @@ -130,14 +114,14 @@ * Adds a user * @param String $username * @param String $email - * @param String $passwd MD5-sum of the users password + * @param String $passwd MD5-sum of the users password * @param String $timezone * @return boolean * @access public */ public function reg_registrateUser($username, $email, $passwd, $language) { $add = $this->mdb5->query(sprintf("INSERT INTO `users` (`ID`, `name`, `email`, `pass`, `language`, `state`) " . - "VALUES (null, `%s`, `%s`, `%s`, `%s`, `regged`);", $username, $email, $passwd, $language)); + "VALUES (null, `%s`, `%s`, `%s`, `%s`, `active`);", $username, $email, $passwd, $language)); if (PEAR :: isError($add)) { return false; } @@ -156,10 +140,8 @@ if($passwd1 === $passwd2) { return true; } - return false; - } else { - return false; } + return false; } /** @@ -278,7 +260,24 @@ if(is_null($this->language)) { $this->language = $this->mdb->queryOne(sprintf("SELECT language FROM users WHERE id = '%s';", $this->uid)); } - return $This->language; + return $this->language; } + + /** + * Creates the Column-Strings + * @param Array $array The users column-array + * @return String + * @access public + */ + public function createColumnString($array) { + $return = ""; + for($i = 0; $i < count($array); $i++) { + $return .= $array[$i]; + if($i !== count($array)-1) { + $return .= "|"; + } + } + return $return; + } } ?> \ No newline at end of file Modified: trunk/page_main.php =================================================================== --- trunk/page_main.php 2007-01-02 14:57:23 UTC (rev 85) +++ trunk/page_main.php 2007-01-03 16:51:39 UTC (rev 86) @@ -118,8 +118,13 @@ " </form>\n" . " </div>", _("Login:"), _("Submit!"), _("Username"), _("Password"), basename($_SERVER['PHP_SELF'])); } else { + if(HTTP_Session :: get("username", false) == false) { + $username = $user->getUsername(); + } else { + $username = HTTP_Session :: get("username"); + } $midHeader_title_right = sprintf(" <span>%s %s</span><br />\n" . - " <div id=\"userinfo\">%s %s</div>", _("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"), $username, _("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_personal.php =================================================================== --- trunk/page_personal.php 2007-01-02 14:57:23 UTC (rev 85) +++ trunk/page_personal.php 2007-01-03 16:51:39 UTC (rev 86) @@ -59,7 +59,7 @@ HTTP_Session :: setIdle($session['time']['idle']); if(false === HTTP_Session :: get("logged_in", false)) { - HTTP :: redirect("./page_login.php"); + //HTTP :: redirect("./page_login.php"); } ################ @@ -129,23 +129,34 @@ # Main copy // main HTTP_Session :: set("uid", 0); +HTTP_Session :: set("logged_in", true); 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); + for($i = 0; $i < count($cols); $i+=3) { + $col1[] = $cols[$i]; + } + $main .= createColumn($col1, 1, $feed); ############ # Column 2 # ############ - $main .= createColumn($cols, 2, $feed); + for($i = 1; $i < count($cols); $i+=3) { + $col2[] = $cols[$i]; + } + $main .= createColumn($col2, 2, $feed); ############ # Column 3 # ############ - $main .= createColumn($cols, 3, $feed); + for($i = 2; $i < count($cols); $i+=3) { + $col3[] = $cols[$i]; + } + $main .= createColumn($col3, 3, $feed); } else { $main = ""; } @@ -172,9 +183,9 @@ echo $design; -function createColumn($cols, $number, $feed) { +function createColumn($column, $number, $feed) { $return = " <div class=\"column$number\">\n"; - foreach ($cols["column$number"] as $col) { + foreach ($column 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']); @@ -187,18 +198,4 @@ $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 Modified: trunk/page_show_all_feeds.php =================================================================== --- trunk/page_show_all_feeds.php 2007-01-02 14:57:23 UTC (rev 85) +++ trunk/page_show_all_feeds.php 2007-01-03 16:51:39 UTC (rev 86) @@ -80,8 +80,15 @@ $tag_manager = new Tag_Manager($db); HTTP_Session :: set("logged_in", true); +HTTP_Session :: set("uid", 0); -//$maxpages = $feed->getFeedsMaxPages(10); +#################################### +# Working with the users feed-list # +#################################### +if(isset($_POST) and isset($_POST['feed'])) { + $_POST['feed'] = $user->createColumnString($_POST['feed']); + $user->updateUserCols(HTTP_Session :: get("uid"), $_POST['feed']); +} $page = "main"; // @@ -120,8 +127,8 @@ $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_all_feeds.php\">%s</a> |\n" . +$navigation = sprintf(" <a href=\"./page_main.php\">%s</a> |\n" . +" <a href=\"./page_show_all_feeds.php\" class=\"highlight\">%s</a> |\n" . " <a href=\"./page_show_feed_tag.php\">%s</a> |\n" . " <a href=\"./page_add_new_feed.php\">%s</a> |\n" . " <a href=\"./page_show_all_tags.php\">%s</a> |\n", _("Home"), _("Show all Feeds"), _("Feeds by TAG"), _("Add a Feed"), _("Show TAGs")); @@ -134,8 +141,8 @@ # Main copy // main -if (true === HTTP_Session :: get("logged_in")) { - $main = createSelectionForm($feed, $tag_manager); +if (true === HTTP_Session :: get("logged_in", false)) { + $main = createSelectionForm($feed, $tag_manager, $user); } else { $main = createSelectionTable($feed, /*30, detectActualPage($maxpages),*/ $tag_manager); @@ -153,22 +160,32 @@ echo $design; -function createSelectionForm($feed, $tag_manager) { - $items = $feed->getFeeds(); - if (false === $items) { +function createSelectionForm($feed, $tag_manager, $user_manager) { + $feeds = $feed->getFeeds(); + if (false === $feeds) { return "error!!!"; } $return = sprintf(" <form action=\"%s\" method=\"post\">\n", $_SERVER['PHP_SELF']); - $return .= sprintf(" <table summary=\"\">\n" . + $return .= sprintf(" <table summary=\"\" border=\"1\">\n" . " <tr>\n" . + " <th colspan=\"5\" class=\"submit\"><input type=\"submit\" name=\"Submit\" value=\"%s\" /></th>\n" . + " </tr>\n" . + " <tr>\n" . " <th> </th>\n" . " <th>%s</th>\n" . " <th>%s</th>\n" . " <th>%s</th>\n" . " <th class=\"language_flag\"><img src=\"pic/lang/International.gif\" alt=\"%s\" /></th>\n" . - " </tr>\n", _("Feed List"), _("Site"), _("Tags"), _("Languages")); - foreach ($items as $list) { + " </tr>\n", _("Submit"), _("Feed List"), _("Site"), _("Tags"), _("Languages")); + foreach ($feeds as $list) { + $user_cols = $user_manager->getUserCols(HTTP_Session :: get("uid")); + $return .= " <tr>\n"; + if(in_array($list['feed_url'], $user_cols)) { + $return .= sprintf(" <td class=\"checked\"><input type=\"checkbox\" name=\"feed[]\" value=\"%s\" checked=\"checked\" /></td>\n", $list['feed_url']); + } else { + $return .= sprintf(" <td><input type=\"checkbox\" name=\"feed[]\" value=\"%s\" /></td>\n", $list['feed_url']); + } $return .= sprintf( " <td><a href=\"./page_show_feed?feed=%s\">%s</a></td>\n" . @@ -182,7 +199,8 @@ } else { $return .= " <td>"; foreach ($tags as $id => $tag) { - $return .= "<a href=\"./page_show_feed_tag.php?tag=$tag\">$tag</a>"; + $taglink = str_replace(" ", "%20", $tag); + $return .= "<a href=\"./page_show_feed_tag.php?tag=$taglink\">$tag</a>"; if ($id !== (count($tags) - 1)) { $return .= ", "; } @@ -194,7 +212,10 @@ " </tr>\n", $list['site_lang'], $list['site_lang']); } - $return .= " </table>\n </form>"; + $return .= sprintf(" <tr>\n" . + " <th colspan=\"5\" class=\"submit\"><input type=\"submit\" name=\"Submit\" value=\"%s\" /></th>\n" . + " </tr>\n" . + " </table>\n </form>", _("Submit")); return $return; } Modified: trunk/styles/default/page_show_all_feeds-screen.css =================================================================== --- trunk/styles/default/page_show_all_feeds-screen.css 2007-01-02 14:57:23 UTC (rev 85) +++ trunk/styles/default/page_show_all_feeds-screen.css 2007-01-03 16:51:39 UTC (rev 86) @@ -237,93 +237,10 @@ padding: 0; } -.newsHeading { - color: rgb(61, 92, 122); - background-color: transparent; - font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif; - font-size: 145%; - text-decoration: none; - margin: 0; - padding: 1ex 0 0 0; - display: block; +.checked { + background-color: yellow; } -.newsHeading:hover { - color: rgb(117, 144, 174); - background-color: transparent; - text-decoration: underline; -} - -.newsDate { - font-style: italic; - margin: 0 !important; - padding: 0; -} - -.newsSummary { - margin: 1.5ex 0 2.5ex 0.75ex !important; - padding: 0; -} - -.more { - text-align: right; - margin: 0; - padding: 0.5em 0; -} - -.more a { - color: rgb(61, 92, 122); - background-color: transparent; - font-size: 92%; - text-decoration: underline; - margin: 0; - padding: 0.25ex 0.75ex; -} - -.more a:hover { - color: rgb(117, 144, 174); - text-decoration: none; -} - -.rowOfBoxes { - clear: both; -} - -.quarter,.oneThird,.half,.twoThirds,.fullWidth { - margin: 1em 0; - float: left; - border-left: 1px solid rgb(204, 204, 204); -} - -.quarter { - width: 21%; - padding: 0 1.9%; -} - -.oneThird { - width: 28%; - padding: 0 1.9%; -} - -.half { - text-align: justify; - width: 46%; - padding: 0 1.9%; -} - -.twoThirds { - text-align: justify; - width: 63%; - padding: 0 1.9%; -} - -.fullWidth { - text-align: justify; - width: 96%; - padding: 0 1.2em; - border-left: none; -} - .filler { /* use with an empty <p> element to add padding to the end of a text box */ border: 1px solid white; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |