From 79d7be01d1001a1915a223b9e598b1b3c2eba697 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 12 Apr 2010 18:56:53 +0000 Subject: [PATCH] Fix: the core system used php templates by default --- htdocs/core/tpl/login.tpl | 190 ---------- htdocs/core/tpl/passwordforgotten.tpl | 151 -------- htdocs/core/tpl/passwordforgotten.tpl.php | 152 ++++++++ htdocs/lib/antispamimage.php | 9 +- htdocs/lib/security.lib.php | 20 +- .../iphone/tpl/passwordforgotten.tpl.php | 120 ++++++ htdocs/theme/phones/iphone/tpl/user/index.php | 0 .../iphone/tpl/user/passwordforgotten.tpl | 120 ------ .../others/tpl/passwordforgotten.tpl.php | 148 ++++++++ htdocs/user/passwordforgotten.php | 342 +++++------------- 10 files changed, 522 insertions(+), 730 deletions(-) delete mode 100644 htdocs/core/tpl/login.tpl delete mode 100644 htdocs/core/tpl/passwordforgotten.tpl create mode 100644 htdocs/core/tpl/passwordforgotten.tpl.php create mode 100644 htdocs/theme/phones/iphone/tpl/passwordforgotten.tpl.php delete mode 100644 htdocs/theme/phones/iphone/tpl/user/index.php delete mode 100644 htdocs/theme/phones/iphone/tpl/user/passwordforgotten.tpl create mode 100644 htdocs/theme/phones/others/tpl/passwordforgotten.tpl.php diff --git a/htdocs/core/tpl/login.tpl b/htdocs/core/tpl/login.tpl deleted file mode 100644 index 1b77eda5379..00000000000 --- a/htdocs/core/tpl/login.tpl +++ /dev/null @@ -1,190 +0,0 @@ -{* Copyright (C) 2009 Regis Houssin - * - * 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} - - - - - - - -{$langs->trans('Login')} - - - - - - - - {if $main_html_header} - {$main_html_header} - {/if} - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - {if $select_entity} - - - {/if} - - {if $captcha} - - - {/if} - - - - - - {if $forgetpasslink || $helpcenterlink} - - {/if} - - - -
- - {if $smarty.session.dol_loginmesg} -
- {$smarty.session.dol_loginmesg} -
- {/if} - - {if $main_home} -
-
- {$main_home} -

- {/if} - - {if $main_google_ad_client} -
- - -
- {/if} - - - - - - {if $main_html_footer} - {$main_html_footer} - {/if} - - - - - \ No newline at end of file diff --git a/htdocs/core/tpl/passwordforgotten.tpl b/htdocs/core/tpl/passwordforgotten.tpl deleted file mode 100644 index d2647e349fc..00000000000 --- a/htdocs/core/tpl/passwordforgotten.tpl +++ /dev/null @@ -1,151 +0,0 @@ -{* Copyright (C) 2009 Regis Houssin - * - * 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} - - - - - - - -Dolibarr Authentification - - - - - - - - - - -
- - - - - - -
- - - - - - - - - - - - - - {if $select_entity} - - - {/if} - - {if $captcha} - - - {/if} - - - - - - - -
- -
- -
- - {if ($mode == 'dolibarr') || (! $disabled)} - - {$langs->trans('SendNewPasswordDesc')} - - {else} -
- {$langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode)} -
- {/if} - -
- -
- - {if $error_message} -
- {$langs->trans('BackToLoginPage')} - - - -
-
- - - - - \ No newline at end of file diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php new file mode 100644 index 00000000000..d171668ef3c --- /dev/null +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -0,0 +1,152 @@ + + * + * 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); +?> + + + + + + + + +Dolibarr Authentification + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + trans('SendNewPasswordDesc'); ?> + + +
+ trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> +
+ + +
+ +
+ + +
/"> + trans('BackToLoginPage'); ?> + + + +
+
+ + + + + \ No newline at end of file diff --git a/htdocs/lib/antispamimage.php b/htdocs/lib/antispamimage.php index 19acf0d750b..dbf736fd561 100644 --- a/htdocs/lib/antispamimage.php +++ b/htdocs/lib/antispamimage.php @@ -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'; diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 0b13b3e23b8..cd9aa8260b8 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -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 diff --git a/htdocs/theme/phones/iphone/tpl/passwordforgotten.tpl.php b/htdocs/theme/phones/iphone/tpl/passwordforgotten.tpl.php new file mode 100644 index 00000000000..cf48bfa0ff6 --- /dev/null +++ b/htdocs/theme/phones/iphone/tpl/passwordforgotten.tpl.php @@ -0,0 +1,120 @@ + + * + * 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); +?> + + + + + + + + +<?php echo $langs->trans('Password'); ?> + + + + + + + + + +
+
trans('Password'); ?>
+
+ + home + +
+
+ +
+
+ + + +
+ +
+ +
+ + trans('Identification'); ?> +
    +
  • + id="username" name="username" value="" /> +
  • +
