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($mode)) $ret.=$ip;
|
||||||
|
|
||||||
if (! empty($conf->geoipmaxmind->enabled) && $mode != 2)
|
if ($mode != 2)
|
||||||
{
|
{
|
||||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
$countrycode=dolGetCountryCodeFromIp($ip);
|
||||||
//$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);
|
|
||||||
if ($countrycode) // If success, countrycode is us, fr, ...
|
if ($countrycode) // If success, countrycode is us, fr, ...
|
||||||
{
|
{
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/common/flags/'.$countrycode.'.png'))
|
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 $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.
|
* Return country code for current user.
|
||||||
* If software is used inside a local network, detection may fails (we need a public ip)
|
* 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
|
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
|
||||||
* no need to call it explicitely.
|
* no need to call it explicitely.
|
||||||
*
|
*
|
||||||
|
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them
|
||||||
* @return void
|
* @return void
|
||||||
* @see dol_htmloutput_mesg
|
* @see dol_htmloutput_mesg
|
||||||
*/
|
*/
|
||||||
function dol_htmloutput_events()
|
function dol_htmloutput_events($disabledoutputofmessages=0)
|
||||||
{
|
{
|
||||||
// Show mesgs
|
// Show mesgs
|
||||||
if (isset($_SESSION['dol_events']['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']);
|
unset($_SESSION['dol_events']['mesgs']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show errors
|
// Show errors
|
||||||
if (isset($_SESSION['dol_events']['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']);
|
unset($_SESSION['dol_events']['errors']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show warnings
|
// Show warnings
|
||||||
if (isset($_SESSION['dol_events']['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']);
|
unset($_SESSION['dol_events']['warnings']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1090,8 +1090,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
print "<head>\n";
|
print "<head>\n";
|
||||||
if (GETPOST('dol_basehref','alpha')) print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref','alpha')).'">'."\n";
|
if (GETPOST('dol_basehref','alpha')) print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref','alpha')).'">'."\n";
|
||||||
// Displays meta
|
// Displays meta
|
||||||
print '<meta name="robots" content="noindex'.($disablenofollow?'':',nofollow').'">'."\n"; // Do not index
|
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="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
|
||||||
print '<meta name="author" content="Dolibarr Development Team">'."\n";
|
print '<meta name="author" content="Dolibarr Development Team">'."\n";
|
||||||
// Favicon
|
// Favicon
|
||||||
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
|
$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.
|
* 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.
|
* 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 $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 $zone 'private' (for private pages) or 'public' (for public pages)
|
||||||
|
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function llxFooter($comment='',$zone='private')
|
function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user, $object;
|
global $conf, $langs, $user, $object;
|
||||||
global $delayedhtmlcontent;
|
global $delayedhtmlcontent;
|
||||||
|
|
||||||
// Global html output events ($mesgs, $errors, $warnings)
|
// Global html output events ($mesgs, $errors, $warnings)
|
||||||
dol_htmloutput_events();
|
dol_htmloutput_events($disabledoutputofmessages);
|
||||||
|
|
||||||
// Code for search criteria persistence.
|
// Code for search criteria persistence.
|
||||||
// Save $user->lastsearch_values if defined (define on list pages when a form field search_xxx exists)
|
// 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