Иконка ресурса

Автоматический парсер раздач с rutor.info 2016-09-17

Нет прав для скачивания

weber_u

Пользователь
Я так понимаю что в 228_rutor.php надо копать используя:
PHP:
Выпонить запросы в базу

ALTER TABLE `bb_topics` ADD `descr` varchar(200) NOT NULL DEFAULT '', ADD `keywords` text NOT NULL, ADD `topic_image` VARCHAR( 255 ) NOT NULL DEFAULT '';
INSERT INTO `bb_config` VALUES ('global_keywords', '');

Открыть viewtopic.php

Найти

// Does this topic contain DL-List?

Выше добавить

if (function_exists('seo_url')) $url_meta = make_url(seo_url(TOPIC_URL . $topic_id, $topic_title));
else $url_meta = make_url(TOPIC_URL . $topic_id);

meta_search($url_meta, $topic_title, $t_data['topic_image'], $t_data['descr'], $t_data['keywords']);


Открыть posting.php

Найти

if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)

Ниже добавить

if ($mode == 'newtopic' && defined('TORRENT_ATTACH_ID') || defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
    {
        $row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");          
            preg_match_all('/\[poster\](.*?)\[\/poster\]/i', $row['post_text'], $poster4, PREG_SET_ORDER);
            preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $row['post_text'], $poster3, PREG_SET_ORDER);
            preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $row['post_text'], $poster2, PREG_SET_ORDER);
            preg_match_all('/\[img\](.*?)\[\/img\]/i', $row['post_text'], $poster1, PREG_SET_ORDER);
                $url = '';
                if (isset($poster3[0][1])) $url = $poster3[0][1];
                elseif (isset($poster4[0][1])) $url = $poster4[0][1];
                elseif (isset($poster2[0][1])) $url = $poster2[0][1];
                elseif (isset($poster1[0][1])) $url = $poster1[0][1];
                DB()->query("UPDATE ". BB_TOPICS ." SET topic_image = '$url' WHERE topic_id = $topic_id ");
    }

Открыть includes/page_header.php

Найти

// FOR SEO
$template->assign_vars(array(
    'SEO_LINK_INDEX_PAGE'             =>    seo_link_header('index'),
    'SEO_LINK_TRACKER_PAGE'         =>    seo_link_header('tracker'),
    'SEO_LINK_GALLERY_PAGE'         =>    seo_link_header('gallery'),
    'SEO_LINK_SEARCH_PAGE'             =>    seo_link_header('search'),
    'SEO_LINK_FAQ_PAGE'             =>    seo_link_header('faq'),
    'SEO_LINK_GROUP_PAGE'             =>    seo_link_header('groupcp'),
    'SEO_LINK_MEMEBERLIST_PAGE'     =>    seo_link_header('memberlist'),
));

Ниже вставить

$template->assign_vars(array(
    'PAGE_DESCRIPTION'    => "<meta name=\"description\" content=\"".$bb_cfg['site_desc']."\" />\n",
    'PAGE_KEYWORDS'       => "<meta name=\"keywords\" content=\"".$bb_cfg['global_keywords']."\" />\n",
));

Открыть includes/functions_post.php

Найти

$topic_dl_type = (isset($_POST['topic_dl_type']) && ($post_info['allow_reg_tracker'] || $is_auth['auth_mod'])) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;

Ниже вставить

$meta = create_metatags ($post_message);
$description = $meta['description'];
$keywords = $meta['keywords'];

Найти

$sql_update = "
                UPDATE
                    " . BB_TOPICS . "
                SET
                    topic_title = '$post_subject',
                    topic_type = $topic_type,
                    topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
                    topic_vote = " . $topic_vote : "") . ",
                    is_draft = $to_draft
                WHERE
                    topic_id = $topic_id
            ";
         
Заменить на

$sql_update = "
                UPDATE
                    " . BB_TOPICS . "
                SET
                    topic_title = '$post_subject',
                    topic_type = $topic_type,
                    topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
                    topic_vote = " . $topic_vote : "") . ",
                    is_draft = $to_draft,
                    keywords = '$keywords',
                    descr = '$description'
                WHERE
                    topic_id = $topic_id
            ";

