dolibarr  7.0.0-beta
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 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31 
32 
33 if (!$user->admin)
35 
36 
37 $langs->load("admin");
38 $langs->load("other");
39 $langs->load("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','alpha');
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">'.$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 $var=true;
96 
97 
98 print '<tr class="oddeven">';
99 print '<td class="fieldrequired">'.$langs->trans("Label")."</td>";
100 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>";
101 print "<td>".$langs->trans("ExampleMyMenuEntry")."</td>";
102 print "</tr>";
103 
104 
105 print '<tr class="oddeven">';
106 print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
107 print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_URL\" value=\"". (GETPOST('EXTERNALSITE_URL','alpha')?GETPOST('EXTERNALSITE_URL','alpha'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL)) . "\" size=\"40\"></td>";
108 print "<td>http://localhost/myurl/";
109 print "<br>http://wikipedia.org/";
110 print "</td>";
111 print "</tr>";
112 
113 print "</table>";
114 
115 
116 print '<br><div class="center">';
117 print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
118 print '</div>';
119 
120 print "</form>\n";
121 
122 llxFooter();
123 
124 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
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:485
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91