/** * Display a common mysql connection error **/ static function displayMySQLError() { if (!isCommandLine()) { Html::nullHeader("Mysql Error", ''); echo "<div class='center'><p class ='b'>\n A link to the Mysql server could not be established. Please check your configuration.\n </p><p class='b'>\n Le serveur Mysql est inaccessible. Vérifiez votre configuration</p>\n </div>"; Html::nullFooter(); } else { echo "A link to the Mysql server could not be established. Please check your configuration.\n"; echo "Le serveur Mysql est inaccessible. Vérifiez votre configuration\n"; } die; }
/** * Display the API Documentation in Html (parsed from markdown) * * @param $file string relative path of documentation file **/ public function inlineDocumentation($file) { global $CFG_GLPI; self::header(true, __("API Documentation")); echo Html::css($CFG_GLPI['root_doc'] . "/lib/prism/prism.css"); echo Html::script($CFG_GLPI['root_doc'] . "/lib/prism/prism.js"); echo "<div class='documentation'>"; $documentation = file_get_contents(GLPI_ROOT . '/' . $file); $md = new Michelf\MarkdownExtra(); $md->code_class_prefix = "language-"; $md->header_id_func = function ($headerName) { $headerName = str_replace(array('(', ')'), '', $headerName); return rawurlencode(strtolower(strtr($headerName, [' ' => '-']))); }; echo $md->transform($documentation); echo "</div>"; Html::nullFooter(); }
$_SESSION['valid_id'] = session_id(); $_SESSION['glpiactiveentities'] = $form->fields['entities_id']; $subentities = getSonsOf('glpi_entities', $form->fields['entities_id']); $_SESSION['glpiactiveentities_string'] = !empty($subentities) ? "'" . implode("', '", $subentities) . "'" : "'" . $form->fields['entities_id'] . "'"; } } if (isset($_SESSION['glpiactiveprofile']['interface']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') { Html::helpHeader(__('Form list', 'formcreator'), $_SERVER['PHP_SELF']); $form->displayUserForm($form); Html::helpFooter(); } elseif (!empty($_SESSION['glpiactiveprofile'])) { Html::header(__('Form Creator', 'formcreator'), $_SERVER['PHP_SELF'], 'helpdesk', 'PluginFormcreatorFormlist'); $form->displayUserForm($form); Html::footer(); } else { Html::nullHeader(__('Form Creator', 'formcreator'), $_SERVER['PHP_SELF']); Html::displayMessageAfterRedirect(); $form->displayUserForm($form); Html::nullFooter(); } } else { Html::displayNotFoundError(); } // If user was not authenticated, remove temporary user if ($_SESSION['glpiname'] == 'formcreator_temp_user') { unset($_SESSION['glpiname']); } // Or display a "Not found" error } else { Html::displayNotFoundError(); }
/** * Display the API Documentation in Html (parsed from markdown) * * @since version 9.1 * * @param string $file relative path of documentation file */ public function inlineDocumentation($file) { global $CFG_GLPI; self::header(true, __("API Documentation")); echo Html::css($CFG_GLPI['root_doc'] . "/lib/prism/prism.css"); echo Html::script($CFG_GLPI['root_doc'] . "/lib/prism/prism.js"); echo "<div class='documentation'>"; $documentation = file_get_contents(GLPI_ROOT . '/' . $file); echo ParsedownExtra::instance()->text($documentation); echo "</div>"; Html::nullFooter(); }