static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!PluginFusioninventory::haveRight($module, $right)) {
         // Gestion timeout session
         if (!isset($_SESSION["glpiID"])) {
             glpi_header($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         displayRightError();
     }
 }
/**
 * Manage login redirection
 *
 * @param $where string: where to redirect ?
**/
function manageRedirect($where)
{
    global $CFG_GLPI, $PLUGIN_HOOKS;
    if (!empty($where)) {
        $data = explode("_", $where);
        if (count($data) >= 2 && isset($_SESSION["glpiactiveprofile"]["interface"]) && !empty($_SESSION["glpiactiveprofile"]["interface"])) {
            $forcetab = '';
            if (isset($data[2])) {
                $forcetab = 'forcetab=' . $data[2];
            }
            // Plugin tab
            if (isset($data[3])) {
                $forcetab .= '_' . $data[3];
            }
            switch ($_SESSION["glpiactiveprofile"]["interface"]) {
                case "helpdesk":
                    switch ($data[0]) {
                        case "plugin":
                            $plugin = $data[1];
                            $valid = false;
                            if (isset($PLUGIN_HOOKS['redirect_page'][$plugin]) && !empty($PLUGIN_HOOKS['redirect_page'][$plugin])) {
                                // Simple redirect
                                if (!is_array($PLUGIN_HOOKS['redirect_page'][$plugin])) {
                                    if (isset($data[2]) && $data[2] > 0) {
                                        $valid = true;
                                        $id = $data[2];
                                        $page = $PLUGIN_HOOKS['redirect_page'][$plugin];
                                    }
                                    $forcetabnum = 3;
                                } else {
                                    // Complex redirect
                                    if (isset($data[2]) && !empty($data[2]) && isset($data[3]) && $data[3] > 0 && isset($PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]]) && !empty($PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]])) {
                                        $valid = true;
                                        $id = $data[3];
                                        $page = $PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]];
                                    }
                                    $forcetabnum = 4;
                                }
                            }
                            if (isset($data[$forcetabnum])) {
                                $forcetab = 'forcetab=' . $data[$forcetabnum];
                            }
                            if ($valid) {
                                glpi_header($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$page}?id={$id}&{$forcetab}");
                            } else {
                                glpi_header($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?{$forcetab}");
                            }
                            break;
                            // Use for compatibility with old name
                        // Use for compatibility with old name
                        case "tracking":
                        case "ticket":
                            glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $data[1] . "&{$forcetab}");
                            break;
                        case "preference":
                            glpi_header($CFG_GLPI["root_doc"] . "/front/preference.php?{$forcetab}");
                            break;
                        default:
                            glpi_header($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?{$forcetab}");
                            break;
                    }
                    break;
                case "central":
                    switch ($data[0]) {
                        case "plugin":
                            $plugin = $data[1];
                            $valid = false;
                            if (isset($PLUGIN_HOOKS['redirect_page'][$plugin]) && !empty($PLUGIN_HOOKS['redirect_page'][$plugin])) {
                                // Simple redirect
                                if (!is_array($PLUGIN_HOOKS['redirect_page'][$plugin])) {
                                    if (isset($data[2]) && $data[2] > 0) {
                                        $valid = true;
                                        $id = $data[2];
                                        $page = $PLUGIN_HOOKS['redirect_page'][$plugin];
                                    }
                                    $forcetabnum = 3;
                                } else {
                                    // Complex redirect
                                    if (isset($data[2]) && !empty($data[2]) && isset($data[3]) && $data[3] > 0 && isset($PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]]) && !empty($PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]])) {
                                        $valid = true;
                                        $id = $data[3];
                                        $page = $PLUGIN_HOOKS['redirect_page'][$plugin][$data[2]];
                                    }
                                    $forcetabnum = 4;
                                }
                            }
                            if (isset($data[$forcetabnum])) {
                                $forcetab = 'forcetab=' . $data[$forcetabnum];
                            }
                            if ($valid) {
                                glpi_header($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$page}?id={$id}&{$forcetab}");
                            } else {
                                glpi_header($CFG_GLPI["root_doc"] . "/front/central.php?{$forcetab}");
                            }
                            break;
                        case "preference":
                            glpi_header($CFG_GLPI["root_doc"] . "/front/preference.php?{$forcetab}");
                            break;
                            // Use for compatibility with old name
                        // Use for compatibility with old name
                        case "tracking":
                            $data[0] = "ticket";
                        default:
                            if (!empty($data[0]) && $data[1] > 0) {
                                glpi_header($CFG_GLPI["root_doc"] . "/front/" . $data[0] . ".form.php?id=" . $data[1] . "&{$forcetab}");
                            } else {
                                glpi_header($CFG_GLPI["root_doc"] . "/front/central.php?{$forcetab}");
                            }
                            break;
                    }
                    break;
            }
        }
    }
}
Esempio n. 3
0
  (at your option) any later version.

  Plugin Monitoring for 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 Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Behaviors. If not, see <http://www.gnu.org/licenses/>.

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

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2012 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     2011

  ------------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
    define('GLPI_ROOT', '../..');
}
include GLPI_ROOT . "/inc/includes.php";
commonHeader($LANG['plugin_monitoring']['title'][0], $_SERVER["PHP_SELF"], "plugins", "monitoring");
glpi_header(GLPI_ROOT . "/plugins/monitoring/front/menu.php");
commonFooter();
Esempio n. 4
0
(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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkRight("config", "w");
$config = new Config();
//Update CAS configuration
if (isset($_POST["update"])) {
    $config->update($_POST);
    glpi_header($CFG_GLPI["root_doc"] . "/front/auth.others.php");
}
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
commonHeader($LANG['title'][14], $_SERVER['PHP_SELF'], "config", "extauth", "others");
showOtherAuthList($_SERVER['PHP_SELF']);
commonFooter();
Esempio n. 5
0
 /** Form to choose a ldap server
  *
  * @param   $target target page for the form
  *
  * @return  nothing
  **/
 static function ldapChooseDirectory($target)
 {
     global $DB, $LANG;
     $query = "SELECT *\n                FROM `glpi_authldaps`\n                ORDER BY `name` ASC";
     $result = $DB->query($query);
     if ($DB->numrows($result) == 1) {
         //If only one server, do not show the choose ldap server window
         $ldap = $DB->fetch_array($result);
         $_SESSION["ldap_server"] = $ldap["id"];
         glpi_header($_SERVER['PHP_SELF']);
     }
     echo "<form action='{$target}' method=\"post\">";
     echo "<div class='center'>";
     echo "<p >" . $LANG['ldap'][5] . "</p>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_2'><th colspan='2'>" . $LANG['ldap'][4] . "</th></tr>";
     //If more than one ldap server
     if ($DB->numrows($result) > 1) {
         echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['common'][16] . "</td>";
         echo "<td class='center'>";
         Dropdown::show('AuthLDAP', array('name' => 'ldap_server', 'display_emptychoice' => false, 'comment' => true));
         echo "</td></tr>";
         echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
         echo "<input class='submit' type='submit' name='ldap_showusers' value=\"" . $LANG['buttons'][2] . "\"></td></tr>";
     } else {
         //No ldap server
         echo "<tr class='tab_bg_2'><td class='center' colspan='2'>" . $LANG['ldap'][7] . "</td></tr>";
     }
     echo "</table></div></form>";
 }
Esempio n. 6
0
    $_POST['login_password'] = unclean_cross_side_scripting_deep($_POST['login_password']);
} else {
    $_POST['login_password'] = '';
}
// Redirect management
$REDIRECT = "";
if (isset($_POST['redirect']) && strlen($_POST['redirect']) > 0) {
    $REDIRECT = "?redirect=" . $_POST['redirect'];
} else {
    if (isset($_GET['redirect']) && strlen($_GET['redirect']) > 0) {
        $REDIRECT = "?redirect=" . $_GET['redirect'];
    }
}
$auth = new Auth();
// now we can continue with the process...
if ($auth->Login($_POST['login_name'], $_POST['login_password'], isset($_REQUEST["noAUTO"]) ? $_REQUEST["noAUTO"] : false)) {
    // Redirect to Command Central if not post-only
    if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
        glpi_header($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php{$REDIRECT}");
    } else {
        glpi_header($CFG_GLPI['root_doc'] . "/front/central.php{$REDIRECT}");
    }
} else {
    // we have done at least a good login? No, we exit.
    nullHeader("Login", $CFG_GLPI["root_doc"] . '/index.php');
    echo '<div class="center b">' . $auth->getErr() . '<br><br>';
    // Logout whit noAUto to manage auto_login with errors
    echo '<a href="' . $CFG_GLPI["root_doc"] . '/logout.php?noAUTO=1' . str_replace("?", "&", $REDIRECT) . '">' . $LANG['login'][1] . '</a></div>';
    nullFooter();
    exit;
}
Esempio n. 7
0
 }
 // If debug mode activated : display some informations
 if ($_SESSION['glpi_use_mode'] == DEBUG_MODE) {
     // display_errors only need for for E_ERROR, E_PARSE, ... which cannot be catched
     ini_set('display_errors', 'On');
     // Recommended development settings
     error_reporting(E_ALL | E_STRICT);
     set_error_handler('userErrorHandlerDebug');
 } else {
     // Recommended production settings
     ini_set('display_errors', 'Off');
     error_reporting(E_ALL);
     set_error_handler('userErrorHandlerNormal');
 }
 if (isset($_SESSION["glpiroot"]) && $CFG_GLPI["root_doc"] != $_SESSION["glpiroot"]) {
     glpi_header($_SESSION["glpiroot"]);
 }
 // Override cfg_features by session value
 foreach ($CFG_GLPI['user_pref_field'] as $field) {
     if (!isset($_SESSION["glpi{$field}"]) && isset($CFG_GLPI[$field])) {
         $_SESSION["glpi{$field}"] = $CFG_GLPI[$field];
     }
 }
 if ((!isset($CFG_GLPI["version"]) || trim($CFG_GLPI["version"]) != GLPI_VERSION) && !isset($_GET["donotcheckversion"])) {
     loadLanguage();
     if (isCommandLine()) {
         echo $LANG['update'][88] . "\n";
     } else {
         nullHeader("UPDATE NEEDED", $CFG_GLPI["root_doc"]);
         echo "<div class='center'>";
         echo "<table class='tab_check'>";
commonHeader($LANG['setup'][704], $_SERVER['PHP_SELF'], "config", "mailing", -1);
if (isset($_GET['activate'])) {
    $config = new Config();
    $tmp['id'] = $CFG_GLPI['id'];
    $tmp['use_mailing'] = 1;
    $config->update($tmp);
    glpi_header($_SERVER['HTTP_REFERER']);
}
if (!$CFG_GLPI['use_mailing']) {
    echo "<div align='center'<p>";
    if (haveRight("config", "w")) {
        echo "<a href='setup.notification.php?activate=1' class='icon_consol b'>" . $LANG['setup'][202] . "</a></p></div>";
    }
} else {
    if (!haveRight("config", "r") && haveRight("notification", "r") && $CFG_GLPI['use_mailing']) {
        glpi_header($CFG_GLPI["root_doc"] . '/front/notification.php');
    } else {
        echo "<table class='tab_cadre'>";
        echo "<tr><th>&nbsp;" . $LANG['setup'][704] . "&nbsp;</th></tr>";
        if (haveRight("config", "r")) {
            echo "<tr class='tab_bg_1'><td class='center'><a href='notificationmailsetting.form.php'>" . $LANG['setup'][201] . "</a></td></tr>";
            echo "<tr class='tab_bg_1'><td class='center'><a href='notificationtemplate.php'>" . $LANG['mailing'][113] . "</a></td> </tr>";
        }
        if (haveRight("notification", "r") && $CFG_GLPI['use_mailing']) {
            echo "<tr class='tab_bg_1'><td class='center'><a href='notification.php'>" . $LANG['setup'][704] . "</a></td></tr>";
        } else {
            echo "<tr class='tab_bg_1'><td class='center'>" . $LANG['setup'][661] . "</td></tr>";
        }
        echo "</table>";
    }
}
Esempio n. 9
0
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkRight("config", "w");
$config = new Config();
if (!empty($_POST["update_auth"])) {
    $config->update($_POST);
    glpi_header($_SERVER['HTTP_REFERER']);
}
if (!empty($_POST["update"])) {
    $config->update($_POST);
    if (isset($_POST["use_ocs_mode"]) && $_POST["use_ocs_mode"] && !$CFG_GLPI["use_ocs_mode"]) {
        glpi_header(getItemTypeSearchURL('OcsServer'));
    } else {
        glpi_header(getItemTypeFormURL('Config'));
    }
}
commonHeader($LANG['common'][12], $_SERVER['PHP_SELF'], "config", "config");
$config->showForm(1);
commonFooter();
Esempio n. 10
0
LICENSE

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: David DURIEUX
// Purpose of file:
// ----------------------------------------------------------------------
if (!defined('GLPI_ROOT')) {
    define('GLPI_ROOT', '../..');
}
include GLPI_ROOT . "/inc/includes.php";
commonHeader($LANG['plugin_fusioninventory']["title"][0], $_SERVER["PHP_SELF"], "plugins", "fusioninventory");
glpi_header(GLPI_ROOT . "/plugins/fusioninventory/front/menu.php");
commonFooter();
Esempio n. 11
0
    exit;
}
checkRight("user", "r");
$user = new User();
if (!isset($_POST["start"])) {
    $_POST["start"] = 0;
}
if (!isset($_POST["sort"])) {
    $_POST["sort"] = "";
}
if (!isset($_POST["order"])) {
    $_POST["order"] = "";
}
if (empty($_POST["id"]) && isset($_POST["name"])) {
    $user->getFromDBbyName($_POST["name"]);
    glpi_header($CFG_GLPI["root_doc"] . "/front/user.form.php?id=" . $user->fields['id']);
}
if (empty($_POST["name"])) {
    $_POST["name"] = "";
}
if ($_POST["id"] > 0 && $user->can($_POST["id"], 'r')) {
    switch ($_REQUEST['glpi_tab']) {
        case -1:
            Profile_User::showForUser($user);
            Group_User::showForUser($user);
            $config = new Config();
            $user->computePreferences();
            $config->showFormUserPrefs($user->fields);
            $user->showItems();
            Reservation::showForUser($_POST["id"]);
            Ticket::showListForUser($_POST["id"]);
                    $kb->redirectToList();
                } else {
                    if (isset($_GET["id"]) && strcmp($_GET["addtofaq"], "yes") == 0) {
                        // ajouter  un item dans la faq
                        $kb->check($_GET["id"], 'w');
                        $kb->addToFaq();
                        glpi_header($_SERVER['HTTP_REFERER']);
                    } else {
                        if (isset($_GET["id"]) && strcmp($_GET["removefromfaq"], "yes") == 0) {
                            // retirer  un item de la faq
                            $kb->check($_GET["id"], 'w');
                            $kb->removeFromFaq($_GET["id"]);
                            glpi_header($_SERVER['HTTP_REFERER']);
                        } else {
                            if (empty($_GET["id"])) {
                                // No id or no tickets id to create from solution
                                glpi_header($CFG_GLPI["root_doc"] . "/front/knowbaseitem.php");
                            } else {
                                // Affiche un item de la base de connaissances
                                $kb->check($_GET["id"], 'r');
                                commonHeader($LANG['title'][5], $_SERVER['PHP_SELF'], "utils", "knowbase");
                                $kb->showFull(true);
                                commonFooter();
                            }
                        }
                    }
                }
            }
        }
    }
}
Esempio n. 13
0
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkSeveralRightsOr(array('knowbase' => 'r', 'faq' => 'r'));
if (isset($_GET["id"])) {
    glpi_header($CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $_GET["id"]);
}
commonHeader($LANG['title'][5], $_SERVER['PHP_SELF'], "utils", "knowbase");
// Search a solution
if (!isset($_GET["contains"]) && isset($_GET["tickets_id"])) {
    $ticket = new Ticket();
    if ($ticket->getFromDB($_GET["tickets_id"])) {
        $_GET["contains"] = $ticket->getField('name');
    }
}
if (!isset($_GET["contains"])) {
    $_GET["contains"] = "";
}
if (!isset($_GET["knowbaseitemcategories_id"])) {
    $_GET["knowbaseitemcategories_id"] = "0";
}
Esempio n. 14
0
                $ruleaction->add($_POST);
                // Can't do this in RuleCriteria, so do it here
                $rule->update(array('id' => $_POST['rules_id'], 'date_mod' => $_SESSION['glpi_currenttime']));
                glpi_header($_SERVER['HTTP_REFERER']);
            } else {
                if (isset($_POST["update"])) {
                    $rulecollection->checkGlobal('w');
                    $rule->update($_POST);
                    Event::log($_POST['id'], "rules", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                    glpi_header($_SERVER['HTTP_REFERER']);
                } else {
                    if (isset($_POST["add"])) {
                        $rulecollection->checkGlobal('w');
                        $newID = $rule->add($_POST);
                        Event::log($newID, "rules", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][20]);
                        glpi_header($_SERVER['HTTP_REFERER'] . "?id={$newID}");
                    } else {
                        if (isset($_POST["delete"])) {
                            $rulecollection->checkGlobal('w');
                            $rulecollection->deleteRuleOrder($_POST["ranking"]);
                            $rule->delete($_POST);
                            Event::log($_POST["id"], "rules", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
                            $rule->redirectToList();
                        }
                    }
                }
            }
        }
    }
}
commonHeader($LANG['common'][12], $_SERVER['PHP_SELF'], "admin", $rulecollection->menu_type, $rulecollection->menu_option);
Esempio n. 15
0
checkCentralAccess();
// Change profile system
if (isset($_POST['newprofile'])) {
    if (isset($_SESSION["glpiprofiles"][$_POST['newprofile']])) {
        changeProfile($_POST['newprofile']);
        if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
            glpi_header($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php");
        }
        glpi_header($_SERVER['PHP_SELF']);
    }
    glpi_header(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
}
// Manage entity change
if (isset($_GET["active_entity"])) {
    if (!isset($_GET["is_recursive"])) {
        $_GET["is_recursive"] = 0;
    }
    if (changeActiveEntities($_GET["active_entity"], $_GET["is_recursive"])) {
        if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"] && isset($_SERVER['HTTP_REFERER'])) {
            glpi_header(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
        }
    }
}
commonHeader($LANG['common'][56], $_SERVER['PHP_SELF']);
// Redirect management
if (isset($_GET["redirect"])) {
    manageRedirect($_GET["redirect"]);
}
$central = new Central();
$central->show();
commonFooter();
Esempio n. 16
0
            } else {
                // Next run
                $offset = $rulecollection->replayRulesOnExistingDB($_GET['offset'], $max, array(), $_GET);
                $manufacturer = $_GET["manufacturer"];
                // global start for stat
                $start = $_GET["start"];
            }
            if ($offset < 0) {
                // Work ended
                $end = explode(" ", microtime());
                $duree = round($end[0] + $end[1] - $start);
                changeProgressBarMessage($LANG['rulesengine'][91] . " (" . timestampToString($duree) . ")");
                echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a>";
            } else {
                // Need more work
                glpi_header($_SERVER['PHP_SELF'] . "?start={$start}&replay_rule=1&offset={$offset}&manufacturer=" . "{$manufacturer}");
            }
            commonFooter(true);
            exit;
        }
    }
}
commonHeader($LANG['rulesengine'][17], $_SERVER['PHP_SELF'], "admin", $rulecollection->menu_type, $rulecollection->menu_option);
if ($rulecollection->showInheritedTab()) {
    $tabs[0] = array('title' => $LANG['rulesengine'][20] . ' : ' . Dropdown::getDropdownName('glpi_entities', $_SESSION['glpiactive_entity']), 'url' => $CFG_GLPI['root_doc'] . "/ajax/rules.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&glpi_tab=1&inherited=1&itemtype=" . get_class($rulecollection));
}
$title = $LANG['rulesengine'][17];
if ($rulecollection->isRuleRecursive()) {
    $title = $LANG['rulesengine'][23] . ' : ' . Dropdown::getDropdownName('glpi_entities', $_SESSION['glpiactive_entity']);
}
$tabs[1] = array('title' => $title, 'url' => $CFG_GLPI['root_doc'] . "/ajax/rules.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&glpi_tab=0&inherited=0&itemtype=" . get_class($rulecollection));
Esempio n. 17
0
    setGlpiSessionPath();
}
startGlpiSession();
error_reporting(0);
// we want to check system before affraid the user.
if (!isset($_SESSION["glpilanguage"]) || empty($_SESSION["glpilanguage"])) {
    $_SESSION["glpilanguage"] = "en_GB";
}
if (isset($_POST["language"])) {
    $_SESSION["glpilanguage"] = $_POST["language"];
}
loadLang($_SESSION["glpilanguage"]);
if (!isset($_POST["install"])) {
    $_SESSION = array();
    if (file_exists(GLPI_CONFIG_DIR . "/config_db.php")) {
        glpi_header(GLPI_ROOT . "/index.php");
        die;
    } else {
        header_html("Select your language");
        choose_language();
    }
} else {
    // DB clean
    if (isset($_POST["db_pass"])) {
        $_POST["db_pass"] = stripslashes($_POST["db_pass"]);
        $_POST["db_pass"] = rawurldecode($_POST["db_pass"]);
        $_POST["db_pass"] = stripslashes($_POST["db_pass"]);
    }
    switch ($_POST["install"]) {
        case "lang_select":
            // lang ok, go accept licence
Esempio n. 18
0
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
commonHeader($LANG['ocsng'][0], $_SERVER['PHP_SELF'], "config", "ocsng");
//Delete template or server
if (isset($_POST["delete"])) {
    $ocs->delete($_POST);
    $ocs->redirectToList();
    //Update server
} else {
    if (isset($_POST["update"])) {
        $ocs->update($_POST);
        glpi_header($_SERVER["HTTP_REFERER"]);
        //Update server
    } else {
        if (isset($_POST["update_server"])) {
            $ocs->update($_POST);
            glpi_header($_SERVER["HTTP_REFERER"]);
            //Add new server
        } else {
            if (isset($_POST["add"])) {
                $newid = $ocs->add($_POST);
                glpi_header($_SERVER["HTTP_REFERER"]);
                //Other
            } else {
                $ocs->showForm($_GET["id"]);
            }
        }
    }
}
commonFooter();
Esempio n. 19
0
                        glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
                    } else {
                        if (isset($_REQUEST['delete_group'])) {
                            $group_ticket = new Group_Ticket();
                            $group_ticket->check($_REQUEST['id'], 'w');
                            $group_ticket->delete($_REQUEST);
                            Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][122]);
                            glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
                        } else {
                            if (isset($_REQUEST['addme_observer'])) {
                                $ticket_user = new Ticket_User();
                                $track->check($_REQUEST['tickets_id'], 'r');
                                $input = array('tickets_id' => $_REQUEST['tickets_id'], 'users_id' => getLoginUserID(), 'use_notification' => 1, 'type' => Ticket::OBSERVER);
                                $ticket_user->add($input);
                                Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                                glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
                            }
                        }
                    }
                }
            }
        }
    }
}
if (isset($_GET["id"]) && $_GET["id"] > 0) {
    if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
        helpHeader($LANG['Menu'][5], '', $_SESSION["glpiname"]);
    } else {
        commonHeader($LANG['Menu'][5], '', "maintain", "ticket");
    }
    $available_options = array('load_kb_sol');
