dolibarr  16.0.5
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 require '../main.inc.php';
30 
31 // Load translation files required by the page
32 $langs->load("other");
33 
34 
35 $mainmenu = GETPOST('mainmenu', "aZ09");
36 $leftmenu = GETPOST('leftmenu', "aZ09");
37 $idmenu = GETPOST('idmenu', 'int');
38 $theme = GETPOST('theme', 'aZ09');
39 $codelang = GETPOST('lang', 'aZ09');
40 $keyforcontent = GETPOST('keyforcontent', 'aZ09');
41 
42 
43 /*
44  * View
45  */
46 
47 if (empty($keyforcontent) && empty($conf->global->EXTERNALSITE_URL)) {
48  llxHeader();
49  print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
50  llxFooter();
51  exit;
52 }
53 
54 if (!empty($keyforcontent)) {
55  llxHeader();
56 
57  print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
58 
59  if (!preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)
60  && !preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
61  $langs->load("errors");
62  print $langs->trans("ErrorBadSyntaxForParamKeyForContent", 'EXTERNAL_SITE_CONTENT_', 'EXTERNAL_SITE_URL_');
63  } elseif (empty($conf->global->$keyforcontent)) {
64  $langs->load("errors");
65  print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent);
66  } else {
67  if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) {
68  print $conf->global->$keyforcontent;
69  } elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
70  /*print "
71  <html>
72  <head>
73  <title>Dolibarr frame for external web site</title>
74  </head>
75 
76  <frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
77  <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
78  ";
79  print '<frame name="main" src="';
80  print $conf->global->$keyforcontent;
81  print '">';
82  print "
83  <noframes>
84  <body>
85 
86  </body>
87  </noframes>
88  </frameset>
89 
90  <noframes>
91  <body>
92  <br><div class=\"center\">
93  Sorry, your browser is too old or not correctly configured to view this area.<br>
94  Your browser must support frames.<br>
95  </div>
96  </body>
97  </noframes>
98 
99  </html>
100  ";*/
101  print '<iframe src="'.$conf->global->$keyforcontent.'"></iframe>';
102  }
103  }
104 
105  print '<div>';
106  llxFooter();
107 } else {
108  if (preg_match('/^\//', $conf->global->EXTERNALSITE_URL) || preg_match('/^http/i', $conf->global->EXTERNALSITE_URL)) {
109  print "
110  <html>
111  <head>
112  <title>Dolibarr frame for external web site</title>
113  </head>
114 
115  <frameset ".(empty($conf->global->MAIN_MENU_INVERT) ? "rows" : "cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
116  <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme ? '&theme='.$theme : '').($codelang ? '&lang='.$codelang : '')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
117  ";
118  print '<frame name="main" src="';
119  print $conf->global->EXTERNALSITE_URL;
120  print '">';
121  print "
122  <noframes>
123  <body>
124 
125  </body>
126  </noframes>
127  </frameset>
128 
129  <noframes>
130  <body>
131  <br><div class=\"center\">
132  Sorry, your browser is too old or not correctly configured to view this area.<br>
133  Your browser must support frames.<br>
134  </div>
135  </body>
136  </noframes>
137 
138  </html>
139  ";
140  } else {
141  llxHeader();
142  print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
143  print $conf->global->EXTERNALSITE_URL;
144  print '<div>';
145  llxFooter();
146  }
147 }
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59