dolibarr  7.0.0-beta
modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
6  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
7  * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
8  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
9  * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
36 
37 $langs->loadLangs(array("errors","admin","modulebuilder"));
38 
39 $mode=GETPOST('mode', 'alpha');
40 if (empty($mode)) $mode='common';
41 $action=GETPOST('action','alpha');
42 $value=GETPOST('value', 'alpha');
43 $page_y=GETPOST('page_y','int');
44 $search_keyword=GETPOST('search_keyword','alpha');
45 $search_status=GETPOST('search_status','alpha');
46 $search_nature=GETPOST('search_nature','alpha');
47 $search_version=GETPOST('search_version','alpha');
48 
49 
50 // For dolistore search
51 $options = array();
52 $options['per_page'] = 20;
53 $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'):0) + 0);
54 $options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
55 $options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
56 $options['search'] = GETPOST('search_keyword', 'alpha');
57 $dolistore = new Dolistore();
58 
59 
60 if (! $user->admin)
62 
63 $specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace');
64 
65 $familyinfo=array(
66  'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
67  'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
68  'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
69  'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
70  'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
71  'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
72  'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
73  'technic'=>array('position'=>'021', 'label'=>$langs->trans("ModuleFamilyTechnic")),
74  'portal'=>array('position'=>'040', 'label'=>$langs->trans("ModuleFamilyPortal")),
75  'interface'=>array('position'=>'050', 'label'=>$langs->trans("ModuleFamilyInterface")),
76  'base'=>array('position'=>'060', 'label'=>$langs->trans("ModuleFamilyBase")),
77  'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
78 );
79 
80 $param='';
81 if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
82 if ($search_status > -1) $param.='&search_status='.urlencode($search_status);
83 if ($search_nature > -1) $param.='&search_nature='.urlencode($search_nature);
84 if ($search_version > -1) $param.='&search_version='.urlencode($search_version);
85 
86 $dirins=DOL_DOCUMENT_ROOT.'/custom';
87 $urldolibarrmodules='https://www.dolistore.com/';
88 
89 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
90 $hookmanager->initHooks(array('adminmodules','globaladmin'));
91 
92 
93 /*
94  * Actions
95  */
96 
97 $formconfirm = '';
98 
99 $parameters=array();
100 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
101 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
102 
103 if (GETPOST('buttonreset','alpha'))
104 {
105  $search_keyword='';
106  $search_status='';
107  $search_nature='';
108  $search_version='';
109 }
110 
111 if ($action=='install')
112 {
113  $error=0;
114 
115  // $original_file should match format module_modulename-x.y[.z].zip
116  $original_file=basename($_FILES["fileinstall"]["name"]);
117  $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
118 
119  if (! $original_file)
120  {
121  $langs->load("Error");
122  setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
123  $error++;
124  }
125  else
126  {
127  if (! preg_match('/\.zip$/i',$original_file))
128  {
129  $langs->load("errors");
130  setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
131  $error++;
132  }
133  if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file))
134  {
135  $langs->load("errors");
136  setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
137  $error++;
138  }
139  }
140 
141  if (! $error)
142  {
143  if ($original_file)
144  {
145  @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
146  dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
147  }
148 
149  $tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
150  if ($tmpdir)
151  {
152  @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
153  dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
154  }
155 
156  $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
157  if ($result > 0)
158  {
159  $result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
160 
161  if (! empty($result['error']))
162  {
163  $langs->load("errors");
164  setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
165  $error++;
166  }
167  else
168  {
169  // Now we move the dir of the module
170  $modulename=preg_replace('/module_/', '', $original_file);
171  $modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
172  // Search dir $modulename
173  $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
174  //var_dump($modulenamedir);
175  if (! dol_is_dir($modulenamedir))
176  {
177  $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
178  //var_dump($modulenamedir);
179  if (! dol_is_dir($modulenamedir))
180  {
181  setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
182  $error++;
183  }
184  }
185 
186  if (! $error)
187  {
188  //var_dump($dirins);
189  @dol_delete_dir_recursive($dirins.'/'.$modulename);
190  dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
191  $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
192  if ($result <= 0)
193  {
194  dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulename, LOG_WARNING);
195  $langs->load("errors");
196  setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulename), null, 'errors');
197  $error++;
198  }
199  }
200  }
201  }
202  else
203  {
204  $error++;
205  }
206  }
207 
208  if (! $error)
209  {
210  setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
211  }
212 }
213 
214 if ($action == 'set' && $user->admin)
215 {
216  $resarray = activateModule($value);
217  if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
218  else
219  {
220  //var_dump($resarray);exit;
221  if ($resarray['nbperms'] > 0)
222  {
223  $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
224  $resqltmp=$db->query($tmpsql);
225  if ($resqltmp)
226  {
227  $obj=$db->fetch_object($resqltmp);
228  //var_dump($obj->nb);exit;
229  if ($obj && $obj->nb > 1)
230  {
231  $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
232  setEventMessages($msg, null, 'warnings');
233  }
234  }
235  else dol_print_error($db);
236  }
237  }
238  header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
239  exit;
240 }
241 else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
242 {
243  $result=unActivateModule($value);
244  if ($result) setEventMessages($result, null, 'errors');
245  header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
246  exit;
247 }
248 
249 
250 
251 /*
252  * View
253  */
254 
255 $form = new Form($db);
256 
257 //$morejs = array("/admin/dolistore/js/dolistore.js.php");
258 $morecss = array("/admin/dolistore/css/dolistore.css");
259 
260 // Set dir where external modules are installed
261 if (! dol_is_dir($dirins))
262 {
263  dol_mkdir($dirins);
264 }
265 $dirins_ok=(dol_is_dir($dirins));
266 
267 $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
268 llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0);
269 
270 $arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
271 $arrayofwarnings=array(); // Array of warning each module want to show when activated
272 $arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module
273 
274 // Search modules dirs
275 $modulesdir = dolGetModulesDirs();
276 
277 
278 $filename = array();
279 $modules = array();
280 $orders = array();
281 $categ = array();
282 $dirmod = array();
283 $i = 0; // is a sequencer of modules found
284 $j = 0; // j is module number. Automatically affected if module number not defined.
285 $modNameLoaded=array();
286 
287 foreach ($modulesdir as $dir)
288 {
289  // Load modules attributes in arrays (name, numero, orders) from dir directory
290  //print $dir."\n<br>";
291  dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
292  $handle=@opendir($dir);
293  if (is_resource($handle))
294  {
295  while (($file = readdir($handle))!==false)
296  {
297  //print "$i ".$file."\n<br>";
298  if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
299  {
300  $modName = substr($file, 0, dol_strlen($file) - 10);
301 
302  if ($modName)
303  {
304  if (! empty($modNameLoaded[$modName])) // In cache of already loaded modules ?
305  {
306  $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
307  setEventMessages($mesg, null, 'warnings');
308  dol_syslog($mesg, LOG_ERR);
309  continue;
310  }
311 
312  try
313  {
314  $res=include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
315  if (class_exists($modName))
316  {
317  try {
318  $objMod = new $modName($db);
319  $modNameLoaded[$modName]=$dir;
320  if (! $objMod->numero > 0 && $modName != 'modUser')
321  {
322  dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
323  }
324  $j = $objMod->numero;
325 
326  $modulequalified=1;
327 
328  // We discard modules according to features level (PS: if module is activated we always show it)
329  $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
330  if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
331  if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
332  if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
333 
334  // We discard modules according to property ->hidden
335  if (! empty($objMod->hidden)) $modulequalified=0;
336 
337  if ($modulequalified > 0)
338  {
339  $publisher=dol_escape_htmltag($objMod->getPublisher());
340  $external=($objMod->isCoreOrExternalModule() == 'external');
341  if ($external)
342  {
343  if ($publisher)
344  {
345  $arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
346  }
347  else
348  {
349  $arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
350  }
351  }
352  ksort($arrayofnatures);
353  }
354 
355  // Define array $categ with categ with at least one qualified module
356  if ($modulequalified > 0)
357  {
358  $filename[$i]= $modName;
359  $modules[$modName] = $objMod;
360 
361  $special = $objMod->special;
362 
363  // Gives the possibility to the module, to provide his own family info and position of this family
364  if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
365  $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
366  $familykey = key($objMod->familyinfo);
367  } else {
368  $familykey = $objMod->family;
369  }
370 
371  $moduleposition = ($objMod->module_position?$objMod->module_position:'500');
372  if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external'))
373  {
374  $moduleposition = 800;
375  }
376 
377  if ($special == 1) $familykey='interface';
378 
379  // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
380  if (! empty($objMod->warnings_activation))
381  {
382  $arrayofwarnings[$modName]=$objMod->warnings_activation;
383  }
384  if (! empty($objMod->warnings_activation_ext))
385  {
386  $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext;
387  }
388 
389  $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
390  $dirmod[$i] = $dir;
391  //print $i.'-'.$dirmod[$i].'<br>';
392  // Set categ[$i]
393  $specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
394  if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
395  if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
396  else $categ[$specialstring]=1;
397  $j++;
398  $i++;
399  }
400  else dol_syslog("Module ".get_class($objMod)." not qualified");
401  }
402  catch(Exception $e)
403  {
404  dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
405  }
406  }
407  else
408  {
409  print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
410  }
411  }
412  catch(Exception $e)
413  {
414  dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
415  }
416  }
417  }
418  }
419  closedir($handle);
420  }
421  else
422  {
423  dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
424  }
425 }
426 
427 if ($action == 'reset_confirm' && $user->admin)
428 {
429  if(!empty($modules[$value])) {
430  $objMod = $modules[$value];
431 
432  if(!empty($objMod->langfiles)) $langs->loadLangs($objMod->langfiles);
433 
434  $form = new Form($db);
435  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
436 
437  }
438 
439 }
440 
441 print $formconfirm;
442 
443 asort($orders);
444 //var_dump($orders);
445 //var_dump($categ);
446 //var_dump($modules);
447 
448 $nbofactivatedmodules=count($conf->modules);
449 $moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
450 if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
451 print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
452 
453 // Start to show page
454 if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
455 if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
456 if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
457 if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
458 
459 $head = modules_prepare_head();
460 
461 
462 print "<br>\n";
463 
464 
465 if ($mode == 'common')
466 {
467  dol_set_focus('#search_keyword');
468 
469  print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
470  if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
471  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
472  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
473  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
474  print '<input type="hidden" name="page" value="'.$page.'">';
475 
476  dol_fiche_head($head, $mode, '', -1);
477 
478  $moreforfilter = '';
479  $moreforfilter.='<div class="divsearchfield">';
480  $moreforfilter.= $langs->trans('Keyword') . ': <input type="text" id="search_keyword" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
481  $moreforfilter.= '</div>';
482  $moreforfilter.='<div class="divsearchfield">';
483  $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
484  $moreforfilter.= '</div>';
485  if (! empty($conf->global->MAIN_FEATURES_LEVEL))
486  {
487  $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
488  if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated");
489  if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental");
490  if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development");
491  $moreforfilter.='<div class="divsearchfield">';
492  $moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1);
493  $moreforfilter.= '</div>';
494  }
495  $moreforfilter.='<div class="divsearchfield">';
496  $moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
497  $moreforfilter.= '</div>';
498  $moreforfilter.=' ';
499  $moreforfilter.='<div class="divsearchfield">';
500  $moreforfilter.='<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
501  $moreforfilter.=' ';
502  $moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
503  $moreforfilter.= '</div>';
504 
505  if (! empty($moreforfilter))
506  {
507  print $moreforfilter;
508  $parameters=array();
509  $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
510  print $hookmanager->resPrint;
511  }
512 
513  $moreforfilter='';
514 
515  print '<div class="clearboth"></div><br>';
516 
517  $parameters=array();
518  $reshook=$hookmanager->executeHooks('insertExtraHeader',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
519  if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
520 
521  // Show list of modules
522 
523  $oldfamily='';
524 
525  foreach ($orders as $key => $value)
526  {
527  $tab=explode('_',$value);
528  $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
529 
530  $modName = $filename[$key];
531  $objMod = $modules[$modName];
532  $dirofmodule = $dirmod[$key];
533 
534  $special = $objMod->special;
535 
536  //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
537  //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev')
538  if (($special >= 4 && $mode != 'expdev')
539  || ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental')) continue; // Discard if not for current tab
540 
541  if (! $objMod->getName())
542  {
543  dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
544  continue;
545  }
546 
547  $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
548 
549  // Check filters
550  $modulename=$objMod->getName();
551  $moduletechnicalname=$objMod->name;
552  $moduledesc=$objMod->getDesc();
553  $moduledesclong=$objMod->getDescLong();
554  $moduleauthor=$objMod->getPublisher();
555 
556  // We discard showing according to filters
557  if ($search_keyword)
558  {
559  $qualified=0;
560  if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
561  || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
562  || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
563  || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
564  || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
565  ) $qualified=1;
566  if (! $qualified) continue;
567  }
568  if ($search_status)
569  {
570  if ($search_status == 'active' && empty($conf->global->$const_name)) continue;
571  if ($search_status == 'disabled' && ! empty($conf->global->$const_name)) continue;
572  }
573  if ($search_nature)
574  {
575  if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue;
576  if (preg_match('/^external_(.*)$/',$search_nature, $reg))
577  {
578  //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
579  $publisher=dol_escape_htmltag($objMod->getPublisher());
580  if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue;
581  if (! $reg[1] && ! empty($publisher)) continue;
582  }
583  if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
584  }
585  if ($search_version)
586  {
587  if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue;
588  if ($objMod->version != 'development' && ($search_version == 'development')) continue;
589  if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue;
590  if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue;
591  }
592 
593  // Load all lang files of module
594  if (isset($objMod->langfiles) && is_array($objMod->langfiles))
595  {
596  foreach($objMod->langfiles as $domain)
597  {
598  $langs->load($domain);
599  }
600  }
601 
602  // Print a separator if we change family
603  if ($familykey!=$oldfamily)
604  {
605  if ($oldfamily) print '</table></div><br>';
606 
607  $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
608  print_fiche_titre($familytext, '', '');
609 
610  print '<div class="div-table-responsive">';
611  print '<table class="tagtable liste" summary="list_of_modules">'."\n";
612 
613  $atleastoneforfamily=0;
614  }
615 
616  $atleastoneforfamily++;
617 
618  if ($familykey!=$oldfamily)
619  {
620  $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
621  $oldfamily=$familykey;
622  }
623 
624 
625 
626 
627  // Version (with picto warning or not)
628  $version=$objMod->getVersion(0);
629  $versiontrans='';
630  if (preg_match('/development/i', $version)) $versiontrans.=img_warning($langs->trans("Development"), 'style="float: left"');
631  if (preg_match('/experimental/i', $version)) $versiontrans.=img_warning($langs->trans("Experimental"), 'style="float: left"');
632  if (preg_match('/deprecated/i', $version)) $versiontrans.=img_warning($langs->trans("Deprecated"), 'style="float: left"');
633  $versiontrans.=$objMod->getVersion(1);
634 
635  // Define imginfo
636  $imginfo="info";
637  if ($objMod->isCoreOrExternalModule() == 'external')
638  {
639  $imginfo="info_black";
640  }
641 
642  print '<tr class="oddeven">'."\n";
643 
644  // Picto + Name of module
645  print ' <td width="200px">';
646  $alttext='';
647  //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
648  //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
649  if (! empty($objMod->picto))
650  {
651  if (preg_match('/^\//i',$objMod->picto)) print img_picto($alttext,$objMod->picto,' width="14px"',1);
652  else print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"');
653  }
654  else
655  {
656  print img_object($alttext, 'generic', 'class="valignmiddle"');
657  }
658  print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
659  print "</td>\n";
660 
661  // Desc
662  print '<td class="valignmiddle tdoverflowmax300">';
663  print nl2br($objMod->getDesc());
664  print "</td>\n";
665 
666  // Help
667  print '<td class="center nowrap" style="width: 82px;">';
668  //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
669  print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
670  print '</td>';
671 
672  // Version
673  print '<td class="center nowrap" width="120px">';
674  print $versiontrans;
675  print "</td>\n";
676 
677  // Activate/Disable and Setup (2 columns)
678  if (! empty($conf->global->$const_name)) // If module is already activated
679  {
680  $disableSetup = 0;
681 
682  // Link enable/disabme
683  print '<td class="center valignmiddle" width="60px">';
684  if (! empty($arrayofwarnings[$modName]))
685  {
686  print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
687  }
688  if (! empty($objMod->disabled))
689  {
690  print $langs->trans("Disabled");
691  }
692  else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1)))
693  {
694  if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used");
695  else print $langs->trans("Required");
696  if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
697  }
698  else
699  {
700  if(!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
701  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value=' . $modName . '&amp;mode=' . $mode . $param . '">';
702  print img_picto($langs->trans("Activated"),'switch_on');
703  print '</a>';
704 
705  }
706  else {
707 
708  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value=' . $modName . '&amp;mode=' . $mode .'&amp;confirm=yes' . $param . '">';
709  print img_picto($langs->trans("Activated"),'switch_on');
710  print '</a>';
711 
712  }
713 
714  }
715  print '</td>'."\n";
716 
717  // Link config
718  if (! empty($objMod->config_page_url) && !$disableSetup)
719  {
720  $backtourlparam='';
721  if ($search_keyword != '') $backtourlparam.=($backtourlparam?'&':'?').'search_keyword='.$search_keyword; // No urlencode here, done later
722  if ($search_nature > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_nature='.$search_nature;
723  if ($search_version > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_version='.$search_version;
724  if ($search_status > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_status='.$search_status;
725  $backtourl=$_SERVER["PHP_SELF"].$backtourlparam;
726 
727  if (is_array($objMod->config_page_url))
728  {
729  print '<td class="tdsetuppicto right" width="60px">';
730  $i=0;
731  foreach ($objMod->config_page_url as $page)
732  {
733  $urlpage=$page;
734  if ($i++)
735  {
736  print '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>';
737  // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
738  }
739  else
740  {
741  if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
742  {
743  $urltouse=dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1);
744  print '<a href="'.$urltouse.(preg_match('/\?/',$urltouse)?'&':'?').'backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
745  }
746  else
747  {
748  $urltouse=$urlpage;
749  print '<a href="'.$urltouse.(preg_match('/\?/',$urltouse)?'&':'?').'backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
750  }
751  }
752  }
753  print "</td>\n";
754  }
755  else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
756  {
757  print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'?backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
758  }
759  else
760  {
761  print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.$objMod->config_page_url.'?backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
762  }
763  }
764  else
765  {
766  print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
767  }
768 
769  }
770  else // Module not yet activated
771  {
772  // Link enable/disable
773  print '<td class="center valignmiddle" width="60px">';
774  if (! empty($objMod->always_enabled))
775  {
776  // Should never happened
777  }
778  else if (! empty($objMod->disabled))
779  {
780  print $langs->trans("Disabled");
781  }
782  else
783  {
784  // Module qualified for activation
785  $warningmessage='';
786  if (! empty($arrayofwarnings[$modName]))
787  {
788  print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
789  foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage)
790  {
791  $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
792  }
793  }
794  if ($objMod->isCoreOrExternalModule() == 'external' && ! empty($arrayofwarningsext))
795  {
796  print '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
797  foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry)
798  {
799  $keymodulelowercase=strtolower(preg_replace('/^mod/','',$keymodule));
800  if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on
801  {
802  foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage)
803  {
804  if ($keycountry == 'always' || $keycountry == $mysoc->country_code)
805  {
806  $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
807  $warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName();
808  if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("Publisher").' : '.$objMod->editor_name;
809  if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
810  }
811  }
812  }
813  }
814  }
815  print '<!-- Message to show: '.$warningmessage.' -->'."\n";
816  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=set&amp;value=' . $modName . '&amp;mode=' . $mode . $param . '"';
817  if ($warningmessage) print ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
818  print '>';
819  print img_picto($langs->trans("Disabled"),'switch_off');
820  print "</a>\n";
821  }
822  print "</td>\n";
823 
824  // Link config
825  print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
826  }
827 
828  print "</tr>\n";
829  }
830 
831  if ($oldfamily)
832  {
833  print "</table>\n";
834  print '</div>';
835  }
836 
837  dol_fiche_end();
838 
839  // Show warning about external users
840  print info_admin(showModulesExludedForExternal($modules))."\n";
841 
842  print '</form>';
843 }
844 
845 if ($mode == 'marketplace')
846 {
847  dol_fiche_head($head, $mode, '', -1);
848 
849  // Marketplace
850  print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
851  print "<tr class=\"liste_titre\">\n";
852  //print '<td>'.$langs->trans("Logo").'</td>';
853  print '<td colspan="2">'.$langs->trans("WebSiteDesc").'</td>';
854  print '<td>'.$langs->trans("URL").'</td>';
855  print '</tr>';
856 
857  print "<tr class=\"oddeven\">\n";
858  $url='https://www.dolistore.com';
859  print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
860  print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
861  print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
862  print '</tr>';
863 
864  print "</table>\n";
865 
866  dol_fiche_end();
867 
868  print '<br>';
869 
870  if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
871  {
872  // $options is array with filter criterias
873  //var_dump($options);
874  $dolistore->getRemoteData($options);
875 
876  print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
877 
878  $previouslink = $dolistore->get_previous_link();
879  $nextlink = $dolistore->get_next_link();
880 
881  print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
882 
883  ?>
884  <form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
885  <input type="hidden" name="mode" value="marketplace" />
886  <div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
887  <input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
888  </div>
889  <div class="divsearchfield">
890  <input class="button" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
891  <a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
892 
893  &nbsp;
894  </div>
895  <div class="divsearchfield right">
896  <?php
897  print $previouslink;
898  print $nextlink;
899  ?>
900  </div>
901  </form>
902 
903  <?php
904 
905  print '</div></div>';
906  print '<div class="clearboth"></div>';
907 
908  ?>
909 
910  <div id="category-tree-left">
911  <ul class="tree">
912  <?php echo $dolistore->get_categories(); ?>
913  </ul>
914  </div>
915  <div id="listing-content">
916  <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
917  <tbody id="listOfModules">
918  <?php echo $dolistore->get_products($categorie); ?>
919  </tbody>
920  </table>
921  </div>
922 
923  <?php
924  }
925 }
926 
927 
928 // Install external module
929 
930 if ($mode == 'deploy')
931 {
932  dol_fiche_head($head, $mode, '', -1);
933 
934  $dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
935  $allowonlineinstall=true;
936  $allowfromweb=1;
937  if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
938 
939  $fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
940  $message='';
941  if (! empty($allowonlineinstall))
942  {
943  if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
944  {
945  $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
946  $allowfromweb=-1;
947  }
948  else
949  {
950  if ($dirins_ok)
951  {
952  if (! is_writable(dol_osencode($dirins)))
953  {
954  $langs->load("errors");
955  $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
956  $allowfromweb=0;
957  }
958  }
959  else
960  {
961  $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
962  $allowfromweb=0;
963  }
964  }
965  }
966  else
967  {
968  $message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
969  $allowfromweb=0;
970  }
971 
972  if ($allowfromweb < 1)
973  {
974  print $langs->trans("SomethingMakeInstallFromWebNotPossible");
975  print $message;
976  //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
977  print '<br>';
978  }
979 
980  print '<br>';
981 
982  if ($allowfromweb >= 0)
983  {
984  if ($allowfromweb == 1)
985  {
986  //print $langs->trans("ThisIsProcessToFollow").'<br>';
987  }
988  else
989  {
990  print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
991  print '<b>'.$langs->trans("StepNb",1).'</b>: ';
992  print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
993  print '<b>'.$langs->trans("StepNb",2).'</b>: ';
994  print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
995  print '<b>'.$langs->trans("StepNb",3).'</b>: ';
996  }
997 
998  if ($allowfromweb == 1)
999  {
1000  print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
1001 
1002  print '<br>';
1003 
1004  print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
1005  print '<input type="hidden" name="action" value="install">';
1006  print '<input type="hidden" name="mode" value="deploy">';
1007  print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
1008  print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
1009  print '</form>';
1010 
1011  print '<br>';
1012  print '<br>';
1013 
1014  print '<div class="center"><div class="logo_setup"></div></div>';
1015  }
1016  else
1017  {
1018  print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
1019  print '<b>'.$langs->trans("StepNb",4).'</b>: ';
1020  print $langs->trans("SetupIsReadyForUse").'<br>';
1021  }
1022  }
1023 
1024  if (! empty($result['return']))
1025  {
1026  print '<br>';
1027 
1028  foreach($result['return'] as $value)
1029  {
1030  echo $value.'<br>';
1031  }
1032  }
1033 
1034  dol_fiche_end();
1035 }
1036 
1037 if ($mode == 'develop')
1038 {
1039  dol_fiche_head($head, $mode, '', -1);
1040 
1041  // Marketplace
1042  print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
1043  print "<tr class=\"liste_titre\">\n";
1044  //print '<td>'.$langs->trans("Logo").'</td>';
1045  print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
1046  print '<td>'.$langs->trans("URL").'</td>';
1047  print '</tr>';
1048 
1049  print '<tr class="oddeven" height="80">'."\n";
1050  print '<td align="left">';
1051  //span class="fa fa-bug"></span>
1052  //print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">';
1053  print '<div class="imgmaxheight50 logo_setup"></div>';
1054  print '</td>';
1055  print '<td>'.$langs->trans("TryToUseTheModuleBuilder").'</td>';
1056  print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
1057  print '</tr>';
1058 
1059  print '<tr class="oddeven" height="80">'."\n";
1060  $url='https://partners.dolibarr.org';
1061  print '<td align="left">';
1062  print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a>';
1063  print '</td>';
1064  print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
1065  print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
1066  print '</tr>';
1067 
1068  print "</table>\n";
1069 
1070  dol_fiche_end();
1071 }
1072 
1073 
1074 
1075 llxFooter();
1076 
1077 $db->close();
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
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)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile')
Make control on an uploaded file from an GUI page and move it to final destination.
Definition: files.lib.php:962
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
unActivateModule($value, $requiredby=1)
Disable a module.
Definition: admin.lib.php:956
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dolGetModulesDirs($subdir='')
Return list of modules directories.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:414
if(empty($reshook)) $form
View.
Definition: perms.php:103
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null)
Copy a dir to another dir.
Definition: files.lib.php:687
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1')
Show information for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
img_warning($titlealt= 'default', $moreatt= '')
Show warning logo.
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.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories) ...
Definition: files.lib.php:1234
llxHeader()
Empty header.
Definition: wrapper.php:46
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_is_file($pathoffile)
Return if path is a file.
Definition: files.lib.php:427
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id='')
Show a title with picto.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
Definition: files.lib.php:1791
print
Draft customers invoices.
Definition: index.php:91
Class Dolistore.
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
activateModule($value, $withdeps=1)
Enable a module.
Definition: admin.lib.php:814
modules_prepare_head()
Prepare array with list of tabs.
Definition: admin.lib.php:546
type
Definition: viewcat.php:283
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)