gevv 02.04.2018 16:55:27
<file name="$themedir/Display.template.php">
<!-- Add a button for making bookmarks (num_replies, active reply button). Optional. -->
<operation error="ignore">
<search position="before"><![CDATA[
'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'], 'active' => true),]]></search>
<add><![CDATA[
'bookmark' => array('test' => 'can_make_bookmarks', 'text' => 'bookmark_add', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']),]]></add>
</operation>
<!-- Add a button for making bookmarks (last_msg, active reply button). Optional. -->
<operation error="ignore">
<search position="before"><![CDATA[
'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true),]]></search>
<add><![CDATA[
'bookmark' => array('test' => 'can_make_bookmarks', 'text' => 'bookmark_add', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']),]]></add>
</operation>
<!-- Add a button for making bookmarks (num_replies, inactive reply button). Optional. -->
<operation error="ignore">
<search position="before"><![CDATA[
'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies']),]]></search>
<add><![CDATA[
'bookmark' => array('test' => 'can_make_bookmarks', 'text' => 'bookmark_add', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']),]]></add>
</operation>
<!-- Add a button for making bookmarks (last_msg, inactive reply button). Optional. -->
<operation error="ignore">
<search position="before"><![CDATA[
'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message']),]]></search>
<add><![CDATA[
'bookmark' => array('test' => 'can_make_bookmarks', 'text' => 'bookmark_add', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']),]]></add>
</operation>
</file>
snrj 03.04.2018 12:23:31
// If we have found SSI.php and we are outside of SMF, then we are running standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF')) // If we are outside SMF and can't find SSI.php, then throw an error
die('<b>Error:</b> Cannot install - please verify you put this file in the same place as SMF\'s SSI.php.');
if (SMF == 'SSI')
db_extend('packages');
// Define the hooks
$hook_functions = array(
'integrate_pre_include' => '$sourcedir/Bookmarks.php',
'integrate_display_buttons' => 'Bookmarks_menu',
);
// Adding or removing them?
if (!empty($context['uninstalling']))
$call = 'remove_integration_function';
else
$call = 'add_integration_function';
// Do the deed
foreach ($hook_functions as $hook => $function)
$call($hook, $function);
Bookmarks.php eklefunction Bookmarks_menu(&$buttons)
{
global $topicinfo, $context, $user_info, $scripturl;
$context['can_make_bookmarks'] = allowedTo('can_make_bookmarks');
if (empty($topicinfo['bookmark']))
$buttons['bookmark'] = array('test' => 'can_make_bookmarks', 'text' => 'bookmark_add', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
}
gevv 03.04.2018 15:12:40
gevv 03.04.2018 21:33:27
snrj 03.04.2018 22:13:26
gevv 17.04.2018 14:34:05
snrj 19.04.2018 00:00:25
gevv 19.04.2018 10:40:07
snrj 19.04.2018 18:59:12
gevv 26.10.2020 21:39:08
Alıntı yapılan: undefinedWhen using the replace mode, the key column is a required entry.
AlıntıChange the method of db insert to insert or add the pk field to the key array
Function: addBookmark
gevv 14.11.2020 13:02:35
$result = $smcFunc['db_insert']('replace', '{db_prefix}bookmarks',
array(
'id_member' => 'int',
'id_topic' => 'int',
),
array(
'id_member' => $id_member,
'id_topic' => $id_topic,
),
array()
);
$result = $smcFunc['db_insert']('replace', '{db_prefix}bookmarks',
array(
'id_member' => 'int',
'id_topic' => 'int',
),
array(
'id_member' => $id_member,
'id_topic' => $id_topic,
),
array('id_member', 'id_topic')
);