Skip to content
Snippets Groups Projects
Commit 90d099dd authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Core templates are in core/templates directory

parent eb8ac6c1
Branches
Tags
No related merge requests found
{* 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 -->
\ No newline at end of file
......@@ -29,7 +29,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<meta name="robots" content="noindex,nofollow">
<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">
<!--
......@@ -82,8 +82,8 @@ function donnefocus() {
<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>
<td rowspan="<?php echo $logo_rowspan; ?>" align="center" valign="top">
<img alt="Logo" title="" src="<?php echo $logo; ?>" />
<td rowspan="<?php echo $rowspan; ?>" align="center" valign="top">
<img alt="Logo" title="" src="<?php echo $urllogo; ?>" />
</td>
</tr>
......@@ -163,7 +163,7 @@ function donnefocus() {
<?php if ($main_google_ad_client) { ?>
<div align="center">
<?php include($google_ad_tpl); ?>
<?php include('google_ad.tpl.php'); ?>
</div>
<?php } ?>
......
......@@ -34,18 +34,15 @@
*/
function dol_loginfunction($langs,$conf,$mysoc)
{
global $dolibarr_main_demo,$db;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
$langs->setDefaultLang($langcode);
$langs->load("main");
$langs->load("other");
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
// 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);
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css.php";
// Set cookie for timeout management
$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"];
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
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
// Ce DTD est OK
......@@ -112,8 +149,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// 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";
......@@ -126,38 +161,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
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
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="';
......@@ -205,8 +208,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
{
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
global $db;
$mc = new Multicompany($db);
$mc->getEntities();
......@@ -336,6 +337,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
*/
function dol_loginfunction2($langs,$conf,$mysoc)
{
global $dolibarr_main_demo,$db;
global $smarty;
$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
......@@ -380,9 +382,7 @@ function dol_loginfunction2($langs,$conf,$mysoc)
}
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
// Si feuille de style en php existe
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
$conf->css.=".php?lang=".$langs->defaultlang;
$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
}
......@@ -398,14 +398,11 @@ function dol_loginfunction2($langs,$conf,$mysoc)
if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
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'))
{
$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='Dolibarr '.DOL_VERSION;
......@@ -415,7 +412,6 @@ function dol_loginfunction2($langs,$conf,$mysoc)
$demologin='';
$demopassword='';
global $dolibarr_main_demo;
if (! empty($dolibarr_main_demo))
{
$tab=explode(',',$dolibarr_main_demo);
......@@ -447,8 +443,9 @@ function dol_loginfunction2($langs,$conf,$mysoc)
// Login
$login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin));
$password = $demopassword;
$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)
$width=0;
......@@ -480,18 +477,18 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{
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,$lastentity,'tabindex="3"'));
$select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
$smarty->assign('select_entity', $select_entity);
}
// Security graphical code
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());
}
......@@ -500,12 +497,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
{
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
{
$smarty->assign('forgetpasslink', 1);
$forgetpasslink=1;
$smarty->assign('forgetpasslink', $forgetpasslink);
}
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
{
$smarty->assign('helpcenterlink', 1);
$helpcenterlink=1;
$smarty->assign('helpcenterlink', $helpcenterlink);
}
}
......@@ -546,7 +545,8 @@ function dol_loginfunction2($langs,$conf,$mysoc)
}
// 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
$smarty->clear_compiled_tpl('login.tpl');
......
......@@ -167,13 +167,13 @@ if ($conf->global->MAIN_SMARTY)
}
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
{
$smarty->template_dir = DOL_DOCUMENT_ROOT."/user/templates/";
$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
}
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment