Darathor
Citation :
But : Permet à chaque membre de gérer sa liste de sujets à notifier par email. Ajoute également deux autres listes de sujets, l'une servant simplement à lister des sujets afin de les retrouver et l'autre listant des sujets à afficher sur l'index.
Prérequis :
- [Sous-MOD] Auto-included files (1.0)
- [Sous-MOD] Définitions CSS complémentaires (1.1)
- Topic list (Sous-mod fourni notamment avec ce mod)
Auteur : Darathor (darathor@free.fr)
Version : 1.0 DEV - B (21/01/2007)
Compatibilité phpBB : 2.0.22
Requête SQL :
Code :
ALTER TABLE `phpbb_topics_watch` ADD `type` SMALLINT UNSIGNED DEFAULT '1' NOT NULL ;
Dans "includes/page_header.php" :
Code :
#
# Trouver
#
'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
'L_WATCHED_TOPICS' => $lang['ExTW_favoris_menu'],
// FIN MOD Extended topic watch
#
# Trouver
#
'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
'U_WATCHED_TOPICS' => append_sid($phpbb_root_path . 'topic_watch_list.' . $phpEx),
// FIN MOD Extended topic watch
Dans "overall_header.tpl" :
Code :
#
# Dans une ligne, trouve
#
<a href="{U_SEARCH}" class="mainmenu">
#
# Dans la ligne, ajouter avant
#
<a href="{U_WATCHED_TOPICS}" class="mainmenu">{L_WATCHED_TOPICS}</a> |
Dans "posting.php" :
Code :
#
# Trouver
#
$sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
#
# Remplacer par
#
// DEBUT MOD Extended topic watch
// -- DEBUT ajouté
// AND type = " . EXTW_MAIL . "
// -- FIN ajouté
$sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND type = " . EXTW_MAIL . "
AND user_id = " . $userdata['user_id'];
// FIN MOD Extended topic watch
Dans "index.php" :
Code :
#
# Trouver
#
$template->set_filenames(array(
'body' => 'index_body.tpl')
);
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
if($userdata['user_id'] != -1)
{
ExTW_topic_list(EXTW_INDEX, true, 0, 0, false);
}
// FIN MOD Extended topic watch
Dans "subsilver/index_body.tpl" :
Code :
#
# Trouver
#
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a></td>
</tr>
</table>
#
# Ajouter après
#
<!-- DEBUT MOD Forum mask -->
{EXTW_INDEX}
<!-- FIN MOD Forum mask -->
Dans "includes/functions_post.php" :
Code :
#
# Trouver
#
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
AND u.user_id = tw.user_id";
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
$sql .= " AND tw.type = " . EXTW_MAIL;
// FIN MOD Extended topic watch
#
# Trouver
#
WHERE topic_id = $topic_id
AND user_id IN ($update_watched_sql)";
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
$sql .= " AND type = " . EXTW_MAIL;
// FIN MOD Extended topic watch
#
# Trouver
#
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
$sql .= " AND type = " . EXTW_MAIL;
// FIN MOD Extended topic watch
#
# Trouver
#
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
#
# Ajouter après
#
// DEBUT MOD Extended topic watch
$sql .= " AND type = " . EXTW_MAIL;
// FIN MOD Extended topic watch
#
# Trouver
#
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
#
# Remplacer par
#
// DEBUT MOD Extended topic watch
// -- DEBUT enlevé
// $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
// VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
// -- FIN enlevé
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status, type)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0, " . EXTW_MAIL . ")";
// FIN MOD Extended topic watch
Dans "subslver.cfg" :
Code :
#
# Trouver
#
?>
#
# Ajoute avant
#
// DEBUT MOD Extended topic watch
$images['ExTW_favoris'] = "$current_template_images/ExTW_favoris.gif";
$images['ExTW_no_favoris'] = "$current_template_images/ExTW_no_favoris.gif";
$images['ExTW_index'] = "$current_template_images/ExTW_index.gif";
$images['ExTW_no_index'] = "$current_template_images/ExTW_no_index.gif";
$images['ExTW_mail'] = "$current_template_images/ExTW_mail.gif";
$images['ExTW_no_mail'] = "$current_template_images/ExTW_no_mail.gif";
// FIN MOD Extended topic watch
Dans "viewtopic_body.tpl" :
Code :
#
# Dans une ligne, trouver
#
<td width="40%" valign="top" nowrap="nowrap" align="left"><span class="gensmall">{S_WATCH_TOPIC}</span><br />
<br />
{S_TOPIC_ADMIN}</td>
#
# Remplacer par
#
<td width="40%" valign="top" nowrap="nowrap" align="left">{S_WATCH_TOPIC_IMG} {S_TOPIC_ADMIN}</td>
Dans : "viewtopic.php" :
Code :
#
# Trouver
#
if( $userdata['session_logged_in'] )
{
$can_watch_topic = TRUE;
$sql = "SELECT notify_status
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
if ( isset($HTTP_GET_VARS['unwatch']) )
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
$is_watching_topic = 0;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
}
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">')
);
$message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = TRUE;
if ( $row['notify_status'] )
{
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
SET notify_status = 0
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql);
}
}
}
}
else
{
if ( isset($HTTP_GET_VARS['watch']) )
{
if ( $HTTP_GET_VARS['watch'] == 'topic' )
{
$is_watching_topic = TRUE;
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
$sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
}
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">')
);
$message = $lang['You_are_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = 0;
}
}
}
#
# Remplacer par
#
// DEBUT MOD Extended topic watch
// if( $userdata['session_logged_in'] )
// {
// $can_watch_topic = TRUE;
//
// $sql = "SELECT notify_status
// FROM " . TOPICS_WATCH_TABLE . "
// WHERE topic_id = $topic_id
// AND user_id = " . $userdata['user_id'];
// if ( !($result = $db->sql_query($sql)) )
// {
// message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql);
// }
//
// if ( $row = $db->sql_fetchrow($result) )
// {
// if ( isset($HTTP_GET_VARS['unwatch']) )
// {
// if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
// {
// $is_watching_topic = 0;
//
// $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
// $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
// WHERE topic_id = $topic_id
// AND user_id = " . $userdata['user_id'];
// if ( !($result = $db->sql_query($sql)) )
// {
// message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
// }
// }
//
// $template->assign_vars(array(
// 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">')
// );
//
// $message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>');
// message_die(GENERAL_MESSAGE, $message);
// }
// else
// {
// $is_watching_topic = TRUE;
//
// if ( $row['notify_status'] )
// {
// $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
// $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
// SET notify_status = 0
// WHERE topic_id = $topic_id
// AND user_id = " . $userdata['user_id'];
// if ( !($result = $db->sql_query($sql)) )
// {
// message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql);
// }
// }
// }
// }
// else
// {
// if ( isset($HTTP_GET_VARS['watch']) )
// {
// if ( $HTTP_GET_VARS['watch'] == 'topic' )
// {
// $is_watching_topic = TRUE;
//
// $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
// $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
// VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
// if ( !($result = $db->sql_query($sql)) )
// {
// message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
// }
// }
//
// $template->assign_vars(array(
// 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">')
// );
//
// $message = $lang['You_are_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>');
// message_die(GENERAL_MESSAGE, $message);
// }
// else
// {
// $is_watching_topic = 0;
// }
// }
// }
$ExTW_array = ExTW_manage_topic_watch($topic_id);
// FIN MOD Extended topic watch
#
# Trouver
#
$s_watching_topic = '';
if ( $can_watch_topic )
{
if ( $is_watching_topic )
{
$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Stop_watching_topic'] . '</a>';
$s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : '';
}
else
{
$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Start_watching_topic'] . '</a>';
$s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Start_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';
}
}
#
# Remplacer par
#
// DEBUT MOD Extended topic watch
// -- DEBUT Enlevé
// $s_watching_topic = '';
// if ( $can_watch_topic )
// {
// if ( $is_watching_topic )
// {
// $s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Stop_watching_topic'] . '</a>';
// $s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : '';
// }
// else
// {
// $s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Start_watching_topic'] . '</a>';
// $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Start_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';
// }
// }
// -- FIN Enlevé
$s_watching_topic_img = ExTW_get_watching_topics_images($ExTW_array, $topic_id, $start);
// FIN MOD Extended topic watch
Uploader aux emplacement suivants les fichiers contenus dans ce zip :
- topic_watch_list.php
- includes/constants/constants_extended_topic_watch.php
- includes/functions_front/functions_front_extended_topic_watch.php
- language/lang_french/lang_front/lang_front_extended_topic_watch.php
- templates/subSilver/topic_watch_list_body.tpl
- templates/subSilver/images/ExTW_no_index.gif
- templates/subSilver/images/ExTW_no_mail.gif
- templates/subSilver/images/ExTW_no_favoris.gif
- templates/subSilver/images/ExTW_index.gif
- templates/subSilver/images/ExTW_mail.gif
- templates/subSilver/images/ExTW_favoris.gif