コード例 #1
0
ファイル: mantisserver.php プロジェクト: n2i/xvnkb
function processResult($result)
{
    $ret = new xmlrpcval();
    if (is_object($result)) {
        $result = get_object_vars($result);
    }
    if (is_associative_array($result)) {
        $ar = array();
        $keys = array_keys($result);
        foreach ($keys as $k) {
            $tmp = new xmlrpcval(array($k => new xmlrpcval($result[$k])), 'struct');
            $ar[] = $tmp;
        }
        $ret->addArray($ar);
    } else {
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                if (!is_string($value)) {
                    $tmp = processResult($value);
                } else {
                    $tmp = new xmlrpcval();
                    $tmp->addScalar($value);
                }
                $result[$key] = $tmp;
            }
            $ret->addArray($result);
        } else {
            if (is_bool($result)) {
                $ret->addScalar($result, "boolean");
            } else {
                $ret->addScalar($result);
            }
        }
    }
    return $ret;
}
コード例 #2
0
function searchEvent()
{
    $mySession = IMuConnect();
    $terms = new IMuTerms();
    $columns = array('SummaryData', 'image.resource{height:100,source:master}');
    if (isset($_GET["name"])) {
        $terms->add('EveEventTitle', trim($_GET["name"]));
    }
    if (isset($_GET["evnum"])) {
        $terms->add('EveEventNumber', trim($_GET["evnum"]));
    }
    if (isset($_GET["irn"])) {
        $terms->add('irn', trim($_GET["irn"]));
    }
    $start = 0;
    if (isset($_GET["start"])) {
        $start = intval($_GET["start"]);
    }
    $number = 15;
    if (isset($_GET["n"])) {
        $number = intval($_GET["n"]);
    }
    $events = new IMuModule('eevents', $mySession);
    try {
        $hits = $events->findTerms($terms);
        $result = $events->fetch('start', $start, $number, $columns);
        $result = processResult($result);
        print json_encode($result);
    } catch (Exception $e) {
        var_dump($e);
    }
}
コード例 #3
0
        } else {
            $data['time'] = processResult($res, 'ttr_created_date', 'ttr_iss_id');
            for ($i = 0; $i < count($data['time']); $i++) {
                $data['time'][$i]['time_spent'] = Misc::getFormattedTime($data['time'][$i]['ttr_time_spent'], true);
            }
        }
    }
    if (empty($_REQUEST['developer']) && in_array('reminder', $_REQUEST['activity_types'])) {
        $sql = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_history.*,\n                    iss_summary,\n                    sta_color,\n                    rma_title\n                FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_history,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_action,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n                WHERE\n                    iss_sta_id = sta_id AND\n                    rmh_iss_id = iss_id AND\n                    rmh_rma_id = rma_id AND\n                    iss_prj_id = {$prj_id} AND\n";
        $sql .= createWhereClause('rmh_created_date');
        $res = $GLOBALS["db_api"]->dbh->getAll($sql, DB_FETCHMODE_ASSOC);
        if (PEAR::isError($res)) {
            print_r($res);
            Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
        } else {
            $data['reminder'] = processResult($res, 'rmh_created_date', 'rmh_iss_id');
        }
    }
    $tpl->assign(array("unit" => $_REQUEST['unit'], "amount" => $_REQUEST['amount'], "developer" => $_REQUEST['developer'], "start_date" => @$start_date, "end_date" => @$end_date, "data" => $data));
}
function createWhereClause($date_field, $user_field = false)
{
    global $start_date, $end_date;
    $sql = '';
    if ($_REQUEST['report_type'] == 'recent') {
        $sql .= "{$date_field} >= DATE_SUB('" . Date_API::getCurrentDateGMT() . "', INTERVAL " . Misc::escapeInteger($_REQUEST['amount']) . " " . Misc::escapeString($_REQUEST['unit']) . ")";
    } else {
        $sql .= "{$date_field} BETWEEN '{$start_date}' AND '{$end_date}'";
    }
    if ($user_field != false && !empty($_REQUEST['developer'])) {
        $sql .= " AND {$user_field} = " . Misc::escapeString($_REQUEST['developer']);
コード例 #4
0
ファイル: index.php プロジェクト: hermit-hacker/CLCS
///////////////////////////////////////////////////////////////////////////////////////////
//                                                                                       //
//                              Main program execution                                   //
//                                                                                       //
///////////////////////////////////////////////////////////////////////////////////////////
// Establish a new CLCSConfiguration object
$cfg_file = new CLCSConfiguration("Courthouse");
// Check for a specified action, build out parameters, and execute
if ($_POST["CLCSA"]) {
    $clcsAction = $_POST["CLCSA"];
    $clcsNodeID = $_POST["NodeID"];
    $clcsIPAddress = $_POST["IPA"];
    $clcsGPU = $_POST["GPU"];
    $clcsJobID = $_POST["JOBID"];
    $clcsResults = $_POST["RESULTS"];
    switch ($clcsAction) {
        case 'Register':
            registerNode($cfg_file, $clcsNodeID, $clcsGPU, $clcsIPAddress);
            break;
        case 'SubmitResult':
            processResult($cfg_file, $clcsNodeID, $clcsJobID, $clcsResults);
            break;
        default:
            echo "Received.\n";
            break;
    }
} else {
    printHTMLHeader("Courthouse");
    echo "No action specified.";
    printHTMLFooter();
}