예제 #1
0
function ProcessVstring($itemname, $itemvalue, $vstring, $output_type)
{
    $params = split(":", $vstring);
    // take out the items that are not really validators like focus
    if (in_array('focus', $params)) {
        unset($params[array_search('focus', $params)]);
    }
    // fix indexes
    $params = array_values($params);
    return ProcessItem($itemname, $itemvalue, $params, $output_type);
}
예제 #2
0
function ProcessAjax()
{
    // fetch the passed items from the get string
    $formid = $_GET["id"];
    // id of the form element
    $fvalue = urldecode($_GET["val"]);
    // the value of the field
    // text requirements like email, date, time, zip
    // special requirements like unique
    $params = array();
    foreach (array_keys($_GET) as $key) {
        $check = strpos($key, 'rule');
        if ($check !== false && $check == 0) {
            $value = urldecode($_GET[$key]);
            $params[] = $value;
            // validation rules
        }
    }
    // required validating handled on javascript side to reduce server traffic
    // pass to the other function
    ProcessItem($formid, $fvalue, $params, "ajax");
}
    require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php")) {
    require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php")) {
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "core.class.php";
} elseif (file_exists("core.class.php")) {
    require_once "core.class.php";
} else {
}
$core = new Core();
$GLOBALS["core"] = $core;
// Prepares URL DATA to include price infomation for all items listed in the operational_items database.
$tempcount = 0;
$result = $core->SQL("SELECT EveTypeID FROM `production_items` WHERE Type = 2");
while ($row = mysql_fetch_assoc($result)) {
    ProcessItem($row['EveTypeID']);
}
$core->Log("CRON(Eve-Central Market Data - Production) Done. All operational items were process successfully.");
function ProcessItem($itemid)
{
    $core = $GLOBALS["core"];
    $evecentralsite = "http://api.eve-central.com/api/marketstat?typeid=" . $itemid . "&regionlimit=10000002";
    $raw = file_get_contents($evecentralsite);
    if ($raw !== FALSE) {
        $xml = new SimpleXMLElement($raw);
        foreach ($xml->marketstat->children() as $item) {
            $eveitemid = (int) $item["id"];
            $registered = $core->SQL("SELECT COUNT(*) FROM `operations_marketdata` WHERE EveTypeID =" . $eveitemid);
            $total_records = mysql_num_rows($registered);
            if ($total_records != 0) {
                $core->SQL("DELETE FROM `operations_marketdata` WHERE EveTypeID =" . $eveitemid);
예제 #4
0
function ProcessDtx($filename, $projectId)
{
    StartAccessToDB();
    $lines = file($filename);
    $msg = "processing " . $filename . "<br>";
    $unitname = basename($filename);
    // Delete the existing unit (if any)
    $msg .= "deleting previous values for {$unitname}, if any...<br>";
    $deleteResult = DeleteUnitAndItemsByUnitName($unitname);
    if ($deleteResult != "") {
        $msg .= "Error while removing previous values: " . $deleteResult;
    } else {
        $msg .= "Success<br>";
        $unitId = -1;
        $index = 0;
        while ($index < count($lines)) {
            $curline = rtrim($lines[$index]);
            if (HasPrefix($curline, '##Package:')) {
                $package = substr($curline, strpos($curline, ':') + 2);
                $msg .= "found package: {$package}<br>";
            }
            if (HasPrefix($curline, '##Status:')) {
                $status = substr($curline, strpos($curline, ':') + 2);
                $msg .= "found status: {$status}<br>";
            }
            if (HasPrefix($curline, '@@')) {
                $msg .= "found item: {$curline} - ";
                if ($unitId == -1) {
                    $msg .= "Adding unit <a href=\"unit.php?Name={$unitname}\">{$unitname}</a> - ";
                    $unitId = AddUnit($unitname, "", "", $package, $status, $projectId, GetLoggedUserId());
                    if (is_string($unitId)) {
                        $msg .= $unitId . "<br>";
                        $unitId = -1;
                    }
                }
                if ($unitId != -1) {
                    $msg .= ProcessItem($lines, $index, $unitId);
                }
            }
            $index++;
        }
    }
    // delete the file, we don't need it anymore
    unlink($filename);
    EndAccessToDB();
    return $msg;
}