123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?php
- if (!defined('SMF'))
- die('Hacking attempt...');
- function Notify()
- {
- global $scripturl, $txt, $topic, $user_info, $context, $smcFunc;
-
- is_not_guest();
- isAllowedTo('mark_any_notify');
-
- if (empty($topic))
- fatal_lang_error('not_a_topic', false);
-
- if (empty($_GET['sa']))
- {
-
- loadTemplate('Notify');
-
- $request = $smcFunc['db_query']('', '
- SELECT id_member
- FROM {db_prefix}log_notify
- WHERE id_member = {int:current_member}
- AND id_topic = {int:current_topic}
- LIMIT 1',
- array(
- 'current_member' => $user_info['id'],
- 'current_topic' => $topic,
- )
- );
- $context['notification_set'] = $smcFunc['db_num_rows']($request) != 0;
- $smcFunc['db_free_result']($request);
-
- $context['topic_href'] = $scripturl . '?topic=' . $topic . '.' . $_REQUEST['start'];
- $context['start'] = $_REQUEST['start'];
- $context['page_title'] = $txt['notification'];
- return;
- }
- elseif ($_GET['sa'] == 'on')
- {
- checkSession('get');
-
- $smcFunc['db_insert']('ignore',
- '{db_prefix}log_notify',
- array('id_member' => 'int', 'id_topic' => 'int'),
- array($user_info['id'], $topic),
- array('id_member', 'id_topic')
- );
- }
- else
- {
- checkSession('get');
-
- $smcFunc['db_query']('', '
- DELETE FROM {db_prefix}log_notify
- WHERE id_member = {int:current_member}
- AND id_topic = {int:current_topic}',
- array(
- 'current_member' => $user_info['id'],
- 'current_topic' => $topic,
- )
- );
- }
-
- redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
- }
- function BoardNotify()
- {
- global $scripturl, $txt, $board, $user_info, $context, $smcFunc;
-
- is_not_guest();
- isAllowedTo('mark_notify');
-
- if (empty($board))
- fatal_lang_error('no_board', false);
-
- if (empty($_GET['sa']))
- {
-
- loadTemplate('Notify');
-
- $request = $smcFunc['db_query']('', '
- SELECT id_member
- FROM {db_prefix}log_notify
- WHERE id_member = {int:current_member}
- AND id_board = {int:current_board}
- LIMIT 1',
- array(
- 'current_board' => $board,
- 'current_member' => $user_info['id'],
- )
- );
- $context['notification_set'] = $smcFunc['db_num_rows']($request) != 0;
- $smcFunc['db_free_result']($request);
-
- $context['board_href'] = $scripturl . '?board=' . $board . '.' . $_REQUEST['start'];
- $context['start'] = $_REQUEST['start'];
- $context['page_title'] = $txt['notification'];
- $context['sub_template'] = 'notify_board';
- return;
- }
-
- elseif ($_GET['sa'] == 'on')
- {
- checkSession('get');
-
- $smcFunc['db_insert']('ignore',
- '{db_prefix}log_notify',
- array('id_member' => 'int', 'id_board' => 'int'),
- array($user_info['id'], $board),
- array('id_member', 'id_board')
- );
- }
-
- else
- {
- checkSession('get');
-
- $smcFunc['db_query']('', '
- DELETE FROM {db_prefix}log_notify
- WHERE id_member = {int:current_member}
- AND id_board = {int:current_board}',
- array(
- 'current_board' => $board,
- 'current_member' => $user_info['id'],
- )
- );
- }
-
- redirectexit('board=' . $board . '.' . $_REQUEST['start']);
- }
|