Core templates are in core/templates directory

This commit is contained in:
Laurent Destailleur 2010-01-04 19:39:16 +00:00
parent eb8ac6c1b0
commit 90d099ddf2
6 changed files with 186 additions and 152 deletions

View File

@ -0,0 +1,34 @@
{* 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$
*}
<!-- BEGIN GOOGLE AD TEMPLATE -->
<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>
<!-- END GOOGLE AD TEMPLATE -->

View File

@ -29,7 +29,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<title><?php echo $langs->trans('Login'); ?></title> <title><?php echo $langs->trans('Login'); ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>"> <link rel="stylesheet" type="text/css" href="<?php echo $conf->css; ?>">
<style type="text/css"> <style type="text/css">
<!-- <!--
@ -54,7 +54,7 @@ function donnefocus() {
} }
</script> </script>
<?php <?php
if ($main_html_header) if ($main_html_header)
echo $main_html_header; echo $main_html_header;
?> ?>
@ -82,8 +82,8 @@ function donnefocus() {
<td valign="bottom" nowrap="nowrap"> <td valign="bottom" nowrap="nowrap">
<input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td> <input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
<td rowspan="<?php echo $logo_rowspan; ?>" align="center" valign="top"> <td rowspan="<?php echo $rowspan; ?>" align="center" valign="top">
<img alt="Logo" title="" src="<?php echo $logo; ?>" /> <img alt="Logo" title="" src="<?php echo $urllogo; ?>" />
</td> </td>
</tr> </tr>
@ -137,8 +137,8 @@ function donnefocus() {
echo '&nbsp;-&nbsp;'; echo '&nbsp;-&nbsp;';
} else { } else {
echo '('; echo '(';
} }
echo $langs->trans('NeedHelpCenter').')</a>'; echo $langs->trans('NeedHelpCenter').')</a>';
} }
echo '</td></tr>'; echo '</td></tr>';
} }
@ -153,7 +153,7 @@ function donnefocus() {
<?php echo $_SESSION['dol_loginmesg']; ?> <?php echo $_SESSION['dol_loginmesg']; ?>
</div></td></tr></table></center> </div></td></tr></table></center>
<?php } ?> <?php } ?>
<?php if ($main_home) { ?> <?php if ($main_home) { ?>
<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750"> <center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
<tr><td align="center"> <tr><td align="center">
@ -163,7 +163,7 @@ function donnefocus() {
<?php if ($main_google_ad_client) { ?> <?php if ($main_google_ad_client) { ?>
<div align="center"> <div align="center">
<?php include($google_ad_tpl); ?> <?php include('google_ad.tpl.php'); ?>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -34,18 +34,15 @@
*/ */
function dol_loginfunction($langs,$conf,$mysoc) function dol_loginfunction($langs,$conf,$mysoc)
{ {
global $dolibarr_main_demo,$db;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
$langs->setDefaultLang($langcode); $langs->setDefaultLang($langcode);
$langs->load("main"); $langs->load("main");
$langs->load("other"); $langs->load("other");
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css.php";
// Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
// Set cookie for timeout management // Set cookie for timeout management
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
@ -54,6 +51,46 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
else unset($_SESSION["urlfrom"]); else unset($_SESSION["urlfrom"]);
$demologin='';
$demopassword='';
if (! empty($dolibarr_main_demo))
{
$tab=explode(',',$dolibarr_main_demo);
$demologin=$tab[0];
$demopassword=$tab[1];
}
// Entity cookie
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{
$lastuser = '';
$lastentity = $_POST['entity'];
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
{
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (isset($_COOKIE[$entityCookieName]))
{
include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
}
}
}
$title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
// Ce DTD est KO car inhibe document.body.scrollTop // Ce DTD est KO car inhibe document.body.scrollTop
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; //print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
// Ce DTD est OK // Ce DTD est OK
@ -112,8 +149,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// Table 1 // 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 '<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 '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
@ -126,38 +161,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<tr>'; print '<tr>';
$demologin='';
$demopassword='';
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo))
{
$tab=explode(',',$dolibarr_main_demo);
$demologin=$tab[0];
$demopassword=$tab[1];
}
// Entity cookie
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{
$lastuser = '';
$lastentity = $_POST['entity'];
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
{
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (isset($_COOKIE[$entityCookieName]))
{
include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = explode('|', $cookieValue);
}
}
}
// Login field // Login field
print '<td valign="bottom"> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp; </td>'."\n"; print '<td valign="bottom"> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp; </td>'."\n";
print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="'; print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="';
@ -204,9 +207,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{ {
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db); $mc = new Multicompany($db);
$mc->getEntities(); $mc->getEntities();
@ -248,7 +249,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>'; // More space with phones if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>'; // More space with phones
print '<tr><td colspan="3" align="center">'; print '<tr><td colspan="3" align="center">';
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
{ {
print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">('; print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">(';
@ -336,6 +337,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
*/ */
function dol_loginfunction2($langs,$conf,$mysoc) function dol_loginfunction2($langs,$conf,$mysoc)
{ {
global $dolibarr_main_demo,$db;
global $smarty; global $smarty;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
@ -344,14 +346,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
$langs->load("main"); $langs->load("main");
$langs->load("other"); $langs->load("other");
$langs->load("help"); $langs->load("help");
$smarty->assign('langs', $langs); $smarty->assign('langs', $langs);
if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER); if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER);
$php_self = $_SERVER['PHP_SELF']; $php_self = $_SERVER['PHP_SELF'];
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:''; $php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
$smarty->assign('php_self', $php_self); $smarty->assign('php_self', $php_self);
$smarty->assign('character_set_client',$conf->file->character_set_client); $smarty->assign('character_set_client',$conf->file->character_set_client);
@ -378,11 +380,9 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
} }
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
$conf->css.=".php?lang=".$langs->defaultlang;
// Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css); $smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
} }
@ -394,28 +394,24 @@ function dol_loginfunction2($langs,$conf,$mysoc)
if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
else unset($_SESSION["urlfrom"]); else unset($_SESSION["urlfrom"]);
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username'); if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
else $smarty->assign('focus_element', 'password'); else $smarty->assign('focus_element', 'password');
$login_background=DOL_URL_ROOT.'/theme/login_background.png';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) 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'); $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');
}
// Title // Title
$title='Dolibarr '.DOL_VERSION; $title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
$smarty->assign('title', $title); $smarty->assign('title', $title);
$demologin=''; $demologin='';
$demopassword=''; $demopassword='';
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo)) if (! empty($dolibarr_main_demo))
{ {
$tab=explode(',',$dolibarr_main_demo); $tab=explode(',',$dolibarr_main_demo);
@ -447,14 +443,15 @@ function dol_loginfunction2($langs,$conf,$mysoc)
// Login // Login
$login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin)); $login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin));
$password = $demopassword;
$smarty->assign('login', $login); $smarty->assign('login', $login);
$smarty->assign('password', $demopassword); $smarty->assign('password', $password);
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0; $width=0;
$rowspan=2; $rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) 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); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
@ -468,30 +465,30 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{ {
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
} }
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
$smarty->assign('logo', $urllogo); $smarty->assign('logo', $urllogo);
$smarty->assign('logo_width', $width); $smarty->assign('logo_width', $width);
$smarty->assign('logo_rowspan', $rowspan); $smarty->assign('logo_rowspan', $rowspan);
// Entity field // Entity field
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{ {
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db); $mc = new Multicompany($db);
$mc->getEntities(); $mc->getEntities();
$smarty->assign('select_entity', $mc->select_entities($mc->entities,$lastentity,'tabindex="3"')); $select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
$smarty->assign('select_entity', $select_entity);
} }
// Security graphical code // Security graphical code
if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
$smarty->assign('captcha', 1); $captcha=1;
$smarty->assign('captcha', $captcha);
$smarty->assign('captcha_refresh', img_refresh()); $smarty->assign('captcha_refresh', img_refresh());
} }
@ -500,12 +497,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{ {
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
{ {
$smarty->assign('forgetpasslink', 1); $forgetpasslink=1;
$smarty->assign('forgetpasslink', $forgetpasslink);
} }
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
{ {
$smarty->assign('helpcenterlink', 1); $helpcenterlink=1;
$smarty->assign('helpcenterlink', $helpcenterlink);
} }
} }
@ -529,28 +528,29 @@ function dol_loginfunction2($langs,$conf,$mysoc)
$smarty->assign('main_google_ad_slot', $conf->global->MAIN_GOOGLE_AD_SLOT); $smarty->assign('main_google_ad_slot', $conf->global->MAIN_GOOGLE_AD_SLOT);
$smarty->assign('main_google_ad_width', $conf->global->MAIN_GOOGLE_AD_WIDTH); $smarty->assign('main_google_ad_width', $conf->global->MAIN_GOOGLE_AD_WIDTH);
$smarty->assign('main_google_ad_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT); $smarty->assign('main_google_ad_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT);
$google_ad_template = DOL_DOCUMENT_ROOT."/core/templates/google_ad.tpl"; $google_ad_template = DOL_DOCUMENT_ROOT."/core/templates/google_ad.tpl";
$smarty->assign('google_ad_tpl', $google_ad_template); $smarty->assign('google_ad_tpl', $google_ad_template);
} }
if (! empty($conf->global->MAIN_HTML_FOOTER)) $smarty->assign('main_html_footer', $conf->global->MAIN_HTML_FOOTER); if (! empty($conf->global->MAIN_HTML_FOOTER)) $smarty->assign('main_html_footer', $conf->global->MAIN_HTML_FOOTER);
$smarty->assign('main_authentication', $conf->file->main_authentication); $smarty->assign('main_authentication', $conf->file->main_authentication);
$smarty->assign('session_name', session_name()); $smarty->assign('session_name', session_name());
// Message // Message
if (! empty($_SESSION["dol_loginmesg"])) if (! empty($_SESSION["dol_loginmesg"]))
{ {
$smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]); $smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]);
} }
// Creation du template // Creation du template
$smarty->display('login.tpl'); $smarty->display('login.tpl'); // To use Smarty
// include(DOL_DOCUMENT_ROOT.'/core/templates/login.tpl.php'); // To use native PHP
// Suppression de la version compilee // Suppression de la version compilee
$smarty->clear_compiled_tpl('login.tpl'); $smarty->clear_compiled_tpl('login.tpl');
$_SESSION["dol_loginmesg"] = ''; $_SESSION["dol_loginmesg"] = '';
} }
@ -746,7 +746,7 @@ function dol_avscan_file($file)
/** /**
* Return array of ciphers mode available * Return array of ciphers mode available
* *
* @return strAv Configuration file content * @return strAv Configuration file content
*/ */
function dol_efc_config() function dol_efc_config()
@ -756,59 +756,59 @@ function dol_efc_config()
{ {
return -1; return -1;
} }
// Set a temporary $key and $data for encryption tests // Set a temporary $key and $data for encryption tests
$key = md5(time() . getmypid()); $key = md5(time() . getmypid());
$data = mt_rand(); $data = mt_rand();
// Get and sort available cipher methods // Get and sort available cipher methods
$ciphers = mcrypt_list_algorithms(); $ciphers = mcrypt_list_algorithms();
natsort($ciphers); natsort($ciphers);
// Get and sort available cipher modes // Get and sort available cipher modes
$modes = mcrypt_list_modes(); $modes = mcrypt_list_modes();
natsort($modes); natsort($modes);
foreach ($ciphers as $cipher) foreach ($ciphers as $cipher)
{ {
foreach ($modes as $mode) foreach ($modes as $mode)
{ {
// Not Compatible // Not Compatible
$result = 'false'; $result = 'false';
// open encryption module // open encryption module
$td = @mcrypt_module_open($cipher, '', $mode, ''); $td = @mcrypt_module_open($cipher, '', $mode, '');
// if we could open the cipher // if we could open the cipher
if ($td) if ($td)
{ {
// try to generate the iv // try to generate the iv
$iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size ($td), MCRYPT_RAND); $iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
// if we could generate the iv // if we could generate the iv
if ($iv) if ($iv)
{ {
// initialize encryption // initialize encryption
@mcrypt_generic_init ($td, $key, $iv); @mcrypt_generic_init ($td, $key, $iv);
// encrypt data // encrypt data
$encrypted_data = mcrypt_generic($td, $data); $encrypted_data = mcrypt_generic($td, $data);
// cleanup // cleanup
mcrypt_generic_deinit($td); mcrypt_generic_deinit($td);
// No error issued // No error issued
$result = 'true'; $result = 'true';
} }
// close // close
@mcrypt_module_close($td); @mcrypt_module_close($td);
} }
if ($result == "true") $available["$cipher"][] = $mode; if ($result == "true") $available["$cipher"][] = $mode;
} }
} }
if (count($available) > 0) if (count($available) > 0)
{ {
// Content of configuration // Content of configuration
@ -820,7 +820,7 @@ function dol_efc_config()
$strAv.= " * This file is licensed under GNU GPL version 2 or above.\n"; $strAv.= " * This file is licensed under GNU GPL version 2 or above.\n";
$strAv.= " * Please visit http://www.gnu.org to now more about it.\n"; $strAv.= " * Please visit http://www.gnu.org to now more about it.\n";
$strAv.= " */\n\n"; $strAv.= " */\n\n";
$strAv.= "/**\n"; $strAv.= "/**\n";
$strAv.= " * Name: EasyFileCrypt Extending Crypt Class\n"; $strAv.= " * Name: EasyFileCrypt Extending Crypt Class\n";
$strAv.= " * Version: 1.0\n"; $strAv.= " * Version: 1.0\n";
$strAv.= " * Created: ".date("r")."\n"; $strAv.= " * Created: ".date("r")."\n";
@ -847,7 +847,7 @@ function dol_efc_config()
$strAv = substr($strAv, 0, strlen($strAv) - 1); $strAv = substr($strAv, 0, strlen($strAv) - 1);
$strAv .= " );\n\n"; $strAv .= " );\n\n";
$strAv .= "?>"; $strAv .= "?>";
return $strAv; return $strAv;
} }
} }

