function approve_send(&$frm)
{
    /* @var $frm cForm */
    if ($frm->validate("approve_send")) {
        return approve($frm);
    }
    $qry = new dbSelect("keys", "trh", grp(m("cols", "*, (key).*"), m("where", "id='{$_POST['id']}'")));
    $qry->run();
    if ($qry->num_rows() <= 0) {
        return view($frm, "<li class='err'>Invalid key selected.</li>");
    }
    $ki = $qry->fetch_array();
    if ($ki["custid"] == "-1") {
        $fromwho = "cust";
        $fromwhoid = $_POST["cusnum"];
    } else {
        if ($ki["suppid"] == "-1") {
            $fromwho = "supp";
            $fromwhoid = $_POST["supid"];
        } else {
            return view($frm, "<li class='err'>Key already approved.</li>");
        }
    }
    $cols = grp(m("{$fromwho}id", $fromwhoid));
    $upd = new dbUpdate("keys", "trh", $cols, "id='{$_POST['id']}'");
    $upd->run(DB_UPDATE);
    if (send_trhmsg($fromwho, $fromwhoid, $ki["email"], "rspkey", $ki["recv_key"])) {
        return view($frm, "<li class='err'>Successfully approved request.</li>");
    } else {
        /* set the id back to -1, because there was an error */
        $cols = grp(m("{$fromwho}id", "-1"));
        $upd = new dbUpdate("keys", "trh", $cols, "id='{$_POST['id']}'");
        $upd->run(DB_UPDATE);
        return view($frm, "<li class='err'>Error approving request.</li>");
    }
}
Ejemplo n.º 2
0
    $notification_handler->triggerEvent('global', 0, 'new_link', $tags);
    $notification_handler->triggerEvent('category', $cid, 'new_link', $tags);
    $notification_handler->triggerEvent('link', $lid, 'approve', $tags);
    redirect_header("index.php", 1, _MD_NEWLINKADDED);
}
if (!isset($_POST['op'])) {
    $op = isset($_GET['op']) ? $_GET['op'] : 'main';
} else {
    $op = $_POST['op'];
}
switch ($op) {
    case "delNewLink":
        delNewLink();
        break;
    case "approve":
        approve();
        break;
    case "addCat":
        addCat();
        break;
    case "addLink":
        addLink();
        break;
    case "listBrokenLinks":
        listBrokenLinks();
        break;
    case "delBrokenLinks":
        delBrokenLinks();
        break;
    case "ignoreBrokenLinks":
        ignoreBrokenLinks();
<?php

require "../settings.php";
if (!isset($_REQUEST["key"])) {
    $_REQUEST["key"] = "list";
}
switch ($_REQUEST["key"]) {
    case "approve":
        $OUTPUT = approve();
        break;
    case "deny":
        $OUTPUT = deny();
        break;
    case "list":
    default:
        $OUTPUT = listorders();
}
$OUTPUT .= "<br />" . mkQuickLinks(ql("../purchase-new.php", "New Order"), ql("../sorder-view.php", "View Customer Sales Orders"), ql("configuration.php", "Transheks Configuration"));
parse();
function listorders($err = "")
{
    /* filters */
    $filter = wgrp(m("approved", "n"));
    $order = "pdate";
    /* output */
    $OUT = "\n\t<h3>Approve Customer Orders</h3>\n\t{$err}\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Customer</th>\n\t\t<th>Received</th>\n\t\t<th>Total</th>\n\t\t<th colspan='3'>Options</th>\n\t</tr>";
    $qry = new dbSelect("recvpurch", "trh", grp(m("where", wgrp($filter)), m("order", $order)));
    $qry->run();
    while ($row = $qry->fetch_array()) {
        $ci = qryCustomer($row["custid"]);
        if (!empty($ci["cusname"])) {
Ejemplo n.º 4
0
if (!$authed) {
    header('WWW-Authenticate: Basic realm="Review"');
    return_response($id, $error, 401);
}
function approve($id)
{
    global $mysqli;
    $sql = "UPDATE chirpy.mf_quotes set approved = 1 where id = ? limit 1";
    $stmt = $mysqli->prepare($sql) or return_response($id, "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error, 500);
    $stmt->bind_param("i", $id) or return_response($id, "Bind failed: (" . $stmt->errno . ") " . $stmt->error, 500);
    $stmt->execute() or return_response($id, "Execute failed: (" . $stmt->errno . ") " . $stmt->error, 500);
    return_response($id, "Approved");
}
function remove($id)
{
    global $mysqli;
    $sql = "DELETE from chirpy.mf_quotes where id = ? limit 1";
    $stmt = $mysqli->prepare($sql) or return_response($id, "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error, 500);
    $stmt->bind_param("i", $id) or return_response($id, "Bind failed: (" . $stmt->errno . ") " . $stmt->error, 500);
    $stmt->execute() or return_response($id, "Execute failed: (" . $stmt->errno . ") " . $stmt->error, 500);
    return_response($id, "Denied");
}
if ($_POST['action'] == "approve") {
    $id = intval($_POST['id']);
    approve($id);
}
if ($_POST['action'] == "remove") {
    $id = intval($_POST['id']);
    remove($id);
}
return_response($id, "What? " . $_POST['action'], 400);
Ejemplo n.º 5
0
if (file_exists($uploadDir . $fileName)) {
    outputJSON('File with that name already exists.');
}
// Upload file
if (!move_uploaded_file($_FILES['SelectedFile']['tmp_name'], $uploadDir . $generatedSourceName)) {
    outputJSON('Error uploading file - check destination is writeable.');
}
$parsedCode = str_replace(array('<', '>'), array('&#60;', '&#62;'), file_get_contents($uploadDir . $generatedSourceName));
//$exec_string = "g++ buffer/$fileName -o buffer/runner && ./buffer/runner > buffer/out.in";
if ($compiler == 'python') {
    $exec_comm = array('shell' => 'timeout 1 sh -c "/usr/bin/time -p -f "%e*%M" -o ', 'memtime' => '', 'cat' => ' cat ' . $uploadDir, 'input' => '', 'execution' => ' | python ' . $uploadDir . $generatedSourceName . '"');
} else {
    $exec_comm = array('compiler' => $compiler, 'source' => ' ' . $uploadDir . $generatedSourceName, 'runner' => ' -o ' . $uploadDir . $generatedRunnerName . ' && timeout 1 sh -c "/usr/bin/time -p -f "%e*%M" -o ', 'memtime' => '', 'salt' => ' cat ' . $uploadDir, 'input' => '', 'execution' => ' | ./' . $uploadDir . $generatedRunnerName . '"');
}
$output_string = "ПУСТОТЕНЬ";
if (approve($username, $taskNumber)) {
    $researcher = researchTask($taskNumber, $exec_comm, $uploadDir);
    //Assigning points to the $username
    //If n number of tasks is completed => the task is completed, assign points
    //============
    if ($researcher['confirms'] == $researcher['taskTestsNumber']) {
        $pointsGained = $points[$taskNumber];
        $sql_request = "UPDATE results SET code_task{$taskNumber}  = '{$parsedCode}' WHERE username = '******'";
        $sql_upd = "UPDATE results SET points = points + {$pointsGained} WHERE username = '******'";
        $connection->query($sql_upd);
        $connection->query($sql_request);
        $output_string = 'Output from cpp:<br><b> ' . '</b><br>' . $researcher['status'] . ' ' . $researcher['confirms'] . '/5' . '<br><br>' . implode(' ', $researcher['time']) . '    ' . implode(' ', $researcher['memory']) . '<br><br>' . implode(' ', $exec_comm) . '<br><br>also your code:<br><pre class="prettyprint">' . $parsedCode . '</pre>' . '<br>' . $taskNumber;
        if ($compiler != 'python') {
            unlink($uploadDir . $generatedRunnerName);
        }
        #УНИЧТОЖЕНИЕ
Ejemplo n.º 6
0
function queue_details()
{
    global $mybb, $db, $cache, $templates, $approval_page, $theme, $lang, $header, $headerinclude, $footer, $parser;
    if ($mybb->settings['rpgsuite_approval']) {
        $currentuser = new GroupMember($mybb, $db, $cache, $mybb->user);
        if ($currentuser->is_admin() && $mybb->input['action'] == 'activationqueue') {
            if ($mybb->request_method == "post") {
                $userid = (int) $mybb->input['userid'];
                $username = $db->escape_string($mybb->input['username']);
                $type = $mybb->input['type'];
                if (isset($mybb->input['approve'])) {
                    approve($userid, $username, $type);
                } else {
                    if (isset($mybb->input['deny'])) {
                        deny($userid, $username);
                    }
                }
            }
            add_breadcrumb('Approve New Members');
            $rpgsuite = new RPGSuite($mybb, $db, $cache);
            $accounts = $rpgsuite->get_awaiting_approval();
            foreach ($accounts as $user) {
                eval("\$userlist .= \"" . $templates->get("rpgapprove_user") . "\";");
            }
            eval("\$approval_page = \"" . $templates->get("rpgapprove_page") . "\";");
            output_page($approval_page);
            exit;
        }
    }
}
Ejemplo n.º 7
0
        $sq = "update " . $table_prefix . "events set status_id = 4, quick_approve = NULL where quick_approve = '" . $code . "'";
        $squery = mysql_query($sq);
        if ($squery) {
            $msg = $lang["event_updated"];
            $event_id = mysql_result($query, 0, 0);
            include "includes/notify.php";
            notify_group($event_id);
        }
    } else {
        $msg = $lang["event_not_found"];
    }
    header("Location: index.php?msg=" . $msg);
}
switch ($_REQUEST["mode"]) {
    case $lang["send_new_password"]:
        send_new_password();
        break;
    case "q":
        approve($_REQUEST["qa"]);
        break;
    case "logout":
        log_out();
        break;
    case "Log In":
        check_login();
        break;
    default:
        header("Location: index.php");
        break;
}
mysql_close($link);