Найти

$sql  = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $to_draft)" : $sql_update;

Заменить на

$sql  = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft, keywords, descr) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $to_draft, '$keywords', '$description')" : $sql_update;

Открыть includes/functions.php

В самый конец файла вставить

function meta_search ($url = false, $title = false, $images = false, $description = false, $keywords = false)
{
    global $template, $bb_cfg;
 
    $title = str_replace('&quot;', '', $title);
 
    $description = "<meta name=\"description\" content=\"$description\" />\n";
    $keywords      = "<meta name=\"keywords\" content=\"$keywords\" />\n";
    $article      = (isset($description) || isset($keywords)) ? "<meta property=\"og:type\" content=\"article\" />\n" : "";
    $generator     = (isset($title) || isset($url) || isset($images)) ? "<meta name=\"generator\" content=\"".$bb_cfg['sitename']." (http://".$bb_cfg['server_name']."/)\" />\n" : "";
    $site_name     = (isset($title) || isset($url) || isset($images)) ? "<meta property=\"og:site_name\" content=\"".$bb_cfg['sitename']."\" />\n" : "";
    $title          = (isset($title)) ? "<meta property=\"og:title\" content=\"".strip_tags($title)."\" />\n" : "";
    $url          = (isset($url)) ? "<meta property=\"og:url\" content=\"$url\" />\n" : "";
    $images      = (isset($images)) ? "<meta property=\"og:image\" content=\"$images\" />\n" : "";
 
    $meta_tags = $description.$keywords.$generator.$site_name.$article.$title.$url.$images;
 
    $template->assign_vars(array('META_TAGS_HEAD' => $meta_tags));

}

function bb_substr($str, $start, $length, $charset ) {

    if ( strtolower($charset) == "utf-8") return iconv_substr($str, $start, $length, "utf-8");
    else return substr($str, $start, $length);

}

function bb_strlen($value, $charset ) {

    if ( strtolower($charset) == "utf-8") return iconv_strlen($value, "utf-8");
    else return strlen($value);

}

