Exemplo n.º 1
0
    // Radio buttons to select output type
    $cal_text .= "<tr>\n\t<td class='forumheader3'>" . EC_LAN_158 . "</td>\n\t<td class='forumheader3' style='text_align:center'>";
    $cal_text .= "\n\t<input type='radio' name='output_type' value='display' checked='checked' /> " . EC_LAN_159 . "<br />\n\t<input type='radio' name='output_type' value='print' /> " . EC_LAN_160 . "<br />";
    if ($ec_enable_pdf) {
        $cal_text .= "<input type='radio' name='output_type' value='pdf' /> " . EC_LAN_161;
    }
    $cal_text .= "</td></tr>";
    $cal_text .= "<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='set_dates' value='" . EC_LAN_156 . "' /></td></tr>";
    $cal_text .= "</table></form></div>";
    $ns->tablerender(EC_LAN_150, $cal_text);
    require_once FOOTERF;
    exit;
}
if (!is_numeric($ec_start_date = decode_date($ec_qs[0], FALSE))) {
    $message = $ec_start_date;
} elseif (!is_numeric($ec_end_date = decode_date($ec_qs[1], TRUE))) {
    $message = $ec_end_date;
} elseif ($ec_start_date >= $ec_end_date) {
    $message = EC_LAN_151;
} elseif ($ec_end_date - $ec_start_date > 366 * 86400) {
    $message = EC_LAN_152;
}
// That's the vetting of the query done (as much as we'll do)
if ($message !== "") {
    require_once HEADERF;
    $ns->tablerender(EC_LAN_80, $message);
    require_once FOOTERF;
    exit;
}
$calSc->catFilter = $cat_filter;
// Category filter
Exemplo n.º 2
0
function extract_bets_foratotal(&$tournir_node, $html, $sport_sign, $tournir_id, $category_id)
{
    $i = 0;
    $filename_headers = "phrases/bwin/{$sport_sign}.headers.txt";
    $filename_labels = "phrases/bwin/{$sport_sign}.labels.txt";
    $phrases_headers = file_get_hash($filename_headers);
    $phrases_labels = file_get_hash($filename_labels);
    $html = kill_space($html);
    $html = numbering_tag($html, 'tr');
    $table_rows = extract_all_numbered_tags($html, 'tr', 'class');
    //  file_put_contents("lines/bwin/$tournir_id.Total.html", $html);
    foreach ($table_rows as $row) {
        $row = kill_property($row, 'TagNo');
        $header = copy_be($row, '<tr', '>');
        $row_class_name = extract_property_values($header, 'class', null);
        if ($row_class_name == 'topbar') {
            // разбираем дату
            $row = copy_between($row, '<h3>', '</h3>');
            list($day_no, $month_no, $year_no) = decode_date($row);
        } elseif (in_array($row_class_name, array('def', 'alt'))) {
            // игроки + время
            if (preg_match('/<td.*>(<h4>)*?(.+) - (.+) - (\\d{1,2}:\\d\\d (PM|AM))(.*?)(<\\/h4>)*?</Ui', $row, $matches)) {
                $gamer1_name = utf8_to_ansi_ce($matches[2]);
                $gamer2_name = utf8_to_ansi_ce($matches[3]);
                list($hour, $minute) = decode_time($matches[4]);
            } elseif (preg_match('/<td.*>(<h5>)*?(.+)(<\\/h5>)*?</iU', $row, $matches)) {
                $phrase = utf8_to_ansi_ce($matches[2]);
                unset($bettype);
                $phrase = str_ireplace($gamer1_name, 'Gamer1', $phrase);
                $phrase = str_ireplace($gamer2_name, 'Gamer2', $phrase);
                $bettype_str = $phrases_headers[$phrase];
                if ($bettype_str) {
                    foreach (explode(';', $bettype_str) as $bet_pair) {
                        list($key, $value) = explode('=', $bet_pair);
                        $bettype[$key] = $value;
                    }
                } else {
                    $bettype['Modifier'] = 'Unknown';
                    $phrases_headers[$phrase] = 'Modifier=Unknown';
                    $phrases_headers_modified = true;
                }
            }
        } elseif ($row_class_name == 'normal' and $bettype) {
            // основная ставка
            if (!in_array($bettype['Modifier'], array('Ignore', 'Unknown'))) {
                $tables = extract_all_tags($row, '<table', '</table>');
                foreach ($tables as $table) {
                    list($label, $koef) = extract_label_koef($table);
                    $label = str_ireplace($gamer1_name, 'Gamer1', $label);
                    $label = str_ireplace($gamer2_name, 'Gamer2', $label);
                    // подбираем формат фразы метки
                    $modifier = $phrases_labels[$label];
                    if ($modifier) {
                        foreach (explode(';', $modifier) as $bet_pair) {
                            list($key, $value) = explode('=', $bet_pair);
                            $bettype[$key] = $value;
                        }
                    } else {
                        $bettype['Modifier'] = 'Unknown';
                        $phrases_labels[$label] = 'Modifier=Unknown';
                        $phrases_labels_modified = true;
                    }
                    if (!in_array($bettype['Modifier'], array('Ignore', 'Unknown'))) {
                        $event_node = event_find_or_create($tournir_node, mktime($hour, $minute, 0, $month_no, $day_no, $year_no), $gamer1_name, $gamer2_name);
                        $bet_node = $event_node->addChild('Bet');
                        foreach ($bettype as $key => $value) {
                            $bet_node->addAttribute($key, $value);
                        }
                        $bet_node->addAttribute('Koef', $koef);
                    }
                    unset($bettype['Modifier']);
                }
            }
        }
        $i++;
    }
    // отбираем новые и складываем их в новый файл
    if ($phrases_headers_modified) {
        $file_hash = file_get_hash($filename_headers);
        foreach ($file_hash as $key => $value) {
            unset($phrases_headers[$key]);
        }
        file_put_hash($filename_headers . '.new', $phrases_headers + file_get_hash($filename_headers . '.new'));
    }
    if ($phrases_labels_modified) {
        $file_hash = file_get_hash($filename_labels);
        foreach ($file_hash as $key => $value) {
            unset($phrases_labels[$key]);
        }
        file_put_hash($filename_labels . '.new', $phrases_labels + file_get_hash($filename_labels . '.new'));
    }
}