示例#1
0
function set_bookmark($topic_id)
{
    global $db, $user;
    $user_id = $user->data['user_id'];
    if (!is_bookmark_set($topic_id, $user_id)) {
        $sql = "INSERT INTO " . BOOKMARK_TABLE . " (topic_id, user_id)\n\t\t\tVALUES (" . $topic_id . ", " . $user_id . ")";
        $db->sql_query($sql);
    }
    return;
}
示例#2
0
$s_watching_topic = '';
if ($can_watch_topic)
{
	$s_watching_topic_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . $kb_mode_append . '&' . (!empty($is_watching_topic) ? 'unwatch' : 'watch') . '=topic&start=' . $start);
	$s_watching_topic_l = (!empty($is_watching_topic) ? $lang['Stop_watching_topic'] : $lang['Start_watching_topic']);
	$s_watching_topic = '<a href="' . $s_watching_topic_url . '">' . $s_watching_topic_l . '</a>';
	$s_watching_topic_img_tmp = (!empty($is_watching_topic) ? $images['topic_un_watch'] : $images['topic_watch']);
	$s_watching_topic_img = (!empty($s_watching_topic_img_tmp)) ? '<a href="' . $s_watching_topic_url . '"><img src="' . $s_watching_topic_img_tmp . '" alt="' . $s_watching_topic_l . '" title="' . $s_watching_topic_l . '" /></a>' : '';
}

// Bookmark information
if ($user->data['session_logged_in'] && !$user->data['is_bot'])
{
	$template->assign_block_vars('bookmark_state', array());
	// Send vars to template
	if (is_bookmark_set($topic_id))
	{
		$bookmark_img = $images['bookmark_remove'];
		$bm_action = '&amp;removebm=true';
		$set_rem_bookmark = $lang['Remove_Bookmark'];
	}
	else
	{
		$bookmark_img = $images['bookmark_add'];
		$bm_action = '&amp;setbm=true';
		$set_rem_bookmark = $lang['Set_Bookmark'];
	}
	$template->assign_vars(array(
		'L_BOOKMARK_ACTION' => $set_rem_bookmark,
		'IMG_BOOKMARK' => $bookmark_img,
		'U_BOOKMARK_ACTION' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&amp;' . $topic_id_append . $kb_mode_append . '&amp;start=' . $start . $vt_sort_append . '&amp;highlight=' . urlencode($_GET['highlight']) . $bm_action)