diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index 3d1fb6af478..6e234c1145f 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -26,6 +26,8 @@ * \brief Page de configuration du module externalsite */ +if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -50,7 +52,7 @@ if ($action == 'update') $db->begin(); $label = GETPOST('EXTERNALSITE_LABEL','alpha'); - $exturl = GETPOST('EXTERNALSITE_URL','alpha'); + $exturl = GETPOST('EXTERNALSITE_URL','none'); $i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity); @@ -104,9 +106,12 @@ print ""; print ''; print ''.$langs->trans("ExternalSiteURL").""; -print "global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL)) . "\" size=\"40\">"; +print ''; print "http://localhost/myurl/"; -print "
http://wikipedia.org/"; +print "
https://wikipedia.org/"; +print "
<iframe>...</iframe>"; print ""; print ""; diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 6005b8e55b6..383bfb0228e 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2018 Laurent Destailleur * * 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 @@ -17,55 +17,104 @@ */ /** - * \file htdocs/externalsite/frames.php - * \ingroup externalsite - * \brief Page that build two frames: One for menu, the other for the target page to show - * \author Laurent Destailleur + * \file htdocs/externalsite/frames.php + * \ingroup externalsite + * \brief Page that build two frames: One for menu, the other for the target page to show + * Usage: + * mydomain.com/externalsite/frames.php to show URL set into setup + * mydomain.com/externalsite/frames.php?keyforcontent to show content defined into conf->global->$keyforcontent */ require '../main.inc.php'; $langs->load("externalsite"); -if (empty($conf->global->EXTERNALSITE_URL)) -{ - llxHeader(); - print '
'.$langs->trans('ExternalSiteModuleNotComplete').'
'; - llxFooter(); -} $mainmenu=GETPOST('mainmenu', "aZ09"); $leftmenu=GETPOST('leftmenu', "aZ09"); $idmenu=GETPOST('idmenu', 'int'); $theme=GETPOST('theme', 'alpha'); $codelang=GETPOST('lang', 'aZ09'); - -print " - - -Dolibarr frame for external web site - - -global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0> - - global->EXTERNALSITE_URL."\"> - - <body> - - </body> - - - - -<body> - <br><div class=\"center\"> - Sorry, your browser is too old or not correctly configured to view this area.<br> - Your browser must support frames.<br> - </div> -</body> - - - -"; +$keyforcontent = GETPOST('keyforcontent', 'aZ09'); +/* + * View + */ + +if (empty($keyforcontent) && empty($conf->global->EXTERNALSITE_URL)) +{ + llxHeader(); + print '
'.$langs->trans('ExternalSiteModuleNotComplete').'
'; + llxFooter(); +} + +if (! empty($keyforcontent)) +{ + llxHeader(); + + print '
'; + + if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) + { + $langs->load("errors"); + print $langs->trans("Variablekeyforcontentmustbenamed", 'EXTERNAL_SITE_CONTENT_'); + } + else if (empty($conf->global->$keyforcontent)) + { + $langs->load("errors"); + print $langs->trans("ErrorNoContentDefinedIntoVar", $keyforcontent); + } + else + { + print $conf->global->$keyforcontent; + } + + print '
'; + llxFooter(); +} +else +{ + if (preg_match('/^\//', $conf->global->EXTERNALSITE_URL) || preg_match('/^http/i', $conf->global->EXTERNALSITE_URL)) + { + print " + + + Dolibarr frame for external web site + + + global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0> + + "; + print ''; + print " + + <body> + + </body> + + + + + <body> + <br><div class=\"center\"> + Sorry, your browser is too old or not correctly configured to view this area.<br> + Your browser must support frames.<br> + </div> + </body> + + + + "; + } + else + { + llxHeader(); + print '
'; + print $conf->global->EXTERNALSITE_URL; + print '
'; + llxFooter(); + } +} diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 95910558311..03d1ccdd8a7 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3206,6 +3206,20 @@ a.impayee:active { font-weight: bold; color: #550000; } a.impayee:hover { font-weight: bold; color: #550000; } +/* + * External web site + */ + +.framecontent { + width: 100%; + height: 100%; +} + +.framecontent iframe { + width: 100%; + height: 100%; +} + /* * Other diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 79d17292234..7f0a522eae5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3265,6 +3265,16 @@ a.impayee:hover { font-weight: bold; color: #550000; } +/* + * External web site + */ + +.framecontent iframe { + width: 100%; + height: 100%; +} + + /* * Other */