Уважаемые пользователи!
C 7 ноября 2020 года phpBB Group прекратила выпуск обновлений и завершила дальнейшее развитие phpBB версии 3.2.
С 1 августа 2024 года phpBB Group прекращает поддержку phpBB 3.2 на официальном сайте.
Сайт официальной русской поддержки phpBB Guru продолжит поддержку phpBB 3.2 до 31 декабря 2024 года.
С учетом этого, настоятельно рекомендуется обновить конференции до версии 3.3.

I Feel Lucky

Ответы на вопросы, связанные с модами для phpBB 2.0.x, кроме относящихся к форуму Для авторов (phpBB 2.0.x).
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

I Feel Lucky

Сообщение VVVas »

Есть такой мод

Код: Выделить всё

## easymod compliant
########################################################################################################
## MOD Title: I Feel Lucky
## MOD Author: AbelaJohnB < jabela@gmail.com > (John B. Abela) http://www.johnabela.com/mods/
## MOD Description: This MOD will create a new link within your header navigation that will link to a 
##                  random thread (permissions granted) within your forums. This MOD was inspired and 
##                  very much like the Google's "I'm Feeling Lucky" feature!
Добавляет в overall_header.tpl ссылку которая ведет на случайную тему.
Но у этого мода есть неприятный баг: после его установки в результатах поиска ссылки на страницы результатов поиска тоже начинают вести на случайную тему.
Автор об этой баге знает и написал следующее:
Okie,

I realized I did not use the "Proper" method of redirecting the user.

phpBB has for a long time now used it's own header() method, which I forgot to use.


I'm using pure php code method header() for the direct.

If you have problems with the redirect because of the header() mis-use, than I'd suggest you hunt down the "Proper" way to do it withing other sections of the core-code.

I really have no desire to repackage the entire MOD for this very pettie (IMVHO) issue that might affect 1% of the phpBB Community and probably 0.0000089% of those people coming to my website.
То есть в лом мне править.
проблема заключаеться от в этом куске кода (это собственно и есть весь мод):

Код: Выделить всё

#
#-----[ OPEN ]------------------------------------------
#
search.php

<...>
#
#-----[ FIND ]------------------------------------------
#
			//
			// Basic requirements
			//
			$show_results = 'topics';
			$sort_by = 0;
			$sort_dir = 'DESC';
		}

#
#-----[ AFTER, ADD ]------------------------------------------
#
		//
		// END MOD: I Feel Lucky MOD (AbelaJohnB)
		//
		else if ( $search_id == 'ifeellucky' )
		{
			if ( $auth_sql != '' )
			{
				$sql = "SELECT t.topic_id, f.forum_id
					FROM " . TOPICS_TABLE . "  t, " . FORUMS_TABLE . " f
					WHERE t.forum_id = f.forum_id
						AND t.topic_moved_id = 0
						AND $auth_sql
						ORDER BY RAND() LIMIT 1";
			}
			else
			{
				$sql = "SELECT topic_id 
					FROM " . TOPICS_TABLE . " ORDER BY RAND() LIMIT 1";
			}
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
			}
			$search_ids = array();
			while( $row = $db->sql_fetchrow($result) )
			{
				$search_ids[] = $row['topic_id'];
			}
			$db->sql_freeresult($result);
			//
			$temp_url = append_sid("viewtopic.php?t=".$search_ids[0]);
			header("Location: " . $temp_url );
			die($temp_url);
			//
		}
		//
		// END MOD: I Feel Lucky MOD (AbelaJohnB)
		//
Может у кого есть идеи как это поправить?
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

А не проще ли сделать этот мод с нуля без каких либо глюков (в том числе и этого) и намного более простой как в установке так и в работе ?

(сделал бы в течении 20-ти минут, но я выпил пару литров пива и по этому в ближайшие 12-16 часов не возьмусь)
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Vladson
Если проше, то вперед и с песней, я не против, просто мне бы хотелось такое развлечение.

