コード例 #1
0
ファイル: library.php プロジェクト: maximeag/help
function post_assoc_alert_question($id_alert, $id_question, $post, $db)
{
    if ($post['response']) {
        $q = $db->prepare('SELECT id_yes as id FROM questions WHERE id = :id');
    } else {
        $q = $db->prepare('SELECT id_no as id FROM questions WHERE id = :id');
    }
    $q->execute(array('id' => $id_question));
    $next_question = $q->fetch(PDO::FETCH_ASSOC);
    $q = $db->prepare('SELECT * FROM assoc_alert_question (id_alert, id_question) VALUES (:id_alert, :id_question)');
    $q->execute(array('id_alert' => $id_alert, 'id_question' => $next_question['id']));
    return status_ok($next_question);
}
コード例 #2
0
//Failure:
//$ret = $index->update(); //no arguments
//$ret = $index->update('K40'); //no arguments update
//$ret = $index->update('K40', array('u' => array('K40', 'V40'))); //operator Invalid
status_ok('HandlerSocketIndex:update', $ret);
//Delete data
//Success:
status_ok('HandlerSocketIndex:remove', $index->remove('K40'));
//status_ok('HandlerSocketIndex:remove', $index->remove(array('=' => 'K40')));
//status_ok('HandlerSocketIndex:remove', $index->remove(array('K40')));
//Failure:
//$ret = $index->remove(); //no arguments
//Perform multiple operations
// Success:
$ret = $index->multi(array(array('find', 'k0'), array('insert', array('k0', 'vv0')), array('find', array('k0')), array('update', array('=' => 'k0'), array('U' => array('k0', '^^0'))), array('find', array('=' => 'k0')), array('update', 'k0', array('k0', '0xx0')), array('find', 'k0'), array('update', 'k0', array('U?' => array('k0', '0---0'))), array('find', array('k0')), array('remove', array('=' => 'k0')), array('find', array('=' => 'k0'))));
status_ok('HandlerSocketIndex:multi', $ret);
unset($ret);
//Failure:
//$ret = $index->multi(); //no arguments
//$ret = $index->multi(''); //argument empty
//$ret = $index->multi(null); //argument NULL
//$ret = $index->multi(array()); //an empty array
//$ret = $index->multi(array('insert', 'ke', 've')); //array Invalid
//$ret = $index->multi(array(array())); //empty array * 2
//$ret = $index->multi(array(array('insert'))); //array Invalid
echo PHP_EOL;
echo '__RESULT__', PHP_EOL;
var_dump(isset($ret) ? $ret : null);
echo '__ERROR__', PHP_EOL;
var_dump(isset($hs) ? $hs->getError() : null);
var_dump(isset($index) ? $index->getError() : null);
コード例 #3
0
ファイル: feed.php プロジェクト: buggithubs/selfoss
}
$repo_url = "https://api.github.com/repos/{$username}/{$repo_name}";
$list_url = $repo_url . "/git/refs/tags/";
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'selfoss.aditu.de/feed.php (tobias.zeising@aditu.de)');
curl_setopt($curl, CURLOPT_URL, $repo_url);
$response = curl_exec($curl);
if (!status_ok($curl)) {
    header("HTTP/1.1 404 Not Found");
    exit("Repository doesn't exist or is private." . $response);
}
$repo = json_decode($response, true);
curl_setopt($curl, CURLOPT_URL, $list_url);
$response = curl_exec($curl);
if (!status_ok($curl)) {
    header("HTTP/1.1 404 Not Found");
    exit("No tags for this repository yet.");
}
$tag_refs = array_reverse(json_decode($response, true));
$tags = array();
foreach ($tag_refs as $tag) {
    //only match version tags
    //if(preg_match('~/v\d+(\.\d+)*$~', $tag["ref"])) {
    curl_setopt($curl, CURLOPT_URL, $tag["object"]["url"]);
    $tags[] = json_decode(curl_exec($curl), true);
    //}
}
curl_close($curl);
function escape(&$var)
{