function create_metatags ($text)
{
    $keyword_count = 20;
    $newarr = array ();
    $meta['description'] = $meta['keywords'] = array();
    $quotes = array ("\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "$", "<", ">", "?", "!", '"');
    $fastquotes = array ("\x22", "\x60", "\t", "\n", "\r", '"', '\r', '\n', "$", "{", "}", "[", "]", "<", ">");
 
    $text = str_replace( "&nbsp;", " ", $text);
    $text = preg_replace('#\[img=(left|right)\].*?\[/img\]\s*#isu', '', $text);
    $text = preg_replace('#\[img\].*?\[/img\]#isu', '', $text);
    $text = preg_replace('#http://.*? #isu', '', $text);
    $text = preg_replace('#\[.*?\]#isu', ' ', $text);
    $text = str_replace( '<br />', ' ', $text);
    $text = strip_tags($text);
    $text = preg_replace( "#&(.+?);#", "", $text);
    $text = trim(str_replace( " ,", "", $text));
     
    $search_word = array("Описание", "О фильме", "Сюжет фильма");
    $i= array_count_values($search_word);
 
    if (preg_match('#Описание#is', $text) || preg_match('#О фильме#is', $text) || preg_match('#Сюжет фильма#is', $text))
        {
        $pos = strpos($text, 'Сюжет фильма');
        $pos .= strpos($text, 'О фильме');
        $pos .= strpos($text, 'Описание');      
        $text_d = substr($text, $pos);
        }
    else{ $text_d = '';}
     
    if($text_d = ($text_d != '') ? $text_d : $text)
        {
        $description = str_replace($fastquotes, '', $text_d);
        $description = str_replace(":", '', $description);
        $description = preg_replace("/(\s){2,}/",' ',$description);
        $description = str_replace($search_word, '', trim($description));
        $meta['description'] = trim(bb_substr( stripslashes($description), 0, 190, 'utf-8' ));
     
    } else { $meta['description'] = ''; }
     
    if( trim($text) != "" ) {
        $text = str_replace($quotes, ' ', $text);  
        $arr = explode(" ", $text);
     
        foreach ( $arr as $word ) {
            if( bb_strlen( $word, 'utf-8' ) > 4 ) $newarr[] = $word;
        }
     
        $arr = array_count_values( $newarr );
        arsort( $arr );  
        $arr = array_keys( $arr );  
        $total = count( $arr );  
        $offset = 0;
        $arr = array_slice( $arr, $offset, $keyword_count );
        $meta['keywords'] = implode( ", ", $arr );
     
    } else { $meta['keywords'] = ''; }
 
    return $meta;
}

Открыть templates/default/page_header.tpl

Найти

{META}

Выше добавить

<!-- IF META_TAGS_HEAD -->{META_TAGS_HEAD}<!-- ELSE -->{PAGE_DESCRIPTION}{PAGE_KEYWORDS}<!-- ENDIF -->

Открыть admin/admin_board.php

Найти

'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),

Ниже добавить

'CONFIG_SITE_KEYSWORDS' => htmlCHR($new['global_keywords']),

Открыть templates/admin/admin_board.tpl

Найти

<tr>
    <td><h4>{L_SITE_DESC}</h4></td>
    <td><input class="post" type="text" size="40" maxlength="255" name="site_desc" value="{CONFIG_SITE_DESCRIPTION}" /></td>
</tr>

Ниже вставить

<tr>
    <td><h4>{L_GLOBAL_KEYWORDS}</h4></td>
    <td><input class="post" type="text" size="40" maxlength="255" name="config_site_keywords" value="{CONFIG_SITE_KEYSWORDS}" /></td>
</tr>

Открыть language/lang_english/lang_admin.php

В самый конец файла вставить

$lang['GLOBAL_KEYWORDS'] = 'Global keywords';

Открыть language/lang_russian/lang_admin.php

В самый конец файла вставить

$lang['GLOBAL_KEYWORDS'] = 'Глобальные ключевые слова';
Ребят, помогите, всем полезно будет
 

Protektor

Пользователь
Я так понимаю что в 228_rutor.php надо копать используя:
PHP:
Выпонить запросы в базу

ALTER TABLE `bb_topics` ADD `descr` varchar(200) NOT NULL DEFAULT '', ADD `keywords` text NOT NULL, ADD `topic_image` VARCHAR( 255 ) NOT NULL DEFAULT '';
INSERT INTO `bb_config` VALUES ('global_keywords', '');

Открыть viewtopic.php

Найти

// Does this topic contain DL-List?

Выше добавить

if (function_exists('seo_url')) $url_meta = make_url(seo_url(TOPIC_URL . $topic_id, $topic_title));
else $url_meta = make_url(TOPIC_URL . $topic_id);

meta_search($url_meta, $topic_title, $t_data['topic_image'], $t_data['descr'], $t_data['keywords']);


Открыть posting.php

Найти

if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)

Ниже добавить

if ($mode == 'newtopic' && defined('TORRENT_ATTACH_ID') || defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
    {
        $row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");         
            preg_match_all('/\[poster\](.*?)\[\/poster\]/i', $row['post_text'], $poster4, PREG_SET_ORDER);
            preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $row['post_text'], $poster3, PREG_SET_ORDER);
            preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $row['post_text'], $poster2, PREG_SET_ORDER);
            preg_match_all('/\[img\](.*?)\[\/img\]/i', $row['post_text'], $poster1, PREG_SET_ORDER);
                $url = '';
                if (isset($poster3[0][1])) $url = $poster3[0][1];
                elseif (isset($poster4[0][1])) $url = $poster4[0][1];
                elseif (isset($poster2[0][1])) $url = $poster2[0][1];
                elseif (isset($poster1[0][1])) $url = $poster1[0][1];
                DB()->query("UPDATE ". BB_TOPICS ." SET topic_image = '$url' WHERE topic_id = $topic_id ");
    }

Открыть includes/page_header.php

Найти

// FOR SEO
$template->assign_vars(array(
    'SEO_LINK_INDEX_PAGE'             =>    seo_link_header('index'),
    'SEO_LINK_TRACKER_PAGE'         =>    seo_link_header('tracker'),
    'SEO_LINK_GALLERY_PAGE'         =>    seo_link_header('gallery'),
    'SEO_LINK_SEARCH_PAGE'             =>    seo_link_header('search'),
    'SEO_LINK_FAQ_PAGE'             =>    seo_link_header('faq'),
    'SEO_LINK_GROUP_PAGE'             =>    seo_link_header('groupcp'),
    'SEO_LINK_MEMEBERLIST_PAGE'     =>    seo_link_header('memberlist'),
));

