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.
--------------------------------------------------------------------------
*/
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
$item = new CalendarSegment();
if (isset($_POST["add"])) {
    $item->check(-1, 'w', $_POST);
    if ($item->add($_POST)) {
        Event::log($_POST["calendars_id"], "calendars", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][32]);
    }
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        if (isset($_POST["item"]) && count($_POST["item"])) {
            foreach ($_POST["item"] as $key => $val) {
                if ($val == 1) {
                    if ($item->can($key, 'w')) {
                        $item->delete(array('id' => $key));
                    }
                }
            }
            Event::log($_POST["calendars_id"], "calendars", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        }
        glpi_header($_SERVER['HTTP_REFERER']);
    }
}
displayErrorAndDie("lost");
Ejemplo n.º 2
0
/**
 * Display common message for privileges errors
 *
 * @return Nothing (die)
**/
function displayRightError()
{
    global $LANG;
    displayErrorAndDie($LANG['common'][83]);
}
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');
Ejemplo n.º 4
0
function registerPluginType($name)
{
    global $LANG;
    echo "</table>";
    displayErrorAndDie($LANG['plugins'][10] . "&nbsp;: {$name}<br><br>" . $LANG['plugins'][1]);
}
Ejemplo n.º 5
0
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:
// ----------------------------------------------------------------------
if (!$dropdown instanceof CommonDropdown) {
    displayErrorAndDie('');
}
if (!$dropdown->canView()) {
    displayRightError();
}
$dropdown->displayHeader();
$dropdown->title();
Search::show(get_class($dropdown));
commonFooter();
Ejemplo n.º 6
0
        if ($doc->canViewFile($_GET)) {
            if ($doc->fields['sha1sum'] && $doc->fields['sha1sum'] != sha1_file(GLPI_DOC_DIR . "/" . $doc->fields['filepath'])) {
                displayErrorAndDie($LANG['document'][49], true);
                // Doc alterated
            } else {
                $doc->send();
            }
        } else {
            displayErrorAndDie($LANG['document'][45], true);
            // No right
        }
    }
} else {
    if (isset($_GET["file"])) {
        // for other file
        $splitter = explode("/", $_GET["file"]);
        if (count($splitter) == 2) {
            $send = false;
            if ($splitter[0] == "_dumps" && haveRight("backup", "w")) {
                $send = true;
            }
            if ($send && file_exists(GLPI_DOC_DIR . "/" . $_GET["file"])) {
                sendFile(GLPI_DOC_DIR . "/" . $_GET["file"], $splitter[1]);
            } else {
                displayErrorAndDie($LANG['document'][45], true);
            }
        } else {
            displayErrorAndDie($LANG['document'][44], true);
        }
    }
}
     Event::log($_POST["id"], get_class($dropdown), 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
     $dropdown->redirectToList();
 } else {
     if (isset($_POST["update"])) {
         $dropdown->check($_POST["id"], 'w');
         $dropdown->update($_POST);
         $dropdown->refreshParentInfos();
         Event::log($_POST["id"], get_class($dropdown), 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
         glpi_header($_SERVER['HTTP_REFERER']);
     } else {
         if (isset($_POST["execute"])) {
             if (method_exists($dropdown, $_POST["_method"])) {
                 call_user_func(array(&$dropdown, $_POST["_method"]), $_POST);
                 glpi_header($_SERVER['HTTP_REFERER']);
             } else {
                 displayErrorAndDie($LANG['common'][24]);
             }
         } else {
             if (isset($_GET['popup'])) {
                 popHeader($dropdown->getTypeName(), $_SERVER['PHP_SELF']);
                 if (isset($_GET["rand"])) {
                     $_SESSION["glpipopup"]["rand"] = $_GET["rand"];
                 }
                 $dropdown->showForm($_GET["id"]);
                 echo "<div class='center'><br><a href='javascript:window.close()'>" . $LANG['buttons'][13] . "</a>";
                 echo "</div>";
                 popFooter();
             } else {
                 $dropdown->displayHeader();
                 if (!isset($options)) {
                     $options = array();