کد:
Find: [Select]
?>
Add Before: [Select]
//Begin Tagging System Text Strings
$txt['smftags_menu'] = 'Tags';
$txt['smftags_admin'] = 'Tags Configuration';
$txt['smftags_addtag'] = '[Add Tag]';
$txt['smftags_seperate'] = 'Seperate each tag by a comma';
$txt['smftags_topic'] = 'Tags: ';
$txt['permissiongroup_smftags'] = 'SMF Tags';
$txt['permissionname_smftags_suggest'] = 'Suggest Tags';
$txt['permissionhelp_smftags_suggest'] = 'Users can suggest tags to add';
$txt['cannot_smftags_suggest'] = 'You are not allowed to suggest tags.';
$txt['permissionname_smftags_manage'] = 'Manage Tags';
$txt['permissionhelp_smftags_manage'] = 'Users can modify the tag settings and add and remove tags';
$txt['cannot_smftags_manage'] = 'You are not allowed to manage tags.';
//END Tagging System Strings
This operation isn't vital to the installation of this mod.
./Themes/default/languages/Modifications.english-utf8.php
Find: [Select]
?>
Add Before: [Select]
//Begin Tagging System Text Strings
$txt['smftags_menu'] = 'Tags';
$txt['smftags_admin'] = 'Tags Configuration';
$txt['smftags_addtag'] = '[Add Tag]';
$txt['smftags_seperate'] = 'Seperate each tag by a comma';
$txt['smftags_topic'] = 'Tags: ';
$txt['permissiongroup_smftags'] = 'SMF Tags';
$txt['permissionname_smftags_suggest'] = 'Suggest Tags';
$txt['permissionhelp_smftags_suggest'] = 'Users can suggest tags to add';
$txt['cannot_smftags_suggest'] = 'You are not allowed to suggest tags.';
$txt['permissionname_smftags_manage'] = 'Manage Tags';
$txt['permissionhelp_smftags_manage'] = 'Users can modify the tag settings and add and remove tags';
$txt['cannot_smftags_manage'] = 'You are not allowed to manage tags.';
//END Tagging System Strings
This operation isn't vital to the installation of this mod.
./index.php
Find: [Select]
'sticky' => array('LockTopic.php', 'Sticky'),
Add After: [Select]
'tags' => array('Tags.php', 'TagsMain'),
./Themes/default/index.template.php
Find: [Select]
$current_action = 'admin';
if (in_array($context['current_action'], array(
Add After: [Select]
'tags',
Find: [Select]
// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
Add After: [Select]
// the [tags] button
echo ($current_action == 'tags' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'tags' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=tags">' , $txt['smftags_menu'] , '</a>
</td>' , $current_action == 'tags' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
./Themes/default/Post.template.php
Find: [Select]
<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" />
</td>
</tr>
Add After: [Select]
';
//Tagging system Mod
if(!isset($context['num_replies']))
{
echo '
<tr>
<td align="right">
<b>', $txt['smftags_topic'], '</b></td>
<td>
<input type="text" name="tags"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" />
<br /><span class="smalltext">', $txt['smftags_seperate'], '</span>
</td>
</tr>';
}
//End Tagging system mod
echo '
./Sources/ManagePermissions.php
Find: [Select]
'pm' => array(
'pm_read' => false,
'pm_send' => false,
),
Add After: [Select]
'smftags' => array(
'smftags_manage' => false,
),
./Sources/Subs.php
Find: [Select]
'edit_settings' => '<a href="' . $scripturl . '?action=serversettings;sesc=' . $sc . '">' . $txt[222] . '</a>',
Add After: [Select]
'tags_settings' => '<a href="' . $scripturl . '?action=tags;sa=admin;sesc=' . $sc . '">' . $txt['smftags_admin'] . '</a>',
./Sources/Post.php
Find: [Select]
createPost($msgOptions, $topicOptions, $posterOptions);
if (isset($topicOptions['id']))
$topic = $topicOptions['id'];
}
Add After: [Select]
// Tagging System
if(isset($_REQUEST['tags']) && !isset($_REQUEST['num_replies']))
{
//Get how many tags there have been for the topic
$dbresult = db_query("
SELECT
COUNT(*) as total
FROM {$db_prefix}tags_log
WHERE ID_TOPIC = " . $topic, __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$totaltags = $row['total'];
mysql_free_result($dbresult);
//Check Tag restrictions
$tags = explode(',',htmlspecialchars($_REQUEST['tags'],ENT_QUOTES));
if($totaltags < $modSettings['smftags_set_maxtags'])
{
$tagcount = 0;
foreach($tags as $tag)
{
if($tagcount >= $modSettings['smftags_set_maxtags'])
continue;
if(empty($tag))
continue;
//Check min tag length
if(strlen($tag) < $modSettings['smftags_set_mintaglength'])
continue;
//Check max tag length
if(strlen($tag) > $modSettings['smftags_set_maxtaglength'])
continue;
//Insert The tag
$dbresult = db_query("
SELECT
ID_TAG
FROM {$db_prefix}tags
WHERE tag = '$tag'", __FILE__, __LINE__);
if(db_affected_rows() == 0)
{
//Insert into Tags table
db_query("INSERT INTO {$db_prefix}tags
(tag, approved)
VALUES ('$tag',1)", __FILE__, __LINE__);
$ID_TAG = db_insert_id();
//Insert into Tags log
db_query("INSERT INTO {$db_prefix}tags_log
(ID_TAG,ID_TOPIC, ID_MEMBER)
VALUES ($ID_TAG,$topic,$ID_MEMBER)", __FILE__, __LINE__);
$tagcount++;
}
else
{
$row = mysql_fetch_assoc($dbresult);
$ID_TAG = $row['ID_TAG'];
$dbresult2= db_query("
SELECT
ID
FROM {$db_prefix}tags_log
WHERE ID_TAG = $ID_TAG AND ID_TOPIC = $topic", __FILE__, __LINE__);
if(db_affected_rows() != 0)
{
continue;
}
mysql_free_result($dbresult2);
//Insert into Tags log
db_query("INSERT INTO {$db_prefix}tags_log
(ID_TAG,ID_TOPIC, ID_MEMBER)
VALUES ($ID_TAG,$topic,$ID_MEMBER)", __FILE__, __LINE__);
$tagcount++;
}
mysql_free_result($dbresult);
}
}
}
//End Tagging System
./Sources/Display.php
Find: [Select]
if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)
{
db_query("
UPDATE {$db_prefix}topics
SET numViews = numViews + 1
WHERE ID_TOPIC = $topic
LIMIT 1", __FILE__, __LINE__);
$_SESSION['last_read_topic'] = $topic;
}
Add After: [Select]
// Tagging System
$dbresult= db_query("
SELECT
t.tag,l.ID,t.ID_TAG
FROM {$db_prefix}tags_log as l, {$db_prefix}tags as t
WHERE t.ID_TAG = l.ID_TAG && l.ID_TOPIC = $topic", __FILE__, __LINE__);
$context['topic_tags'] = array();
while($row = mysql_fetch_assoc($dbresult))
{
$context['topic_tags'][] = array(
'ID' => $row['ID'],
'ID_TAG' => $row['ID_TAG'],
'tag' => $row['tag'],
);
}
mysql_free_result($dbresult);
// End Tagging System
./Themes/default/Display.template.php
Find: [Select]
<a name="lastPost"></a>';
Add After: [Select]
// Tagging System
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="windowbg">
<b>', $txt['smftags_topic'], '</b>';
foreach ($context['topic_tags'] as $i => $tag)
{
echo '<a href="' . $scripturl . '?action=tags;tagid=' . $tag['ID_TAG'] . '">' . $tag['tag'] . '</a>&nbsp;';
if(!$context['user']['is_guest'])
echo '<a href="' . $scripturl . '?action=tags;sa=deletetag;tagid=' . $tag['ID'] . '"><font color="#FF0000">[X]</font></a>&nbsp;';
}
global $topic;
if(!$context['user']['is_guest'] && allowedTo('smftags_add'))
echo '
&nbsp;<a href="' . $scripturl . '?action=tags;sa=addtag;topic=',$topic, '">' . $txt['smftags_addtag'] . '</a>
</td>
</tr>
</table>';
//End Tagging System
./Sources/RemoveTopic.php
Find: [Select]
db_query("
DELETE FROM {$db_prefix}log_search_subjects
WHERE ID_TOPIC $condition", __FILE__, __LINE__);
Add Before: [Select]
// Tagging System for Topics
db_query("DELETE FROM {$db_prefix}tags_log
WHERE ID_TOPIC $condition", __FILE__, __LINE__);
// End Tagging System for Topics
علاقه مندی ها (Bookmarks)