Esempio n. 1
0
<?php

/**
 * Generate the Command/<command>.xml file from its php file
 * Outputs the XML to stdout.
 */
echo "Starting the XML generation process\n\n";
// Name of the command, eg 'Remote' for Remote.php's XML output
$dir = 'PEAR/Command/';
foreach (scandir($dir) as $file) {
    $file = explode('.', $file);
    if (isset($file[1]) && $file[1] === 'php' && $file[0] != 'Common') {
        echo "Generating XML for " . $file[0] . " \n";
        generateXML($file[0]);
    }
}
echo "\nDone.\n";
function generateXML($name)
{
    $file = 'PEAR/Command/' . $name . '.php';
    if (!file_exists($file)) {
        die('File ' . $file . ' doesn\'t exist, perhaps ' . $name . ' is not a valid command name.');
    }
    require_once $file;
    $cmd_name = 'PEAR_Command_' . $name;
    $a = 't';
    $cmd = new $cmd_name($a, $a);
    $xml = '<commands version="1.0">' . "\n";
    foreach ($cmd->commands as $command => $docs) {
        $command = htmlentities($command, ENT_QUOTES, 'UTF-8');
        $xml .= ' <' . $command . '>' . "\n";
Esempio n. 2
0
function getMainXML($username, $sess, $pass, $pass2)
{
    $c = DBConnect();
    if ($c == null) {
        return array(false, "");
    }
    $contest = $_SESSION["usertable"]["contestnumber"];
    $r = DBExec($c, "select * from contesttable where contestnumber={$contest}");
    if (DBnLines($r) == 0) {
        echo "Unable to find the contest {$contest} in the database.\n";
        exit;
    }
    $ct = DBRow($r, 0);
    $localsite = $ct["contestlocalsite"];
    $mainsite = $ct["contestmainsite"];
    $siteurl = $ct['contestmainsiteurl'] . '/site/get.php';
    //	if ($mainsite==$localsite) return array(true,"");
    /*
    	$r = DBExec($c, "select * from sitetable where sitenumber=".$mainsite." and contestnumber=$contest");
    	if (DBnLines($r)==0) {
    		echo "Unable to find the main site in the database (site=$mainsite, contest=$contest).\n";
    		exit;
    	}
    	$st = DBRow($r,0);
    	$siteurl =  $st["siteip"] . '/site/get.php';
    */
    if (substr($siteurl, 0, 7) != 'http://') {
        $siteurl = 'http://' . $siteurl;
    }
    if ($sess == '') {
        //		MSGError('session empty');
        $s = file_get_contents($siteurl);
        if ($s === false) {
            return array(false, '', '');
        }
        //		MSGError($s);
        $t = strtok($s, " \t");
        while ($t !== false && substr($t, 0, 8) != '<SESSION' && substr($t, 0, 6) != '<ERROR' && $t != '<OK>' && $t != '<NOTOK>') {
            echo $t . " ";
            $t = strtok(" \t");
        }
        if ($t === false) {
            return array(false, '', '');
        }
        echo $t . " -->\n";
        if (substr($t, 0, 8) == '<SESSION') {
            $id = strtok(" \t");
            return array(false, $id, $id);
        } else {
            return array(false, '', '');
        }
    }
    if ($pass == $pass2) {
        //		MSGError('equal');
        $opts = array('http' => array('method' => 'GET', 'header' => 'Cookie: PHPSESSID=' . $sess));
        $context = stream_context_create($opts);
        $s = file_get_contents($siteurl . '?name=' . $username . '&password='******'&check=nocheck', 0, $context);
    } else {
        $data = encryptData(generateXML($contest), myhash($pass2));
        $data_url = http_build_query(array('xml' => $data, 'name' => $username, 'password' => $pass, 'check' => myhash($pass . $pass2)));
        $opts = array('http' => array('method' => 'POST', 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded", 'content' => $data_url));
        $context = stream_context_create($opts);
        $s = file_get_contents($siteurl, 0, $context);
    }
    if ($s === false) {
        return array(false, "", '');
    }
    //		MSGError('OPA1: ' . $s);
    $t = strtok($s, " \t");
    while ($t !== false && substr($t, 0, 8) != '<SESSION' && substr($t, 0, 6) != '<ERROR' && $t != '<OK>' && $t != '<NOTOK>') {
        echo $t . " ";
        $t = strtok(" \t");
    }
    if ($t === false) {
        return array(false, '', '');
    }
    echo $t . " -->\n";
    if (substr($t, 0, 6) == "<ERROR") {
        $id = strtok(" \t");
        if ($id === false) {
            return array(false, '', '');
        }
        return array(false, $id, "");
    }
    if (substr($t, 0, 8) == "<SESSION") {
        $id = strtok(" \t");
        if ($id === false) {
            return array(false, '', '');
        }
        $idextra = strtok(" \t");
        if ($idextra === false) {
            return array(false, '', '');
        }
        //		MSGError("id=$id  idextra=$idextra");
        return array(false, $id, $idextra);
    }
    $id = strtok(" \t");
    if ($id === false) {
        return array(false, '', '');
    }
    //MSGError('OPA2: ' . $s);
    if ($pass2 != '') {
        $s = decryptData($id, myhash($pass2));
    }
    if (strtoupper(substr($s, 0, 5)) != "<XML>") {
        return array(false, '', $t);
    }
    return array(true, $s, $t);
}
Esempio n. 3
0
            $itemObj->sellerInfo->positiveFeedbackPercent = (string) $child->sellerInfo->positiveFeedbackPercent;
            $itemObj->sellerInfo->sellerUserName = (string) $child->sellerInfo->sellerUserName;
            $itemObj->sellerInfo->feedbackScore = (string) $child->sellerInfo->feedbackScore;
            $itemObj->sellerInfo->sellerStoreName = (string) $child->storeInfo->storeName;
            $itemObj->sellerInfo->sellerStoreURL = (string) $child->storeInfo->storeURL;
            $itemObj->sellerInfo->feedbackRatingStar = (string) $child->sellerInfo->feedbackRatingStar;
            $itemObj->sellerInfo->topRatedSeller = (string) $child->sellerInfo->topRatedSeller;
            //shippingInfo class
            $itemObj->shippingInfo->oneDayShippingAvailable = (string) $child->shippingInfo->oneDayShippingAvailable;
            $itemObj->shippingInfo->shippingType = (string) $child->shippingInfo->shippingType;
            $itemObj->shippingInfo->expeditedShipping = (string) $child->shippingInfo->expeditedShipping;
            $itemObj->shippingInfo->expeditedShipping = (string) $child->shippingInfo->expeditedShipping;
            $itemObj->shippingInfo->returnsAccepted = (string) $child->returnsAccepted;
            $itemObj->shippingInfo->handlingTime = (string) $child->shippingInfo->handlingTime;
            foreach ($child->shippingInfo->children() as $locations) {
                if ($locations->getName() == "shipToLocations") {
                    $itemObj->shippingInfo->shipToLocations = $itemObj->shippingInfo->shipToLocations . $locations . ',';
                }
            }
            $itemObj->shippingInfo->shipToLocations = substr($itemObj->shippingInfo->shipToLocations, 0, -1);
            $mainObj->item1[$i] = $itemObj;
            $i = $i + 1;
        }
        return json_encode($mainObj);
    }
}
generateXML();
echo parseData();
?>
    
Esempio n. 4
0
        }
        $fromsite = $localsite;
        $siteinfo = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $fromsite);
        $scores = explode(",", $siteinfo['siteglobalscore']);
        if (count($scores) == 0 || count($scores) == 1 && !is_numeric($scores[0])) {
            $scores = array($fromsite);
        }
        $judges = explode(",", $siteinfo['sitejudging']);
        if (count($judges) == 0 || count($judges) == 1 && !is_numeric($judges[0])) {
            $judges = array($fromsite);
        }
        $scores = array_unique(array_merge($scores, $judges));
        if (in_array(0, $scores)) {
            $scores = null;
        }
        $xml = generateXML($_SESSION["usertable"]["contestnumber"], $localsite, $scores, $reduced);
        if (isset($_POST['nopassword']) && $_POST['nopassword'] == 'true') {
            echo $xml;
        } else {
            echo rawurlencode($_POST['challenge']) . " " . encryptData($xml, $_POST['password']);
        }
        exit;
    }
}
ob_end_flush();
?>
<br>
<body onload="document.form1.name.focus()">
<script language="JavaScript" src="../sha256.js"></script>
<script language="JavaScript">
function computeHASH()
Esempio n. 5
0
        }
        $tasks = explode(",", $siteinfo['sitetasking']);
        if (count($tasks) == 0 || count($tasks) == 1 && !is_numeric($tasks[0])) {
            $tasks = array($fromsite);
        }
    } else {
        echo "<!-- <ERROR9> " . session_id() . " " . session_id() . " -->\n";
        exit;
    }
    if (isset($_POST) && isset($_POST['xml'])) {
        //		$fp=fopen('/tmp/aaa',"w"); fwrite($fp,$_POST['xml']); fclose($fp);
        $s = decryptData(rawurldecode($_POST['xml']), myhash($_SESSION["usertable"]["userpassword"]));
        //		$fp=fopen('/tmp/aaa1',"w"); fwrite($fp,$s); fclose($fp);
        $ac = array();
        $ac['SITEREC'] = array('site' => $fromsite, 'sitenumber' => 0, 'number' => 0, 'sitename' => 0, 'siteip' => 0, 'siteduration' => 0, 'sitelastmileanswer' => 0, 'sitelastmilescore' => 0, 'siteautoend' => 0, 'siteactive' => 0, 'sitescorelevel' => 0, 'sitepermitlogins' => 0, 'siteautojudge' => 0, 'sitenextuser' => 0, 'sitenextclar' => 0, 'sitenextrun' => 0, 'sitenexttask' => 0, 'sitemaxtask' => 0, 'sitechiefname' => 0, 'updatetime' => 0);
        $ac['SITETIME'] = array('site' => $fromsite, 'number' => 0, 'start' => 0, 'enddate' => 0, 'updatetime' => 0);
        $ac['USERREC'] = array('site' => $fromsite, 'user' => 0, 'number' => 0, 'username' => 0, 'usericpcid' => 0, 'userfull' => 0, 'userdesc' => 0, 'type' => 0, 'enabled' => 0, 'multilogin' => 0, 'userip' => 0, 'userlastlogin' => 0, 'userlastlogout' => 0, 'permitip' => 0, 'updatetime' => 0);
        $ac['CLARREC'] = array('site' => $judges, 'user' => 0, 'number' => 0, 'problem' => 0, 'question' => 0, 'clarnumber' => 0, 'clardate' => 0, 'clardatediff' => 0, 'clardatediffans' => 0, 'claranswer' => 0, 'clarstatus' => 0, 'clarjudge' => 0, 'clarjudgesite' => 0, 'updatetime' => 0);
        $ac['RUNREC'] = array('site' => $judges, 'user' => 0, 'number' => 0, 'runnumber' => 0, 'problem' => 0, 'lang' => 0, 'filename' => 0, 'filepath' => 0, 'rundate' => 0, 'rundatediff' => 0, 'rundatediffans' => 0, 'runanswer' => 0, 'runstatus' => 0, 'runjudge' => 0, 'runjudgesite' => 0, 'runjudge1' => 0, 'runjudgesite1' => 0, 'runanswer1' => 0, 'runjudge2' => 0, 'runjudgesite2' => 0, 'runanswer2' => 0, 'autoip' => 0, 'autobegindate' => 0, 'autoenddate' => 0, 'autoanswer' => 0, 'autostdout' => 0, 'autostderr' => 0, 'updatetime' => 0);
        $ac['TASKREC'] = array('site' => $tasks, 'user' => 0, 'desc' => 0, 'number' => 0, 'tasknumber' => 0, 'color' => 0, 'colorname' => 0, 'updatetime' => 0, 'filename' => 0, 'filepath' => 0, 'sys' => 0, 'status' => 0, 'taskdate' => 0, 'taskdatediff' => 0, 'taskdatediffans' => 0, 'taskstaffnumber' => 0, 'taskstaffsite' => 0);
        if (importFromXML($s, $ac, $_SESSION["usertable"]["contestnumber"])) {
            echo "<!-- <OK> -->";
        } else {
            echo "<!-- <NOTOK> -->";
        }
    }
    $xml = generateXML($_SESSION["usertable"]["contestnumber"], 0, $scores);
    echo encryptData($xml, myhash($_SESSION["usertable"]["userpassword"]));
} else {
    echo "<!-- <ERROR3> " . session_id() . " " . session_id() . " -->\n";
}
Esempio n. 6
0
<?php

