mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Can disabled output of notify messages
This commit is contained in:
parent
1a49a2bb94
commit
9e382a7f1b
|
|
@ -2241,17 +2241,9 @@ function dol_print_ip($ip,$mode=0)
|
|||
|
||||
if (empty($mode)) $ret.=$ip;
|
||||
|
||||
if (! empty($conf->geoipmaxmind->enabled) && $mode != 2)
|
||||
if ($mode != 2)
|
||||
{
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
$geoip=new DolGeoIP('country',$datafile);
|
||||
//print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
|
||||
//print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
|
||||
$countrycode=$geoip->getCountryCodeFromIP($ip);
|
||||
$countrycode=dolGetCountryCodeFromIp($ip);
|
||||
if ($countrycode) // If success, countrycode is us, fr, ...
|
||||
{
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/common/flags/'.$countrycode.'.png'))
|
||||
|
|
@ -2265,6 +2257,35 @@ function dol_print_ip($ip,$mode=0)
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a country code from IP. Empty string if not found.
|
||||
*
|
||||
* @param string $ip IP
|
||||
* @return string Country code ('us', 'fr', ...)
|
||||
*/
|
||||
function dolGetCountryCodeFromIp($ip)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$countrycode='';
|
||||
|
||||
if (! empty($conf->geoipmaxmind->enabled))
|
||||
{
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
$geoip=new DolGeoIP('country',$datafile);
|
||||
//print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
|
||||
//print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
|
||||
$countrycode=$geoip->getCountryCodeFromIP($ip);
|
||||
}
|
||||
|
||||
return $countrycode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return country code for current user.
|
||||
* If software is used inside a local network, detection may fails (we need a public ip)
|
||||
|
|
@ -5746,26 +5767,27 @@ function setEventMessages($mesg, $mesgs, $style='mesgs')
|
|||
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
|
||||
* no need to call it explicitely.
|
||||
*
|
||||
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them
|
||||
* @return void
|
||||
* @see dol_htmloutput_mesg
|
||||
* @see dol_htmloutput_mesg
|
||||
*/
|
||||
function dol_htmloutput_events()
|
||||
function dol_htmloutput_events($disabledoutputofmessages=0)
|
||||
{
|
||||
// Show mesgs
|
||||
if (isset($_SESSION['dol_events']['mesgs'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']);
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']);
|
||||
unset($_SESSION['dol_events']['mesgs']);
|
||||
}
|
||||
|
||||
// Show errors
|
||||
if (isset($_SESSION['dol_events']['errors'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error');
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error');
|
||||
unset($_SESSION['dol_events']['errors']);
|
||||
}
|
||||
|
||||
// Show warnings
|
||||
if (isset($_SESSION['dol_events']['warnings'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning');
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning');
|
||||
unset($_SESSION['dol_events']['warnings']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1090,8 +1090,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||
print "<head>\n";
|
||||
if (GETPOST('dol_basehref','alpha')) print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref','alpha')).'">'."\n";
|
||||
// Displays meta
|
||||
print '<meta name="robots" content="noindex'.($disablenofollow?'':',nofollow').'">'."\n"; // Do not index
|
||||
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; // Scale for mobile device
|
||||
print '<meta name="robots" content="noindex'.($disablenofollow?'':',nofollow').'">'."\n"; // Do not index
|
||||
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
|
||||
print '<meta name="author" content="Dolibarr Development Team">'."\n";
|
||||
// Favicon
|
||||
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
|
||||
|
|
@ -1874,17 +1874,18 @@ if (! function_exists("llxFooter"))
|
|||
* Close div /DIV class=fiche + /DIV id-right + /DIV id-container + /BODY + /HTML.
|
||||
* If global var $delayedhtmlcontent was filled, we output it just before closing the body.
|
||||
*
|
||||
* @param string $comment A text to add as HTML comment into HTML generated page
|
||||
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
|
||||
* @param string $comment A text to add as HTML comment into HTML generated page
|
||||
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
|
||||
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them
|
||||
* @return void
|
||||
*/
|
||||
function llxFooter($comment='',$zone='private')
|
||||
function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0)
|
||||
{
|
||||
global $conf, $langs, $user, $object;
|
||||
global $delayedhtmlcontent;
|
||||
|
||||
// Global html output events ($mesgs, $errors, $warnings)
|
||||
dol_htmloutput_events();
|
||||
dol_htmloutput_events($disabledoutputofmessages);
|
||||
|
||||
// Code for search criteria persistence.
|
||||
// Save $user->lastsearch_values if defined (define on list pages when a form field search_xxx exists)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user