Fix: the core system used php templates by default

This commit is contained in:
Regis Houssin 2010-04-12 18:56:53 +00:00
parent 0e7cfd1ea3
commit 79d7be01d1
10 changed files with 522 additions and 730 deletions

View File

@ -1,190 +0,0 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
{php}
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
{/php}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- BEGIN SMARTY TEMPLATE -->
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<title>{$langs->trans('Login')}</title>
<link rel="stylesheet" type="text/css" href="{$conf_css}">
<style type="text/css">
<!--
#login {ldelim}
margin-top: 70px;
margin-bottom: 30px;
text-align: center;
font: 12px arial,helvetica;
{rdelim}
#login table {ldelim}
width: 498px;
border: 1px solid #C0C0C0;
background: #F0F0F0 url({$login_background}) repeat-x;
font-size: 12px;
{rdelim}
-->
</style>
<script type="text/javascript">
function donnefocus() {ldelim}
document.getElementById('{$focus_element}').focus();
{rdelim}
</script>
{if $main_html_header}
{$main_html_header}
{/if}
<!-- HTTP_USER_AGENT = {$smarty.server.HTTP_USER_AGENT} -->
</head>
<body class="body" onload="donnefocus();">
<form id="login" name="login" method="post" action="{$php_self}">
<input type="hidden" name="token" value="{$smarty.session.newtoken}">
<input type="hidden" name="loginfunction" value="loginfunction" />
<table class="login" summary="{$title}" cellpadding="0" cellspacing="0" border="0" align="center">
<tr class="vmenu"><td align="center">{$title}</td></tr>
</table>
<br>
<table class="login" summary="Login area" cellpadding="2" align="center">
<tr><td colspan="3">&nbsp;</td></tr>
<tr>
<td valign="bottom"> &nbsp; <b>{$langs->trans('Login')}</b> &nbsp; </td>
<td valign="bottom" nowrap="nowrap">
<input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="{$login}" tabindex="1" /></td>
<td rowspan="{$logo_rowspan}" align="center" valign="top">
<img alt="Logo" title="" src="{$logo}" />
</td>
</tr>
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b>{$langs->trans('Password')}</b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="{$password}" tabindex="2">
</td></tr>
{if $select_entity}
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b>{$langs->trans('Entity')}</b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
{$select_entity}
</td></tr>
{/if}
{if $captcha}
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b>{$langs->trans('SecurityCode')}</b></td>
<td valign="top" nowrap="nowrap" align="left" class="none">
<table style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="4"></td>
<td><img src="{$dol_url_root}/lib/antispamimage.php" border="0" width="128" height="36"></td>
<td><a href="{$php_self}">{$captcha_refresh}</a></td>
</tr></table>
</td></tr>
{/if}
<tr><td colspan="3">&nbsp;</td></tr>
<tr><td colspan="3" style="text-align:center;"><br>
<input type="submit" class="button" value="&nbsp; {$langs->trans('Connection')} &nbsp;" tabindex="5" />
</td></tr>
{if $forgetpasslink || $helpcenterlink}
<tr><td colspan="3" align="center">
{strip}
{if $forgetpasslink}
<a style="color: #888888; font-size: 10px" href="{$dol_url_root}/user/passwordforgotten.php">(
{$langs->trans('PasswordForgotten')}
{if ! $helpcenterlink}
)
{/if}
</a>
{/if}
{if $helpcenterlink}
<a style="color: #888888; font-size: 10px" href="{$dol_url_root}/support/index.php" target="_blank">
{if $forgetpasslink}
&nbsp;-&nbsp;
{else}
(
{/if}
{$langs->trans('NeedHelpCenter')})</a>
{/if}
{/strip}
</td></tr>
{/if}
</table>
</form>
{if $smarty.session.dol_loginmesg}
<center><table width="60%"><tr><td align="center"><div class="error">
{$smarty.session.dol_loginmesg}
</div></td></tr></table></center>
{/if}
{if $main_home}
<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
<tr><td align="center">
{$main_home}
</td></tr></table></center><br>
{/if}
{if $main_google_ad_client}
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "{$main_google_ad_client}";
/* {$main_google_ad_width}x{$main_google_ad_height}, {$main_google_ad_name} */
google_ad_slot = "{$main_google_ad_slot}";
google_ad_width = {$main_google_ad_width};
google_ad_height = {$main_google_ad_height};
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
{/if}
<!-- authentication mode = {$main_authentication} -->
<!-- cookie name used for this session = {$session_name} -->
<!-- urlfrom in this session = {$smarty.session.urlfrom} -->
{if $main_html_footer}
{$main_html_footer}
{/if}
</body>
</html>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,151 +0,0 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
{php}
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
{/php}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- BEGIN SMARTY TEMPLATE -->
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<title>Dolibarr Authentification</title>
<link rel="stylesheet" type="text/css" href="{$conf_css}">
<style type="text/css">
<!--
#login {ldelim}
margin-top: 70px;
margin-bottom: 30px;
text-align: center;
font: 12px arial,helvetica;
{rdelim}
#login table {ldelim}
width: 498px;
border: 1px solid #C0C0C0;
background: #F0F0F0 url({$login_background}) repeat-x;
font-size: 12px;
{rdelim}
-->
</style>
<script type="text/javascript">
function donnefocus() {ldelim}
document.getElementById('{$focus_element}').focus();
{rdelim}
</script>
</head>
<body class="body" onload="donnefocus();">
<form id="login" name="login" method="post" action="{$php_self}">
<input type="hidden" name="token" value="{$smarty.session.newtoken}">
<input type="hidden" name="action" value="buildnewpassword">
<table class="login" summary="{$title}" cellpadding="0" cellspacing="0" border="0" align="center">
<tr class="vmenu"><td align="center">{$title}</td></tr>
</table>
<br>
<table class="login" summary="Login area" cellpadding="2" align="center">
<tr><td colspan="3">&nbsp;</td></tr>
<tr>
<td valign="bottom"> &nbsp; <b>{$langs->trans('Login')}</b> &nbsp; </td>
<td valign="bottom" nowrap="nowrap">
<input type="text" {$disabled} id="username" name="username" class="flat" size="15" maxlength="25" value="{$login}" tabindex="1" /></td>
<td rowspan="{$logo_rowspan}" align="center" valign="top">
<img alt="Logo" title="" src="{$logo}" />
</td>
</tr>
{if $select_entity}
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b>{$langs->trans('Entity')}</b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
{$select_entity}
</td></tr>
{/if}
{if $captcha}
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b>{$langs->trans('SecurityCode')}</b></td>
<td valign="top" nowrap="nowrap" align="left" class="none">
<table style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="3"></td>
<td><img src="{$dol_url_root}/lib/antispamimage.php" border="0" width="128" height="36"></td>
<td><a href="{$php_self}">{$captcha_refresh}</a></td>
</tr></table>
</td></tr>
{/if}
<tr><td colspan="3">&nbsp;</td></tr>
<tr><td colspan="3" style="text-align:center;"><br>
<input id="password" type="submit" {$disabled} class="button" name="password" value="{$langs->trans('SendNewPassword')}" tabindex="4" />
</td></tr>
</table>
</form>
<center>
<table width="90%"><tr><td align="center">
{if ($mode == 'dolibarr') || (! $disabled)}
<font style="font-size: 12px;">
{$langs->trans('SendNewPasswordDesc')}
</font>
{else}
<div class="warning" align="center">
{$langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode)}
</div>
{/if}
</td></tr>
</table>
<br>
{if $error_message}
<table width="90%"><tr><td align="center" style="font-size: 12px;>
{$error_message}
</td></tr></table><br>
{/if}
<br>
<a href="{$dol_url_root}/">
{$langs->trans('BackToLoginPage')}
</a>
</center>
<br>
<br>
</body>
</html>
<!-- END SMARTY TEMPLATE -->

