MOD topic_in_whoisonline HELP

Проблемы с установкой или работой phpBB 2.0.x? Ищите ответы здесь!
Nervenom
phpBB 1.2.0
Сообщения: 10
Стаж: 19 лет 11 месяцев
Откуда: я взялся?

Сообщение Nervenom »

Вот он сам код:

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

############################################################## 
## MOD Title:          Topic in Who is online 
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. R°d) http://mods.db9.dk
## MOD Description:    This mod will make it possible to view
##                     exactly witch topic a user is looking
##                     at. The information is applyed in the
##                     Who-is-online list.
## MOD Version:        1.2.9
## MOD Compatibility:  2.0.6
## 
## Installation Level: Easy
## Installation Time:  5 Minutes 
## Files To Edit:      7
##      viewonline.php 
##      viewtopic.php
##      includes/page_header.php
##      includes/sessions.php 
##      language/lang_english/lang_main.php
##      template/subSilver/viewforum_body.tpl
##      template/subSilver/viewtopic_body.tpl
##
## Included Files:     1
##      topic_in_wio_db_update.php
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## 1. Full MOD description
## -----------
## This mod will make it possible to view exactly witch topic a
## user are looking at the information is applyed to the end of
## the forum information, in the Who-is-online list this mod
## also add a "who is also watching this topic list" like the
## already existing "Who is watching this forum".
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or 
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 SQL commands are not performed
## -----------
## This MOD need a database update.
## Then, in any case if you install this MOD manually or using
## an alpha release of EM, please copying the *_db_update.php
## in your phpBB root directory, run it with your navigator,
## and then delete it from the phpBB root directory.
##
## Please, do it NOW! Before editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
## 2.2 Translation are not managed
## -----------
## Moreover, EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=42
##
############################################################## 
## MOD History: 
## 
##   2003-12-23 - Version 1.2.9
##      - phpBB template & EasyMOD compliance enhancement
##      - Dutch, French, German, Hungarian, Italian, Lithuanian,
##        & Spanish translations now provide
##        with the MOD
## 
##   ????-??-?? - Version 1.2.8
##      - now EM ready
## 
##   ????-??-?? - Version 1.2.7
##      - changes made for phpBB2 2.0.5.
## 
##   ????-??-?? - Version 1.2.6
##      - fixed that users inside a topic was not counted rigth
## 
##   ????-??-?? - Version 1.2.5
##      - fixed a typo in the how-to page_header.php
## 
##   ????-??-?? - Version 1.2.4
##      - fixed the count of users when viewing topic,
##        called by post id
## 
##   ????-??-?? - Version 1.2.3
##      - removed some "letovers" from the ver 2.0.0. how-to :-)
## 
##   ????-??-?? - Version 1.2.2
##      - fixed a error that causes the link in who-is-online
##        was wrong
## 
##   ????-??-?? - Version 1.2.1
##      - fixed a error that causes "error, update sessions table"
## 
##   ????-??-?? - Version 1.2.0
##      - re-write mod to comply with phpBB2 version 2.0.2.
## 
##   ????-??-?? - Version 1.0.4
##      - now also display numbers of guest/hidden users
## 
##   ????-??-?? - Version 1.0.3
##      - now also includes the "users browsing this topic list
## 
##   ????-??-?? - Version 1.0.2
##      - missed to include the how-to for viewtopic.php
##      - minor correction to session.php
## 
##   ????-??-?? - Version 1.0.1
##      - improved refresh time
## 
##   ????-??-?? - Version 1.0.0
##      - initial BETA release
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
# 
#-----[ COPY ]------------------------------------------------ 
# 
copy topic_in_wio_db_update.php to topic_in_wio_db_update.php

#
# This MOD need a database update.
# Then, as you must have now copied the topic_in_wio_db_update.php file
# in your phpBB root directory, run it with your navigator...
# http://www.yourWebSite.xxx/phpbbRootDir/topic_in_wio_db_update.php
#
# ...and then delete it from the phpBB root directory!!!
#
# Please, do it NOW! Before editing phpBB files by EM or manually!!!
# Otherwise, you may have an error message during your next
# connection.
#

# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewonline.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "SELECT u.user_id, u.username

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
, s.session_page

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, s.session_topic

# 
#-----[ FIND ]------------------------------------------------ 
# 
$location_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $row['session_page']);
$location = $forum_data[$row['session_page']];

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

// Start replacement - Topic in Who is online MOD
if ($row['session_topic'])
{
	//
	// Topic info
	//
	$sql = "SELECT topic_title FROM " . TOPICS_TABLE . " WHERE topic_id=" . $row['session_topic'];
	if ( $result2 = $db->sql_query($sql) )
	{
		$topic_title = $db->sql_fetchrow($result2);
	}
	else
	{	
		message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
	}
	$location_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $row['session_topic']);
	$location = $forum_data[$row['session_page']] .' -> '.$topic_title['topic_title'];
} else 
{
	$location_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $row['session_page']);
	$location = $forum_data[$row['session_page']];
}
// End replacement - Topic in Who is online MOD

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

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

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Topic in Who is online MOD
$topic_id = intval($forum_topic_data['topic_id']);
// End add - Topic in Who is online MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$userdata = session_pagestart($user_ip, $forum_id);

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
)

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, $topic_id

# 
#-----[ FIND ]------------------------------------------------ 
# 
// Output page header
//

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Topic in Who is online MOD
define('SHOW_ONLINE', true);
// End add - Topic in Who is online MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/page_header.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';

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

// Start replacement - Topic in Who is online MOD
$user_forum_sql = ( !empty($topic_id) ) ? "AND s.session_topic = " . intval($topic_id) :(( !empty($forum_id) ) ? "AND s.session_page = ".intval($forum_id) : '');
// End replacement - Topic in Who is online MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist;

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

// Start replacement - Topic in Who is online MOD
$online_userlist = $lang['Registered_users'].' ' . $online_userlist;
// End replacement - Topic in Who is online MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( $total_online_users == 0 )
{
	$l_t_user_s = $lang['Online_users_zero_total'];
}
else if ( $total_online_users == 1 )
{
	$l_t_user_s = $lang['Online_user_total'];
}
else
{
	$l_t_user_s = $lang['Online_users_total'];
}

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

// Start replacement - Topic in Who is online MOD
if ( $total_online_users == 0 )
{
	$l_t_user_s = ( ( isset($topic_id) ) ? $lang['Browsing_topic'] : ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Online_users_zero_total'] ) );
}
else
{
	$l_t_user_s = ( ( isset($topic_id) ) ? $lang['Browsing_topic'] : ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Online_users_total'] ) );
}
// End replacement - Topic in Who is online MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/sessions.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
function session_pagestart($user_ip, $thispage_id)

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
)

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
#
, $thistopic_id=PAGE_INDEX

# 
#-----[ FIND ]------------------------------------------------ 
# 
if ( $current_time - $userdata['session_time'] > 60 )

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
)

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
#
|| ((( $userdata['user_id'] == ANONYMOUS )?$userdata['user_session_topic']:$userdata['session_topic']) != $thispage_topic) || (( $userdata['user_id'] == ANONYMOUS )?$userdata['user_session_page']:$userdata['session_page']) != $thispage_id

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "UPDATE " . SESSIONS_TABLE . "
SET
WHERE

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
$thispage_id

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
, session_topic = '".$thistopic_id ."'

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "UPDATE " . USERS_TABLE . "
SET
WHERE

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
$thispage_id

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
, user_session_topic='" . $thistopic_id . "'

# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

// Start add - Topic in Who is online MOD
$lang['Browsing_topic'] = 'Users browsing this topic:';
// End add - Topic in Who is online MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/viewforum_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
#
{LOGGED_IN_USER_LIST}</b></span></td>

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
#
{LOGGED_IN_USER_LIST}

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
#
{TOTAL_USERS_ONLINE}<br/>

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
#
<tr> 
	<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

<!-- Start add - Topic in Who is online MOD -->
<span class="gensmall"><b><br/>{TOTAL_USERS_ONLINE}<br/>{LOGGED_IN_USER_LIST}</b></span></td>
<!-- End add - Topic in Who is online MOD -->