View File

@ -142,16 +142,16 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"])
if ($conf->global->MAIN_SMARTY) if ($conf->global->MAIN_SMARTY)
{ {
$smarty->assign('langs', $langs); $smarty->assign('langs', $langs);
$php_self = $_SERVER['PHP_SELF']; $php_self = $_SERVER['PHP_SELF'];
$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:''; $php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
$smarty->assign('php_self', $php_self); $smarty->assign('php_self', $php_self);
$smarty->assign('character_set_client',$conf->file->character_set_client); $smarty->assign('character_set_client',$conf->file->character_set_client);
$smarty->assign('dol_url_root', DOL_URL_ROOT); $smarty->assign('dol_url_root', DOL_URL_ROOT);
$smarty->assign('mode', $mode); $smarty->assign('mode', $mode);
$smarty->assign('login', $login); $smarty->assign('login', $login);
// Select templates // Select templates
if ($conf->browser->phone) if ($conf->browser->phone)
{ {
@ -167,22 +167,22 @@ if ($conf->global->MAIN_SMARTY)
} }
else else
{ {
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/passwordforgotten.tpl")) if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/core/templates/passwordforgotten.tpl"))
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/core/";
} }
else else
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT."/user/templates/"; $smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
} }
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
// Si feuille de style en php existe // Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang; if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css); $smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
} }
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) 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'); $smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png');
@ -191,26 +191,26 @@ if ($conf->global->MAIN_SMARTY)
{ {
$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png'); $smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
} }
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username'); if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
else $smarty->assign('focus_element', 'password'); else $smarty->assign('focus_element', 'password');
// Title // Title
$title='Dolibarr '.DOL_VERSION; $title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
$smarty->assign('title', $title); $smarty->assign('title', $title);
// Send password button enabled ? // Send password button enabled ?
$disabled='disabled'; $disabled='disabled';
if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled=''; if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled='';
if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled
$smarty->assign('disabled', $disabled); $smarty->assign('disabled', $disabled);
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0; $width=0;
$rowspan=2; $rowspan=2;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) 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); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
@ -224,20 +224,20 @@ if ($conf->global->MAIN_SMARTY)
{ {
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
} }
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
$smarty->assign('logo', $urllogo); $smarty->assign('logo', $urllogo);
$smarty->assign('logo_width', $width); $smarty->assign('logo_width', $width);
$smarty->assign('logo_rowspan', $rowspan); $smarty->assign('logo_rowspan', $rowspan);
// Entity field // Entity field
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && ! $disabled) if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && ! $disabled)
{ {
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db; global $db;
$mc = new Multicompany($db); $mc = new Multicompany($db);
$mc->getEntities(); $mc->getEntities();
@ -250,16 +250,16 @@ if ($conf->global->MAIN_SMARTY)
$smarty->assign('captcha', 1); $smarty->assign('captcha', 1);
$smarty->assign('captcha_refresh', img_refresh()); $smarty->assign('captcha_refresh', img_refresh());
} }
// Message // Message
if ($message) if ($message)
{ {
$smarty->assign('error_message', $message); $smarty->assign('error_message', $message);
} }
// Creation du template // Creation du template
$smarty->display('passwordforgotten.tpl'); $smarty->display('passwordforgotten.tpl');
// Suppression de la version compilee // Suppression de la version compilee
$smarty->clear_compiled_tpl('passwordforgotten.tpl'); $smarty->clear_compiled_tpl('passwordforgotten.tpl');
} }
@ -268,11 +268,11 @@ else
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
// Si feuille de style en php existe // Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n"; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
// En tete html // En tete html
print "<html>\n"; print "<html>\n";
print "<head>\n"; print "<head>\n";
@ -310,15 +310,15 @@ else
print "}\n"; print "}\n";
print '</script>'."\n"; print '</script>'."\n";
print '</head>'."\n"; print '</head>'."\n";
// Body // Body
print '<body class="body" onload="donnefocus();">'."\n"; print '<body class="body" onload="donnefocus();">'."\n";
// Form // Form
print '<form id="login" action="'.$_SERVER["PHP_SELF"].'" method="post" name="login">'."\n"; 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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="buildnewpassword">'."\n"; print '<input type="hidden" name="action" value="buildnewpassword">'."\n";
// Table 1 // Table 1
$title='Dolibarr '.DOL_VERSION; $title='Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
@ -334,23 +334,23 @@ else
} }
print '</table>'."\n"; print '</table>'."\n";
print '<br>'."\n"; print '<br>'."\n";
// Send password button enabled ? // Send password button enabled ?
$disabled='disabled'; $disabled='disabled';
if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled=''; if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled='';
if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled=''; // To force button enabled
// Table 2 // Table 2
print '<table class="login" cellpadding="2" align="center">'."\n"; print '<table class="login" cellpadding="2" align="center">'."\n";
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n"; print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
print '<tr>'; print '<tr>';
print '<td align="left" valign="bottom"><br> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp;</td>'; 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>'; print '<td valign="bottom"><input id="username" type="text" '.$disabled.' name="username" class="flat" size="15" maxlength="25" value="'.$login.'" tabindex="1" /></td>';
$title=''; $title='';
// Show logo (search in order: small company logo, large company logo, theme logo, common logo) // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width=0; $width=0;
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
@ -376,15 +376,15 @@ else
} }
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
if (function_exists("imagecreatefrompng") && ! $disabled) if (function_exists("imagecreatefrompng") && ! $disabled)
{ {
if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>'; // More space with phones 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 "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 '<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 '<td valign="top" nowrap="nowrap" align="left" class="e">';
print '<table style="width: 100px;"><tr>'; // Force width to a small value 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>'; print '<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="2"></td>';
$width=128;$height=36; $width=128;$height=36;
@ -392,21 +392,21 @@ else
print '<td><img src="'.DOL_URL_ROOT.'/lib/antispamimage.php" border="0" width="'.$width.'" height="'.$height.'"></td>'; 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 '<td><a href="'.$_SERVER["PHP_SELF"].'">'.img_refresh().'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n"; print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
print '<tr><td colspan="3" style="text-align:center;"><br>'; 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 '<input id="password" type="submit" '.$disabled.' class="button" name="password" value="'.$langs->trans("SendNewPassword").'" tabindex="4">';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print "</table>"."\n"; print "</table>"."\n";
print "</form>"."\n"; print "</form>"."\n";
print '<center>'."\n"; print '<center>'."\n";
print '<table width="90%"><tr><td align="center">'; print '<table width="90%"><tr><td align="center">';
if (($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') || (! $disabled)) if (($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') || (! $disabled))
@ -418,20 +418,20 @@ else
print '<div class="warning" align="center">'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'</div>'."\n"; print '<div class="warning" align="center">'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'</div>'."\n";
} }
print '</td></tr></table><br>'; print '</td></tr></table><br>';
if ($message) if ($message)
{ {
print '<table width="90%"><tr><td align="center" style="font-size: 12px;">'; print '<table width="90%"><tr><td align="center" style="font-size: 12px;">';
print $message.'</td></tr></table><br>'; print $message.'</td></tr></table><br>';
} }
print '<br>'."\n"; print '<br>'."\n";
print '<a href="'.DOL_URL_ROOT.'/">'.$langs->trans("BackToLoginPage").'</a>'; print '<a href="'.DOL_URL_ROOT.'/">'.$langs->trans("BackToLoginPage").'</a>';
print '</center>'."\n"; print '</center>'."\n";
print "<br>"; print "<br>";
print "<br>"; print "<br>";
// Fin entete html // Fin entete html
print "\n</body>\n</html>"; print "\n</body>\n</html>";
} }