форум vBSupport.ru > В помощь веб-мастеру > Общие вопросы сайтостроения
Register Меню vBsupport Изображения Files Manager О рекламе Today's Posts Search
  • Родная гавань
  • Блок РКН снят
  • Premoderation
  • For English speaking users
  • Каталог Фрилансеров
  • If you want to buy some product or script
  • Администраторам
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
Блок РКН снят, форум доступен на всей территории России, включая новые терртории, без VPN
На форуме введена премодерация ВСЕХ новых пользователей

Почта с временных сервисов, типа mailinator.com, gawab.com и/или прочих, которые предоставляют временный почтовый ящик без регистрации и/или почтовый ящик для рассылки спама, отслеживается и блокируется, а так же заносится в спам-блок форума, аккаунты удаляются
for English speaking users:
You may be surprised with restriction of access to the attachments of the forum. The reason is the recent change in vbsupport.org strategy:

- users with reputation < 10 belong to "simple_users" users' group
- if your reputation > 10 then administrator (kerk, Luvilla) can decide to move you into an "improved" group, but only manually

Main idea is to increase motivation of community members to share their ideas and willingness to support to each other. You may write an article for the subject where you are good enough, you may answer questions, you may share vbulletin.com/org content with vbsupport.org users, receiving "thanks" equal your reputation points. We should not only consume, we should produce something.

- you may:
* increase your reputation (doing something useful for another members of community) and being improved
* purchase temporary access to the improved category:
10 $ for 3 months. - this group can download attachments, reputation/posts do not matter.
20 $ for 3 months. - this group can download attachments, reputation/posts do not matter + adds eliminated + Inbox capacity increased + files manager increased permissions.

Please contact kerk or Luvilla regarding payments.

Important!:
- if your reputation will become less then 0, you will be moved into "simple_users" users' group automatically.*
*for temporary groups (pre-paid for 3 months) reputation/posts do not matter.
Уважаемые пользователи!

На форуме открыт новый раздел "Каталог фрилансеров"

и отдельный раздел для платных заказов "Куплю/Закажу"

Если вы хотите приобрести какой то скрипт/продукт/хак из каталогов перечисленных ниже:
Каталог модулей/хаков
Ещё раз обращаем Ваше внимание: всё, что Вы скачиваете и устанавливаете на свой форум, Вы устанавливаете исключительно на свой страх и риск.
Сообщество vBSupport'а физически не в состоянии проверять все стили, хаки и нули, выкладываемые пользователями.
Помните: безопасность Вашего проекта - Ваша забота.
Убедительная просьба: при обнаружении уязвимостей или сомнительных кодов обязательно отписывайтесь в теме хака/стиля
Спасибо за понимание
 
 
 
 
Diamant
Знаток
 
Diamant's Avatar
Default Нужна помощь в написании модуля
0

На форуме стоит следующий хак - http://vbsupport.ru/forum/showthread.php?t=44793
В одном из его модулей идет обращение к php скрипту. Выполняется какая-то функция и модуль получает данные. Потом он эти данные регистрирует как переменные и их можно юзать в шаблоне. Все эти данные используются в posbit_legacy

Код этого модуля (можно не читать):
Code:
global $vbulletin;
if ($vbulletin->options['sc_thumbs_onoff'] AND $vbulletin->options['sc_thumbs_option_post']) {
  if (THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'showpost') {
    require_once(DIR . '/includes/functions_sc_thumbs.php'); 
    global $ids;
      $contenttype = 'post';
      $contentid = $post['postid'];
        $thumbs = fetch_thumbs($this->post['postid'], $ids, 'post', 'postid');
        $can_thumb = can_thumb_check($this->post, 'post', false, $thread['firstpostid'], $thread['forumid']);
            $type = thumbed_already_check($this->post, 'post', 'postid');
            $list = fetch_thumbers_bit($thumbs);
            $amount_unformatted = $list['users_plus_num'] - $list['users_minus_num'];      
            $amount = vb_number_format($amount_unformatted);

            $templater = vB_Template::create('sc_thumbs_box');         
              $templater->register('contenttype', $contenttype);
              $templater->register('contentid', $contentid);
              $templater->register('can_thumb', $can_thumb);
              $templater->register('type', $type);
              $templater->register('list', $list);
              $templater->register('amount', $amount);           
            $box['post_thumbs_box'] .= $templater->render();
            vB_Template::preRegister('postbit_legacy', $box);
            vB_Template::preRegister('postbit', $box);    
  }  
}

if ($vbulletin->options['sc_thumbs_onoff'] AND $vbulletin->options['sc_thumbs_option_nodecomment']) {
  if (THIS_SCRIPT == 'vbcms') {
    require_once(DIR . '/includes/functions_sc_thumbs.php'); 
    global $posts, $chk;
    if(!$chk) {$chk = 1;}
    if ($chk == 1) {$fetch_again = true;}else {$fetch_again = false;}      
      $contenttype = 'post';
      $contentid = $post['postid'];
        $thumbs = fetch_thumbs($this->post['postid'], $posts, 'post', 'postid', $fetch_again);
        $can_thumb = can_thumb_check($this->post, 'post', false);
            $type = thumbed_already_check($this->post, 'post', 'postid');
            $list = fetch_thumbers_bit($thumbs);
            $amount_unformatted = $list['users_plus_num'] - $list['users_minus_num'];      
            $amount = vb_number_format($amount_unformatted);

            $templater = vB_Template::create('sc_thumbs_box');         
              $templater->register('contenttype', $contenttype);
              $templater->register('contentid', $contentid);
              $templater->register('can_thumb', $can_thumb);
              $templater->register('type', $type);
              $templater->register('list', $list);
              $templater->register('amount', $amount);           
            $box['post_thumbs_box'] .= $templater->render();
            vB_Template::preRegister('vbcms_postbit_legacy', $box);
            vB_Template::preRegister('vbcms_postbit', $box);
   $chk++;          
  }
}