Ниже вставить

$template->assign_vars(array(
    'PAGE_DESCRIPTION'    => "<meta name=\"description\" content=\"".$bb_cfg['site_desc']."\" />\n",
    'PAGE_KEYWORDS'       => "<meta name=\"keywords\" content=\"".$bb_cfg['global_keywords']."\" />\n",
));

Открыть includes/functions_post.php

Найти

$topic_dl_type = (isset($_POST['topic_dl_type']) && ($post_info['allow_reg_tracker'] || $is_auth['auth_mod'])) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;

Ниже вставить

$meta = create_metatags ($post_message);
$description = $meta['description'];
$keywords = $meta['keywords'];

Найти

$sql_update = "
                UPDATE
                    " . BB_TOPICS . "
                SET
                    topic_title = '$post_subject',
                    topic_type = $topic_type,
                    topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
                    topic_vote = " . $topic_vote : "") . ",
                    is_draft = $to_draft
                WHERE
                    topic_id = $topic_id
            ";
        
Заменить на

$sql_update = "
                UPDATE
                    " . BB_TOPICS . "
                SET
                    topic_title = '$post_subject',
                    topic_type = $topic_type,
                    topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
                    topic_vote = " . $topic_vote : "") . ",
                    is_draft = $to_draft,
                    keywords = '$keywords',
                    descr = '$description'
                WHERE
                    topic_id = $topic_id
            ";

Найти

$sql  = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $to_draft)" : $sql_update;

Заменить на

$sql  = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft, keywords, descr) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $to_draft, '$keywords', '$description')" : $sql_update;

Открыть includes/functions.php

В самый конец файла вставить

function meta_search ($url = false, $title = false, $images = false, $description = false, $keywords = false)
{
    global $template, $bb_cfg;

    $title = str_replace('&quot;', '', $title);

    $description = "<meta name=\"description\" content=\"$description\" />\n";
    $keywords      = "<meta name=\"keywords\" content=\"$keywords\" />\n";
    $article      = (isset($description) || isset($keywords)) ? "<meta property=\"og:type\" content=\"article\" />\n" : "";
    $generator     = (isset($title) || isset($url) || isset($images)) ? "<meta name=\"generator\" content=\"".$bb_cfg['sitename']." (http://".$bb_cfg['server_name']."/)\" />\n" : "";
    $site_name     = (isset($title) || isset($url) || isset($images)) ? "<meta property=\"og:site_name\" content=\"".$bb_cfg['sitename']."\" />\n" : "";
    $title          = (isset($title)) ? "<meta property=\"og:title\" content=\"".strip_tags($title)."\" />\n" : "";
    $url          = (isset($url)) ? "<meta property=\"og:url\" content=\"$url\" />\n" : "";
    $images      = (isset($images)) ? "<meta property=\"og:image\" content=\"$images\" />\n" : "";

    $meta_tags = $description.$keywords.$generator.$site_name.$article.$title.$url.$images;

    $template->assign_vars(array('META_TAGS_HEAD' => $meta_tags));

}

function bb_substr($str, $start, $length, $charset ) {

    if ( strtolower($charset) == "utf-8") return iconv_substr($str, $start, $length, "utf-8");
    else return substr($str, $start, $length);

}

function bb_strlen($value, $charset ) {

    if ( strtolower($charset) == "utf-8") return iconv_strlen($value, "utf-8");
    else return strlen($value);

}

