From 78c66bc7a0a84827b342d31ec394ed4e88412d74 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 12 Apr 2010 15:25:57 +0000 Subject: [PATCH] Fix: the core system used php templates by default --- htdocs/lib/security.lib.php | 103 ++--------- htdocs/theme/phones/iphone/tpl/login.tpl | 137 -------------- htdocs/theme/phones/iphone/tpl/login.tpl.php | 135 ++++++++++++++ htdocs/theme/phones/others/tpl/login.tpl | 180 ------------------- htdocs/theme/phones/others/tpl/login.tpl.php | 174 ++++++++++++++++++ 5 files changed, 319 insertions(+), 410 deletions(-) delete mode 100644 htdocs/theme/phones/iphone/tpl/login.tpl create mode 100644 htdocs/theme/phones/iphone/tpl/login.tpl.php delete mode 100644 htdocs/theme/phones/others/tpl/login.tpl create mode 100644 htdocs/theme/phones/others/tpl/login.tpl.php diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 2045a8b805d..0b13b3e23b8 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -44,33 +44,25 @@ function dol_loginfunction($langs,$conf,$mysoc) $main_authentication=$conf->file->main_authentication; $session_name=session_name(); + + $dol_url_root = DOL_URL_ROOT; $php_self = $_SERVER['PHP_SELF']; $php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:''; // Select templates $template_dir=DOL_DOCUMENT_ROOT.'/core/tpl/'; // Common case - if (! empty($conf->global->MAIN_USE_THEME_TEMPLATES)) // Disabled by default because make useless filsesystem calls that reduce speed. + if ($conf->browser->phone) { - if ($conf->browser->phone && ! empty($conf->global->MAIN_SMARTY)) + // Special cases + if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone)) { - // Special cases - if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone)) - { - $template_dir=DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone."/tpl/"; - } - else - { - $template_dir=DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/"; - } + $theme = 'default'; + $template_dir=DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone."/tpl/"; } else { - if ((! empty($conf->global->MAIN_SMARTY) && file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/login.tpl")) - || (empty($conf->global->MAIN_SMARTY) && file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/login.tpl.php"))) - { - $template_dir=DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/"; - } + $template_dir=DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/"; } } @@ -202,83 +194,8 @@ function dol_loginfunction($langs,$conf,$mysoc) $main_home=nl2br($conf->global->MAIN_HOME); $conf_css=DOL_URL_ROOT.$conf->css; - - - // START SMARTY - if ($conf->global->MAIN_SMARTY) - { - global $smarty; - - $smarty->template_dir=$template_dir; - - $smarty->assign('conf_css', $conf_css); - $smarty->assign('langs', $langs); - - if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER); - - $smarty->assign('php_self', $php_self); - $smarty->assign('character_set_client',$conf->file->character_set_client); - - $smarty->assign('theme', 'default'); - - $smarty->assign('dol_url_root', DOL_URL_ROOT); - - $smarty->assign('focus_element', $focus_element); - - $smarty->assign('login_background', $login_background); - - $smarty->assign('title', $title); - - $smarty->assign('login', $login); - $smarty->assign('password', $password); - - $smarty->assign('logo', $urllogo); - $smarty->assign('logo_width', $width); - $smarty->assign('logo_rowspan', $rowspan); - - $smarty->assign('select_entity', $select_entity); - $smarty->assign('captcha', $captcha); - $smarty->assign('captcha_refresh', $captcha_refresh); - - $smarty->assign('forgetpasslink', $forgetpasslink); - $smarty->assign('helpcenterlink', $helpcenterlink); - - $smarty->assign('main_home', $main_home); - - // Google Adsense (ex: demo mode) - if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) - { - $smarty->assign('main_google_ad_client', $conf->global->MAIN_GOOGLE_AD_CLIENT); - $smarty->assign('main_google_ad_name', $conf->global->MAIN_GOOGLE_AD_NAME); - $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_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT); - - $google_ad_template = DOL_DOCUMENT_ROOT."/core/tpl/google_ad.tpl"; - $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); - $smarty->assign('main_authentication', $main_authentication); - $smarty->assign('session_name', $session_name); - - // Message - if (! empty($_SESSION["dol_loginmesg"])) - { - $smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]); - } - - // Creation du template - $smarty->display('login.tpl'); // To use Smarty - // Suppression de la version compilee - $smarty->clear_compiled_tpl('login.tpl'); - - // END SMARTY - } - else - { - include($template_dir.'login.tpl.php'); // To use native PHP - } + + include($template_dir.'login.tpl.php'); // To use native PHP $_SESSION["dol_loginmesg"] = ''; } diff --git a/htdocs/theme/phones/iphone/tpl/login.tpl b/htdocs/theme/phones/iphone/tpl/login.tpl deleted file mode 100644 index 687404d1913..00000000000 --- a/htdocs/theme/phones/iphone/tpl/login.tpl +++ /dev/null @@ -1,137 +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} - - - - - - - - -{$title} - - - - - - - - - - -
-
{$title}
-
- -
-
- - - -
- -
- -
- - {$langs->trans('Identification')} -
    -
  • - -
  • - -
  • - -
  • - -
- - {if $select_entity} - {$langs->trans('Entity')} -
    -
  • - {$select_entity} - -
  • -
- {/if} - - {if $captcha} - {$langs->trans('SecurityCode')} -
    -
  • - - - - -
  • -
- {/if} - -
    -
  • - -
  • -
- -
-
- -{if $forgetpasslink || $helpcenterlink} - {$langs->trans('Tools')} - - {if $forgetpasslink} - - {/if} - -{/if} - -{if $dol_loginmesg} - -{/if} - - - - - \ No newline at end of file diff --git a/htdocs/theme/phones/iphone/tpl/login.tpl.php b/htdocs/theme/phones/iphone/tpl/login.tpl.php new file mode 100644 index 00000000000..44e10ce7855 --- /dev/null +++ b/htdocs/theme/phones/iphone/tpl/login.tpl.php @@ -0,0 +1,135 @@ + + * + * 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 $title; ?> + + + + + + + + + + +
+
+
+ +
+
+ + + +
+ +
+ +
+ + trans('Identification'); ?> +
    +
  • + +
  • + +
  • + +
  • + +
+ + + trans('Entity'); ?> +
    +
  • + + +
  • +
+ + + + trans('SecurityCode'); ?> +
    +
  • + + + /> + +
  • +
+ + +
    +
  • + +
  • +
+ +
+
+ + + trans('Tools'); ?> + + + + + + + + + + + + + \ No newline at end of file diff --git a/htdocs/theme/phones/others/tpl/login.tpl b/htdocs/theme/phones/others/tpl/login.tpl deleted file mode 100644 index c65a07ac5dd..00000000000 --- a/htdocs/theme/phones/others/tpl/login.tpl +++ /dev/null @@ -1,180 +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 $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} -
- {include file=$google_ad_tpl} -
- {/if} - - - - - - {if $main_html_footer} - {$main_html_footer} - {/if} - - - - - \ No newline at end of file diff --git a/htdocs/theme/phones/others/tpl/login.tpl.php b/htdocs/theme/phones/others/tpl/login.tpl.php new file mode 100644 index 00000000000..091b804da46 --- /dev/null +++ b/htdocs/theme/phones/others/tpl/login.tpl.php @@ -0,0 +1,174 @@ + + * + * 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('Login'); ?> + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'; +} +?> + + + + + +
+ + +
+ +
+ + + +
+
+ +

+ + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file