function CreateTicket($subject, $name, $email, $cat, $phone, $pri=2) {
	global $link, $db_name, $notify;

	if ($subject == "")
		$subject = "[No Subject]";

	/* Generate random ticket_id */
	do {
		mt_srand ((double) microtime() * 1000000);
		$ID =  mt_rand(0,9) . mt_rand(0,9) . mt_rand(0,9) . mt_rand(0,9) . mt_rand(0,9) . mt_rand(0,9);
	} while(ValidID($ID) == false);

	/* Insert the ticket */
	mysql_db_query($db_name, "insert into tickets (subject, name, email, cat, phone, status, ID, priority) VALUES ('".addslashes($subject)."', '$name', '$email', '$cat', '$phone', 'open', $ID, $pri);", $link);

	if (mysql_error($link))
		return false;

	/* Succeeded */

	SendNotification($name, $email, $phone, $subject, $cat);

	return $ID;
}
Beispiel #2
0
if (!HasPermission('forum.viewforum', $fid)) {
    Kill(__('You may not access this forum.'));
}
$tags = ParseThreadTags($thread['title']);
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($_POST['report']) {
    if ($_POST['key'] !== $loguser['token']) {
        Kill(__('No.'));
    }
    // TODO make this use actual notifications or anything better
    Query("INSERT INTO {pmsgs_text} (title,text) VALUES ({0},{1})", "Post report (post #{$pid})", '');
    $pmid = InsertId();
    Query("INSERT INTO {pmsgs} (id,userto,userfrom,date,ip,msgread,deleted,drafting)\n\t\tVALUES ({0},{1},{2},{3},{4},0,0,0)", $pmid, -1, $loguserid, time(), $_SERVER['REMOTE_ADDR']);
    $report = "<strong>Post report</strong>\n\n<strong>Post:</strong> " . actionLinkTag($tags[0], 'post', $pid) . " (post #{$pid})\n\n<strong>Message:</strong>\n{$_POST['message']}\n\n" . actionLinkTag('Mark issue as resolved', 'showprivate', $pmid, 'markread=1');
    Query("UPDATE {pmsgs_text} SET text={0} WHERE pid={1}", $report, $pmid);
    SendNotification('pm', $pmid, -1);
    die(header('Location: ' . actionLink('post', $pid)));
}
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $isHidden ? '' : $tags[0]) => $tags[0], '' => __("Report post")));
$user = Fetch(Query("SELECT * FROM {users} WHERE id={0}", $post['user']));
foreach ($user as $key => $value) {
    $post['u_' . $key] = $value;
}
MakePost($post, POST_SAMPLE);
$fields = array('message' => '<textarea id="text" name="message" rows=10></textarea>', 'btnSubmit' => '<input type="submit" name="report" value="' . __('Submit report') . '">');
echo '
	<form action="" method="POST">';
RenderTemplate('form_reportpost', array('fields' => $fields));
echo '
		<input type="hidden" name="key" value="' . $loguser['token'] . '">
	</form>';
