[Feed-collector-svn] SF.net SVN: feed-collector: [124] trunk
Status: Beta
Brought to you by:
c167
|
From: <C1...@us...> - 2007-06-06 09:27:41
|
Revision: 124
http://feed-collector.svn.sourceforge.net/feed-collector/?rev=124&view=rev
Author: C167
Date: 2007-06-06 02:27:22 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Login works, simple change in html_header: now the page-style changes automaticaly
Modified Paths:
--------------
trunk/inc/smarty.php
trunk/page_login.php
trunk/styles/default/html_header.tpl
trunk/styles/default/page_login.tpl
Modified: trunk/inc/smarty.php
===================================================================
--- trunk/inc/smarty.php 2007-06-05 18:05:20 UTC (rev 123)
+++ trunk/inc/smarty.php 2007-06-06 09:27:22 UTC (rev 124)
@@ -15,3 +15,6 @@
$smarty->compile_dir = $sm['compile_dir'];
$smarty->config_dir = $sm['config_dir'];
$smarty->cache_dir = $sm['cache_dir'];
+
+$smarty->assign('page', $page);
+?>
Modified: trunk/page_login.php
===================================================================
--- trunk/page_login.php 2007-06-05 18:05:20 UTC (rev 123)
+++ trunk/page_login.php 2007-06-06 09:27:22 UTC (rev 124)
@@ -12,44 +12,40 @@
require_once "inc/config.php";
error_reporting(E_ALL);
-###############
-# DEFINITIONS #
-###############
+/* DEFINITIONS */
define('FC_PASS_OK', 0);
define('FC_PASS_TOO_SHORT', 1);
-############
-# DATABASE #
-############
+/* DATABASE */
require_once "./inc/database.php";
-###########
-# SESSION #
-###########
+/* SESSION */
require_once "./inc/session.php";
-##############
-# HTTP-Class #
-##############
+/* HTTP-Class */
require_once "HTTP.php";
+/* STYLE */
+require_once "inc/styles.php";
+
$page = "login";
-############
-# LANGUAGE #
-############
+/* LANGUAGE */
require_once "./inc/language.php";
-################
-# User-Manager #
-################
+/* SMARTY */
+require_once "inc/smarty.php";
+
+/* User-Manager */
require_once "class/User_manager.php";
$user = new User_manager($db);
+$error = LOGIN_SUCCESSFULL;
+
if (false === HTTP_Session :: get("logged_in", false)) {
if (isset ($_POST['submit'])) {
if (empty ($_POST['username']) or empty ($_POST['passwd'])) {
- $main = displayLoginForm(LOGIN_WRONG_VALUES);
+ $error = LOGIN_WRONG_VALUES;
} else {
$login = $user->loginUser($_POST['username'], md5($_POST['passwd']));
switch ($login['state']) {
@@ -68,115 +64,61 @@
}
break;
case LOGIN_WRONG_VALUES :
- $main = displayLoginForm(LOGIN_WRONG_VALUES);
+ $error = LOGIN_WRONG_VALUES;
HTTP_Session :: set("logged_in", false);
break;
case LOGIN_INACTIVE :
- $main = displayLoginForm(LOGIN_INACTIVE);
+ $error = LOGIN_INACTIVE;
HTTP_Session :: set("logged_in", false);
break;
default :
- $main = displayLoginForm(LOGIN_WRONG_VALUES);
+ $error = LOGIN_WRONG_VALUES;
}
}
- } else {
- $main = displayLoginForm();
}
} else {
HTTP :: redirect("./page_main.php");
}
-#####################
-# BUILD THE CONTENT #
-#####################
-// get the design
-$design = file_get_contents("styles/default/page_login.tpl", "r");
-
# Header
// title
-$title = "Feed-Collector";
-$design = str_replace("<!-- title -->", $title, $design);
+$smarty->assign('title', "Feed-Collector");
// related sites
require_once "./inc/upperBar.php";
-$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);
+$smarty->assign('page_title', _("Feed-Collector"));
+$smarty->assign('sub_title', _("{ stay up to date with all your news feeds! }"));
// midHeader title right
require_once "./inc/userstatus_display.php";
-$design = str_replace("<!-- midHeader title right -->", $midHeader_title_right, $design);
// navigation
require_once "inc/navigation.php";
-$design = str_replace("<!-- navigation -->", $navigation, $design);
// main
-$design = str_replace("<!-- main -->", $main, $design);
+switch ($error) {
+ case LOGIN_WRONG_VALUES :
+ $smarty->assign('message', _("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 :
+ $smarty->assign('message', _("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 :
+ $smarty->assign('message', _("Please enter your username and your password to login. Cookies have to be enabled from this point."));
+}
+$smarty->assign('login', _("Login"));
+$smarty->assign('username', _("Username"));
+$smarty->assign('password', _("Password"));
+$smarty->assign('submit', _("Submit!"));
+$smarty->assign('reset', _("Reset!"));
# footer
-require_once "./inc/footer.php";
-$design = str_replace("<!-- footer -->", $footer, $design);
+$smarty->assign('admin_email', $admin['email']);
+$smarty->assign('updated', _("Updated"));
-echo $design;
-
-function displayLoginForm($error = null) {
- if (!is_null($error)) {
- switch ($error) {
- case LOGIN_WRONG_VALUES :
- $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 :
- $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 :
- $message = sprintf(" <p>%s</p>\n", _("Please enter your username and your password to login. Cookies have to be enabled from this point."));
- }
- } else {
- $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" .
- " <form action=\"%s\" method=\"post\" accept-charset=\"UTF-8\">\n" .
- "$message" .
- " <table summary=\"\">\n" .
- " <tr id=\"formtitle\">\n" .
- " <th colspan=\"2\">%s</th>\n" .
- " </tr>\n" .
- " <tr>\n" .
- " <td class=\"formElem\">%s</td>\n" .
- " <td class=\"formField\"><input type=\"text\" name=\"username\" size=\"30\" maxlength=\"30\" onfocus=\"if (this.value=='Login') this.value=''\" /></td>\n" .
- " </tr>\n" .
- " <tr>\n" .
- " <td class=\"formElem\">%s</td>\n" .
- " <td class=\"formField\"><input type=\"password\" name=\"passwd\" size=\"30\" maxlength=\"30\" onfocus=\"if (this.value=='Passwordezz') this.value=''\" /></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" .
- " <input type=\"hidden\" name=\"cameFrom\" value=\"%s\" />\n" .
- " </form>\n" .
- " </div>\n", $_SERVER['PHP_SELF'], _("Login"), _("Username"), _("Password"), _("Submit!"), _("Reset!"), !empty ($_GET['cameFrom']) ? $_GET['cameFrom'] : "");
- return $form;
-}
-
-function filterInput($input, $type) {
- $inhalt = trim($inhalt);
- $inhalt = htmlspecialchars($inhalt);
- switch ($type) {
- case "username" :
-
- break;
- case "mail" :
-
- break;
- }
-
- return $inhalt;
-}
+$smarty->display('page_login.tpl');
?>
Modified: trunk/styles/default/html_header.tpl
===================================================================
--- trunk/styles/default/html_header.tpl 2007-06-05 18:05:20 UTC (rev 123)
+++ trunk/styles/default/html_header.tpl 2007-06-06 09:27:22 UTC (rev 124)
@@ -7,7 +7,7 @@
<meta name="author" content="haran" />
<meta name="generator" content="haran" />
- <link rel="stylesheet" type="text/css" href="./styles/default/css/page_main-screen.css" media="screen, tv, projection" title="Default" />
+ <link rel="stylesheet" type="text/css" href="./styles/default/css/page_{$page}-screen.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="./styles/default/css/common-screen.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="./styles/default/css/header-screen.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="./styles/default/css/main_copy-screen.css" media="screen, tv, projection" title="Default" />
Modified: trunk/styles/default/page_login.tpl
===================================================================
--- trunk/styles/default/page_login.tpl 2007-06-05 18:05:20 UTC (rev 123)
+++ trunk/styles/default/page_login.tpl 2007-06-06 09:27:22 UTC (rev 124)
@@ -1,31 +1,31 @@
- <body>
- <!-- For non-visual user agents: -->
- <div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
+{include file="html_header.tpl"}
+{include file="page_header.tpl"}
- <!-- ##### Header ##### -->
+ <!-- ##### Main Copy ##### -->
- <div id="header">
- <div class="superHeader">
-<!-- related sites -->
+ <div id="main-copy">
+ <div id="registration_form">
+ <form action="{$smarty.server.PHP_SELF}" method="post" accept-charset="UTF-8">
+ <p>{$message}</p>
+ <table summary="{$table_summary|default:""}">
+ <tr id="formtitle">
+ <th colspan="2">{$login}</th>
+ </tr>
+ <tr>
+ <td class="formElem">{$username}</td>
+ <td class="formField"><input type="text" name="username" size="30" maxlength="30" onfocus="if (this.value=='Login') this.value=''" /></td>
+ </tr>
+ <tr>
+ <td class="formElem">{$password}</td>
+ <td class="formField"><input type="password" name="passwd" size="30" maxlength="30" onfocus="if (this.value=='Passwordezz') this.value=''" /></td>
+ </tr>
+ <tr id="formButtons">
+ <td colspan="2"><input type="submit" value="{$submit}" name="submit" /><input type="reset" value="{$reset}" /></td>
+ </tr>
+ </table>
+ <input type="hidden" name="cameFrom" value="{$smarty.get.cameFrom|default:""}" />
+ </form>
</div>
-
- <div class="midHeader">
-<!-- midHeader title left -->
-
- <br class="doNotDisplay doNotPrint" />
-
- <div class="headerLogin">
-<!-- midHeader title right -->
- </div>
- </div>
-
- <div class="subHeader">
-<!-- navigation -->
- </div>
</div>
- <!-- ##### Main Copy ##### -->
-
- <div id="main-copy">
-<!-- main -->
- </div>
+{include file="page_footer.tpl}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|