$topic)); // Notify people that this topic has been locked? sendNotifications($topic, empty($locked) ? 'unlock' : 'lock'); // Back to the topic! redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); } // Sticky a topic. Can't be done by topic starters - that would be annoying! function Sticky() { global $db_prefix, $modSettings, $topic, $sourcedir; // Make sure the user can sticky it, and they are stickying *something*. isAllowedTo('make_sticky'); // You shouldn't be able to (un)sticky a topic if the setting is disabled. if (empty($modSettings['enableStickyTopics'])) fatal_lang_error('cannot_make_sticky', false); // You can't sticky a board or something! if (empty($topic)) fatal_lang_error(472, false); checkSession('get'); // We need Subs-Post.php for the sendNotifications() function. require_once($sourcedir . '/Subs-Post.php'); // Is this topic already stickied, or no? $request = db_query(" SELECT isSticky FROM {$db_prefix}topics WHERE ID_TOPIC = $topic LIMIT 1", __FILE__, __LINE__); list ($isSticky) = mysql_fetch_row($request); mysql_free_result($request); // Toggle the sticky value.... pretty simple ;). db_query(" UPDATE {$db_prefix}topics SET isSticky = " . (empty($isSticky) ? 1 : 0) . " WHERE ID_TOPIC = $topic LIMIT 1", __FILE__, __LINE__); // Log this sticky action - always a moderator thing. logAction('sticky', array('topic' => $topic)); // Notify people that this topic has been stickied? if (empty($isSticky)) sendNotifications($topic, 'sticky'); // Take them back to the now stickied topic. redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); } ?>