function extract_league($Html) { $Html = extract_tags($Html, '<input', '>', "\r\n", 'catm[]'); $Html = delete_all($Html, '<', 'name='); $Html = delete_all($Html, '"', '>'); $Html = replace_all($Html, '[]', '"', '[]='); return $Html; }
function kill_tag($Html, $Tag) { $Tags = explode('|', $Tag); foreach ($Tags as $t) { $Html = replace_all($Html, "<{$t} ", '>', "<{$t}>"); $Html = delete_all($Html, "<{$t}>", "</{$t}>"); } return $Html; }
function extract_league($Html) { $Html = copy_be($Html, '<form id="fbets"', '</form>'); $Html = replace_all($Html, 'долгосрочные ставки', '</form>', '</form>'); $Html = extract_tags($Html, '<input', '>', "\r\n", 'name=', 'value='); $Html = delete_all($Html, '<input', 'name='); $Html = str_ireplace(' value="', '=', $Html); $Html = str_ireplace('">', '', $Html); return $Html; }
function extract_bet($Html) { // Разбираемся с концами строк $Html = str_ireplace("\n", '<br>', $Html); $Html = str_ireplace("\r", '<br>', $Html); $Html = copy_be($Html, '<form name=f1>', '</form>'); $Html = str_ireplace(' ', ' ', $Html); $Html = kill_tag_bound($Html, 'input|itemevent|a|b'); $Html = str_ireplace(' noshade', '', $Html); $Html = kill_property($Html, 'time|color'); $Html = replace_all($Html, '<sup>', '</sup>', ' '); $Html = kill_tag($Html, 'big'); $Html = str_ireplace('<endpreview/>', '', $Html); $Html = str_ireplace('<hr><br>', '<hr>', $Html); $Html = str_ireplace('<br>Оглавление<', '<', $Html); $Html = str_ireplace('<br>Оглавление<', '<', $Html); $Html = replace_all($Html, '<u>', '</form>', '</form>'); $Html = kill_tag_bound($Html, 'u|form'); $Html = delete_all($Html, '<span ', '</span>', 'maxcap'); return $Html; }
function extract_bet($Html) { $Html = copy_be($Html, '<form name=f1', '</form>', 'Дома'); $Html = kill_space($Html); $Html = kill_tag($Html, 'script'); $Html = kill_tag_bound($Html, 'b|a|tbody|small|colgroup'); // <!-- Выносим Экспресы и информацию о предыдущих встречах --> $Html = str_ireplace('<span class=tr>1</span>', '', $Html); $Html = delete_all($Html, '<tr>', '</tr>', '<span class=tr>'); $Html = delete_all($Html, '<span class=n>', '</span>'); // <!-- Убираем строки с кнопками --> $Html = delete_all($Html, '<table ', '</table>', '<input '); // <!-- Заменяем IMG с информацией на igif для последующего удаления --> $Html = replace_all($Html, '<img ', '>', "igif"); // <!-- Убираем левые коэффициенты в скобках --> $Html = replace_all($Html, '>(', ')', '>'); // <!-- Убираем оглавление --> $Html = delete_all($Html, "<div ", "</div", "Оглавление"); $Html = kill_property($Html, 'width|border'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', '>Хозяева|' . '>Гости|' . '>Фолы|' . '>ж/к|' . '>угл.'); return $Html; }
function make_request($Url, $Method = "GET", $Referer, $PostData, &$host, &$port) { global $login; $URI = parse_url($Url); $PostData = replace_all($PostData, '[{<', '>}]', ''); switch ($URI['scheme']) { case 'https': $URI['scheme'] = 'ssl'; $URI['port'] = 443; $host = $URI['scheme'] . '://' . $URI['host']; break; case 'http': default: $URI['scheme'] = ''; $URI['port'] = 80; $host = $URI['host']; } $cookiehost = $URI['host']; if ($login) { $cookiehost = $login . '_' . $cookiehost; } if ($URI['port']) { $port = $URI['port']; } // generate headers in array. $Header = array(); $Path = $URI['path']; if ($URI['query']) { $Path .= '?' . $URI['query']; } if ($Method == 'GET' and $PostData) { $Path = $URI['path'] . '?' . $PostData; } $Header[] = $Method . ' ' . $Path . ' HTTP/1.1'; if ($URI['port'] == 443) { $Header[] = 'Host: ' . $URI['host']; $Header[] = 'User-Agent: User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)'; $Header[] = 'Accept: text/html'; $Header[] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3'; $Header[] = 'Accept-Encoding: gzip,deflate'; $Header[] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7'; $Header[] = 'Keep-Alive: 300'; $Header[] = 'Referer: ' . $Referer; $Header[] = 'Connection: Close'; } else { $Header[] = 'Host: ' . $host . ':' . $port; $Header[] = 'User-Agent: User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)'; $Header[] = 'Accept: text/html'; $Header[] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3'; $Header[] = 'Accept-Encoding: gzip,deflate'; $Header[] = 'Accept-Charset: utf-8;q=0.7,*;q=0.7'; $Header[] = 'Keep-Alive: 300'; $Header[] = 'Proxy-Connection: keep-alive'; $Header[] = 'Referer: ' . $Referer; $Header[] = 'Connection: Close'; } if (file_exists("cookies/{$cookiehost}.txt")) { $Header[] = "Cookie: " . str_replace("\r\n", '; ', urldecode(file_get_contents("cookies/{$cookiehost}.txt"))); } if ($Method == 'POST' and $PostData) { $Header[] = "Content-Type: application/x-www-form-urlencoded"; $Header[] = 'Content-Length: ' . strlen($PostData); } return implode("\r\n", $Header) . "\r\n\r\n" . $PostData; }
/** * The base-message template-string for the top of the message */ $msg_template_str = $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL']; $temp = explode(";", $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES']); $add = $info->numRows() == 1 ? $temp[0] : $temp[1]; /** * The template-string for displaying the Page-Titles ... in this case as a link */ $page_template_str = "- <b><a href='../pages/settings.php?page_id={{id}}'>{{title}}</a></b><br />"; $values = array('type' => 'Template', 'type_name' => $file, 'pages' => $add); $msg = replace_all($msg_template_str, $values); $page_names = ""; while ($data = $info->fetchRow()) { $page_info = array('id' => $data['page_id'], 'title' => $data['page_title']); $page_names .= replace_all($page_template_str, $page_info); } /** * Printing out the error-message and die(). */ $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE'] . $msg . $page_names); } } // Check if we have permissions on the directory if (!is_writable(WB_PATH . '/templates/' . $file)) { $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL'] . WB_PATH . '/templates/' . $file); } // Try to delete the template dir if (!rm_full_dir(WB_PATH . '/templates/' . $file)) { $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']); } else {
function extract_league($Html) { $Html = replace_all($Html, '<table', '</table>', '', 'долгосрочные ставки'); return extract_form_hash($Html); }
function extract_bet($Html) { $Html = delete_all($Html, "(at ", ")"); $Html = delete_all($Html, "(score: ", ")"); $Html = str_ireplace('<wbr/>', '', $Html); $Html = str_replace("-.--", " ", $Html); $Html = kill_tag($Html, "h1|script"); $Html = kill_space($Html); $Html = kill_comment($Html); $Html = numbering_tag($Html, 'div'); $Html = extract_numbered_tags($Html, 'div', "", "bet-list"); $Html = extract_numbered_tags($Html, 'div', "", "dsBodyContent"); $Html = kill_property($Html, 'TagNo'); $Html = kill_property($Html, "onmouseover|onmouseout|onclick|bgcolor|border|cellpadding|leaguename|id|width|cellspacing|regionname"); $Html = kill_property_value($Html, "colspan", "1"); $Html = kill_tag_bound($Html, "form|input|a|nobr|img|tbody|span"); $Html = delete_all($Html, ' class="unselected ', '"'); $Html = delete_all($Html, ' class=\'unselected ', '\''); $Html = replace_all_contain($Html, '<div', '</div>', '', 'isFavourite|' . 'isNoFavourite'); $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'sizer|' . 'bottomline'); $Html = kill_property_value_exclude($Html, "class", "controlHeaderNoShadow|topbar|normal|def|alt|ControlContent"); $Html = str_ireplace('<td></td>', '<td/>', $Html); $Html = kill_unclassed_tag($Html, 'div'); $Html = kill_apostrof($Html, 'colspan'); // !-- Приводим Totalы к нормальному виду --> $Html = replace_all($Html, "<h5>Сумма набранных очков ", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Тотал ", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько будет забито голов?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько голов будет забито?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Сколько геймов будет сыграно в матче?", '</h5>', '<h5>Total</h5>'); $Html = replace_all($Html, "<h5>Кто выиграет больше геймов в матче? (гандикап игрока)", '</h5>', '<h5>Fora</h5>'); $Html = replace_all($Html, "<h5>Двойной шанс", '</h5>', '<h5>1X_12_X2</h5>'); $Html = str_ireplace('<tr class="alt"', "\r\n" . '<tr class="alt"', $Html); $Html = str_ireplace('<tr class="def"', "\r\n" . '<tr class="alt"', $Html); $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (copy_be($tag, '>', '<', ' - ', ' - ', ':')) { $Html = str_ireplace("\r\n" . $tag, str_ireplace('="alt"', '="evn"', $tag), $Html); } } $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (strpos($tag, '"alt"')) { $newtag = numbering_tag($tag, 'tr'); $trAlt = extract_numbered_tags($newtag, 'tr', '', 'alt'); $h5 = delete_all($trAlt, '<', '>'); if (strpos($h5, ' ')) { $newtag = str_replace($trAlt, '', $newtag); $Normals = explode("\r\n", extract_numbered_tags($newtag, 'tr', "\r\n", 'normal')); foreach ($Normals as $normal) { $newtag = str_replace($normal, '', $newtag); } $newtag = kill_property($newtag, 'TagNo'); $Html = str_replace($tag, $newtag, $Html); } } } $Html = str_ireplace("\r\n", '', $Html); $Html = str_ireplace('<tr class="evn"', "\r\n" . '<tr class="evn"', $Html); $Tags = explode("\r\n", $Html); foreach ($Tags as $tag) { if (strpos($tag, '"evn"')) { $newtag = numbering_tag($tag, 'tr'); $trEvn = extract_numbered_tags($newtag, 'tr', '', 'evn'); if (strpos($newtag, '="normal"') == 0) { $newtag = str_replace($trEvn, '', $newtag); } $newtag = kill_property($newtag, 'TagNo'); $Html = str_replace($tag, $newtag, $Html); } } $Html = str_ireplace("\r\n", '', $Html); return $Html; }
function clean($str, $uid = '') { global $fm, $config, $user, $phpbb_root_path, $delims; $str = stripslashes($str); $str = replace_all("\r\n", "\n", $str); if ($uid) { $str = str_replace("\n", '<br>', $str); // convert bbcode smilies to img sources, checking image width to see if it will fit on the phone or not if (preg_match_all('/<!-- s(.*?) --><img src="{SMILIES_PATH}\\/(.*?)" alt="(.*?)" title="(.*?)" \\/><!-- s(.*?) -->/is', $str, $matches)) { $tags = $matches[0]; $icons = $matches[2]; for ($i = 0; $i < count($tags); $i++) { $resize = true; $local = $phpbb_root_path . $config['smilies_path'] . '/' . $icons[$i]; if ($imagedata = @getimagesize($local)) { if ($imagedata[0] < 320) { $resize = false; } } $icon = '<img src="' . generate_board_url() . '/' . $config['smilies_path'] . '/' . $icons[$i] . '"' . ($resize ? ' onload="resizeIMG(this);"' : '') . '>'; $str = str_replace($tags[$i], $icon, $str); } } // our list of bbcodes to change $bbcode = array('/\\[i(|:' . $uid . ')\\](.*?)\\[\\/i(|:' . $uid . ')\\]/is' => '<i>$2</i>', '/\\[b(|:' . $uid . ')\\](.*?)\\[\\/b(|:' . $uid . ')\\]/is' => '<b>$2</b>', '/\\[u(|:' . $uid . ')\\](.*?)\\[\\/u(|:' . $uid . ')\\]/is' => '<u>$2</u>', '/\\[color=(.*?)(|:' . $uid . ')\\](.*?)\\[\\/color(|:' . $uid . ')\\]/is' => '<font color="$1">$3</font>', '/\\[size=(.*?)(|:' . $uid . ')\\](.*?)\\[\\/size(|:' . $uid . ')\\]/is' => '<span style="font-size:$1%;line-height:normal">$3</span>', '/\\[center(|:' . $uid . ')\\](.*?)\\[\\/center(|:' . $uid . ')\\]/is' => '<center>$2</center>', '/\\[hr(|:' . $uid . ')\\](.*?)\\[\\/hr(|:' . $uid . ')\\]/is' => '<hr>', '/\\[url(|:' . $uid . ')\\](.*?)\\[\\/url(|:' . $uid . ')\\]/is' => '<a href="$2">$2</a>', '/\\[url=(.*?)(|:' . $uid . ')\\](.*?)\\[\\/url(|:' . $uid . ')\\]/is' => '<a href="$1">$3</a>', '/<!-- m --><a class="postlink" href="(.*?)">(.*?)<\\/a><!-- m -->/is' => '<a href="$1">$2</a>', '/<!-- w --><a class="postlink" href="(.*?)">(.*?)<\\/a><!-- w -->/is' => '<a href="$1">$2</a>', '/\\[quote=(.*?)(|:' . $uid . ')\\](.*?)\\[\\/quote(|:' . $uid . ')\\]/is' => '<blockquote><cite>$1 wrote:</cite>$3</blockquote>', '/\\[quote(|:' . $uid . ')="(.*?)"\\](.*?)\\[\\/quote(|:' . $uid . ')\\]/is' => '<blockquote><cite>$2 wrote:</cite>$3</blockquote>', '/\\[quote(|:' . $uid . ')\\](.*?)\\[\\/quote(|:' . $uid . ')\\]/is' => '<blockquote>$2</blockquote>', '/\\[img(|:' . $uid . ')\\](.*?)\\[\\/img(|:' . $uid . ')\\]/is' => '<img src="$2" onload="resizeIMG(this);">', '/\\[code(|:' . $uid . ')\\](.*?)\\[\\/code(|:' . $uid . ')\\]/is' => '<dl class="codebox"><dt>Code:</dt><dd><code>$2</code></dd></dl>', '/\\[\\*(|:' . $uid . ')\\](.*?)\\[\\/\\*:m(|:' . $uid . ')\\]/is' => '•$2', '/\\[list(|:' . $uid . ')\\](.*?)\\[\\/list:u(|:' . $uid . ')\\]([\\n]|)/is' => '$2', '/\\[albumimg(|:' . $uid . ')\\](.*?)\\[\\/albumimg(|:' . $uid . ')\\]/is' => '<img src="' . generate_board_url() . '/album_thumbnail.php?pic_id=$2" alt="Image $2" title="Image $2" border="0" onload="resizeIMG(this);">'); // make the bbcode changes while (list($regex, $html) = each($bbcode)) { while (preg_match($regex, $str)) { $str = preg_replace($regex, $html, $str); } } } else { $str = replace_all("\n", ' ', $str); $str = replace_all('<br>', ' ', $str); $str = html_entity_decode($str); } $str = str_replace($delims, '', $str); $str = preg_replace('/\\s\\s+/', ' ', $str); $str = trim($str); return $str; }
function delete_all($Html, $Begin, $End, $Contain1 = null, $Contain2 = null, $Contain3 = null) { return replace_all($Html, $Begin, $End, '', $Contain1, $Contain2, $Contain3); }
private function extract_main_bets(&$tournir_node, $html, $sport_sign, $tournir_id) { $html = kill_property($html, 'TagNo'); $html = numbering_tag($html, 'tr'); $events = extract_all_numbered_tags($html, 'tr', 'event-header'); foreach ($events as $event) { // получаем $event_info = take_be($event, '<table', '</table>'); file_put_contents("Event.html", $event_info); preg_match_all('/<div class="(.*)?member-name(.*)?">(.*)?<\\/div>/imsU', $event_info, $matches); $gamer1_name = $matches[3][0]; $gamer2_name = $matches[3][1]; $datetime_str = delete_all(copy_be($event_info, '<td', '</td>', '"date"'), '<', '>'); list($day_no, $month_no, $year_no, $hour, $minute) = $this->decode_datetime($datetime_str); $extrabet = copy_be($event_info, '<a', '</a>', 'treeid'); $event_id = extract_property_values($extrabet, 'treeid', ''); $extrabet = delete_all($extrabet, '<', '>'); $event_node = $this->event_create($tournir_node, $event_id, mktime($hour, $minute, 0, $month_no, $day_no, $year_no), $gamer1_name, $gamer2_name); $cells = extract_all_tags(replace_all($event, '<td', '>', '<td>'), '<td>', '</td>'); $i = 0; foreach ($cells as $cell) { $cell = trim(copy_between($cell, '<td>', '</td>')); if ($cell) { $cell = kill_tag_bound($cell, 'a'); unset($bettype); $bettype_str = $this->header[$i]; foreach (explode(';', $bettype_str) as $bet_pair) { list($key, $value) = explode('=', $bet_pair); $bettype[$key] = $value; } if ($bettype['Kind'] == 'Total') { preg_match('/\\((.+?)\\)<br\\/>(.+?)/iU', $cell, $matches); if ($matches[2]) { $matches[2] = delete_all($matches[2], '<', '>'); $this->addBet($event_node, $bettype_str . ';Value=' . $matches[1] . ';Koef=' . $matches[2]); } } elseif ($bettype['Kind'] == 'Fora') { preg_match('/\\(([\\+\\-]*?)(.+?)\\)<br\\/>(.+?)/iU', $cell, $matches); if ($matches[3]) { $matches[3] = delete_all($matches[3], '<', '>'); $this->addBet($event_node, $bettype_str . ';Value=' . $matches[1] . $matches[2] . ';Koef=' . $matches[3]); } } else { $cell = delete_all($cell, '<', '>'); $this->addBet($event_node, $bettype_str . ';Koef=' . $cell); } } $i++; } //if ($extrabet > 0) $this->extract_extra_bets($event_node, $tournir_id, $event_id); } }
$temp = explode(";", $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES']); $add = $oAddon->numRows() == 1 ? $temp[0] : $temp[1]; } /** * The template-string for displaying the Page-Titles ... in this case as a link */ $page_template_str = "- <b><a href='../pages/sections.php?page_id={{id}}'>{{title}}</a></b><br />"; $values = array('type' => 'Modul', 'type_name' => $sAddonsFile, 'pages' => $add); $msg = replace_all($msg_template_str, $values); $page_names = ""; while ($data = $oAddon->fetchRow(MYSQLI_ASSOC)) { $sql = 'SELECT `page_title` FROM `' . TABLE_PREFIX . 'pages` ' . 'WHERE `page_id`= ' . (int) $data['page_id']; $oPage = $database->query($sql); $aPage = $oPage->fetchRow(MYSQLI_ASSOC); $aPageInfo = array('id' => $data['page_id'], 'title' => $aPage['page_title']); $page_names .= replace_all($page_template_str, $aPageInfo); } /** * Printing out the error-message and die(). */ $admin->print_error(str_replace($TEXT['FILE'], "Modul", $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']) . $msg . $page_names); } } else { $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']); } // Check if we have permissions on the directory if (!is_writable(WB_PATH . '/modules/' . $sAddonsFile)) { $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']); } // Run the modules uninstall script if there is one if (file_exists(WB_PATH . '/modules/' . $sAddonsFile . '/uninstall.php')) {
if (!isset($_POST['file']) || $_POST['file'] == "") { $admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS'], $js_back); } else { $sAddonName = $admin->StripCodeFromText($_POST['file']); } $sAction = $admin->StripCodeFromText($_POST['action']); $sAction = in_array($sAction, $aValideActions) ? $sAction : 'upgrade'; // Extra protection if (trim($sAddonName) == '') { $admin->print_error($MESSAGE['GENERIC_ERROR_OPENING_FILE'], $js_back); } // check whether the module is core $aPreventFromUninstall = array('captcha_control', 'jsadmin', 'output_filter', 'wysiwyg', 'menu_link'); if ($sAction == 'uninstall' && preg_match('/' . $sAddonsFile . '/si', implode('|', $aPreventFromUninstall))) { $temp = array('name' => $file); $msg = replace_all($MESSAGE['MEDIA_CANNOT_DELETE_DIR'], $temp); $admin->print_error($msg); } // check if specified module folder exists $sAddonRelPath = '/modules/' . $sAddonName; // let the old variablename if module use it if (!file_exists(WB_PATH . $sAddonRelPath . '/' . $sAction . '.php')) { $admin->print_header(); $admin->print_error($TEXT['NOT_FOUND'] . ': <tt>"' . $sAddonName . '/' . $sAction . '.php"</tt> ', $js_back); } // include modules install.php script if (in_array($sAction, $aValideActions)) { require WB_PATH . $sAddonRelPath . '/' . $sAction . '.php'; } // load module info into database and output status message load_module(WB_PATH . $sAddonRelPath, false);