# 
#-----[ FIND ]------------------------------------------------ 
#
	 <span class="gensmall"><b>{PAGINATION}</b><br />
	 &nbsp; </span></td>
</tr>

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

<!-- Start replacement - Topic in Who is online MOD -->
	<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
</tr>
<!-- End replacement - Topic in Who is online MOD -->

# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
И вот ЭТОТ МОМЕНТ...:

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

# Please, do it NOW! Before editing phpBB files by EM or manually!!!
# Otherwise, you may have an error message during your next
# connection.
... я и профтыкал :shock:

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

Вот этот преславутый файл , который работает с БД:

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

<?php
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. R°d
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login, 
## but that is a minor cosmetic isue, that will correct it self next time the use  logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################

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

###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE '.USERS_TABLE.' ADD user_session_topic INT (11) not null AFTER user_session_page', 
'ALTER TABLE '.SESSIONS_TABLE.' ADD session_topic INT (11) not null AFTER session_page'
);

$mods = array ( 
'Detailed who is online mod','Detailed who is online mod'
);

############################################### Do not change anything below this line #######################################

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

if ($userdata['user_level']!=ADMIN)
      message_die(GENERAL_ERROR, "You are not Authorised to do this"); 
$n=0;
$message="<b>This list is a result of the SQL queries needed for the additional mods in the pre-moded pack</b><br/><br/>";
while($sql[$n])
{
	$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
	if(!$result = $db->sql_query($sql[$n])) 
	$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	$n++;
}
 message_die(GENERAL_MESSAGE, $message); 
?>
и каким своим кодом заменить ?

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

put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need
Иногда, для великих открытий достаточно элементарной малости невзрачной.
Казалось бы, не часто мы готовы познавать многое, но, радуясь, всегда открываем что-то новое.
Iftin
phpBB 2.0.7
Сообщения: 573
Стаж: 20 лет
Откуда: Moscow

Сообщение Iftin »

дак а ты на документ из браузера ссылался ?
например
http://mysite.ru/topic_in_wio_db_update.php

делал такое?
Nervenom
phpBB 1.2.0
Сообщения: 10
Стаж: 19 лет 11 месяцев
Откуда: я взялся?

Сообщение Nervenom »

Да, НО после всего исправления кода, ибо профтыкал,ю а там предупреждали ,что сперва файлик запусти а потом правь.

Кстати вот таблицы из базы прикрученой к форуму:

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

phpbb_auth_access
phpbb_banlist
phpbb_categories
phpbb_config
phpbb_confirm
phpbb_disallow
phpbb_forum_prune
phpbb_forums
phpbb_groups
phpbb_logs
phpbb_logs_config
phpbb_posts
phpbb_posts_text
phpbb_privmsgs
phpbb_privmsgs_text
phpbb_ranks
phpbb_search_results
phpbb_search_wordlist
phpbb_search_wordmatch
phpbb_sessions
phpbb_smilies
phpbb_themes
phpbb_themes_name
phpbb_topics
phpbb_topics_watch
phpbb_user_group
phpbb_users
phpbb_vote_desc
phpbb_vote_results
phpbb_vote_voters
phpbb_words
Я чего-то совсем не вижу "session_" там :x
Иногда, для великих открытий достаточно элементарной малости невзрачной.
Казалось бы, не часто мы готовы познавать многое, но, радуясь, всегда открываем что-то новое.
Iftin
phpBB 2.0.7
Сообщения: 573
Стаж: 20 лет
Откуда: Moscow

Сообщение Iftin »

как ты понять не можешь, что не столь суть важна, когда ты сослался на файл базы, до или после. Не создал, до так прсото ругается как сейчас... мы сейчас природу изучаем .почему у тебя на автомате не создаются таблицы и колонки, вот это главное!
ещё раз сошлись на этот файл.
http://твой адрес сайта.ru/topic_in_wio_db_update.php
и пришли нам листинг сюда ,что он там на создавал.

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

и текстовый варинат, этого дока пришли в фоурм.
topic_in_wio_db_update.php
Nervenom
phpBB 1.2.0
Сообщения: 10
Стаж: 19 лет 11 месяцев
Откуда: я взялся?

Сообщение Nervenom »

