Example #1
0
function _sendmail()
{
    global $usertoken;
    if ($usertoken['usertype_id'] < 5) {
        die('Err:Msg110:WrongUser');
    }
    $msg = strip_tags($_POST['mailmsg']);
    $from = strip_tags($_POST['mailfrom']);
    $mail_group = strip_tags($_POST['mailgrp']);
    $to_adr = _GetMailAdressForGroup(strip_tags($_POST['mailgrp']));
    $msg_url = strip_tags($_POST['sysurl']);
    $msg = $msg . '\\n===== System generated email, please do not reply. =====';
    if (strlen($msg_url) < 1) {
        $msg_url = 'lsdbMessage.php';
    }
    #debug($from.":".$to.":".$msg);
    $ret = DB_setMessage($from, 6, 1, $msg, $msg_url, $mail_group, $to_adr);
    if (!$ret == 1) {
        debug('ERROR creating mail:' . $ret);
        return;
    }
    // abschicken ...
    _sendpendingmails();
}
Example #2
0
function _submitMatchResult($vmkey, $eventid, $vtid, $vsets, $vlegs)
{
    /*
     * unlike the saveMatch function this is triggered by non-priviledged users
     * here we have only calculated values - no check save as they are ...
     * TODO -> this is 60% identical to _saveMatch function ...
     * TODO -> check if this can be replaced by the axEditor ...
     * + saveresults status GreenRing ($$greencrosspic) and send message URL
     */
    global $event, $dbi, $LS_LEVEL, $usertoken;
    $editmode = 0;
    $editmode = retAccessThisMatchKey($vmkey);
    if ($LS_LEVEL < 2 && $editmode == 0) {
        die("<h3>No access ...{$editmode}</h3>");
    }
    # // save values into the match-team-assignment table
    $ret = DB_UpdateMatchTeamResults($vmkey, $eventid, $vtid, $vsets, $vlegs);
    if ($ret != 2) {
        die("<h3>Error saving Match result values...</h3>");
    }
    // JUST set STATUS to SUBMITTED
    $ret = DB_setMatchStatus($vmkey, 5);
    if ($ret != 1) {
        die('<h3>Event: (' . $event['evname'] . ') Match: ' . $vmkey . ' Status Update failed ...</h3>');
    }
    dsolog(1, $usertoken['uname'], 'Result ' . $vsets[0] . ':' . $vsets[1] . ' for Match $vmkey submitted for review');
    // MESSAGE BUS
    if ($usertoken['ttypeuser_id'] < 3) {
        $msg = $event['evname'] . ' Result ' . $vsets[0] . ':' . $vsets[1] . ' submitted by Account ' . $usertoken['uname'] . ' - please review using the system link below.';
        $url = 'ls_system.php?func=showmatch&vmkey=' . $vmkey . '&eventid=' . $eventid;
        $ret = DB_setMessage($usertoken['uname'], 1, 1, $msg, $url, $event['mgroup_id']);
        if ($ret != 1) {
            die('<h3>Event: (' . $event['evname'] . ') Match: ' . $vmkey . ' Request for approval could not be sent.</h3>');
        }
    }
    _sendpendingmails();
}
Example #3
0
    #debug($obj);
    $qry = 'INSERT into wfrequesthistory(message,mgroup_id,wfrequest_id,wfstate_id,wfstatechange,wfuser_id)' . ' VALUES("' . $sMSG . '",' . $obj['mgroup_id'] . ',' . $wf_id . ',' . $wfstatus_id . ',NOW(),' . $usertoken['id'] . ')';
    #debug($qry);
    $p3 = sql_query($qry, $dbi);
    if ($p3 != 1) {
        echo '<h3>History could not be created ...</h3>';
    }
    /*
     *  can we generate a mail message here  ??? we cant hook into the _sedmail proc since its a service ...
     *  we use the DB_setMessage api instead
     *  recipients are either user/admin 
     */
    $msg = 'Antrag: ' . $obj['wfobject'] . ' Status: ' . $wfstatus_id . ' Info: ' . $sMSG;
    $sysurl = 'wf.php?op=edit&reqid=' . $wf_id;
    if ($recipient == 'user') {
        $recipient_addres = retUserProperty($obj['user_id'], 'email');
        $p4 = DB_setMessage($usertoken['uname'], 4, 1, $msg, $sysurl, 0, $recipient_addres);
    } else {
        $p4 = DB_setMessage($usertoken['uname'], 4, 1, $msg, $sysurl, $obj['mgroup_id']);
    }
    if ($p4 != 1) {
        echo '<h3>Message could not be created ...' . $ret . '</h3>';
    } else {
        _sendpendingmails();
    }
}
if ($p1 + $p2 + $p3 + $p4 == 4) {
    echo '<font color=\'green\'>' . $p1 . '/' . $p2 . '/' . $p3 . '/' . $p4 . ':Success RequestChangeStatus' . $wf_id . '</font>';
} else {
    echo '<font color=\'red\'>' . $p1 . '/' . $p2 . '/' . $p3 . '/' . $p4 . ':Error during RequestChangeStatus' . $wf_id . '</font>';
}