redirect() static public méthode

Redirection hack
static public redirect ( $dest ) : nothing
$dest string: Redirection destination
Résultat nothing
 function checkRight($itemtype, $right)
 {
     global $CFG_GLPI;
     if (!Session::haveRight($itemtype, $right)) {
         // Check for session timeout
         if (!isset($_SESSION['glpiID'])) {
             Html::redirect($CFG_GLPI['root_doc'] . '/index.php');
             exit;
         }
         Html::displayRightError();
     }
 }
Exemple #2
0
 /**
  * Check if I have the right $right to module $module 
  *
  * @param $module Module to check (typology)
  * @param $right Right to check
  *
  * @return Nothing : display error if not permit
  **/
 static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!plugin_typology_haveRight($module, $right)) {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             Html::redirect($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         Html::displayRightError();
     }
 }
 function checkMobileLogin()
 {
     //check Profile
     if (isset($_SESSION['glpi_plugin_mobile_profile']) && $_SESSION['glpi_plugin_mobile_profile']['mobile_user'] == '') {
         Html::redirect($CFG_GLPI["root_doc"] . "/plugins/front/central.php");
     }
     //check glpi login && redirect to plugin mobile
     if (!isset($_SESSION["glpiactiveprofile"]) || $_SESSION["glpiactiveprofile"]["interface"] != "central") {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             if (strpos($_SERVER['PHP_SELF'], 'index.php') === false && strpos($_SERVER['PHP_SELF'], 'login.php') === false && strpos($_SERVER['PHP_SELF'], 'logout.php') === false && strpos($_SERVER['PHP_SELF'], 'recoverpassword.form.php') === false) {
                 //Html::redirect($CFG_GLPI["root_doc"]."/plugins/mobile/index.php");
                 Html::redirect("/glpi/plugins/mobile/index.php");
                 exit;
             }
         }
     }
 }
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     switch ($ma->getAction()) {
         case "uninstall":
             $itemtype = $ma->getItemtype(false);
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     //Session::addMessageAfterRedirect(sprintf(__('Form duplicated: %s', 'formcreator'), $item->getName()));
                     $_SESSION['glpi_uninstalllist'][$itemtype][$id] = $id;
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 }
             }
             Html::redirect($CFG_GLPI["root_doc"] . '/plugins/uninstall/front/action.php?device_type=' . $itemtype . "&model_id=" . $_POST["model_id"]);
             return;
             break;
     }
     return;
 }
Exemple #5
0
function plugin_init_treeview()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['treeview'] = true;
    Plugin::registerClass('PluginTreeviewPreference', array('addtabon' => array('Preference')));
    Plugin::registerClass('PluginTreeviewProfile', array('addtabon' => array('Profile')));
    $PLUGIN_HOOKS['change_profile']['treeview'] = array('PluginTreeviewProfile', 'changeprofile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginTreeviewProfile', array('addtabon' => 'Profile'));
        if (Session::haveRight("plugin_treeview", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['treeview'] = array('tools' => 'PluginTreeviewConfig');
            $PLUGIN_HOOKS['pre_item_purge']['treeview'] = array('Profile' => array('PluginTreeviewProfile', 'cleanProfiles'));
            if (isset($_SESSION["glpi_plugin_treeview_loaded"]) && $_SESSION["glpi_plugin_treeview_loaded"] == 1 && class_exists('PluginTreeviewConfig')) {
                foreach (PluginTreeviewConfig::getTypes() as $type) {
                    $PLUGIN_HOOKS['item_update']['treeview'][$type] = 'plugin_item_update_treeview';
                    $PLUGIN_HOOKS['item_delete']['treeview'][$type] = 'plugin_treeview_reload';
                    $PLUGIN_HOOKS['item_restore']['treeview'][$type] = 'plugin_treeview_reload';
                }
            }
            if ($_SERVER['PHP_SELF'] == $CFG_GLPI["root_doc"] . "/front/central.php" && (!isset($_SESSION["glpi_plugin_treeview_loaded"]) || $_SESSION["glpi_plugin_treeview_loaded"] == 0) && isset($_SESSION["glpi_plugin_treeview_preference"]) && $_SESSION["glpi_plugin_treeview_preference"] == 1) {
                Html::redirect($CFG_GLPI["root_doc"] . "/plugins/treeview/index.php");
            }
            if ($_SERVER['PHP_SELF'] == $CFG_GLPI["root_doc"] . "/logout.php" && (isset($_SESSION["glpi_plugin_treeview_loaded"]) && $_SESSION["glpi_plugin_treeview_loaded"] == 1 && class_exists('PluginTreeviewConfig'))) {
                $config = new PluginTreeviewConfig();
                $config->hideTreeview();
            }
            // Add specific files to add to the header : javascript or css
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "dtree.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "dtree.css";
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "functions.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "style.css";
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "treeview.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "treeview.css";
        }
        // Config page
        if (Session::haveRight("plugin_treeview", UPDATE) || Session::haveRight("config", UPDATE)) {
            $PLUGIN_HOOKS['config_page']['treeview'] = 'front/config.form.php';
        }
    }
}
     if (isset($_POST["ldap_filter2"])) {
         $_SESSION["ldap_group_filter2"] = $_POST["ldap_filter2"];
     }
     Html::redirect($_SERVER['PHP_SELF']);
 } else {
     if (!isset($_GET['start'])) {
         $_GET['start'] = 0;
     }
     if (isset($_SESSION["ldap_import"])) {
         unset($_SESSION["ldap_import"]);
     }
     if (!isset($_SESSION["ldap_server"])) {
         if (isset($_POST["ldap_server"])) {
             $_SESSION["ldap_server"] = $_POST["ldap_server"];
         } else {
             Html::redirect($CFG_GLPI["root_doc"] . "/front/ldap.php");
         }
     }
     if (!AuthLdap::testLDAPConnection($_SESSION["ldap_server"])) {
         unset($_SESSION["ldap_server"]);
         echo "<div class='center b'>" . __('Unable to connect to the LDAP directory') . "<br>";
         echo "<a href='" . $_SERVER['PHP_SELF'] . "?next=listservers'>" . __('Back') . "</a></div>";
     } else {
         if (!isset($_SESSION["ldap_group_filter"])) {
             $_SESSION["ldap_group_filter"] = '';
         }
         if (!isset($_SESSION["ldap_group_filter2"])) {
             $_SESSION["ldap_group_filter2"] = '';
         }
         if (isset($_GET["order"])) {
             $_SESSION["ldap_sortorder"] = $_GET["order"];
Exemple #7
0
@link      http://www.glpi-project.org/
@since     2009
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Plugin::load('webservices', true);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$webservices = new PluginWebservicesClient();
if (isset($_POST["add"])) {
    $webservices->check(-1, CREATE, $_POST);
    $webservices->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $webservices->check($_POST["id"], UPDATE);
        $webservices->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["purge"])) {
            $webservices->check($_POST["id"], PURGE);
            $webservices->delete($_POST);
            Html::redirect($CFG_GLPI["root_doc"] . "/plugins/webservices/front/client.php");
        } else {
            Html::header(__('Web Services', 'webservices'), $_SERVER['PHP_SELF'], "config", "pluginWebservicesClient");
            $webservices->display(array('id' => $_GET["id"]));
            Html::footer();
        }
    }
}
* * @since version 0.85 in front
*/
include '../inc/includes.php';
//@session_start();
if (!isset($_SESSION["noAUTO"]) && isset($_SESSION["glpiauthtype"]) && $_SESSION["glpiauthtype"] == Auth::CAS) {
    include GLPI_PHPCAS;
    phpCAS::client(CAS_VERSION_2_0, $CFG_GLPI["cas_host"], intval($CFG_GLPI["cas_port"]), $CFG_GLPI["cas_uri"], false);
    phpCAS::setServerLogoutURL(strval($CFG_GLPI["cas_logout"]));
    phpCAS::logout();
}
$toADD = "";
// Redirect management
if (isset($_POST['redirect']) && strlen($_POST['redirect']) > 0) {
    $toADD = "?redirect=" . $_POST['redirect'];
} else {
    if (isset($_GET['redirect']) && strlen($_GET['redirect']) > 0) {
        $toADD = "?redirect=" . $_GET['redirect'];
    }
}
if (isset($_SESSION["noAUTO"]) || isset($_GET['noAUTO'])) {
    if (empty($toADD)) {
        $toADD .= "?";
    } else {
        $toADD .= "&";
    }
    $toADD .= "noAUTO=1";
}
Session::destroy();
// Redirect to the login-page
Html::redirect($CFG_GLPI["root_doc"] . "/index.php" . $toADD);
/** @file
* @brief
* @since version 0.85
*/
if (!defined('GLPI_ROOT')) {
    include '../inc/includes.php';
}
$link = new Supplier_Ticket();
Session::checkLoginUser();
Html::popHeader(__('Email followup'), $_SERVER['PHP_SELF']);
if (isset($_POST["update"])) {
    $link->check($_POST["id"], UPDATE);
    $link->update($_POST);
    echo "<script type='text/javascript' >\n";
    echo "window.parent.location.reload();";
    echo "</script>";
} else {
    if (isset($_POST['delete'])) {
        $link->check($_POST['id'], DELETE);
        $link->delete($_POST);
        Event::log($link->fields['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
        Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $link->fields['tickets_id']);
    } else {
        if (isset($_GET["id"])) {
            $link->showSupplierNotificationForm($_GET["id"]);
        } else {
            Html::displayErrorAndDie('Lost');
        }
    }
}
Html::popFooter();
$ruleaction = new RuleAction(get_class($rule));
if (isset($_POST["add_action"])) {
    $rulecollection->checkGlobal(CREATE);
    $ruleaction->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $rulecollection->checkGlobal(UPDATE);
        $rule->update($_POST);
        Event::log($_POST['id'], "rules", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
        Html::back();
    } else {
        if (isset($_POST["add"])) {
            $rulecollection->checkGlobal(CREATE);
            $newID = $rule->add($_POST);
            Event::log($newID, "rules", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $newID));
            Html::redirect($_SERVER['HTTP_REFERER'] . "?id={$newID}");
        } else {
            if (isset($_POST["purge"])) {
                $rulecollection->checkGlobal(PURGE);
                $rulecollection->deleteRuleOrder($_POST["ranking"]);
                $rule->delete($_POST, 1);
                Event::log($_POST["id"], "rules", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $rule->redirectToList();
            }
        }
    }
}
Html::header(Rule::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'admin', $rulecollection->menu_type, $rulecollection->menu_option);
$rule->display(array('id' => $_GET["id"]));
Html::footer();
Exemple #11
0
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 show network port by network equipment
*/
include '../inc/includes.php';
Session::checkRight("reports", READ);
// Titre
if (isset($_POST["switch"]) && $_POST["switch"]) {
    Html::header(Report::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "tools", "report");
    Report::title();
    $name = Dropdown::getDropdownName("glpi_networkequipments", $_POST["switch"]);
    echo "<div class='center spaced'><h2>" . sprintf(__('Network report by hardware: %s'), $name) . "</h2></div>";
    Report::reportForNetworkInformations("`glpi_networkequipments` AS ITEM", "PORT_1.`itemtype` = 'NetworkEquipment'\n                                              AND PORT_1.`items_id` = ITEM.`id`", "ITEM.`id` = '" . $_POST["switch"] . "'");
    Html::footer();
} else {
    Html::redirect($CFG_GLPI['root_doc'] . "/front/report.networking.php");
}
/**
 * @since version 0.84.2
**/
function checkConfigFile()
{
    if (file_exists(GLPI_CONFIG_DIR . "/config_db.php")) {
        Html::redirect($CFG_GLPI['root_doc'] . "/index.php");
        die;
    }
}
Exemple #13
0
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Genericobject plugin 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 Genericobject. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   genericobject
 @author    the genericobject plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/genericobject
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
Session::checkRight("config", "w");
if (isset($_GET['itemtype'])) {
    $type = new PluginGenericobjectType();
    $type->getFromDBByType($_GET['itemtype']);
    Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType') . '?id=' . $type->getID());
} else {
    Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "plugins", "genericobject", "type");
    Search::Show('PluginGenericobjectType');
    Html::footer();
}
Exemple #14
0
if (isset($_POST['activate'])) {
    $config = new Config();
    $tmp['id'] = $CFG_GLPI['id'];
    $tmp['use_mailing'] = 1;
    $config->update($tmp);
    Html::back();
}
if (!$CFG_GLPI['use_mailing']) {
    if (Session::haveRight("config", "w")) {
        echo "<div class='center'>";
        Html::showSimpleForm($_SERVER['PHP_SELF'], 'activate', __('Enable followup via email'));
        echo "</div>";
    }
} else {
    if (!Session::haveRight("config", "r") && Session::haveRight("notification", "r") && $CFG_GLPI['use_mailing']) {
        Html::redirect($CFG_GLPI["root_doc"] . '/front/notification.php');
    } else {
        echo "<table class='tab_cadre'>";
        echo "<tr><th>" . _n('Notification', 'Notifications', 2) . "</th></tr>";
        if (Session::haveRight("config", "r")) {
            echo "<tr class='tab_bg_1'><td class='center'>" . "<a href='notificationmailsetting.form.php'>" . __('Email followups configuration') . "</a></td></tr>";
            echo "<tr class='tab_bg_1'><td class='center'><a href='notificationtemplate.php'>" . _n('Notification template', 'Notification templates', 2) . "</a></td> </tr>";
        }
        if (Session::haveRight("notification", "r") && $CFG_GLPI['use_mailing']) {
            echo "<tr class='tab_bg_1'><td class='center'>" . "<a href='notification.php'>" . _n('Notification', 'Notifications', 2) . "</a></td></tr>";
        } else {
            echo "<tr class='tab_bg_1'><td class='center'>" . __('Impossible to configure the notifications: please configure your email followup using the above configuration.') . "</td></tr>";
        }
        echo "</table>";
    }
}
Exemple #15
0
    Session::redirectIfNotLoggedIn();
    Html::displayRightError();
}
if (isset($_POST["id"])) {
    $_GET["id"] = $_POST["id"];
} else {
    if (!isset($_GET["id"])) {
        $_GET["id"] = -1;
    }
}
if (isset($_POST["purge"])) {
    $item_device->check($_POST["id"], PURGE);
    $item_device->delete($_POST, 1);
    Event::log($_POST["id"], get_class($item_device), 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
    $device = $item_device->getOnePeer(1);
    Html::redirect($device->getLinkURL());
} else {
    if (isset($_POST["update"])) {
        $item_device->check($_POST["id"], UPDATE);
        $item_device->update($_POST);
        Event::log($_POST["id"], get_class($item_device), 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
        Html::back();
    } else {
        Html::header($item_device->getTypeName(Session::getPluralNumber()), '', "config", "commondevice", get_class($item_device));
        if (!isset($options)) {
            $options = array();
        }
        $options['id'] = $_GET["id"];
        $item_device->display($options);
        Html::footer();
    }
Exemple #16
0
    Html::displayBackLink();
    echo "</div>";
    Html::popFooter();
    exit;
}
Html::popHeader(__('Bulk modification'), $_SERVER['PHP_SELF']);
$results = $ma->process();
$nbok = $results['ok'];
$nbko = $results['ko'];
$nbnoright = $results['noright'];
if ($nbok == 0) {
    $message = __('Failed operation');
} else {
    if ($nbnoright || $nbko) {
        $message = __('Operation performed partially successful');
    } else {
        $message = __('Operation successful');
    }
}
if ($nbnoright || $nbko) {
    //TRANS: %$1d and %$2d are numbers
    $message .= "<br>" . sprintf(__('(%1$d authorizations problems, %2$d failures)'), $nbnoright, $nbko);
}
Session::addMessageAfterRedirect($message);
if (isset($results['messages']) && is_array($results['messages']) && count($results['messages'])) {
    foreach ($results['messages'] as $message) {
        Session::addMessageAfterRedirect($message, false, ERROR);
    }
}
Html::redirect($results['redirect']);
Html::popFooter();
}
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$addressing = new PluginAddressingAddressing();
if (isset($_POST["add"])) {
    $addressing->check(-1, CREATE, $_POST);
    if (!empty($_POST["name"]) && !empty($_POST["begin_ip"]) && !empty($_POST["end_ip"])) {
        $newID = $addressing->add($_POST);
    } else {
        Session::addMessageAfterRedirect(__('Problem when adding, required fields are not here', 'addressing'), false, ERROR);
    }
    if ($_SESSION['glpibackcreated']) {
        Html::redirect($addressing->getFormURL() . "?id=" . $newID);
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $addressing->check($_POST['id'], DELETE);
        $addressing->delete($_POST);
        $addressing->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $addressing->check($_POST['id'], PURGE);
            $addressing->restore($_POST);
            $addressing->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $addressing->check($_POST['id'], PURGE);
Exemple #18
0
*/
include '../inc/includes.php';
Session::checkRight("budget", READ);
if (empty($_GET["id"])) {
    $_GET["id"] = '';
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = '';
}
$budget = new Budget();
if (isset($_POST["add"])) {
    $budget->check(-1, CREATE, $_POST);
    if ($newID = $budget->add($_POST)) {
        Event::log($newID, "budget", 4, "financial", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($budget->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $budget->check($_POST["id"], DELETE);
        if ($budget->delete($_POST)) {
            Event::log($_POST["id"], "budget", 4, "financial", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        }
        $budget->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $budget->check($_POST["id"], DELETE);
            if ($budget->restore($_POST)) {
                Event::log($_POST["id"], "budget", 4, "financial", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
$fup = new TicketFollowup();
if (isset($_POST["add"])) {
    $fup->check(-1, CREATE, $_POST);
    $fup->add($_POST);
    Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s adds a followup'), $_SESSION["glpiname"]));
    Html::back();
} else {
    if (isset($_POST['add_close']) || isset($_POST['add_reopen'])) {
        $ticket = new Ticket();
        if ($ticket->getFromDB($_POST["tickets_id"]) && $ticket->canApprove()) {
            $fup->add($_POST);
            Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s approves or refuses a solution'), $_SESSION["glpiname"]));
            Html::back();
        }
    } else {
        if (isset($_POST["update"])) {
            $fup->check($_POST['id'], UPDATE);
            $fup->update($_POST);
            Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s updates a followup'), $_SESSION["glpiname"]));
            Html::redirect(Toolbox::getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
        } else {
            if (isset($_POST["purge"])) {
                $fup->check($_POST['id'], PURGE);
                $fup->delete($_POST, 1);
                Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s purges a followup'), $_SESSION["glpiname"]));
                Html::redirect(Toolbox::getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
            }
        }
    }
}
Html::displayErrorAndDie('Lost');
Exemple #20
0
Inventaire
This file is part of GLPI.

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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
// Entry menu case
define('GLPI_ROOT', '../../..');
define("MOBILE_EXTRANET_ROOT", GLPI_ROOT . "/plugins/mobile");
include GLPI_ROOT . "/inc/includes.php";
$option = new PluginMobileOption();
$option->save($_REQUEST);
//Html::redirect(MOBILE_EXTRANET_ROOT . "/front/central.php?message=".urlencode($LANG['plugin_mobile']['common'][3]));
Html::redirect($CFG_GLPI['root_doc'] . "/plugins/mobile/front/central.php?message=" . urlencode($LANG['plugin_mobile']['common'][3]));
Exemple #21
0
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$cost = new TicketCost();
if (isset($_POST["add"])) {
    $cost->check(-1, CREATE, $_POST);
    if ($newID = $cost->add($_POST)) {
        Event::log($_POST['tickets_id'], "tickets", 4, "tracking", sprintf(__('%s adds a cost'), $_SESSION["glpiname"]));
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $cost->check($_POST["id"], PURGE);
        if ($cost->delete($_POST, 1)) {
            Event::log($cost->fields['tickets_id'], "tickets", 4, "tracking", sprintf(__('%s purges a cost'), $_SESSION["glpiname"]));
        }
        Html::redirect(Toolbox::getItemTypeFormURL('Ticket') . '?id=' . $cost->fields['tickets_id']);
    } else {
        if (isset($_POST["update"])) {
            $cost->check($_POST["id"], UPDATE);
            if ($cost->update($_POST)) {
                Event::log($cost->fields['tickets_id'], "tickets", 4, "tracking", sprintf(__('%s updates a cost'), $_SESSION["glpiname"]));
            }
            Html::back();
        }
    }
}
Html::displayErrorAndDie('Lost');
Exemple #22
0
<?php

include "../../../inc/includes.php";
Session::checkRight("entity", UPDATE);
// Check if plugin is activated...
$plugin = new Plugin();
if ($plugin->isActivated("formcreator")) {
    $target = new PluginFormcreatorTarget();
    // Add a new target
    if (isset($_POST["add"]) && !empty($_POST['plugin_formcreator_forms_id'])) {
        Session::checkRight("entity", UPDATE);
        $target->add($_POST);
        Html::back();
        // Delete a target
    } elseif (isset($_POST["delete_target"])) {
        Session::checkRight("entity", UPDATE);
        $target->delete($_POST);
        Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/form.form.php?id=' . $_POST['plugin_formcreator_forms_id']);
    } else {
        Html::back();
    }
    // Or display a "Not found" error
} else {
    Html::displayNotFoundError();
}
        }
        unset($_SESSION["ocs_update"]);
        $display_list = false;
        echo "<div class='center b'><br>";
        echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . __('Back') . "</a></div>";
    }
}
if (!isset($_POST["update_ok"])) {
    if (!isset($_GET['check'])) {
        $_GET['check'] = 'all';
    }
    if (!isset($_GET['start'])) {
        $_GET['start'] = 0;
    }
    PluginOcsinventoryngOcsServer::manageDeleted($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
    if ($display_list) {
        PluginOcsinventoryngOcsServer::showComputersToUpdate($_SESSION["plugin_ocsinventoryng_ocsservers_id"], $_GET['check'], $_GET['start']);
    }
} else {
    if (count($_POST['toupdate']) > 0) {
        $_SESSION["ocs_update_count"] = 0;
        foreach ($_POST['toupdate'] as $key => $val) {
            if ($val == "on") {
                $_SESSION["ocs_update"]['computers'][] = $key;
                $_SESSION["ocs_update_count"]++;
            }
        }
    }
    Html::redirect($_SERVER['PHP_SELF']);
}
Html::footer();
Exemple #24
0
*/
include '../inc/includes.php';
Session::checkRight("networking", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$netdevice = new NetworkEquipment();
if (isset($_POST["add"])) {
    $netdevice->check(-1, CREATE, $_POST);
    if ($newID = $netdevice->add($_POST)) {
        Event::log($newID, "networkequipment", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($netdevice->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $netdevice->check($_POST["id"], DELETE);
        $netdevice->delete($_POST);
        Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $netdevice->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $netdevice->check($_POST["id"], DELETE);
            $netdevice->restore($_POST);
            Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $netdevice->redirectToList();
Exemple #25
0
                        $problem_user = new Problem_User();
                        $problem_user->check($_POST['id'], 'd');
                        $problem_user->delete($_POST);
                        Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
                        Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
                    } else {
                        if (isset($_POST['delete_group'])) {
                            $group_problem = new Group_Problem();
                            $group_problem->check($_POST['id'], 'd');
                            $group_problem->delete($_POST);
                            Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
                            Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
                        } else {
                            if (isset($_POST['delete_supplier'])) {
                                $problem_supplier = new Problem_Supplier();
                                $problem_supplier->check($_POST['id'], 'd');
                                $problem_supplier->delete($_POST);
                                Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
                                Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
                            } else {
                                Html::header(Problem::getTypeName(2), $_SERVER['PHP_SELF'], "maintain", "problem");
                                $problem->showForm($_GET["id"], $_GET);
                                Html::footer();
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemple #26
0
echo "<td class='right' colspan='2'><textarea name='content' cols='78' rows='14' >{$content}</textarea>";
echo "</td></tr>";
echo "<input type='hidden' name='_from_followup' value='{$from_followup}'>";
echo "<input type='hidden' name='requesttypes_id' value='1'";
echo "<input type='hidden' name='is_private' value='0'";
echo "<input type='hidden' name='new' value='1'";
echo "<tr class='tab_bg_2'>";
echo "<td colspan='1' class='center'>";
echo "<input type='submit' value=\"" . __("Save") . "\" class='submit' onClick1=\"'history.go(-1)'\">";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
if (isset($_REQUEST['new'])) {
    //echo "<div style='text-align:center; margin-top:20px;'> <b> ".$LANG['plugin_mobile']['common'][13]." </b></div>";
}
if (Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
    global $key, $new;
    //$new = $_REQUEST['new'];
    if (isset($_REQUEST['new']) && $_POST['content'] != "") {
        $id = $_REQUEST['id'];
        $content = $_POST['content'];
        $query = "UPDATE glpi_tickets\n\t\t\tSET solvedate = NOW(), date_mod = NOW(), solution = '" . $content . "', status = 5, users_id_lastupdater = '" . $_SESSION['glpiID'] . "'\n\t\t\tWHERE id = " . $id . " \n\t\t\t";
        $result = $DB->query($query);
        Html::redirect($CFG_GLPI["root_doc"] . '/plugins/mobile/front/tab.php?glpi_tab=Ticket$2&id=' . $id . '&itemtype=Ticket&menu=maintain&ssmenu=ticketcomputer');
    }
    if (isset($new) && $_POST['content'] == "") {
        echo "<script>alert('Error');</script>";
    }
}
//PluginMobileFollowup::show(Session::getLoginUserID(),1);
$common->displayFooter();
/** @file
* @brief
*/
// Modified by Stevenes Donato
// stevenesdonato@gmail.com
// Check PHP version not to have trouble
if (version_compare(PHP_VERSION, "5.3.0") < 0) {
    die("PHP >= 5.3.0 required");
}
define('DO_NOT_CHECK_HTTP_REFERER', 1);
// If config_db doesn't exist -> start installation
define('GLPI_ROOT', dirname(__FILE__));
include GLPI_ROOT . "/config/based_config.php";
if (!file_exists(GLPI_CONFIG_DIR . "/config_db.php")) {
    include_once GLPI_ROOT . "/inc/autoload.function.php";
    Html::redirect("install/install.php");
    die;
} else {
    $TRY_OLD_CONFIG_FIRST = true;
    include GLPI_ROOT . "/inc/includes.php";
    $_SESSION["glpicookietest"] = 'testcookie';
    // For compatibility reason
    if (isset($_GET["noCAS"])) {
        $_GET["noAUTO"] = $_GET["noCAS"];
    }
    Auth::checkAlternateAuthSystems(true, isset($_GET["redirect"]) ? $_GET["redirect"] : "");
}
?>
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    $_GET["name"] = "";
}
if (isset($_GET['getvcard'])) {
    if (empty($_GET["id"])) {
        Html::redirect($CFG_GLPI["root_doc"] . "/front/user.php");
    }
    $user->check($_GET['id'], READ);
    $user->generateVcard();
} else {
    if (isset($_POST["add"])) {
        $user->check(-1, CREATE, $_POST);
        // Pas de nom pas d'ajout
        if (!empty($_POST["name"]) && ($newID = $user->add($_POST))) {
            Event::log($newID, "users", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
            if ($_SESSION['glpibackcreated']) {
                Html::redirect($user->getFormURL() . "?id=" . $newID);
            }
        }
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $user->check($_POST['id'], DELETE);
            $user->delete($_POST);
            Event::log($_POST["id"], "users", 4, "setup", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
            $user->redirectToList();
        } else {
            if (isset($_POST["restore"])) {
                $user->check($_POST['id'], PURGE);
                $user->restore($_POST);
                Event::log($_POST["id"], "users", 4, "setup", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
                $user->redirectToList();
Exemple #29
0
}
//LDAP Server add/update/delete
if (isset($_POST["update"])) {
    $config_ldap->update($_POST);
    Html::back();
} else {
    if (isset($_POST["add"])) {
        //If no name has been given to this configuration, then go back to the page without adding
        if ($_POST["name"] != "") {
            if ($newID = $config_ldap->add($_POST)) {
                if (AuthLdap::testLDAPConnection($newID)) {
                    Session::addMessageAfterRedirect(__('Test successful'));
                } else {
                    Session::addMessageAfterRedirect(__('Test failed'), false, ERROR);
                }
                Html::redirect($CFG_GLPI["root_doc"] . "/front/authldap.php?next=extauth_ldap&id=" . $newID);
            }
        }
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $config_ldap->delete($_POST);
            $_SESSION['glpi_authconfig'] = 1;
            $config_ldap->redirectToList();
        } else {
            if (isset($_POST["test_ldap"])) {
                $config_ldap->getFromDB($_POST["id"]);
                if (AuthLdap::testLDAPConnection($_POST["id"])) {
                    //TRANS: %s is the description of the test
                    $_SESSION["LDAP_TEST_MESSAGE"] = sprintf(__('Test successful: %s'), sprintf(__('Main server %s'), $config_ldap->fields["name"]));
                } else {
  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author
  @comment
  @copyright Copyright (c) 2011-2014 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2013

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight("plugin_monitoring_unavailability", READ);
Html::header(__('Monitoring - unavailabilities', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "unavailability");
if (isset($_GET['id'])) {
    $pmUnavailability = new PluginMonitoringUnavailability();
    $pmUnavailability->getFromDB($_GET['id']);
    $input = array();
    $input['id'] = $_GET['id'];
    $input['scheduled'] = $_GET['scheduled'];
    $pmUnavailability->update($input);
}
Html::redirect($_SERVER['HTTP_REFERER']);