28require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
40 if (isset($versionarray[0])) {
41 $string = $versionarray[0];
43 if (isset($versionarray[1])) {
44 $string .=
'.'.$versionarray[1];
46 if (isset($versionarray[2])) {
47 $string .=
'.'.$versionarray[2];
71 $count1 = count($versionarray1);
72 $count2 = count($versionarray2);
73 $maxcount = max($count1, $count2);
74 while ($level < $maxcount) {
75 $operande1 = isset($versionarray1[$level]) ? $versionarray1[$level] : 0;
76 $operande2 = isset($versionarray2[$level]) ? $versionarray2[$level] : 0;
77 if (preg_match(
'/alpha|dev/i', $operande1)) {
80 if (preg_match(
'/alpha|dev/i', $operande2)) {
83 if (preg_match(
'/beta$/i', $operande1)) {
86 if (preg_match(
'/beta$/i', $operande2)) {
89 if (preg_match(
'/beta([0-9])+/i', $operande1)) {
92 if (preg_match(
'/beta([0-9])+/i', $operande2)) {
95 if (preg_match(
'/rc$/i', $operande1)) {
98 if (preg_match(
'/rc$/i', $operande2)) {
101 if (preg_match(
'/rc([0-9])+/i', $operande1)) {
104 if (preg_match(
'/rc([0-9])+/i', $operande2)) {
109 if ($operande1 < $operande2) {
113 if ($operande1 > $operande2) {
131 return explode(
'.', PHP_VERSION);
142 return explode(
'.', DOL_VERSION);
169function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler =
'', $okerror =
'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0, $database =
'')
171 global $db, $conf, $langs, $user;
173 dol_syslog(
"Admin.lib::run_sql run sql file ".$sqlfile.
" silent=".$silent.
" entity=".$entity.
" usesavepoint=".$usesavepoint.
" handler=".$handler.
" okerror=".$okerror, LOG_DEBUG);
175 if (!is_numeric($linelengthlimit)) {
176 dol_syslog(
"Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR);
187 $versionarray = $db->getVersionArray();
189 $fp = fopen($sqlfile,
"r");
193 if ($linelengthlimit > 0) {
194 $buf = fgets($fp, $linelengthlimit);
201 if (preg_match(
'/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) {
205 if (!empty($reg[1])) {
206 if (!preg_match(
'/'.preg_quote($reg[1]).
'/i', $db->type)) {
213 if (!empty($reg[2])) {
214 if (is_numeric($reg[2])) {
215 $versionrequest = explode(
'.', $reg[2]);
218 if (!count($versionrequest) || !count($versionarray) ||
versioncompare($versionrequest, $versionarray) > 0) {
222 $dbcollation = strtoupper(preg_replace(
'/_/',
'', $conf->db->dolibarr_main_db_collation));
225 if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) {
235 $buf = preg_replace(
'/^--\sV(MYSQL|PGSQL)([^\s]*)/i',
'', $buf);
241 if ($nocommentremoval || !preg_match(
'/^\s*--/', $buf)) {
242 if (empty($nocommentremoval)) {
243 $buf = preg_replace(
'/([,;ERLT\)])\s*--.*$/i',
'\1', $buf);
248 $buffer .= trim($buf);
253 if (preg_match(
'/;/', $buffer)) {
256 $arraysql[$i] = $buffer;
264 $arraysql[$i] = $buffer;
268 dol_syslog(
"Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR);
272 $listofmaxrowid = array();
273 foreach ($arraysql as $i => $sql) {
277 while (preg_match(
'/__\+MAX_([A-Za-z0-9_]+)__/i', $newsql, $reg)) {
279 if (!isset($listofmaxrowid[$table])) {
281 $sqlgetrowid =
'SELECT MAX(rowid) as max from '.preg_replace(
'/^llx_/', MAIN_DB_PREFIX, $table);
282 $resql = $db->query($sqlgetrowid);
284 $obj = $db->fetch_object($resql);
285 $listofmaxrowid[$table] = $obj->max;
286 if (empty($listofmaxrowid[$table])) {
287 $listofmaxrowid[$table] = 0;
291 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
292 print
'<div class="error">'.$langs->trans(
"Failed to get max rowid for ".$table).
"</div>";
300 $from =
'__+MAX_'.$table.
'__';
301 $to =
'+'.$listofmaxrowid[$table];
302 $newsql = str_replace($from, $to, $newsql);
303 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1).
' (replacing '.$from.
' to '.$to.
')', LOG_DEBUG);
305 $arraysql[$i] = $newsql;
308 if ($offsetforchartofaccount > 0) {
314 $newsql = preg_replace(
'/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims',
'VALUES (__ENTITY__, \1 + '.((
int) $offsetforchartofaccount).
', \2, \3 + '.((
int) $offsetforchartofaccount), $newsql);
315 $newsql = preg_replace(
'/([,\s])0 \+ '.((
int) $offsetforchartofaccount).
'/ims',
'\1 0', $newsql);
317 $arraysql[$i] = $newsql;
326 $listofinsertedrowid = array();
327 $keyforsql = md5($sqlfile);
328 foreach ($arraysql as $i => $sql) {
331 if ($onlysqltoimportwebsite) {
332 $newsql = str_replace(array(
"\'"),
'__BACKSLASHQUOTE__', $sql);
335 $l = strlen($newsql);
340 $char = $newsql[$is];
347 } elseif (empty($quoteopen)) {
348 $newsqlclean .= $char;
352 $newsqlclean = str_replace(array(
"null"),
'__000__', $newsqlclean);
358 if (preg_match(
'/^--/', $newsqlclean)) {
360 } elseif (preg_match(
'/^UPDATE llx_website SET \w+ = \d+\+\d+ WHERE rowid = \d+;$/', $newsqlclean)) {
362 } elseif (preg_match(
'/^INSERT INTO llx_website_page\([a-z0-9_\s,]+\) VALUES\([0-9_\s,\+]+\);$/', $newsqlclean)) {
370 if (preg_match(
'/^UPDATE llx_website SET \w+ = \'[a-zA-Z,\s]*\' WHERE rowid = \d+;$/', $sql)) {
379 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1).
" contains non allowed instructions.", LOG_WARNING);
380 dol_syslog(
'$newsqlclean='.$newsqlclean, LOG_DEBUG);
386 if (MAIN_DB_PREFIX !=
'llx_') {
387 $sql = preg_replace(
'/llx_/i', MAIN_DB_PREFIX, $sql);
390 if (!empty($handler)) {
391 $sql = preg_replace(
'/__HANDLER__/i',
"'".$db->escape($handler).
"'", $sql);
394 if (!empty($database)) {
395 $sql = preg_replace(
'/__DATABASE__/i', $db->escape($database), $sql);
398 $newsql = preg_replace(
'/__ENTITY__/i', (!empty($entity) ? $entity : $conf->entity), $sql);
402 print
'<tr class="trforrunsql'.$keyforsql.
'"><td class="tdtop opacitymedium"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>'.$langs->trans(
"Request").
' '.($i + 1).
" sql='".
dol_htmlentities($newsql, ENT_NOQUOTES).
"'</td></tr>\n";
404 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG);
408 if (preg_match_all(
'/__ENCRYPT\(\'([^\']+)\'\)__/i', $newsql, $reg)) {
409 $num = count($reg[0]);
411 for ($j = 0; $j < $num; $j++) {
413 $to = $db->encrypt($reg[1][$j]);
414 $newsql = str_replace($from, $to, $newsql);
420 if (preg_match_all(
'/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i', $newsql, $reg)) {
421 $num = count($reg[0]);
423 for ($j = 0; $j < $num; $j++) {
425 $to = $db->decrypt($reg[1][$j]);
426 $newsql = str_replace($from, $to, $newsql);
432 while (preg_match(
'/__([0-9]+)__/', $newsql, $reg)) {
434 if (empty($listofinsertedrowid[$cursor])) {
436 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
437 print
'<div class="error">'.$langs->trans(
"FileIsNotCorrect").
"</div>";
444 $from =
'__'.$cursor.
'__';
445 $to = $listofinsertedrowid[$cursor];
446 $newsql = str_replace($from, $to, $newsql);
451 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1), LOG_DEBUG);
454 $result = $db->query($newsql, $usesavepoint);
457 print
'<!-- Result = OK -->'.
"\n";
460 if (preg_replace(
'/insert into ([^\s]+)/i', $newsql, $reg)) {
464 $table = preg_replace(
'/([^a-zA-Z_]+)/i',
'', $reg[1]);
465 $insertedrowid = $db->last_insert_id($table);
466 $listofinsertedrowid[$cursorinsert] = $insertedrowid;
467 dol_syslog(
'Admin.lib::run_sql Insert nb '.$cursorinsert.
', done in table '.$table.
', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG);
471 $errno = $db->errno();
473 print
'<!-- Result = '.$errno.
' -->'.
"\n";
478 'DB_ERROR_TABLE_ALREADY_EXISTS',
479 'DB_ERROR_COLUMN_ALREADY_EXISTS',
480 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
481 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS',
482 'DB_ERROR_RECORD_ALREADY_EXISTS',
483 'DB_ERROR_NOSUCHTABLE',
484 'DB_ERROR_NOSUCHFIELD',
485 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
486 'DB_ERROR_NO_INDEX_TO_DROP',
487 'DB_ERROR_CANNOT_CREATE',
488 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
489 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
492 if ($okerror ==
'none') {
497 if (!in_array($errno, $okerrors)) {
499 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
500 print
'<div class="error">'.$langs->trans(
"Error").
" ".$db->errno().
" (Req ".($i + 1).
"): ".$newsql.
"<br>".$db->error().
"</div>";
501 print
'</td></tr>'.
"\n";
503 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1).
" Error ".$db->errno().
" ".$newsql.
"<br>".$db->error(), LOG_ERR);
511 print
'<tr><td>'.$langs->trans(
"ProcessMigrateScript").
'</td>';
512 print
'<td class="right">';
514 print
'<span class="ok">'.$langs->trans(
"OK").
'</span>';
516 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
520 print
'<script type="text/javascript">
521 jQuery(document).ready(function() {
522 function init_trrunsql'.$keyforsql.
'()
524 console.log("toggle .trforrunsql'.$keyforsql.
'");
525 jQuery(".trforrunsql'.$keyforsql.
'").toggle();
527 init_trrunsql'.$keyforsql.
'();
528 jQuery(".trforrunsqlshowhide'.$keyforsql.
'").click(function() {
529 init_trrunsql'.$keyforsql.
'();
533 if (count($arraysql)) {
534 print
' - <a class="trforrunsqlshowhide'.$keyforsql.
'" href="#" title="'.($langs->trans(
"ShowHideTheNRequests", count($arraysql))).
'">'.$langs->trans(
"ShowHideDetails").
'</a>';
536 print
' - <span class="opacitymedium">'.$langs->trans(
"ScriptIsEmpty").
'</span>';
540 print
'</td></tr>'.
"\n";
568 dol_print_error(
'',
'Error call dolibar_del_const with parameter name empty');
572 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
573 $sql .=
" WHERE (".$db->decrypt(
'name').
" = '".$db->escape($name).
"'";
574 if (is_numeric($name)) {
575 $sql .=
" OR rowid = ".((int) $name);
579 $sql .=
" AND entity = ".((int) $entity);
582 dol_syslog(
"admin.lib::dolibarr_del_const", LOG_DEBUG);
583 $resql = $db->query($sql);
585 $conf->global->$name =
'';
607 $sql =
"SELECT ".$db->decrypt(
'value').
" as value";
608 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
609 $sql .=
" WHERE name = ".$db->encrypt($name);
610 $sql .=
" AND entity = ".((int) $entity);
612 dol_syslog(
"admin.lib::dolibarr_get_const", LOG_DEBUG);
613 $resql = $db->query($sql);
615 $obj = $db->fetch_object($resql);
617 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
639function dolibarr_set_const($db, $name, $value, $type =
'chaine', $visible = 0, $note =
'', $entity = 1)
648 dol_print_error($db,
"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR);
656 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
657 $sql .=
" WHERE name = ".$db->encrypt($name);
659 $sql .=
" AND entity = ".((int) $entity);
662 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
663 $resql = $db->query($sql);
665 if (strcmp($value,
'')) {
666 if (!preg_match(
'/^(MAIN_LOGEVENTS|MAIN_AGENDA_ACTIONAUTO)/', $name) && (preg_match(
'/(_KEY|_EXPORTKEY|_SECUREKEY|_SERVERKEY|_PASS|_PASSWORD|_PW|_PW_TICKET|_PW_EMAILING|_SECRET|_SECURITY_TOKEN|_WEB_TOKEN)$/', $name))) {
671 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
677 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const(name, value, type, visible, note, entity)";
679 $sql .= $db->encrypt($name);
680 $sql .=
", ".$db->encrypt($newvalue);
681 $sql .=
", '".$db->escape($type).
"', ".((int) $visible).
", '".$db->escape($note).
"', ".((int) $entity).
")";
685 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
686 $resql = $db->query($sql);
691 $conf->global->$name = $value;
694 $error = $db->lasterror();
713 global $langs, $conf, $user, $form;
715 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
716 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off'), $desc);
721 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=".$mode;
722 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
724 $head[$h][1] = $langs->trans(
"AvailableModules");
725 $head[$h][1] .= $form->textwithpicto(
'', $langs->trans(
"YouMustEnableOneModule").
'.<br><br><span class="opacitymedium">'.$desc.
'</span>', 1,
'warning');
728 $head[$h][1] = $langs->trans(
"AvailableModules").
'<span class="badge marginleftonly">'.$nbofactivatedmodules.
' / '.$nboftotalmodules.
'</span>';
730 $head[$h][2] =
'modules';
733 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=marketplace";
734 $head[$h][1] = $langs->trans(
"ModulesMarketPlaces");
735 $head[$h][2] =
'marketplace';
738 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=deploy";
739 $head[$h][1] = $langs->trans(
"AddExtensionThemeModuleOrOther");
740 $head[$h][2] =
'deploy';
743 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=develop";
744 $head[$h][1] = $langs->trans(
"ModulesDevelopYourModule");
745 $head[$h][2] =
'develop';
758 global $langs, $conf, $user;
762 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=other";
763 $head[$h][1] = $langs->trans(
"LanguageAndPresentation");
764 $head[$h][2] =
'other';
767 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=template";
768 $head[$h][1] = $langs->trans(
"SkinAndColors");
769 $head[$h][2] =
'template';
772 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=dashboard";
773 $head[$h][1] = $langs->trans(
"Dashboard");
774 $head[$h][2] =
'dashboard';
777 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=login";
778 $head[$h][1] = $langs->trans(
"LoginPage");
779 $head[$h][2] =
'login';
782 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=css";
783 $head[$h][1] = $langs->trans(
"CSSPage");
784 $head[$h][2] =
'css';
803 global $db, $langs, $conf, $user;
807 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_other.php";
808 $head[$h][1] = $langs->trans(
"Miscellaneous");
809 $head[$h][2] =
'misc';
812 $head[$h][0] = DOL_URL_ROOT.
"/admin/security.php";
813 $head[$h][1] = $langs->trans(
"Passwords");
814 $head[$h][2] =
'passwords';
817 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_file.php";
818 $head[$h][1] = $langs->trans(
"Files").
' ('.$langs->trans(
"Upload").
')';
819 $head[$h][2] =
'file';
829 $head[$h][0] = DOL_URL_ROOT.
"/admin/proxy.php";
830 $head[$h][1] = $langs->trans(
"ExternalAccess");
831 $head[$h][2] =
'proxy';
834 $head[$h][0] = DOL_URL_ROOT.
"/admin/events.php";
835 $head[$h][1] = $langs->trans(
"Audit");
836 $head[$h][2] =
'audit';
842 $sql =
"SELECT COUNT(r.id) as nb";
843 $sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
844 $sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
845 $sql .=
" AND entity = ".((int) $conf->entity);
846 $sql .=
" AND bydefault = 1";
848 $sql .=
" AND r.perms NOT LIKE '%_advance'";
850 $resql = $db->query($sql);
852 $obj = $db->fetch_object($resql);
860 $head[$h][0] = DOL_URL_ROOT.
"/admin/perms.php";
861 $head[$h][1] = $langs->trans(
"DefaultRights");
863 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.$nbPerms.
'</span>' :
'');
865 $head[$h][2] =
'default';
879 global $langs, $conf;
884 $object->id = $object->numero;
886 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=desc';
887 $head[$h][1] = $langs->trans(
"Description");
888 $head[$h][2] =
'desc';
891 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=feature';
892 $head[$h][1] = $langs->trans(
"TechnicalServicesProvided");
893 $head[$h][2] =
'feature';
896 if ($object->isCoreOrExternalModule() ==
'external') {
897 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=changelog';
898 $head[$h][1] = $langs->trans(
"ChangeLog");
899 $head[$h][2] =
'changelog';
917 global $langs, $conf;
921 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=searchkey";
922 $head[$h][1] = $langs->trans(
"TranslationKeySearch");
923 $head[$h][2] =
'searchkey';
926 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=overwrite";
927 $head[$h][1] =
'<span class="valignmiddle">'.$langs->trans(
"TranslationOverwriteKey").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
928 $head[$h][2] =
'overwrite';
947 global $langs, $conf, $user;
951 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=createform";
952 $head[$h][1] = $langs->trans(
"DefaultCreateForm");
953 $head[$h][2] =
'createform';
956 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=filters";
957 $head[$h][1] = $langs->trans(
"DefaultSearchFilters");
958 $head[$h][2] =
'filters';
961 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=sortorder";
962 $head[$h][1] = $langs->trans(
"DefaultSortOrder");
963 $head[$h][2] =
'sortorder';
966 if (!empty($conf->use_javascript_ajax)) {
967 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=focus";
968 $head[$h][1] = $langs->trans(
"DefaultFocus");
969 $head[$h][2] =
'focus';
972 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=mandatory";
973 $head[$h][1] = $langs->trans(
"DefaultMandatory");
974 $head[$h][2] =
'mandatory';
1001 $arrayofSessions = array();
1004 $iniPath = ini_get(
"session.save_path");
1006 $sessPath = $iniPath;
1009 dol_syslog(
'admin.lib:listOfSessions sessPath='.$sessPath);
1013 while (($file = @readdir($dh)) !==
false) {
1014 if (preg_match(
'/^sess_/i', $file) && $file !=
"." && $file !=
"..") {
1015 $fullpath = $sessPath.$file;
1016 if (!@is_dir($fullpath) && is_readable($fullpath)) {
1017 $sessValues = file_get_contents($fullpath);
1023 if (preg_match(
'/dol_login/i', $sessValues) &&
1024 (preg_match(
'/dol_entity\|i:'.$conf->entity.
';/i', $sessValues) || preg_match(
'/dol_entity\|s:([0-9]+):"'.$conf->entity.
'"/i', $sessValues)) &&
1025 preg_match(
'/dol_company\|s:([0-9]+):"('.
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM').
')"/i', $sessValues)) {
1026 $tmp = explode(
'_', $file);
1029 $loginfound = preg_match(
'/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs);
1031 $arrayofSessions[$idsess][
"login"] = $regs[1];
1033 $arrayofSessions[$idsess][
"age"] = time() - filectime($fullpath);
1034 $arrayofSessions[$idsess][
"creation"] = filectime($fullpath);
1035 $arrayofSessions[$idsess][
"modification"] = filemtime($fullpath);
1036 $arrayofSessions[$idsess][
"raw"] = $sessValues;
1044 return $arrayofSessions;
1057 $sessPath = ini_get(
"session.save_path").
"/";
1058 dol_syslog(
'admin.lib:purgeSessions mysessionid='.$mysessionid.
' sessPath='.$sessPath);
1064 while (($file = @readdir($dh)) !==
false) {
1065 if ($file !=
"." && $file !=
"..") {
1066 $fullpath = $sessPath.$file;
1067 if (!@is_dir($fullpath)) {
1068 $sessValues = file_get_contents($fullpath);
1070 if (preg_match(
'/dol_login/i', $sessValues) &&
1071 preg_match(
'/dol_entity\|s:([0-9]+):"('.$conf->entity.
')"/i', $sessValues) &&
1072 preg_match(
'/dol_company\|s:([0-9]+):"(' .
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM').
')"/i', $sessValues)) {
1073 $tmp = explode(
'_', $file);
1076 if ($idsess != $mysessionid) {
1077 $res = @unlink($fullpath);
1108 global $db, $langs, $conf, $mysoc;
1113 if (empty($value)) {
1114 $ret[
'errors'][] =
'ErrorBadParameter';
1118 $ret = array(
'nbmodules'=>0,
'errors'=>array(),
'nbperms'=>0);
1120 $modFile = $modName.
".class.php";
1127 foreach ($modulesdir as $dir) {
1128 if (file_exists($dir.$modFile)) {
1129 $found = @include_once $dir.$modFile;
1136 $objMod =
new $modName($db);
1140 $vermin = isset($objMod->phpmin) ? $objMod->phpmin : 0;
1142 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequirePHPVersion",
versiontostring($vermin));
1148 $vermin = isset($objMod->need_dolibarr_version) ? $objMod->need_dolibarr_version : 0;
1151 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireDolibarrVersion",
versiontostring($vermin));
1156 if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) {
1157 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireJavascript");
1161 $const_name = $objMod->const_name;
1162 if ($noconfverification == 0) {
1168 $result = $objMod->init();
1171 $ret[
'errors'][] = $objMod->error;
1174 if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) {
1177 foreach ($objMod->depends as $key => $modulestringorarray) {
1179 if ((!is_numeric($key)) && !preg_match(
'/^always/', $key) && $mysoc->country_code && !preg_match(
'/^'.$mysoc->country_code.
'/', $key)) {
1180 dol_syslog(
"We are not concerned by dependency with key=".$key.
" because our country is ".$mysoc->country_code);
1184 if (!is_array($modulestringorarray)) {
1185 $modulestringorarray = array($modulestringorarray);
1188 foreach ($modulestringorarray as $modulestring) {
1191 foreach ($modulesdir as $dir) {
1192 if (file_exists($dir.$modulestring.
".class.php")) {
1194 if (empty($resarray[
'errors'])) {
1197 $activateerr = join(
', ', $resarray[
'errors']);
1198 foreach ($resarray[
'errors'] as $errorMessage) {
1207 $ret[
'nbmodules'] += $resarray[
'nbmodules'];
1208 $ret[
'nbperms'] += $resarray[
'nbperms'];
1211 $ret[
'errors'][] = $activateerr;
1213 $ret[
'errors'][] = $langs->trans(
'activateModuleDependNotSatisfied', $objMod->name, $modulestring);
1219 if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && !empty($objMod->conflictwith)) {
1221 $num = count($objMod->conflictwith);
1222 for ($i = 0; $i < $num; $i++) {
1223 foreach ($modulesdir as $dir) {
1224 if (file_exists($dir.$objMod->conflictwith[$i].
".class.php")) {
1233 if (!count($ret[
'errors'])) {
1234 $ret[
'nbmodules']++;
1235 $ret[
'nbperms'] += (is_array($objMod->rights) ? count($objMod->rights) : 0);
1251 global $db, $modules, $conf;
1254 if (empty($value)) {
1255 return 'ErrorBadParameter';
1260 $modFile = $modName.
".class.php";
1267 foreach ($modulesdir as $dir) {
1268 if (file_exists($dir.$modFile)) {
1269 $found = @include_once $dir.$modFile;
1277 $objMod =
new $modName($db);
1278 $result = $objMod->remove();
1280 $ret = $objMod->error;
1285 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
1287 $genericMod->name = preg_replace(
'/^mod/i',
'', $modName);
1288 $genericMod->rights_class = strtolower(preg_replace(
'/^mod/i',
'', $modName));
1289 $genericMod->const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', $modName));
1290 dol_syslog(
"modules::unActivateModule Failed to find module file, we use generic function with name ".$modName);
1291 $genericMod->remove(
'');
1295 if (!$ret && $requiredby && is_object($objMod) && is_array($objMod->requiredby)) {
1296 $countrb = count($objMod->requiredby);
1297 for ($i = 0; $i < $countrb; $i++) {
1325function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabcomplete)
1327 global $db, $modules, $conf, $langs;
1329 dol_syslog(
"complete_dictionary_with_modules Search external modules to complete the list of dictionnary tables", LOG_DEBUG, 1);
1336 foreach ($modulesdir as $dir) {
1339 dol_syslog(
"Scan directory ".$dir.
" for modules");
1341 if (is_resource($handle)) {
1342 while (($file = readdir($handle)) !==
false) {
1344 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1345 $modName = substr($file, 0,
dol_strlen($file) - 10);
1348 include_once $dir.$file;
1349 $objMod =
new $modName($db);
1351 if ($objMod->numero > 0) {
1352 $j = $objMod->numero;
1357 $modulequalified = 1;
1360 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1362 $modulequalified = 0;
1365 $modulequalified = 0;
1369 $modulequalified = 0;
1372 if ($modulequalified) {
1374 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1375 foreach ($objMod->langfiles as $langfile) {
1376 $langs->load($langfile);
1381 if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries)) {
1382 $objMod->dictionaries = $objMod->dictionnaries;
1385 if (!empty($objMod->dictionaries)) {
1387 $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0;
1388 $tabnamerelwithkey = array();
1389 foreach ($objMod->dictionaries[
'tabname'] as $key => $val) {
1390 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $val);
1392 $taborder[] = max($taborder) + 1;
1394 $tabnamerelwithkey[$key] = $val;
1395 $tabcomplete[$tmptablename][
'picto'] = $objMod->picto;
1397 foreach ($objMod->dictionaries[
'tablib'] as $key => $val) {
1398 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1401 $tabcomplete[$tmptablename][
'lib'] = $val;
1403 foreach ($objMod->dictionaries[
'tabsql'] as $key => $val) {
1404 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1407 $tabcomplete[$tmptablename][
'sql'] = $val;
1409 foreach ($objMod->dictionaries[
'tabsqlsort'] as $key => $val) {
1410 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1412 $tabsqlsort[] = $val;
1413 $tabcomplete[$tmptablename][
'sqlsort'] = $val;
1415 foreach ($objMod->dictionaries[
'tabfield'] as $key => $val) {
1416 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1419 $tabcomplete[$tmptablename][
'field'] = $val;
1421 foreach ($objMod->dictionaries[
'tabfieldvalue'] as $key => $val) {
1422 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1424 $tabfieldvalue[] = $val;
1425 $tabcomplete[$tmptablename][
'value'] = $val;
1427 foreach ($objMod->dictionaries[
'tabfieldinsert'] as $key => $val) {
1428 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1429 $nbtabfieldinsert++;
1430 $tabfieldinsert[] = $val;
1431 $tabcomplete[$tmptablename][
'fieldinsert'] = $val;
1433 foreach ($objMod->dictionaries[
'tabrowid'] as $key => $val) {
1434 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1437 $tabcomplete[$tmptablename][
'rowid'] = $val;
1439 foreach ($objMod->dictionaries[
'tabcond'] as $key => $val) {
1440 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1443 $tabcomplete[$tmptablename][
'rowid'] = $val;
1445 if (!empty($objMod->dictionaries[
'tabhelp'])) {
1446 foreach ($objMod->dictionaries[
'tabhelp'] as $key => $val) {
1447 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1450 $tabcomplete[$tmptablename][
'help'] = $val;
1453 if (!empty($objMod->dictionaries[
'tabfieldcheck'])) {
1454 foreach ($objMod->dictionaries[
'tabfieldcheck'] as $key => $val) {
1455 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1457 $tabcomplete[$tmptablename][
'fieldcheck'] = $val;
1461 if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) {
1462 print
'Error in descriptor of module '.$const_name.
'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
1472 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1479 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1496 global $db, $conf, $langs;
1500 foreach ($modulesdir as $dir) {
1502 dol_syslog(
"Scan directory ".$dir.
" for modules");
1504 if (is_resource($handle)) {
1505 while (($file = readdir($handle)) !==
false) {
1506 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1507 $modName = substr($file, 0,
dol_strlen($file) - 10);
1510 include_once $dir.$file;
1511 $objMod =
new $modName($db);
1513 $modulequalified = 1;
1516 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1518 if ($objMod->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
1519 $modulequalified = 0;
1521 if ($objMod->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
1522 $modulequalified = 0;
1525 $modulequalified = 0;
1528 if ($modulequalified) {
1530 if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) {
1533 setEventMessages($objMod->automatic_activation[$country_code],
null,
'warnings');
1536 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1543 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1558 global $db, $modules, $conf, $langs;
1561 $filename = array();
1570 dol_syslog(
"complete_elementList_with_modules Search external modules to complete the list of contact element", LOG_DEBUG, 1);
1574 foreach ($modulesdir as $dir) {
1577 dol_syslog(
"Scan directory ".$dir.
" for modules");
1579 if (is_resource($handle)) {
1580 while (($file = readdir($handle)) !==
false) {
1582 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1583 $modName = substr($file, 0,
dol_strlen($file) - 10);
1586 include_once $dir.$file;
1587 $objMod =
new $modName($db);
1589 if ($objMod->numero > 0) {
1590 $j = $objMod->numero;
1595 $modulequalified = 1;
1598 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1600 $modulequalified = 0;
1603 $modulequalified = 0;
1607 $modulequalified = 0;
1610 if ($modulequalified) {
1612 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1613 foreach ($objMod->langfiles as $langfile) {
1614 $langs->load($langfile);
1618 $modules[$i] = $objMod;
1619 $filename[$i] = $modName;
1620 $orders[$i] = $objMod->family.
"_".$j;
1624 if (!empty($objMod->module_parts[
'contactelement'])) {
1625 if (is_array($objMod->module_parts[
'contactelement'])) {
1626 foreach ($objMod->module_parts[
'contactelement'] as $elem => $title) {
1627 $elementList[$elem] = $langs->trans($title);
1630 $elementList[$objMod->name] = $langs->trans($objMod->name);
1637 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1644 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1665 global $db, $langs, $conf, $user;
1666 global $_Avery_Labels;
1668 $form =
new Form($db);
1670 if (empty($strictw3c)) {
1671 dol_syslog(
"Warning: Function form_constantes is calle with parameter strictw3c = 0, this is deprecated. Value must be 2 now.", LOG_DEBUG);
1673 if (!empty($strictw3c) && $strictw3c == 1) {
1674 print
"\n".
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1675 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1676 print
'<input type="hidden" name="action" value="updateall">';
1679 print
'<div class="div-table-responsive-no-min">';
1680 print
'<table class="noborder centpercent">';
1681 print
'<tr class="liste_titre">';
1682 print
'<td class="">'.$langs->trans(
"Description").
'</td>';
1684 $text = $langs->trans($text);
1685 print $form->textwithpicto($text, $helptext, 1,
'help',
'', 0, 2,
'idhelptext');
1687 if (empty($strictw3c)) {
1688 print
'<td class="center" width="80">'.$langs->trans(
"Action").
'</td>';
1693 foreach ($tableau as $key => $const) {
1696 if (is_numeric($key)) {
1699 if (is_array($const)) {
1700 $type = $const[
'type'];
1701 $label = $const[
'label'];
1711 $sql .=
", ".$db->decrypt(
'name').
" as name";
1712 $sql .=
", ".$db->decrypt(
'value').
" as value";
1715 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
1716 $sql .=
" WHERE ".$db->decrypt(
'name').
" = '".$db->escape($const).
"'";
1717 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
1718 $sql .=
" ORDER BY name ASC, entity DESC";
1719 $result = $db->query($sql);
1723 $obj = $db->fetch_object($result);
1726 $obj = (object) array(
'rowid'=>
'',
'name'=>$const,
'value'=>
'',
'type'=>$type,
'note'=>
'');
1729 if (empty($strictw3c)) {
1730 print
"\n".
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1731 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1732 print
'<input type="hidden" name="page_y" value="'.newToken().
'">';
1735 print
'<tr class="oddeven">';
1739 if (empty($strictw3c)) {
1740 print
'<input type="hidden" name="action" value="update">';
1742 print
'<input type="hidden" name="rowid'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$obj->rowid.
'">';
1743 print
'<input type="hidden" name="constname'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$const.
'">';
1744 print
'<input type="hidden" name="constnote_'.$obj->name.
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1745 print
'<input type="hidden" name="consttype_'.$obj->name.
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1746 if (!empty($tableau[$key][
'tooltip'])) {
1747 print $form->textwithpicto($label ? $label : $langs->trans(
'Desc'.$const), $tableau[$key][
'tooltip']);
1749 print($label ? $label : $langs->trans(
'Desc'.$const));
1752 if ($const ==
'ADHERENT_MAILMAN_URL') {
1753 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick1">'.
img_down().
'</a><br>';
1755 print
'<div id="example1" class="hidden">';
1756 print
'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0';
1758 } elseif ($const ==
'ADHERENT_MAILMAN_UNSUB_URL') {
1759 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick2">'.
img_down().
'</a><br>';
1760 print
'<div id="example2" class="hidden">';
1761 print
'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&send_unsub_ack_to_this_batch=0&send_unsub_notifications_to_list_owner=0';
1764 } elseif ($const ==
'ADHERENT_MAILMAN_LISTS') {
1765 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick3">'.
img_down().
'</a><br>';
1766 print
'<div id="example3" class="hidden">';
1767 print
'mymailmanlist<br>';
1768 print
'mymailmanlist1,mymailmanlist2<br>';
1769 print
'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>';
1770 if (isModEnabled(
'categorie')) {
1771 print
'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
1775 } elseif (in_array($const, [
'ADHERENT_MAIL_FROM',
'ADHERENT_CC_MAIL_FROM'])) {
1776 print
' '.img_help(1, $langs->trans(
"EMailHelpMsgSPFDKIM"));
1782 if ($const ==
'ADHERENT_CARD_TYPE' || $const ==
'ADHERENT_ETIQUETTE_TYPE') {
1785 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
1786 $arrayoflabels = array();
1787 foreach (array_keys($_Avery_Labels) as $codecards) {
1788 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards][
'name'];
1790 print $form->selectarray(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $arrayoflabels, ($obj->value ? $obj->value :
'CARD'), 1, 0, 0);
1791 print
'<input type="hidden" name="consttype" value="yesno">';
1792 print
'<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1796 print
'<input type="hidden" name="consttype'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1797 print
'<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1798 if ($obj->type ==
'textarea' || in_array($const, array(
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_ETIQUETTE_TEXT'))) {
1799 print
'<textarea class="flat" name="constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" cols="50" rows="5" wrap="soft">'.
"\n";
1801 print
"</textarea>\n";
1802 } elseif ($obj->type ==
'html') {
1803 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1804 $doleditor =
new DolEditor(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $obj->value,
'', 160,
'dolibarr_notes',
'',
false,
false, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
1805 $doleditor->Create();
1806 } elseif ($obj->type ==
'yesno') {
1807 print $form->selectyesno(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $obj->value, 1);
1808 } elseif (preg_match(
'/emailtemplate/', $obj->type)) {
1809 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1812 $tmp = explode(
':', $obj->type);
1814 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, -1);
1816 $arrayofmessagename = array();
1817 if (is_array($formmail->lines_model)) {
1818 foreach ($formmail->lines_model as $modelmail) {
1821 if (!empty($arrayofmessagename[$modelmail->label])) {
1822 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
1825 $arrayofmessagename[$modelmail->label.
':'.$tmp[1]] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)).$moreonlabel;
1830 print $form->selectarray(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $arrayofmessagename, $obj->value.
':'.$tmp[1],
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
1831 } elseif (preg_match(
'/MAIL_FROM$/i', $const)) {
1832 print
img_picto(
'',
'email',
'class="pictofixedwidth"').
'<input type="text" class="flat minwidth300" name="constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.
dol_escape_htmltag($obj->value).
'">';
1834 print
'<input type="text" class="flat minwidth300" name="constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.
dol_escape_htmltag($obj->value).
'">';
1840 if (empty($strictw3c)) {
1841 print
'<td class="center">';
1842 print
'<input type="submit" class="button small reposition" value="'.$langs->trans(
"Update").
'" name="update">';
1848 if (empty($strictw3c)) {
1856 if (!empty($strictw3c) && $strictw3c == 1) {
1857 print
'<div align="center"><input type="submit" class="button small reposition" value="'.$langs->trans(
"Update").
'" name="update"></div>';
1871 global $conf, $langs;
1873 $text = $langs->trans(
"OnlyFollowingModulesAreOpenedToExternalUsers");
1877 if (!empty($modules)) {
1879 foreach ($tmpmodules as $module) {
1880 $moduleconst = $module->const_name;
1881 $modulename = strtolower($module->name);
1885 if (!in_array($modulename, $listofmodules)) {
1897 $tmptext = $langs->trans(
'Module'.$module->numero.
'Name');
1898 if ($tmptext !=
'Module'.$module->numero.
'Name') {
1899 $text .= $langs->trans(
'Module'.$module->numero.
'Name');
1901 $text .= $langs->trans($module->name);
1925 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity, libelle, description)";
1926 $sql .=
" VALUES ('".$db->escape($name).
"','".$db->escape($type).
"',".((int) $conf->entity).
", ";
1927 $sql .= ($label ?
"'".$db->escape($label).
"'" :
'null').
", ";
1928 $sql .= (!empty($description) ?
"'".$db->escape($description).
"'" :
"null");
1931 dol_syslog(
"admin.lib::addDocumentModel", LOG_DEBUG);
1932 $resql = $db->query($sql);
1956 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"document_model";
1957 $sql .=
" WHERE nom = '".$db->escape($name).
"'";
1958 $sql .=
" AND type = '".$db->escape($type).
"'";
1959 $sql .=
" AND entity = ".((int) $conf->entity);
1961 dol_syslog(
"admin.lib::delDocumentModel", LOG_DEBUG);
1962 $resql = $db->query($sql);
1983 $phpinfostring = ob_get_contents();
1986 $info_arr = array();
1987 $info_lines = explode(
"\n", strip_tags($phpinfostring,
"<tr><td><h2>"));
1989 foreach ($info_lines as $line) {
1992 preg_match(
"~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] :
null;
1994 if (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1995 $info_arr[trim($cat)][trim($val[1])] = $val[2];
1996 } elseif (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1997 $info_arr[trim($cat)][trim($val[1])] = array(
"local" => $val[2],
"master" => $val[3]);
2010 global $langs, $conf;
2015 $head[$h][0] = DOL_URL_ROOT.
"/admin/company.php";
2016 $head[$h][1] = $langs->trans(
"Company");
2017 $head[$h][2] =
'company';
2020 $head[$h][0] = DOL_URL_ROOT.
"/admin/openinghours.php";
2021 $head[$h][1] = $langs->trans(
"OpeningHours");
2022 $head[$h][2] =
'openinghours';
2025 $head[$h][0] = DOL_URL_ROOT.
"/admin/accountant.php";
2026 $head[$h][1] = $langs->trans(
"Accountant");
2027 $head[$h][2] =
'accountant';
2030 $head[$h][0] = DOL_URL_ROOT.
"/admin/company_socialnetworks.php";
2031 $head[$h][1] = $langs->trans(
"SocialNetworksInformation");
2032 $head[$h][2] =
'socialnetworks';
2049 global $langs, $conf, $user;
2054 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
2055 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails.php";
2056 $head[$h][1] = $langs->trans(
"OutGoingEmailSetup");
2057 $head[$h][2] =
'common';
2060 if (isModEnabled(
'mailing')) {
2061 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_emailing.php";
2062 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"EMailing"));
2063 $head[$h][2] =
'common_emailing';
2067 if (isModEnabled(
'ticket')) {
2068 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_ticket.php";
2069 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"Ticket"));
2070 $head[$h][2] =
'common_ticket';
2076 if (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates') {
2077 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_senderprofile_list.php";
2078 $head[$h][1] = $langs->trans(
"EmailSenderProfiles");
2079 $head[$h][2] =
'senderprofiles';
2083 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_templates.php";
2084 $head[$h][1] = $langs->trans(
"EMailTemplates");
2085 $head[$h][2] =
'templates';
2088 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_ingoing.php";
2089 $head[$h][1] = $langs->trans(
"InGoingEmailSetup", $langs->transnoentitiesnoconv(
"EMailing"));
2090 $head[$h][2] =
'common_ingoing';
versiontostring($versionarray)
Renvoi une version en chaine depuis une version en tableau.
security_prepare_head()
Prepare array with list of tabs.
run_sql($sqlfile, $silent=1, $entity=0, $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0, $colspan=0, $onlysqltoimportwebsite=0, $database='')
Launch a sql file.
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
purgeSessions($mysessionid)
Purge existing sessions.
unActivateModule($value, $requiredby=1)
Disable a module.
activateModule($value, $withdeps=1, $noconfverification=0)
Enable a module.
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabcomplete)
Add external modules to list of dictionaries.
versiondolibarrarray()
Return version Dolibarr.
activateModulesRequiredByCountry($country_code)
Activate external modules mandatory when country is country_code.
delDocumentModel($name, $type)
Delete document model used by doc generator.
showModulesExludedForExternal($modules)
Show array with constants to edit.
versionphparray()
Return version PHP.
ihm_prepare_head()
Prepare array with list of tabs.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
modulehelp_prepare_head($object)
Prepare array with list of tabs.
listOfSessions()
Return list of session.
phpinfo_array()
Return the php_info into an array.
dolibarr_get_const($db, $name, $entity=1)
Get the value of a setup constant from database.
form_constantes($tableau, $strictw3c=0, $helptext='', $text='Value')
Show array with constants to edit.
modules_prepare_head($nbofactivatedmodules, $nboftotalmodules, $nbmodulesnotautoenabled)
Prepare array with list of tabs.
complete_elementList_with_modules(&$elementList)
Search external modules to complete the list of contact element.
email_admin_prepare_head()
Return array head with list of tabs to view object informations.
translation_prepare_head()
Prepare array with list of tabs.
company_admin_prepare_head()
Return array head with list of tabs to view object informations.
defaultvalues_prepare_head()
Prepare array with list of tabs.
Class to manage a WYSIWYG editor.
dolGetModulesDirs($subdir='')
Return list of modules directories.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
dolEncrypt($chain, $key='', $ciphering='AES-256-CTR', $forceseed='')
Encode a string with a symetric encryption.
dolDecrypt($chain, $key='')
Decode a string with a symetric encryption.