Example #1
0
function extract_league($Html)
{
    $Html = extract_tags($Html, '<a href="betsnew.aspx?leagueids=', '>', "\r\n");
    preg_match_all('/(\\d+)/m', $Html, $Matches);
    $Html = implode(",", $Matches[1]);
    return $Html;
}
Example #2
0
function extract_league($Html)
{
    $Html = extract_tags($Html, '<input type="checkbox" name="hd', '">', ",");
    $Html = delete_all($Html, '<', 'value="');
    $Html = str_replace('">', '', $Html);
    return $Html;
}
Example #3
0
function extract_league(&$sport_node, $html)
{
    $html = kill_space($html);
    $html = extract_tags($html, '<noscript>', '</noscript>', '', 'sportNavigationRegionExpandedNew');
    $html = str_ireplace('<div class="leftnav">', '@@@<div class="leftnav">', $html);
    $html = numbering_tag($html, 'div');
    $regions = explode('@@@', $html);
    unset($regions[0]);
    foreach ($regions as $region) {
        // получаем название региона
        $region_name = copy_be($region, '<a', '</a>', 'sportsNavigationArrowButtonNew');
        $region_name = copy_between($region_name, '>', '</a');
        $tournirs = extract_all_tags($region, '<a href=\'betsnew.aspx?leagueids=', '</a>');
        foreach ($tournirs as $tournir) {
            $tournir_name = copy_between($tournir, '>', '</a');
            preg_match('/(.+) \\((\\d+)\\)$/m', $tournir_name, $matches);
            $tournir_name = $matches[1];
            // бракуем турниры
            $tournir_node = $sport_node->addChild('Tournir', $tournir_name);
            $league = copy_be($tournir, '<a', '>', 'leagueids');
            $league_id = copy_between($league, 'leagueids=', "'");
            $tournir_node->addAttribute('Id', $league_id);
            $tournir_node->addAttribute('Region_Name', $region_name);
        }
    }
}
Example #4
0
function extract_league($Html)
{
    global $xml;
    $Html = extract_tags($Html, '<a href=\'betsnew.aspx?leagueids=', '>', "\r\n");
    preg_match_all('/(\\d+)/m', $Html, $Matches);
    foreach ($Matches[1] as $league_id) {
        $xml->addChild('Tournir', $league_id);
    }
}
Example #5
0
function extract_league($Html)
{
    $Html = copy_be($Html, '<form ', '</form>', 'name="f1"');
    $LineValue = extract_line_value($Html);
    $Html = extract_tags($Html, '<input ', '>', "\r\n", 'checkbox', 'events[]');
    $Html = delete_all($Html, '<input ', "name='");
    $Html = str_replace("'>", '', $Html);
    $Html = str_ireplace("' value='", "=", $Html);
    return $Html;
}
Example #6
0
function extract_bet($Html)
{
    $Html = extract_tags($Html, '<table cellSpacing=2 cellPadding=1', '</table>', "\r\n");
    $Html = kill_space($Html);
    $Html = kill_tag_bound($Html, 'b|a|br|font|img');
    $Html = str_ireplace(' nowrap', '', $Html);
    $Html = kill_property($Html, 'onmouseover|onclick|align|id|style|width|cellspacing');
    //  Убираем строки без ставок
    $Html = delete_all($Html, '<tr>', '</tr>', 'class="t_comment"');
    $Html = delete_all($Html, '<tr>', '</tr>', 'class="t_comment1"');
    $Html = str_ireplace(' class=date', ' @lass=date', $Html);
    $Html = kill_property($Html, 'class');
    $Html = str_ireplace(' @lass=date', ' class=date', $Html);
    return $Html;
}
Example #7
0
function extract_bet($Html)
{
    $Html = extract_tags($Html, '<table ', '</table>', '', 'Дома');
    $Html = kill_space($Html);
    $Html = str_ireplace('=>', '|', $Html);
    $Html = kill_comment($Html);
    $Html = kill_tag($Html, 'script');
    $Html = kill_tag_bound($Html, 'input|b|a|img|strong');
    $Html = str_ireplace('<br>', '|', $Html);
    $Html = str_ireplace('>-<', '><', $Html);
    $Html = str_ireplace(' bgcolor="#66FFFF"', ' league="#66FFFF"', $Html);
    $Html = kill_property($Html, 'bgcolor|align|valign|width|border|class');
    $Html = replace_all_contain($Html, '<tr', '</tr>', '', 'угл |' . 'ж.к ');
    return $Html;
}
Example #8
0
function extract_league($Html)
{
    $Html = copy_be($Html, '<form ', '</form>', '"frmTurnirs"');
    $Html = extract_tags($Html, '<input', '>', "\r\n", 'id="sport_', 'name="turnir_');
    $Html = delete_all($Html, '<input', '>', 'turnir_2_');
    // Бейсбол
    $Html = delete_all($Html, '<input', '>', 'turnir_12_');
    // Бокс
    $Html = delete_all($Html, '<input', '>', 'turnir_254_');
    // Лотереи
    $Html = delete_all($Html, '<input', '>', 'turnir_255_');
    // Другие виды спорта
    $Html = delete_all($Html, '<input', '>', 'turnir_6_');
    // Хоккей
    $Html = extract_property_values($Html, 'name', ';');
    return $Html;
}
Example #9
0
function clean_word($html_to_save)
{
    if (strstr($html_to_save, '<!--[if gte mso')) {
        //word mess up tags
        $tags = extract_tags($html_to_save, 'xml', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8');
        $matches = $tags;
        if (!empty($matches)) {
            foreach ($matches as $m) {
                $html_to_save = str_replace($m['full_tag'], '', $html_to_save);
            }
            $html_to_save = str_replace('<!--[if gte mso 8]><![endif]-->', '', $html_to_save);
            $html_to_save = str_replace('<!--[if gte mso 9]><![endif]-->', '', $html_to_save);
            $html_to_save = str_replace('<!--[if gte mso 10]><![endif]-->', '', $html_to_save);
            $html_to_save = str_replace('<!--[if gte mso 11]><![endif]-->', '', $html_to_save);
            $html_to_save = str_replace('class="MsoNormal"', '', $html_to_save);
        }
        $tags = extract_tags($html_to_save, 'style', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8');
        $matches = $tags;
        if (!empty($matches)) {
            foreach ($matches as $m) {
                $html_to_save = str_replace($m['full_tag'], '', $html_to_save);
            }
        }
    }
    $html_to_save = str_replace('class="exec"', '', $html_to_save);
    $html_to_save = str_replace('style=""', '', $html_to_save);
    $html_to_save = str_replace('ui-draggable', '', $html_to_save);
    $html_to_save = str_replace('class="ui-droppable"', '', $html_to_save);
    $html_to_save = str_replace('ui-droppable', '', $html_to_save);
    $html_to_save = str_replace('mw_edited', '', $html_to_save);
    $html_to_save = str_replace('_moz_dirty=""', '', $html_to_save);
    $html_to_save = str_replace('ui-droppable', '', $html_to_save);
    $html_to_save = str_replace('<br >', '<br />', $html_to_save);
    $html_to_save = str_replace('<br>', '<br />', $html_to_save);
    $html_to_save = str_replace(' class=""', '', $html_to_save);
    $html_to_save = str_replace(' class=" "', '', $html_to_save);
    //$html_to_save = str_replace ( '<br><br>', '<div><br><br></div>', $html_to_save );
    //$html_to_save = str_replace ( '<br /><br />', '<div><br /><br /></div>', $html_to_save );
    $html_to_save = preg_replace('/<!--(.*)-->/Uis', '', $html_to_save);
    //$html_to_save = '<p>' . str_replace("<br />","<br />", str_replace("<br /><br />", "</p><p>", $html_to_save)) . '</p>';
    //$html_to_save = str_replace(array("<p></p>", "<p><h2>", "<p><h1>", "<p><div", "</pre></p>", "<p><pre>", "</p></p>", "<p></td>", "<p><p", "<p><table", "<p><p", "<p><table"), array("<p>&nbsp;</p>", "<h2>", "<h1>", "<div",  "</pre>", "<pre>", "</p>", "</td>", "<p", "<table", "<p", "<table"), $html_to_save);
    //p($html_to_save);
    return $html_to_save;
}
Example #10
0
function extract_bet($Html)
{
    $Html = kill_space($Html);
    $Html = numbering_tag($Html, 'table');
    $Html = extract_numbered_tags($Html, 'table', '', 'content');
    $Tags = explode("\r\n", extract_tags($Html, '<table', 'height="22"', "\r\n"));
    foreach ($Tags as $tag) {
        $TagNo = extract_tagno($tag, 'table');
        $Table = extract_numbered_tag($Html, 'table', $TagNo);
        if (stripos($Table, 'поб.1') > 0) {
            $Result .= $Table;
        }
    }
    $Html = $Result;
    $Html = str_ireplace('>-<', '><', $Html);
    $Html = kill_comment($Html);
    $Html = kill_tag($Html, 'script');
    $Html = kill_tag_bound($Html, 'a|b|img|strong');
    $Html = kill_property($Html, 'tagno|bgcolor|align|valign|width|cellspacing|border|cellpadding');
    $Html = replace_all_contain($Html, '<tr', '</tr>', '', ' тайм)|' . ' тайм:|' . ' четверть:|' . '-й сет:|' . 'Дополнительные тоталы:|' . 'colspan="17"|' . 'Первый матч|' . 'Второй матч|' . 'Хозяева|' . 'Счет серии');
    return $Html;
}
Example #11
0
function extract_numbered_tags($Html, $TagName, $Separator, $Contain1 = "", $Contain2 = "", $Contain3 = "")
{
    $Tags = explode("\r\n", extract_tags($Html, "<{$TagName}\tTagNo=", ">", "\r\n", $Contain1, $Contain2, $Contain3));
    $Result = array();
    foreach ($Tags as $tag) {
        $TagNo = extract_tagno($tag, $TagName);
        $Result[] = extract_numbered_tag($Html, $TagName, $TagNo);
    }
    return implode($Separator, $Result);
}
Example #12
0
 function save_field()
 {
     $id = is_admin();
     if ($id == false) {
         exit('Error: not logged in as admin.');
     }
     if ($_POST) {
         $the_field_data_all = $_POST;
     } else {
         exit('Error: no POST?');
     }
     $is_no_save = url_param('peview', true);
     //p($is_no_save);
     $ref_page = $_SERVER['HTTP_REFERER'];
     if ($ref_page != '') {
         //$page_id = $ref_page->page->id;
         //$the_ref_page = get_page ( $page_id );
         $ref_page = $the_ref_page = get_ref_page();
         //p($ref_page);
         $page_id = $ref_page['id'];
     }
     $json_print = array();
     foreach ($the_field_data_all as $the_field_data) {
         if (!empty($the_field_data)) {
             $save_global = false;
             if ($the_field_data['attributes']) {
                 //$the_field_data ['attributes'] = json_decode($the_field_data ['attributes']);
                 //var_dump($the_field_data ['attributes']);
             }
             if (intval($the_field_data['attributes']['page']) != 0) {
                 $page_id = intval($the_field_data['attributes']['page']);
                 $content_id = $page_id;
                 $the_ref_page = get_page($page_id);
             }
             if (intval($the_field_data['attributes']['post']) != 0) {
                 $post_id = intval($the_field_data['attributes']['post']);
                 $content_id = $post_id;
                 $the_ref_post = get_post($post_id);
             }
             if (intval($the_field_data['attributes']['category']) != 0) {
                 $category_id = intval($the_field_data['attributes']['category']);
             }
             $page_element_id = false;
             if (strval($the_field_data['attributes']['id']) != '') {
                 $page_element_id = $the_field_data['attributes']['id'];
             }
             if ($the_field_data['attributes']['global'] != false) {
                 $save_global = true;
             }
             if ($the_field_data['attributes']['rel'] == 'global') {
                 $save_global = true;
             }
             if ($the_field_data['attributes']['rel'] == 'post') {
                 if ($ref_page != '') {
                     $save_global = false;
                     $ref_post = $the_ref_post = get_ref_post();
                     //p ( $ref_post );
                     $post_id = $ref_post['id'];
                     $page_id = $ref_page['id'];
                     $content_id = $post_id;
                 }
             }
             if ($the_field_data['attributes']['rel'] == 'page') {
                 //	p ( $_SERVER );
                 if ($ref_page != '') {
                     $save_global = false;
                     $ref_page = $the_ref_page = get_ref_page();
                     $page_id = $ref_page['id'];
                     $content_id = $page_id;
                 }
             }
             if ($the_field_data['attributes']['rel'] == 'PAGE_ID') {
                 //	p ( $_SERVER );
                 if ($ref_page != '') {
                     $save_global = false;
                     $ref_page = $the_ref_page = get_ref_page();
                     $page_id = $ref_page['id'];
                     $content_id = $page_id;
                 }
             }
             if ($the_field_data['attributes']['rel'] == 'POST_ID') {
                 //	p ( $_SERVER );
                 if ($ref_page != '') {
                     $save_global = false;
                     $ref_page = $the_ref_page = get_ref_page();
                     $page_id = $ref_page['id'];
                     $content_id = $page_id;
                 }
             }
             if ($category_id == false and $page_id == false and $post_id == false and $save_global == false) {
                 print 'Error: plase specify integer value for at least one of those attributes - page, post or category';
             } else {
                 $some_mods = array();
                 if ($the_field_data['attributes']['field'] != '') {
                     if ($the_field_data['html'] != '') {
                         $field = trim($the_field_data['attributes']['field']);
                         $html_to_save = $the_field_data['html'];
                         $html_to_save = str_replace('MICROWEBER', 'microweber', $html_to_save);
                         //$html_to_save = str_replace ( '<div><br></div>', '<br>', $html_to_save );
                         //$html_to_save = str_replace ( '<div><br /></div>', '<br />', $html_to_save );
                         //$html_to_save = str_replace ( '<div></div>', '<br />', $html_to_save );
                         $content = $html_to_save;
                         $html_to_save = $content;
                         if (strstr($content, 'mw_params_encoded') == true) {
                             $tags1 = extract_tags($content, 'div', $selfclosing = true, $return_the_entire_tag = true, $charset = 'UTF-8');
                             //	p($tags);
                             $matches = $tags1;
                             if (!empty($matches)) {
                                 //
                                 foreach ($matches as $m) {
                                     //
                                     if ($m['tag_name'] == 'div') {
                                         $attr = $m['attributes'];
                                         if (strval($attr['module_id']) == '') {
                                             $attr['module_id'] = 'module_' . rand() . rand() . rand() . rand();
                                         }
                                         if ($attr['module_id'] != '') {
                                             $mw_params_encoded = $attr;
                                             $mod_id = $attr['module_id'];
                                             $tag1 = "<microweber ";
                                             foreach ($mw_params_encoded as $k => $v) {
                                                 $skip_key = false;
                                                 if ($k == 'edit') {
                                                     $v = 'edit_tag';
                                                 }
                                                 if ($k == 'onmouseup') {
                                                     $v = '';
                                                     $skip_key = true;
                                                 }
                                                 if ($k == 'class') {
                                                     $v = '';
                                                     $skip_key = true;
                                                 }
                                                 if ($skip_key == false) {
                                                     if (strtolower(trim($k)) != 'save' and strtolower(trim($k)) != 'submit') {
                                                         $tag1 = $tag1 . "{$k}=\"{$v}\" ";
                                                     }
                                                 }
                                                 $tag1 = $tag1 . "module=\"{$attr['mw_params_module']}\" ";
                                             }
                                             $tag1 .= " />";
                                             $some_mods[$mod_id] = $tag1;
                                         }
                                     }
                                 }
                             }
                             /*$doc = new DOMDocument ();
                             								$doc->preserveWhiteSpace = true;
                             								$doc->loadHTML ( $content );
                             								$xpath = new DOMXpath ( $doc );
                             								foreach ( $xpath->query ( '//div[@mw_params_encoded]' ) as $a ) {
                             									//	$clunker_vars = get_object_vars($a->nodeValue); // we pass the object, not th
                             									//echo "Found {$a->previousSibling->previousSibling->nodeValue}," . " by {$a->previousSibling->nodeValue}\n";
                             									
                             
                             									$mw_params_encoded = $a->getAttribute ( 'mw_params_encoded' );
                             									$mod_id = $a->getAttribute ( 'module_id' );
                             									
                             									$mw_params_encoded = base64_decode ( $mw_params_encoded );
                             									$mw_params_encoded = unserialize ( $mw_params_encoded );
                             									
                             									//$c1 = $a->nodeValue;
                             									$c1 = domNodeContent ( $a, 1 );
                             									
                             									if (! empty ( $mw_params_encoded )) {
                             										$tag1 = "<microweber ";
                             										
                             										foreach ( $mw_params_encoded as $k => $v ) {
                             											if ($k == 'edit') {
                             												$v = 'edit_tag';
                             											}
                             											if ((strtolower ( trim ( $k ) ) != 'save') and (strtolower ( trim ( $k ) ) != 'submit')) {
                             												$tag1 = $tag1 . "{$k}=\"{$v}\" ";
                             											}
                             										
                             										}
                             										$tag1 .= " />";
                             										$some_mods [$mod_id] = $tag1;
                             										//p ( $tag1 );
                             									//	p ( $c1 );
                             									//$c1 = trim ( $c1 );
                             									//$content = trim ( $content );
                             									//$content123 = explode ( $c1, $content );
                             									//$content = str_ireplace ( $c1, $tag1, $content );
                             									// p($content123);
                             									}
                             								}*/
                             //
                             //$parsed = get_string_between ( $content, "mw_params_encoded=\"", '"' );
                             //
                         }
                         //p($some_mods,1);
                         $html_to_save = $content;
                         foreach ($some_mods as $some_mod_k => $some_mod_v) {
                             //$t1 = extact_tag_by_attr ( 'module_id', $some_mod_k, $content, 'div' );
                             //p ( $t1 );
                             $content = preg_replace("#<div[^>]*id=\"{$some_mod_k}\".*?</div>#si", $some_mod_v, $content);
                         }
                         if ($is_no_save != true) {
                             $pattern = "/mw_last_hover=\"[0-9]*\"/";
                             $pattern = "/mw_last_hover=\"[0-9]*\"/i";
                             $content = preg_replace($pattern, "", $content);
                             $pattern = "/mw_last_hover=\"\"/";
                             $content = preg_replace($pattern, "", $content);
                             $pattern = "/mw_tag_edit=\"[0-9]*\"/i";
                             $content = preg_replace($pattern, "", $content);
                             $pattern = "/mw_tag_edit=\"\"/";
                             $content = preg_replace($pattern, "", $content);
                         }
                         //$content = preg_replace ( "#<div[^>]*id=\"{$some_mod_k}\".*?</div>#si", $some_mod_v, $content );
                         $html_to_save = $content;
                         //	p ( $content,1 );
                         if (strstr($content, '<div') == true) {
                             $relations = array();
                             $tags = extract_tags($content, 'div', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8');
                             $matches = $tags;
                             if (!empty($matches)) {
                                 //
                                 foreach ($matches as $m) {
                                     //
                                     //	p ( ($m) );
                                     if ($m['tag_name'] == 'div') {
                                         $replaced = false;
                                         $attr = $m['attributes'];
                                         if ($attr['mw_params_encoded']) {
                                             $decode_params = $attr['mw_params_encoded'];
                                             //$decode_params = base64_decode ( $decode_params );
                                             $decode_params = 'edit_tag';
                                             //p ( $decode_params );
                                             //p ( $attr, 1 );
                                             //print 1111111111111111111111111111111111111111111111111111111;
                                         }
                                         foreach ($some_mods as $some_mod_k => $some_mod_v) {
                                             //p(($m));
                                             //	p($some_mod_v);
                                             if (stristr($content, $some_mod_k)) {
                                                 //p ( $content );
                                                 //$content = str_ireplace ( $m ['full_tag'], $some_mod_v, $content );
                                                 //p ( $content, 1 );
                                             }
                                         }
                                         //p ( $content, 1 );
                                         if ($attr['class'] == 'module') {
                                             //	p($attr);
                                             if ($attr['base64_array'] != '') {
                                                 $base64_array = base64_decode($attr['base64_array']);
                                                 $base64_array = unserialize($base64_array);
                                                 if (!empty($base64_array)) {
                                                     $tag1 = "<microweber ";
                                                     foreach ($base64_array as $k => $v) {
                                                         if (strtolower(trim($k)) != 'save' and strtolower(trim($k)) != 'submit') {
                                                             $tag1 = $tag1 . "{$k}=\"{$v}\" ";
                                                         }
                                                     }
                                                     $tag1 .= " />";
                                                     $to_save[] = $tag1;
                                                     $content = str_ireplace($m['full_tag'], $tag1, $content);
                                                     $replaced = true;
                                                     //p($base64_array);
                                                 }
                                             }
                                             if ($replaced == false) {
                                                 if ($attr['edit'] != '') {
                                                     $tag = $attr['edit'];
                                                     $tag = 'edit_tag';
                                                     //$tag = base64_decode ( $tag );
                                                     //p ( $tag );
                                                     if (strstr($tag, 'module_id=') == false) {
                                                         $tag = str_replace('/>', ' module_id="module_' . date('Ymdhis') . rand() . '" />', $tag);
                                                     }
                                                     $to_save[] = $tag;
                                                     if ($tag != false) {
                                                         $content = str_ireplace($m['full_tag'], $tag, $content);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 $html_to_save = $content;
                             }
                         }
                         $html_to_save = str_ireplace('class="ui-droppable"', '', $html_to_save);
                         $html_to_save = str_ireplace('<div><div></div><div><div></div>', '<br />', $html_to_save);
                         //$html_to_save = str_ireplace ( 'class="ui-droppable"', '', $html_to_save );
                         //$html_to_save =utfString( $html_to_save );
                         //$html_to_save = htmlspecialchars ( $html_to_save, ENT_QUOTES );
                         //$html_to_save = html_entity_decode ( $html_to_save );
                         //p($html_to_save);
                         //	p($content,1);
                         $html_to_save = clean_word($html_to_save);
                         if ($save_global == false) {
                             if ($content_id) {
                                 if ($page_id) {
                                     $for_histroy = $the_ref_page;
                                     if ($post_id) {
                                         $for_histroy = $the_ref_post;
                                     }
                                     if (stristr($field, 'custom_field_')) {
                                         $field123 = str_ireplace('custom_field_', '', $field);
                                         $old = $for_histroy['custom_fields'][$field123];
                                     } else {
                                         $old = $for_histroy[$field];
                                     }
                                     $history_to_save = array();
                                     $history_to_save['table'] = 'table_content';
                                     $history_to_save['id'] = $content_id;
                                     $history_to_save['value'] = $old;
                                     $history_to_save['field'] = $field;
                                     //p ( $history_to_save );
                                     if ($is_no_save != true) {
                                         CI::model('core')->saveHistory($history_to_save);
                                     }
                                 }
                                 $to_save = array();
                                 $to_save['id'] = $content_id;
                                 $to_save['quick_save'] = true;
                                 $to_save['page_element_id'] = $page_element_id;
                                 $to_save['page_element_content'] = CI::model('template')->parseMicrwoberTags($html_to_save, $options = false);
                                 $to_save[$field] = $html_to_save;
                                 //print "<h2>For content $content_id</h2>";
                                 //p ( $to_save );
                                 //p ( $html_to_save, 1 );
                                 $json_print[] = $to_save;
                                 if ($is_no_save != true) {
                                     $saved = CI::model('content')->saveContent($to_save);
                                     //	p($to_save);
                                     //p($content_id);
                                     //p($page_id);
                                     //	p ( $html_to_save ,1);
                                 }
                                 //print ($html_to_save) ;
                                 $html_to_save = CI::model('template')->parseMicrwoberTags($html_to_save, $options = false);
                             } else {
                                 if ($category_id) {
                                     print __FILE__ . __LINE__ . ' category is not implemented not rady yet';
                                 }
                             }
                         } else {
                             $field_content = CI::model('core')->optionsGetByKey($the_field_data['attributes']['field'], $return_full = true, $orderby = false);
                             $to_save = $field_content;
                             $to_save['option_key'] = $the_field_data['attributes']['field'];
                             $to_save['option_value'] = $html_to_save;
                             $to_save['option_key2'] = 'editable_region';
                             $to_save['page_element_id'] = $page_element_id;
                             $to_save['page_element_content'] = CI::model('template')->parseMicrwoberTags($html_to_save, $options = false);
                             //print "<h2>Global</h2>";
                             if ($is_no_save != true) {
                                 $to_save = CI::model('core')->optionsSave($to_save);
                             }
                             $json_print[] = $to_save;
                             $history_to_save = array();
                             $history_to_save['table'] = 'global';
                             //	$history_to_save ['id'] = 'global';
                             $history_to_save['value'] = $field_content['option_value'];
                             $history_to_save['field'] = $field;
                             if ($is_no_save != true) {
                                 CI::model('core')->saveHistory($history_to_save);
                             }
                             $html_to_save = CI::model('template')->parseMicrwoberTags($html_to_save, $options = false);
                             //	$json_print[] = array ($the_field_data ['attributes'] ['id'] => $html_to_save );
                             //	print ($html_to_save) ;
                             //	print ($to_save) ;
                             //p ( $field_content );
                             //optionsSave($data)
                         }
                     }
                 } else {
                     //	print ('Error: plase specify a "field" attribute') ;
                     //	p($the_field_data);
                 }
             }
         }
     }
     //	p($_POST);
     /*	if (! empty ( $_POST )) {
     			foreach ( $_POST as $k => $v ) {
     				
     				//
     				$v2 = array ();
     				foreach ( $v as $v1_k => $v1_v ) {
     					$html = CI::model ( 'template' )->parseMicrwoberTags ( $v1_v, $options = false );
     					$v2 [$v1_k] =  ( $html );
     				}
     				
     				$json_print [$k] = $v2;
     			}
     		}
     		*/
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     header('Content-type: application/json');
     $json_print = json_encode($json_print);
     print $json_print;
     CI::model('core')->cleanCacheGroup('global/blocks');
     exit;
 }
Example #13
0
function extract_bet($Html)
{
    $Html = str_ireplace(' nowrap', ' ', $Html);
    $Html = kill_space($Html);
    $Html = kill_comment($Html);
    $Html = extract_tags($Html, '<table ', '</table>', "\r\n", 'class="OT"');
    $Html = kill_tag($Html, "script");
    $Html = kill_tag_bound($Html, "form|input|a|nobr|img|tbody|div");
    $Html = kill_property($Html, "onmouseover|onmouseout|onclick|bgcolor|border|cellpadding|cellspacing|width|id|class");
    return $Html;
}
Example #14
0
function update_cookies($Url, $Response)
{
    global $login;
    $URI = parse_url($Url);
    $cookiehost = $URI['host'];
    if ($login) {
        $cookiehost = $login . '_' . $cookiehost;
    }
    $FCookArr = array();
    if (file_exists("cookies/{$cookiehost}.txt")) {
        $CookiesArr = explode("\r\n", file_get_contents("cookies/{$cookiehost}.txt"));
        foreach ($CookiesArr as $Cookie) {
            list($name, $value) = explode('=', $Cookie);
            $FCookArr[$name] = $value;
        }
    }
    $NewCook = extract_tags($Response, 'Set-Cookie: ', "\r\n");
    if ($NewCook != null) {
        $NewCook = str_ireplace('Set-Cookie: ', '', $NewCook);
        $NewCookArr = explode("\r\n", trim($NewCook));
        foreach ($NewCookArr as $NewCook) {
            list($Cookie, ) = explode(';', $NewCook, 2);
            list($name, $value) = explode('=', $Cookie);
            $FCookArr[$name] = $value;
        }
        $Cookies = array();
        foreach ($FCookArr as $key => $value) {
            $Cookies[] = $key . '=' . $value;
        }
        file_put_contents("cookies/{$cookiehost}.txt", implode("\r\n", $Cookies));
    }
}
Example #15
0
function extract_form_hash($Html)
{
    $NameHash = array();
    $Inputs = explode("\r\n", extract_tags($Html, '<input ', '>', "\r\n", "name"));
    foreach ($Inputs as $input) {
        preg_match("/ name=(\\'(.*)\\'|\"(.*)\"|(?-U:([#0-9a-z%_\\[\\]]+)))/imsU", $input, $match);
        $name = $match[2] . $match[3] . $match[4];
        preg_match("/ value=(\\'(.*)\\'|\"(.*)\"|(?-U:([#0-9a-z%_]+)))/imsU", $input, $match);
        $value = $match[2] . $match[3] . $match[4];
        if ($name) {
            if ($NameHash[$name]) {
                $NameHash[$name] = $NameHash[$name] + 1;
                $name = $name . '[{<' . $NameHash[$name] . '>}]';
            } else {
                $NameHash[$name] = 1;
            }
            $PostHash[$name] = $value;
        }
    }
    return $PostHash;
}
Example #16
0
 public function clean_word($html_to_save)
 {
     if (strstr($html_to_save, '<!--[if gte mso')) {
         // word mess up tags
         $tags = extract_tags($html_to_save, 'xml', $selfclosing = false, $return_the_entire_tag = true, $charset = 'UTF-8');
         $matches = $tags;
         if (!empty($matches)) {
             foreach ($matches as $m) {
                 $html_to_save = str_replace($m['full_tag'], '', $html_to_save);
             }
             $html_to_save = str_replace('<!--[if gte mso 8]><![endif]-->', '', $html_to_save);
             $html_to_save = str_replace('<!--[if gte mso 9]><![endif]-->', '', $html_to_save);
             $html_to_save = str_replace('<!--[if gte mso 10]><![endif]-->', '', $html_to_save);
             $html_to_save = str_replace('<!--[if gte mso 11]><![endif]-->', '', $html_to_save);
             $html_to_save = str_replace('class="MsoNormal"', '', $html_to_save);
         }
     }
     $html_to_save = str_replace('class="exec"', '', $html_to_save);
     $html_to_save = str_replace('style=""', '', $html_to_save);
     $html_to_save = str_replace('ui-draggable', '', $html_to_save);
     $html_to_save = str_replace('class="ui-droppable"', '', $html_to_save);
     $html_to_save = str_replace('ui-droppable', '', $html_to_save);
     $html_to_save = str_replace('mw_edited', '', $html_to_save);
     $html_to_save = str_replace('_moz_dirty=""', '', $html_to_save);
     $html_to_save = str_replace('ui-droppable', '', $html_to_save);
     $html_to_save = str_replace('<br >', '<br />', $html_to_save);
     $html_to_save = str_replace('<br>', '<br />', $html_to_save);
     $html_to_save = str_replace(' class=""', '', $html_to_save);
     $html_to_save = str_replace(' class=" "', '', $html_to_save);
     // $html_to_save = preg_replace('/<!--(.*)-->/Uis', '', $html_to_save);
     return $html_to_save;
 }
Example #17
0
$base_regex = '/<base[^>]*' . 'href=[\\"|\'](.*)[\\"|\']/Ui';
preg_match_all($base_regex, $string, $base_match, PREG_PATTERN_ORDER);
if (strlen($base_match[1][0]) > 0) {
    $base_url = $base_match[1][0];
    $base_override = true;
}
// Parse Description
$return_array['description'] = '';
$nodes = extract_tags($string, 'meta');
foreach ($nodes as $node) {
    if (strtolower($node['attributes']['name']) == 'description') {
        $return_array['description'] = trim($node['attributes']['content']);
    }
}
// Parse Images
$images_array = extract_tags($string, 'img');
$images = array();
for ($i = 0; $i <= sizeof($images_array); $i++) {
    $img = trim(@$images_array[$i]['attributes']['src']);
    $width = preg_replace("/[^0-9.]/", '', $images_array[$i]['attributes']['width']);
    $height = preg_replace("/[^0-9.]/", '', $images_array[$i]['attributes']['height']);
    $ext = trim(pathinfo($img, PATHINFO_EXTENSION));
    if ($img && $ext != 'gif') {
        if (substr($img, 0, 7) == 'http://') {
        } else {
            if (substr($img, 0, 1) == '/' || $base_override) {
                $img = $base_url . $img;
            } else {
                $img = $relative_url . $img;
            }
        }