예제 #1
0
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('projects');
require $GO_LANGUAGE->get_language_file('projects');
require $GO_MODULES->class_path . "projects.class.inc";
$projects = new projects();
$fee_id = isset($_REQUEST['fee_id']) ? $_REQUEST['fee_id'] : 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($GO_MODULES->write_permissions) {
        $name = smart_addslashes(trim($_POST['name']));
        $value = trim(str_replace(',', '.', smart_addslashes($_POST['value'])));
        if ($name == '' || $value == '') {
            $feedback = '<p class="Error">' . $error_missing_field . '</p>';
        } else {
            if (isset($_POST['fee_id'])) {
                if ($projects->update_fee($_POST['fee_id'], $name, $value, smart_addslashes($_POST['time']))) {
                    header('Location: ' . $GO_MODULES->url . 'index.php?post_action=fees');
                    exit;
                } else {
                    $feedback = '<p class="Error">' . $strSaveError . '</p>';
                }
            } else {
                if ($projects->add_fee($name, $value, $_POST['time'])) {
                    header('Location: ' . $GO_MODULES->url . 'index.php?post_action=fees');
                    exit;
                } else {
                    $feedback = '<p class="Error">' . $strSaveError . '</p>';
                }
            }
        }
    } else {