Добавлено спустя 1 час 3 минуты 8 секунд:

Я так понимаю, идея примерно такова:

Код: Выделить всё

######################################################## 
## Mod Title:   View Random Topic 
## Mod Version: 1.0 
## Author:       Matthijs van de Water <matthijs@beryllium.net> 
## Description:  Totally useless feature  
##               Will direct you to a random topic. 
## 
## Installation Level:  easy 
## Installation Time:   5-8 Minutes 
## Files To Edit:       4 (viewtopic.php, index.php, 
##                         lang_main.php, index_body.tpl) 
######################################################## 
## KNOWN LIMITATIONS: 
##  Will output an error if you don't have permission 
##  to view or read the topic. 
##  Refreshing will get you another topic  
######################################################## 

# 
#-----[ FIND in viewtopic.php ]------------------------------------------ 
# 
if( !isset($topic_id) && !isset($post_id) ) 

# 
#-----[ CHANGE to ]------------------------------------------ 
# 
if( !isset($topic_id) && !isset($post_id) && $HTTP_GET_VARS['view'] != 'random' ) 

# 
#-----[ FIND in viewtopic.php ]------------------------------------------ 
# 
    else 
    { 
        $topic_id = $row['topic_id']; 
    } 
} 

# 
#-----[ ADD after ]------------------------------------------ 
# 
else if ( $HTTP_GET_VARS['view'] == 'random' ) 
{ 
    $sql = "SELECT t.topic_id 
        FROM " . TOPICS_TABLE . " t 
        ORDER BY RAND() 
        LIMIT 1"; 
    if ( !($result = $db->sql_query($sql)) ) 
    { 
        message_die(GENERAL_ERROR, "Could not obtain random topic information", '', __LINE__, __FILE__, $sql); 
    } 
    if ( !($row = $db->sql_fetchrow($result)) ) 
    { 
        message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); 
    } 
    else 
    { 
        $topic_id = $row['topic_id']; 
    } 
} 
# 
#-----[ FIND in index.php ]------------------------------------------ 
# 
  'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'], 
# 
#-----[ ADD after ]------------------------------------------ 
# 
  'L_VIEW_RANDOM_TOPIC' => $lang['View_random_topic'], 
  'U_VIEW_RANDOM_TOPIC' => append_sid("viewtopic.$phpEx?view=random"), 

# 
#-----[ FIND in language/lang_english/lang_main.php ]----------------------- 
# 
    $lang['Forums_marked_read'] = "All forums have been marked read"; 

# 
#-----[ ADD after ]------------------------------------------ 
# 
    $lang['View_random_topic'] = "View A Random Topic"; 

# 
#-----[ FIND in templates/subSilver/index_body.tpl ]------------------------------------------ 
# 
    <a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td> 
# 
#-----[ CHANGE to ]------------------------------------------ 
# 
    <a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a><br /> 
    <a href="{U_VIEW_RANDOM_TOPIC}" class="gensmall">{L_VIEW_RANDOM_TOPIC}</a> 
    </td> 

# 
#----------------------------------------------- 
#
?
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Проще не получается пока, но это наверное потому что я пъяный не ставте не посоветовавшись со специалистами (если конечно вы сами не специалист)

Код: Выделить всё

#
# open
#
viewtopic.php

#
# find
#
if ( !isset($topic_id) && !isset($post_id) )
{
	message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

#
# replace
#
if ( !isset($HTTP_GET_VARS['ifeellucky']) )
{
	if ( !isset($topic_id) && !isset($post_id) )
	{
		message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
	}
}
else
{
	$sql = "SELECT t.topic_id
		FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
		WHERE f.auth_view = 0
			AND f.auth_read = 0
		ORDER BY RAND()
		LIMIT 1";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
	}

	if ( $row = $db->sql_fetchrow($result) )
	{
		$topic_id = intval($row['topic_id']);
	}
	else
	{
		message_die(GENERAL_ERROR, "Could not obtain topic information");
	}
}

#
# open
#
includes/page_header.php

