本文整理汇总了PHP中Toolbox::stripslashes_deep方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::stripslashes_deep方法的具体用法?PHP Toolbox::stripslashes_deep怎么用?PHP Toolbox::stripslashes_deep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::stripslashes_deep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDatas
/**
* Display datas extracted from DB
*
* @param $data array of search datas prepared to get datas
*
* @return nothing
**/
static function displayDatas(array &$data)
{
global $CFG_GLPI;
$item = null;
if (class_exists($data['itemtype'])) {
$item = new $data['itemtype']();
}
$rand = mt_rand();
if (!isset($data['data']) || !isset($data['data']['totalcount'])) {
return false;
}
// Contruct Pager parameters
$globallinkto = Toolbox::append_params(array('criteria' => Toolbox::stripslashes_deep($data['search']['criteria']), 'metacriteria' => Toolbox::stripslashes_deep($data['search']['metacriteria'])), '&');
$parameters = "sort=" . $data['search']['sort'] . "&order=" . $data['search']['order'] . '&' . $globallinkto;
if (isset($_GET['_in_modal'])) {
$parameters .= "&_in_modal=1";
}
// Global search header
if ($data['display_type'] == self::GLOBAL_SEARCH) {
if ($data['item']) {
echo "<div class='center'><h2>" . $data['item']->getTypeName();
// More items
if ($data['data']['totalcount'] > $data['search']['start'] + self::GLOBAL_DISPLAY_COUNT) {
echo " <a href='" . $data['search']['target'] . "?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
// If the begin of the view is before the number of items
if ($data['data']['count'] > 0) {
// Display pager only for HTML
if ($data['display_type'] == self::HTML_OUTPUT) {
// For plugin add new parameter if available
if ($plug = isPluginItemType($data['itemtype'])) {
$function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
if (function_exists($function)) {
$out = $function($data['itemtype']);
if (is_array($out) && count($out)) {
$parameters .= Toolbox::append_params($out, '&');
}
}
}
$search_config_top = "";
$search_config_bottom = "";
if (!isset($_GET['_in_modal']) && Session::haveRightsOr('search_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL))) {
$search_config_top = $search_config_bottom = "<div class='pager_controls'><img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config_top .= " class='pointer' onClick=\"";
$search_config_top .= Html::jsGetElementbyID('search_config_top') . ".dialog('open');\">";
$search_config_bottom .= " class='pointer' onClick=\"";
$search_config_bottom .= Html::jsGetElementbyID('search_config_bottom') . ".dialog('open');\">";
$search_config_top .= Ajax::createIframeModalWindow('search_config_top', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
$search_config_bottom .= Ajax::createIframeModalWindow('search_config_bottom', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
}
if ($item !== null && $item->maybeDeleted()) {
$delete_ctrl = self::isDeletedSwitch($data['search']['is_deleted']);
$search_config_top .= $delete_ctrl;
}
Html::printPager($data['search']['start'], $data['data']['totalcount'], $data['search']['target'], $parameters, $data['itemtype'], 0, $search_config_top);
$search_config_top .= "</div>";
$search_config_bottom .= "</div>";
}
// Define begin and end var for loop
// Search case
$begin_display = $data['data']['begin'];
$end_display = $data['data']['end'];
// Form to massive actions
$isadmin = $data['item'] && $data['item']->canUpdate();
if (!$isadmin && InfoCom::canApplyOn($data['itemtype'])) {
$isadmin = Infocom::canUpdate() || Infocom::canCreate();
}
if ($data['itemtype'] != 'AllAssets') {
$showmassiveactions = count(MassiveAction::getAllMassiveActions($data['item'], $data['search']['is_deleted']));
} else {
$showmassiveactions = true;
}
$massformid = 'massform' . $data['itemtype'];
if ($showmassiveactions && $data['display_type'] == self::HTML_OUTPUT) {
Html::openMassiveActionsForm($massformid);
$massiveactionparams = $data['search']['massiveactionparams'];
$massiveactionparams['num_displayed'] = $end_display - $begin_display;
$massiveactionparams['fixed'] = false;
$massiveactionparams['is_deleted'] = $data['search']['is_deleted'];
$massiveactionparams['container'] = $massformid;
Html::showMassiveActions($massiveactionparams);
}
// Compute number of columns to display
// Add toview elements
$nbcols = count($data['data']['cols']);
if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
// HTML display - massive modif
$nbcols++;
//.........这里部分代码省略.........
示例2: post_addItem
function post_addItem()
{
//only log in file, important events (connections and critical events; TODO : we need to add a general option to filter this in 9.1)
if (isset($this->fields['level']) && $this->fields['level'] <= 3) {
$message_type = "";
if (isset($this->fields['type']) && $this->fields['type'] != 'system') {
$message_type = "[" . $this->fields['type'] . " " . $this->fields['id'] . "] ";
}
$full_message = "[" . $this->fields['service'] . "] " . $message_type . $this->fields['level'] . ": " . Toolbox::stripslashes_deep($this->fields['message']) . "\n";
Toolbox::logInFile("event", $full_message);
}
}
示例3: plugin_surveyticket_install
function plugin_surveyticket_install()
{
global $DB;
if (!TableExists('glpi_plugin_surveyticket_questions')) {
$DB_file = GLPI_ROOT . "/plugins/surveyticket/install/mysql/plugin_surveyticket-empty.sql";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (Toolbox::get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
include GLPI_ROOT . "/plugins/surveyticket/inc/profile.class.php";
$psProfile = new PluginSurveyticketProfile();
$psProfile->initProfile();
}
return true;
}
示例4: plugin_escalation_install
function plugin_escalation_install()
{
global $DB;
if (!TableExists("glpi_plugin_escalation_groups_groups")) {
$empty_sql = "plugin_escalation-empty.sql";
$DB_file = GLPI_ROOT . "/plugins/escalation/install/mysql/{$empty_sql}";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (Toolbox::get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
} else {
if (!TableExists("glpi_plugin_escalation_configs")) {
$DB->query("CREATE TABLE `glpi_plugin_escalation_configs` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `entities_id` int(11) NOT NULL DEFAULT '0',\n `unique_assigned` varchar(255) DEFAULT NULL,\n `workflow` varchar(255) DEFAULT NULL,\n `limitgroup` varchar(255) DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
$DB->query("INSERT INTO `glpi_plugin_escalation_configs`\n (`id` ,`entities_id` ,`unique_assigned` ,`workflow`, `limitgroup`)\n VALUES (NULL , '0', '0', '0', '0');");
}
if (!TableExists("glpi_plugin_escalation_profiles")) {
$DB->query("CREATE TABLE `glpi_plugin_escalation_profiles` (\n `profiles_id` int(11) NOT NULL DEFAULT '0',\n `bypassworkflow` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `copyticket` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `copyticketonworkflow` char(1) COLLATE utf8_unicode_ci DEFAULT NULL\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
}
if (!FieldExists('glpi_plugin_escalation_profiles', 'copyticket')) {
$DB->query("ALTER TABLE `glpi_plugin_escalation_profiles` \n ADD `copyticket` CHAR( 1 ) NULL ");
$DB->query("ALTER TABLE `glpi_plugin_escalation_profiles` \n ADD `copyticketonworkflow` CHAR( 1 ) NULL ");
}
if (!FieldExists("glpi_plugin_escalation_configs", "limitgroup")) {
$migration = new Migration(PLUGIN_ESCALATION_VERSION);
$migration->addField('glpi_plugin_escalation_configs', "limitgroup", "varchar(255) DEFAULT NULL");
$migration->migrationOneTable('glpi_plugin_escalation_configs');
$DB->query("UPDATE `glpi_plugin_escalation_configs` \n SET `limitgroup` = '0' WHERE `entities_id` =1");
}
}
return true;
}
示例5: showFormInfos
/**
*
* Display additional information form from Model form
* @param PluginDatainjectionModel $model
*/
static function showFormInfos(PluginDatainjectionModel $model)
{
$canedit = $model->can($model->fields['id'], UPDATE);
self::showAddInfo($model, $canedit);
$model->loadInfos();
$nb = count($model->getInfos());
if ($nb > 0) {
echo "<form method='post' name='info_form' id='info_form' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit) {
echo "<th> </th>";
}
echo "<th>" . __('Tables', 'datainjection') . "</th>";
echo "<th>" . __('Fields', 'datainjection') . "</th>";
echo "<th>" . __('Mandatory information', 'datainjection') . "</th>";
echo "</tr>";
foreach ($model->getInfos() as $info) {
$info->fields = Toolbox::stripslashes_deep($info->fields);
$infos_id = $info->fields['id'];
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
echo "<input type='checkbox' name='item[" . $infos_id . "]' value='1' {$sel}>";
echo "</td>";
}
echo "<td class='center'>";
$rand = PluginDatainjectionInjectionType::dropdownLinkedTypes($info, array('primary_type' => $model->fields['itemtype']));
echo "</td>";
echo "<td class='center'><span id='span_field_{$infos_id}'></span></td>";
echo "<td class='center'><span id='span_mandatory_{$infos_id}'></span></td></tr>";
}
if ($canedit) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='4'>";
echo "<input type='hidden' name='models_id' value='" . $model->fields['id'] . "'>";
echo "<input type='submit' name='update' value='" . _sx('button', 'Save') . "' class='submit'>";
echo "</td></tr>";
Html::openArrowMassives("info_form", true);
Html::closeArrowMassives(array('delete' => __('Delete permanently')));
}
echo "</table>";
Html::closeForm();
}
}
示例6: pluginMonitoringInstall
function pluginMonitoringInstall($version)
{
global $DB, $CFG_GLPI;
// ** Insert in DB
$DB_file = GLPI_ROOT . "/plugins/monitoring/install/mysql/plugin_monitoring-" . $version . "-empty.sql";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
include GLPI_ROOT . "/plugins/monitoring/inc/profile.class.php";
$pmProfile = new PluginMonitoringProfile();
$pmProfile->initProfile();
include GLPI_ROOT . "/plugins/monitoring/inc/command.class.php";
$pmCommand = new PluginMonitoringCommand();
$pmCommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/notificationcommand.class.php";
$pmNotificationcommand = new PluginMonitoringNotificationcommand();
$pmNotificationcommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/check.class.php";
$pmCheck = new PluginMonitoringCheck();
$pmCheck->initChecks();
include GLPI_ROOT . "/plugins/monitoring/inc/hostconfig.class.php";
$pmHostconfig = new PluginMonitoringHostconfig();
$pmHostconfig->initConfig();
include GLPI_ROOT . "/plugins/monitoring/inc/config.class.php";
$pmConfig = new PluginMonitoringConfig();
$pmConfig->initConfig();
$query = "UPDATE `glpi_plugin_monitoring_configs`\n SET `version`='" . PLUGIN_MONITORING_VERSION . "'\n WHERE `id`='1'";
$DB->query($query);
$query = "SELECT * FROM `glpi_calendars`\n WHERE `name`='24x7'\n LIMIT 1";
$result = $DB->query($query);
if ($DB->numrows($result) == 0) {
$calendar = new Calendar();
$input = array();
$input['name'] = '24x7';
$input['is_recursive'] = 1;
$calendars_id = $calendar->add($input);
$calendarSegment = new CalendarSegment();
$input = array();
$input['calendars_id'] = $calendars_id;
$input['is_recursive'] = 1;
$input['begin'] = '00:00:00';
$input['end'] = '24:00:00';
$input['day'] = '0';
$calendarSegment->add($input);
$input['day'] = '1';
$calendarSegment->add($input);
$input['day'] = '2';
$calendarSegment->add($input);
$input['day'] = '3';
$calendarSegment->add($input);
$input['day'] = '4';
$calendarSegment->add($input);
$input['day'] = '5';
$calendarSegment->add($input);
$input['day'] = '6';
$calendarSegment->add($input);
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/templates')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/templates");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/weathermapbg')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/weathermapbg");
}
CronTask::Register('PluginMonitoringServiceevent', 'updaterrd', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringLog', 'cleanlogs', '96400', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringUnavaibility', 'unavaibility', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringDisplayview_rule', 'replayallviewrules', '1200', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
示例7: foreach
$values = $_POST['users_id_validate'];
}
foreach ($data_users as $data) {
$users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'], $data['firstname']);
if (in_array($data['id'], $values)) {
$param['values'][] = $data['id'];
}
}
// Display all users
if (isset($_POST['all_users']) && $_POST['all_users']) {
$param['values'] = array_keys($users);
}
$param['multiple'] = true;
$param['display'] = true;
$param['size'] = count($users);
$users = Toolbox::stripslashes_deep($users);
$rand = Dropdown::showFromArray(!empty($_POST['name']) ? $_POST['name'] : 'users_id_validate', $users, $param);
// Display all/none buttons to select all or no users in group
if (!empty($_POST['groups_id'])) {
echo "<br><br><a id='all_users' class='vsubmit'>" . __('All') . "</a>";
$param_button['validatortype'] = 'list_users';
$param_button['name'] = !empty($_POST['name']) ? $_POST['name'] : '';
$param_button['users_id_validate'] = '';
$param_button['all_users'] = 1;
$param_button['groups_id'] = $_POST['groups_id'];
$param_button['entity'] = $_POST['entity'];
$param_button['right'] = $_POST['right'];
Ajax::updateItemOnEvent('all_users', 'show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param_button, array('click'));
echo " <a id='no_users' class='vsubmit'>" . __('None') . "</a>";
$param_button['all_users'] = 0;
Ajax::updateItemOnEvent('no_users', 'show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param_button, array('click'));
示例8: getUsedMappingsOrInfos
/**
* @param $options array
**/
static function getUsedMappingsOrInfos($options = array())
{
global $DB;
$p['itemtype'] = self::NO_VALUE;
$p['primary_type'] = '';
$p['mapping_or_info'] = array();
$p['called_by'] = '';
$p['need_decode'] = true;
foreach ($options as $key => $value) {
$p[$key] = $value;
}
if ($p['need_decode']) {
$mapping_or_info = json_decode(Toolbox::stripslashes_deep($options['mapping_or_info']), true);
} else {
$mapping_or_info = $options['mapping_or_info'];
}
$used = array();
$table = $p['called_by'] == 'PluginDatainjectionMapping' ? "glpi_plugin_datainjection_mappings" : "glpi_plugin_datainjection_infos";
$datas = getAllDatasFromTable($table, "`models_id` = '" . $mapping_or_info['models_id'] . "'");
$injectionClass = PluginDatainjectionCommonInjectionLib::getInjectionClassInstance($p['itemtype']);
$options = $injectionClass->getOptions();
foreach ($datas as $data) {
if ($data['value'] != self::NO_VALUE) {
foreach ($options as $option) {
if (isset($option['table']) && $option['table'] == getItemTypeForTable($data['itemtype']) && $option['linkfield'] == $data['value'] && $option['displaytype'] != 'multiline_text' && $mapping_or_info['value'] != $data['value']) {
$used[$option['linkfield']] = $option['linkfield'];
break;
}
}
}
}
return $used;
}
示例9: unset
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
if (!Session::haveRightsOr('knowbase', array(READ, KnowbaseItem::READFAQ))) {
Session::redirectIfNotLoggedIn();
Html::displayRightError();
}
if (isset($_GET["id"])) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $_GET["id"]);
}
Html::header(KnowbaseItem::getTypeName(1), $_SERVER['PHP_SELF'], "tools", "knowbaseitem");
// Clean for search
$_GET = Toolbox::stripslashes_deep($_GET);
// Search a solution
if (!isset($_GET["contains"]) && isset($_GET["item_itemtype"]) && isset($_GET["item_items_id"])) {
if ($item = getItemForItemtype($_GET["item_itemtype"])) {
if ($item->getFromDB($_GET["item_items_id"])) {
$_GET["contains"] = $item->getField('name');
}
}
}
// Manage forcetab : non standard system (file name <> class name)
if (isset($_GET['forcetab'])) {
Session::setActiveTab('Knowbase', $_GET['forcetab']);
unset($_GET['forcetab']);
}
$kb = new Knowbase();
$kb->display($_GET);
示例10: getDatasForTemplate
public function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$events = $this->getAllEvents();
$this->datas['##order.action##'] = $events[$event];
if ($event == 'duedate') {
$this->datas['##order.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
foreach ($options['orders'] as $id => $order) {
$tmp = array();
$tmp['##order.item.name##'] = $order['name'];
$tmp['##order.item.numorder##'] = $order['num_order'];
$tmp['##order.item.url##'] = rawurldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_order_order_" . $id);
$tmp['##order.item.orderdate##'] = Html::convDate($order["order_date"]);
$tmp['##order.item.duedate##'] = Html::convDate($order["duedate"]);
$tmp['##order.item.deliverydate##'] = Html::convDate($order["deliverydate"]);
$tmp['##order.item.comment##'] = Html::clean($order["comment"]);
$tmp['##order.item.state##'] = Dropdown::getDropdownName('glpi_plugin_order_orderstates', $order["plugin_order_orderstates_id"]);
$this->datas['orders'][] = $tmp;
}
$this->getTags();
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
if (!isset($this->datas[$tag])) {
$this->datas[$tag] = $values['label'];
}
}
} else {
$this->datas['##lang.ordervalidation.title##'] = $events[$event];
$this->datas['##lang.ordervalidation.entity##'] = __("Entity");
$this->datas['##ordervalidation.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->obj->getField('entities_id'));
$this->datas['##lang.ordervalidation.name##'] = __("Name");
$this->datas['##ordervalidation.name##'] = $this->obj->getField("name");
$this->datas['##lang.ordervalidation.numorder##'] = __("Order number");
$this->datas['##ordervalidation.numorder##'] = $this->obj->getField("num_order");
$this->datas['##lang.ordervalidation.orderdate##'] = __("Date of order", "order");
$this->datas['##ordervalidation.orderdate##'] = Html::convDate($this->obj->getField("order_date"));
$this->datas['##lang.ordervalidation.state##'] = __("Status");
$this->datas['##ordervalidation.state##'] = Dropdown::getDropdownName("glpi_plugin_order_orderstates", $this->obj->getField("plugin_order_orderstates_id"));
$this->datas['##lang.ordervalidation.comment##'] = __("Comment of validation", "order");
$comment = Toolbox::stripslashes_deep(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $options['comments']));
$this->datas['##ordervalidation.comment##'] = nl2br($comment);
switch ($event) {
case "ask":
$this->datas['##lang.ordervalidation.users##'] = __("Request order validation", "order") . " " . __("By");
break;
case "validation":
$this->datas['##lang.ordervalidation.users##'] = __("Order is validated", "order") . " " . __("By");
break;
case "cancel":
$this->datas['##lang.ordervalidation.users##'] = __("Order canceled", "order") . " " . __("By");
break;
case "undovalidation":
$this->datas['##lang.ordervalidation.users##'] = __("Validation canceled successfully", "order") . " " . __("By");
break;
case "delivered":
$this->datas['##lang.ordervalidation.users##'] = __("No item to generate", "order");
break;
}
$this->datas['##ordervalidation.users##'] = Html::clean(getUserName(Session::getLoginUserID()));
$this->datas['##order.author.name##'] = Html::clean(getUserName($this->obj->getField('users_id')));
$this->datas['##order.deliveryuser.name##'] = Html::clean(getUserName($this->obj->getField('users_id_delivery')));
$this->datas['##lang.ordervalidation.url##'] = "URL";
$url = $CFG_GLPI["url_base"] . "/index.php?redirect=plugin_order_order_" . $this->obj->getField("id");
$this->datas['##ordervalidation.url##'] = urldecode($url);
}
}
示例11: header
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "ruleactionvalue.php")) {
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not acces directly to this file");
}
Session::checkLoginUser();
$display = false;
$ra = new RuleAction();
$ra->displayActionSelectPattern(Toolbox::stripslashes_deep($_POST));
示例12: Login
//.........这里部分代码省略.........
break;
case self::MAIL:
if (Toolbox::canUseImapPop()) {
AuthMail::tryMailAuth($this, $login_name, $login_password, $this->user->fields["auths_id"]);
}
break;
case self::NOT_YET_AUTHENTIFIED:
break;
}
} else {
if (!$exists) {
//test all ldap servers only is user is not present in glpi's DB
if (!$this->auth_succeded && Toolbox::canUseLdap()) {
AuthLdap::tryLdapAuth($this, $login_name, $login_password, 0, false, false);
}
//test all imap/pop servers
if (!$this->auth_succeded && Toolbox::canUseImapPop()) {
AuthMail::tryMailAuth($this, $login_name, $login_password, 0, false);
}
}
}
}
// Fin des tests de connexion
}
}
if ($user_deleted_ldap) {
User::manageDeletedUserInLdap($this->user->fields["id"]);
}
// Ok, we have gathered sufficient data, if the first return false the user
// is not present on the DB, so we add him.
// if not, we update him.
if ($this->auth_succeded) {
//Set user an not deleted from LDAP
$this->user->fields['is_deleted_ldap'] = 0;
// Prepare data
$this->user->fields["last_login"] = $_SESSION["glpi_currenttime"];
if ($this->extauth) {
$this->user->fields["_extauth"] = 1;
}
if ($DB->isSlave()) {
if (!$this->user_present) {
// Can't add in slave mode
$this->addToError(__('User not authorized to connect in GLPI'));
$this->auth_succeded = false;
}
} else {
if ($this->user_present) {
// First stripslashes to avoid double slashes
$input = Toolbox::stripslashes_deep($this->user->fields);
// Then ensure addslashes
$input = Toolbox::addslashes_deep($input);
// update user and Blank PWD to clean old database for the external auth
$this->user->update($input);
if ($this->extauth) {
$this->user->blankPassword();
}
} else {
if ($CFG_GLPI["is_users_auto_add"]) {
// Auto add user
// First stripslashes to avoid double slashes
$input = Toolbox::stripslashes_deep($this->user->fields);
// Then ensure addslashes
$input = Toolbox::addslashes_deep($input);
unset($this->user->fields);
$this->user->add($input);
} else {
// Auto add not enable so auth failed
$this->addToError(__('User not authorized to connect in GLPI'));
$this->auth_succeded = false;
}
}
}
}
// Log Event (if possible)
if (!$DB->isSlave()) {
// GET THE IP OF THE CLIENT
$ip = getenv("HTTP_X_FORWARDED_FOR") ? getenv("HTTP_X_FORWARDED_FOR") : getenv("REMOTE_ADDR");
if ($this->auth_succeded) {
if (GLPI_DEMO_MODE) {
// not translation in GLPI_DEMO_MODE
Event::log(-1, "system", 3, "login", $login_name . " log in from " . $ip);
} else {
//TRANS: %1$s is the login of the user and %2$s its IP address
Event::log(-1, "system", 3, "login", sprintf(__('%1$s log in from IP %2$s'), $login_name, $ip));
}
} else {
if (GLPI_DEMO_MODE) {
Event::log(-1, "system", 1, "login", "login", "Connection failed for " . $login_name . " ({$ip})");
} else {
//TRANS: %1$s is the login of the user and %2$s its IP address
Event::log(-1, "system", 1, "login", sprintf(__('Failed login for %1$s from IP %2$s'), $login_name, $ip));
}
}
}
Session::init($this);
if ($noauto) {
$_SESSION["noAUTO"] = 1;
}
return $this->auth_succeded;
}
示例13: importExternal
/**
* Import a value in a dropdown table.
*
* This import a new dropdown if it doesn't exist - Play dictionnary if needed
*
* @param $value string Value of the new dropdown (need to be addslashes)
* @param $entities_id int entity in case of specific dropdown (default -1)
* @param $external_params array (manufacturer) (need to be addslashes)
* @param $comment (default '') (need to be addslashes)
* @param $add if true, add it if not found. if false,
* just check if exists (true by default)
*
* @return integer : dropdown id.
**/
function importExternal($value, $entities_id = -1, $external_params = array(), $comment = "", $add = true)
{
$value = trim($value);
if (strlen($value) == 0) {
return 0;
}
$ruleinput = array("name" => stripslashes($value));
$rulecollection = RuleCollection::getClassByType($this->getType(), true);
foreach ($this->additional_fields_for_dictionnary as $field) {
if (isset($external_params[$field])) {
$ruleinput[$field] = $external_params[$field];
} else {
$ruleinput[$field] = '';
}
}
/*
switch ($this->getTable()) {
case "glpi_computermodels" :
case "glpi_monitormodels" :
case "glpi_printermodels" :
case "glpi_peripheralmodels" :
case "glpi_phonemodels" :
case "glpi_networkequipmentmodels" :
$ruleinput["manufacturer"] = $external_params["manufacturer"];
break;
}*/
$input["name"] = $value;
$input["comment"] = $comment;
$input["entities_id"] = $entities_id;
if ($rulecollection) {
$res_rule = $rulecollection->processAllRules(Toolbox::stripslashes_deep($ruleinput), array(), array());
if (isset($res_rule["name"])) {
$input["name"] = $res_rule["name"];
}
}
return $add ? $this->import($input) : $this->findID($input);
}
示例14: post_addItem
function post_addItem()
{
if ($this->fields['perfdata'] != '' && !isset($_SESSION['plugin_monitoring_installation'])) {
PluginMonitoringPerfdataDetail::updateDetailForPerfdata(Toolbox::stripslashes_deep($this->fields['perfdata']), $this->fields['id']);
}
}
示例15: showFormMappings
/**
* @param $model PluginDatainjectionModel object
**/
static function showFormMappings(PluginDatainjectionModel $model)
{
global $CFG_GLPI;
$canedit = $model->can($model->fields['id'], UPDATE);
if (isset($_SESSION['datainjection']['lines'])) {
$lines = unserialize($_SESSION['datainjection']['lines']);
} else {
$lines = array();
}
echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
//Display link to the preview popup
if (isset($_SESSION['datainjection']['lines']) && !empty($lines)) {
$nblines = $_SESSION['datainjection']['nblines'];
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td class='center'>";
$url = $CFG_GLPI["root_doc"] . "/plugins/datainjection/front/popup.php?popup=preview&models_id=" . $model->getID();
echo "<a href=# onClick=\"var w = window.open('{$url}' , 'glpipopup', " . "'height=400, width=600, top=100, left=100, scrollbars=yes' );w.focus();\"/>";
echo __('See the file', 'datainjection') . "</a>";
echo "</td></tr>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th>" . __('Header of the file', 'datainjection') . "</th>";
echo "<th>" . __('Tables', 'datainjection') . "</th>";
echo "<th>" . _n('Field', 'Fields', 2) . "</th>";
echo "<th>" . __('Link field', 'datainjection') . "</th>";
echo "</tr>";
$model->loadMappings();
foreach ($model->getMappings() as $mapping) {
$mapping->fields = Toolbox::stripslashes_deep($mapping->fields);
$mappings_id = $mapping->getID();
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>" . $mapping->fields['name'] . "</td>";
echo "<td class='center'>";
$options = array('primary_type' => $model->fields['itemtype']);
PluginDatainjectionInjectionType::dropdownLinkedTypes($mapping, $options);
echo "</td>";
echo "<td class='center'><span id='span_field_{$mappings_id}'>";
echo "</span></td>";
echo "<td class='center'><span id='span_mandatory_{$mappings_id}'></span></td>";
}
if ($canedit) {
echo "<tr> <td class='tab_bg_2 center' colspan='4'>";
echo "<input type='hidden' name='models_id' value='" . $model->fields['id'] . "'>";
echo "<input type='submit' name='update' value='" . _sx('button', 'Save') . "' class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}