protected function my_nonce_filed() { getOutput(function () { wp_nonce_field('my-nonce'); apply_filters('cf_add_to_form_filter', null); }); }
//token secret is stored to be used later $_SESSION['oauth_token_secret'] = $values['oauth_token_secret']; $url = 'https://11870.com/services/manage-api/authorize'; $authorizeUrl = $url . '?oauth_token=' . $values['oauth_token']; header('Location: ' . $authorizeUrl); } else { var_dump($values); } } else { if (isset($_REQUEST['oauth_token']) && isset($_REQUEST['oauth_verifier'])) { $oauthToken = $_REQUEST['oauth_token']; $oauthVerifier = $_REQUEST['oauth_verifier']; $url = 'https://11870.com/services/manage-api/access-token'; $params = array('oauth_consumer_key' => rawurlencode($appToken), 'oauth_token' => $oauthToken, 'oauth_signature_method' => rawurlencode('HMAC-SHA1'), 'oauth_timestamp' => rawurlencode(time()), 'oauth_nonce' => rawurlencode(uniqid()), 'oauth_version' => rawurlencode('1.0'), 'oauth_verifier' => $oauthVerifier); $signingKey = $appSecret . '&' . $_SESSION['oauth_token_secret']; $output = getOutput($url, $params, $signingKey); parse_str($output, $values); if (isset($values['oauth_token']) && isset($values['oauth_token_secret'])) { $oauthToken = $values['oauth_token']; $oauthTokenSecret = $values['oauth_token_secret']; echo sprintf('Auth success : token : %s', $oauthToken); } else { echo 'Auth failed'; } } } function buildSignatureBaseString($method, $url, $params) { $urlElements = parse_url($url); $signatureParams = array(rawurlencode(strtoupper($method)), rawurlencode(sprintf('%s://%s%s', $urlElements['scheme'], $urlElements['host'], $urlElements['path'])), rawurlencode(getOauthQueryString($params))); return implode('&', $signatureParams);
<?php include "airavata.php"; $projId = createProject("admin", "test"); echo var_dump($projId); $expId = createExperiment("admin", "exp5", $projId, "test", "{\"input1\":\"13\",\"input2\":\"3\",\"input3\":\"true\"}"); // $expId = "exp5_e7b826cf-a429-4b3e-b519-28d859fe4b64"; echo var_dump($expId); $res = launchExperiment($expId); echo var_dump($res); while (($status = get_experiment_status($expId)) != "COMPLETED") { echo "{$status}\n"; sleep(1); } $results = getOutput($expId); echo var_dump($results);
# USERS LIST RETURN ########################################################## case 'list': $num_page = !empty($_POST['num_page']) ? $_POST['num_page'] : 0; $nb_items = !empty($_POST['nb_items']) ? $_POST['nb_items'] : 30; $num_start = $num_page * $nb_items; # On recupere les informtions sur les membres $sql = 'SELECT user_id, user_fullname, user_email, user_status FROM ' . $core->prefix . 'user ORDER by lower(user_fullname) ASC LIMIT ' . $nb_items . ' OFFSET ' . $num_start; print getOutput($sql, $num_page, $nb_items); break; ########################################################## # DEFAULT RETURN ########################################################## ########################################################## # DEFAULT RETURN ########################################################## default: print '<div class="flash_error">' . T_('User bad call') . '</div>'; break; } } else { print 'forbidden'; } function getOutput($sql, $num_page = 0, $nb_items = 30)
$xdata .= '<tr>'; foreach ($row as $key => $val) { if (!strstr($key, "_xorder")) { $xdata .= '<td>' . getOutput($val, $type[$key]) . '</td>'; } } $xdata .= '</tr>'; } } /// if (!$xdata) { //putxt("select top(".$datatop.") ".$cols." from tb".$sttdatato.$tables_join." where ".($we?$we:"1").($_GET["octawhere"]?(" and ".$_GET["octawhere"]):"").$fcol); $sql = mssql_query("select top(" . $datatop . ") " . $cols . " from tb" . $sttdatato . $tables_join . " where (" . ($we ? $we : "1") . ")" . ($_GET["octawhere"] ? " and " . $_GET["octawhere"] : "") . $fcol); //$sql2=mssql_query("select count(*) from tb".$sttdatato." where ".$we); while ($row = mssql_fetch_array($sql, MSSQL_ASSOC)) { $xdata .= '<tr>'; foreach ($row as $key => $val) { if (!strstr($key, "_xorder")) { $xdata .= '<td>' . getOutput($val, $type[$key]) . '</td>'; } } $xdata .= '</tr>'; } } $sub = mssql_num_rows($sql); $xdata .= '<tr class="trfooter"><td>' . $sub . ' de ' . number_format($sub, 0, '', ".") . '</td></tr>'; echo $xdata; // end; // $datos[data]=$xdata; // $datos[total]=$sub; // echo json_encode($datos);
/** * Test both scripts (plain and golfed version) using the test framework * Check their output against the expected output * * @param int $nb the input argument (the number of keys) * @param string $expected the expected program output */ function testKeys($nb, $expected) { // Test the plain-code function it(sprintf('displays %d keys (plain version)', $nb), getOutput(function () use($nb) { keys_plain(2, [__FILE__, $nb]); }) === $expected); // Test the golfed function it(sprintf('displays %d keys (golfed version)', $nb), getOutput(function () use($nb) { keys_golfed(2, [__FILE__, $nb]); }) === $expected); }
} //$sql=mssql_query("select ".$cols." from tb".$searchto.$tables_join.($con?" where ".$con:"").$xorder." LIMIT 0, 200"); $result = $mysqli->query("select " . $cols . " from tb" . $searchto . $tables_join . ($con ? " where " . $con : "") . $xorder . " LIMIT 0, 200"); //$q="select count(*) from tb".$searchto.$tables_join.($con?" where ".$con:""); $result1 = $mysqli->query("select count(*) from tb" . $searchto . $tables_join . ($con ? " where " . $con : "")); //$sqlq="select top(200) ".$cols." from tb".$searchto.$tables_join.($con?" where ".$con:"").$xorder; //die("select count(*) from tb".$searchto.$tables_join.($con?" where ".$con:"")); //$sql2=mssql_query($q); //while(@$row=mssql_fetch_array($sql,MSSQL_ASSOC)){ while (@($row = $result->fetch_array(MYSQLI_ASSOC))) { ?> <tr><?php foreach ($row as $key => $val) { ?> <td><?php echo getOutput($val, $type); ?> </td><?php } ?> </tr><?php } //$sub=mssql_num_rows($sql); $sub = $result->num_rows; //$row=mssql_fetch_array($sql2); $row = $result1->fetch_array(MYSQLI_ASSOC); ?> <tr class="trfooter"> <td>Se muestran <?php echo $sub; ?>
/** * Given a piece of code that runs through all the printable characters using different steps (and wrapping), * compute the best value for the step (to match all the output conditions and minimize the score. * Display the value it founds as best, the score and the output of the program. * * Usage: * <code> * findBestOffset('for(;++$f<96;$T=($T+&)%95)echo chr(32+$T);') * </code> * * @param string $rawCode */ function findBestOffset($rawCode) { $solutions = []; $outputs = []; $count = 96; for ($k = 1; $k < $count; $k++) { if ($count % $k) { $code = str_replace('&', $k, $rawCode); $output = getOutput(function () use($code) { eval($code); }); $score = computeScore($output, $code); if (is_integer($score)) { $solutions[$code] = $score; $outputs[$code] = $output; } echo '.'; } } echo "\n"; asort($solutions); $bestK = array_keys($solutions)[0]; $score = $solutions[$bestK]; echo 'Best solution: <code>' . $bestK . '</code>, score=' . $score . "\n"; echo 'Output: <output>' . $outputs[$bestK] . "</output>\n"; }
function getResponse($box, $begin, $end, $insts, $instcats, $ppl, $prjs, $progs, $deps, $awards, $params, $paramcats, $platforms, $type, $limit = null, $offset = 0, $sort = null) { $query = buildQuery($box, $begin, $end, $insts, $instcats, $ppl, $prjs, $progs, $deps, $awards, $params, $paramcats, $platforms, $type, $limit, $offset, $sort); // if ($type == "paramcats") echo $query; error_log(preg_replace('/(\\n|\\t)+/', ' ', $query)); $results = sparqlSelect($query); if ($type == "datasets" || $type == "dataTable") { $count = getDatasetCount($box, $begin, $end, $insts, $instcats, $ppl, $prjs, $progs, $deps, $awards, $params, $paramcats, $platforms); } getOutput($results, $type, $limit, $offset, $count); }
if (isset($_REQUEST['full']) && $_REQUEST['full']) { getFullOutput($tracking); } else { if (isset($_REQUEST['terminate'])) { $terminate = $_REQUEST['terminate']; setTerminate($tracking, $terminate); } else { if (isset($_REQUEST['modelId'])) { $modelId = $_REQUEST['modelId']; getModel($tracking, $modelId); } else { if (isset($_REQUEST['retune']) && $_REQUEST['retune']) { retune($tracking); } else { if (!isset($_REQUEST['full']) || !$_REQUEST['full']) { getOutput($tracking); } } } } } } else { if (count($_REQUEST) > 0) { //tracking is not set and all parameters were not given //return error because required parameters were not given echo outputError("1000"); } } } function tune($uData, $bModel, $schedule, $parameters, $weather, $email) {
function displayFile($f, $n) { $output = getOutput($f, $n); echo "[033m {$output}"; }
<?php echo getOutput($_POST["script"] . ".php"); function getOutput($script) { ob_start(); include $script; $output = ob_get_contents(); ob_end_clean(); return $output; }
$c .= ($c ? "," : "") . "'' as " . $col; $ct[] = "vnarchar"; } } } //busco primero si coicide solo el codigo if (!$searchvalue) { $sql = mssql_query("select top(1) " . $c . " from tbproductos order by existstencia_pro desc"); } else { $sql = mssql_query("select top(1) " . $c . " from tbproductos where codigo_pro like '" . $searchvalue . "'"); } if (mssql_num_rows($sql) != 1) { $data = explode("+", $searchvalue); $sq = ""; foreach ($data as $val) { $sq .= ($sq ? " and " : "") . "(codigo_pro like '%" . $val . "%' or nombre_pro like '%" . $val . "%' or descripcion_pro like '%" . $val . "%')"; } $sql = mssql_query("select top(50) " . $c . " from tbproductos where " . $sq); } while ($row = mssql_fetch_array($sql, MSSQL_ASSOC)) { echo '<tr>'; $key = 0; foreach ($row as $val) { echo '<td ' . ($row[existencia_pro] <= 0 || $row[precio1_pro] < 0 ? "style=\"color:red\"" : "style=\"color:green\"") . '>' . getOutput($val, $ct[$key++]) . '</td>'; } echo "</tr>"; } break; } } /// si se va a agregar una nueva funcion llamenla por el nombre a traves de la variable get elemplo if($operacion){ ejecuta }
// http://code.google.com/p/yupp/issues/detail?id=147 if (YuppConfig::getInstance()->getCurrentMode() === YuppConfig::MODE_PROD) { ?> Disculpe las molestias, verificaremos el error en breve. <?php // TODO: esto deberia estar en Logger // log a disco /* if (!file_exists('_manage_errors')) { mkdir('_manage_errors', 755); } */ if (file_exists('ylogs/500')) { FileSystem::write('ylogs/500/err_' . date("Ymd.his") . '.log', getOutput($m, true)); } ?> <?php } else { ?> <div class="text"> <?php echo getOutput($m); ?> </div> <?php } ?> </div> </body> </html>