Exemple #1
0
 /**
  * retrieve next playbyplayID
  * @return [type] [description]
  */
 public function getNext(Playbyplay $pbp)
 {
     $match_id = $pbp - getMatch()->getId();
     //$all = $this->getDoctrine()->getManager()->getRepository('PowersmashIOSPlayBundle:Play')->listPlay($match_id);
     $rsm = new ResultSetMapping();
     $rsm = getScalarResult('id', 'id');
     $this->getDoctrine()->getManager()->createNativeQuery('SELECT * FROM playbyplay WHERE match_id = ?', $rsm)->setParameter(1, $pbp->getMatch()->getId())->getResult();
     return $rsm;
 }
Exemple #2
0
/**
 * Get a team name from an ID. Also optionally return a "pending" notice that tells
 * the reader what match will determine which player goes in this slot.
 * 
 * @todo I bet this could be coded better
 * @param int $needle team ID to search for
 * @param array $haystack raw challonge payload
 * @param int $pending ID of match we are waiting on
 * @param boolean $pending_loser if true, we want the pending match's loser
 * @return string name of team, or HTML chunk describing what we're waiting on.
 */
function getName($needle, $haystack, $pending = null, $pending_loser = null)
{
    if (is_null($needle)) {
        $d = getMatch($pending, $haystack);
        $who = "<em>" . ($pending_loser ? "Winner of " : "Loser of ") . "</em>";
        return $who . $d['identifier'] . ' <small>Match ID <a href="#match_' . $d['id'] . '">' . $d['id'] . "</a></small>";
    }
    foreach ($haystack['participants'] as $i => $data) {
        if ($data['participant']['id'] == $needle) {
            return $data['participant']['name'];
        }
    }
}
function lzmatch_request()
{
    $ak = getAccessToken();
    if ($ak) {
        $matchKey = $_REQUEST['key'];
        $matchData = getMatch($ak, $matchKey, 'full_card');
        wp_send_json(array('data' => $matchData));
        exit;
    } else {
        setAccessToken();
        $ak = getAccessToken();
        if ($ak) {
            lzmatch_request();
        } else {
            die('Error');
        }
    }
}
$patterns[] = array("pattern" => "/SCM Checkins associated SCM user/i", "status" => 'scm_checkin_associated', "set_user" => false);
$patterns[] = array("pattern" => "/Support email \\(subject:.*\\) associated.*/i", "status" => 'email_associated', "set_user" => false);
$patterns[] = array("pattern" => "/Support email \\(subject:.*\\) disassociated.*/i", "status" => 'email_disassociated', "set_user" => false);
$patterns[] = array("pattern" => "/Outgoing email sent by (.*)/i", "status" => 'email_sent', "set_user" => true);
$patterns[] = array("pattern" => "/Time tracking entry removed by (.*)/i", "status" => 'time_removed', "set_user" => true);
$patterns[] = array("pattern" => "/Time tracking entry submitted by (.*)/i", "status" => 'time_added', "set_user" => true);
$patterns[] = array("pattern" => "/Time tracking entry submitted remotely by (.*)/i", "status" => 'remote_time_added', "set_user" => true);
// loop through all history without a status
$sql = "SELECT\n            his_id,\n            his_summary\n        FROM\n            " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_history\n        WHERE\n            his_htt_id = ''";
//$sql .= " AND his_summary LIKE 'Time tracking entry submitted remotely by %' LIMIT 10";
$result = $GLOBALS["db_api"]->dbh->getAll($sql, DB_FETCHMODE_ASSOC);
$updated = 0;
$skipped = 0;
foreach ($result as $row) {
    echo $row["his_summary"] . "<br />";
    $match = getMatch($row["his_summary"]);
    if ($match) {
        update($row["his_id"], $match);
        $updated++;
    } else {
        $skipped++;
    }
}
echo "Updated: {$updated}<br />\nSkipped: {$skipped}";
function getMatch($desc)
{
    global $patterns;
    $return = array();
    foreach ($patterns as $id => $data) {
        if (preg_match($data["pattern"], $desc, $matches)) {
            $return["status"] = $data["status"];
Exemple #5
0
<?php

//url
$url = 'http://www.imdb.com/title/tt0367882/';
//get the page content
$imdb_content = getData($url);
//parse for product name
$name = getMatch('/<title>(.*)<\\/title>/isU', $imdb_content);
$director = strip_tags(getMatch('/<h5[^>]*>Director:<\\/h5>(.*)<\\/div>/isU', $imdb_content));
$plot = getMatch('/<h5[^>]*>Plot:<\\/h5>(.*)<\\/div>/isU', $imdb_content);
$release_date = getMatch('/<h5[^>]*>Release Date:<\\/h5>(.*)<\\/div>/isU', $imdb_content);
$mpaa = getMatch('/<a href="\\/mpaa">MPAA<\\/a>:<\\/h5>(.*)<\\/div>/isU', $imdb_content);
$run_time = getMatch('/Runtime:<\\/h5>(.*)<\\/div>/isU', $imdb_content);
//build content
$content .= '<h2>Film</h2><p>' . $name . '</p>';
$content .= '<h2>Director</h2><p>' . $director . '</p>';
$content .= '<h2>Plot</h2><p>' . substr($plot, 0, strpos($plot, '<a')) . '</p>';
$content .= '<h2>Release Date</h2><p>' . substr($release_date, 0, strpos($release_date, '<a')) . '</p>';
$content .= '<h2>MPAA</h2><p>' . $mpaa . '</p>';
$content .= '<h2>Run Time</h2><p>' . $run_time . '</p>';
$content .= '<h2>Full Details</h2><p><a href="' . $url . '" rel="nofollow">' . $url . '</a></p>';
echo $content;
//gets the match content
function getMatch($regex, $content)
{
    preg_match($regex, $content, $matches);
    return $matches[1];
}
//gets the data from a URL
function getData($url)
{
Exemple #6
0
foreach ($aPage as $k => $v) {
    if ($v['draft'] == 0) {
        $tpl->assign('content', crbr('<div style="font-size: 90%; margin-bottom: 8px;"><a href="' . $sRequest . '/' . $v['key'] . '">' . $v['title'] . '</a><br />' . $v['annotation'] . '</div>'));
    }
}
include_once FLGR_COMMON . '/stemmers.php';
if (isset($_GET['q'])) {
    $tpl->assign('search_query', $q);
    $_t->assign('search_query', $q);
    // Разбиваем на слова
    $aWords = preg_split("/[\\s\\W]+/", $q, -1, PREG_SPLIT_NO_EMPTY);
    // Формируем прямой запрос
    $q = implode(' ', $aWords);
    cStat::bSaveEvent(EVENT_SEARCH, $q);
    // Ищем в страницах
    $aMatch = getMatch($q);
    // Ищем в новостях
    $aMatchNews = getMatchNews($q);
    // Сливаем результаты
    $aOutMatch = array_merge($aMatch, $aMatchNews);
    // Сортируем по релевантности
    uasort($aOutMatch, 'relcmp');
    // Выводим
    foreach ($aOutMatch as $k => $v) {
        $tplSearchResults = $tpl->fetchBlock('SearchResults');
        $tplSearchResults->assign($v);
        $tplSearchResults->assign('path', $k);
        $tpl->assign('SearchResults', $tplSearchResults);
        $tplSearchResults->reset();
    }
    // Формируем стемминг-запрос
Exemple #7
0
    }
}
//$w = new worker();
//$w->count = 1;
//$w->is_once = true;
//利用后台线程来爬取数据,不能在 web 环境中运行
//$count = 20;        // 每个进程循环多少次
//$w->on_worker_start = function($worker) use ($count) {
//  for ($i = 0; $i < $count; $i++)
//  {
//      $worker->log('后台进程'.$i.'已经启动');
sleep(5);
$baseUri = "http://cbadata.sports.sohu.com/sch/all/";
$urls = getItems($baseUri);
for ($i = 0; $i < count($urls); $i++) {
    $result = getMatch($urls[$i]);
    if (count($result) == 0) {
        continue;
    }
    var_dump($result);
    savaCbaData($result);
}
//        getMatch($urls[127]);
//        $urls = removeRepeit($urls);
//      if($urls<= 0){
//          break;
//      }
//      for($j = 0; $j < count($urls); $j++){
//          $result = getItemdetails($urls[$j]);
//          saveData($result);
// print_r($result);
Exemple #8
0
<?php

require_once '../../classes/db/DB.class.php';
//require_once '../../classes/controller/UserTools.class';
//todo: make it query the database for match of strengths/weaknesses
//implementation on front-end: call the api in a for-loop to get
//x number of matches
function getMatch()
{
    $db = new DB();
    $db->connect();
    //$userTools = new UserTools();
    if (!isset($_GET['apikey'])) {
        echo "bad api key";
        return NULL;
    }
    if (isset($_GET['userID'])) {
        $id = $_GET['userID'];
        $data = $db->select('users', "id = {$id}");
        //$data = $userTools->get($id);
    } elseif (isset($_GET['name'])) {
        $name = $_GET['name'];
        //$data = $userTools->getByName($name);
        $data = $db->select('users', "name = {$name}");
    }
    echo json_encode($data);
}
getMatch();
Exemple #9
0
 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License 3
 * @author Sylae Jiendra Corell <*****@*****.**>
 */
require_once 'config.php';
require_once 'sorts.php';
require_once 'misc.php';
$debug = array();
$data = json_decode(file_get_contents("https://api.challonge.com/v1/tournaments/" . $config['challonge_id'] . ".json?api_key=" . $config['challonge_api'] . "&include_participants=1&include_matches=1"), true)['tournament'];
if (array_key_exists('match', $_POST)) {
    $debug['http_post'] = $_POST;
    // filter time!
    $p = array();
    foreach ($_POST as $k => $v) {
        $p[$k] = is_numeric($v) ? (int) $v : "";
    }
    $m = getMatch($p['match'], $data);
    $score = array();
    $p1w = 0;
    $p2w = 0;
    // round 1
    if ($p['p1r1'] > $p['p2r1']) {
        $p1w++;
    } else {
        $p2w++;
    }
    $score[1] = $p['p1r1'] . "-" . $p['p2r1'];
    // round 2
    if (is_int($p['p1r2']) && is_int($p['p2r2'])) {
        if ($p['p1r2'] > $p['p2r2']) {
            $p1w++;
        } else {
Exemple #10
0
<?php

session_start();
require "pdo.php";
$userID = $_SESSION["userID"];
$rows = getMatch($userID);
header('Content-Type: application/json');
if ($rows != 0) {
    $rows = json_encode($rows);
}
echo $rows;
<?php

$method = $_POST['method'];
if ($method == "getRegions") {
    getRegions();
} else {
    if ($method == "getMatch") {
        getMatch($_POST['region'], $_POST['match_id']);
    }
}
/**
 * Function returns all regions analysed
 * Scan directory
 * @return Array with regions
 */
function getRegions()
{
    $dir = 'resources/bilgewater_matchID';
    $files = array_diff(scandir($dir), array('..', '.'));
    $regions = array();
    foreach ($files as $file) {
        array_push($regions, strtolower(explode(".", $file)[0]));
    }
    echo json_encode($regions);
}
/**
 * Function returns stats for one game
 * Launch a request to RIOT API
 * Update BDD
 */
function getMatch($region, $id)