dolibarr  19.0.0-dev
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 if (!isModEnabled("externalsite")) {
44  accessforbidden('Module externalsite not enabled');
45 }
46 
47 
48 /*
49  * View
50  */
51 
52 if (empty($keyforcontent) && empty($conf->global->EXTERNALSITE_URL)) {
53  llxHeader();
54  print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
55  llxFooter();
56  exit;
57 }
58 
59 if (!empty($keyforcontent)) {
60  llxHeader();
61 
62  print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
63 
64  if (!preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)
65  && !preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
66  $langs->load("errors");
67  print $langs->trans("ErrorBadSyntaxForParamKeyForContent", 'EXTERNAL_SITE_CONTENT_', 'EXTERNAL_SITE_URL_');
68  } elseif (empty($conf->global->$keyforcontent)) {
69  $langs->load("errors");
70  print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent);
71  } else {
72  if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) {
73  print $conf->global->$keyforcontent;
74  } elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) {
75  /*print "
76  <html>
77  <head>
78  <title>Dolibarr frame for external web site</title>
79  </head>
80 
81  <frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
82  <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
83  ";
84  print '<frame name="main" src="';
85  print $conf->global->$keyforcontent;
86  print '">';
87  print "
88  <noframes>
89  <body>
90 
91  </body>
92  </noframes>
93  </frameset>
94 
95  <noframes>
96  <body>
97  <br><div class=\"center\">
98  Sorry, your browser is too old or not correctly configured to view this area.<br>
99  Your browser must support frames.<br>
100  </div>
101  </body>
102  </noframes>
103 
104  </html>
105  ";*/
106  print '<iframe src="'.$conf->global->$keyforcontent.'"></iframe>';
107  }
108  }
109 
110  print '<div>';
111  llxFooter();
112 } else {
113  if (preg_match('/^\//', $conf->global->EXTERNALSITE_URL) || preg_match('/^http/i', $conf->global->EXTERNALSITE_URL)) {
114  print "
115  <html>
116  <head>
117  <title>Dolibarr frame for external web site</title>
118  </head>
119 
120  <frameset ".(empty($conf->global->MAIN_MENU_INVERT) ? "rows" : "cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
121  <frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme ? '&theme='.$theme : '').($codelang ? '&lang='.$codelang : '')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
122  ";
123  print '<frame name="main" src="';
124  print $conf->global->EXTERNALSITE_URL;
125  print '">';
126  print "
127  <noframes>
128  <body>
129 
130  </body>
131  </noframes>
132  </frameset>
133 
134  <noframes>
135  <body>
136  <br><div class=\"center\">
137  Sorry, your browser is too old or not correctly configured to view this area.<br>
138  Your browser must support frames.<br>
139  </div>
140  </body>
141  </noframes>
142 
143  </html>
144  ";
145  } else {
146  llxHeader();
147  print '<div class="framecontent" style="height: '.($_SESSION['dol_screenheight'] - 90).'px">';
148  print $conf->global->EXTERNALSITE_URL;
149  print '<div>';
150  llxFooter();
151  }
152 }
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.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.