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