dolibarr  9.0.0
externalsite.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
4  * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
7  * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
29 if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
30 
31 require '../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
33 
34 
35 if (!$user->admin)
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array('admin', 'other', 'externalsite'));
40 
41 $def = array();
42 
43 $action = GETPOST('action','alpha');
44 
45 // Sauvegardes parametres
46 if ($action == 'update')
47 {
48  $i=0;
49 
50  $db->begin();
51 
52  $label = GETPOST('EXTERNALSITE_LABEL','alpha');
53  $exturl = GETPOST('EXTERNALSITE_URL','none');
54 
55  $i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
56  $i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
57 
58  if ($i >= 2)
59  {
60  $db->commit();
61  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
62  }
63  else
64  {
65  $db->rollback();
66  setEventMessages($db->lasterror(), null, 'errors');
67  }
68 }
69 
70 
75 llxHeader();
76 
77 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
78 print load_fiche_titre($langs->trans("ExternalSiteSetup"),$linkback,'title_setup');
79 print '<br>';
80 
81 print $langs->trans("Module100Desc")."<br>\n";
82 print '<br>';
83 
84 print '<form name="externalsiteconfig" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
85 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
86 print '<input type="hidden" name="action" value="update">';
87 print "<table class=\"noborder\" width=\"100%\">";
88 
89 print "<tr class=\"liste_titre\">";
90 print "<td width=\"30%\">".$langs->trans("Parameter")."</td>";
91 print "<td>".$langs->trans("Value")."</td>";
92 print "<td>".$langs->trans("Examples")."</td>";
93 print "</tr>";
94 
95 
96 print '<tr class="oddeven">';
97 print '<td class="fieldrequired">'.$langs->trans("Label")."</td>";
98 print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_LABEL\" value=\"". (GETPOST('EXTERNALSITE_LABEL','alpha')?GETPOST('EXTERNALSITE_LABEL','alpha'):((empty($conf->global->EXTERNALSITE_LABEL) || $conf->global->EXTERNALSITE_LABEL=='ExternalSite')?'':$conf->global->EXTERNALSITE_LABEL)) . "\" size=\"12\"></td>";
99 print "<td>".$langs->trans("ExampleMyMenuEntry")."</td>";
100 print "</tr>";
101 
102 
103 print '<tr class="oddeven">';
104 print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
105 print '<td><textarea class="flat minwidth500" name="EXTERNALSITE_URL">';
106 print (GETPOST('EXTERNALSITE_URL','none')?GETPOST('EXTERNALSITE_URL','none'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL));
107 print '</textarea></td>';
108 print "<td>http://localhost/myurl/";
109 print "<br>https://wikipedia.org/";
110 print "<br>&lt;iframe&gt;...&lt;/iframe&gt;";
111 print "</td>";
112 print "</tr>";
113 
114 print "</table>";
115 
116 
117 print '<br><div class="center">';
118 print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
119 print '</div>';
120 
121 print "</form>\n";
122 
123 llxFooter();
124 
125 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:510
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
llxHeader()
Empty header.
Definition: wrapper.php:44