รายละเอียด ให้สมาชิกสามารถบันทึกข้อความส่วนตัวที่มีความสำคัญไว้ในคอมพิวเตอร์ของตัวเอง ซึ่งจะดาวน์โหลดมาในรูปแบบไฟล์ .html สามารถเปิดอ่านได้ในภายหลัง
ตัวอย่าง
สำหรับ SMF 1.1.xxแก้ไขไฟล์:file $boarddir/index.php
ค้นหา -->>
'pm' => array('PersonalMessage.php', 'MessageMain'),
เพิ่มไว้หลัง -->>
'pmsave' => array('PersonalMessage.php', 'Message_Save_as_HTML'),
'pmsaveall' => array('PersonalMessage.php', 'Messages_save_all'),
file $sourcedir/ModSettings.php
ค้นหา -->>
array('check', 'enableReportPM'),
เพิ่มไว้หลัง -->>
array('check', 'SaveAllPMsEnabled'),
file $sourcedir/PersonalMessage.php
ค้นหา -->>
// Handle labels.
if (empty($context['currently_using_labels']))
unset($context['pm_areas']['labels']);
เพิ่มไว้ก่อน -->>
//Pah i need to add this only if it enabled ;)
if(!empty($modSettings['SaveAllPMsEnabled'])) {
$context['pm_areas']['folders']['areas'][] = array();
$context['pm_areas']['folders']['areas']['saveall'] = array('link' => '<a href="' . $scripturl . '?action=pmsaveall'.($context['folder'] == 'outbox' ? ';sa=pm_out' : '') .'">' . $txt['SaveAllPMs'] . '</a>', 'href' => $scripturl . '?action=pmsaveall'.($context['folder'] == 'outbox' ? ';sa=pm_out' : ''));
}
ค้นหา -->>
if (isset($_REQUEST['del_selected']))
$_REQUEST['pm_action'] = 'delete';
แก้เป็น -->>
if (isset($_REQUEST['del_selected']))
$_REQUEST['pm_action'] = 'delete';
// Multiple PM Saving =)
if (isset($_REQUEST['save_selected']))
{
// Assume Inbox or Outbox
$_REQUEST['sa'] = !isset($_REQUEST['f']) || $_REQUEST['f'] == 'inbox' ? 'pm_in' : 'pm_out';
return Message_Save_as_HTML($_REQUEST['pms']);
}
ค้นหา -->>
?>
เพิ่มไว้ก่อน -->>
function Message_Save_as_HTML($pid = null) {
global $db_prefix, $txt, $scripturl, $context;
global $board_info, $ID_MEMBER;
global $modSettings;
// No guests!
is_not_guest();
// You're not supposed to be here at all, if you can't even read PMs.
isAllowedTo('pm_read');
//Check the pid for multi read (save_all give all pid in one array!
if (empty($pid)) {
if (is_numeric($_REQUEST['pid']) && $_REQUEST['pid'] > 0)
$pid = array($_REQUEST['pid']);
else
redirectexit('action=pm');
}
elseif(!is_array($pid))
$pid = array($pid);
else
$pid = array_unique($pid);
if (!isset($_REQUEST['sa']) || $_REQUEST['sa'] == 'pm_in') {
$add_search = "pmr.deleted = 0 AND pmr.ID_MEMBER = $ID_MEMBER" ;
//I would like only to know who did sent me the messages not more!
$sent_to_all = '';
}
elseif($_REQUEST['sa'] == 'pm_out') {
//Oh i need only the my own and not delted pms *nice*
$add_search = "pm.deletedBySender = 0 AND pm.ID_MEMBER_FROM = $ID_MEMBER";
//Only my own sent pms are allowed to see all informations like bcc etc etc...
$sent_to_all = ', pmr.bcc as bcc';
}
else
redirectexit('action=pm');
$context['PM_with_images'] = false;
$context['pm'] = array();
$owners = array();
//Load the pms... IN array ;)
$request = db_query("
SELECT pm.ID_PM as ID_PM, pm.ID_MEMBER_FROM as ID_MEMBER_FROM, pm.fromName as fromName,
pm.msgtime as time, pm.subject as subject, pm.body as pmtext,
pmr.ID_MEMBER as sentto $sent_to_all
FROM {$db_prefix}personal_messages as pm
LEFT JOIN {$db_prefix}pm_recipients as pmr ON (pm.ID_PM = pmr.ID_PM)
WHERE pm.ID_PM ".(count($pid) == 1 ? "= '".current($pid)."'": "IN ('".implode("', '",$pid)."')")." AND ".
$add_search
,__FILE__,__LINE__);
while ($row = mysql_fetch_assoc($request)) {
if(!isset($context['pm'][$row['ID_PM']])) {
$context['pm'][$row['ID_PM']] = array(
'ID' => $row['ID_PM'],
'ID_MEMBER_FROM' => array(
'id' => $row['ID_MEMBER_FROM'],
'name' => $row['fromName'],
),
'sentto' => array (
'to' => array(),
'bcc' => array(),
),
'subject' => $row['subject'],
'pmtext' => parse_bbc($row['pmtext'], false),
'time' => timeformat($row['time'], false),
);
}
//Huhhh which people become the pm... or only a sent to me =)
if(!empty($sent_to_all))
$item = ($row['bcc'] == 1 ? 'bcc' : 'to');
else
$item = 'to';
$context['pm'][$row['ID_PM']]['sentto'][$item][$row['sentto']] = array(
'id' => $row['sentto'],
'name' => $txt['guest'],
);
//Collect the member id i need to load them later *g*
$owners[$row['sentto']] = $row['sentto'];
$owners[$row['ID_MEMBER_FROM']] = $row['ID_MEMBER_FROM'];
if(!$context['PM_with_images'])
$context['PM_with_images'] = preg_match('~(\[img.*?\])(.+?)\[/img\]~eis', $row['pmtext']) !== 0;
}
mysql_free_result($request);
//No pms loaded... tsts people try everything...
if(empty($context['pm']))
redirectexit('action=pm');
//So Let's load some memberdatas...
if (!empty($owners)) {
//Now i can Load the Missing global :)
global $user_profile;
loadMemberData($owners);
//So let's replace the links...
foreach($context['pm'] as $PM_ID => $PM_array) {
if(!empty($context['pm'][$PM_ID]['ID_MEMBER_FROM']['id'])) {
$profile = $user_profile[$context['pm'][$PM_ID]['ID_MEMBER_FROM']['id']];
$context['pm'][$PM_ID]['ID_MEMBER_FROM']['name'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['realName'] . '</span></a>';
}
if(!empty($context['pm'][$PM_ID]['sentto']['to'])) {
foreach($context['pm'][$PM_ID]['sentto']['to'] as $k => $v) {
if(!empty($v['id'])) {
$profile = $user_profile[$v['id']];
if (!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
$context['pm'][$PM_ID]['sentto']['to'][$k]['name'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['realName'] . '</span></a>';
else
$context['pm'][$PM_ID]['sentto']['to'][$k]['name'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>';
}
}
}
if(!empty($context['pm'][$PM_ID]['sentto']['bcc'])) {
foreach($context['pm'][$PM_ID]['sentto']['bcc'] as $k => $v) {
if(!empty($v['id'])) {
$profile = $user_profile[$v['id']];
if (!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
$context['pm'][$PM_ID]['sentto']['bcc'][$k]['name'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['realName'] . '</span></a>';
else
$context['pm'][$PM_ID]['sentto']['bcc'][$k]['name'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>';
}
}
}
}
}
loadTemplate('IMSave');
$context['template_layers'] = array('IMSave');
$context['topic_subject'] = $txt[159]." - ".(count($pid) == 1 ? '#'.current($pid) : timeformat(time(), false));
$context['file_name'] = (count($pid) == 1 ? 'PM'.current($pid) : time()).'.html';
}
//Load all Messages... (Currently no limit... but i thing about it).
function Messages_save_all() {
global $db_prefix, $txt, $scripturl, $context;
global $board_info, $ID_MEMBER;
global $modSettings;
if(empty($modSettings['SaveAllPMsEnabled']))
fatal_error($txt['SaveAllPMsEnabled_error'], false);
// No guests!
is_not_guest();
// You're not supposed to be here at all, if you can't even read PMs.
isAllowedTo('pm_read');
if (!isset($_REQUEST['sa']) || $_REQUEST['sa'] == 'pm_in') {
$add_search = "pmr.deleted = 0 AND pmr.ID_MEMBER = $ID_MEMBER" ;
}
elseif($_REQUEST['sa'] == 'pm_out') {
//Oh i need only the my own and not delted pms *nice*
$add_search = "pm.deletedBySender = 0 AND pm.ID_MEMBER_FROM = $ID_MEMBER";
}
else
redirectexit('action=pm');
$pms = array();
//Load the pms... IN array ;)
$request = db_query("
SELECT pm.ID_PM as ID_PM
FROM {$db_prefix}personal_messages as pm
LEFT JOIN {$db_prefix}pm_recipients as pmr ON (pm.ID_PM = pmr.ID_PM)
WHERE $add_search",__FILE__,__LINE__);
while ($row = mysql_fetch_assoc($request))
$pms[] = $row['ID_PM'];
//TsTs no pms... gna i hate people who try this...
if(empty($pms))
redirectexit('action=pm');
//Remove the double pms...
$pms = array_unique($pms);
//if(count($pms) > 250)
// fatal_error('Bitte nicht mehr als 250 PMs gleichzeitig speichern!', FALSE);
Message_Save_as_HTML($pms);
}
file $themedir/PersonalMessage.template.php
ค้นหา -->>
$delete_button = create_button('delete.gif', 154, 31, 'align="middle"');
เพิ่มไว้หลัง -->>
$savepm_button = create_button('savepm_b.gif', 'SavePM', 'SavePM', 'align="middle"');
ค้นหา -->>
echo '
<a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions[', $message['id'], ']=delete;f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';sesc=', $context['session_id'], '" onclick="return confirm(\'', addslashes($txt[154]), '?\');">', $delete_button, '</a>
เพิ่มไว้ก่อน -->>
echo '
<a href="', $scripturl, '?action=pmsave', ($context['folder'] != 'outbox' ? '' : ';sa=pm_out'), ';pid=', $message['id'], '">', $savepm_button, '</a>';
ค้นหา -->>
echo '
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['smf249'], '\')) return false;" />';
แก้เป็น -->>
echo '
<input type="submit" name="save_selected" value="', $txt['SavePM'], '" style="font-weight: normal;" />';
echo '
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['smf249'], '\')) return false;" />';
ค้นหา -->>
<div style="float: right;"><input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['smf249'], '\')) return false;" /></div>
แก้เป็น -->>
<div style="float: right;"><input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['smf249'], '\')) return false;" /></div>
<div style="float: right;"><input type="submit" name="save_selected" value="', $txt['SavePM'], '" style="font-weight: normal;" /></div>
file $languagedir/ModSettings.thai-utf8.php
เพิ่ม -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comfile $languagedir/index.thai-utf8.php
เพิ่ม -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comการตั้งค่า: ผู้ดูแล -->> ส่วนปรับแต่งค่าการใช้งาน -->> เปิดใช้งาน "บันทึกข้อความส่วนตัวทั้งหมด"
ลิงค์หัวข้อ:
http://dexmore.com/topic/2009