dolibarr  7.0.0-beta
spip.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2012 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) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
8  * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
34 
35 $langs->load("admin");
36 $langs->load("members");
37 $langs->load("mailmanspip");
38 
39 if (! $user->admin) accessforbidden();
40 
41 
42 $type=array('yesno','texte','chaine');
43 
44 $action = GETPOST('action','aZ09');
45 
46 
47 /*
48  * Actions
49  */
50 
51 // Action mise a jour ou ajout d'une constante
52 if ($action == 'update' || $action == 'add')
53 {
54  $constname=GETPOST("constname");
55  $constvalue=GETPOST("constvalue");
56 
57  // Action mise a jour ou ajout d'une constante
58  if ($action == 'update' || $action == 'add')
59  {
60  foreach($_POST['constname'] as $key => $val)
61  {
62  $constname=$_POST["constname"][$key];
63  $constvalue=$_POST["constvalue"][$key];
64  $consttype=$_POST["consttype"][$key];
65  $constnote=$_POST["constnote"][$key];
66 
67  $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
68 
69  if (! $res > 0) $error++;
70  }
71 
72  if (! $error)
73  {
74  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
75  }
76  else
77  {
78  setEventMessages($langs->trans("Error"), null, 'errors');
79  }
80  }
81 }
82 
83 // Action activation d'un sous module du module adherent
84 if ($action == 'set')
85 {
86  $result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
87  if ($result < 0)
88  {
89  dol_print_error($db);
90  }
91 }
92 
93 // Action desactivation d'un sous module du module adherent
94 if ($action == 'unset')
95 {
96  $result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
97  if ($result < 0)
98  {
99  dol_print_error($db);
100  }
101 }
102 
103 
104 
105 /*
106  * View
107  */
108 
109 $help_url='';
110 
111 llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url);
112 
113 
114 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
115 print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup');
116 
117 
118 $head = mailmanspip_admin_prepare_head();
119 
120 
121 $var=true;
122 
123 /*
124  * Spip
125  */
126 if (! empty($conf->global->ADHERENT_USE_SPIP))
127 {
128  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
129 
130  dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
131 
132  //$link=img_picto($langs->trans("Active"),'tick').' ';
133  $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
134  //$link.=$langs->trans("Disable");
135  $link.=img_picto($langs->trans("Activated"),'switch_on');
136  $link.='</a>';
137  // Edition des varibales globales
138  $constantes=array(
139  'ADHERENT_SPIP_SERVEUR',
140  'ADHERENT_SPIP_DB',
141  'ADHERENT_SPIP_USER',
142  'ADHERENT_SPIP_PASS'
143  );
144 
145  print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
146  print '<br>';
147 
148  form_constantes($constantes,2);
149 
150  dol_fiche_end();
151 
152  print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
153 
154  print '</form>';
155 }
156 else
157 {
158  dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
159 
160  $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
161  //$link.=$langs->trans("Activate");
162  $link.=img_picto($langs->trans("Disabled"),'switch_off');
163  $link.='</a>';
164  print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
165 
166  dol_fiche_end();
167 }
168 
169 llxFooter();
170 
171 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
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
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
form_constantes($tableau, $strictw3c=0, $helptext='')
Show array with constants to edit.
Definition: admin.lib.php:1309
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 ...
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
Definition: admin.lib.php:410
dol_fiche_end($notab=0)
Show tab footer of a card.
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