#
# find
#
	'L_FAQ' => $lang['FAQ'],

#
# add
#
	'L_LUCK' => $lang['luck'],

#
# find
#
	'U_FAQ' => append_sid('faq.'.$phpEx),

#
# add
#
	'U_LUCK' => append_sid('viewtopic.'.$phpEx.'?ifeellucky=1'),

#
# open
#
language/lang_english/lang_main.php

#
# find
#
$lang['FAQ'] = 'FAQ';

#
# add
#
$lang['luck'] = 'Luck';

#
# open
#
template/subSilver/overall_header.tpl

#
# find
#
<table cellspacing="0" cellpadding="2" border="0">
	<tr> 
		<td align="center" valign="top" nowrap="nowrap">

#
# in-line find
#
<span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" />{L_FAQ}</a></span>

#
# in-line, before
#
<span class="mainmenu">&nbsp;<a href="{U_LUCK}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_LUCK}" hspace="3" />{L_LUCK}</a></span>

#
# eom
#
Если надо напишу ещё подругому но это уже когда буду трезвый...

Добавлено спустя 1 минуту 12 секунд:
VVVas писал(а):## Description: Totally useless feature
## Will direct you to a random topic.
А вот с описанием полностью согласен :D Totally useless
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Vladson
Ну у меня же стоит keep unread flag 2, так вот он поменял кое чего, а как это прикрутить я не в курсе. Вот чего он натворил во viewtopic.php

Код: Выделить всё

#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
if ( !isset($topic_id) && !isset($post_id) )
{
	message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

//
// Find topic id if user requested a newer
// or older topic
//
if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
{
	if ( $HTTP_GET_VARS['view'] == 'newest' )
	{
		if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
		{
			$session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];

			if (!preg_match('/^[A-Za-z0-9]*$/', $session_id))
			{
				$session_id = '';
			}

			if ( $session_id )
			{
				$sql = "SELECT p.post_id
					FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s,  " . USERS_TABLE . " u
					WHERE s.session_id = '$session_id'
						AND u.user_id = s.session_user_id
						AND p.topic_id = $topic_id
						AND p.post_time >= u.user_lastvisit
					ORDER BY p.post_time ASC
					LIMIT 1";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
				}

				if ( !($row = $db->sql_fetchrow($result)) )
				{
					message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
				}

				$post_id = $row['post_id'];

				if (isset($HTTP_GET_VARS['sid']))
				{
					redirect("viewtopic.$phpEx?sid=$session_id&" . POST_POST_URL . "=$post_id#$post_id");
				}
				else
				{
					redirect("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id");
				}
			}
		}

		redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
	}

#
#-----[ REPLACE WITH ]------------------------------------------
#
//START MOD Keep_unread_2
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? htmlspecialchars( $HTTP_GET_VARS['mode'] ) : '';