+ + + trans('Entity'); ?> +
    +
  • + + +
  • +
+ + + + trans('SecurityCode'); ?> +
    +
  • + + + + +
  • +
+ + +
    +
  • + type="submit" value="trans('SendByMail'); ?>" /> +
  • +
+ +
+
+ +
    +
  • + trans('Infos'); ?> + trans('SendNewPasswordDesc'); + }else{ + echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); + } ?> +
  • +
+ + + + + + + + + \ No newline at end of file diff --git a/htdocs/theme/phones/iphone/tpl/user/index.php b/htdocs/theme/phones/iphone/tpl/user/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/theme/phones/iphone/tpl/user/passwordforgotten.tpl b/htdocs/theme/phones/iphone/tpl/user/passwordforgotten.tpl deleted file mode 100644 index 74fafd1da09..00000000000 --- a/htdocs/theme/phones/iphone/tpl/user/passwordforgotten.tpl +++ /dev/null @@ -1,120 +0,0 @@ -{* Copyright (C) 2009 Regis Houssin - * - * 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} - - - - - - - - -{$langs->trans('Password')} - - - - - - - - - -
-
{$langs->trans('Password')}
-
- - home - -
-
- -
-
- - - -
- -
- -
- - {$langs->trans('Identification')} -
    -
  • - -
  • -
- - {if $select_entity} - {$langs->trans('Entity')} -
    -
  • - {$select_entity} - -
  • -
- {/if} - - {if $captcha} - {$langs->trans('SecurityCode')} -
    -
  • - - - - -
  • -
- {/if} - -
    -
  • - -
  • -
- -
-
- -
    -
  • - {$langs->trans('Infos')} - {if ($mode == 'dolibarr') || (! $disabled)} - {$langs->trans('SendNewPasswordDesc')} - {else} - {$langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode)} - {/if} -
  • -
- -{if $error_message} - -{/if} - - - - - \ No newline at end of file diff --git a/htdocs/theme/phones/others/tpl/passwordforgotten.tpl.php b/htdocs/theme/phones/others/tpl/passwordforgotten.tpl.php new file mode 100644 index 00000000000..4dda6647e09 --- /dev/null +++ b/htdocs/theme/phones/others/tpl/passwordforgotten.tpl.php @@ -0,0 +1,148 @@ + + * + * 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); +?> + + + + + + + + +Dolibarr Authentification + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + trans('SendNewPasswordDesc'); ?> + + +
+ trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> +
+ + +
+ +
+ + +
/"> + trans('BackToLoginPage'); ?> + + + +
+
+ + + + + \ No newline at end of file diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 4160f650197..adb5c948089 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -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&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&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 ''."\n"; - - // En tete html - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; // Evite indexation par robots - print "Dolibarr Authentification\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - // Body - print ''."\n"; - - // Form - print '
'."\n"; - print ''; - print ''."\n"; - - // Table 1 - $title='Dolibarr '.DOL_VERSION; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print '
'."\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 ''."\n"; - - print ''."\n"; - - print ''; - print ''; - print ''; - - $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 ''; - print ''."\n"; - - if (function_exists("imagecreatefrompng") && ! $disabled) - { - if (! empty($conf->browser->phone)) print ''; // More space with phones - - //print "Info session: ".session_name().session_id();print_r($_SESSION); - print ''; - print ''; - print ''; + $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } - print ''."\n"; + $conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang; - print ''."\n"; - - print ""."\n"; - - print "
"."\n"; - - print '
'."\n"; - print '
'; - if (($mode == 'dolibarr') || (! $disabled)) - { - print ''.$langs->trans("SendNewPasswordDesc").''."\n"; - } - else - { - print '
'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'
'."\n"; - } - print '

'; - - if ($message) - { - print '
'; - print $message.'

'; - } - - print '
'."\n"; - print ''.$langs->trans("BackToLoginPage").''; - print '
'."\n"; - - print "
"; - print "
"; - - // Fin entete html - print "\n\n"; + $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&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&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 + +?> \ No newline at end of file