View File

@ -0,0 +1,152 @@
<?php
/* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- BEGIN PHP TEMPLATE -->
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<title>Dolibarr Authentification</title>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
<style type="text/css">
<!--
#login {
margin-top: 70px;
margin-bottom: 30px;
text-align: center;
font: 12px arial,helvetica;
}
#login table {
width: 498px;
border: 1px solid #C0C0C0;
background: #F0F0F0 url('<?php echo $login_background; ?>') repeat-x;
font-size: 12px;
}
-->
</style>
<script type="text/javascript">
function donnefocus() {
document.getElementById('<?php echo $focus_element; ?>').focus();
}
</script>
</head>
<body class="body" onload="donnefocus();">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="buildnewpassword">
<table class="login" summary="<?php echo $title; ?>" cellpadding="0" cellspacing="0" border="0" align="center">
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
</table>
<br>
<table class="login" summary="Login area" cellpadding="2" align="center">
<tr><td colspan="3">&nbsp;</td></tr>
<tr>
<td valign="bottom"> &nbsp; <b><?php echo $langs->trans('Login'); ?></b> &nbsp; </td>
<td valign="bottom" nowrap="nowrap">
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
<td rowspan="<?php echo $rowspan; ?>" align="center" valign="top">
<img alt="Logo" title="" src="<?php echo $urllogo; ?>" />
</td>
</tr>
<?php if ($select_entity) { ?>
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('Entity'); ?></b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
<?php echo $select_entity; ?>
</td></tr>
<?php } ?>
<?php if ($captcha) { ?>
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('SecurityCode'); ?></b></td>
<td valign="top" nowrap="nowrap" align="left" class="none">
<table style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="3"></td>
<td><img src="<?php echo $dol_url_root.'/lib/antispamimage.php'; ?>" border="0" width="128" height="36"></td>
<td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td>
</tr></table>
</td></tr>
<?php } ?>
<tr><td colspan="3">&nbsp;</td></tr>
<tr><td colspan="3" style="text-align:center;"><br>
<input id="password" type="submit" <?php echo $disabled; ?> class="button" name="password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
</td></tr>
</table>
</form>
<center>
<table width="90%"><tr><td align="center">
<?php if ($mode == 'dolibarr' || ! $disabled) { ?>
<font style="font-size: 12px;">
<?php echo $langs->trans('SendNewPasswordDesc'); ?>
</font>
<?php }else{ ?>
<div class="warning" align="center">
<?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
</div>
<?php } ?>
</td></tr>
</table>
<br>
<?php if ($message) { ?>
<table width="90%"><tr><td align="center" style="font-size: 12px;>
<?php echo $message; ?>
</td></tr></table><br>
<?php } ?>
<br>
<a href="<?php echo $dol_url_root; ?>/">
<?php echo $langs->trans('BackToLoginPage'); ?>
</a>
</center>
<br>
<br>
</body>
</html>
<!-- END PHP TEMPLATE -->

View File

@ -25,10 +25,11 @@
define('NOLOGIN',1);
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB',1);
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN',1);
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
require_once("../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';

View File

@ -51,7 +51,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
// Select templates
$template_dir=DOL_DOCUMENT_ROOT.'/core/tpl/'; // Common case
if ($conf->browser->phone)
{
// Special cases
@ -65,8 +64,21 @@ function dol_loginfunction($langs,$conf,$mysoc)
$template_dir=DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/";
}
}
else
{
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/login.tpl"))
{
$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
}
else
{
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
}
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang;
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang;
$conf_css = DOL_URL_ROOT.$conf->css;
}
// Set cookie for timeout management
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
@ -192,8 +204,8 @@ function dol_loginfunction($langs,$conf,$mysoc)
}
}
$main_home=nl2br($conf->global->MAIN_HOME);
$conf_css=DOL_URL_ROOT.$conf->css;
$dol_loginmesg = $_SESSION["dol_loginmesg"];
include($template_dir.'login.tpl.php'); // To use native PHP

View File

@ -0,0 +1,120 @@
<?php
/* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- BEGIN PHP TEMPLATE -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $langs->trans('Password'); ?></title>
<meta name="robots" content="noindex,nofollow" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport"content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="<?php echo $dol_url_root.'/theme/phones/iphone/theme/'.$theme.'/'.$theme.'.css.php'; ?>" />
<script type="text/javascript" src="<?php echo $dol_url_root.'/includes/iphone/iwebkit/Framework/javascript/functions.js'; ?>"></script>
</head>
<body>
<div id="topbar">
<div id="title"><?php echo $langs->trans('Password'); ?></div>
<div id="leftnav">
<a href="<?php echo $dol_url_root; ?>/">
<img alt="home" src="<?php echo $dol_url_root.'/theme/phones/iphone/theme/'.$theme.'/img/home.png'; ?>"/>
</a>
</div>
</div>
<div id="content">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="action" value="buildnewpassword">
<div align="center">
<img src="<?php echo $dol_url_root.'/theme/phones/iphone/theme/'.$theme.'/thumbs/dolibarr.png'; ?>">
</div>
<br>
<span class="graytitle"><?php echo $langs->trans('Identification'); ?></span>
<ul class="pageitem">
<li class="form">
<input placeholder="<?php echo $langs->trans('Login'); ?>" type="text" <?php echo $disabled; ?> id="username" name="username" value="<?php echo $login; ?>" />
</li>
</ul>
<?php if ($select_entity) { ?>
<span class="graytitle"><?php echo $langs->trans('Entity'); ?></span>
<ul class="pageitem">
<li class="form">
<?php echo $select_entity; ?>
<span class="arrow"></span>
</li>
</ul>
<?php } ?>
<?php if ($captcha) { ?>
<span class="graytitle"><?php echo $langs->trans('SecurityCode'); ?></span>
<ul class="pageitem">
<li class="form">
<span class="narrow">
<input type="text" id="securitycode" name="code" />
<img src="<?php echo $dol_url_root.'/lib/antispamimage.php'; ?>" border="0" width="128" height="36" />
</span>
</li>
</ul>
<?php } ?>
<ul class="pageitem">
<li class="form">
<input name="input Button" <?php echo $disabled; ?> type="submit" value="<?php echo $langs->trans('SendByMail'); ?>" />
</li>
</ul>
</form>
</div>
<ul class="pageitem">
<li class="textbox">
<span class="header"><?php echo $langs->trans('Infos'); ?></span>
<?php if ($mode == 'dolibarr' || ! $disabled) {
echo $langs->trans('SendNewPasswordDesc');
}else{
echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode);
} ?>
</li>
</ul>
<?php if ($message) { ?>
<script type="text/javascript" language="javascript">
alert('<?php echo $message; ?>');
</script>
<?php } ?>
</body>
</html>
<!-- END PHP TEMPLATE -->

View File

@ -1,120 +0,0 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
{php}
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
{/php}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- BEGIN SMARTY TEMPLATE -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$langs->trans('Password')}</title>
<meta name="robots" content="noindex,nofollow" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport"content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="{$dol_url_root}/theme/phones/iphone/theme/{$theme}/{$theme}.css.php" />
<script type="text/javascript" src="{$dol_url_root}/includes/iphone/iwebkit/Framework/javascript/functions.js"></script>
</head>
<body>
<div id="topbar">
<div id="title">{$langs->trans('Password')}</div>
<div id="leftnav">
<a href="{$dol_url_root}/">
<img alt="home" src="{$dol_url_root}/theme/phones/iphone/theme/{$theme}/img/home.png"/>
</a>
</div>
</div>
<div id="content">
<form id="login" name="login" method="post" action="{$php_self}">
<input type="hidden" name="token" value="{$smarty.session.newtoken}" />
<input type="hidden" name="action" value="buildnewpassword">
<div align="center">
<img src="{$dol_url_root}/theme/phones/iphone/theme/{$theme}/thumbs/dolibarr.png">
</div>
<br>
<span class="graytitle">{$langs->trans('Identification')}</span>
<ul class="pageitem">
<li class="form">
<input placeholder="{$langs->trans('Login')}" type="text" {$disabled} id="username" name="username" value="{$login}" />
</li>
</ul>
{if $select_entity}
<span class="graytitle">{$langs->trans('Entity')}</span>
<ul class="pageitem">
<li class="form">
{$select_entity}
<span class="arrow"></span>
</li>
</ul>
{/if}
{if $captcha}
<span class="graytitle">{$langs->trans('SecurityCode')}</span>
<ul class="pageitem">
<li class="form">
<span class="narrow">
<input type="text" id="securitycode" name="code" />
<img src="{$dol_url_root}/lib/antispamimage.php" border="0" width="128" height="36" />
</span>
</li>
</ul>
{/if}
<ul class="pageitem">
<li class="form">
<input name="input Button" {$disabled} type="submit" value="{$langs->trans('SendByMail')}" />
</li>
</ul>
</form>
</div>
<ul class="pageitem">
<li class="textbox">
<span class="header">{$langs->trans('Infos')}</span>
{if ($mode == 'dolibarr') || (! $disabled)}
{$langs->trans('SendNewPasswordDesc')}
{else}
{$langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode)}
{/if}
</li>
</ul>
{if $error_message}
<script type="text/javascript" language="javascript">
alert('{$error_message}');
</script>
{/if}
</body>
</html>
<!-- END SMARTY TEMPLATE -->

View File

@ -0,0 +1,148 @@
<?php
/* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- BEGIN PHP TEMPLATE -->
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<title>Dolibarr Authentification</title>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
<style type="text/css">
<!--
#login {
margin-top: 10px;
margin-bottom: 5px;
text-align: center;
font: 12px arial,helvetica;
}
#login table {
border: 1px solid #C0C0C0;
background: #F0F0F0 url('<?php echo $login_background; ?>') repeat-x;
font-size: 12px;
}
-->
</style>
<script type="text/javascript">
function donnefocus() {
document.getElementById('<?php echo $focus_element; ?>').focus();
}
</script>
</head>
<body class="body" onload="donnefocus();">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="buildnewpassword">
<table class="login" summary="<?php echo $title; ?>" cellpadding="0" cellspacing="0" border="0" align="center">
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
</table>
<br>
<table class="login" summary="Login area" cellpadding="2" align="center">
<tr><td colspan="3">&nbsp;</td></tr>
<tr>
<td valign="bottom"> &nbsp; <b><?php echo $langs->trans('Login'); ?></b> &nbsp; </td>
<td valign="bottom" nowrap="nowrap">
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
</tr>
<?php if ($select_entity) { ?>
<tr><td valign="top" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('Entity'); ?></b> &nbsp; </td>
<td valign="top" nowrap="nowrap">
<?php echo $select_entity; ?>
</td></tr>
<?php } ?>
<?php if ($captcha) { ?>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td valign="middle" nowrap="nowrap"> &nbsp; <b><?php echo $langs->trans('SecurityCode'); ?></b></td>
<td valign="top" nowrap="nowrap" align="left" class="none">
<table style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="3"></td>
<td><img src="<?php echo $dol_url_root.'/lib/antispamimage.php'; ?>" border="0" width="64" height="24"></td>
<td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td>
</tr></table>
</td></tr>
<?php } ?>
<tr><td colspan="3">&nbsp;</td></tr>
<tr><td colspan="3" style="text-align:center;"><br>
<input id="password" type="submit" <?php echo $disabled; ?> class="button" name="password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
</td></tr>
</table>
</form>
<center>
<table width="90%"><tr><td align="center">
<?php if ($mode == 'dolibarr' || ! $disabled) { ?>
<font style="font-size: 12px;">
<?php echo $langs->trans('SendNewPasswordDesc'); ?>
</font>
<?php }else{ ?>
<div class="warning" align="center">
<?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
</div>
<?php } ?>
</td></tr>
</table>
<br>
<?php if ($message) { ?>
<table width="90%"><tr><td align="center" style="font-size: 12px;>
<?php echo $message; ?>
</td></tr></table><br>
<?php } ?>
<br>
<a href="<?php echo $dol_url_root; ?>/">
<?php echo $langs->trans('BackToLoginPage'); ?>
</a>
</center>
<br>
<br>
</body>
</html>
<!-- END PHP TEMPLATE -->

View File

@ -46,7 +46,6 @@ $login = isset($_POST["username"])?$_POST["username"]:'';
$conf->entity = isset($_POST["entity"])?$_POST["entity"]:1;
/**
* Actions
*/
@ -135,284 +134,105 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"])
}
/*
* Affichage page
*/
if ($conf->global->MAIN_SMARTY)
$php_self = $_SERVER['PHP_SELF'];
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
$dol_url_root = DOL_URL_ROOT;
// Select templates
if ($conf->browser->phone)
{
$smarty->assign('langs', $langs);
$php_self = $_SERVER['PHP_SELF'];
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
$smarty->assign('php_self', $php_self);
$smarty->assign('character_set_client',$conf->file->character_set_client);
$smarty->assign('dol_url_root', DOL_URL_ROOT);
$smarty->assign('mode', $mode);
$smarty->assign('login', $login);
// Select templates
if ($conf->browser->phone)
if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone))
{
if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone))
{
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone."/tpl/user/";
$smarty->assign('theme', 'default');
}
else
{
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/user/";
}
$theme = 'default';
$template_dir = DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone."/tpl/";
}
else
{
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/core/tpl/passwordforgotten.tpl"))
{
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/core/";
}
else
{
$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
}
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang;
$smarty->assign('conf_css', DOL_URL_ROOT.$conf->css);
$template_dir = DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/";
}
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
{
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png');
}
else
{
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
}
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
else $smarty->assign('focus_element', 'password');
// Title
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
$smarty->assign('title', $title);
// Send password button enabled ?
$disabled='disabled';
if ($mode == 'dolibarr') $disabled='';
if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled
$smarty->assign('disabled', $disabled);
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0;
$rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
$width=128;
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
}
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
$smarty->assign('logo', $urllogo);
$smarty->assign('logo_width', $width);
$smarty->assign('logo_rowspan', $rowspan);
// Entity field
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && ! $disabled)
{
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db);
$mc->getEntities();
$smarty->assign('select_entity', $mc->select_entities($mc->entities,$conf->entity,'tabindex="2"'));
}
// Security graphical code
if (function_exists("imagecreatefrompng") && ! $disabled)
{
$smarty->assign('captcha', 1);
$smarty->assign('captcha_refresh', img_refresh());
}
// Message
if ($message)
{
$smarty->assign('error_message', $message);
}
// Creation du template
$smarty->display('passwordforgotten.tpl');
// Suppression de la version compilee
$smarty->clear_compiled_tpl('passwordforgotten.tpl');
}
else
{
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php";
header('Cache-Control: Public, must-revalidate');
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
// En tete html
print "<html>\n";
print "<head>\n";
print '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'."\n";
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
print "<title>Dolibarr Authentification</title>\n";
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$conf->css.'?lang='.$langs->defaultlang.'">'."\n";
print '<style type="text/css">'."\n";
print '<!--'."\n";
print '#login {';
print ' margin-top: '.(empty($conf->browser->phone)?'70px;':'10px;');
print ' margin-bottom: '.(empty($conf->browser->phone)?'30px;':'5px;');
print ' text-align: center;';
print ' font: 10px arial,helvetica;';
print '}'."\n";
print '#login table {';
if (empty($conf->browser->phone)) print ' width: 498px;';
print ' border: 1px solid #C0C0C0;';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl"))
{
print 'background: #F0F0F0 url('.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png) repeat-x;';
$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
}
else
{
print 'background: #F0F0F0 url('.DOL_URL_ROOT.'/theme/login_background.png) repeat-x;';
}
print ' font-size: 12px;';
print '}'."\n";
print '-->'."\n";
print '</style>'."\n";
print '<script type="text/javascript">'."\n";
print "function donnefocus() {\n";
if (! $_REQUEST["username"]) print "document.getElementById('username').focus();\n";
else print "document.getElementById('password').focus();\n";
print "}\n";
print '</script>'."\n";
print '</head>'."\n";
// Body
print '<body class="body" onload="donnefocus();">'."\n";
// Form
print '<form id="login" action="'.$_SERVER["PHP_SELF"].'" method="post" name="login">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="buildnewpassword">'."\n";
// Table 1
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
print '<table class="login" summary="'.$title.'" cellpadding="0" cellspacing="0" border="0" align="center">'."\n";
print '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n";
print '</table>'."\n";
print '<br>'."\n";
// Send password button enabled ?
$disabled='disabled';
if ($mode == 'dolibarr') $disabled='';
if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled
// Table 2
print '<table class="login" cellpadding="2" align="center">'."\n";
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
print '<tr>';
print '<td align="left" valign="bottom"><br> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp;</td>';
print '<td valign="bottom"><input id="username" type="text" '.$disabled.' name="username" class="flat" size="15" maxlength="25" value="'.$login.'" tabindex="1" /></td>';
$title='';
// Show lock logo
$width=0;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_logo.png';
}
print '<td rowspan="2" align="center">';
if (empty($conf->browser->phone))
{
print '<img title="'.$title.'" src="'.$urllogo.'"';
if ($width) print ' width="'.$width.'"';
print '>';
}
print '</td>';
print '</tr>'."\n";
if (function_exists("imagecreatefrompng") && ! $disabled)
{
if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>'; // More space with phones
//print "Info session: ".session_name().session_id();print_r($_SESSION);
print '<tr><td align="left" valign="middle" nowrap="nowrap"> &nbsp; <b>'.$langs->trans("SecurityCode").'</b></td>';
print '<td valign="top" nowrap="nowrap" align="left" class="e">';
print '<table style="width: 100px;"><tr>'; // Force width to a small value
print '<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="2"></td>';
$width=128;$height=36;
if (! empty($conf->browser->phone)) $width=64; $height=24;
print '<td><img src="'.DOL_URL_ROOT.'/lib/antispamimage.php" border="0" width="'.$width.'" height="'.$height.'"></td>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'">'.img_refresh().'</a></td>';
print '</tr></table>';
print '</td>';
print '</tr>';
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
}
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
$conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang;
print '<tr><td colspan="3" style="text-align:center;"><br>';
print '<input id="password" type="submit" '.$disabled.' class="button" name="password" value="'.$langs->trans("SendNewPassword").'" tabindex="4">';
print '</td></tr>'."\n";
print "</table>"."\n";
print "</form>"."\n";
print '<center>'."\n";
print '<table width="90%"><tr><td align="center">';
if (($mode == 'dolibarr') || (! $disabled))
{
print '<font style="font-size: 12px;">'.$langs->trans("SendNewPasswordDesc").'</font>'."\n";
}
else
{
print '<div class="warning" align="center">'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'</div>'."\n";
}
print '</td></tr></table><br>';
if ($message)
{
print '<table width="90%"><tr><td align="center" style="font-size: 12px;">';
print $message.'</td></tr></table><br>';
}
print '<br>'."\n";
print '<a href="'.DOL_URL_ROOT.'/">'.$langs->trans("BackToLoginPage").'</a>';
print '</center>'."\n";
print "<br>";
print "<br>";
// Fin entete html
print "\n</body>\n</html>";
$conf_css = DOL_URL_ROOT.$conf->css;
}
?>
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
{
$login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
}
else
{
$login_background = DOL_URL_ROOT.'/theme/login_background.png';
}
if (! $_REQUEST["username"]) $focus_element = 'username';
else $focus_element = 'password';
// Title
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
// Send password button enabled ?
$disabled='disabled';
if ($mode == 'dolibarr') $disabled='';
if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0;
$rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
}
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode($mysoc->logo);
$width=128;
}
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
{
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
}
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
// Entity field
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && ! $disabled)
{
require_once(DOL_DOCUMENT_ROOT.'/multicompany/class/multicompany.class.php');
global $db;
$mc = new Multicompany($db);
$mc->getEntities();
$select_entity = $mc->select_entities($mc->entities,$conf->entity,'tabindex="2"');
}
// Security graphical code
if (function_exists("imagecreatefrompng") && ! $disabled)
{
$captcha = 1;
$captcha_refresh = img_refresh();
}
include($template_dir.'passwordforgotten.tpl.php'); // To use native PHP
?>