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