Author: rhari
Date: Mon Apr 30 14:53:17 2007
New Revision: 392
URL: http://svn.gna.org/viewcvs/phplinker?rev=392&view=rev
Log:
#197 Déplacement de login, logout, passwd et code dans admin/
Added:
trunk/smarty/default/templates/admin/login.tpl
trunk/smarty/default/templates/admin/passwd.tpl
trunk/www/admin/code.php
trunk/www/admin/login.php
trunk/www/admin/logout.php
trunk/www/admin/passwd.php
Modified:
trunk/smarty/default/templates/admin/category.tpl
trunk/www/admin/includes/auth.php
trunk/www/admin/includes/header.php
Modified: trunk/smarty/default/templates/admin/category.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/category.tpl?rev=392&r1=391&r2=392&view=diff
==============================================================================
--- trunk/smarty/default/templates/admin/category.tpl (original)
+++ trunk/smarty/default/templates/admin/category.tpl Mon Apr 30 14:53:17 2007
@@ -238,8 +238,8 @@
function addTag (tagname){
if (tagname == '')return;
-// xajax_linker_add_tag(tagname);
- addTag_step2('7', tagname);
+ xajax_linker_add_tag(tagname);
+// addTag_step2('7', tagname);
}
//****************************************************************************************
Added: trunk/smarty/default/templates/admin/login.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/login.tpl?rev=392&view=auto
==============================================================================
--- trunk/smarty/default/templates/admin/login.tpl (added)
+++ trunk/smarty/default/templates/admin/login.tpl Mon Apr 30 14:53:17 2007
@@ -1,0 +1,14 @@
+{* Smarty *} {* -*- mode: html -*- *}{* $Id: login.tpl 199 2007-03-22
14:43:26Z gassla $ *}
+<div style="margin-top: 10%; width: 100%; text-align: center;">
+<form action="login" method="post">
+{$err}
+ <input type="hidden" name="came_from" value="{$came_from}" />
+ <table border="0" cellspacing="0" cellpadding="10" style="border: solid
1px black; margin: auto auto auto auto;">
+ <tr><td>Utilisateur</td><td><input type="text" size="30" class="person"
name="login_login" id="login" value="" /></td></tr>
+ <tr><td>Mot de passe</td><td><input type="password" class="keyring"
size="30" name="login_password" /></td></tr>
+ <tr><td colspan="2" style="text-align:center"><input
+ value="Login" type="submit" /></td></tr>
+ </table>
+</form>
+<a href="passwd">Forgot password</a>
+</div>
Added: trunk/smarty/default/templates/admin/passwd.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/passwd.tpl?rev=392&view=auto
==============================================================================
--- trunk/smarty/default/templates/admin/passwd.tpl (added)
+++ trunk/smarty/default/templates/admin/passwd.tpl Mon Apr 30 14:53:17 2007
@@ -1,0 +1,27 @@
+{* Smarty *}
+
+
+
+<div style="margin-top: 10%; width: 100%; text-align: center;">
+ {$msg}
+ <form action="passwd" method="post">
+ <table border="0" cellspacing="0" cellpadding="10" style="border: solid
1px black; margin: auto auto auto auto;">
+ <tr>
+ <td>Login</td>
+ <td><input type="text" size="22" style="border: solid 1px #777;"
name="login" id="login" value="" /></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td><img src="/admin/code.php"> <a href="passwd"><img
src="/imgs/icons/reload.png" alt="The image is unreadable" title="The image is
unreadable" /></a></td>
+ </tr>
+ <tr>
+ <td>Code</td>
+ <td><input type="text" size="22" style="border: solid 1px #777;"
name="code" id="login" value="" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" style="text-align:center"><input value="Envoyer"
type="submit" /></td>
+ </tr>
+ </table>
+ </form>
+<a href="login">Login</a></center>
+</div>
Added: trunk/www/admin/code.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/code.php?rev=392&view=auto
==============================================================================
--- trunk/www/admin/code.php (added)
+++ trunk/www/admin/code.php Mon Apr 30 14:53:17 2007
@@ -1,0 +1,53 @@
+<?php
+/*
+ This file is part of PHPLinker.
+
+ PHPLinker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ PHPLinker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PHPLinker; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+?>
+<?php
+require("../includes/start.php");
+
+if(isset($_SESSION['code']))
+ $text = $_SESSION['code']; //on récupére le code à générer
+else {
+ header("Location: /admin/passwd");
+ exit;
+}
+
+$im = imagecreatefromjpeg("../imgs/secret.jpg");
+$id = imagecreatefromjpeg("../imgs/secret.jpg");
+$grey = imagecolorallocate($im, 128, 128, 128);
+$black = imagecolorallocate($im, 0, 0, 0);
+$font = "/admin/css/themes/main/buttonfont.ttf";
+for($i=0;$i<5;$i++) {
+ $angle=mt_rand(10,15);
+
+ if(mt_rand(0,1)==1)
+ $angle=-$angle;
+
+ imagettftext($im, 14, $angle, 11+(20*$i), 21, $grey, $font,
substr($text,$i,1));
+ imagettftext($im, 14, $angle, 10+(20*$i), 20, $black, $font,
substr($text,$i,1));
+ }
+
+imagecopymerge ( $im, $id, 0, 0, 0, 0, 120, 30, 50 );
+
+header("Content-type: image/png");
+
+imagepng($im);
+imagedestroy($im);
+imagedestroy($id);
+
+?>
Modified: trunk/www/admin/includes/auth.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/includes/auth.php?rev=392&r1=391&r2=392&view=diff
==============================================================================
--- trunk/www/admin/includes/auth.php (original)
+++ trunk/www/admin/includes/auth.php Mon Apr 30 14:53:17 2007
@@ -28,7 +28,7 @@
linker_tpl("level",$CurrentUser->group);
}else{
- header("Location: /login?came_from=".$_SERVER['REQUEST_URI']);
+ header("Location: /admin/login?came_from=".$_SERVER['REQUEST_URI']);
exit;
}
?>
Modified: trunk/www/admin/includes/header.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/includes/header.php?rev=392&r1=391&r2=392&view=diff
==============================================================================
--- trunk/www/admin/includes/header.php (original)
+++ trunk/www/admin/includes/header.php Mon Apr 30 14:53:17 2007
@@ -53,7 +53,7 @@
//debut1
$elements = array(
'Accueil' => array( 'url' => '/admin/', 'roles' => 'any' ),
- 'Sortie' => array( 'url' => '/logout', 'roles' => 'any' ),
+ 'Sortie' => array( 'url' => '/admin/logout', 'roles' => 'any'
),
);
$buttons="";
Added: trunk/www/admin/login.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/login.php?rev=392&view=auto
==============================================================================
--- trunk/www/admin/login.php (added)
+++ trunk/www/admin/login.php Mon Apr 30 14:53:17 2007
@@ -1,0 +1,66 @@
+<?php
+/*
+ This file is part of PHPLinker.
+
+ PHPLinker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ PHPLinker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PHPLinker; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+// $Id: login.php 380 2007-04-27 11:52:52Z cyb $
+?>
+<?php
+
+require("../includes/start.php");
+$css_theme = "/admin/css/themes/main/main.css";
+$title="Login";
+$headers[]="<link rel='stylesheet' type='text/css' href=".$css_theme." />";
+
+if(isset($_POST['login_login'],$_POST['login_password'])){
+ $data['login']=$_POST['login_login'];
+ $data['password']=$_POST['login_password'];
+ $User = new User();
+ $test = $User->login($data);
+ if($test>0) {
+ if ( isset($_POST['came_from']) ) {
+ header("Location: ".$_POST['came_from']);
+ exit;
+ } else {
+ header("Location: /admin/");
+ exit;
+ }
+ }else{
+ header("Location: /admin/login?err=1");
+ exit;
+ }
+ }
+?>
+<?php
+$came_from="/admin/";
+
+if(isset($_GET['came_from']))
+ $came_from=$_GET['came_from'];
+
+$err_msg="";
+if(isset($_GET['err'])){
+ switch ($_GET['err']){
+ case 1:
+ $err_msg="<center><span style='color: rgb(255, 0, 0);'>"._('Invalid
Login or password!') . "</span>";
+ break;
+ }
+ }
+
+ require("../includes/header.php");
+ linker_tpl("err",$err_msg);
+ linker_tpl("came_from",$came_from);
+ require("../includes/footer.php");
+?>
Added: trunk/www/admin/logout.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/logout.php?rev=392&view=auto
==============================================================================
--- trunk/www/admin/logout.php (added)
+++ trunk/www/admin/logout.php Mon Apr 30 14:53:17 2007
@@ -1,0 +1,26 @@
+<?php
+/*
+ This file is part of PHPLinker.
+
+ PHPLinker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ PHPLinker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PHPLinker; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+?>
+<?php
+require("../includes/start.php");
+
+$User = new User();
+$User->logout("/");
+
+?>
Added: trunk/www/admin/passwd.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/passwd.php?rev=392&view=auto
==============================================================================
--- trunk/www/admin/passwd.php (added)
+++ trunk/www/admin/passwd.php Mon Apr 30 14:53:17 2007
@@ -1,0 +1,82 @@
+<?php
+/*
+ This file is part of PHPLinker.
+
+ PHPLinker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ PHPLinker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PHPLinker; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+?>
+<?php
+require("../includes/start.php");
+$css_theme = "/admin/css/themes/main/main.css";
+$title="Forgot password";
+$headers[]="<link rel='stylesheet' type='text/css' href=".$css_theme." />";
+
+$User = new User();
+$msg="";
+
+$icon_warning="<img src='/imgs/icons/warning' />";
+$icon_ok="";
+
+if( isset($_POST['login']) ){
+
+ if($_POST['code']==$_SESSION['code']){
+
+ $q = sql_query('die',__FILE__,__LINE__,__FUNCTION__ ,
+ "SELECT id , email FROM user WHERE
login='".$_POST['login']."' LIMIT 1");
+
+ if( mysql_num_rows($q)==1 ){
+
+ list($id_user,$email)=mysql_fetch_array($q);
+
+ $pass = $User->randomPass();
+
+ if($User->setPass($id_user,$pass)){
+ $_SESSION['id_user'] = $id_user;
+ if(!$User->sendInfo($id_user,$pass)){
+ $msg= $icon_warning. "<font color='red'>".$_SESSION['error'] .
"</font>";
+ unset($_SESSION['error']);
+
+ }else{
+ $msg=$icon_ok." <font color='green'>User information sent to
$email</font>";
+ }
+ $_SESSION['id_user'] = -1;
+ unset($_SESSION['id_user']);
+
+ }else{
+ $msg=$icon_warning." <font color='red'>Set new password: fails</font>";
+ }
+
+ }else{
+ $msg= $icon_warning." <font color='red'>This login doesn't
exist!</font>";
+ }
+
+ }else{
+ $msg=$icon_warning." <font color='red'>Invalid code</font>";
+ }
+}
+linker_tpl("msg",$msg);
+
+$chars = "abBCDEFcdefghijkLmnPQRSTUVWXYpqrstxyz123456789";
+$code="";
+srand((double)microtime()*1000000); // Génération aléatoire du code
+for($i=0; $i<5;$i++){
+ $code.= $chars[rand()%strlen($chars)];
+ }
+$_SESSION['code'] = $code;
+
+require("../includes/header.php");
+require("../includes/footer.php");
+
+?>
_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits