[Feed-collector-svn] SF.net SVN: feed-collector: [94] trunk
Status: Beta
Brought to you by:
c167
|
From: <c1...@us...> - 2007-01-05 19:00:46
|
Revision: 94
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=94&view=rev
Author: c167
Date: 2007-01-05 11:00:42 -0800 (Fri, 05 Jan 2007)
Log Message:
-----------
works nearly correct
Modified Paths:
--------------
trunk/.htaccess
trunk/index.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/statistics.php
trunk/styles/default/page_login-screen.css
trunk/styles/default/page_login.tpl
trunk/styles/default/page_show_feed_tag.tpl
Added Paths:
-----------
trunk/inc/navigation.php
trunk/page_add_new_feed.php
trunk/styles/default/page_add_new_feed-screen.css
trunk/styles/default/page_add_new_feed.tpl
Removed Paths:
-------------
trunk/add_new_feed.php
trunk/class/class.security.php
trunk/class/template_manager.php
trunk/class/template_manager_sidebar.php
trunk/dynamic.php
trunk/inc/definitions.php
trunk/inc/functions.php
trunk/inc/querys.php
trunk/inc/secure.php
trunk/inc/template.php
trunk/todo.php
Modified: trunk/.htaccess
===================================================================
--- trunk/.htaccess 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/.htaccess 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,4 +0,0 @@
-<Files ~ "\.tpl$">
- Order allow, deny
- Deny from all
-</Files>
\ No newline at end of file
Deleted: trunk/add_new_feed.php
===================================================================
--- trunk/add_new_feed.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/add_new_feed.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,205 +0,0 @@
-<?php
-/**
- * This script is used for adding feeds to the database
- * //it gets the informarion about the new feeds throug POST-Messages
- * It should be moved out of the project-root und run by Cronjob or by hand through console
- * @version 1.7
- * @since 23 - 10.07.2006
- * @author c167 <c1...@us...>
- * @todo Add error-messages to every point an error may occure
- */
-
-
-
-$sql = 'INSERT INTO `feed_list` (`ID`, `site_name`, `site_url`, `site_lang`, `feed_name`, `feed_url`, `feed_type`, `feed_lang`, `feed_img`, `is_active`, `last_change`) VALUES (NULL, \'Heise Online\', \'http://heise.de\', \'de_DE\', \'heise open news\', \'http://heise.de/open/Atom.rdf\', \'Atom 1.0\', \'de_DE\', \'heise_open.ico\', \'1\', \'1152864327\');';
- /*ID
- site_name
- site_url
- site_lang
- site_img
- feed_name
- feed_url
- feed_type
- feed_db_name
- feed_lang
- feed_img
- is_active
- last_change
- */
-// We need some PEAR-classes
-require_once "MDB2.php"; // Database
-require_once "Log.php";
-require_once "HTML/QuickForm.php";
-
-// some other stuff
-require_once "inc/config.php";
-require_once "inc/definitions.php";
- /*
-ID int(10) UNSIGNED Nein
-site_name varchar(255) latin1_swedish_ci Nein
-site_url varchar(255) latin1_swedish_ci Nein
-site_lang varchar(7) latin1_swedish_ci Ja NULL
-site_img varchar(20) latin1_swedish_ci Ja NULL
-feed_name varchar(255) latin1_swedish_ci Nein
-feed_url varchar(255) latin1_swedish_ci Nein
-feed_type varchar(10) latin1_swedish_ci Nein
-feed_db_name varchar(255) latin1_swedish_ci Nein
-feed_lang varchar(8) latin1_swedish_ci Nein
-feed_img varchar(255) latin1_swedish_ci Nein
-is_active tinyint(1) Nein
-last_change int(11) Nein 0
- */
-
-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>"._("Add New Feed")."</title>\n\t</head>\n\t<body>\n";
-$form = new HTML_QuickForm('eingabe', 'post', $_SERVER['PHP_SELF']);
-
-// Now we create some objects...
-
-// We'll better ask for the admin-password
-$pw = HTML_QuickForm::createElement('password', 'admin-pw', _("Admin password:"));
-$pw->setSize(20);
-$pw->setMaxlength(20);
-
-// site_name
-$site_name = HTML_QuickForm::createElement('text', 'site_name', _("Site name:"));
-$site_name->setSize(50);
-$site_name->setMaxLength(255);
-
-// site_url
-$site_url = HTML_QuickForm::createElement('text', 'site_url', _("URL of the site:"));
-$site_url->setSize(50);
-$site_url->setMaxLength(255);
-
-// site_lang
-$site_lang = HTML_QuickForm::createElement('text', 'site_lang', _("Language of the site:"));
-$site_lang->setSize(7);
-$site_lang->setMaxLength(7);
-
-// site_img
-$site_img = HTML_QuickForm::createElement('text', 'site_img', _("The image of the site:"));
-$site_img->setSize(20);
-$site_img->setMaxLength(20);
-
-// feed_name
-$feed_name = HTML_QuickForm::createElement('text', 'feed_name', _("Name of the feed:"));
-$feed_name->setSize(50);
-$feed_name->setMaxLength(255);
-
-// feed_description
-$feed_description = HTML_QuickForm::createElement('text', 'feed_description', _("Description of the feed:"));
-$feed_description->setSize(50);
-$feed_description->setMaxLength(255);
-
-// feed_url
-$feed_url = HTML_QuickForm::createElement('text', 'feed_url', _("URL of the feed:"));
-$feed_url->setSize(50);
-$feed_url->setMaxLength(255);
-
-// feed_type
-/* This should be a options-list with to elements, use JavaScript
-$feed_type = HTML_QuickForm::createElement('text', 'feed_url', _("URL of the feed:"));
-$feed_type->setSize(50);
-$feed_type->setMaxLength(255);
-*/
-
-//$form->addElement($pw);
-$form->addElement($site_name);
-$form->addElement($site_url);
-$form->addElement($site_lang);
-$form->addElement($site_img);
-$form->addElement($feed_name);
-$form->addElement($feed_description);
-$form->addElement($feed_url);
-$form->display();
-/*
-$time_now = time();
-echo _("Script startet at " . microtime() . "<br />\n");
-//if ($update['enabled']) {
-
- // Connect to the database
- $dsn = array (
- 'phptype' => DB_TYPE,
- 'username' => DB_LOGIN,
- 'password' => DB_PASSWD,
- 'hostspec' => DB_HOST,
- 'database' => DB_DATABASE
- );
-
- $options = array (
- 'debug' => 2,
- 'portability' => DB_PORTABILITY_ALL
- );
-
- $db = & DB :: connect($dsn, $options);
- if (PEAR :: isError($db)) {
- //$log->
- echo $db->getMessage() . "<br />\n";
- die(_("Script ended with error at ") . time());
- } else {
- echo _("Successfully connected to the database<br />\n");
- }
- $db->setFetchMode(DB_FETCHMODE_ASSOC);
-
- /*
- * Now we get all the data from the feeds-table
- *//*
- // Proceed with a query...
- $res = & $db->query('SELECT * FROM feed_list');
-
- // Always check that result is not an error
- if (PEAR :: isError($res)) {
- echo $res->getMessage() . "<br />\n";
- die(_("Script stoped with error at ") . time());
- } else {
- echo _("Successfully SELECTed the feeds-list from the database<br />\n");
- }
- if (!isset ($row)) {
- echo _("There are <b>no</b> feeds in the database.<br />" .
- "This is quite bad, so please run the script \"add_new_feed.php\" from the console as described in the file \"README.txt\"<br />\n");
- }
- /*
- * Now we start the main thing
- *//*
- while ($row = & $res->fetchRow()) {
-
- foreach ($row as $var => $value) {
- echo $var . "=> " . $value . "<br />\n";
- }
-
- // Is the feed active?
- if ($row['is_active'] != 1) {
- continue;
- }
- /*
- * Do we have to look for an update?
- * First we calculate the time difference
- *//*
- if (($time_now - $row['last_change']) < 0) {
- echo _("WARING Differece negative!! <br />\n");
- }
- if (($time_now - $row['last_change']) > $update['difference']) {
- echo _("Update: " . $row['feed_name'] . " | diff: ") . ($time_now - $row['last_change']);
-
- } else {
- echo _("Not to update: ") . $row['feed_name'];
- continue;
- }
-
- }
-/*} else {
- /**
- * @todo write to log
- */
-/* echo _("The script is not allowed to update the feeds.<br />" .
- "This means that the feeds won't be updated, the lists are not up to datehttp://localhost/~stefan/ws32/feed-collector/trunk/update_feeds.php<br />");
-}*//*
-echo _("Script finished at ") . microtime();
-*/
-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</head>\n\t<body>\n";
-?>
\ No newline at end of file
Deleted: trunk/class/class.security.php
===================================================================
--- trunk/class/class.security.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/class/class.security.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,46 +0,0 @@
-<?php
-/*
-* This file contains the class(es) needed for updating the streams
-*
-*/
-
-/**
- * This class is used to validate the inputs.
- * It checks for:
- * SQL-Injecion
- */
-class security {
- /**
- * The given Values, may be a file_get_contents or a $_GET or a $_POST-Statement
- * @var resource
- */
- private $resource;
-
- /**
- * This function searches for standart-commands used in SQL-Statements
- * @version 0.1
- * @return bool
- */
- public function sql_checker() {
- $seq = array("SELECT", "DROP", "ALTER");
- $seqi= array();
- }
-
- /**
- * Sets the resource used in this class
- * @param stream
- */
- public function set_resource($res) {
- $resource = $res;
- }
-
- /**
- * Sets the resource used in this class
- * @return value
- */
- public function get_resource() {
- return $resource;
- }
-
-}
-?>
\ No newline at end of file
Deleted: trunk/class/template_manager.php
===================================================================
--- trunk/class/template_manager.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/class/template_manager.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,96 +0,0 @@
-<?php
-
-
-/**
- * Created on 04.07.2006
- * This file is the home of the Template-Manager
- * @version 46
- * @since 1.19 - 28.05.2006
- * @author c167 <c1...@us...>
- */
-
-class Template_Manager {
-
- /**
- * The PEAR::MDB2-Object
- * @access protected
- */
- protected $mdb2;
-
- /**
- * The name of the page
- * @access protected
- */
- protected $page;
-
- /**
- * State of the sidebar
- * @access protected
- */
- protected $sidebar_created = false;
-
- /**
- * The konstructor
- * @param Object $db a PEAR::DP-object
- * @param String $page The name of the desired page
- * @param String $box_source The sourcedore of a box
- *
- * @version 1.2
- * @since 1.1 - 04.07.2006
- * @access public
- */
- public function __construct($template, $page /* , $box_source*/
- ) {
- //$this->box_source = $box_source;
- //$this->db = $db;
- $this->page = $page;
- $this->template = $template;
- }
-
- /**
- * This function loads an extension
- * @param String $name The extensions name
- */
- public static function loadExtension($name) {
- if(is_file("template_manager_".$name.".php")) {
- include_once "template_manager_".$name.".php";
- return new Template_Manager_Sidebar();
- } else {
- return false;
- }
- }
-
- /**
- * Create the boxes
- *
- * @return String The HTML-Code representing the boxes
- * @version 1.1
- * @since 1.1 - 04.07.2006
- * @access public
- */
- public function createBoxes() {
- /**
- * @todo probably we set another language-domain, need to check that
- */
- switch ($this->page) {
- case "main" :
- $b['1']['title'] = "<a href=\"?page=version\">dev://VERSION</a>";
- $b['1']['content'] = "<u><b>Version: 0.2</b></u><br /> This is the initial release. some code is working, but the script cannot parse feeds or display items";
- $b['2']['title'] = "<a href=\"?page=php\">dev://PHP</a>";
- $b2_content = "<u><b>Progress: 20 %</b></u><br /> There are problems with the database-connection.<br />The page-code, that is finished yet, works fine, otherwise you would not see this ;-)";
- $b3_title = "<a href=\"?page=mysql\">dev://MySQL</a>";
- $b3_content = "<u><b>Progress: 20 %</b></u><br /> The Channels-table is nearly finished, but I find \n new things to add every day. I'm not sure if I included all the necesary information \n in the feed_tables.";
- $b4_title = "<a href=\"?page=html\">dev://HTML</a>";
- $b4_content = "<u><b>Progress: 10 %</b></u><br /> The site is under heavy development. \n <span class=\"titleTip\" title=\"At the time\">ATM</span>, there are no more pages to see, \n cause there are problems with the stylesheets.";
- $b5_title = "<a href=\"?page=css\">dev://CSS</a>";
- $b5_content = "<u><b>Progress: 90 %</b></u><br /> The stylesheet of the default-template is nearly finished.";
-
- break;
-
- default :
- // Do something
- }
- }
-
-}
-?>
\ No newline at end of file
Deleted: trunk/class/template_manager_sidebar.php
===================================================================
--- trunk/class/template_manager_sidebar.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/class/template_manager_sidebar.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,83 +0,0 @@
-<?php
-/**
- * Created on 02.10.2006
- *
- * @version 46
- * @author C167 <c1...@us...>
- * @since 45 - 02.10.2006
- */
-
-/**
- *
- */
-define(TEMPLATE_SIDEBAR_TEXT, 0);
-
-/**
- *
- */
-define(TEMPLATE_SIDEBAR_LINK, 1);
-
-class Template_Manager_Sidebar extends Template_Manager {
- /**
- * The construcot
- *
- * @since 21 - 31.08.2006
- * @return void
- * @param String $template
- * @param String $page
- */
- public function __construct($template, $page) {
- parent::__construct($template, $page);
- }
- /**
- * Create the sidebar
- *
- * @return object sidebar-object
- * @version 1.1
- * @since 21 - 31.08.2006
- * @access public
- */
- public function sidebar_create() {
- $this->sidebar_created = true;
- return true;
- }
- /**
- * Create a sidebar-element
- *
- * @see createSidebar()
- * @return void
- * @version 1.1
- * @since 21 - 31.08.2006
- * @access public
- */
- public function sidebar_addElement($type, $name, $link = null) {
- switch($type) {
- case TEMPLATE_SIDEBAR_TEXT:
-
- break;
- case TEMPLATE_SIDEBAR_LINK:
- if(null === $link) return false;
- break;
-
- default:
- return false;
- }
- }
-
- /**
- * Show the sidebar
- *
- * @see createSidebar()
- * @return void
- * @version 1.1
- * @since 21 - 31.08.2006
- * @access public
- */
- public function show() {
- if(true === $this->sidebar_finished) {
- echo $this->sidebar_code;
- } else return false;
- }
-}
-
-?>
Deleted: trunk/dynamic.php
===================================================================
--- trunk/dynamic.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/dynamic.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,43 +0,0 @@
-<?php
-
-
-/**
- * Created on 13.11.2006
- * This script is called by the AJAX-Component in some sites
- * @version 1
- * @since 56 - 13.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_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();
-} else {
- //$log->log(_("Successfully connected to the database"), PEAR_LOG_DEGUB);
-}
-$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
-
-if(!isset($_GET['id'])) {
-
-} else {
- HTTP_Session :: start();
- HTTP_Session :: id($_GET['id']);
- if(!HTTP_Session :: isNew) {
-
- }
-}
-?>
\ No newline at end of file
Deleted: trunk/inc/definitions.php
===================================================================
--- trunk/inc/definitions.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/inc/definitions.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,26 +0,0 @@
-<?php
-/**
- * Definitions
- * This file contains the definitions needed by the script
- */
-
-// Database
-define('DB_TYPE', $db['type']);
-define('DB_LOGIN', $db['user']);
-define('DB_PASSWD', $db['passwd']);
-define('DB_HOST', $db['host']);
-define('DB_DATABASE', $db['database']);
-
-// Folders
-define('FOLDER_LANG', "i18n/");
-define('FOLDER_TEMPLATES', "styles/");
-define('FOLDER_PIC_FAVICONS', "pic/feeds/");
-define('FOLDER_PIC_LANG', "pic/lang/");
-define('FOLDER_LOG', "log/");
-
-define('FEED_RETURN_ONLY', 1);
-define('FEED_DISPLAY_ONLY', 2);
-define('FEED_RETURN_AND_DISPLAY', 3);
-
-
-?>
\ No newline at end of file
Deleted: trunk/inc/functions.php
===================================================================
--- trunk/inc/functions.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/inc/functions.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,162 +0,0 @@
-<?php
-
-
-/**
- * This file contains the main functions used by the script
- * Please note: The functions that make the script more secure are in secure.php
- * @author Stefan Valouch <ste...@go...>
- * @since 1 - 03.07.2006
- * @version 14
- * @todo change the language-test to check for compiled .mo-files
- */
-
-/** Check the data the users browser sends to the server
- * This function reads and converts the data given by the browser
- *
- * @return string_array
- */
-function userdata() {
-
-}
-
-/**
- * checks if the desired language is available
- * @param $language string
- * @return boolean true if available
- * @since 3 - 03.07.2006
- * @version 1.4
- */
-function checkLang($language) {
- if (is_file(FOLDER_TPLS . $language . ".mo")) {
- return true;
- } else {
- return false;
- }
-
- /*for($i = 0; $i < count($GLOBALS['lang_avail']); $i++) {
- //echo $i;
- if($language == $GLOBALS['lang_avail'][$i]) {
- $return = "i18n/" .$GLOBALS['lang_avail_code'][$i] .".php";
- $GLOBALS['lang'] = $GLOBALS['lang_avail'][$i];
- $GLOBALS['lang_code'] = $GLOBALS['lang_avail_code'][$i];
- //echo $return;
- }
- }
- if(isset($return)) {
- return $return;
- } else {
- return "i18n/en_EN.php";
- }*/
-}
-
-/**
- * Displays where the user is
- * @param $location string
- * @return html_string
- */
-function you_are_here($location) {
- $position = _("You are here: ") . '<a href="index.php?page=main">' . _("Main page") . '</a>';
- $search = ' => <a href="index.php?page=search">' . _("Search") . '</a>';
- $search_res = ' => <a href="index.php?page=searchresults">' . _("Search results") . '</a>';
- switch ($location) {
- case "search" :
- $position .= $search;
- break;
- case "searchresults" :
- $position .= $search;
- $position .= $search_res;
- default :
-
- }
- return $position;
-}
-
-/**
- * Check if the channel is already in the database.
- * @param $channel_info string_array
- * @return bool
- */
-function add_feed($channel_info) {
- $channels = mysql_query("SELECT * FROM channels") or die($error['mysql'] = true);
- while ($channel_info = mysql_fetch_array($channels, MYSQL_ASSOC)) {
- foreach ($line as $col_value) {
- switch (true) {
- case ($channel_info['site_url'] == $value) :
- return 0;
- break;
- case ($channel_info['feed_url'] == $value) :
- return 0;
- break;
- default :
- return 1;
- // Daten inzufügen
- }
- }
- /* foreach($channels as $var => $value) {
- switch(true) {
- case $channel_info['site_url'] == $value:
- return 0;
- break;
- case $channel_info['feed_url'] == $value:
- return 0;
- break;
- default:
-
- }*/
- }
- /*$sql_setup['crate_channels'] = 'CREATE TABLE `channels` ('
- . ' `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, '
- . ' `site_name` VARCHAR(255) NOT NULL, '
- . ' `site_url` VARCHAR(255) NOT NULL, '
- . ' `site_lang` VARCHAR(255) NULL, '
- . ' `feed_name` VARCHAR(255) NULL, '
- . ' `feed_url` VARCHAR(255) NOT NULL, '
- . ' `feed_type` VARCHAR(10) NOT NULL, '
- . ' `feed_lang` VARCHAR(6) NOT NULL, '
- . ' `is_active` BOOL NOT NULL, '
- . ' `last_change` TIMESTAMP NOT NULL DEFAULT \'1111111111\' '
- . ' `encoding` VARCHAR(20) NOT NULL, '
- . ' `temp` VARCHAR(255) NOT NULL'
- . ' )'
- . ' ENGINE = myisam;';
- $query = "SELECT * FROM Meine_Tabelle";
- $result = mysql_query($query) or die("Anfrage fehlgeschlagen: " . mysql_error());
-
- /* Ausgabe der Ergebnisse in HTML */ /*
- echo "<table>\n";
- while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
- echo "\t<tr>\n";
- foreach ($line as $col_value) {
- echo "\t\t<td>$col_value</td>\n";
- }
- echo "\t</tr>\n";*/
-
-}
-define(VAR_CHECK_TYPE_INT, 0);
-define(VAR_CHECK_TYPE_FLOAT, 1);
-define(VAR_CHECK_TYPE_DOUBLE, 2);
-define(VAR_CHECK_TYPE_STRING, 3);
-
-define(VAR_CHECK_METHOD_GET, 0);
-define(VAR_CHECK_METHOD_POST, 1);
-/**
- * Check if a variable has a specific type
- * @param String $name The name of the variable
- * @param Int $method The method {GET, POST}
- * @param Int $type The type
- * @return String description
- */
-function getVariableCheckType($name, $method, $type) {
- if(VAR_CHECK_METHOD_POST === $method) {
- if(isset($_POST[$name])) {
-
- }
- } elseif(VAR_CHECK_METHOD_POST === $method) {
- if(isset($_GET[$name])) {
-
- }
- } else {
- return false;
- }
-}
-?>
\ No newline at end of file
Added: trunk/inc/navigation.php
===================================================================
--- trunk/inc/navigation.php (rev 0)
+++ trunk/inc/navigation.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -0,0 +1,68 @@
+<?php
+
+
+/**
+ * Created on 05.01.2007
+ *
+ *
+ * @author C167 <c1...@us...>
+ */
+
+$hl = " class=\"highlight\"";
+if (!isset ($page)) {
+ $page = "";
+}
+switch ($page) {
+ case "main" :
+ $page_main = $hl;
+ $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $login = $register = $personal = "";
+ break;
+ case "show_all_feeds" :
+ $show_all_feeds = $hl;
+ $page_main = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $login = $register = $personal = "";
+ break;
+ case "show_feed_tag" :
+ $show_feed_tag = $hl;
+ $page_main = $show_all_feeds = $add_new_feed = $show_feed = $add_tag = $login = $register = $personal = "";
+ break;
+ case "add_new_feed" :
+ $add_new_feed = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $show_feed = $add_tag = $login = $register = $personal = "";
+ break;
+ case "show_feed" :
+ $show_feed = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $add_tag = $login = $register = $personal = "";
+ break;
+ case "add_tag":
+ $add_tag = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $register = $personal = "";
+ break;
+ case "login" :
+ $login = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $register = $personal = "";
+ break;
+ case "register" :
+ $register = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $login = $personal = "";
+ break;
+ case "personal" :
+ $personal = $hl;
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $login = $register = "";
+ break;
+ default :
+ $page_main = $show_all_feeds = $show_feed_tag = $add_new_feed = $show_feed = $add_tag = $login = $register = $personal = "";
+}
+$navigation = sprintf(" <a href=\"./page_main.php\"$page_main>%s</a> |\n" .
+" <a href=\"./page_show_all_feeds.php\"$show_all_feeds>%s</a> |\n" .
+" <a href=\"./page_show_feed_tag.php\"$show_feed_tag>%s</a> |\n" .
+" <a href=\"./page_add_new_feed.php\"$add_new_feed>%s</a> |\n" .
+" <a href=\"./page_show_feed.php\"$show_feed>%s</a> |\n" .
+" <a href=\"./page_add_tag.php\"$add_tag>%s</a> |\n", _("Home"), _("Show all Feeds"), _("Feeds by TAG"), _("Add a Feed"), _("Display a Feed"), _("Add a Tag"));
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $navigation .= sprintf(" <a href=\"./page_login.php\"$login>%s</a> |\n" .
+ " <a href=\"./page_register.php\"$register>%s</a>", _("Login"), _("Register"));
+} else {
+ $navigation .= sprintf(" <a href=\"./page_personal.php\"$personal>%s</a> |\n" .
+ " <a href=\"./page_logout.php?returnto=page_main.php\">%s</a>", _("Personal Page"), _("LogOut"));
+}
+?>
Deleted: trunk/inc/querys.php
===================================================================
--- trunk/inc/querys.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/inc/querys.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,33 +0,0 @@
-<?php
-/**
- * This file contains the most used querys of this project
- */
-
-#$select_all_channels = "SELECT ID, Titel, Inhalt, Datum, Autor FROM News ORDER BY Datum DESC;";
-/**
- * Select all the channels
- */
-$select_all_channels = "SELECT ID, site_name, site_url, site_lang, feed_name, feed_url, feed_type, feed_lang, is_active, last_change, encoding, add_date FROM channels ORDER BY add_date DESC;";
-
-/**
- * Select the information needed to make a list of feeds
- */
-$select_feeds_to_show = "SELECT ID, site_name, site_url, site_lang, feed_name, feed_url feed_lang, last_change, add_date FROM channels ORDER BY add_date DESC;";
-/*
-REATE TABLE `channels` (
-`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-`site_name` VARCHAR( 255 ) NOT NULL ,
-`site_url` VARCHAR( 255 ) NOT NULL ,
-`site_lang` VARCHAR( 255 ) NOT NULL ,
-`feed_name` VARCHAR( 255 ) NOT NULL ,
-`feed_url` VARCHAR( 255 ) NOT NULL ,
-`feed_type` VARCHAR( 10 ) NOT NULL ,
-`feed_lang` VARCHAR( 6 ) NOT NULL ,
-`is_active` BOOL NOT NULL ,
-`last_change` TIMESTAMP NOT NULL DEFAULT '1111111111',
-`encoding` VARCHAR( 20 ) NOT NULL ,
-`temp` VARCHAR( 255 ) NOT NULL ,
-INDEX ( `feed_name` )
-) ENGINE = MYISAM ;
-*/
-?>
\ No newline at end of file
Deleted: trunk/inc/secure.php
===================================================================
--- trunk/inc/secure.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/inc/secure.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,144 +0,0 @@
-<?php
-/*
-* This file contains functions ans classes to improve the security of the script
-* Please use them!
-*
-*/
-
-//////////////////////
-// GENERAL-SECURITY //
-//////////////////////
-
-/**
- * Checks if the page exists
- * @param $page page_name
- * @return bool
- */
-function page_exists($page) {
- switch($page) {
- case "main":
- return 1;
- break;
- case "show_feed":
- return 1;
- break;
- case "search":
- return 1;
- break;
- case "admin":
- return 1;
- break;
- case "css":
- return 1;
- break;
- case "html":
- return 1;
- break;
- case "mysql":
- return 1;
- break;
- default:
- return 0;
- }
-}
-
-////////////////////
-// ERROR-HANDLING //
-////////////////////
-
-/**
- * Function to react on errors
- * @param $error String
- * @param $error_type Int
- */
- function error_page($error) {
-
- }
-
-//////////
-// GET //
-//////////
-/**
- * Secure way to get a GET-Integer
- * @param $name string
- * @param $optional bool
- * @return $x
- * @author boinc.berkeley.edu
- */
- function get_int($name, $optional=false) {
- $x=null;
- if (isset($_GET[$name])) $x = $_GET[$name];
- if (!is_numeric($x)) {
- if ($optional) {
- return null;
- } else {
- error_page("missing or bad parameter: $name $x");
- }
- }
- return (int)$x;
- }
-
-/**
- * Secure way to get a GET-String
- * @param $name string
- * @param $optional bool
- * @return $x string
- * @author boinc.berkeley.edu
- */
- function get_str($name, $optional=false) {
- $x = null;
- if (isset($_GET[$name])) {
- $x = $_GET[$name];
- }
- if (!$x && !$optional) {
- error_page("missing or bad parameter: $name");
- }
- return $x;
- }
-
-//////////
-// POST //
-//////////
-/**
- * Secure way to get a POST-Integer
- * @param $name sting
- * @param $optional bool
- * @return $x
- * @author boinc.berkeley.edu
- */
- function post_int($name, $optional=false) {
- $x = null;
- if (isset($_POST[$name])) $x = $_POST[$name];
- if (!is_numeric($x)) {
- if ($optional) {
- return null;
- } else {
- error_page("missing or bad parameter: $name $x");
- }
- }
- return (int)$x;
- }
-
-/**
- * Secure way to get a POST-String
- * @param $name string
- * @param $optional bool
- * @return $x
- * @author boinc.berkeley.edu
- */
- function post_str($name, $optional=false) {
- $x = $_POST[$name];
- if (!$x && !$optional) {
- error_page("missing or bad parameter: $name");
- }
- return $x;
- }
-
-/**
- * Secure way to get a GET-String
- *
- * @author Berkeley
- */
-
-
-?>
\ No newline at end of file
Deleted: trunk/inc/template.php
===================================================================
--- trunk/inc/template.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/inc/template.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -1,121 +0,0 @@
-<?php
-/*
-* This file contains the functions for using the templates
-* that are stored in inc/templates/
-*
-*/
-
-
-/**
- * Dummy Class
- * This class contains the dummys
- */
-class dummys {
-
- /**
- * @var Highlightable link
- */
- var $link = ' <a href="{url}" alt={alt} {class}>{name}</a> ';
-
- /**
- * @var Highlight actual link
- */
- var $highlight = 'class="highlight"';
-
- /**
- * @var Footer_left
- */
- var $footer_left = ' E-mail: <a href="./index.html" title="Email webmaster">web...@yo...</a><br />
- <a href="./index.html" class="doNotPrint">Contact Us</a>';
-
- /**
- * @var Footer_right
- */
- var $footer_right = ' This design is (almost) public domain.<br />
- <a href="./index.html" class="doNotPrint">This is a footer link</a>';
-
- /**
- * Get the navi-left
- * @return navi-left
- */
- //function get_dummy_left() {
- // return $dummy_navi_left;
- //}
-}
-/*
-/**
- * Find and replace a String
- * @param $search String: The string that should be searched for
- * @param $replace String
- * @param $input String: The Text given
- * @return String
- */
-function My_str_replace($search,$replace,$input) {
- if(strstr($input,$search)) {
- $x = strpos($input,$search);
- return substr($input,0,$x) . $replace . substr($input,$x+strlen($search));
- } else {
- return $input;
- }
-}
-/*
-/**
- * Includes a page and replaces the {}-placeholders
- * @param $page string
- * @param $design string
- * @return html-page
- *
-function print_page($page='main',$design='sinorca2') {
-
- }
-
- // now we return the page
- return $file;
- echo $file;
- echo $file;
-}*/
-
-/**
- * Creates the links in the navibar
- * @param $urls string_array
- * @param $names string_array
- * @param $position int
- * @param $optional bool
- * @return html-link
- */
-function navi_links($url, $names, $position, $display=false) {
- if($display) {
- $dummy = new dummys;
- // Load a dummy-Link into the array
- for($i = 0; $i < sizeof($url); $i++) {
- $a[$i] = $dummy->link;
- }
- // Replace
- for($i = 0; $i < sizeof($url); $i++) {
- $a[$i] = str_replace("{url}", $url[$i], $a[$i]);
- $a[$i] = str_replace("{alt}", $alt[$i], $a[$i]);
- $a[$i] = str_replace("{name}", $name[$i], $a[$i]);
- if($i = ($position-1)) {
- $a[$i] = str_replace("{class}", $dummy->highlight, $a[$i]);
- } else {
- $a[$i] = str_replace("{class}", "", $a[$i]);
- }
- $a;
- }
- return array($a);
- }
-}
-
-
-/**
- * Thsi function generates the left navibar
- * @param $urls string_array
- * @param $names string_array
- * @param $actual_page int
- * @param $optional bool
- * @return html-link
- */
-function navi_left($urls, $names, $actual_page, $optional=false) {
-
-}
-?>
\ No newline at end of file
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/index.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -2,67 +2,10 @@
/**
- * Main page
- *
- * @version 33
+ * Dummy Page
* @author C167 <c1...@us...>
*/
-# include the standard pear-files
-//require_once "XML/Parser.php"; # The PEAR::XML_PARSER
-require_once "MDB2.php"; # The PEAR::MDB2
-require_once "HTTP/Session2.php"; # The session-manager
-
-require_once "inc/definitions.php";
-require_once "inc/functions.php"; // some functions
-require_once "inc/secure.php";
-require_once "class/template_manager.php"; // The template-system
-require_once "inc/config.php";
-require_once "inc/querys.php";
-
-// Connect to the database
-$dsn = array (
- 'phptype' => DB_TYPE,
- 'username' => DB_LOGIN,
- 'password' => DB_PASSWD,
- 'hostspec' => DB_HOST,
- 'database' => DB_DATABASE
-);
-
-$options = array (
- 'debug' => 2,
- 'result_buffering' => false,
- 'portability' => MDB2_PORTABILITY_ALL
-);
-
-$db = & MDB2 :: connect($dsn, $options);
-if (PEAR :: isError($db)) {
- $db->getMessage();
- die();
-}
-
-// Now we start the session and set some values
-//HTTP_Session2::setContainer('MDB', $session['container']['options']);
-HTTP_Session2::start();
-HTTP_Session2::setExpire($session['time']['expire']);
-HTTP_Session2::setIdle($session['time']['idle']);
-
-//$template = new Template_Manager();
-//if(HTTP_Session2::isNew()) {
-//$template->showLoginForm
-//}
-$_GET['page'] = "show_feeds";
-switch ($_GET['page']) {
- case "main" :
- include_once "page_main.php";
- break;
- case "show_feeds" :
- include_once "page_show_feeds.php";
- break;
- case "about" :
-
- break;
- default :
- include_once "page_main.php";
-}
+require_once "HTTP.php";
+HTTP :: redirect("./page_main.php");
?>
\ No newline at end of file
Copied: trunk/page_add_new_feed.php (from rev 64, trunk/add_new_feed.php)
===================================================================
--- trunk/page_add_new_feed.php (rev 0)
+++ trunk/page_add_new_feed.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -0,0 +1,240 @@
+<?php
+
+
+/**
+ * Created on 30.08.2006
+ *
+ * @version 1
+ * @since 56 - 17.11.2006
+ * @author c167 <c1...@us...>
+ * @package feed-collector
+ */
+
+require_once "inc/config.php";
+error_reporting(E_ALL);
+
+###############
+# DEFINITIONS #
+###############
+define('FC_PASS_OK', 0);
+define('FC_PASS_TOO_SHORT', 1);
+
+############
+# 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)) {
+ echo $db->getMessage();
+ echo "<br />";
+ echo $db->getDebugInfo();
+} else {
+}
+$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']);
+
+if (true === HTTP_Session :: isNew()) {
+ HTTP_Session :: set("logged_in", false);
+}
+
+################
+# FEED-Manager #
+################
+require_once "class/Feed_manager.php";
+$feed = new Feed_manager($db);
+
+##############
+# 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 #
+#####################
+$page = "add_new_feed";
+// get the design
+$design = file_get_contents("styles/default/page_add_new_feed.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
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $midHeader_title_right = sprintf(" <p>%s</p>", _("You are not logged in"));
+} else {
+ if (HTTP_Session :: get("username", false) == false) {
+ $username = $user->getUsername();
+ } else {
+ $username = HTTP_Session :: get("username");
+ }
+ $midHeader_title_right = sprintf(" <p>%s %s</p>", _("Hello"), $username);
+}
+$design = str_replace("<!-- midHeader title right -->", $midHeader_title_right, $design);
+
+// navigation
+require_once "inc/navigation.php";
+$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 = "";
+//print_r($_POST);
+if (!empty ($_POST['site_name']) and !empty ($_POST['site_url']) and !empty ($_POST['site_lang']) and !empty ($_POST['feed_name']) and !empty ($_POST['feed_url']) and !empty ($_POST['feed_type']) and !empty ($_POST['feed_db_name']) and !empty ($_POST['feed_lang']) and !empty ($_POST['is_active'])) {
+ echo 1;
+
+} else {
+ echo 2;
+ if (!empty ($_POST['site_name']) or !empty ($_POST['site_url']) or !empty ($_POST['site_lang']) or !empty ($_POST['feed_name']) or !empty ($_POST['feed_url']) or !empty ($_POST['feed_type']) or !empty ($_POST['feed_db_name']) or !empty ($_POST['feed_lang']) or !empty ($_POST['is_active'])) {
+ echo 3;
+ buildForm($main, _("Marked fields have to be filled!"));
+ } else {
+ echo 4;
+ buildForm($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 buildForm(& $form, $message = null) {
+ $form = sprintf(" <h1>%s</h1>\n <p>%s</p>\n", _("Add a feed"), _("<b>How do I do that?</b><br />\n The Scripts need some information about the site that creates the script (e.g. name and url) and about the feed (e.g. url, name, type)"));
+ if (!is_null($message)) {
+ $form .= sprintf(" <h2>%s</h2>\n", $message);
+ }
+ $form .= sprintf(" <div id=\"add_form\">\n" .
+ " <form action=\"%s\" method=\"post\" accept-charset=\"UTF-8\">\n" .
+ " <table summary=\"\">\n" .
+ " <tr>\n" .
+ " <th colspan=\"2\" id=\"formtitle\">%s</th>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\" >%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"site_name\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"site_url\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\">\n" .
+ " <select name=\"site_lang\">\n" .
+ " <option value=\"en_EN\">%s</option>\n" .
+ " <option value=\"de_DE\">%s</option>\n" .
+ " </select>\n" .
+ " </td>\n" .
+ " <tr>\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"site_img\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"feed_name\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr>\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"feed_description\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"feed_url\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\">\n" .
+ " <select name=\"feed_type\">\n" .
+ " <option value=\"atom10\">%s</option>\n" .
+ " <option value=\"rss20\">%s</option>\n" .
+ " <option value=\"rss10\">%s</option>\n" .
+ " <option value=\"rdf09\">%s</option>\n" .
+ " </select>\n" .
+ " </td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"feed_db_name\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr>\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\">\n" .
+ " <select name=\"feed_lang\">\n" .
+ " <option value=\"en_EN\">%s</option>\n" .
+ " <option value=\"de_DE\">%s</option>\n" .
+ " </select>\n" .
+ " </td>\n" .
+ " </tr>\n" .
+ " <tr>\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\"><input type=\"text\" name=\"feed_image\" size=\"30\" maxlength=\"255\" /></td>\n" .
+ " </tr>\n" .
+ " <tr class=\"required\">\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\">\n" .
+ " <select name=\"is_active\">\n" .
+ " <option value=\"1\">%s</option>\n" .
+ " <option value=\"0\">%s</option>\n" .
+ " </select>\n" .
+ " </td>\n" .
+ " </tr>\n" .
+ " <tr id=\"formButtons\">\n" .
+ " <td colspan=\"2\"><input type=\"submit\" value=\"%s\" name=\"submit\" /><input type=\"reset\" value=\"%s\" /></td>\n" .
+ " </tr>\n" .
+ " </table>\n" .
+ " </form>\n" .
+ " <p id=\"required\">%s</p>\n" .
+ " </div>\n", $_SERVER['PHP_SELF'], _("ADD IT!"), _("Site Name"), _("Site URL"), _("Site Language"), _("English"), _("German"), _("Site Image"), _("Feed Name"), _("Feed Description"), _("Feed URL"), _("Feed Type"), _("ATOM 1.0"), _("RSS 2.0"), _("RSS 1.0"), _("RDF 0.9"), _("Feed Database Name"), _("Feed Language"), _("English"), _("German"), _("Feed Image"), _("Active?"), _("Yes!"), _("No!"), _("Submit!"), _("Reset"), _("Marked fields are required"));
+}
+?>
\ No newline at end of file
Modified: trunk/page_add_tag.php
===================================================================
--- trunk/page_add_tag.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/page_add_tag.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -10,12 +10,8 @@
* @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);
-
+//error_reporting(E_ALL);
############
# DATABASE #
############
@@ -52,13 +48,16 @@
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);
-
}
+################
+# FEED-Manager #
+################
+require_once "class/Feed_manager.php";
+$feed = new Feed_manager($db);
+
##############
# HTTP-Class #
##############
@@ -77,13 +76,13 @@
$user = new User_manager($db);
if (false === HTTP_Session :: get("logged_in", false)) {
- HTTP :: redirect("./page_login.php");
+ //HTTP :: redirect("./page_login.php");
}
$main = "";
if (!$tag_manager->hasTags($_GET['feed'])) {
- $main .= sprintf("hi");
+ $main .= sprintf("");
// there are no tags yet, please add one...
} else {
$main .= sprintf(" <div id=\"tags\">\n" .
@@ -110,7 +109,7 @@
#####################
# BUILD THE CONTENT #
#####################
-
+$page = "add_tag";
// get the design
$design = file_get_contents("styles/default/page_add_tag.tpl", "r");
@@ -128,11 +127,20 @@
$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:"));
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $midHeader_title_right = sprintf(" <p>%s</p>", _("You are not logged in"));
+} else {
+ if(HTTP_Session :: get("username", false) == false) {
+ $username = $user->getUsername();
+ } else {
+ $username = HTTP_Session :: get("username");
+ }
+ $midHeader_title_right = sprintf(" <p>%s %s</p>", _("Hello"), $username);
+}
$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"));
+require_once "inc/navigation.php";
$design = str_replace("<!-- navigation -->", $navigation, $design);
// main
@@ -148,16 +156,18 @@
function displayAddForm() {
$form = sprintf(" <div id=\"addTags_form\">\n" .
" <form action=\"%s\" method=\"post\" accept-charset=\"UTF-8\">\n" .
- " <div id=\"formtitle\">%s</div>\n" .
- " <div class=\"left\">\n" .
- " <div class=\"formElem\">%s</div>\n" .
- " </div>\n" .
- " <div class=\"right\">\n" .
- " <div class=\"formField\" ><input type=\"text\" name=\"tag\" size=\"30\" maxlength=\"30\" /></div>\n" .
- " </div>\n" .
- " <div id=\"formButtons\">\n" .
- " <input type=\"submit\" value=\"%s\" name=\"submit\" />\n" .
- " </div>\n" .
+ " <table summary=\"\">\n" .
+ " <tr>\n" .
+ " <td colspan=2 id=\"formtitle\">%s</td>\n" .
+ " </tr>\n" .
+ " <tr>\n" .
+ " <td class=\"formElem\">%s</td>\n" .
+ " <td class=\"formField\" ><input type=\"text\" name=\"tag\" size=\"30\" maxlength=\"30\" /></td>\n" .
+ " </tr>\n" .
+ " <tr>\n" .
+ " <td colspan=2 id=\"formButtons\"><input type=\"submit\" value=\"%s\" name=\"submit\" /></td>\n" .
+ " </tr>\n" .
+ " </table>\n" .
" </form>\n" .
" </div>\n", $_SERVER['PHP_SELF'] . "?feed=" . $_GET['feed'], _("Add Tag"), _("tag name"), _("Submit!"));
return $form;
Modified: trunk/page_login.php
===================================================================
--- trunk/page_login.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/page_login.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -10,10 +10,7 @@
* @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);
###############
@@ -60,8 +57,6 @@
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);
@@ -77,6 +72,7 @@
################
require_once "class/User_manager.php";
$user = new User_manager($db);
+
if (false === HTTP_Session :: get("logged_in", false)) {
if (isset ($_POST['submit'])) {
if (empty ($_POST['username']) or empty ($_POST['passwd'])) {
@@ -111,12 +107,13 @@
}
} else {
- $main = displayLoginForm(0);
+ $main = displayLoginForm();
}
} else {
- HTTP :: redirect ("./page_main.php");
+ HTTP :: redirect("./page_main.php");
}
+$page = "login";
#####################
# BUILD THE CONTENT #
#####################
@@ -138,11 +135,20 @@
$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:"));
+if (false === HTTP_Session :: get("logged_in", false)) {
+ $midHeader_title_right = sprintf(" <p>%s</p>", _("You are not logged in"));
+} else {
+ if (HTTP_Session :: get("username", false) == false) {
+ $username = $user->getUsername();
+ } else {
+ $username = HTTP_Session :: get("username");
+ }
+ $midHeader_title_right = sprintf(" <p>%s %s</p>", _("Hello"), $username);
+}
$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"));
+require_once "inc/navigation.php";
$design = str_replace("<!-- navigation -->", $navigation, $design);
// main
@@ -155,22 +161,29 @@
echo $design;
-function displayLoginForm($error) {
- switch ($error) {
- 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"));
- break;
- case LOGIN_INACTIVE :
- $id_username = "error";
- $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;
- 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."));
+function displayLoginForm($error = null) {
+ if (!is_null($error)) {
+ switch ($error) {
+ 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"));
+ break;
+ case LOGIN_INACTIVE :
+ $id_username = "error";
+ $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;
+ 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."));
+ }
+ } 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."));
+
}
$form = sprintf(" <div id=\"registration_form\">\n" .
" <form action=\"%s\" method=\"post\" accept-charset=\"UTF-8\">\n" .
Modified: trunk/page_main.php
===================================================================
--- trunk/page_main.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/page_main.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -10,9 +10,7 @@
* @package feed-collector
*/
-require_once "inc/functions.php";
require_once "inc/config.php";
-require_once "inc/definitions.php";
error_reporting(E_ALL);
############
# DATABASE #
@@ -123,17 +121,7 @@
$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" .
-" <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"));
-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_personal.php\">%s</a> |\n <a href=\"./page_logout.php?returnto=page_main.php\">%s</a>", _("Personal Page"), _("LogOut"));
-}
+require_once "inc/navigation.php";
$design = str_replace("<!-- navigation -->", $navigation, $design);
# Main copy
Modified: trunk/page_personal.php
===================================================================
--- trunk/page_personal.php 2007-01-05 00:35:47 UTC (rev 93)
+++ trunk/page_personal.php 2007-01-05 19:00:42 UTC (rev 94)
@@ -10,21 +10,18 @@
* @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
+ 'phptype' => $db['type'],
+ 'username' => $db['user'],
+ 'password' => $db['passwd'],
+ 'hostspec' => $db['host'],
+ 'database' => $db['database']
);
$options = array (
'debug' => 2,
@@ -74,7 +71,7 @@
require_once "class/User_manager.php";
$user = new User_manager($db);
-$page = "main";
+$page = "personal";
//
// Now we're going to replace the placeholders in the template with the important content
//
@@ -93,34 +90,24 @@
$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! }"));
+$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
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=\"passwd\" value=\"%s\" /><br />\n" .
- " <input type=\"hidden\" name=\"cameFrom\" value=\"%s\" />" .
- " </form>\n" .
- " </div>", _("Login:"), _("Submit!"), _("Username"), _("Password"), basename($_SERVER['PHP_SELF']));
+ $midHeader_title_right = sprintf(" <p>%s</p>", _("You are not logged in"));
} else {
- $midHeader_title_right = sprintf(" <span>%s %s</span><br />\n" .
- " <p id=\"userinfo\">%s %s</p>", _("Hello"), $user->getUsername(), _("Your last login was at"), date("H:m:i", HTTP_Session :: get("lastLogin")));
+ if(HTTP_Session :: get("username", false) == false) {
+ $username = $user->getUsername();
+ } else {
+ $username = HTTP_Session :: get("username");
+ }
+ $midHeader_title_right = sprintf(" <p>%s %s</p>", _("Hello"), $username);
}
$design = str_replace("<!-- midHeader title right -->", $midHeader_title_right, $design);
// navigation
-$navigation = sprintf(" <a href=\"./page_main.php\">%s</a> |\n" .
- " <a href=\"./page_show_all_feeds.php\">%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 Feeds"), _("Feeds by TAG"), _("Add a Feed"), _("Show TAGs"));
-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_personal.php\" class=\"highlight\">%s</a> |\n <a href=\"./page_logout.php?returnto=page_main.php\">%s</a>", _("Personal Page"), _("LogOut"));
-}
+require_once "inc/navigation.php";
$design = str_replace("<!-- navigation -->", $navigation, $design);
/*
@@ -164,20 +151,6 @@
//}
$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\"><st...
[truncated message content] |