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

Автоматический парсер раздач с 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 кода ))) остальное взято из существующего мода. А выкладывать в общее пользование я смысла не вижу, слишком много тут тех кто хочет что бы ему все бесплатно доставалось.
 

sergey67

Пользователь
Я так понимаю что в 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'] = 'Глобальные ключевые слова';
Ребят, помогите, всем полезно будет
PHP:
function submit_torrent($subject, $message, $forum_id, $torfile, $time, $user_id)
{
    global $lang, $bb_cfg;

    $user_ip = '7f000001';
    if(!$user_id) $user_id = BOT_UID;

    $subject = preg_replace("/(FREEISLAND|HQCLUB|HQ-ViDEO|HELLYWOOD|ExKinoRay|NewStudio|LostFilm|RiperAM|Generalfilm|Files-x|NovaLan|Scarabey|New-Team|HD-NET|MediaClub|Baibako|CINEMANIA|Rulya74|RG WazZzuP|Ash61|egoleshik|Т-Хzona|TORRENT - BAGIRA|F-Torrents|2LT_FS|Bagira|Pshichko66|Занавес|msltel|Leo.pard|Точка Zрения|BenderBEST|PskovLine|HDReactor|Temperest|Element-Team|BT-Club|Filmoff CLUB|HD Club|HDCLUB|potroks|fox-torrents|HYPERHD|GORESEWAGE|NoLimits-Team|New Team|FireBit-Films|NNNB|New-team|Youtracker|marcury|Neofilm|Filmrus|Deadmauvlad|Torrent-Xzona|Brazzass|Кинорадиомагия|Assassin&#039;s Creed|GOLDBOY|ClubTorrent|AndreSweet|TORRENT-45|0ptimus|Torrange|Sanjar &amp; NeoJet|Leonardo|BTT-TEAM и Anything-group|BTT-TEAM|Anything-group|Gersuzu|Xixidok|PEERATES|ivandubskoj|R. G. Jolly Roger|Fredd Kruger|Киномагия|RG MixTorrent|RusTorents|Тorrent-Хzona|R.G. Mega Best|Gold Cartoon KINOREAKTOR (Sheikn)|ImperiaFilm|RG Jolly Roger|Sheikn|R.G. Mobile-Men|KinoRay &amp; Sheikn|HitWay|mcdangerous|Тorren|Stranik 2.0|Romych|R.G. AVI|Lebanon|Big111|Dizell|СИНЕМА-ГРУПП|PlanetaUA|RG Superdetki|potrokis|olegek70|bAGrat|Alekxandr48|Mao Dzedyn|Fartuna|R.G.Mega Best|DenisNN|Киномагии|UAGet|Victorious|Gold Cartoon KINOREAKTOR|KINOREAKTOR|KinoFiles|HQRips|F-Torrent|A.Star|Beeboop|Azazel|Leon-masl|Vikosol|RG Orient Extreme|R.G.TorrBy|ale x2008|Deadmauvlad|semiramida1970|Zelesk|CineLab SoundMix|Сотник|ALGORITM|E76|datynet|Дяди Лёши| leon030982|GORESEWAGE|Hot-Film|КинозалSAT|ENGINEER|CinemaClub|Zlofenix|pro100shara|FreeRutor|FreeHD|гаврила|vadi|SuperMin|GREEN TEA|Kerob|AGR - Generalfilm|R.G. DHT-Music|Витек 78|Twi7ter|KinoGadget|BitTracker|KURD28|Gears Media|KINONAVSE100|Just TeMa|OlLanDGroup|Portablius|MegaPeer|Megapeer|селезень)/si","Хит Рус Тор",$subject);
    
    DB()->sql_query("INSERT INTO ". BB_TOPICS ."
        (topic_title, topic_poster, topic_time, forum_id, topic_attachment, topic_dl_type, topic_last_post_time)
        VALUES
        ('$subject', $user_id, '$time', $forum_id, '1', '1', '$time')");
    $topic_id = DB()->sql_nextid();

    DB()->sql_query("INSERT INTO ". BB_POSTS ."
        (topic_id, forum_id, poster_id, post_time, poster_ip, post_attachment)
        VALUES
        ($topic_id, $forum_id, $user_id, '$time', '$user_ip', '1')");
    $post_id = DB()->sql_nextid();

    DB()->sql_query("UPDATE ". BB_TOPICS ." SET
        topic_first_post_id = $post_id,
        topic_last_post_id = $post_id
        WHERE topic_id = $topic_id");

    DB()->sql_query("INSERT INTO ". BB_POSTS_TEXT ."
        (post_id, post_text)
        VALUES
        ($post_id, '$message')");

    add_search_words($post_id, stripslashes($message), stripslashes($subject));

    DB()->sql_query("INSERT INTO ". BB_ATTACHMENTS_DESC ."
        (physical_filename, real_filename, extension, mimetype, filesize, filetime)
        VALUES
        ('". $torfile['physical_filename'] ."', '". $torfile['real_filename'] ."', 'torrent', 'application/x-bittorrent', '". $torfile['filesize'] ."', ". $time .")");
    $attach_id = DB()->sql_nextid();

    DB()->sql_query("INSERT INTO ". BB_ATTACHMENTS ."
        (attach_id, post_id, user_id_1)
        VALUES
        ($attach_id, $post_id, ". $user_id .")");

    DB()->sql_query("UPDATE ". BB_FORUMS ." SET
        forum_posts = forum_posts + 1,
        forum_last_post_id = $post_id,
        forum_topics = forum_topics + 1
        WHERE forum_id = $forum_id");

    DB()->sql_query("UPDATE rutor_releases SET time = ". TIMENOW ." WHERE title = '$subject'");

    if ($bb_cfg['last_added'])
    {
        $row = DB()->fetch_row("SELECT post_text FROM ". BB_POSTS_TEXT ." WHERE post_id = $post_id");           
            preg_match_all('/\[gposter=right\](.*?)\[\/gposter\]/i', $row['post_text'], $poster7, PREG_SET_ORDER);
            preg_match_all('/\[gposter=left\](.*?)\[\/gposter\]/i', $row['post_text'], $poster6, PREG_SET_ORDER);
            preg_match_all('/\[gposter\](.*?)\[\/gposter\]/i', $row['post_text'], $poster5, PREG_SET_ORDER);
            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 = empty($url) ? 'noposter.png' : '';
        if (isset($poster7[0][1])) $url = $poster7[0][1];
        elseif (isset($poster6[0][1])) $url = $poster6[0][1];
        elseif (isset($poster5[0][1])) $url = $poster5[0][1];
        elseif (isset($poster4[0][1])) $url = $poster4[0][1];
        elseif (isset($poster3[0][1])) $url = $poster3[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");
    }
    
$sql = DB()->fetch_rowset("SELECT t.topic_id, p.post_text
    FROM bb_topics t
    LEFT JOIN bb_posts_text p ON (p.post_id = t.topic_first_post_id)  WHERE descr = '' OR keywords = ''");
    
foreach($sql as $row)
{
    $meta = create_metatags($row['post_text']);
    DB()->sql_query("UPDATE bb_topics SET keywords = '".$meta['keywords']."', descr = '".$meta['description']."' WHERE topic_id = ".$row['topic_id']."");
}

    
    tracker_register ($attach_id, '0', TOR_NOT_APPROVED);
}
 

ivangord

Пользователь
Всем привет! Кто-нибудь уже пробовал ставить на новую версию? я никак не могу прицепить регистрацию торрента. Ругается на src/Legacy/Torrent.php и на строку №71. Не определяет Undefined constant "TorrentPier\Legacy\IS_ADMIN"
 

ivangord

Пользователь
функцию регистрации цепляю вот таким образом: \TorrentPier\Legacy\Torrent::tracker_register($attach_id, 'newtopic', TOR_NOT_APPROVED);
 
Сверху