28 require_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);
168 function run_sql($sqlfile, $silent = 1, $entity =
'', $usesavepoint = 1, $handler =
'', $okerror =
'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0)
170 global $db, $conf, $langs, $user;
172 dol_syslog(
"Admin.lib::run_sql run sql file ".$sqlfile.
" silent=".$silent.
" entity=".$entity.
" usesavepoint=".$usesavepoint.
" handler=".$handler.
" okerror=".$okerror, LOG_DEBUG);
174 if (!is_numeric($linelengthlimit)) {
175 dol_syslog(
"Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR);
186 $versionarray = $db->getVersionArray();
188 $fp = fopen($sqlfile,
"r");
192 if ($linelengthlimit > 0) {
193 $buf = fgets($fp, $linelengthlimit);
200 if (preg_match(
'/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) {
204 if (!empty($reg[1])) {
205 if (!preg_match(
'/'.preg_quote($reg[1]).
'/i', $db->type)) {
212 if (!empty($reg[2])) {
213 if (is_numeric($reg[2])) {
214 $versionrequest = explode(
'.', $reg[2]);
217 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);
245 if ($buffer) $buffer .=
' ';
246 $buffer .= trim($buf);
251 if (preg_match(
'/;/', $buffer)) {
254 $arraysql[$i] = $buffer;
262 $arraysql[$i] = $buffer;
266 dol_syslog(
"Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR);
270 $listofmaxrowid = array();
271 foreach ($arraysql as $i =>
$sql) {
275 while (preg_match(
'/__\+MAX_([A-Za-z0-9_]+)__/i', $newsql, $reg)) {
277 if (!isset($listofmaxrowid[$table])) {
279 $sqlgetrowid =
'SELECT MAX(rowid) as max from '.preg_replace(
'/^llx_/', MAIN_DB_PREFIX, $table);
280 $resql = $db->query($sqlgetrowid);
282 $obj = $db->fetch_object($resql);
283 $listofmaxrowid[$table] = $obj->max;
284 if (empty($listofmaxrowid[$table])) {
285 $listofmaxrowid[$table] = 0;
289 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
290 print
'<div class="error">'.$langs->trans(
"Failed to get max rowid for ".$table).
"</div>";
298 $from =
'__+MAX_'.$table.
'__';
299 $to =
'+'.$listofmaxrowid[$table];
300 $newsql = str_replace($from, $to, $newsql);
301 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1).
' (replacing '.$from.
' to '.$to.
')', LOG_DEBUG);
303 $arraysql[$i] = $newsql;
306 if ($offsetforchartofaccount > 0) {
312 $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);
313 $newsql = preg_replace(
'/([,\s])0 \+ '.((
int) $offsetforchartofaccount).
'/ims',
'\1 0', $newsql);
315 $arraysql[$i] = $newsql;
324 $listofinsertedrowid = array();
325 $keyforsql = md5($sqlfile);
326 foreach ($arraysql as $i =>
$sql) {
329 if ($onlysqltoimportwebsite) {
330 $newsql = str_replace(array(
"\'"),
'__BACKSLASHQUOTE__',
$sql);
333 $l = strlen($newsql);
338 $char = $newsql[$is];
345 } elseif (empty($quoteopen)) {
346 $newsqlclean .= $char;
350 $newsqlclean = str_replace(array(
"null"),
'__000__', $newsqlclean);
356 if (preg_match(
'/^--/', $newsqlclean)) {
358 } elseif (preg_match(
'/^UPDATE llx_website SET \w+ = \d+\+\d+ WHERE rowid = \d+;$/', $newsqlclean)) {
360 } elseif (preg_match(
'/^INSERT INTO llx_website_page\([a-z0-9_\s,]+\) VALUES\([0-9_\s,\+]+\);$/', $newsqlclean)) {
368 if (preg_match(
'/^UPDATE llx_website SET \w+ = \'[a-zA-Z,\s]*\' WHERE rowid = \d+;$/',
$sql)) {
377 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1).
" contains non allowed instructions.", LOG_WARNING);
378 dol_syslog(
'$newsqlclean='.$newsqlclean, LOG_DEBUG);
384 if (MAIN_DB_PREFIX !=
'llx_') {
385 $sql = preg_replace(
'/llx_/i', MAIN_DB_PREFIX,
$sql);
388 if (!empty($handler)) {
389 $sql = preg_replace(
'/__HANDLER__/i',
"'".$db->escape($handler).
"'",
$sql);
392 $newsql = preg_replace(
'/__ENTITY__/i', (!empty($entity) ? $entity : $conf->entity),
$sql);
396 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";
398 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG);
402 if (preg_match_all(
'/__ENCRYPT\(\'([^\']+)\'\)__/i', $newsql, $reg)) {
403 $num = count($reg[0]);
405 for ($j = 0; $j < $num; $j++) {
407 $to = $db->encrypt($reg[1][$j]);
408 $newsql = str_replace($from, $to, $newsql);
414 if (preg_match_all(
'/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i', $newsql, $reg)) {
415 $num = count($reg[0]);
417 for ($j = 0; $j < $num; $j++) {
419 $to = $db->decrypt($reg[1][$j]);
420 $newsql = str_replace($from, $to, $newsql);
426 while (preg_match(
'/__([0-9]+)__/', $newsql, $reg)) {
428 if (empty($listofinsertedrowid[$cursor])) {
430 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
431 print
'<div class="error">'.$langs->trans(
"FileIsNotCorrect").
"</div>";
438 $from =
'__'.$cursor.
'__';
439 $to = $listofinsertedrowid[$cursor];
440 $newsql = str_replace($from, $to, $newsql);
445 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1), LOG_DEBUG);
448 $result = $db->query($newsql, $usesavepoint);
451 print
'<!-- Result = OK -->'.
"\n";
454 if (preg_replace(
'/insert into ([^\s]+)/i', $newsql, $reg)) {
458 $table = preg_replace(
'/([^a-zA-Z_]+)/i',
'', $reg[1]);
459 $insertedrowid = $db->last_insert_id($table);
460 $listofinsertedrowid[$cursorinsert] = $insertedrowid;
461 dol_syslog(
'Admin.lib::run_sql Insert nb '.$cursorinsert.
', done in table '.$table.
', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG);
465 $errno = $db->errno();
467 print
'<!-- Result = '.$errno.
' -->'.
"\n";
472 'DB_ERROR_TABLE_ALREADY_EXISTS',
473 'DB_ERROR_COLUMN_ALREADY_EXISTS',
474 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
475 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS',
476 'DB_ERROR_RECORD_ALREADY_EXISTS',
477 'DB_ERROR_NOSUCHTABLE',
478 'DB_ERROR_NOSUCHFIELD',
479 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
480 'DB_ERROR_NO_INDEX_TO_DROP',
481 'DB_ERROR_CANNOT_CREATE',
482 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
483 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
486 if ($okerror ==
'none') {
491 if (!in_array($errno, $okerrors)) {
493 print
'<tr><td class="tdtop"'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'>';
494 print
'<div class="error">'.$langs->trans(
"Error").
" ".$db->errno().
": ".$newsql.
"<br>".$db->error().
"</div>";
495 print
'</td></tr>'.
"\n";
497 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1).
" Error ".$db->errno().
" ".$newsql.
"<br>".$db->error(), LOG_ERR);
505 print
'<tr><td>'.$langs->trans(
"ProcessMigrateScript").
'</td>';
506 print
'<td class="right">';
508 print
'<span class="ok">'.$langs->trans(
"OK").
'</span>';
510 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
514 print
'<script type="text/javascript">
515 jQuery(document).ready(function() {
516 function init_trrunsql'.$keyforsql.
'()
518 console.log("toggle .trforrunsql'.$keyforsql.
'");
519 jQuery(".trforrunsql'.$keyforsql.
'").toggle();
521 init_trrunsql'.$keyforsql.
'();
522 jQuery(".trforrunsqlshowhide'.$keyforsql.
'").click(function() {
523 init_trrunsql'.$keyforsql.
'();
527 if (count($arraysql)) {
528 print
' - <a class="trforrunsqlshowhide'.$keyforsql.
'" href="#" title="'.($langs->trans(
"ShowHideTheNRequests", count($arraysql))).
'">'.$langs->trans(
"ShowHideDetails").
'</a>';
530 print
' - <span class="opacitymedium">'.$langs->trans(
"ScriptIsEmpty").
'</span>';
534 print
'</td></tr>'.
"\n";
562 dol_print_error(
'',
'Error call dolibar_del_const with parameter name empty');
566 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
567 $sql .=
" WHERE (".$db->decrypt(
'name').
" = '".$db->escape($name).
"'";
568 if (is_numeric($name)) {
569 $sql .=
" OR rowid = ".((int) $name);
573 $sql .=
" AND entity = ".((int) $entity);
576 dol_syslog(
"admin.lib::dolibarr_del_const", LOG_DEBUG);
577 $resql = $db->query(
$sql);
579 $conf->global->$name =
'';
601 $sql =
"SELECT ".$db->decrypt(
'value').
" as value";
602 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
603 $sql .=
" WHERE name = ".$db->encrypt($name);
604 $sql .=
" AND entity = ".((int) $entity);
606 dol_syslog(
"admin.lib::dolibarr_get_const", LOG_DEBUG);
607 $resql = $db->query(
$sql);
609 $obj = $db->fetch_object($resql);
611 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
633 function dolibarr_set_const($db, $name, $value, $type =
'chaine', $visible = 0, $note =
'', $entity = 1)
642 dol_print_error($db,
"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR);
650 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
651 $sql .=
" WHERE name = ".$db->encrypt($name);
653 $sql .=
" AND entity = ".((int) $entity);
656 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
657 $resql = $db->query(
$sql);
659 if (strcmp($value,
'')) {
660 if (!preg_match(
'/^MAIN_LOGEVENTS/', $name) && (preg_match(
'/(_KEY|_EXPORTKEY|_SECUREKEY|_SERVERKEY|_PASS|_PASSWORD|_PW|_PW_TICKET|_PW_EMAILING|_SECRET|_SECURITY_TOKEN|_WEB_TOKEN)$/', $name))) {
665 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
671 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const(name, value, type, visible, note, entity)";
673 $sql .= $db->encrypt($name);
674 $sql .=
", ".$db->encrypt($newvalue);
675 $sql .=
", '".$db->escape($type).
"', ".((int) $visible).
", '".$db->escape($note).
"', ".((int) $entity).
")";
679 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
680 $resql = $db->query(
$sql);
685 $conf->global->$name = $value;
688 $error = $db->lasterror();
707 global $langs, $conf, $user,
$form;
709 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
710 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off'), $desc);
714 $mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT;
715 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=".$mode;
716 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
718 $head[$h][1] = $langs->trans(
"AvailableModules");
719 $head[$h][1] .=
$form->textwithpicto(
'', $langs->trans(
"YouMustEnableOneModule").
'.<br><br><span class="opacitymedium">'.$desc.
'</span>', 1,
'warning');
722 $head[$h][1] = $langs->trans(
"AvailableModules").
'<span class="badge marginleftonly">'.$nbofactivatedmodules.
' / '.$nboftotalmodules.
'</span>';
724 $head[$h][2] =
'modules';
727 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=marketplace";
728 $head[$h][1] = $langs->trans(
"ModulesMarketPlaces");
729 $head[$h][2] =
'marketplace';
732 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=deploy";
733 $head[$h][1] = $langs->trans(
"AddExtensionThemeModuleOrOther");
734 $head[$h][2] =
'deploy';
737 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=develop";
738 $head[$h][1] = $langs->trans(
"ModulesDevelopYourModule");
739 $head[$h][2] =
'develop';
752 global $langs, $conf, $user;
756 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=other";
757 $head[$h][1] = $langs->trans(
"LanguageAndPresentation");
758 $head[$h][2] =
'other';
761 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=template";
762 $head[$h][1] = $langs->trans(
"SkinAndColors");
763 $head[$h][2] =
'template';
766 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=dashboard";
767 $head[$h][1] = $langs->trans(
"Dashboard");
768 $head[$h][2] =
'dashboard';
771 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=login";
772 $head[$h][1] = $langs->trans(
"LoginPage");
773 $head[$h][2] =
'login';
776 $head[$h][0] = DOL_URL_ROOT.
"/admin/ihm.php?mode=css";
777 $head[$h][1] = $langs->trans(
"CSSPage");
778 $head[$h][2] =
'css';
797 global $db, $langs, $conf, $user;
801 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_other.php";
802 $head[$h][1] = $langs->trans(
"Miscellaneous");
803 $head[$h][2] =
'misc';
806 $head[$h][0] = DOL_URL_ROOT.
"/admin/security.php";
807 $head[$h][1] = $langs->trans(
"Passwords");
808 $head[$h][2] =
'passwords';
811 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_file.php";
812 $head[$h][1] = $langs->trans(
"Files").
' ('.$langs->trans(
"Upload").
')';
813 $head[$h][2] =
'file';
823 $head[$h][0] = DOL_URL_ROOT.
"/admin/proxy.php";
824 $head[$h][1] = $langs->trans(
"ExternalAccess");
825 $head[$h][2] =
'proxy';
828 $head[$h][0] = DOL_URL_ROOT.
"/admin/events.php";
829 $head[$h][1] = $langs->trans(
"Audit");
830 $head[$h][2] =
'audit';
836 $sql =
"SELECT COUNT(r.id) as nb";
837 $sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
838 $sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
839 $sql .=
" AND entity = ".((int) $conf->entity);
840 $sql .=
" AND bydefault = 1";
841 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
842 $sql .=
" AND r.perms NOT LIKE '%_advance'";
844 $resql = $db->query(
$sql);
846 $obj = $db->fetch_object($resql);
854 $head[$h][0] = DOL_URL_ROOT.
"/admin/perms.php";
855 $head[$h][1] = $langs->trans(
"DefaultRights");
857 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">'.$nbPerms.
'</span>' :
'');
859 $head[$h][2] =
'default';
872 global $langs, $conf, $user;
877 $object->id = $object->numero;
879 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=desc';
880 $head[$h][1] = $langs->trans(
"Description");
881 $head[$h][2] =
'desc';
884 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=feature';
885 $head[$h][1] = $langs->trans(
"TechnicalServicesProvided");
886 $head[$h][2] =
'feature';
889 if ($object->isCoreOrExternalModule() ==
'external') {
890 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=changelog';
891 $head[$h][1] = $langs->trans(
"ChangeLog");
892 $head[$h][2] =
'changelog';
910 global $langs, $conf, $user;
914 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=searchkey";
915 $head[$h][1] = $langs->trans(
"TranslationKeySearch");
916 $head[$h][2] =
'searchkey';
919 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=overwrite";
920 $head[$h][1] =
'<span class="valignmiddle">'.$langs->trans(
"TranslationOverwriteKey").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
921 $head[$h][2] =
'overwrite';
940 global $langs, $conf, $user;
944 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=createform";
945 $head[$h][1] = $langs->trans(
"DefaultCreateForm");
946 $head[$h][2] =
'createform';
949 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=filters";
950 $head[$h][1] = $langs->trans(
"DefaultSearchFilters");
951 $head[$h][2] =
'filters';
954 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=sortorder";
955 $head[$h][1] = $langs->trans(
"DefaultSortOrder");
956 $head[$h][2] =
'sortorder';
959 if (!empty($conf->use_javascript_ajax)) {
960 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=focus";
961 $head[$h][1] = $langs->trans(
"DefaultFocus");
962 $head[$h][2] =
'focus';
965 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=mandatory";
966 $head[$h][1] = $langs->trans(
"DefaultMandatory");
967 $head[$h][2] =
'mandatory';
994 $arrayofSessions = array();
997 $iniPath = ini_get(
"session.save_path");
999 $sessPath = $iniPath;
1002 dol_syslog(
'admin.lib:listOfSessions sessPath='.$sessPath);
1006 while (($file = @readdir($dh)) !==
false) {
1007 if (preg_match(
'/^sess_/i', $file) && $file !=
"." && $file !=
"..") {
1008 $fullpath = $sessPath.$file;
1009 if (!@is_dir($fullpath) && is_readable($fullpath)) {
1010 $sessValues = file_get_contents($fullpath);
1016 if (preg_match(
'/dol_login/i', $sessValues) &&
1017 (preg_match(
'/dol_entity\|i:'.$conf->entity.
';/i', $sessValues) || preg_match(
'/dol_entity\|s:([0-9]+):"'.$conf->entity.
'"/i', $sessValues)) &&
1018 preg_match(
'/dol_company\|s:([0-9]+):"('.
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM').
')"/i', $sessValues)) {
1019 $tmp = explode(
'_', $file);
1022 $loginfound = preg_match(
'/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs);
1024 $arrayofSessions[$idsess][
"login"] = $regs[1];
1026 $arrayofSessions[$idsess][
"age"] = time() - filectime($fullpath);
1027 $arrayofSessions[$idsess][
"creation"] = filectime($fullpath);
1028 $arrayofSessions[$idsess][
"modification"] = filemtime($fullpath);
1029 $arrayofSessions[$idsess][
"raw"] = $sessValues;
1037 return $arrayofSessions;
1050 $sessPath = ini_get(
"session.save_path").
"/";
1051 dol_syslog(
'admin.lib:purgeSessions mysessionid='.$mysessionid.
' sessPath='.$sessPath);
1057 while (($file = @readdir($dh)) !==
false) {
1058 if ($file !=
"." && $file !=
"..") {
1059 $fullpath = $sessPath.$file;
1060 if (!@is_dir($fullpath)) {
1061 $sessValues = file_get_contents($fullpath);
1063 if (preg_match(
'/dol_login/i', $sessValues) &&
1064 preg_match(
'/dol_entity\|s:([0-9]+):"('.$conf->entity.
')"/i', $sessValues) &&
1065 preg_match(
'/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.
')"/i', $sessValues)) {
1066 $tmp = explode(
'_', $file);
1069 if ($idsess != $mysessionid) {
1070 $res = @unlink($fullpath);
1101 global $db, $langs, $conf, $mysoc;
1106 if (empty($value)) {
1107 $ret[
'errors'][] =
'ErrorBadParameter';
1111 $ret = array(
'nbmodules'=>0,
'errors'=>array(),
'nbperms'=>0);
1113 $modFile = $modName.
".class.php";
1120 foreach ($modulesdir as $dir) {
1121 if (file_exists($dir.$modFile)) {
1122 $found = @include_once $dir.$modFile;
1129 $objMod =
new $modName($db);
1133 $vermin = isset($objMod->phpmin) ? $objMod->phpmin : 0;
1135 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequirePHPVersion",
versiontostring($vermin));
1141 $vermin = isset($objMod->need_dolibarr_version) ? $objMod->need_dolibarr_version : 0;
1144 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireDolibarrVersion",
versiontostring($vermin));
1149 if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) {
1150 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireJavascript");
1154 $const_name = $objMod->const_name;
1155 if ($noconfverification == 0) {
1156 if (!empty($conf->global->$const_name)) {
1161 $result = $objMod->init();
1164 $ret[
'errors'][] = $objMod->error;
1167 if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) {
1170 foreach ($objMod->depends as $key => $modulestring) {
1172 if ((!is_numeric($key)) && !preg_match(
'/^always/', $key) && $mysoc->country_code && !preg_match(
'/^'.$mysoc->country_code.
'/', $key)) {
1173 dol_syslog(
"We are not concerned by dependency with key=".$key.
" because our country is ".$mysoc->country_code);
1177 foreach ($modulesdir as $dir) {
1178 if (file_exists($dir.$modulestring.
".class.php")) {
1180 if (empty($resarray[
'errors'])) {
1183 foreach ($resarray[
'errors'] as $errorMessage) {
1192 $ret[
'nbmodules'] += $resarray[
'nbmodules'];
1193 $ret[
'nbperms'] += $resarray[
'nbperms'];
1195 $ret[
'errors'][] = $langs->trans(
'activateModuleDependNotSatisfied', $objMod->name, $modulestring);
1200 if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && !empty($objMod->conflictwith)) {
1202 $num = count($objMod->conflictwith);
1203 for ($i = 0; $i < $num; $i++) {
1204 foreach ($modulesdir as $dir) {
1205 if (file_exists($dir.$objMod->conflictwith[$i].
".class.php")) {
1214 if (!count($ret[
'errors'])) {
1215 $ret[
'nbmodules']++;
1216 $ret[
'nbperms'] += (is_array($objMod->rights)?count($objMod->rights):0);
1232 global $db, $modules, $conf;
1235 if (empty($value)) {
1236 return 'ErrorBadParameter';
1241 $modFile = $modName.
".class.php";
1248 foreach ($modulesdir as $dir) {
1249 if (file_exists($dir.$modFile)) {
1250 $found = @include_once $dir.$modFile;
1258 $objMod =
new $modName($db);
1259 $result = $objMod->remove();
1261 $ret = $objMod->error;
1267 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
1269 $genericMod->name = preg_replace(
'/^mod/i',
'', $modName);
1270 $genericMod->rights_class = strtolower(preg_replace(
'/^mod/i',
'', $modName));
1271 $genericMod->const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', $modName));
1272 dol_syslog(
"modules::unActivateModule Failed to find module file, we use generic function with name ".$modName);
1273 $genericMod->remove(
'');
1277 if (!$ret && $requiredby && is_object($objMod) && is_array($objMod->requiredby)) {
1278 $countrb = count($objMod->requiredby);
1279 for ($i = 0; $i < $countrb; $i++) {
1307 function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabcomplete)
1309 global $db, $modules, $conf, $langs;
1311 dol_syslog(
"complete_dictionary_with_modules Search external modules to complete the list of dictionnary tables", LOG_DEBUG, 1);
1318 foreach ($modulesdir as $dir) {
1321 dol_syslog(
"Scan directory ".$dir.
" for modules");
1323 if (is_resource($handle)) {
1324 while (($file = readdir($handle)) !==
false) {
1326 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1327 $modName = substr($file, 0,
dol_strlen($file) - 10);
1330 include_once $dir.$file;
1331 $objMod =
new $modName($db);
1333 if ($objMod->numero > 0) {
1334 $j = $objMod->numero;
1339 $modulequalified = 1;
1342 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1344 $modulequalified = 0;
1347 $modulequalified = 0;
1351 $modulequalified = 0;
1354 if ($modulequalified) {
1356 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1357 foreach ($objMod->langfiles as $langfile) {
1358 $langs->load($langfile);
1363 if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries)) {
1364 $objMod->dictionaries = $objMod->dictionnaries;
1367 if (!empty($objMod->dictionaries)) {
1369 $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0;
1370 $tabnamerelwithkey = array();
1371 foreach ($objMod->dictionaries[
'tabname'] as $key => $val) {
1372 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $val);
1374 $taborder[] = max($taborder) + 1;
1376 $tabnamerelwithkey[$key] = $val;
1377 $tabcomplete[$tmptablename][
'picto'] = $objMod->picto;
1379 foreach ($objMod->dictionaries[
'tablib'] as $key => $val) {
1380 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1383 $tabcomplete[$tmptablename][
'lib'] = $val;
1385 foreach ($objMod->dictionaries[
'tabsql'] as $key => $val) {
1386 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1389 $tabcomplete[$tmptablename][
'sql'] = $val;
1391 foreach ($objMod->dictionaries[
'tabsqlsort'] as $key => $val) {
1392 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1394 $tabsqlsort[] = $val;
1395 $tabcomplete[$tmptablename][
'sqlsort'] = $val;
1397 foreach ($objMod->dictionaries[
'tabfield'] as $key => $val) {
1398 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1401 $tabcomplete[$tmptablename][
'field'] = $val;
1403 foreach ($objMod->dictionaries[
'tabfieldvalue'] as $key => $val) {
1404 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1406 $tabfieldvalue[] = $val;
1407 $tabcomplete[$tmptablename][
'value'] = $val;
1409 foreach ($objMod->dictionaries[
'tabfieldinsert'] as $key => $val) {
1410 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1411 $nbtabfieldinsert++;
1412 $tabfieldinsert[] = $val;
1413 $tabcomplete[$tmptablename][
'fieldinsert'] = $val;
1415 foreach ($objMod->dictionaries[
'tabrowid'] as $key => $val) {
1416 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1419 $tabcomplete[$tmptablename][
'rowid'] = $val;
1421 foreach ($objMod->dictionaries[
'tabcond'] as $key => $val) {
1422 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1425 $tabcomplete[$tmptablename][
'rowid'] = $val;
1427 if (!empty($objMod->dictionaries[
'tabhelp'])) {
1428 foreach ($objMod->dictionaries[
'tabhelp'] as $key => $val) {
1429 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1432 $tabcomplete[$tmptablename][
'help'] = $val;
1435 if (!empty($objMod->dictionaries[
'tabfieldcheck'])) {
1436 foreach ($objMod->dictionaries[
'tabfieldcheck'] as $key => $val) {
1437 $tmptablename = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabnamerelwithkey[$key]);
1439 $tabcomplete[$tmptablename][
'fieldcheck'] = $val;
1443 if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) {
1444 print
'Error in descriptor of module '.$const_name.
'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
1454 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1461 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1478 global $db, $conf, $langs;
1482 foreach ($modulesdir as $dir) {
1484 dol_syslog(
"Scan directory ".$dir.
" for modules");
1486 if (is_resource($handle)) {
1487 while (($file = readdir($handle)) !==
false) {
1488 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1489 $modName = substr($file, 0,
dol_strlen($file) - 10);
1492 include_once $dir.$file;
1493 $objMod =
new $modName($db);
1495 $modulequalified = 1;
1498 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1500 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
1501 $modulequalified = 0;
1503 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
1504 $modulequalified = 0;
1506 if (!empty($conf->global->$const_name)) {
1507 $modulequalified = 0;
1510 if ($modulequalified) {
1512 if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) {
1515 setEventMessages($objMod->automatic_activation[$country_code],
null,
'warnings');
1518 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1525 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1540 global $db, $modules, $conf, $langs;
1543 $filename = array();
1552 dol_syslog(
"complete_elementList_with_modules Search external modules to complete the list of contact element", LOG_DEBUG, 1);
1556 foreach ($modulesdir as $dir) {
1559 dol_syslog(
"Scan directory ".$dir.
" for modules");
1561 if (is_resource($handle)) {
1562 while (($file = readdir($handle)) !==
false) {
1564 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1565 $modName = substr($file, 0,
dol_strlen($file) - 10);
1568 include_once $dir.$file;
1569 $objMod =
new $modName($db);
1571 if ($objMod->numero > 0) {
1572 $j = $objMod->numero;
1577 $modulequalified = 1;
1580 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1581 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 &&
getDolGlobalString($const_name)) {
1582 $modulequalified = 0;
1584 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 &&
getDolGlobalString($const_name)) {
1585 $modulequalified = 0;
1588 if (empty($conf->global->$const_name)) {
1589 $modulequalified = 0;
1592 if ($modulequalified) {
1594 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1595 foreach ($objMod->langfiles as $langfile) {
1596 $langs->load($langfile);
1600 $modules[$i] = $objMod;
1601 $filename[$i] = $modName;
1602 $orders[$i] = $objMod->family.
"_".$j;
1606 if (!empty($objMod->module_parts[
'contactelement'])) {
1607 if (is_array($objMod->module_parts[
'contactelement'])) {
1608 foreach ($objMod->module_parts[
'contactelement'] as $elem => $title) {
1609 $elementList[$elem] = $langs->trans($title);
1612 $elementList[$objMod->name] = $langs->trans($objMod->name);
1619 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1626 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1647 global $db, $langs, $conf, $user;
1648 global $_Avery_Labels;
1652 if (empty($strictw3c)) {
1653 dol_syslog(
"Warning: Function form_constantes is calle with parameter strictw3c = 0, this is deprecated. Value must be 2 now.", LOG_DEBUG);
1655 if (!empty($strictw3c) && $strictw3c == 1) {
1656 print
"\n".
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1658 print
'<input type="hidden" name="action" value="updateall">';
1661 print
'<div class="div-table-responsive-no-min">';
1662 print
'<table class="noborder centpercent">';
1663 print
'<tr class="liste_titre">';
1664 print
'<td class="">'.$langs->trans(
"Description").
'</td>';
1666 $text = $langs->trans($text);
1667 print
$form->textwithpicto($text, $helptext, 1,
'help',
'', 0, 2,
'idhelptext');
1669 if (empty($strictw3c)) {
1670 print
'<td class="center" width="80">'.$langs->trans(
"Action").
'</td>';
1675 foreach ($tableau as $key => $const) {
1678 if (is_numeric($key)) {
1681 if (is_array($const)) {
1682 $type = $const[
'type'];
1683 $label = $const[
'label'];
1693 $sql .=
", ".$db->decrypt(
'name').
" as name";
1694 $sql .=
", ".$db->decrypt(
'value').
" as value";
1697 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
1698 $sql .=
" WHERE ".$db->decrypt(
'name').
" = '".$db->escape($const).
"'";
1699 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
1700 $sql .=
" ORDER BY name ASC, entity DESC";
1701 $result = $db->query(
$sql);
1705 $obj = $db->fetch_object($result);
1708 $obj = (object) array(
'rowid'=>
'',
'name'=>$const,
'value'=>
'',
'type'=>$type,
'note'=>
'');
1711 if (empty($strictw3c)) {
1712 print
"\n".
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1713 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1714 print
'<input type="hidden" name="page_y" value="'.newToken().
'">';
1717 print
'<tr class="oddeven">';
1721 if (empty($strictw3c)) {
1722 print
'<input type="hidden" name="action" value="update">';
1724 print
'<input type="hidden" name="rowid'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$obj->rowid.
'">';
1725 print
'<input type="hidden" name="constname'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$const.
'">';
1726 print
'<input type="hidden" name="constnote_'.$obj->name.
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1727 print
'<input type="hidden" name="consttype_'.$obj->name.
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1728 if (!empty($tableau[$key][
'tooltip'])) {
1729 print
$form->textwithpicto($label ? $label : $langs->trans(
'Desc'.$const), $tableau[$key][
'tooltip']);
1731 print ($label ? $label : $langs->trans(
'Desc'.$const));
1734 if ($const ==
'ADHERENT_MAILMAN_URL') {
1735 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick1">'.
img_down().
'</a><br>';
1737 print
'<div id="example1" class="hidden">';
1738 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';
1740 } elseif ($const ==
'ADHERENT_MAILMAN_UNSUB_URL') {
1741 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick2">'.
img_down().
'</a><br>';
1742 print
'<div id="example2" class="hidden">';
1743 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';
1746 } elseif ($const ==
'ADHERENT_MAILMAN_LISTS') {
1747 print
'. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick3">'.
img_down().
'</a><br>';
1748 print
'<div id="example3" class="hidden">';
1749 print
'mymailmanlist<br>';
1750 print
'mymailmanlist1,mymailmanlist2<br>';
1751 print
'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>';
1753 print
'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
1757 } elseif ($const ==
'ADHERENT_MAIL_FROM') {
1758 print
' '.img_help(1, $langs->trans(
"EMailHelpMsgSPFDKIM"));
1764 if ($const ==
'ADHERENT_CARD_TYPE' || $const ==
'ADHERENT_ETIQUETTE_TYPE') {
1767 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
1768 $arrayoflabels = array();
1769 foreach (array_keys($_Avery_Labels) as $codecards) {
1770 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards][
'name'];
1772 print
$form->selectarray(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $arrayoflabels, ($obj->value ? $obj->value :
'CARD'), 1, 0, 0);
1773 print
'<input type="hidden" name="consttype" value="yesno">';
1774 print
'<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1778 print
'<input type="hidden" name="consttype'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1779 print
'<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1780 if ($obj->type ==
'textarea' || in_array($const, array(
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_ETIQUETTE_TEXT'))) {
1781 print
'<textarea class="flat" name="constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" cols="50" rows="5" wrap="soft">'.
"\n";
1783 print
"</textarea>\n";
1784 } elseif ($obj->type ==
'html') {
1785 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1786 $doleditor =
new DolEditor(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $obj->value,
'', 160,
'dolibarr_notes',
'',
false,
false,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
1787 $doleditor->Create();
1788 } elseif ($obj->type ==
'yesno') {
1789 print
$form->selectyesno(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $obj->value, 1);
1790 } elseif (preg_match(
'/emailtemplate/', $obj->type)) {
1791 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1794 $tmp = explode(
':', $obj->type);
1796 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, -1);
1798 $arrayofmessagename = array();
1799 if (is_array($formmail->lines_model)) {
1800 foreach ($formmail->lines_model as $modelmail) {
1803 if (!empty($arrayofmessagename[$modelmail->label])) {
1804 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
1807 $arrayofmessagename[$modelmail->label.
':'.$tmp[1]] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)).$moreonlabel;
1812 print
$form->selectarray(
'constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')), $arrayofmessagename, $obj->value.
':'.$tmp[1],
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
1813 } elseif (preg_match(
'/MAIL_FROM$/i', $const)) {
1814 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).
'">';
1816 print
'<input type="text" class="flat minwidth300" name="constvalue'.(empty($strictw3c) ?
'' : ($strictw3c == 3 ?
'_'.$const :
'[]')).
'" value="'.
dol_escape_htmltag($obj->value).
'">';
1822 if (empty($strictw3c)) {
1823 print
'<td class="center">';
1824 print
'<input type="submit" class="button small reposition" value="'.$langs->trans(
"Update").
'" name="update">';
1830 if (empty($strictw3c)) {
1838 if (!empty($strictw3c) && $strictw3c == 1) {
1839 print
'<div align="center"><input type="submit" class="button small reposition" value="'.$langs->trans(
"Update").
'" name="update"></div>';
1853 global $conf, $langs;
1855 $text = $langs->trans(
"OnlyFollowingModulesAreOpenedToExternalUsers");
1856 $listofmodules = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
1859 if (!empty($modules)) {
1861 foreach ($tmpmodules as $module) {
1862 $moduleconst = $module->const_name;
1863 $modulename = strtolower($module->name);
1867 if (!in_array($modulename, $listofmodules)) {
1879 $tmptext = $langs->trans(
'Module'.$module->numero.
'Name');
1880 if ($tmptext !=
'Module'.$module->numero.
'Name') {
1881 $text .= $langs->trans(
'Module'.$module->numero.
'Name');
1883 $text .= $langs->trans($module->name);
1907 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity, libelle, description)";
1908 $sql .=
" VALUES ('".$db->escape($name).
"','".$db->escape($type).
"',".((int) $conf->entity).
", ";
1909 $sql .= ($label ?
"'".$db->escape($label).
"'" :
'null').
", ";
1910 $sql .= (!empty($description) ?
"'".$db->escape($description).
"'" :
"null");
1913 dol_syslog(
"admin.lib::addDocumentModel", LOG_DEBUG);
1914 $resql = $db->query(
$sql);
1938 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"document_model";
1939 $sql .=
" WHERE nom = '".$db->escape($name).
"'";
1940 $sql .=
" AND type = '".$db->escape($type).
"'";
1941 $sql .=
" AND entity = ".((int) $conf->entity);
1943 dol_syslog(
"admin.lib::delDocumentModel", LOG_DEBUG);
1944 $resql = $db->query(
$sql);
1965 $phpinfostring = ob_get_contents();
1968 $info_arr = array();
1969 $info_lines = explode(
"\n", strip_tags($phpinfostring,
"<tr><td><h2>"));
1971 foreach ($info_lines as $line) {
1974 preg_match(
"~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] :
null;
1976 if (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1977 $info_arr[trim($cat)][trim($val[1])] = $val[2];
1978 } elseif (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1979 $info_arr[trim($cat)][trim($val[1])] = array(
"local" => $val[2],
"master" => $val[3]);
1992 global $langs, $conf;
1997 $head[$h][0] = DOL_URL_ROOT.
"/admin/company.php";
1998 $head[$h][1] = $langs->trans(
"Company");
1999 $head[$h][2] =
'company';
2002 $head[$h][0] = DOL_URL_ROOT.
"/admin/openinghours.php";
2003 $head[$h][1] = $langs->trans(
"OpeningHours");
2004 $head[$h][2] =
'openinghours';
2007 $head[$h][0] = DOL_URL_ROOT.
"/admin/accountant.php";
2008 $head[$h][1] = $langs->trans(
"Accountant");
2009 $head[$h][2] =
'accountant';
2012 $head[$h][0] = DOL_URL_ROOT.
"/admin/company_socialnetworks.php";
2013 $head[$h][1] = $langs->trans(
"SocialNetworksInformation");
2014 $head[$h][2] =
'socialnetworks';
2031 global $langs, $conf, $user;
2036 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
2037 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails.php";
2038 $head[$h][1] = $langs->trans(
"OutGoingEmailSetup");
2039 $head[$h][2] =
'common';
2043 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_emailing.php";
2044 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"EMailing"));
2045 $head[$h][2] =
'common_emailing';
2050 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_ticket.php";
2051 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"Ticket"));
2052 $head[$h][2] =
'common_ticket';
2058 if (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates') {
2059 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_senderprofile_list.php";
2060 $head[$h][1] = $langs->trans(
"EmailSenderProfiles");
2061 $head[$h][2] =
'senderprofiles';
2065 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_templates.php";
2066 $head[$h][1] = $langs->trans(
"EMailTemplates");
2067 $head[$h][2] =
'templates';
2070 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_ingoing.php";
2071 $head[$h][1] = $langs->trans(
"InGoingEmailSetup", $langs->transnoentitiesnoconv(
"EMailing"));
2072 $head[$h][2] =
'common_ingoing';