dolibarr 21.0.0-beta
frames.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 */
19
30// Load Dolibarr environment
31require '../main.inc.php';
32
41// Load translation files required by the page
42$langs->load("other");
43
44
45$mainmenu = GETPOST('mainmenu', "aZ09");
46$leftmenu = GETPOST('leftmenu', "aZ09");
47$idmenu = GETPOSTINT('idmenu');
48$theme = GETPOST('theme', 'aZ09');
49$codelang = GETPOST('lang', 'aZ09');
50$keyforcontent = GETPOST('keyforcontent', 'aZ09');
51
52if (!isModEnabled("externalsite")) {
53 accessforbidden('Module externalsite not enabled');
54}
55
56
57/*
58 * View
59 */
60
61if (empty($keyforcontent) && !getDolGlobalString('EXTERNALSITE_URL')) {
62 llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-externalsite page-frames');
63 print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
64 llxFooter();
65 exit;
66}
67
68if (!empty($keyforcontent)) {
69 llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-externalsite page-frames');
70
71 print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
72
73 if (!preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)
74 && !preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
75 $langs->load("errors");
76 print $langs->trans("ErrorBadSyntaxForParamKeyForContent", 'EXTERNAL_SITE_CONTENT_', 'EXTERNAL_SITE_URL_');
77 } elseif (!getDolGlobalString($keyforcontent)) {
78 $langs->load("errors");
79 print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent);
80 } else {
81 if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) {
82 print getDolGlobalString($keyforcontent);
83 } elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
84 /*print "
85 <html>
86 <head>
87 <title>Dolibarr frame for external web site</title>
88 </head>
89
90 <frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
91 <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
92 ";
93 print '<frame name="main" src="';
94 print getDolGlobalString($keyforcontent);
95 print '">';
96 print "
97 <noframes>
98 <body>
99
100 </body>
101 </noframes>
102 </frameset>
103
104 <noframes>
105 <body>
106 <br><div class=\"center\">
107 Sorry, your browser is too old or not correctly configured to view this area.<br>
108 Your browser must support frames.<br>
109 </div>
110 </body>
111 </noframes>
112
113 </html>
114 ";*/
115 print '<iframe src="'.getDolGlobalString($keyforcontent).'"></iframe>';
116 }
117 }
118
119 print '<div>';
120 llxFooter();
121} else {
122 if (preg_match('/^\//', $conf->global->EXTERNALSITE_URL) || preg_match('/^http/i', $conf->global->EXTERNALSITE_URL)) {
123 print "
124 <html>
125 <head>
126 <title>Dolibarr frame for external web site</title>
127 </head>
128
129 <frameset ".(!getDolGlobalString('MAIN_MENU_INVERT') ? "rows" : "cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
130 <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme ? '&theme='.$theme : '').($codelang ? '&lang='.$codelang : '')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
131 ";
132 print '<frame name="main" src="';
133 print $conf->global->EXTERNALSITE_URL;
134 print '">';
135 print "
136 <noframes>
137 <body>
138
139 </body>
140 </noframes>
141 </frameset>
142
143 <noframes>
144 <body>
145 <br><div class=\"center\">
146 Sorry, your browser is too old or not correctly configured to view this area.<br>
147 Your browser must support frames.<br>
148 </div>
149 </body>
150 </noframes>
151
152 </html>
153 ";
154 } else {
155 llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-externalsite page-frames');
156 print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
157 print $conf->global->EXTERNALSITE_URL;
158 print '<div>';
159 llxFooter();
160 }
161}
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
llxFooter()
Footer empty.
Definition document.php:107
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.