Beispiel #3
0
                    $pid = InsertId();
                    Query("insert into {pmsgs} (id, userto, userfrom, conv_start, date, ip, drafting, draft_to) values ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", $pid, 0, $loguserid, $convStart, time(), $_SERVER['REMOTE_ADDR'], 1, $_POST['to']);
                }
                die(header("Location: " . actionLink("private", "", "show=2")));
            } else {
                if ($draftID) {
                    $pid = $draftID;
                    Query("DELETE FROM {pmsgs} WHERE id={0} AND drafting=1", $pid);
                } else {
                    Query("insert into {pmsgs_text} (title,text) values ({0}, {1})", $_POST['title'], $post);
                    $pid = InsertId();
                }
                foreach ($recipIDs as $recipient) {
                    $cs = $recipient == $replyTo ? $convStart : 0;
                    $rPM = Query("insert into {pmsgs} (id, userto, userfrom, conv_start, date, ip, msgread, drafting) values ({0}, {1}, {2}, {3}, {4}, {5}, 0, {6})", $pid, $recipient, $loguserid, $cs, time(), $_SERVER['REMOTE_ADDR'], 0);
                    SendNotification('pm', $pid, $recipient);
                }
                die(header("Location: " . actionLink("private", "", "show=1")));
            }
        } else {
            Alert(__("Enter a message and try again."), __("Your PM is empty."));
        }
    } else {
        Alert(__("Enter a title and try again."), __("Your PM is untitled."));
    }
}
if ($_POST['text']) {
    $prefill = $_POST['text'];
}
if ($_POST['title']) {
    $trefill = $_POST['title'];
            VALUES (' . $game->player['user_alliance'] . ', ' . $thread_id . ', ' . $game->player['user_id'] . ', 0, "' . $post_title . '", ' . $game->TIME . ', "' . $post_text . '")';
    if (!$db->query($sql)) {
        message(DATABASE_ERROR, 'Could not insert new post data');
    }
    $new_post_id = $db->insert_id();
    $sql = 'UPDATE alliance_bthreads
            SET thread_replies = thread_replies + 1,
                thread_last_post_id = ' . $new_post_id . ',
                thread_last_post_date = ' . $game->TIME . '
            WHERE thread_id = ' . $thread_id;
    if (!$db->query($sql)) {
        message(DATABASE_ERROR, 'Could not update thread data');
    }
    // 14/07/12 - AC: Send a notification of the new post to all the
    //            others members of the alliance
    SendNotification($post_title, $thread_id, false);
    redirect('a=alliance_board&show_thread=' . $thread_id . $override_str);
} elseif (!empty($_GET['new_post'])) {
    $thread_id = (int) $_GET['new_post'];
    $sql = 'SELECT thread_id, alliance_id, thread_title
            FROM alliance_bthreads
            WHERE thread_id = ' . $thread_id;
    if (($thread = $db->queryrow($sql)) === false) {
        message(DATABASE_ERROR, 'Could not query thread data');
    }
    if (empty($thread['thread_id'])) {
        message(NOTICE, constant($game->sprache("TEXT9")));
    }
    if ($thread['alliance_id'] != $game->player['user_alliance']) {
        message(NOTICE, constant($game->sprache("TEXT9")));
    }
Beispiel #5
0
function ParseQueue()
{
    $array = DirList('/var/mail/artica-wbl');
    if (!is_array($array)) {
        return null;
    }
    $ldap = new clladp();
    while (list($key, $filename) = each($array)) {
        $continue = true;
        $noscan = false;
        if (!preg_match("#.+?\\.ini\$#", $filename)) {
            continue;
        }
        $ini = new Bs_IniHandler("/var/mail/artica-wbl/{$filename}");
        $robot = $ini->_params["MAIL"]["action"];
        $robot_from = $ini->_params["MAIL"]["robotname"];
        if (preg_match("#.+?@(.+?)@(.+)#", $robot_from, $re)) {
            $robot_from = "{$re[1]}@{$re[2]}";
        }
        $user = $ini->_params["MAIL"]["orignal_from"];
        if ($user == null) {
            $user = $ini->_params["MAIL"]["From"];
        }
        $filecontent = $ini->_params["MAIL"]["Content"];
        $subject = $ini->_params["MAIL"]["subject"];
        $uid = $ldap->uid_from_email($user);
        write_syslog("ParseQueue():: Robot \"{$robot_from}\" Subject:{$subject} From:\"{$uid}\" <{$user}> ({$robot})", __FILE__);
        if ($robot == null) {
            $continue = false;
            write_syslog("ParseQueue():: No robot specified", __FILE__);
        }
        if ($uid == null) {
            $uid = CreateThisUser($user);
            if ($uid == null) {
                write_syslog("ParseQueue():: Unable to detect internal user for {$user}", __FILE__);
                $continue = false;
            }
        }
        if (!is_file($filecontent)) {
            $continue = false;
            write_syslog("ParseQueue():: Unable to stat {$filecontent}", __FILE__);
        }
        if (!$continue) {
            @unlink("/var/mail/artica-wbl/{$filename}");
            @unlink($filecontent);
            continue;
        }
        if ($robot == "report") {
            $noscan = true;
        }
        if ($robot == "quarantine") {
            $noscan = true;
        }
        $content = @file_get_contents($filecontent);
        if (!$noscan) {
            $emails = DetecteMails($content, $subject);
            if (!is_array($emails)) {
                write_syslog("ParseQueue():: Unable to detect mails in contents", __FILE__);
                @unlink("/var/mail/artica-wbl/{$filename}");
                @unlink($filecontent);
                continue;
            }
        }
        $ct = new user($uid);
        if ($robot == "white") {
            $count = $count + 1;
            while (list($num, $addr) = each($emails)) {
                if (trim($addr) == null) {
                    continue;
                }
                if (substr($addr, 0, 1) == '-') {
                    $addr = substr($addr, 1, strlen($addr));
                    if (!$ct->del_whitelist($addr)) {
                        $res[$addr] = "failed ({$robot}) (delete)";
                    } else {
                        $res[$addr] = "Success ({$robot}) (delete)";
                    }
                    continue;
                }
                if (!$ct->add_whitelist($addr)) {
                    $res[$addr] = "failed ({$robot})";
                } else {
                    $res[$addr] = "Success ({$robot})";
                }
            }
        }
        if ($robot == "black") {
            $count = $count + 1;
            while (list($num, $addr) = each($emails)) {
                if (trim($addr) == null) {
                    continue;
                }
                if (substr($addr, 0, 1) == '-') {
                    $addr = substr($addr, 1, strlen($addr));
                    if (!$ct->del_blacklist($addr)) {
                        $res[$addr] = "failed ({$robot}) (delete)";
                    } else {
                        $res[$addr] = "Success ({$robot}) (delete)";
                    }
                    continue;
                }
                if (!$ct->add_blacklist($addr)) {
                    $res[$addr] = "failed ({$robot})";
                } else {
                    $res[$addr] = "Success ({$robot})";
                }
            }
        }
        if ($robot == "report") {
            $sender = $robot_from;
            $recipient = $ct->mail;
            $uid = $ct->uid;
            write_syslog("ParseQueue():: build white & black lists report for {$uid}", __FILE__);
            BuildWhiteListReport($uid, $sender, $subject);
            @unlink("/var/mail/artica-wbl/{$filename}");
            @unlink($filecontent);
            continue;
        }
        if ($robot == "quarantine") {
            $sender = $robot_from;
            $recipient = $ct->mail;
            $uid = $ct->uid;
            write_syslog("ParseQueue():: build quarantine report for {$uid}", __FILE__);
            $usr = new usersMenus();
            $PHP_BIN_PATH = $usr->PHP_BIN_PATH;
            $EXEC_NICE = $usr->EXEC_NICE;
            $cmd = "{$EXEC_NICE}{$PHP_BIN_PATH} " . dirname(__FILE__) . "/exec.quarantine.reports.php --single {$uid} {$ct->ou} {$sender} \"{$subject}\" &";
            write_syslog("ParseQueue():: processing \"{$cmd}\"", __FILE__);
            system($cmd);
            @unlink("/var/mail/artica-wbl/{$filename}");
            @unlink($filecontent);
            continue;
        }
        if (is_array($res)) {
            SendNotification($ct->mail, $robot_from, $subject, $res);
            write_syslog("ParseQueue():: Success for {$robot} list ordered by \"{$ct->mail}\" with " . implode(",", $emails) . " addresses", __FILE__);
        }
        write_syslog("ParseQueue():: Deleting  {$filename} & " . basename($filecontent) . " in queue dir", __FILE__);
        unlink("/var/mail/artica-wbl/{$filename}");
        unlink($filecontent);
        continue;
    }
    return $count;
}
Beispiel #6
0
        if ($canDeleteComments || $postedby == $loguserid && HasPermission('user.deleteownusercomments')) {
            Query("delete from {usercomments} where uid={0} and id={1}", $id, (int) $_GET['cid']);
            if ($loguserid != $id) {
                // dismiss any new comment notification that has been sent to that user, unless there are still new comments
                $lastcmt = FetchResult("SELECT date FROM {usercomments} WHERE uid={0} ORDER BY date DESC LIMIT 1", $id);
                if ($lastcmt < $user['lastprofileview']) {
                    DismissNotification('profilecomment', $id, $id);
                }
            }
            die(header("Location: " . actionLink("profile", $id, '', $user['name'])));
        }
    }
    if (isset($_POST['actionpost']) && !IsReallyEmpty($_POST['text']) && $canComment) {
        $rComment = Query("insert into {usercomments} (uid, cid, date, text) values ({0}, {1}, {2}, {3})", $id, $loguserid, time(), $_POST['text']);
        if ($loguserid != $id) {
            SendNotification('profilecomment', $id, $id);
        }
        die(header("Location: " . actionLink("profile", $id, '', $user['name'])));
    }
}
if ($loguserid) {
    if (Settings::get('postLayoutType')) {
        $blocktext = __('Block layout');
        $unblocktext = __('Unblock layout');
    } else {
        $blocktext = __('Block signature');
        $unblocktext = __('Unblock signature');
    }
    $rBlock = Query("select * from {blockedlayouts} where user={0} and blockee={1}", $id, $loguserid);
    $isBlocked = NumRows($rBlock);
    if ($isBlocked) {