листинг "topic_in_wio_db_update.php" смотри выше :shock: :D
А запустить уже не могу, я "по умному" перед правкой залочил форум полностью. и не могу войти разлочить :oops:
А повторный запуск этой паги ни к чему не приводит. Так и показывает что форум закрыт!

Добавлено спустя 1 минуту 45 секунд:

Я понял теперь что и как. Вот только как исправить это ручками не знаю :oops:
Иногда, для великих открытий достаточно элементарной малости невзрачной.
Казалось бы, не часто мы готовы познавать многое, но, радуясь, всегда открываем что-то новое.
Iftin
phpBB 2.0.7
Сообщения: 573
Стаж: 20 лет
Откуда: Moscow

Сообщение Iftin »

Nervenom, походу ты вообще полный лаймер и устанавливал так я понял easemodom, верно?

сослаться ,чтобы на документ из браузера никакая лочка не влияет!

Добавлено спустя 2 минуты 58 секунд:

файл закинь topic_in_wio_db_update.php
по FTP, где лежит корень втоего форума!!!!!!!!!!!!!!
:twisted:
Nervenom
phpBB 1.2.0
Сообщения: 10
Стаж: 19 лет 11 месяцев
Откуда: я взялся?

Сообщение Nervenom »

Залез в БД и узрел следующие колонки таблицы phpbb_sessions:
session_id
session_user_id
session_start
session_time
session_ip
session_page
session_logged_in
session_admin

И как видно из ошибки:

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

UPDATE phpbb_sessions SET session_time = 1117130641, session_page = -1, session_topic = '0' WHERE session_id = '3dae7177cc6105b1ffc4bed86a7792e3'
session_topic - не существует... как правильно добавить? важен ли порядок в таблице? И еще смущает "session_page = -1" это нормально?

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

2 Iftin
Да я не сильно шарю, но ты я вижу просто гений PHP кода, что такие советы дельные даешь.
Никакими изимодами не пользовался, а при запуске topic_in_wio_db_update.php НИЧЕГО НЕ ИЗМЕНЯЕТСЯ.
и запускал я естественно из корня.

Добавлено спустя 47 минут 15 секунд:

Большое всем спасибо за желание помочь, но я сам разобрался... пол ня потратил, пока пофиксил, столько узнал :lol:
2 строчки в MySql:

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

ALTER TABLE phpbb_users ADD user_session_topic INT (11) not null AFTER user_session_page, 
ALTER TABLE phpbb_sessions ADD session_topic INT (11) not null AFTER session_page
И все готово.
взял от сюда

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

$sql=array(
'ALTER TABLE '.USERS_TABLE.' ADD user_session_topic INT (11) not null AFTER user_session_page',
'ALTER TABLE '.SESSIONS_TABLE.' ADD session_topic INT (11) not null AFTER session_page'
); 
названия таблиц подставил из phpBB2\install\schemas\mysql_schema.sql

Всем спасибо! =)
Иногда, для великих открытий достаточно элементарной малости невзрачной.
Казалось бы, не часто мы готовы познавать многое, но, радуясь, всегда открываем что-то новое.
Iftin
phpBB 2.0.7
Сообщения: 573
Стаж: 20 лет
Откуда: Moscow

Сообщение Iftin »

вот молодец, ТЕПЕРЬ всем подсказывай тоже, если увидишь похожу ошибочку на форуме =))
я не гений, кста я только учусь =) НО САМОЕ ГЛАВНОЕ, что ТЫ понял, что надо создать ячейки в таблице =)))
Всех балг тебе и твоему детищю - форуму!

Добавлено спустя 4 минуты 37 секунд:

Тебе ещё повезло, что пол дня... я тут недавно возился с фотоальбомом, который я аппдейт сделал. То есть поменял старый альбом на новый. Так вот всё порушилось и тоже не работал. Так я написал о помощи в конференции на разных площадках, так до сих пор помогают :lol: а всё дело бы в таблице, в базе надо было создать две ячейки, которые почему-то из браузера не делаются.
А сегодня я увидел тебя с такой же ошибочкой и сразу понял, в чём дело =)))
ладно, это уже отступление, всем благ!

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