function create_metatags ($text)
{
    $keyword_count = 20;
    $newarr = array ();
    $meta['description'] = $meta['keywords'] = array();
    $quotes = array ("\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', ",", ".", "/", "¬", "#", ";", ":", "@", "~", "[", "]", "{", "}", "=", "-", "+", ")", "(", "*", "^", "%", "$", "<", ">", "?", "!", '"');
    $fastquotes = array ("\x22", "\x60", "\t", "\n", "\r", '"', '\r', '\n', "$", "{", "}", "[", "]", "<", ">");

    $text = str_replace( "&nbsp;", " ", $text);
    $text = preg_replace('#\[img=(left|right)\].*?\[/img\]\s*#isu', '', $text);
    $text = preg_replace('#\[img\].*?\[/img\]#isu', '', $text);
    $text = preg_replace('#http://.*? #isu', '', $text);
    $text = preg_replace('#\[.*?\]#isu', ' ', $text);
    $text = str_replace( '<br />', ' ', $text);
    $text = strip_tags($text);
    $text = preg_replace( "#&(.+?);#", "", $text);
    $text = trim(str_replace( " ,", "", $text));
    
    $search_word = array("Описание", "О фильме", "Сюжет фильма");
    $i= array_count_values($search_word);

    if (preg_match('#Описание#is', $text) || preg_match('#О фильме#is', $text) || preg_match('#Сюжет фильма#is', $text))
        {
        $pos = strpos($text, 'Сюжет фильма');
        $pos .= strpos($text, 'О фильме');
        $pos .= strpos($text, 'Описание');     
        $text_d = substr($text, $pos);
        }
    else{ $text_d = '';}
    
    if($text_d = ($text_d != '') ? $text_d : $text)
        {
        $description = str_replace($fastquotes, '', $text_d);
        $description = str_replace(":", '', $description);
        $description = preg_replace("/(\s){2,}/",' ',$description);
        $description = str_replace($search_word, '', trim($description));
        $meta['description'] = trim(bb_substr( stripslashes($description), 0, 190, 'utf-8' ));
    
    } else { $meta['description'] = ''; }
    
    if( trim($text) != "" ) {
        $text = str_replace($quotes, ' ', $text); 
        $arr = explode(" ", $text);
    
        foreach ( $arr as $word ) {
            if( bb_strlen( $word, 'utf-8' ) > 4 ) $newarr[] = $word;
        }
    
        $arr = array_count_values( $newarr );
        arsort( $arr ); 
        $arr = array_keys( $arr ); 
        $total = count( $arr ); 
        $offset = 0;
        $arr = array_slice( $arr, $offset, $keyword_count );
        $meta['keywords'] = implode( ", ", $arr );
    
    } else { $meta['keywords'] = ''; }

    return $meta;
}

Открыть templates/default/page_header.tpl

Найти

{META}

Выше добавить

<!-- IF META_TAGS_HEAD -->{META_TAGS_HEAD}<!-- ELSE -->{PAGE_DESCRIPTION}{PAGE_KEYWORDS}<!-- ENDIF -->

Открыть admin/admin_board.php

Найти

'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),

Ниже добавить

'CONFIG_SITE_KEYSWORDS' => htmlCHR($new['global_keywords']),

Открыть templates/admin/admin_board.tpl

Найти

<tr>
    <td><h4>{L_SITE_DESC}</h4></td>
    <td><input class="post" type="text" size="40" maxlength="255" name="site_desc" value="{CONFIG_SITE_DESCRIPTION}" /></td>
</tr>

Ниже вставить

<tr>
    <td><h4>{L_GLOBAL_KEYWORDS}</h4></td>
    <td><input class="post" type="text" size="40" maxlength="255" name="config_site_keywords" value="{CONFIG_SITE_KEYSWORDS}" /></td>
</tr>

Открыть language/lang_english/lang_admin.php

В самый конец файла вставить

$lang['GLOBAL_KEYWORDS'] = 'Global keywords';

Открыть language/lang_russian/lang_admin.php

В самый конец файла вставить

$lang['GLOBAL_KEYWORDS'] = 'Глобальные ключевые слова';
Ребят, помогите, всем полезно будет
Хватит уже ныть во всех темых о мета тегах, не выкладывают мод в общее пользование значит не считают нужным, не можете сами написать заказывайте за деньги, у меня такой мод больше года по крону работает, но продать его я не могу только потому что моего там срочек 10-15 кода ))) остальное взято из существующего мода. А выкладывать в общее пользование я смысла не вижу, слишком много тут тех кто хочет что бы ему все бесплатно доставалось.
 
Сверху