setup.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <?php
  2. /* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/recruitment/admin/setup.php
  19. * \ingroup recruitment
  20. * \brief Recruitment setup page.
  21. */
  22. // Load Dolibarr environment
  23. $res = 0;
  24. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  25. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  26. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
  27. }
  28. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  29. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
  30. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  31. $i--;
  32. $j--;
  33. }
  34. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
  35. $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
  36. }
  37. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
  38. $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
  39. }
  40. // Try main.inc.php using relative path
  41. if (!$res && file_exists("../../main.inc.php")) {
  42. $res = @include "../../main.inc.php";
  43. }
  44. if (!$res && file_exists("../../../main.inc.php")) {
  45. $res = @include "../../../main.inc.php";
  46. }
  47. if (!$res) {
  48. die("Include of main fails");
  49. }
  50. global $langs, $user;
  51. // Libraries
  52. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  53. require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
  54. require_once DOL_DOCUMENT_ROOT."/recruitment/class/recruitmentjobposition.class.php";
  55. // Translations
  56. $langs->loadLangs(array("admin", "recruitment"));
  57. // Access control
  58. if (!$user->admin) {
  59. accessforbidden();
  60. }
  61. // Parameters
  62. $action = GETPOST('action', 'aZ09');
  63. $backtopage = GETPOST('backtopage', 'alpha');
  64. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  65. $value = GETPOST('value', 'alpha');
  66. $label = GETPOST('label', 'alpha');
  67. $scandir = GETPOST('scan_dir', 'alpha');
  68. $type = 'recruitmentjobposition';
  69. $arrayofparameters = array(
  70. // 'RECRUITMENT_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
  71. // 'RECRUITMENT_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
  72. );
  73. $error = 0;
  74. $setupnotempty = 0;
  75. /*
  76. * Actions
  77. */
  78. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  79. if ($action == 'updateMask') {
  80. $maskconst = GETPOST('maskconstjob', 'alpha');
  81. $maskvalue = GETPOST('maskjob', 'alpha');
  82. if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
  83. $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
  84. }
  85. if (!($res > 0)) {
  86. $error++;
  87. }
  88. if (!$error) {
  89. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  90. } else {
  91. setEventMessages($langs->trans("Error"), null, 'errors');
  92. }
  93. } elseif ($action == 'specimen') {
  94. $modele = GETPOST('module', 'alpha');
  95. $tmpobjectkey = GETPOST('object');
  96. $tmpobject = new $tmpobjectkey($db);
  97. $tmpobject->initAsSpecimen();
  98. // Search template files
  99. $file = '';
  100. $classname = '';
  101. $filefound = 0;
  102. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  103. foreach ($dirmodels as $reldir) {
  104. $file = dol_buildpath($reldir."core/modules/recruitment/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
  105. if (file_exists($file)) {
  106. $filefound = 1;
  107. $classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
  108. break;
  109. }
  110. }
  111. if ($filefound) {
  112. require_once $file;
  113. $module = new $classname($db);
  114. if ($module->write_file($tmpobject, $langs) > 0) {
  115. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=recruitment-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
  116. return;
  117. } else {
  118. setEventMessages($module->error, null, 'errors');
  119. dol_syslog($module->error, LOG_ERR);
  120. }
  121. } else {
  122. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  123. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  124. }
  125. } elseif ($action == 'set') {
  126. // Activate a model
  127. $ret = addDocumentModel($value, $type, $label, $scandir);
  128. } elseif ($action == 'del') {
  129. $ret = delDocumentModel($value, $type);
  130. if ($ret > 0) {
  131. $tmpobjectkey = GETPOST('object');
  132. if (!empty($tmpobjectkey)) {
  133. $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
  134. if (getDolGlobalString($constforval) == "$value") {
  135. dolibarr_del_const($db, $constforval, $conf->entity);
  136. }
  137. }
  138. }
  139. } elseif ($action == 'setmod') {
  140. // TODO Check if numbering module chosen can be activated by calling method canBeActivated
  141. $tmpobjectkey = GETPOST('object');
  142. if (!empty($tmpobjectkey)) {
  143. $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey)."_ADDON";
  144. dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
  145. }
  146. } elseif ($action == 'setdoc') {
  147. // Set default model
  148. $tmpobjectkey = GETPOST('object');
  149. if (!empty($tmpobjectkey)) {
  150. $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
  151. if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
  152. // The constant that was read before the new set
  153. // We therefore requires a variable to have a coherent view
  154. $conf->global->$constforval = $value;
  155. }
  156. // We disable/enable the document template (into llx_document_model table)
  157. $ret = delDocumentModel($value, $type);
  158. if ($ret > 0) {
  159. $ret = addDocumentModel($value, $type, $label, $scandir);
  160. }
  161. }
  162. } elseif ($action == 'unsetdoc') {
  163. $tmpobjectkey = GETPOST('object');
  164. if (!empty($tmpobjectkey)) {
  165. $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
  166. dolibarr_del_const($db, $constforval, $conf->entity);
  167. }
  168. }
  169. /*
  170. * View
  171. */
  172. $form = new Form($db);
  173. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  174. $page_name = "RecruitmentSetup";
  175. llxHeader('', $langs->trans($page_name));
  176. // Subheader
  177. $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
  178. print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
  179. // Configuration header
  180. $head = recruitmentAdminPrepareHead();
  181. print dol_get_fiche_head($head, 'settings', '', -1, '');
  182. // Setup page goes here
  183. //echo '<span class="opacitymedium">'.$langs->trans("RecruitmentSetupPage").'</span><br><br>';
  184. if ($action == 'edit') {
  185. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  186. print '<input type="hidden" name="token" value="'.newToken().'">';
  187. print '<input type="hidden" name="action" value="update">';
  188. print '<table class="noborder centpercent">';
  189. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  190. foreach ($arrayofparameters as $key => $val) {
  191. print '<tr class="oddeven"><td>';
  192. $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
  193. print $form->textwithpicto($langs->trans($key), $tooltiphelp);
  194. print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($key).'"></td></tr>';
  195. }
  196. print '</table>';
  197. print '<br><div class="center">';
  198. print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
  199. print '</div>';
  200. print '</form>';
  201. print '<br>';
  202. } else {
  203. if (!empty($arrayofparameters)) {
  204. print '<table class="noborder centpercent">';
  205. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  206. foreach ($arrayofparameters as $key => $val) {
  207. $setupnotempty++;
  208. print '<tr class="oddeven"><td>';
  209. $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
  210. print $form->textwithpicto($langs->trans($key), $tooltiphelp);
  211. print '</td><td>'.getDolGlobalString($key).'</td></tr>';
  212. }
  213. print '</table>';
  214. print '<div class="tabsAction">';
  215. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
  216. print '</div>';
  217. }
  218. }
  219. $moduledir = 'recruitment';
  220. $myTmpObjects = array();
  221. $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1);
  222. foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
  223. if ($myTmpObjectArray['includerefgeneration']) {
  224. /*
  225. * Orders Numbering model
  226. */
  227. $setupnotempty++;
  228. print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
  229. print '<table class="noborder centpercent">';
  230. print '<tr class="liste_titre">';
  231. print '<td>'.$langs->trans("Name").'</td>';
  232. print '<td>'.$langs->trans("Description").'</td>';
  233. print '<td class="nowrap">'.$langs->trans("Example").'</td>';
  234. print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
  235. print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  236. print '</tr>'."\n";
  237. clearstatcache();
  238. foreach ($dirmodels as $reldir) {
  239. $dir = dol_buildpath($reldir."core/modules/".$moduledir);
  240. if (is_dir($dir)) {
  241. $handle = opendir($dir);
  242. if (is_resource($handle)) {
  243. while (($file = readdir($handle)) !== false) {
  244. if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
  245. $file = substr($file, 0, dol_strlen($file) - 4);
  246. require_once $dir.'/'.$file.'.php';
  247. $module = new $file($db);
  248. // Show modules according to features level
  249. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  250. continue;
  251. }
  252. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  253. continue;
  254. }
  255. if ($module->isEnabled()) {
  256. dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
  257. print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
  258. print $module->info($langs);
  259. print '</td>';
  260. // Show example of numbering model
  261. print '<td class="nowrap">';
  262. $tmp = $module->getExample();
  263. if (preg_match('/^Error/', $tmp)) {
  264. $langs->load("errors");
  265. print '<div class="error">'.$langs->trans($tmp).'</div>';
  266. } elseif ($tmp == 'NotConfigured') {
  267. print $langs->trans($tmp);
  268. } else {
  269. print $tmp;
  270. }
  271. print '</td>'."\n";
  272. print '<td class="center">';
  273. $constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
  274. if (getDolGlobalString($constforvar) == $file) {
  275. print img_picto($langs->trans("Activated"), 'switch_on');
  276. } else {
  277. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
  278. print img_picto($langs->trans("Disabled"), 'switch_off');
  279. print '</a>';
  280. }
  281. print '</td>';
  282. $mytmpinstance = new $myTmpObjectKey($db);
  283. $mytmpinstance->initAsSpecimen();
  284. // Info
  285. $htmltooltip = '';
  286. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  287. $nextval = $module->getNextValue($mytmpinstance);
  288. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  289. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  290. if ($nextval) {
  291. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  292. $nextval = $langs->trans($nextval);
  293. }
  294. $htmltooltip .= $nextval.'<br>';
  295. } else {
  296. $htmltooltip .= $langs->trans($module->error).'<br>';
  297. }
  298. }
  299. print '<td class="center">';
  300. print $form->textwithpicto('', $htmltooltip, 1, 0);
  301. print '</td>';
  302. print "</tr>\n";
  303. }
  304. }
  305. }
  306. closedir($handle);
  307. }
  308. }
  309. }
  310. print "</table><br>\n";
  311. }
  312. if ($myTmpObjectArray['includedocgeneration']) {
  313. /*
  314. * Document templates generators
  315. */
  316. $setupnotempty++;
  317. $type = strtolower($myTmpObjectKey);
  318. print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
  319. // Load array def with activated templates
  320. $def = array();
  321. $sql = "SELECT nom";
  322. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  323. $sql .= " WHERE type = '".$db->escape($type)."'";
  324. $sql .= " AND entity = ".$conf->entity;
  325. $resql = $db->query($sql);
  326. if ($resql) {
  327. $i = 0;
  328. $num_rows = $db->num_rows($resql);
  329. while ($i < $num_rows) {
  330. $array = $db->fetch_array($resql);
  331. array_push($def, $array[0]);
  332. $i++;
  333. }
  334. } else {
  335. dol_print_error($db);
  336. }
  337. print "<table class=\"noborder\" width=\"100%\">\n";
  338. print "<tr class=\"liste_titre\">\n";
  339. print '<td>'.$langs->trans("Name").'</td>';
  340. print '<td>'.$langs->trans("Description").'</td>';
  341. print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
  342. print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
  343. print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
  344. print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
  345. print "</tr>\n";
  346. clearstatcache();
  347. foreach ($dirmodels as $reldir) {
  348. foreach (array('', '/doc') as $valdir) {
  349. $realpath = $reldir."core/modules/".$moduledir.$valdir;
  350. $dir = dol_buildpath($realpath);
  351. if (is_dir($dir)) {
  352. $handle = opendir($dir);
  353. if (is_resource($handle)) {
  354. while (($file = readdir($handle)) !== false) {
  355. $filelist[] = $file;
  356. }
  357. closedir($handle);
  358. arsort($filelist);
  359. foreach ($filelist as $file) {
  360. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  361. if (file_exists($dir.'/'.$file)) {
  362. $name = substr($file, 4, dol_strlen($file) - 16);
  363. $classname = substr($file, 0, dol_strlen($file) - 12);
  364. require_once $dir.'/'.$file;
  365. $module = new $classname($db);
  366. $modulequalified = 1;
  367. if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
  368. $modulequalified = 0;
  369. }
  370. if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
  371. $modulequalified = 0;
  372. }
  373. if ($modulequalified) {
  374. print '<tr class="oddeven"><td width="100">';
  375. print(empty($module->name) ? $name : $module->name);
  376. print "</td><td>\n";
  377. if (method_exists($module, 'info')) {
  378. print $module->info($langs);
  379. } else {
  380. print $module->description;
  381. }
  382. print '</td>';
  383. // Active
  384. if (in_array($name, $def)) {
  385. print '<td class="center">'."\n";
  386. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
  387. print img_picto($langs->trans("Enabled"), 'switch_on');
  388. print '</a>';
  389. print '</td>';
  390. } else {
  391. print '<td class="center">'."\n";
  392. print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  393. print "</td>";
  394. }
  395. // Default
  396. print '<td class="center">';
  397. $constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
  398. if (getDolGlobalString($constforvar) == $name) {
  399. //print img_picto($langs->trans("Default"), 'on');
  400. // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
  401. print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  402. } else {
  403. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  404. }
  405. print '</td>';
  406. // Info
  407. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  408. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  409. if ($module->type == 'pdf') {
  410. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  411. }
  412. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  413. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  414. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  415. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
  416. print '<td class="center">';
  417. print $form->textwithpicto('', $htmltooltip, 1, 0);
  418. print '</td>';
  419. // Preview
  420. print '<td class="center">';
  421. if ($module->type == 'pdf') {
  422. $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
  423. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  424. } else {
  425. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  426. }
  427. print '</td>';
  428. print "</tr>\n";
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. print '</table>';
  438. }
  439. }
  440. if (empty($setupnotempty)) {
  441. print '<br>'.$langs->trans("NothingToSetup");
  442. }
  443. // Page end
  444. print dol_get_fiche_end();
  445. llxFooter();
  446. $db->close();