24 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
25 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
34 $langs->loadLangs(array(
'errors',
'admin',
'modulebuilder',
'exports'));
36 $mode =
GETPOST(
'mode',
'alpha');
37 $action =
GETPOST(
'action',
'aZ09');
39 if (empty($mode)) $mode =
'desc';
57 $form =
new Form($db);
59 $help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
60 llxHeader(
'', $langs->trans(
"Setup"), $help_url);
62 print '<!-- Force style container -->'.
"\n".
'<style>
68 $arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"Core"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - '.$langs->trans(
"AllPublishers"));
81 $modNameLoaded = array();
83 foreach ($modulesdir as $dir)
87 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
88 $handle = @opendir($dir);
89 if (is_resource($handle))
91 while (($file = readdir($handle)) !==
false)
94 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php')
96 $modName = substr($file, 0,
dol_strlen($file) - 10);
100 if (!empty($modNameLoaded[$modName]))
102 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
109 $res = include_once $dir.$file;
110 if (class_exists($modName))
113 $objMod =
new $modName($db);
114 $modNameLoaded[$modName] = $dir;
116 if (!$objMod->numero > 0 && $modName !=
'modUser')
118 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
120 $j = $objMod->numero;
122 $modulequalified = 1;
125 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
126 if ($objMod->version ==
'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0;
127 if ($objMod->version ==
'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0;
128 if (preg_match(
'/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0;
133 if ($modulequalified > 0)
136 $external = ($objMod->isCoreOrExternalModule() ==
'external');
141 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
143 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
146 ksort($arrayofnatures);
150 if ($modulequalified > 0)
152 $modules[$i] = $objMod;
153 $filename[$i] = $modName;
156 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
157 if (!is_array($familyinfo)) $familyinfo = array();
158 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
159 $familykey = key($objMod->familyinfo);
161 $familykey = $objMod->family;
164 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
165 if ($moduleposition ==
'50' && ($objMod->isCoreOrExternalModule() ==
'external'))
167 $moduleposition =
'80';
170 $orders[$i] = $familyinfo[$familykey][
'position'].
"_".$familykey.
"_".$moduleposition.
"_".$j;
174 $specialstring =
'unknown';
175 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') $specialstring =
'expdev';
176 if (isset($categ[$specialstring])) $categ[$specialstring]++;
177 else $categ[$specialstring] = 1;
180 }
else dol_syslog(
"Module ".get_class($objMod).
" not qualified");
183 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
186 print "Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
190 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
197 dol_syslog(
"htdocs/admin/modulehelp.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
209 foreach ($orders as $tmpkey => $tmpvalue)
211 $tmpMod = $modules[$tmpkey];
212 if ($tmpMod->numero == $id)
215 $modName = $filename[$tmpkey];
216 $dirofmodule = $dirmod[$tmpkey];
222 $value = $orders[$key];
223 $tab = explode(
'_', $value);
224 $familyposition = $tab[0]; $familykey = $tab[1]; $module_position = $tab[2]; $numero = $tab[3];
231 $modulename = $objMod->getName();
232 $moduledesc = $objMod->getDesc();
233 $moduleauthor = $objMod->getPublisher();
234 $moduledir = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
236 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
238 $text =
'<span class="opacitymedium">'.$langs->trans(
"LastActivationDate").
':</span> ';
239 if (!empty($conf->global->$const_name)) $text .=
dol_print_date($objMod->getLastActivationDate(),
'dayhour');
240 else $text .= $langs->trans(
"Disabled");
241 $tmp = $objMod->getLastActivationInfo();
242 $authorid = $tmp[
'authorid'];
245 $tmpuser =
new User($db);
246 $tmpuser->fetch($authorid);
247 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationAuthor").
':</span> ';
248 $text .= $tmpuser->getNomUrl(1);
253 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationIP").
':</span> ';
259 $title = ($modulename ? $modulename : $moduledesc);
261 print '<div class="centpercent">';
263 $picto =
'object_'.$objMod->picto;
265 print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0,
'',
'titlemodulehelp');
272 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
276 if (isset($objMod->langfiles) && is_array($objMod->langfiles))
278 foreach ($objMod->langfiles as $domain)
280 $langs->load($domain);
288 $version = $objMod->getVersion(0);
290 if (preg_match(
'/development/i', $version)) $versiontrans .=
img_warning($langs->trans(
"Development"),
'style="float: left"');
291 if (preg_match(
'/experimental/i', $version)) $versiontrans .=
img_warning($langs->trans(
"Experimental"),
'style="float: left"');
292 if (preg_match(
'/deprecated/i', $version)) $versiontrans .=
img_warning($langs->trans(
"Deprecated"),
'style="float: left"');
293 $versiontrans .= $objMod->getVersion(1);
297 if ($objMod->isCoreOrExternalModule() ==
'external')
299 $imginfo =
"info_black";
307 if ($moduledesc) $text .=
'<br>'.$moduledesc.
'<br><br><br>';
309 $text .=
'<span class="opacitymedium">'.$langs->trans(
"Version").
':</span> '.$version;
311 $moduledescriptorfile = get_class($objMod).
'.class.php';
312 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"DescriptorFile").
':</span> '.$moduledescriptorfile;
315 if ($objMod->isCoreOrExternalModule() ==
'external')
317 $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"ExternalModule").
' - '.$langs->trans(
"InstalledInto", $dirofmodule);
318 if ($objMod->editor_name !=
'dolibarr') $textexternal .=
'<br><span class="opacitymedium">'.$langs->trans(
"Publisher").
':</span> '.(empty($objMod->editor_name) ? $langs->trans(
"Unknown") : $objMod->editor_name);
319 $editor_url = $objMod->editor_url;
320 if (!preg_match(
'/^http/', $editor_url)) $editor_url =
'http://'.$editor_url;
321 if (!empty($objMod->editor_url) && !preg_match(
'/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name !=
'dolibarr' ?
' - ' :
'').img_picto(
'',
'globe').
' <a href="'.$editor_url.
'" target="_blank">'.$objMod->editor_url.
'</a>';
322 $text .= $textexternal;
325 $text .=
'<br><span class="opacitymedium">'.$langs->trans(
"Origin").
':</span> '.$langs->trans(
"Core").
'<br>';
328 $moduledesclong = $objMod->getDescLong();
329 if ($moduledesclong) $text .=
'<br><hr><div class="moduledesclong">'.$moduledesclong.
'<div>';
332 if ($mode ==
'feature')
334 $text .=
'<br><strong>'.$langs->trans(
"DependsOn").
':</strong> ';
335 if (count($objMod->depends)) $text .= join(
',', $objMod->depends);
336 else $text .= $langs->trans(
"None");
337 $text .=
'<br><strong>'.$langs->trans(
"RequiredBy").
':</strong> ';
338 if (count($objMod->requiredby)) $text .= join(
',', $objMod->requiredby);
339 else $text .= $langs->trans(
"None");
343 $text .=
'<br><strong>'.$langs->trans(
"AddDataTables").
':</strong> ';
344 $sqlfiles =
dol_dir_list(
dol_buildpath($moduledir.
'/sql/'),
'files', 0,
'llx.*\.sql', array(
'\.key\.sql',
'\.sql\.back'));
345 if (count($sqlfiles) > 0)
347 $text .= $langs->trans(
"Yes").
' (';
349 foreach ($sqlfiles as $val)
351 $text .= ($i ?
', ' :
'').preg_replace(
'/\.sql$/',
'', preg_replace(
'/llx_/',
'', $val[
'name']));
355 }
else $text .= $langs->trans(
"No");
359 $text .=
'<br><strong>'.$langs->trans(
"AddDictionaries").
':</strong> ';
360 if (isset($objMod->dictionaries) && isset($objMod->dictionaries[
'tablib']) && is_array($objMod->dictionaries[
'tablib']) && count($objMod->dictionaries[
'tablib']))
363 foreach ($objMod->dictionaries[
'tablib'] as $val)
365 $text .= ($i ?
', ' :
'').$val;
368 }
else $text .= $langs->trans(
"No");
372 $text .=
'<br><strong>'.$langs->trans(
"AddData").
':</strong> ';
376 $text .= $langs->trans(
"Yes").
' ('.$moduledir.
'/sql/data.sql)';
377 }
else $text .= $langs->trans(
"No");
381 $text .=
'<br><strong>'.$langs->trans(
"AddRemoveTabs").
':</strong> ';
382 if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
385 foreach ($objMod->tabs as $val)
387 if (is_array($val)) $val = $val[
'data'];
390 $tmp = explode(
':', $val, 3);
391 $text .= ($i ?
', ' :
'').$tmp[0].
':'.$tmp[1];
395 }
else $text .= $langs->trans(
"No");
399 $text .=
'<br><strong>'.$langs->trans(
"AddModels").
':</strong> ';
400 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'models']) && $objMod->module_parts[
'models'])
402 $text .= $langs->trans(
"Yes");
403 }
else $text .= $langs->trans(
"No");
407 $text .=
'<br><strong>'.$langs->trans(
"AddSubstitutions").
':</strong> ';
408 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'substitutions']) && $objMod->module_parts[
'substitutions'])
410 $text .= $langs->trans(
"Yes");
411 }
else $text .= $langs->trans(
"No");
415 $text .=
'<br><strong>'.$langs->trans(
"AddSheduledJobs").
':</strong> ';
416 if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
419 foreach ($objMod->cronjobs as $val)
421 $text .= ($i ?
', ' :
'').($val[
'label']);
424 }
else $text .= $langs->trans(
"No");
428 $text .=
'<br><strong>'.$langs->trans(
"AddTriggers").
':</strong> ';
429 $moreinfoontriggerfile =
'';
430 if (isset($objMod->module_parts) && isset($objMod->module_parts[
'triggers']) && $objMod->module_parts[
'triggers'])
436 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
438 $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() ==
'external') ?
'/'.$moduledir :
'').
'/core/triggers'));
439 foreach ($triggers as $triggercursor)
441 if ($triggercursor[
'module'] == $moduledir)
444 $moreinfoontriggerfile =
' ('.$triggercursor[
'relpath'].
')';
448 $text .= $langs->trans($yesno).$moreinfoontriggerfile;
452 $text .=
'<br><strong>'.$langs->trans(
"AddBoxes").
':</strong> ';
453 if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
456 foreach ($objMod->boxes as $val)
458 $text .= ($i ?
', ' :
'').($val[
'file'] ? $val[
'file'] : $val[0]);
461 }
else $text .= $langs->trans(
"No");
465 $text .=
'<br><strong>'.$langs->trans(
"AddHooks").
':</strong> ';
466 if (isset($objMod->module_parts) && is_array($objMod->module_parts[
'hooks']) && count($objMod->module_parts[
'hooks']))
469 foreach ($objMod->module_parts[
'hooks'] as $key => $val)
471 if ($key ===
'entity')
continue;
478 foreach ($val as $value)
480 $text .= ($i ?
', ' :
'').($value);
488 $text .= ($i ?
', ' :
'').($val);
491 }
else $text .= $langs->trans(
"No");
495 $text .=
'<br><strong>'.$langs->trans(
"AddPermissions").
':</strong> ';
496 if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
499 foreach ($objMod->rights as $val)
501 $text .= ($i ?
', ' :
'').($val[1]);
504 }
else $text .= $langs->trans(
"No");
508 $text .=
'<br><strong>'.$langs->trans(
"AddMenus").
':</strong> ';
509 if (isset($objMod->menu) && !empty($objMod->menu))
511 $text .= $langs->trans(
"Yes");
512 }
else $text .= $langs->trans(
"No");
516 $text .=
'<br><strong>'.$langs->trans(
"AddExportProfiles").
':</strong> ';
517 if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
520 foreach ($objMod->export_label as $val)
522 $text .= ($i ?
', ' :
'').($val);
525 }
else $text .= $langs->trans(
"No");
529 $text .=
'<br><strong>'.$langs->trans(
"AddImportProfiles").
':</strong> ';
530 if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
533 foreach ($objMod->import_label as $val)
535 $text .= ($i ?
', ' :
'').($val);
538 }
else $text .= $langs->trans(
"No");
542 $text .=
'<br><strong>'.$langs->trans(
"AddOtherPagesOrServices").
':</strong> ';
543 $text .= $langs->trans(
"DetectionNotPossible");
547 if ($mode ==
'changelog')
549 $changelog = $objMod->getChangeLog();
550 if ($changelog) $text .=
'<div class="moduledesclong">'.$changelog.
'<div>';
551 else $text .=
'<div class="moduledesclong">'.$langs->trans(
"NotAvailable").
'</div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolGetModulesDirs($subdir= '')
Return list of modules directories.
modulehelp_prepare_head($object)
Prepare array with list of tabs.
Class to manage Dolibarr users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
dol_is_file($pathoffile)
Return if path is a file.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage triggers.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...