[Feed-collector-svn] SF.net SVN: feed-collector: [95] trunk
Status: Beta
Brought to you by:
c167
From: <c1...@us...> - 2007-01-06 15:13:49
|
Revision: 95 http://feed-collector.svn.sourceforge.net/feed-collector/?rev=95&view=rev Author: c167 Date: 2007-01-06 07:13:49 -0800 (Sat, 06 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/page_add_new_feed.php trunk/page_add_tag.php trunk/page_login.php trunk/page_main.php trunk/page_personal.php trunk/page_register.php trunk/page_show_all_feeds.php trunk/page_show_feed.php trunk/page_show_feed_tag.php trunk/update_feeds.php Modified: trunk/page_add_new_feed.php =================================================================== --- trunk/page_add_new_feed.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_add_new_feed.php 2007-01-06 15:13:49 UTC (rev 95) @@ -83,10 +83,31 @@ //HTTP :: redirect("./page_login.php"); } +$page = "add_new_feed"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + ##################### # BUILD THE CONTENT # ##################### -$page = "add_new_feed"; // get the design $design = file_get_contents("styles/default/page_add_new_feed.tpl", "r"); Modified: trunk/page_add_tag.php =================================================================== --- trunk/page_add_tag.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_add_tag.php 2007-01-06 15:13:49 UTC (rev 95) @@ -79,6 +79,28 @@ //HTTP :: redirect("./page_login.php"); } +$page = "add_tag"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + $main = ""; if (!$tag_manager->hasTags($_GET['feed'])) { @@ -109,7 +131,6 @@ ##################### # BUILD THE CONTENT # ##################### -$page = "add_tag"; // get the design $design = file_get_contents("styles/default/page_add_tag.tpl", "r"); Modified: trunk/page_login.php =================================================================== --- trunk/page_login.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_login.php 2007-01-06 15:13:49 UTC (rev 95) @@ -67,6 +67,29 @@ ############## require_once "HTTP.php"; + +$page = "login"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + ################ # User-Manager # ################ @@ -113,7 +136,6 @@ HTTP :: redirect("./page_main.php"); } -$page = "login"; ##################### # BUILD THE CONTENT # ##################### @@ -167,7 +189,7 @@ case LOGIN_WRONG_VALUES : $id_username = "error"; $id_password = "error"; - $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")); + $message = sprintf(" <p>%s</p>\n", _("Unknown username. If you don't have a username then please <a href=\"./page_register.php\">register</a> a new one")); break; case LOGIN_INACTIVE : $id_username = "error"; @@ -177,12 +199,12 @@ default : $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.")); + $message = sprintf(" <p>%s</p>\n", _("Please enter your username and your password to login. Cookies have to be enabled from this point.")); } } else { $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.")); + $message = sprintf(" <p>%s</p>\n", _("Please enter your username and your password to login. Cookies have to be enabled from this point.")); } $form = sprintf(" <div id=\"registration_form\">\n" . Modified: trunk/page_main.php =================================================================== --- trunk/page_main.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_main.php 2007-01-06 15:13:49 UTC (rev 95) @@ -45,8 +45,7 @@ 'table' => $session['container']['tablename'], 'autooptimize' => $session['container']['autooptimize'] ); -HTTP_Session :: setContainer('MDB2', /*$session['container']['options']*/ -$options); +HTTP_Session :: setContainer('MDB2', $options); HTTP_Session :: start(); HTTP_Session :: setExpire($session['time']['expire']); HTTP_Session :: setIdle($session['time']['idle']); @@ -68,6 +67,7 @@ require_once "class/User_manager.php"; $user = new User_manager($db); +$page = "main"; ############ # LANGUAGE # @@ -78,14 +78,17 @@ if(!in_array($language, $langs)) { $language = "en_EN"; } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); } else { - $language = HTTP :: negotiateLanguage($langs, "en_EN"); + $language = "en_EN"; } -/* -bindtextdomain("page_main", dirname($_SERVER['SCRIPT_FILENAME'])."i18n"); setlocale(LC_ALL, $language); -*/ -$page = "main"; +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + // // Now we're going to replace the placeholders in the template with the important content // @@ -126,18 +129,7 @@ # Main copy // main -$main = sprintf(" <h1>%s</h1>\n %s", _("Welcome!"), _("<p>This is the home of Feed-Collector, an database-driven news-reader.\n" . -" It is written to automaticaly collect news from other websites \n" . -" <acronym title=\"Resource Description Framework\">RDF</acronym>-, \n" . -" <acronym title=\"Really Simple Syndication\">RSS</acronym>- and \n" . -" <acronym title=\"Atom Syndication Formats\">ATOM</acronym>-newsfeeds \n" . -" and to display them to a user. There is no need to delete \"older news\", \n" . -" so you can come here anytime and search in the database</p>\n" . -" <p>Users can register to this site. If they do so, they get a personal page \n" . -" displaying the news they are interested in. Once a user is logged in, he can \n" . -" modify his page by adding and removing news feeds. To do so, just go to the \n" . -" <a href=\"./page_select_feeds.php\">feed-overview-page</a> and select/deselect \n" . -" news feeds.</p>")); +$main = sprintf(" <h1>%s</h1>\n %s", _("Welcome!"), _("<p>This is the home of Feed-Collector, an database-driven news-reader.\n It is written to automaticaly collect news from other websites \n <acronym title=\"Resource Description Framework\">RDF</acronym>-, \n <acronym title=\"Really Simple Syndication\">RSS</acronym>- and \n <acronym title=\"Atom Syndication Formats\">ATOM</acronym>-newsfeeds \n and to display them to a user. There is no need to delete \"older news\", \n so you can come here anytime and search in the database</p>\n <p>Users can register to this site. If they do so, they get a personal page \n displaying the news they are interested in. Once a user is logged in, he can \n modify his page by adding and removing news feeds. To do so, just go to the \n <a href=\"./page_select_feeds.php\">feed-overview-page</a> and select/deselect \n news feeds.</p>")); $design = str_replace("<!-- main -->", $main, $design); // latest news Modified: trunk/page_personal.php =================================================================== --- trunk/page_personal.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_personal.php 2007-01-06 15:13:49 UTC (rev 95) @@ -72,6 +72,28 @@ $user = new User_manager($db); $page = "personal"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + + // // Now we're going to replace the placeholders in the template with the important content // Modified: trunk/page_register.php =================================================================== --- trunk/page_register.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_register.php 2007-01-06 15:13:49 UTC (rev 95) @@ -81,10 +81,31 @@ require_once "class/User_manager.php"; $user = new User_manager($db); +$page = "register"; +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + + ##################### # BUILD THE CONTENT # ##################### -$page = "register"; // get the design $design = file_get_contents("styles/default/page_register.tpl", "r"); Modified: trunk/page_show_all_feeds.php =================================================================== --- trunk/page_show_all_feeds.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_show_all_feeds.php 2007-01-06 15:13:49 UTC (rev 95) @@ -83,6 +83,28 @@ } $page = "show_all_feeds"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + + // // Now we're going to replace the placeholders in the template with the important content // Modified: trunk/page_show_feed.php =================================================================== --- trunk/page_show_feed.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_show_feed.php 2007-01-06 15:13:49 UTC (rev 95) @@ -74,6 +74,28 @@ require_once "HTTP.php"; $page = "show_feed"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + + // // Now we're going to replace the placeholders in the template with the important content // Modified: trunk/page_show_feed_tag.php =================================================================== --- trunk/page_show_feed_tag.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/page_show_feed_tag.php 2007-01-06 15:13:49 UTC (rev 95) @@ -74,6 +74,28 @@ require_once "HTTP.php"; $page = "show_feed_tag"; + +############ +# LANGUAGE # +############ +if (true === HTTP_Session :: get("logged_in", false)) { + $user->setUserId(HTTP_Session :: get("uid")); + $language = $user->getUserLanguage(); + if(!in_array($language, $langs)) { + $language = "en_EN"; + } +} elseif(isset($_GET['lang']) and in_array($_GET['lang'], $langs)) { + $language = $_GET['lang']; +} elseif(!is_null(HTTP_Session :: get("lang")) and in_array(HTTP_Session :: get("lang"), $langs)) { + $language = HTTP_Session :: get("lang"); +} else { + $language = "en_EN"; +} +setlocale(LC_ALL, $language); +bindtextdomain("page_$page", "./i18n"); +textdomain("page_$page"); + + // Now we're going to replace the placeholders in the template with the important content // if (!isset ($_GET['tag'])) { Modified: trunk/update_feeds.php =================================================================== --- trunk/update_feeds.php 2007-01-05 19:00:42 UTC (rev 94) +++ trunk/update_feeds.php 2007-01-06 15:13:49 UTC (rev 95) @@ -14,7 +14,7 @@ $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"; + \"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"; } @@ -26,7 +26,6 @@ require_once "Log.php"; // Logger // some other stuff require_once "inc/config.php"; -require_once "inc/definitions.php"; ############################### # Configure and start logging # ############################### @@ -56,11 +55,11 @@ ############################################## // Connect to the database $dsn = array ( - 'phptype' => DB_TYPE, - 'username' => DB_LOGIN, - 'password' => DB_PASSWD, - 'hostspec' => DB_HOST, - 'database' => DB_DATABASE + 'phptype' => $db['type'], + 'username' => $db['user'], + 'password' => $db['passwd'], + 'hostspec' => $db['host'], + 'database' => $db['database'] ); $options = array ( 'debug' => 2, @@ -200,8 +199,10 @@ $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); -if(false === $console) echo "\t</body>\n</html>"; -else echo ""; +if (false === $console) + echo "\t</body>\n</html>"; +else + echo ""; function insertData($data, $table_name, $log, $mdb2) { $mdb2->loadModule('Extended'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |