本文整理汇总了PHP中Html::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::redirect方法的具体用法?PHP Html::redirect怎么用?PHP Html::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkRight
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();
}
}
示例2: checkRight
/**
* 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();
}
}
示例3: checkMobileLogin
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;
}
}
}
}
示例4: processMassiveActionsForOneItemtype
/**
* @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;
}
示例5: plugin_init_treeview
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';
}
}
}
示例6: unset
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"];
示例7: PluginWebservicesClient
@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();
}
}
}
示例8: intval
* * @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);
示例9: Supplier_Ticket
/** @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();
示例10: RuleAction
$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();
示例11: sprintf
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");
}
示例12: checkConfigFile
/**
* @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;
}
}
示例13: Copyright
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();
}
示例14: Config
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>";
}
}
示例15: get_class
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();
}