From d7c2bdba384fbe2627664a99198a26ec742afbab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Jan 2017 16:42:59 +0100 Subject: [PATCH] Fix: link was useless with a nofollow tag. --- htdocs/core/lib/security.lib.php | 5 +++-- htdocs/core/tpl/login.tpl.php | 15 +++++++++++++-- htdocs/main.inc.php | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4cfc077f0be..ced20a79ea6 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -339,7 +339,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu } /** - * Check access by user to object + * Check access by user to object. + * This function is also called by restrictedArea * * @param User $user User to check * @param array $featuresarray Features/modules to check @@ -348,8 +349,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) - * * @return bool True if user has access, False otherwise + * @see restrictedArea */ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='rowid') { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a9d7c73ae1a..b3a2ced1023 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +// Need global variable $title to be defined + header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -35,7 +37,10 @@ $arrayofjs=array( ); $titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. -print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs); +$disablenofollow=1; +if (! preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow=0; + +print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow); ?> @@ -71,7 +76,13 @@ $(document).ready(function () { - +
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8aba2e428f2..a18840f131c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -993,9 +993,10 @@ function top_httphead() * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files * @param int $disablejmobile Disable jmobile + * @param int $disablenofollow Disable no follow tag * @return void */ -function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0) +function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0) { global $user, $conf, $langs, $db; @@ -1017,7 +1018,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print "\n"; if (GETPOST('dol_basehref')) print ''."\n"; // Displays meta - print ''."\n"; // Do not index + print ''."\n"; // Do not index print ''; // Scale for mobile device print ''."\n"; $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);