if ( !empty($post_id) )
{ //added topic_last_post_id, p.post_time to sql
	$sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, p.post_time
		FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
		WHERE t.topic_id = p.topic_id
		AND t.topic_moved_id = 0
		AND p.post_id = $post_id";
}
else if ( !empty($topic_id) )
{
	$sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id
		FROM " . TOPICS_TABLE . " t
		WHERE t.topic_moved_id = 0
		AND t.topic_id = $topic_id";
}
else
{
	message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
if ( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($result) )
{
	message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_id = $row['forum_id'];
$topic_id = $row['topic_id'];
$post_time = $row['post_time'];
$topic_last_post_id = $row['topic_last_post_id'];
//END MOD Keep_unread_2

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//

//START MOD Keep_unread_2 * Keep topic unread from given post onwards
if ($mode == 'unread')
{
	$board_config['tracking_unreads'][$topic_id] = $post_time-1; //testing for ">" only later on
	write_cookies($userdata);
	$message = $lang['keep_unread_done'] . '<br /><br />' .
	sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a> ') . '<br /><br />' .
	sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');
	message_die(GENERAL_MESSAGE, $message);
}
$topic_last_read = topic_last_read($forum_id, $topic_id);
//END MOD Keep_unread_2

//
// Find topic id if user requested a newer
// or older topic
//
if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
{
	if ( $HTTP_GET_VARS['view'] == 'newest' )
	{ // read the first unread post in this topic
		$sql = "SELECT p.post_id, t.topic_last_post_id
			FROM (" . TOPICS_TABLE . " t
			LEFT JOIN " . POSTS_TABLE . " p ON p.topic_id = t.topic_id AND p.post_time > $topic_last_read)
			WHERE t.topic_id = $topic_id
			AND t.topic_moved_id = 0
			ORDER BY p.post_time";
		if ( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
		}
		$post_id = empty($row['post_id']) ? $row['topic_last_post_id'] : $row['post_id'];
		redirect(append_sid("./viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
	}

#
#-----[ FIND ]------------------------------------------------
# 
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
		}

		if ( $row = $db->sql_fetchrow($result) )
		{
			$topic_id = intval($row['topic_id']);
		}

#
#-----[ REPLACE WITH ]----------------------------------------
#

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
		}

		if ( $row = $db->sql_fetchrow($result) )
		{
			$topic_id = intval($row['topic_id']);
			//MOD Keep_unread_2
			redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
		}

#
#-----[ FIND ]------------------------------------------------
#
$forum_id = intval($forum_topic_data['forum_id']);

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//

#
#-----[ REPLACE WITH ]----------------------------------------
#

$forum_id = intval($forum_topic_data['forum_id']);

//MOD Keep_unread_2: session management already done above

#
#-----[ FIND ]------------------------------------------------
#
//
// Set a cookie for this topic
//
if ( $userdata['session_logged_in'] )
{
	$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
	$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();

	if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) )
	{
		$topic_last_read = ( $tracking_topics[$topic_id] > $tracking_forums[$forum_id] ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
	}
	else if ( !empty($tracking_topics[$topic_id]) || !empty($tracking_forums[$forum_id]) )
	{
		$topic_last_read = ( !empty($tracking_topics[$topic_id]) ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
	}
	else
	{
		$topic_last_read = $userdata['user_lastvisit'];
	}

	if ( count($tracking_topics) >= 150 && empty($tracking_topics[$topic_id]) )
	{
		asort($tracking_topics);
		unset($tracking_topics[key($tracking_topics)]);
	}

	$tracking_topics[$topic_id] = time();

	setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}

#
#-----[ REPLACE WITH ]----------------------------------------
#
// 
// Set a cookie for this topic
//
//START MOD Keep_unread_2 * $topic_last_read is known
//Reached the last post in a topic with unread posts
if ($topic_last_post_id == $postrow[($total_posts-1)]['post_id'])
{
	//Read up to time of retrieval of this topic
	$board_config['tracking_unreads'][$topic_id] = time();
}
//Reading a page, but not the last one, in a topic with new posts
elseif (isset($board_config['tracking_unreads'][$topic_id]))
{
	//Set the highest of current topic_last_read and time of last post on page
	$board_config['tracking_unreads'][$topic_id] = max($topic_last_read, $postrow[($total_posts-1)]['post_time']);
}
write_cookies($userdata); //Save
//END MOD Keep_unread_2

#
#-----[ FIND ]------------------------------------------------
#
	//
	// Define the little post icon
	//
	if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read )
	{
		$mini_post_img = $images['icon_minipost_new'];
		$mini_post_alt = $lang['New_post'];
	}
	else
	{
		$mini_post_img = $images['icon_minipost'];
		$mini_post_alt = $lang['Post'];
	}

#
#-----[ REPLACE WITH ]------------------------------------------------
#
	//
	//START MOD Keep_Unread_2 * Define the little post icon
	//
	if ( $postrow[$i]['post_time'] > $topic_last_read )
	{
		$mini_post_img = $images['icon_minipost_new'];
		$mini_post_alt = $lang['New_post'];
	}
	else
	{
		$mini_post_img = $images['icon_minipost'];
		$mini_post_alt = $lang['Post'];
	}
	//END MOD Keep_unread_2

#
#-----[ FIND ]------------------------------------------------
#

	$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';

#
#-----[ AFTER, ADD ]------------------------------------------
#
	//START MOD Keep_Unread_2
	$temp_url = append_sid("viewtopic.$phpEx?mode=unread&" . POST_POST_URL . '=' . $postrow[$i]['post_id']);
	//$keep_unread_img_ms = '<a class="postmenu" onclick="this.blur();" href="' . $temp_url . '" title = "' . $lang['keep_post_unread_explain'] . '">' . $lang['keep_post_unread'] . '</a>';
	$keep_unread_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_keep_unread'] . '" title = "' . $lang['keep_post_unread_explain'] . '" border="0" /></a>';
	
#
#-----[ FIND ]------------------------------------------------
#
  	'L_MINI_POST_ALT' => $mini_post_alt,

#
#-----[ AFTER, ADD ]------------------------------------------
#
 	//MOD Keep_Unread_2
 	'KEEP_UNREAD_IMG' => $keep_unread_img,
 	//'KEEP_UNREAD_IMG_MS' => $keep_unread_img_ms,

#
А наличием мозга я не блещу, может подскажете?
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Если в тех местах уже накручено то дождись другой версии она будет практически независима от форума и сможет "дружить" с любыми модами
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Жду.
я люблю daft punk | новый sugoi.ru
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Vladson
Как процесс?
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Я был временно дизориентирован проблемами со здоровъем,
(то зубы болели, то в запой на пару дней опять отправлялся)
по этому было как-то не до этого...
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Vladson писал(а):Если в тех местах уже накручено то дождись другой версии она будет практически независима от форума и сможет "дружить" с любыми модами
Ещё не подружилась?
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Я конечно должен предупредить, типа это только бетка и не надо её ставить, но я всё равно знаю что ты меня не послушаешь, так что если что тестируй на здоровъе

(это отдельный файл, просто заливаешь в папку форума и ставишь ссылку на него с главной страницы, я попробовал вроде работает)

Код: Выделить всё

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$sql = "SELECT t.topic_id
	FROM " . TOPICS_TABLE . "  t, " . FORUMS_TABLE . " f
	WHERE t.forum_id = f.forum_id
		AND t.topic_moved_id = 0
		AND f.auth_view = 0
		AND f.auth_read = 0
	ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($result) )
{
	message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
}
$db->sql_freeresult($result);
$temp_url = append_sid("viewtopic.php?t=" . $row['topic_id']);
header("Location: " . $temp_url );
die($temp_url);
?>
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Vladson писал(а):это отдельный файл, просто заливаешь в папку форума и ставишь ссылку на него с главной страницы
То есть вроде как можно сунуть этот линк на этот файл и к себе на сайт и он будет вести на рандомную тему?
Vladson писал(а):это только бетка
У тебя все моды бетки :wink: . Но ведь работают. Вечером затестим.
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Можно хоть на постороннем сайте поставить, всё равно будет работать
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.
Аватара пользователя
VVVas
Former team member
Сообщения: 4463
Стаж: 19 лет 6 месяцев
Поблагодарили: 1 раз

Сообщение VVVas »

Всё работает (см. подпись).
Как я понял даже твориться проверка на то, что бы действительно был доступ к этой теме у человека. Спасибо.
я люблю daft punk | новый sugoi.ru
Аватара пользователя
Vladson
Former team member
Сообщения: 816
Стаж: 20 лет
Откуда: Estonia, Tallinn

Сообщение Vladson »

Просто направляет на те темы которые могут читать гости
Серый цвет - светлый (светлее чёрного), но он и тёмный (темнее белого), он же промежуточный (между чёрным и белым). Теорию относительности никто не отменял. Истина в целом - понятие виртуально-ситуативное.

Вернуться в «Поддержка модов для phpBB 2.0.x»