コード例 #1
0
(at your option) any later version.

ocsinventoryng 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 ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("computer", READ);
if (isset($_POST["force_ocs_resynch"])) {
    $computer = new Computer();
    $computer->check($_POST['id'], UPDATE);
    //Get the ocs server id associated with the machine
    $ocsservers_id = PluginOcsinventoryngOcsServer::getByMachineID($_POST["id"]);
    //Update the computer
    $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocsservers_id);
    $dohistory = isset($cfg_ocs['dohistory']) ? $cfg_ocs['dohistory'] : false;
    PluginOcsinventoryngOcsServer::updateComputer($_POST["resynch_id"], $ocsservers_id, $dohistory, 1);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $link = new PluginOcsinventoryngOcslink();
        $values["id"] = $_POST["link_id"];
        $values["use_auto_update"] = $_POST["use_auto_update"];
        $link->update($values);
        Html::back();
    } else {
コード例 #2
0
ファイル: ocslink.form.php プロジェクト: geldarr/hack-space
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Ocsinventoryng 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 ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------------------------------------------------------- */
include '../../../inc/includes.php';
Session::checkRight("computer", "r");
if (isset($_POST["force_ocs_resynch"])) {
    $computer = new Computer();
    $computer->check($_POST['id'], 'w');
    //Get the ocs server id associated with the machine
    $ocsservers_id = PluginOcsinventoryngOcsServer::getByMachineID($_POST["id"]);
    //Update the computer
    PluginOcsinventoryngOcsServer::updateComputer($_POST["resynch_id"], $ocsservers_id, 1, 1);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $link = new PluginOcsinventoryngOcslink();
        $values["id"] = $_POST["link_id"];
        $values["use_auto_update"] = $_POST["use_auto_update"];
        $link->update($values);
        Html::back();
    } else {
        Html::displayErrorAndDie("lost");
    }
コード例 #3
0
ファイル: computer.form.php プロジェクト: glpi-project/glpi
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("computer", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$computer = new Computer();
//Add a new computer
if (isset($_POST["add"])) {
    $computer->check(-1, CREATE, $_POST);
    if ($newID = $computer->add($_POST)) {
        Event::log($newID, "computers", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($computer->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
    // delete a computer
} else {
    if (isset($_POST["delete"])) {
        $computer->check($_POST['id'], DELETE);
        $ok = $computer->delete($_POST);
        if ($ok) {
            Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        }
コード例 #4
0
ファイル: hook.php プロジェクト: geldarr/hack-space
/**
 *
 * Unlock fields managed by the plugin
 * @since 1.0
 * @param $_POST array
 */
function plugin_ocsinventoryng_unlockFields($params = array())
{
    $computer = new Computer();
    $computer->check($_POST['id'], 'w');
    if (isset($_POST["lockfield"]) && count($_POST["lockfield"])) {
        foreach ($_POST["lockfield"] as $key => $val) {
            PluginOcsinventoryngOcsServer::deleteInOcsArray($_POST["id"], $key, "computer_update");
        }
    }
}
コード例 #5
0
ファイル: computer.form.php プロジェクト: geldarr/hack-space
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("computer", "r");
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$computer = new Computer();
//Add a new computer
if (isset($_POST["add"])) {
    $computer->check(-1, 'w', $_POST);
    if ($newID = $computer->add($_POST)) {
        Event::log($newID, "computers", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    }
    Html::back();
    // delete a computer
} else {
    if (isset($_POST["delete"])) {
        $computer->check($_POST['id'], 'd');
        $ok = $computer->delete($_POST);
        if ($ok) {
            Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        }
        $computer->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
コード例 #6
0
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["sort"])) {
    $_GET["sort"] = "";
}
if (!isset($_GET["order"])) {
    $_GET["order"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$computer = new Computer();
//Add a new computer
if (isset($_POST["add"])) {
    $computer->check(-1, 'w', $_POST);
    if ($newID = $computer->add($_POST)) {
        Event::log($newID, "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    }
    glpi_header($_SERVER['HTTP_REFERER']);
    // delete a computer
} else {
    if (isset($_POST["delete"])) {
        $computer->check($_POST['id'], 'd');
        $ok = $computer->delete($_POST);
        if ($ok) {
            Event::log($_POST["id"], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][22] . " " . $computer->getField('name'));
        }
        $computer->redirectToList();
    } else {
        if (isset($_POST["restore"])) {