// Based on:
// IRMA, Information Resource-Management and Administration
// Christian Bauer
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (empty($_POST["type"]) || $_POST["type"] != "Helpdesk" || !$CFG_GLPI["use_anonymous_helpdesk"]) {
    checkRight("create_ticket", "1");
}
$track = new Ticket();
// Security check
if (empty($_POST) || count($_POST) == 0) {
    glpi_header($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
}
if (!empty($_POST["type"]) && $_POST["type"] == "Helpdesk") {
    nullHeader($LANG['title'][10]);
} else {
    if ($_POST["_from_helpdesk"]) {
        helpHeader($LANG['Menu'][31], '', $_SESSION["glpiname"]);
    } else {
        commonHeader($LANG['Menu'][31], '', $_SESSION["glpiname"], "maintain", "tracking");
    }
}
if (isset($_POST["_my_items"]) && !empty($_POST["_my_items"])) {
    $splitter = explode("_", $_POST["_my_items"]);
    if (count($splitter) == 2) {
        $_POST["itemtype"] = $splitter[0];
        $_POST["items_id"] = $splitter[1];
Esempio n. 21
0
 /**
  * Check global right on an object
  *
  * @param $right Right to check : c / r / w / d
  *
  * @return nothing
  **/
 function checkGlobal($right)
 {
     global $CFG_GLPI;
     if (!$this->canGlobal($right)) {
         // Gestion timeout session
         if (!getLoginUserID()) {
             glpi_header($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         displayRightError();
     }
 }
Esempio n. 22
0
define('GLPI_ROOT', '.');
include GLPI_ROOT . "/inc/includes.php";
//@session_start();
if (!isset($_SESSION["noAUTO"]) && isset($_SESSION["glpiauthtype"]) && $_SESSION["glpiauthtype"] == Auth::CAS) {
    include GLPI_ROOT . "/lib/phpcas/CAS.php";
    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";
}
$auth = new Auth();
$auth->destroySession();
// Redirect to the login-page
glpi_header($CFG_GLPI["root_doc"] . "/index.php" . $toADD);
Esempio n. 23
0
            $print->restore($_POST);
            Event::log($_POST["id"], "printers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][23]);
            $print->redirectToList();
        } else {
            if (isset($_REQUEST["purge"])) {
                $print->check($_REQUEST["id"], 'd');
                $print->delete($_REQUEST, 1);
                Event::log($_REQUEST["id"], "printers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][24]);
                $print->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $print->check($_POST["id"], 'w');
                    $print->update($_POST);
                    Event::log($_POST["id"], "printers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                    glpi_header($_SERVER['HTTP_REFERER']);
                } else {
                    if (isset($_GET["unglobalize"])) {
                        $print->check($_GET["id"], 'w');
                        Computer_Item::unglobalizeItem($print);
                        Event::log($_GET["id"], "printers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][60]);
                        glpi_header($CFG_GLPI["root_doc"] . "/front/printer.form.php?id=" . $_GET["id"]);
                    } else {
                        commonHeader($LANG['Menu'][2], $_SERVER['PHP_SELF'], "inventory", "printer");
                        $print->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"]));
                        commonFooter();
                    }
                }
            }
        }
    }
}
Esempio n. 24
0
                    } else {
                        $mailcollector->deleteOrImportSeveralEmails($emails_ids, 1, $_POST['entities_id']);
                    }
                }
                break;
            default:
                // Plugin specific actions
                $split = explode('_', $_POST["action"]);
                if ($split[0] == 'plugin' && isset($split[1])) {
                    // Normalized name plugin_name_action
                    // Allow hook from any plugin on any (core or plugin) type
                    doOneHook($split[1], 'MassiveActionsProcess', $_POST);
                } else {
                    if ($plug = isPluginItemType($_POST["itemtype"])) {
                        // non-normalized name
                        // hook from the plugin defining the type
                        doOneHook($plug['plugin'], 'MassiveActionsProcess', $_POST);
                    }
                }
        }
        addMessageAfterRedirect($LANG['common'][23]);
        glpi_header($REDIRECT);
    } else {
        //action, itemtype or item not defined
        echo "<div class='center'>" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png' alt='warning'><br><br>";
        echo "<b>" . $LANG['common'][24] . "</b></div>";
        displayBackLink();
    }
    commonFooter();
}
// itemtype defined
Esempio n. 25
0
/**
 * Check if I am logged in
 *
 * @return Nothing : display error if not permit
**/
function checkLoginUser()
{
    global $CFG_GLPI;
    if (!isset($_SESSION["glpiname"])) {
        // Gestion timeout session
        if (!getLoginUserID()) {
            glpi_header($CFG_GLPI["root_doc"] . "/index.php");
            exit;
        }
        displayRightError();
    }
}
$fup = new TicketFollowup();
if (isset($_POST["add"])) {
    $fup->check(-1, 'w', $_POST);
    $fup->add($_POST);
    Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . "  " . $LANG['log'][21]);
    glpi_header($_SERVER['HTTP_REFERER']);
} 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", $_SESSION["glpiname"] . "  " . $LANG['log'][29]);
            glpi_header($_SERVER['HTTP_REFERER']);
        }
    } else {
        if (isset($_POST["update"])) {
            $fup->check($_POST['id'], 'w');
            $fup->update($_POST);
            Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . "  " . $LANG['log'][21]);
            glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
        } else {
            if (isset($_POST["delete"])) {
                $fup->check($_POST['id'], 'w');
                $fup->delete($_POST);
                Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
            }
        }
    }
}
displayErrorAndDie('Lost');
Esempio n. 27
0
http://indepnet.net/   http://glpi-project.org
-------------------------------------------------------------------------

