ค้นหา -->>
// Show all the users buddies, as well as a add/delete interface.
function editBuddies($memID)
{
แก้เป็น -->>
// Show all thank you posts by the current user
function showThankYouPosts($memID)
{
global $txt, $user_info, $scripturl, $modSettings, $db_prefix;
global $context, $user_profile, $ID_MEMBER, $sourcedir;
// If just deleting a message, do it and then redirect back.
if (isset($_GET['delete']))
{
checkSession('get');
// We can be lazy, since removeMessage() will check the permissions for us.
require_once($sourcedir . '/RemoveTopic.php');
removeMessage((int) $_GET['delete']);
// Back to... where we are now ;).
redirectexit('action=profile;u=' . $memID . ';sa=showPosts;start=' . $_GET['start']);
}
// Is the load average too high to allow searching just now?
if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts'])
fatal_lang_error('loadavg_show_posts_disabled', false);
// Default to 10.
if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
$_REQUEST['viewscount'] = '10';
$request = db_query("
SELECT COUNT(*)
FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
WHERE m.ID_MEMBER = $memID
AND b.ID_BOARD = m.ID_BOARD
AND m.thank_you_post = 1
AND $user_info[query_see_board]", __FILE__, __LINE__);
list ($msgCount) = mysql_fetch_row($request);
mysql_free_result($request);
$request = db_query("
SELECT MIN(ID_MSG), MAX(ID_MSG)
FROM {$db_prefix}messages AS m
WHERE m.ID_MEMBER = $memID
AND m.thank_you_post = 1", __FILE__, __LINE__);
list ($min_msg_member, $max_msg_member) = mysql_fetch_row($request);
mysql_free_result($request);
$reverse = false;
$range_limit = '';
$maxIndex = (int) $modSettings['defaultMaxMessages'];
// Make sure the starting place makes sense and construct our friend the page index.
$context['start'] = (int) $_REQUEST['start'];
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $memID . ';sa=showThankYouPosts', $context['start'], $msgCount, $maxIndex);
$context['current_page'] = $context['start'] / $maxIndex;
$context['current_member'] = $memID;
// Reverse the query if we're past 50% of the pages for better performance.
$start = $context['start'];
$reverse = $_REQUEST['start'] > $msgCount / 2;
if ($reverse)
{
$maxIndex = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 && $msgCount > $context['start'] ? $msgCount - $context['start'] : (int) $modSettings['defaultMaxMessages'];
$start = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 || $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] ? 0 : $msgCount - $context['start'] - $modSettings['defaultMaxMessages'];
}
// Guess the range of messages to be shown.
if ($msgCount > 1000)
{
$margin = floor(($max_msg_member - $min_msg_member) * (($start + $modSettings['defaultMaxMessages']) / $msgCount) + .1 * ($max_msg_member - $min_msg_member));
$range_limit = $reverse ? 'ID_MSG < ' . ($min_msg_member + $margin) : 'ID_MSG > ' . ($max_msg_member - $margin);
}
$context['page_title'] = $txt['thankyoutitle'] . ': ' . $user_profile[$memID]['realName'];
// Find this user's posts. The left join on categories somehow makes this faster, weird as it looks.
$looped = false;
while (true)
{
$request = db_query("
SELECT
b.ID_BOARD, b.name AS bname, c.ID_CAT, c.name AS cname, m.ID_TOPIC, m.ID_MSG,
t.ID_MEMBER_STARTED, t.ID_FIRST_MSG, t.ID_LAST_MSG, m.body, m.smileysEnabled,
m.subject, m.posterTime
, m.thank_you_post_counter, m.thank_you_post
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
WHERE m.ID_MEMBER = $memID
AND m.ID_TOPIC = t.ID_TOPIC
AND m.thank_you_post = 1
AND t.ID_BOARD = b.ID_BOARD" . (empty($range_limit) ? '' : "
AND $range_limit") . "
AND $user_info[query_see_board]
ORDER BY m.ID_MSG " . ($reverse ? 'ASC' : 'DESC') . "
LIMIT $start, $maxIndex", __FILE__, __LINE__);
// Make sure we quit this loop.
if (mysql_num_rows($request) === $maxIndex || $looped)
break;
$looped = true;
$range_limit = '';
}
// Start counting at the number of the first message displayed.
$counter = $reverse ? $context['start'] + $maxIndex + 1 : $context['start'];
$context['posts'] = array();
$board_ids = array('own' => array(), 'any' => array());
$thank_you_posts = array();
while ($row = mysql_fetch_assoc($request))
{
// Censor....
censorText($row['body']);
censorText($row['subject']);
// Do the code.
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);
// And the array...
$context['posts'][$counter += $reverse ? -1 : 1] = array(
'body' => $row['body'],
'counter' => $counter,
'category' => array(
'name' => $row['cname'],
'id' => $row['ID_CAT']
),
'board' => array(
'name' => $row['bname'],
'id' => $row['ID_BOARD']
),
'topic' => $row['ID_TOPIC'],
'subject' => $row['subject'],
'start' => 'msg' . $row['ID_MSG'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'id' => $row['ID_MSG'],
'can_reply' => false,
'can_mark_notify' => false,
'can_delete' => false,
'delete_possible' => ($row['ID_FIRST_MSG'] != $row['ID_MSG'] || $row['ID_LAST_MSG'] == $row['ID_MSG']) && (empty($modSettings['edit_disable_time']) || $row['posterTime'] + $modSettings['edit_disable_time'] * 60 >= time()),
'thank_you_post' => array(
'locked' => !empty($row['thank_you_post']) && $row['thank_you_post'] > 1,
'counter' => !empty($row['thank_you_post_counter']) ? $row['thank_you_post_counter'] : '0',
'isThankYouPost' => !empty($row['thank_you_post']) && $row['thank_you_post'] >= 1,
'href' => $scripturl . '?action=thankyoupostlist;topic=' . $row['ID_TOPIC'] . '.0;msg='.$row['ID_MSG'],
),
);
$thank_you_posts[] = $row['ID_MSG'];
if ($ID_MEMBER == $row['ID_MEMBER_STARTED'])
$board_ids['own'][$row['ID_BOARD']][] = $counter;
$board_ids['any'][$row['ID_BOARD']][] = $counter;
}
mysql_free_result($request);
// All posts were retrieved in reverse order, get them right again.
if ($reverse)
$context['posts'] = array_reverse($context['posts'], true);
// These are all the permissions that are different from board to board..
$permissions = array(
'own' => array(
'post_reply_own' => 'can_reply',
'delete_own' => 'can_delete',
),
'any' => array(
'post_reply_any' => 'can_reply',
'mark_any_notify' => 'can_mark_notify',
'delete_any' => 'can_delete',
)
);
// For every permission in the own/any lists...
foreach ($permissions as $type => $list)
{
foreach ($list as $permission => $allowed)
{
// Get the boards they can do this on...
$boards = boardsAllowedTo($permission);
// Hmm, they can do it on all boards, can they?
if (!empty($boards) && $boards[0] == 0)
$boards = array_keys($board_ids[$type]);
// Now go through each board they can do the permission on.
foreach ($boards as $board_id)
{
// There aren't any posts displayed from this board.
if (!isset($board_ids[$type][$board_id]))
continue;
// Set the permission to true ;).
foreach ($board_ids[$type][$board_id] as $counter)
$context['posts'][$counter][$allowed] = true;
}
}
}
// Clean up after posts that cannot be deleted.
foreach ($context['posts'] as $counter => $dummy)
$context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];
//Load A Preview?
if(!empty($modSettings['thankYouPostPreview']) && !empty($thank_you_posts)) {
//Should i gernerate a list? Need a extra query :)
require_once($sourcedir.'/ThankYouPost.php');
ThankYouPostList($thank_you_posts, true, true);
}
}
// Show all the users buddies, as well as a add/delete interface.
function editBuddies($memID)
{
file $sourcedir/RemoveTopic.php
ค้นหา -->>
UPDATE {$db_prefix}messages
SET icon = 'recycled'
เพิ่มไว้หลัง -->>
, thank_you_post = IF(thank_you_post = 1, 2, thank_you_post)
ค้นหา -->>
// Mark recycled topic as read.
เพิ่มไว้ก่อน -->>
//Okay i changed above... it lock the thank you ;P so it's not possible to made more thanks in the junkyard
ค้นหา -->>
// Make sure this message isn't getting deleted later on.
เพิ่มไว้ก่อน -->>
// Okay the thank you must be moved to the recycler too ;)
db_query("
UPDATE {$db_prefix}thank_you_post
SET
ID_TOPIC = $topicID,
ID_BOARD = $modSettings[recycle_board]
WHERE ID_MSG = $message", __FILE__, __LINE__);
ค้นหา -->>
// Delete anything related to the topic.
db_query("
DELETE FROM {$db_prefix}messages
WHERE ID_TOPIC $condition", __FILE__, __LINE__);
เพิ่มไว้ก่อน -->>
//Delete the Thank You Posts from this topics, before the message removed... i need the starter of the messages <<
require_once($sourcedir.'/ThankYouPost.php');
ThankYouPostRemoveTopics($topics);
file $sourcedir/Security.php
ค้นหา -->>
'move_any',
'send_topic',
เพิ่มไว้หลัง -->>
'thank_you_post_post', 'thank_you_post_lock_own', 'thank_you_post_lock_any',
'thank_you_post_delete_own', 'thank_you_post_delete_any',
'thank_you_post_delete_mem_own', 'thank_you_post_delete_mem_any',
'thank_you_post_lock_all_own', 'thank_you_post_lock_all_any',
'thank_you_post_unlock_all',
file $sourcedir/SplitTopics.php
ค้นหา -->>
// Cache the new topics subject... we can do it now as all the subjects are the same!
updateStats('subject', $split2_ID_TOPIC, $new_subject);
เพิ่มไว้ก่อน -->>
//Move the Thank You Post over to the other topic... bไh this is work :(
db_query("
UPDATE {$db_prefix}thank_you_post
SET
ID_TOPIC = $split2_ID_TOPIC
WHERE ID_MSG IN ($postList)", __FILE__, __LINE__);
ค้นหา -->>
// Merge log topic entries.
เพิ่มไว้ก่อน -->>
// Change the Thank You post to the new board and topic ;D
db_query("
UPDATE {$db_prefix}thank_you_post
SET
ID_TOPIC = $ID_TOPIC,
ID_BOARD = $target_board
WHERE ID_TOPIC IN (" . implode(', ', $deleted_topics) . ")", __FILE__, __LINE__);
file $sourcedir/Subs-Boards.php
ค้นหา -->>
// This setting is a little twisted in the database...
if (isset($boardOptions['posts_count']))
$boardUpdates[] = 'countPosts = ' . ($boardOptions['posts_count'] ? '0' : '1');
เพิ่มไว้หลัง -->>
// So enable or disable the Thank You Post in a board :D...
if (isset($boardOptions['thank_you_post_enable']))
$boardUpdates[] = 'thank_you_post_enable = ' . ($boardOptions['thank_you_post_enable'] ? '0' : '1');
ค้นหา -->>
'posts_count' => true,
เพิ่มไว้หลัง -->>
'thank_you_post_enable' => false,
ค้นหา -->>
// Delete any message icons that only appear on these boards.
db_query("
DELETE FROM {$db_prefix}message_icons
WHERE ID_BOARD IN (" . implode(', ', $boards_to_remove) . ')', __FILE__, __LINE__);
เพิ่มไว้หลัง -->>
// Delete any Thank You Posts that only appear on these boards.
db_query("
DELETE FROM {$db_prefix}thank_you_post
WHERE ID_BOARD IN (" . implode(', ', $boards_to_remove) . ')', __FILE__, __LINE__);
ค้นหา -->>
b.boardOrder, b.countPosts, b.memberGroups, b.ID_THEME, b.override_theme,
เพิ่มไว้หลัง -->>
thank_you_post_enable,
ค้นหา -->>
'count_posts' => empty($row['countPosts']),
เพิ่มไว้หลัง -->>
'thank_you_post_enable' => empty($row['thank_you_post_enable']),
file $themedir/Admin.template.php
ค้นหา -->>
<a href="' . $scripturl . '?action=convertentities">' . $txt['entity_convert_title'] . '</a><br />' : '', '
เพิ่มไว้หลัง -->>
<a href="', $scripturl, '?action=thankyoupostrecountall">', $txt['maintain_thxpostrecount'], '</a><br />
<a href="', $scripturl, '?action=thankyoupostrepairtable">', $txt['maintain_thxpostrepair'], '</a><br />
file $themedir/Display.template.php
ค้นหา -->>
else
unset($normal_buttons['custom']);
เพิ่มไว้หลัง -->>
//Special Lock for the Thank You :)
if($context['thank_you_lock_allowed'])
if(empty($context['is_thank_you_post_locked']))
$normal_buttons['thankyoupostlock'] = array('text' => 'thank_you_post_lock_all_b', 'image' => 'thank_you_lock1.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostcloseall;topic=' . $context['current_topic']);
else
$normal_buttons['thankyoupostlock'] = array('text' => 'thank_you_post_open_all_b', 'image' => 'thank_you_lock2.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostcloseall;topic=' . $context['current_topic']);
//A Fix for later, if some Translations are not Updated
if(empty($txt['thank_you_link_aftercounters']))
$txt['thank_you_link_aftercounters'] = $txt['thank_you_link_aftercounter'];
ค้นหา -->>
$split_button = create_button('split.gif', 'smf251', 'smf251', 'align="middle"');
เพิ่มไว้หลัง -->>
$thankyoupostpost_button = create_button('thank_you_b.gif', 'thank_you_post_post_b', 'thank_you_post_post_b', 'align="middle"');
$thankyoupostlock_button = create_button('thank_you_b.gif', 'thank_you_post_lock_b', 'thank_you_post_lock_b', 'align="middle"');
$thankyoupostopen_button = create_button('thank_you_b.gif', 'thank_you_post_open_b', 'thank_you_post_open_b', 'align="middle"');
$thankyoupostdelete_button = create_button('thank_you_b.gif', 'thank_you_post_delete_b', 'thank_you_post_delete_b', 'align="middle"');
ค้นหา -->>
// Show avatars, images, etc.?
เพิ่มไว้ก่อน -->>
if(!empty($modSettings['thankYouPostDisplayPage'])) {
echo '
', $txt['thank_you_post_thx_display'], '<br />
-', $txt['thank_you_post_made_display'], ': ', $message['member']['thank_you_post']['made'], '<br />
-', $txt['thank_you_post_became_display'], ': ', $message['member']['thank_you_post']['became'], '<br />
<br />';
}
ค้นหา -->>
// What about splitting it off the rest of the topic?
if ($context['can_split'])
echo '
<a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '">', $split_button, '</a>';
เพิ่มไว้หลัง -->>
// Can do some Thank You Post things :)
if ($message['thank_you_post']['post'] && !$message['thank_you_post']['locked'])
echo '
<a href="', $scripturl, '?action=thankyou;topic=', $context['current_topic'], '.0;msg=', $message['id'], '">', $thankyoupostpost_button, '</a>';
if ($message['thank_you_post']['lock'] && $message['thank_you_post']['isThankYouPost'])
echo '
<a href="', $scripturl, '?action=thankyoupostlock;topic=', $context['current_topic'], '.0;msg=', $message['id'], '">', $message['thank_you_post']['locked'] ? $thankyoupostopen_button : $thankyoupostlock_button, '</a>';
if ($message['thank_you_post']['delete'] && $message['thank_you_post']['isThankYouPost'])
echo '
<a href="', $scripturl, '?action=thankyoupostdelete;topic=', $context['current_topic'], '.0;msg=', $message['id'], ';sesc=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_thank_you_post'], '?\');">', $thankyoupostdelete_button, '</a>';
ค้นหา -->>
echo '
</td>
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
เพิ่มไว้ก่อน -->>
//Show the Thank You list or the link or.... nothing? XD
if ($message['thank_you_post']['isThankYouPost']) {
echo '
</tr><tr class="ThankOMatic">
<td colspan="2" class="smalltext" width="100%">
<hr width="100%" size="1" class="hrcolor" />';
if(!empty($context['thank_you_post'][$message['id']])) {
echo '
<p>'.$txt['followgiveathank'].'</p><p>';
foreach($context['thank_you_post'][$message['id']]['fulllist'] as $thx)
echo $thx['link'].(!empty($thx['deletelink']) ? $thx['deletelink'] : '').($thx['last'] ? '' : ', ');
echo '
</p>';
}
//Counter and Link to the direkt or complete list :)
echo '
<a href="'.$message['thank_you_post']['href'].'">
'.$txt['thank_you_link_beforecounter'].' '.$message['thank_you_post']['counter'].' '.($message['thank_you_post']['counter'] == 1 ? $txt['thank_you_link_member'] : $txt['thank_you_link_members']).' '.($message['thank_you_post']['counter'] == 1 ? $txt['thank_you_link_aftercounter'] : $txt['thank_you_link_aftercounters']).'
</a>';
if($message['thank_you_post']['locked'])
echo '<br />
<span class="smalltext"><i>'.$txt['thank_you_is_locked'].'</i></span>';
}
ค้นหา -->>
if ($context['can_remove_post'] && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
$mod_buttons[] = array('text' => 'quickmod_delete_selected', 'image' => 'delete_selected.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" id="quickmodSubmit"', 'url' => 'javascript:document.quickModForm.submit();');
เพิ่มไว้หลัง -->>
if($context['thank_you_post_unlock_all'])
$mod_buttons[] = array('text' => 'thank_you_post_unlock_all', 'image' => 'thankyoulock2.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostunlockall;topic=' . $context['current_topic'] . '.0');
file $themedir/ManageBoards.template.php
ค้นหา -->>
// Finish off the table.
echo '
เพิ่มไว้ก่อน -->>
// Add the Thank You Post Informations... Enable or Disable this option for a board :)
echo '
<tr>
<td>
<b>', $txt['mboards_thank_you_post_enable'], '</b><br />
', $txt['mboards_thank_you_post_enable_desc'], '<br /><br />
</td>
<td valign="top" align="right">
<input type="checkbox" name="thank_you_post_enable" ', $context['board']['thank_you_post_enable'] ? ' checked="checked"' : '', ' class="check" />
</td>
</tr>';
file $themedir/Profile.template.php
ค้นหา -->>
if (!empty($modSettings['userLanguage']))
echo '
<td><b>', $txt['smf225'], ':</b></td>
<td>', $context['member']['language'], '</td>
</tr><tr>';
เพิ่มไว้หลัง -->>
//Thank You Infomations :)
echo '
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr><tr>
<td colspan="2" align="center"><u><b>'.$txt['thankyoutitle'].'</b></u></td>
</tr><tr>
<td><b>', $txt['thankyoupostmade'], ':</b></td>
<td>', $context['member']['thank_you_post']['made'], '</td>
</tr><tr>
<td><b>', $txt['thankyoupostbecame'], ':</b></td>
<td>', $context['member']['thank_you_post']['became'], '</td>
</tr><tr>';
ค้นหา -->>
', $modSettings['karmaApplaudLabel'], ' <input type="text" name="karmaGood" size="4" value="', $context['member']['karma']['good'], '" onchange="setInnerHTML(document.getElementById(\'karmaTotal\'), this.value - this.form.karmaBad.value);" style="margin-right: 2ex;" /> ', $modSettings['karmaSmiteLabel'], ' <input type="text" name="karmaBad" size="4" value="', $context['member']['karma']['bad'], '" onchange="this.form.karmaGood.onchange();" /><br />
(', $txt[94], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
</td>
</tr>';
แก้เป็น -->>
', $modSettings['karmaApplaudLabel'], ' <input type="text" name="karmaGood" size="4" value="', $context['member']['karma']['good'], '" onchange="setInnerHTML(document.getElementById(\'karmaTotal\'), this.value - this.form.karmaBad.value);" style="margin-right: 2ex;" /> ', $modSettings['karmaSmiteLabel'], ' <input type="text" name="karmaBad" size="4" value="', $context['member']['karma']['bad'], '" onchange="this.form.karmaGood.onchange();" /><br />
(', $txt[94], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
</td>
</tr>';
}
// Admins are allowed to change the Thank-O-Matic Stats :D
if ($context['user']['is_admin'])
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr><tr>
<tr>
<td><b>', $txt['thankyoutitle'], ' ', $txt['thankyoupostmade'], ': </b></td>
<td><input type="text" name="thank_you_post_made" size="4" value="', $context['member']['thank_you_post']['made'], '" /></td>
</tr>
<tr>
<td><b>', $txt['thankyoutitle'], ' ', $txt['thankyoupostbecame'], ': </b></td>
<td><input type="text" name="thank_you_post_became" size="4" value="', $context['member']['thank_you_post']['became'], '" /></td>
</tr>';
}
ค้นหา -->>
// Template for showing all the buddies of the current user.
function template_editBuddies()
{
แก้เป็น -->>
// Template for showing all the Thank You Posts of the user, in chronological order.
function template_showThankYouPosts()
{
global $context, $settings, $options, $scripturl, $modSettings, $txt;
echo '
<table border="0" width="85%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">
<tr class="titlebg">
<td colspan="3" height="26">
<img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" align="top" /> ', $txt['thankyoutitle'], '
</td>
</tr>';
// Only show posts if they have made some!
if (!empty($context['posts']))
{
// Page numbers.
echo '
<tr class="catbg3">
<td colspan="3">
', $txt[139], ': ', $context['page_index'], '
</td>
</tr>
</table>';
// Button shortcuts
$quote_button = create_button('quote.gif', 145, 'smf240', 'align="middle"');
$reply_button = create_button('reply_sm.gif', 146, 146, 'align="middle"');
$remove_button = create_button('delete.gif', 121, 31, 'align="middle"');
$notify_button = create_button('notify_sm.gif', 131, 125, 'align="middle"');
// For every post to be displayed, give it its own subtable, and show the important details of the post.
foreach ($context['posts'] as $post)
{
echo '
<table border="0" width="85%" cellspacing="1" cellpadding="0" class="bordercolor" align="center">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0" cellpadding="4" class="bordercolor" align="center">
<tr class="titlebg2">
<td style="padding: 0 1ex;">
', $post['counter'], '
</td>
<td width="75%" class="middletext">
<a href="', $scripturl, '#', $post['category']['id'], '">', $post['category']['name'], '</a> / <a href="', $scripturl, '?board=', $post['board']['id'], '.0">', $post['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $post['topic'], '.', $post['start'], '#msg', $post['id'], '">', $post['subject'], '</a>
</td>
<td class="middletext" align="right" style="padding: 0 1ex; white-space: nowrap;">
', $txt[30], ': ', $post['time'], '
</td>
</tr>
<tr>
<td width="100%" height="80" colspan="3" valign="top" class="windowbg2">
<div class="post">', $post['body'], '</div>
</td>';
//Show the Thank You list or the link or.... nothing? XD
if ($post['thank_you_post']['isThankYouPost']) {
echo '
</tr><tr class="ThankOMatic">
<td colspan="3" class="windowbg2" width="100%">
<hr width="100%" size="1" class="hrcolor" />
<span class="smalltext">';
if(!empty($context['thank_you_post'][$post['id']])) {
echo '
<p>'.$txt['followgiveathank'].'</p><p>';
foreach($context['thank_you_post'][$post['id']]['fulllist'] as $thx)
echo $thx['link'].(!empty($thx['deletelink']) ? $thx['deletelink'] : '').($thx['last'] ? '' : ', ');
echo '
</p>';
}
//Counter and Link to the direkt or complete list :)
echo '
<a href="'.$post['thank_you_post']['href'].'">
'.$txt['thank_you_link_beforecounter'].' '.$post['thank_you_post']['counter'].' '.($post['thank_you_post']['counter'] == 1 ? $txt['thank_you_link_member'] : $txt['thank_you_link_members']).' '.$txt['thank_you_link_aftercounter'].'
</a>';
if($post['thank_you_post']['locked'])
echo '<br />
<span class="smalltext"><i>'.$txt['thank_you_is_locked'].'</i></span>';
echo '
</span></td>';
}
echo '
</tr>
<tr>
<td colspan="3" class="windowbg2" align="', !$context['right_to_left'] ? 'right' : 'left', '"><span class="middletext">';
if ($post['can_delete'])
echo '
<a href="', $scripturl, '?action=profile;u=', $context['current_member'], ';sa=showPosts;start=', $context['start'], ';delete=', $post['id'], ';sesc=', $context['session_id'], '" onclick="return confirm(\'', $txt[154], '?\');">', $remove_button, '</a>';
if ($post['can_delete'] && ($post['can_mark_notify'] || $post['can_reply']))
echo '
', $context['menu_separator'];
if ($post['can_reply'])
echo '
<a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '">', $reply_button, '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], ';sesc=', $context['session_id'], '">', $quote_button, '</a>';
if ($post['can_reply'] && $post['can_mark_notify'])
echo '
', $context['menu_separator'];
if ($post['can_mark_notify'])
echo '
<a href="' . $scripturl . '?action=notify;topic=' . $post['topic'] . '.' . $post['start'] . '">' . $notify_button . '</a>';
echo '
</span></td>
</tr>
</table>
</td>
</tr>
</table>';
}
// Show more page numbers.
echo '
<table border="0" width="85%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">
<tr>
<td colspan="3" class="catbg3">
', $txt[139], ': ', $context['page_index'], '
</td>
</tr>
</table>';
}
// No posts? Just end the table with a informative message.
else
echo '
<tr class="windowbg2">
<td>
', $txt[170], '
</td>
</tr>
</table>';
}
// Template for showing all the buddies of the current user.
function template_editBuddies()
{
file $languagedir/Admin.thai-utf8.php
เพิ่ม -->>
$txt['maintain_thxpostrecount'] = 'Recalculate Thank-O-Matic stats';
$txt['maintain_thxpostrepair'] = 'Repair and optimize Thank-O-Matic tables';
file $languagedir/index.thai-utf8.php
เพิ่ม -->>
//Thank You text for the Thread :)
$txt['thank_you_link_beforecounter'] = 'For this post,';
$txt['thank_you_link_members'] = 'members';
$txt['thank_you_link_member'] = 'member';
$txt['thank_you_link_aftercounter'] = 'gave a thank you!';
$txt['thank_you_link_aftercounters'] = 'gave a thank you!';
$txt['thank_you_is_locked'] = 'Thank You is locked';
$txt['thank_you_post_post_b'] = 'Thank You';
$txt['thank_you_post_delete_b'] = 'Delete Thank You';
$txt['thank_you_post_lock_b'] = 'Lock Thank You';
$txt['thank_you_post_open_b'] = 'Open Thank You';
$txt['thank_you_post_lock_all_b'] = 'Lock All Thank You';
$txt['thank_you_post_open_all_b'] = 'Open All Thank You';
$txt['remove_thank_you_post'] = 'Remove this Thank You';
$txt['followgiveathank'] = 'Follow members gave a thank to your post:';
$txt['thank_you_post_unlock_all'] = 'Unlock All Thank You Posts';
$txt['thankyoupostlist'] = 'Thank You Post List (Complete)';
$txt['thankyouposterrorinscript'] = 'Error in scirpt... somehow this should not happen!';
$txt['thank_you_post_thx_display'] = 'Thank You';
$txt['thank_you_post_made_display'] = 'Given';
$txt['thank_you_post_became_display'] = 'Receive';
file $languagedir/ManageBoards.thai-utf8.php
เพิ่ม -->>
$txt['mboards_thank_you_post_enable'] = 'Enable Thank-O-Matic';
$txt['mboards_thank_you_post_enable_desc'] = 'This option enable the "Thank You" for posts on this board';
file $languagedir/ManagePermissions.thai-utf8.php
เพิ่ม -->>
//Thank-O-Matic Premmisions ;)
$txt['permissiongroup_thank_you_post'] = 'Thank-O-Matic';
$txt['permissionname_thank_you_post_show'] = 'Show Thank You Members of the Post';
$txt['permissionhelp_thank_you_post_show'] = 'Show the list who said thank you';
$txt['permissionname_thank_you_post_post'] = 'Give thank you to a post';
$txt['permissionhelp_thank_you_post_post'] = 'With this a user is allowed to add a thank you to each post in the allowed boards';
$txt['permissionname_thank_you_post_lock'] = 'Lock Thank You Post';
$txt['permissionhelp_thank_you_post_lock'] = 'Lock a "Thank You" so no one can make any new one.';
$txt['permissionname_thank_you_post_lock_own'] = 'Own Thank You';
$txt['permissionname_thank_you_post_lock_any'] = 'Any Thank You';
$txt['permissionname_thank_you_post_delete'] = 'Delete Thank You Post List';
$txt['permissionhelp_thank_you_post_delete'] = 'Deleting of Thank You Post list in the forum.';
$txt['permissionname_thank_you_post_delete_own'] = 'Own Thank You';
$txt['permissionname_thank_you_post_delete_any'] = 'Any Thank You';
$txt['permissionname_thank_you_post_delete_mem'] = 'Delete Thank You Post Member';
$txt['permissionhelp_thank_you_post_delete_mem'] = 'Deleting of a Poster in the Thank You Post list.';
$txt['permissionname_thank_you_post_delete_mem_own'] = 'Own Member';
$txt['permissionname_thank_you_post_delete_mem_any'] = 'Any Member';
$txt['permissionname_thank_you_post_lock_all'] = 'Lock/Unlock Thank You Thread';
$txt['permissionhelp_thank_you_post_lock_all'] = 'Lock/Unlock all "Thank You" options in the thread so no one can make any new one or start one.';
$txt['permissionname_thank_you_post_lock_all_own'] = 'Topic Owner';
$txt['permissionname_thank_you_post_lock_all_any'] = 'Any Topic';
$txt['permissionname_thank_you_post_unlock_all'] = 'Unlock all Posts of Thank You Thread';
$txt['permissionhelp_thank_you_post_unlock_all'] = 'Unlock all single "Thank You" Post, you can use this after a topic is moved from the junk yard back to the normal board, or for some other reasons ;)';
file$languagedir/Errors.thai-utf8.php
เพิ่ม -->>
//Thank-O-Matic Premmisions Errors ;)
$txt['cannot_thank_you_post_show'] = "You're not allowed to see this Thank You List!";
$txt['cannot_thank_you_post_post'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_lock_own'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_lock_any'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_delete_own'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_delete_any'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_delete_mem_own'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_delete_mem_any'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_lock_all_own'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_lock_all_any'] = "You're not allowed to use Thank You Options!";
$txt['cannot_thank_you_post_unlock_all'] = "You're not allowed to use Thank You Options!";
file $languagedir/ModSettings.thai-utf8.php
//Thank-O-Matic ModSettings ;)
$txt['thankyouposttitle'] = 'Thank-O-Matic';
$txt['thankYouPostColors'] = 'Enable Coloring the members of the list.';
$txt['thankYouPostOnePerPost'] = 'User can post to each post a Thank You<br />
<span class="smalltext">If this disabled, the member can post only one thanks per thread.</span>';
$txt['thankYouPostPreview'] = 'Enable Preview List under the post in topic index.';
$txt['thankYouPostPreviewHM'] = 'How many items should be shown in the previewlist?<br /><span class="smalltext"><strong>(0 = all)</strong></span></';
$txt['thankYouPostPreviewOrder'] = 'The order of the previewlist';
$txt['thankYouPostPreviewOrderSelect'] = 'Earliest THX first|Latest THX first';
$txt['thankYouPostFullOrder'] = 'The order of the Fulllist';
$txt['thankYouPostFullOrderSelect'] = 'Earliest THX first|Latest THX first|Member Names';
$txt['thankYouPostHideExtraInfo'] = '<br /><span class="smalltext"><a href="http://mods.simplemachines.org/index.php?mod=118">(require Hide Mod Special)</a></span>';
//Pleast don't forget the .$txt['thankYouPostHideExtraInfo'] after the text!
$txt['thankYouPostUnhidePost'] = 'Unhide Content of the Post after posting "Thank You" to this post
<br /><span class="smalltext">This unhide only the post who made the thank you, but if the user post normal it unhide all</span>'.$txt['thankYouPostHideExtraInfo'];
$txt['thankYouPostThxUnhideAll'] = 'On Thank You unhide all, hidden contents!
<br /><span class="smalltext">Unhide all content after posting one Thank You to any post (Disable Option 1)</span>'.$txt['thankYouPostHideExtraInfo'];
$txt['thankYouPostDisableUnhide'] = 'Disable the Option unhide content, after real posting, only thank you can unhide it!
<br /><span class="smalltext">You must post a Thank You to unhide the content, depend on Option 1/2 how many it unhide</span>'.$txt['thankYouPostHideExtraInfo'];
$txt['thankYouPostDisplayPage'] = 'Show Thank You Post given and receive on Topic Display';
file $languagedir/Profile.thai-utf8.php
//Thank-O-Matic
$txt['thankyoutitle'] = 'Thank You Posts';
$txt['thankyoupostmade'] = 'Thanks given by you';
$txt['thankyoupostbecame'] = 'Thanks taken by you';
ดาวน์โหลด: ThankOMatic.rar
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comแตกไฟล์แล้วอัพโหลดไปไว้ที่
file thank_you_b.gif -->> $themedir/images/buttons
file thank_you.gif -->> $themedir/images/thai-utf8
file thank_you_delete.gif -->> $themedir/images/thai-utf8
file thank_you_lock1.gif -->> $themedir/images/thai-utf8
file thank_you_lock2.gif -->> $themedir/images/thai-utf8
file ThankYouPost.template.php -->> $themesdir/default
file ThankYouPost.thai-utf8.php -->> $themesdir/default/language
file ThankYouPost.php -->> $sourcedir
สร้างไฟล์: install_1.x.x.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/install_1.x.x.php -->> Enter เสร็จแล้วลบทิ้ง
<?
/*****************************************************************
* install.php Version 1.0.2 *
* Special Advanced Version for Easier Handling *
* Programmed / Copyright By DIN1031 (http://www.ayu-kult.de/) *
* for SMF (http://www.simplemachines.org) *
*****************************************************************/
/*****************************************************************
* It's free to change and use everywhere who this file is *
* useable and made his work. You can change the code as you like *
* it. The only thing that i wish is, add the first 7 Lines of *
* this file *
* THANKS A LOT *
*****************************************************************/
/*****************************************************************
* Used for follow Software *
* Programm: Thank-O-Matic *
* By: DIN1031 (http://www.ayu-kult.de/) *
* Copyright: DIN1031 (http://www.ayu-kult.de/) *
*****************************************************************/
global $db_prefix, $modSettings;
//This is a way to install the mod without the package parser!
//This is a way to install the mod without the package parser!
$SSI_INSTALL = false;
if(!isset($db_prefix)) {
require('SSI.php');
$SSI_INSTALL = true;
}
//I can't install it if this on <<
$old_querycheck = isset($modSettings['disableQueryCheck']) ? $modSettings['disableQueryCheck'] : 0;
$modSettings['disableQueryCheck'] = 1;
// Creat Tables :)
db_query("
CREATE TABLE IF NOT EXISTS {$db_prefix}thank_you_post (
ID_THX_POST int(10) unsigned NOT NULL auto_increment,
ID_MSG int(10) unsigned NOT NULL ,
ID_TOPIC mediumint(8) unsigned NOT NULL ,
ID_BOARD smallint(5) unsigned NOT NULL ,
ID_MEMBER mediumint(8) unsigned NOT NULL ,
memberName varchar(80) NOT NULL ,
thx_time int(10) unsigned NOT NULL ,
PRIMARY KEY (ID_THX_POST),
INDEX (ID_BOARD),
INDEX (ID_MSG),
INDEX (ID_TOPIC),
INDEX (ID_MEMBER)
) TYPE=MyISAM", __FILE__, __LINE__);
/*This is the array for alter Tables... i use this as my advance installer so i can made some changes quicker *g*
Table without db_prefix
array('table', 'rowname', 'rowsetting', 'update value');
This Check if the row exists, if not than creat it :), easy for update handling ;)
*/
$sql_adds = array(
array("topics", "thank_you_post_locked", "TINYINT(4) unsigned DEFAULT '0' NOT NULL"),
array("boards", "thank_you_post_enable", "TINYINT(4) unsigned DEFAULT '1' NOT NULL", '1'),
array("messages", "thank_you_post", "TINYINT(4) unsigned DEFAULT '0' NOT NULL"),
array("messages", "thank_you_post_counter", "SMALLINT(5) unsigned DEFAULT '0' NOT NULL"),
array("members", "thank_you_post_made", "mediumint(8) unsigned DEFAULT '0' NOT NULL"),
array("members", "thank_you_post_became", "mediumint(8) unsigned DEFAULT '0' NOT NULL"),
);
foreach($sql_adds as $rowinfo) {
$table = $rowinfo['0'];
$rowname = $rowinfo['1'];
$rowsetting = $rowinfo['2'];
//Mistake made... hmmm what should i do? XD Tell him that something not correct!
if(empty($rowname) || empty($rowsetting)) {
echo "SQL SMF INSTALLER: Error... rowname or rowsetting not set!";
die();
}
//Load the rows ;)
$request = db_query("SHOW COLUMNS FROM {$db_prefix}{$table}", __FILE__, __LINE__);
$installed = false;
while($row = mysql_fetch_assoc($request) ) {
$installed = $row['Field'] == $rowname;
if($installed)
break;
}
mysql_free_result($request);
//Not Installed Intall it ;)
if(!$installed) {
db_query("ALTER TABLE {$db_prefix}{$table} ADD $rowname $rowsetting", __FILE__, __LINE__);
//I need to change values? Because it's new installed :)
if(isset($rowinfo['3'])) {
db_query("
UPDATE {$db_prefix}{$table}
SET $rowname = $rowinfo[3]", __FILE__, __LINE__);
}
}
}
//Okay Work done ;) (Replace the Varibale back...)
$modSettings['disableQueryCheck'] = $old_querycheck;
//Give a proper answer on ssi install ;)
if($SSI_INSTALL)
echo 'DB Changes should be made now...';
?>
ลิงค์หัวข้อ:
http://dexmore.com/topic/1990