/** * Show Dolibarr default login page * @param langs Lang object (must be initialized by a new). * @param conf Conf object * @param mysoc Company object */ function dol_loginfunction($langs,$conf,$mysoc) { global $dolibarr_main_demo,$db; global $smartphone; $langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang')); $langs->setDefaultLang($langcode); $langs->load("main"); $langs->load("other"); $langs->load("help"); $langs->load("admin"); $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"]:''; // Title $title='Dolibarr '.DOL_VERSION; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; // Select templates if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone)) { $template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/'; } else { if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/login.tpl.php")) { $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/"; } else { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } } $conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang; $conf_css = DOL_URL_ROOT.$conf->css; // Set cookie for timeout management $prefix=dol_getprefix(); $sessiontimeout='DOLSESSTIMEOUT_'.$prefix; if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0); if (GETPOST("urlfrom")) $_SESSION["urlfrom"]=GETPOST("urlfrom"); else unset($_SESSION["urlfrom"]); if (! GETPOST("username")) $focus_element='username'; else $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')) { $login_background=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'; } $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)) { $prefix=dol_getprefix(); $entityCookieName = 'DOLENTITYID_'.$prefix; if (isset($_COOKIE[$entityCookieName])) { include_once(DOL_DOCUMENT_ROOT . "/core/class/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 $login = (!empty($lastuser)?$lastuser:(GETPOST("username")?GETPOST("username"):$demologin)); $password = $demopassword; // 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?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); } elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&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'; } // Entity field $select_entity=''; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX)) { $rowspan++; $res=dol_include_once('/multicompany/class/actions_multicompany.class.php'); if ($res) { $mc = new ActionsMulticompany($db); $select_entity=$mc->select_entities($lastentity, 'tabindex="3"'); } } // Security graphical code $captcha=0; $captcha_refresh=''; if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { $captcha=1; $captcha_refresh=img_refresh(); } // Extra link $forgetpasslink=0; $helpcenterlink=0; if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) { if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { $forgetpasslink=1; } if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) { $helpcenterlink=1; } } // Home message if (! empty($conf->global->MAIN_HOME)) { $i=0; while (preg_match('/__\(([a-zA-Z]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100) { $conf->global->MAIN_HOME=preg_replace('/__\('.$reg[1].'\)__/i',$langs->trans($reg[1]),$conf->global->MAIN_HOME); $i++; } } $main_home=dol_htmlcleanlastbr($conf->global->MAIN_HOME); // Google AD $main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0); $dol_loginmesg = $_SESSION["dol_loginmesg"]; include($template_dir.'login.tpl.php'); // To use native PHP $_SESSION["dol_loginmesg"] = ''; }
/** * Load setup values into conf object (read llx_const) * @param $db Handler d'acces base * @return int < 0 if KO, >= 0 if OK */ function setValues($db) { dol_syslog("Conf::setValues"); // Directory of core triggers $this->triggers_modules[] = "/includes/triggers"; // Default relative path to triggers file // Avoid warning if not defined if (empty($this->db->dolibarr_main_db_encryption)) $this->db->dolibarr_main_db_encryption=0; if (empty($this->db->dolibarr_main_db_cryptkey)) $this->db->dolibarr_main_db_cryptkey=''; /* * Definition de toutes les constantes globales d'environnement * - En constante php (TODO a virer) * - En $this->global->key=value */ $sql = "SELECT ".$db->decrypt('name')." as name,"; $sql.= " ".$db->decrypt('value')." as value, entity"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE entity IN (0,".$this->entity.")"; $sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. $result = $db->query($sql); if ($result) { $numr = $db->num_rows($result); $multicompany_sharing=array(); $i = 0; while ($i < $numr) { $objp = $db->fetch_object($result); $key=$objp->name; $value=$objp->value; if ($key) { if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install) $this->global->$key=$value; if ($value && preg_match('/^MAIN_MODULE_/',$key)) { // If this is constant for a css file activated by a module if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key)) { $this->css_modules[]=$value; } // If this is constant for a new tab page activated by a module elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TABS_/i',$key)) { $params=explode(':',$value,2); $this->tabs_modules[$params[0]][]=$value; //print 'xxx'.$params[0].'-'.$value; } // If this is constant for triggers activated by a module elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$reg)) { $modulename = strtolower($reg[1]); $this->triggers_modules[] = '/'.$modulename.'/includes/triggers/'; } // If this is constant for login method activated by a module elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_LOGIN_METHOD$/i',$key,$reg)) { $modulename = strtolower($reg[1]); $this->login_method_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/includes/login/'; } // If this is constant for hook activated by a module. Value is list of hooked tabs separated with : elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg)) { $modulename = strtolower($reg[1]); $params=explode(':',$value); foreach($params as $value) { $this->hooks_modules[$modulename][]=$value; } } // If this is constant for a smarty need by a module elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$/i',$key,$reg)) { $module=strtolower($reg[1]); // Add this module in list of modules that need smarty $this->need_smarty[]=$module; } // If this is constant for a sms engine elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_SMS$/i',$key,$reg)) { $module=strtolower($reg[1]); // Add this module in list of modules that need smarty $this->sms_engine[$module]=$module; } // If this is a module constant elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg)) { $module=strtolower($reg[1]); //print "Module ".$module." is enabled<br>\n"; $this->$module->enabled=true; // Add this module in list of enabled modules $this->modules[]=$module; } } // Sharings between entities else if ($value && preg_match('/^MULTICOMPANY_([A-Z_]+)_SHARING$/',$key,$reg)) { $module=strtolower($reg[1]); $multicompany_sharing[$module]=$value; } } $i++; } // Sharings between entities if (isset($this->multicompany->enabled) && $this->multicompany->enabled && ! empty($multicompany_sharing)) { $ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); if ($ret) { $mc = new ActionsMulticompany($db); foreach($multicompany_sharing as $key => $value) { $this->entities[$key]=$mc->check_entity($value); } } } } $db->free($result); //var_dump($this->modules); // Clean some variables if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php"; if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_frontoffice.php"; if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_backoffice.php"; // Use eldy by default because smartphone does not work on all phones if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_frontoffice.php"; // Ue eldy by default because smartphone does not work on all phones // Variable globales LDAP if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME=''; if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME; if (! isset($this->global->LDAP_KEY_GROUPS)) $this->global->LDAP_KEY_GROUPS=$this->global->LDAP_FIELD_FULLNAME; if (! isset($this->global->LDAP_KEY_CONTACTS)) $this->global->LDAP_KEY_CONTACTS=$this->global->LDAP_FIELD_FULLNAME; if (! isset($this->global->LDAP_KEY_MEMBERS)) $this->global->LDAP_KEY_MEMBERS=$this->global->LDAP_FIELD_FULLNAME; // Load translation object with current language if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; // By default, we repeat info on all tabs if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1; $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; // If multicompany module is enabled, we redefine the root of data if (! empty($this->global->MAIN_MODULE_MULTICOMPANY) && ! empty($this->entity) && $this->entity > 1) $rootfordata.='/'.$this->entity; // For backward compatibility // TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code if (isset($this->comptabilite->enabled)) $this->compta->enabled=$this->comptabilite->enabled; if (isset($this->propale->enabled)) $this->propal->enabled=$this->propale->enabled; // Define default dir_output and dir_temp for directories of modules foreach($this->modules as $module) { $this->$module->dir_output=$rootfordata."/".$module; $this->$module->dir_temp=$rootfordata."/".$module."/temp"; } // For mycompany setup $this->mycompany->dir_output=$rootfordata."/mycompany"; $this->mycompany->dir_temp=$rootfordata."/mycompany/temp"; // For admin features $this->admin->dir_output=$rootfordata.'/admin'; $this->admin->dir_temp=$rootfordata.'/admin/temp'; // Module user $this->user->dir_output=$rootforuser."/users"; $this->user->dir_temp=$rootforuser."/users/temp"; // Exception: Some dir are not the name of module. So we keep exception here // for backward compatibility. // Sous module bons d'expedition $this->expedition_bon->enabled=defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0; // Sous module bons de livraison $this->livraison_bon->enabled=defined("MAIN_SUBMODULE_LIVRAISON")?MAIN_SUBMODULE_LIVRAISON:0; // Module fournisseur $this->fournisseur->commande->dir_output=$rootfordata."/fournisseur/commande"; $this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp"; $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; // Module product/service $this->product->dir_output=$rootfordata."/produit"; $this->product->dir_temp =$rootfordata."/produit/temp"; $this->service->dir_output=$rootfordata."/produit"; $this->service->dir_temp =$rootfordata."/produit/temp"; // Module contrat $this->contrat->dir_output=$rootfordata."/contracts"; $this->contrat->dir_temp=$rootfordata."/contracts/temp"; /* * Set some default values */ // societe if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; // Security if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask // conf->box_max_lines $this->box_max_lines=5; if (isset($this->global->MAIN_BOXES_MAXLINES)) $this->box_max_lines=$this->global->MAIN_BOXES_MAXLINES; // conf->use_preview_tabs $this->use_preview_tabs=0; if (isset($this->global->MAIN_USE_PREVIEW_TABS)) $this->use_preview_tabs=$this->global->MAIN_USE_PREVIEW_TABS; // conf->use_javascript_ajax $this->use_javascript_ajax=1; if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT; // If no javascript_ajax, Ajax features are disabled. if (! $this->use_javascript_ajax) { $this->global->PRODUIT_USE_SEARCH_TO_SELECT=0; } // conf->monnaie if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; $this->monnaie=$this->global->MAIN_MONNAIE; // TODO deprecated $this->currency=$this->global->MAIN_MONNAIE; // $this->compta->mode = Option du module Comptabilite (simple ou expert): // Defini le mode de calcul des etats comptables (CA,...) $this->compta->mode = 'RECETTES-DEPENSES'; // By default if (isset($this->global->COMPTA_MODE)) $this->compta->mode = $this->global->COMPTA_MODE; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' // $this->liste_limit = constante de taille maximale des listes if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; // $this->product->limit_size = constante de taille maximale des select de produit if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100; $this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE; // $this->theme et $this->css if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy"; $this->theme=$this->global->MAIN_THEME; $this->css = "/theme/".$this->theme."/style.css.php"; // $this->email_from = email pour envoi par dolibarr des mails automatiques $this->email_from = "*****@*****.**"; if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; // $this->notification->email_from = email pour envoi par Dolibarr des notifications $this->notification->email_from=$this->email_from; if (! empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from=$this->global->NOTIFICATION_EMAIL_FROM; // $this->mailing->email_from = email pour envoi par Dolibarr des mailings $this->mailing->email_from=$this->email_from; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; // Defini MAIN_GRAPH_LIBRARY if (empty($this->global->MAIN_GRAPH_LIBRARY)) $this->global->MAIN_GRAPH_LIBRARY = 'artichow'; if (! isset($this->global->FCKEDITOR_EDITORNAME)) $this->global->FCKEDITOR_EDITORNAME='ckeditor'; // fckeditor to switch // Format for date (used by default when not found or searched in lang) $this->format_date_short="%d/%m/%Y"; # Format of day with PHP/C tags (strftime functions) $this->format_date_short_java="dd/MM/yyyy"; # Format of day with Java tags $this->format_hour_short="%H:%M"; $this->format_hour_short_duration="%H:%M"; $this->format_date_text_short="%d %b %Y"; $this->format_date_text="%d %B %Y"; $this->format_date_hour_short="%d/%m/%Y %H:%M"; $this->format_date_hour_text_short="%d %b %Y %H:%M"; $this->format_date_hour_text="%d %B %Y %H:%M"; // Limites decimales si non definie (peuvent etre egale a 0) if (! isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT=5; if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2; if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8; // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30; // Set default variable to calculate VAT as if option tax_mode was 0 (standard) if (empty($this->global->TAX_MODE_SELL_PRODUCT)) $this->global->TAX_MODE_SELL_PRODUCT='invoice'; if (empty($this->global->TAX_MODE_BUY_PRODUCT)) $this->global->TAX_MODE_BUY_PRODUCT='invoice'; if (empty($this->global->TAX_MODE_SELL_SERVICE)) $this->global->TAX_MODE_SELL_SERVICE='payment'; if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE='payment'; /* We always show vat menus if module tax is enabled. * Because even when vat option is 'franchise' and vat rate is 0, we have to pay vat. */ $this->compta->tva=1; // This option means "Show vat menus" // Delay before warnings $this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; $this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60; $this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60; $this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60; $this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60; $this->facture->client->warning_delay=(isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED)?$this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED:0)*24*60*60; $this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60; $this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60; $this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60; $this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; $this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60; $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; // For backward compatibility $this->produit=$this->product; // Define menu manager in setup if (empty($user->societe_id)) // If internal user or not defined { $this->top_menu=(empty($this->global->MAIN_MENU_STANDARD_FORCED)?$this->global->MAIN_MENU_STANDARD:$this->global->MAIN_MENU_STANDARD_FORCED); $this->smart_menu=(empty($this->global->MAIN_MENU_SMARTPHONE_FORCED)?$this->global->MAIN_MENU_SMARTPHONE:$this->global->MAIN_MENU_SMARTPHONE_FORCED); } else // If external user { $this->top_menu=(empty($this->global->MAIN_MENUFRONT_STANDARD_FORCED)?$this->global->MAIN_MENUFRONT_STANDARD:$this->global->MAIN_MENUFRONT_STANDARD_FORCED); $this->smart_menu=(empty($this->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$this->global->MAIN_MENUFRONT_SMARTPHONE:$this->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); } // For backward compatibility if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php'; elseif ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_backoffice.php'; }
$entityCookieName = 'DOLENTITYID_'.$prefix; if (isset($_COOKIE[$entityCookieName])) { include_once(DOL_DOCUMENT_ROOT . "/core/class/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); } } $res=dol_include_once('/multicompany/class/actions_multicompany.class.php'); if ($res) { $mc = new ActionsMulticompany($db); $select_entity = $mc->select_entities($lastentity,'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 ?>
/** * Show an HTML header + a BODY + The top menu bar * @param head Lines in the HEAD * @param title Title of web page * @param target Target to use in menu links * @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) * @param disablehead Do not output head section * @param arrayofjs Array of js files to add in header * @param arrayofcss Array of css files to add in header * @param morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) */ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '') { global $user, $conf, $langs, $db, $dolibarr_main_authentication; $html = new Form($db); if (!$conf->top_menu) { $conf->top_menu = 'eldy_backoffice.php'; } // For backward compatibility with old modules if (empty($conf->headerdone)) { top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); } print '<body id="mainbody">'; if ($conf->use_javascript_ajax) { if ($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) { print '<script type="text/javascript"> jQuery(document).ready(function () { jQuery("body").layout( layoutSettings ); }); var layoutSettings = { name: "mainlayout", defaults: { useStateCookie: true, size: "auto", resizable: false, //paneClass: "none", //resizerClass: "resizer", //togglerClass: "toggler", //buttonClass: "button", //contentSelector: ".content", //contentIgnoreSelector: "span", togglerTip_open: "Close This Pane", togglerTip_closed: "Open This Pane", resizerTip: "Resize This Pane" }, west: { paneClass: "leftContent", spacing_closed: 14, togglerLength_closed: 14, togglerAlign_closed: "top", //togglerLength_open: 0, // effect defaults - overridden on some panes //slideTrigger_open: "mouseover", //initClosed: true, fxName: "drop", fxSpeed: "normal", fxSettings: { easing: "" } }, north: { paneClass: "none", resizerClass: "none", togglerClass: "none", spacing_open: 0, togglerLength_open: 0, togglerLength_closed: -1, slidable: false, fxName: "none" }, center: { paneSelector: "#mainContent" } } </script>'; } if (!empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION)) { print "\n" . '<script type="text/javascript"> jQuery(document).ready(function () { jQuery( ".vmenu" ).accordion({ autoHeight: false, event: "mouseover", //collapsible: true, //active: 2, header: "> .blockvmenupair > .menu_titre" }); }); </script>'; } // Wrapper to show tooltips print "\n" . '<script type="text/javascript"> jQuery(document).ready(function () { jQuery(function() { $(".classfortooltip").tipTip({maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50}); }); }); </script>'; } /* * Top menu */ $top_menu = isset($conf->browser->phone) ? $conf->smart_menu : $conf->top_menu; if (GETPOST('menu')) { $top_menu = GETPOST('menu'); } // menu=eldy_backoffice.php // Load the top menu manager $result = dol_include_once("/includes/menus/standard/" . $top_menu); if (!$result) { $top_menu = 'eldy_backoffice.php'; include_once DOL_DOCUMENT_ROOT . "/includes/menus/standard/" . $top_menu; } print "\n" . '<!-- Start top horizontal menu ' . $top_menu . ' -->' . "\n"; if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) { print '<div class="ui-layout-north"> <!-- Begin top layout -->' . "\n"; } print '<div id="tmenu_tooltip" class="tmenu">' . "\n"; // Show menu $menutop = new MenuTop($db); $menutop->atarget = $target; $menutop->showmenu(); // This contains a \n print "</div>\n"; // Link to login card $loginhtmltext = ''; $logintext = ''; if ($user->societe_id) { $thirdpartystatic = new Societe($db); $thirdpartystatic->fetch($user->societe_id); $companylink = ' (' . $thirdpartystatic->getNomUrl('', '') . ')'; $company = ' (' . $langs->trans("Company") . ': ' . $thirdpartystatic->name . ')'; } $logintext = '<div class="login"><a href="' . DOL_URL_ROOT . '/user/fiche.php?id=' . $user->id . '"'; $logintext .= $menutop->atarget ? ' target="' . $menutop->atarget . '"' : ''; $logintext .= '>' . $user->login . '</a>'; if ($user->societe_id) { $logintext .= $companylink; } $logintext .= '</div>'; $loginhtmltext .= '<u>' . $langs->trans("User") . '</u>'; $loginhtmltext .= '<br><b>' . $langs->trans("Name") . '</b>: ' . $user->getFullName($langs); $loginhtmltext .= '<br><b>' . $langs->trans("Login") . '</b>: ' . $user->login; $loginhtmltext .= '<br><b>' . $langs->trans("Administrator") . '</b>: ' . yn($user->admin); $type = $user->societe_id ? $langs->trans("External") . $company : $langs->trans("Internal"); $loginhtmltext .= '<br><b>' . $langs->trans("Type") . '</b>: ' . $type; $loginhtmltext .= '<br><b>' . $langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"]; $loginhtmltext .= '<br>'; $loginhtmltext .= '<br><u>' . $langs->trans("Connection") . '</u>'; if ($conf->global->MAIN_MODULE_MULTICOMPANY) { $loginhtmltext .= '<br><b>' . $langs->trans("ConnectedOnMultiCompany") . '</b>: ' . $conf->entity . ' (user entity ' . $user->entity . ')'; } $loginhtmltext .= '<br><b>' . $langs->trans("ConnectedSince") . '</b>: ' . dol_print_date($user->datelastlogin, "dayhour"); $loginhtmltext .= '<br><b>' . $langs->trans("PreviousConnexion") . '</b>: ' . dol_print_date($user->datepreviouslogin, "dayhour"); $loginhtmltext .= '<br><b>' . $langs->trans("AuthenticationMode") . '</b>: ' . $_SESSION["dol_authmode"]; $loginhtmltext .= '<br><b>' . $langs->trans("CurrentTheme") . '</b>: ' . $conf->theme; $s = picto_from_langcode($langs->getDefaultLang()); $loginhtmltext .= '<br><b>' . $langs->trans("CurrentUserLanguage") . '</b>: ' . ($s ? $s . ' ' : '') . $langs->getDefaultLang(); $loginhtmltext .= '<br><b>' . $langs->trans("Browser") . '</b>: ' . $conf->browser->name . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')'; if (!empty($conf->browser->phone)) { $loginhtmltext .= '<br><b>' . $langs->trans("Phone") . '</b>: ' . $conf->browser->phone; } if (!empty($_SESSION["disablemodules"])) { $loginhtmltext .= '<br><b>' . $langs->trans("DisabledModules") . '</b>: <br>' . join(', ', explode(',', $_SESSION["disablemodules"])); } // Link info $logouthtmltext = ''; $logouttext = ''; $logouthtmltext = $langs->trans("Logout") . '<br>'; //$logouthtmltext.="<br>"; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $logouttext .= '<a href="' . DOL_URL_ROOT . '/user/logout.php"'; $logouttext .= $menutop->atarget ? ' target="' . $menutop->atarget . '"' : ''; $logouttext .= '>'; $logouttext .= '<img class="login" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/logout.png"'; $logouttext .= ' alt="' . dol_escape_htmltag($langs->trans("Logout")) . '" title=""'; $logouttext .= '>'; $logouttext .= '</a>'; } else { $logouttext .= '<img class="login" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/logout.png"'; $logouttext .= ' alt="' . dol_escape_htmltag($langs->trans("Logout")) . '" title=""'; $logouttext .= '>'; } print '<div class="login_block">' . "\n"; print '<table class="nobordernopadding" summary=""><tr>'; print $html->textwithtooltip('', $loginhtmltext, 2, 1, $logintext, '', 1); // Select entity if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { if ($user->admin && !$user->entity) { $res = @dol_include_once('/multicompany/class/actions_multicompany.class.php'); if ($res) { $mc = new ActionsMulticompany($db); $mc->showInfo($conf->entity); } } } print $html->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, '', 1); // Link to print main content area if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->browser->phone)) { $qs = $_SERVER["QUERY_STRING"] . ($_SERVER["QUERY_STRING"] ? '&' : '') . $morequerystring; $text = '<a href="' . $_SERVER["PHP_SELF"] . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">'; $text .= '<img class="printer" border="0" width="14" height="14" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/printer.png"'; $text .= ' title="" alt="">'; $text .= '</a>'; print $html->textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, '', 1); } print '</tr></table>' . "\n"; print "</div>\n"; if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) { print "</div><!-- End top layout -->\n"; } print "<!-- End top horizontal menu -->\n"; if (!$conf->use_javascript_ajax || !$conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) { print '<table width="100%" class="notopnoleftnoright" summary="leftmenutable" id="undertopmenu"><tr>'; } }