if (THIS_SCRIPT != 'vbcms') {
  if ($vbulletin->options['sc_thumbs_onoff'] AND $vbulletin->options['sc_thumbs_postbit_stats']) {
      $post['sc_thumbs_up_received'] = vb_number_format($post['sc_thumbs_up_received']);
      $post['sc_thumbs_down_received'] = vb_number_format($post['sc_thumbs_down_received']);
      $post['sc_thumbs_up_gave'] = vb_number_format($post['sc_thumbs_up_gave']);
      $post['sc_thumbs_down_gave'] = vb_number_format($post['sc_thumbs_down_gave']);
      
      $templater = vB_Template::create('sc_thumbs_postbit_info');
      $templater->register('post', $post);
      $template_hook['postbit_userinfo_right_after_posts'] .= $templater->render(); 
  }
}
Моя цель визуально (источник - MaulTalk):



Моя цель технически: мне нужно переменную amount (количество баллов у сообщения) передать в шаблон forumbit (отображение раздела), чтобы вывести возле каждой темы оценку ее первого поста.

Я в этом деле новичек, еще мало разбираюсь. Набросал следующий код:
Code:
global $vbulletin;
if ($vbulletin->options['sc_thumbs_onoff']) {
  if (THIS_SCRIPT == 'forumdisplay') {
    require_once(DIR . '/includes/functions_sc_thumbs.php'); 
    global $ids;
      $contenttype = 'post';
      $contentid = $post['postid'];
        $thumbs = fetch_thumbs($this->post['postid'], $ids, 'post', 'postid');
        $can_thumb = can_thumb_check($this->post, 'post', false, $thread['firstpostid'], $thread['forumid']);
            $list = fetch_thumbers_bit($thumbs);
            $amount_unformatted = $list['users_plus_num'] - $list['users_minus_num'];      
            $amount = vb_number_format($amount_unformatted);
            $templater = vB_Template::create('sc_thumbs_box');                   
            $box['post_thumbs_box'] .= $templater->render();
vB_Template::preRegister('forumbit',array('amount' => $amount));    
  }  
}
Знаю, что из ниоткуда не берется переменная айди поста, но это другая история.

Место выполнения - forumdisplay_start. После его активации, при переходе в раздел, выдает ошибку (Удаленный сервер или файл не найден), при этом остальные части форума работают. Что я делаю не так?
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 
 
mindframe
Специалист
 
mindframe's Avatar
Default
0

Бери ID первого поста темы, выводи рейтинг темы, 1 запрос в общем, правда с джоинами.
А то что ты кашу городишь, не нужно оно тебе.
 
 
Diamant
Знаток
 
Diamant's Avatar
Default
0

Quote:
Originally Posted by mindframe View Post
Бери ID первого поста темы, выводи рейтинг темы, 1 запрос в общем, правда с джоинами.
А то что ты кашу городишь, не нужно оно тебе.
Quote:
Originally Posted by Diamant View Post
Я в этом деле новичек, еще мало разбираюсь.
Какая переменная отвечает за ID первого поста? Как именно выводить?
 
 
mindframe
Специалист
 
mindframe's Avatar
Default
2

Quote:
Originally Posted by Diamant View Post
Какая переменная отвечает за ID первого поста? Как именно выводить?
Хранится в таблице thread, поле firstpostid, рейтинг поста хранится в таблице sc_thumbs_post, просто делай запрос к sc_thumbs_post и WHERE postid = $firstpostid.
Я могу написать код, это не сложно, просто попробуй сам разобраться, поверь, это интересно, возможно поначалу сложно, но у тебя под рукой как пример куча хаков, просто ковыряй и смотри.
 
 
Diamant
Знаток
 
Diamant's Avatar
Default
0

Quote:
Originally Posted by mindframe View Post
Хранится в таблице thread, поле firstpostid, рейтинг поста хранится в таблице sc_thumbs_post, просто делай запрос к sc_thumbs_post и WHERE postid = $firstpostid.
Я могу написать код, это не сложно, просто попробуй сам разобраться, поверь, это интересно, возможно поначалу сложно, но у тебя под рукой как пример куча хаков, просто ковыряй и смотри.
Дайте пример того, как достать из БД этот firstpostid. Тогда я буду по аналогии делать и научусь.

Diamant добавил 02.06.2013 в 00:06
Вот что набросал для получения firstpostid:

Code:
$point = $vbulletin->db->query_read("SELECT * FROM `".TABLE_PREFIX."thread` WHERE `threadid`=123");
vB_Template::preRegister('threadbit',array('point' => $point));
Вместо 123 нужно поставить айди темы. Откуда брать ее переменную?

Last edited by Diamant : 06-02-2013 at 12:06 AM. Reason: Добавлено сообщение
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT +4. The time now is 03:25 AM.


Powered by vBulletin® Version 3.5.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.