示例#1
0
function doit()
{
    global $HTTP_POST_VARS, $nodeinfo;
    if (!defined("RED_NOTIFICATION_INC")) {
    }
    include "messages/red_notification.inc";
    if (!defined("USER_INC")) {
    }
    include "dbapi/user.inc";
    $errstr = '<ul>';
    if ($HTTP_POST_VARS['expert_type'] == 'auto') {
        delete_expert($nodeinfo['id']);
        if ($HTTP_POST_VARS['old_expert'] != "") {
            $user = get_user_from_name($HTTP_POST_VARS['old_expert']);
            if ($user != -1) {
                if (isset($HTTP_POST_VARS['field_notify_user'])) {
                    send_red_notification(LTMSG_FETERMN, $user['User_ID'], $nodeinfo['id']);
                }
            }
        }
    } else {
        if ($HTTP_POST_VARS['field_expert'] == "") {
            $errstr .= '<li>You have to enter an expert';
        } else {
            if (!is_valid_expert($HTTP_POST_VARS['field_expert'])) {
                $errstr .= '<li>The expert you specified could not be found in the database.';
            }
        }
        if ($HTTP_POST_VARS['field_description'] == "") {
            $errstr .= '<li>Please enter a descripiton for your expert.';
        }
        if ($errstr != '<ul>') {
            $predef['Name'] = $HTTP_POST_VARS['field_expert'];
            $predef['About'] = $HTTP_POST_VARS['field_description'];
            print_error($errstr . '</ul>', $predef);
        }
        $currexp = get_def_expert($nodeinfo['id']);
        $newexp_id = get_user_from_name($HTTP_POST_VARS['field_expert']);
        $newexp_id = $newexp_id['User_ID'];
        if (is_array($currexp)) {
            edit_expert($nodeinfo['id'], $HTTP_POST_VARS['field_expert'], $HTTP_POST_VARS['field_description']);
            if ($HTTP_POST_VARS['old_expert'] != "") {
                $user = get_user_from_name($HTTP_POST_VARS['old_expert']);
                if ($user != -1) {
                    if (isset($HTTP_POST_VARS['field_notify_user'])) {
                        send_red_notification(LTMSG_FETERMN, $user['User_ID'], $nodeinfo['id']);
                    }
                }
            }
            if (isset($HTTP_POST_VARS['field_notify_user'])) {
                send_red_notification(LTMSG_FEELECT, $newexp_id, $nodeinfo['id']);
            }
        } else {
            add_expert($nodeinfo['id'], $HTTP_POST_VARS['field_expert'], $HTTP_POST_VARS['field_description']);
            if (isset($HTTP_POST_VARS['field_notify_user'])) {
                send_red_notification(LTMSG_FEELECT, $newexp_id, $nodeinfo['id']);
            }
        }
    }
    go_back();
}
示例#2
0
function edit_slot()
{
    global $nodeinfo, $HTTP_POST_VARS, $field_image_file, $field_image_file_name, $sess;
    if (!defined("RED_NOTIFICATION_INC")) {
    }
    include "messages/red_notification.inc";
    $slot = validate_and_set($HTTP_POST_VARS);
    $oldslot = get_slot_info($slot['id']);
    edit_slot_ex($slot['id'], $slot);
    if (isset($HTTP_POST_VARS['row']) and $HTTP_POST_VARS['row'] != "") {
        reposition_slot($slot, $HTTP_POST_VARS['row']);
    }
    copy_file($slot['id']);
    //Notify users only if god (admin) wants them to be notified (the default)
    if (isset($HTTP_POST_VARS['field_notify_users']) and $slot['islive'] == "y") {
        $trail1_new = get_node_info($slot['trail_1_id']);
        $trail2_new = $slot['trail_2_id'] ? get_node_info($slot['trail_2_id']) : -1;
        $trail1_old = get_node_info($oldslot['trail_1_id']);
        $trail2_old = $oldslot['trail_2_id'] ? get_node_info($oldslot['trail_2_id']) : -1;
        send_red_notification(LTMSG_SLOTTERM, $trail1_old['userid'], $trail1_old['id'], $slot['node']);
        if ($trail2 != -1) {
            send_red_notification(LTMSG_SLOTTERM, $trail2_old['userid'], $trail2_old['id'], $slot['node']);
        }
        send_red_notification(LTMSG_SLOTTERM, $trail1_new['userid'], $trail1_new['id'], $slot['node']);
        if ($trail2 != -1) {
            send_red_notification(LTMSG_SLOTTERM, $trail2_new['userid'], $trail2_new['id'], $slot['node']);
        }
    }
    Header("Location: " . $sess->url($nodeinfo['path']));
    exit;
}