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