require_once 'geneXML.php';
generateXML($_POST, $_SERVER);
/*如果全部运行完毕,发送邮件*/
$kissList = interXML(true);
require_once 'geneHTML.php';
if (sizeof($kissList) > 0) {
    //针对kissList过滤,移除全部正确用例
    $html = geneHTML($kissList);
    echo $html;
    require_once 'geneHistory.php';
    geneHistory($html);
    if (!Config::$DEBUG) {
        $_mails = explode('mail=', $_POST['config']);
        if (sizeof($_mails) == 2) {
            require_once 'smail.php';
            sendmail($html, true);
        }
        require_once 'config.php';
        Config::StopAll();
    }
}
function arrayToXML($array_in)
{
    $return = "";
    $attributes = array();
    foreach ($array_in as $k => $v) {
        if ($k[0] == "@") {
            // attribute...
            $attributes[str_replace("@", "", $k)] = $v;
        } else {
            if (is_array($v)) {
                $return .= generateXML($k, arrayToXML($v), $attributes);
                $attributes = array();
            } else {
                if (is_bool($v)) {
                    $return .= generateXML($k, $v == true ? "true" : "false", $attributes);
                    $attributes = array();
                } else {
                    $return .= generateXML($k, $v, $attributes);
                    $attributes = array();
                }
            }
        }
    }
    return $return;
}