Example #1
0
<?php 
// Grids
echo getGrids($_SESSION['TourId']);
?>
</table>
</div>

<div id="AwaDiv">
<div class="Title" style="cursor:pointer" onclick="this.nextElementSibling.style.display=(this.nextElementSibling.style.display=='none'?'table':'none')"><?php 
print get_text('ScheduleAwards', 'Boinx');
?>
</div>
<table class="Tabella">
<?php 
// Awards
echo getAwards($_SESSION['TourId']);
?>
</table>
</div>

<?php 
include 'Common/Templates/tail.php';
function getExtra($TourId)
{
    $QuaSes = 0;
    $ret = '<tr valign="top">';
    // select all the possible feeds...
    $ret .= '<td colspan="4"><table cellpadding="0" cellspacing="0" border="0" width="100%">';
    // Qualifications IND (Div and Class)
    $q = safe_r_sql("select distinct QuSession, BsType, left(BsExtra, 1) as BsSession, substr(BsExtra, 2) as BsTargetNo\n\t\t\tfrom Qualifications\n\t\t\tinner join Entries on EnId=QuId and EnTournament={$TourId}\n\t\t\tleft join BoinxSchedule on EnTournament=BsTournament and BsType=concat_ws('_', 'Qua', 'Ind')\n\t\t\twhere QuSession!='0'\n\t\t\torder by QuSession");
    $ret .= '<tr><th colspan="' . (safe_num_rows($q) + 2) . '">' . get_text('Session') . "</th></tr>\n";
function getPlayerInfo($href)
{
    //$href = "playerpage.htm?ilkid=ALLENMAR01";
    //$href = "playerpage.htm?ilkid=ARRINLAV01";
    $debug = false;
    $base_url = "http://databasefootball.com/players/";
    //echo "href: $href<br>";
    //echo "$base_url $href<br>";
    $p_url = $base_url . $href;
    //echo "player url: $p_url<br>";
    $player_page = file_get_html($p_url);
    $bio = $player_page->find('font.bio', 0);
    //echo var_dump($bio);
    $plaintext = $bio->plaintext;
    $innerText = $bio->innerText;
    //echo "innerText: $innerText<br>";
    echo "Plaintext: {$plaintext}<br>";
    $plaintext = preg_replace("(\\'\\')", "\"", $plaintext);
    $plaintext = preg_replace("(\\')", "\\'", $plaintext);
    $fullName = $position = $height = $weight = $dob = $hometown = $college = $drafted = $nickname = "null";
    $fullName = getAttribute($plaintext, "", "Position:");
    if (preg_match("/Full Name:/", $plaintext)) {
        if (!(strpos($fullName, "Full Name:") === false)) {
            $fullName = getAttribute($plaintext, "Full Name:", "Position:");
        }
    }
    if (preg_match("/\\(*\\)/", $fullName)) {
        $nickname = getAttribute($plaintext, "(", ")");
    }
    //echo "FullName: $fullName<br>";
    if (preg_match("/Position:/", $plaintext)) {
        if (preg_match("/Height:/", $plaintext)) {
            $position = getAttribute($plaintext, "Position:", "Height:");
        } else {
            $position = getAttribute($plaintext, "Position:", "Born:");
        }
    }
    if (preg_match("/Height:/", $plaintext)) {
        $height = getAttribute($plaintext, "Height:", "Weight:");
    }
    if (preg_match("/Weight:/", $plaintext)) {
        $weight = getAttribute($plaintext, "Weight:", "Born:");
    }
    if (preg_match("/Born:/", $plaintext)) {
        if (preg_match("/, in/", $plaintext)) {
            $dob = getAttribute($plaintext, "Born:", ", in");
            $hometown = getAttribute($plaintext, ", in", "High School:");
        } else {
            if (preg_match("/High School:/", $plaintext)) {
                $dob = getAttribute($plaintext, "Born:", "High School:");
                $dob = preg_replace("/,/", "", $dob);
            } else {
                $dob = getAttribute($plaintext, "Born:", "");
            }
        }
        $dob = preg_replace("/,/", "", $dob);
    }
    if (preg_match("/College:/", $plaintext)) {
        $college = getAttribute($plaintext, "College:", "Drafted");
    }
    if (preg_match("/Drafted:/", $plaintext)) {
        $drafted = getAttribute($plaintext, "Drafted:", "");
    }
    //$fullName = $player_page->find("a h1")->plaintext;
    $header = $player_page->find("a[name] h1", 0);
    $fullName = $header->plaintext;
    //Jerry Da prato
    //John Smith
    //La var Arrington
    $fullName = preg_replace("/[[:space:]]([A-Z])/", " !\$1", htmltrim($fullName));
    $fullName = preg_replace("(\\')", "\\'", $fullName);
    //echo var_dump($fullName)."<br>";
    $name_array = explode(' !', $fullName);
    $first = $name_array[0];
    $last = $name_array[1];
    //echo "trs: ".var_dump($player_page->find('table tr[onmouseover]'));
    $teams = getTeams($player_page->find('table tbody tr td table tbody tr[onmouseover]'));
    //echo "Name: $fullName<br>";
    if ($debug) {
        echo "plaintext: {$plaintext}<br>";
        echo "nickName: {$nickname}<br>";
        echo "Position: '{$position}'<br>";
        echo "height: {$height}<br>";
        echo "weight: {$weight}<br>";
        echo "dob: {$dob}<br>";
        echo "hometown: {$hometown}<br>";
        echo "college: {$college}<br>";
        echo "drafted: {$drafted}<br>";
        echo "teams: {$teams}<br><br>";
    }
    $insert = "INSERT INTO players (\r\n\t\t\t\tfirst_name, last_name, height, weight, dob, position, team, college, hometown, drafted, nickname) \r\n\t\t\t\tVALUES('{$first}', '{$last}', '{$height}', {$weight}, '{$dob}', '{$position}', '{$teams}', '{$college}', '{$hometown}', '{$drafted}', '{$nickname}')";
    preg_replace("/''/", "'", $insert);
    echo $insert . "<br>";
    //$result = mysql_query($insert);
    $id = mysql_insert_id();
    /***********************
    	///awards section
    	/***********************/
    getAwards($id, $player_page->find('td p font.bio', 0));
    //->find('a[href^=/awards]')
}
Example #3
0
 /********************************
  * Process 'Awards'
  ********************************/
 ErrorLog("Processing Award Data (" . $data["pID_{$x}"] . ")", 3);
 // Check if Minimal Central Update
 $awdsReqComplete = $cfg->get('stats_awds_complete');
 if ($centralupdate == 2) {
     // Ignore any Award Data in SnapShot as this could mess up current data
     $complete = 0;
     $awdsReqComplete = 1;
 }
 if ($complete || !$awdsReqComplete) {
     // Check Backend Awards
     checkBackendAwards();
     $awards = array();
     getAwards();
     if (count($awards)) {
         for ($i = 0; $i < count($awards); $i += 2) {
             if ($awards[$i] > 2000000 && $awards[$i] < 3000000) {
                 $query = "SELECT level FROM awards WHERE (id = " . $data["pID_{$x}"] . ") AND (awd = {$awards[$i]})";
             } else {
                 $query = "SELECT level FROM awards WHERE (id = " . $data["pID_{$x}"] . ") AND (awd = {$awards[$i]}) AND (level = " . $awards[$i + 1] . ")";
             }
             $result = mysql_query($query);
             checkSQLResult($result, $query);
             if (!mysql_num_rows($result)) {
                 if ($awards[$i] > 2000000 && $awards[$i] < 3000000) {
                     $first = time();
                 } elseif ($awards[$i] < 2000000 && $awards[$i + 1] > 1) {
                     $first = 0;
                     // Need to do extra work for Badges as more than one badge per round may have been awarded