LICENSE

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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Remi collet
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
glpi_header(GLPI_ROOT . "/front/fieldunicity.php");
Esempio n. 28
0
 function addRule($input)
 {
     global $LANG;
     $this->check($_POST["affectentity"], 'w');
     $collection = RuleCollection::getClassByType($_POST['sub_type']);
     $rule = $collection->getRuleClass($_POST['sub_type']);
     $ruleid = $rule->add($_POST);
     if ($ruleid) {
         //Add an action associated to the rule
         $ruleAction = new RuleAction();
         //Action is : affect computer to this entity
         $ruleAction->addActionByAttributes("assign", $ruleid, "entities_id", $_POST["affectentity"]);
         switch ($_POST['sub_type']) {
             case 'RuleRight':
                 if ($_POST["profiles_id"]) {
                     $ruleAction->addActionByAttributes("assign", $ruleid, "profiles_id", $_POST["profiles_id"]);
                 }
                 $ruleAction->addActionByAttributes("assign", $ruleid, "is_recursive", $_POST["is_recursive"]);
         }
     }
     Event::log($ruleid, "rules", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
     glpi_header($_SERVER['HTTP_REFERER']);
 }
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
$link_itemtype = new Link_ItemType();
if (isset($_POST["add"])) {
    $link->check($_GET["id"], 'w');
    if ($link_itemtype->add($_POST)) {
        Event::log($_POST["links_id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][32]);
    }
    glpi_header($CFG_GLPI["root_doc"] . "/front/link.form.php?id=" . $_POST["links_id"]);
} else {
    if (isset($_GET["delete"])) {
        $link->check($_GET["links_id"], 'w');
        $link_itemtype->delete($_GET);
        Event::log($_GET["links_id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
        glpi_header($_SERVER['HTTP_REFERER']);
    }
}
Esempio n. 30
0
        OcsServer::showStatistics($_SESSION["ocs_update"]['statistics'], true);
        unset($_SESSION["ocs_update"]);
        $display_list = false;
        echo "<div class='center b'><br>";
        echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a></div>";
    }
}
if (!isset($_POST["update_ok"])) {
    if (!isset($_GET['check'])) {
        $_GET['check'] = 'all';
    }
    if (!isset($_GET['start'])) {
        $_GET['start'] = 0;
    }
    OcsServer::manageDeleted($_SESSION["ocsservers_id"]);
    if ($display_list) {
        OcsServer::showComputersToUpdate($_SESSION["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"]++;
            }
        }
    }
    glpi_header($_SERVER['PHP_SELF']);
}
commonFooter();