AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF
หน้าแรก
เว็บบอร์ด
กระทู้โปรด
กระทู้ล่าสุด
ติดต่อทีมงาน
ห้องเกมส์
ร้านค้า
ซื้อไอเท็ม
ศูนย์กลางซื้อ-ขาย
ไอเท็มของคุณ
ไอเท็มของสมาชิก
ส่งเงินให้เพื่อน
ส่งไอเท็มให้เพื่อน
ธนาคาร
สัตว์เลี้ยง
สัตว์เลี้ยงของคุณ
สัตว์เลี้ยงของสมาชิก
เกี่ยวกับเรา
ปฏิทิน
สมาชิก
22 พฤษภาคม 2555, 16:09:59
ยินดีต้อนรับผู้เยี่ยมชม
ยินดีต้อนรับคุณ,
ผู้เยี่ยมชม
กรุณา
เข้าสู่ระบบ
หรือ
ลงทะเบียน
1 ชั่วโมง
1 วัน
1 สัปดาห์
1 เดือน
ตลอดกาล
เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
ระเบียบปฏิบัติ
สมัครสมาชิก
ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477
-:-DexMoreGroup แหล่งมั่วสุมทางปัญญา-:-
Web Achieve
Simple Machines Forum
SMF Modifications
AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF
หน้า:
1
ผู้เขียน
หัวข้อ: AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF (อ่าน 1846 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
UnclEo
!Personal
Reputation :
5863
Chips :
9884 Mony
Age
: 33
Member ID
: 2
Level 44 : Exp 80%
HP: 50.5%
PD: 3.542
Login Time
: 471:22:51
Total Posts
: 3043
Total Topics
: 1519
Adviser
: 24
AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF
เมื่อ:
22 มิถุนายน 2553, 20:45:13
ชื่อ: AjaxChat Integration
ผู้เขียน: .HuNTeR.
นำเสนอโดย:
DexMoreGroup
ประเภท: Socialization
รองรับ: SMF 1.1.xx, 2.0.xx
ปรับปรุงล่าสุด: 18 พฤษภาคม 2553
ต้นฉบับ:
AjaxChat Integration
รายละเอียด
AjaxChat เป็น Application ที่ใช้ได้กับ CMS หลายๆ ค่ายด้วยกัน ซึ่งความสามารถก็ไม่แพ้ห้องสนทนาที่ใช้สำหรับเว็บตัวอื่นๆ
สามารถเปิดห้องสนทนาเป็น PopUp ได้
กำหนดให้แสดงเฉพาะหน้าแรก หรือหน้าพื้นฐานอื่นๆ ได้
แสดงจำนวนผู้ใช้ที่ปุมในแถบเมนู
แสดงจำนวนผู้ใช้ในรายละเอียดผู้ใช้
แสดงชื่อผู้ใช้ในส่วนของผู้ใช้งานขณะนี้
กำหนดกลุ่มผู้ดูแลได้
ใช้ BBCode ตัวหนา, ตัวเอียง, ขีดเส้นใต้
สามารถโพสต์รูปในห้อง/กล่องสนทนาได้
บูรณาการณ์ห้องสนทนากับกล่องสนทนาเข้าด้วยกันได้
ผู้ใช้สามารถสร้างห้องส่วนตัวและเชิญผู้อื่นเข้าร่วมสนทนาได้
มีบอทคอยรายงานความเคลื่อนไหว
ตัวอย่าง
สำหรับ SMF 1.1.xx
แก้ไขไฟล์:
file $sourcedir/BoardIndex.php
ค้นหา -->>
โค๊ด:
[Select]
// Track most online statistics?
if (!empty($modSettings['trackStats']))
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
$context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];
//users in chat
if (!WIRELESS){
$userIDs = chatOnlineUsers();
$context['chat_links'] = array();
if (count($userIDs) > 0){
$query = "SELECT mem.ID_MEMBER, mem.realName, mem.ID_GROUP, mg.onlineColor, mg.ID_GROUP
FROM
{$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))WHERE ";
foreach ($userIDs as $ID)
$query .= 'ID_MEMBER = '. $ID . ' OR ';
//remove the last OR
$query = substr($query, 0, strlen($query)-3);
$result = db_query($query, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
if($row['onlineColor'] != ""){
$link.= '" style="color: ' . $row['onlineColor'];
}
$link.= '">' . $row['realName'] . '</a>';
array_push($context['chat_links'], $link);
}
mysql_free_result($result);
}
//set the flag true for home page
$context['chat_isHome'] = true;
}
file $sourcedir/Load.php
ค้นหา -->>
โค๊ด:
[Select]
$context['template_layers'] = array('main');
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
array_splice($context['template_layers'], 1, 0, 'shout');
ค้นหา -->>
โค๊ด:
[Select]
// Load each template.... and attempt to load its associated language file.
foreach ($templates as $template)
{
loadTemplate($template);
loadLanguage($template, '', false);
}
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
loadTemplate('Shout');
loadLanguage('Shout');
ค้นหา -->>
โค๊ด:
[Select]
?>
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
function getShoutBoxContent($mini = false){
global $scripturl, $modSettings;
// Get the URL to the chat directory:
if (!defined('AJAX_CHAT_URL')){
if (empty($modSettings['miniChat']))
define('AJAX_CHAT_URL', str_replace("index.php", "shoutBox/", $scripturl));
else
define('AJAX_CHAT_URL', str_replace("index.php", "chat/", $scripturl));
}
// Get the real path to the chat directory:
if (!defined('AJAX_CHAT_PATH')){
if (empty($modSettings['miniChat']))
define('AJAX_CHAT_PATH', dirname(dirname(__FILE__)) . '/shoutBox/');
else
define('AJAX_CHAT_PATH', dirname(dirname(__FILE__)) . '/chat/');
}
// Validate the path to the chat:
if (@is_file(AJAX_CHAT_PATH . 'lib/classes.php')){
// Include Class libraries:
require_once(AJAX_CHAT_PATH.'lib/classes.php');
// Initialize the shoutbox:
$ajaxChat = new CustomAJAXChatShoutBox();
// Parse and return the shoutbox template content:
return $ajaxChat->getShoutBoxContent($mini);
}
return null;
}
function chatOnlineUsers(){
global $db_prefix;
$userIDs = array();
$result = db_query("SELECT userID
FROM ${db_prefix}ajaxchat_online
WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)
", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($result)) {
array_push($userIDs, $row['userID']);
}
mysql_free_result($result);
return array_unique($userIDs);
}
file $sourcedir/ManagePermissions.php
ค้นหา -->>
โค๊ด:
[Select]
'profile_upload_avatar' => false,
'profile_remote_avatar' => false,
)
),
'board' => array(
แก้เป็น -->>
โค๊ด:
[Select]
'profile_upload_avatar' => false,
'profile_remote_avatar' => false,
),
'chat' => array(
'chat_access' => false,
'chat_mod' => false,
'shout_view' => false,
'shout_access' => false,
'shout_mod' => false,
)
),
'board' => array(
file $sourcedir/ModSettings.php
ค้นหา -->>
โค๊ด:
[Select]
array('text', 'default_personalText'),
array('int', 'max_signatureLength'),
แก้เป็น -->>
โค๊ด:
[Select]
array('text', 'default_personalText'),
array('int', 'max_signatureLength'),
array('check', 'enableShoutBox'),
array('check', 'anyPageShoutBox'),
array('check', 'miniChat'),
array('check', 'chatPopUp'),
array('check', 'enableChatButtonNo'),
array('check', 'enableChatBelowPM'),
file $boarddir/SSI.php
ค้นหา -->>
โค๊ด:
[Select]
?>
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
function ssi_chatOnline($output_method = 'echo')
{
global $db_prefix, $scripturl, $txt;
$users = array();
$userIDs = array();
$result = db_query("SELECT userID
FROM ${db_prefix}ajaxchat_online
WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)
", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($result)) {
array_push($userIDs, $row['userID']);
}
mysql_free_result($result);
$users['IDs'] = array_unique($userIDs);
$users['links'] = array();
if (count($users['IDs']) > 0){
$query = "SELECT mem.ID_MEMBER, mem.realName, mem.ID_GROUP, mg.onlineColor, mg.ID_GROUP
FROM
{$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))WHERE ";
foreach ($users['IDs'] as $ID)
$query .= 'ID_MEMBER = '. $ID . ' OR ';
//remove the last OR
$query = substr($query, 0, strlen($query)-3);
$result = db_query($query, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
if($row['onlineColor'] != ""){
$link.= '" style="color: ' . $row['onlineColor'];
}
$link.= '">' . $row['realName'] . '</a>';
array_push($users['links'], $link);
}
mysql_free_result($result);
}
if ($output_method != 'echo')
return $users;
else{
if (count($users['links']) == 0 )
echo $txt['chat_no_user'];
elseif (count($users['links']) == 1 )
echo '1' . $txt['chat_aUser']. ':<br />', implode($users['links']);
else
echo count($users['links']). $txt['chat_users']. ':<br />', implode(', ', $users['links']);
}
}
file $themedir/BoardIndex.template.php
ค้นหา -->>
โค๊ด:
[Select]
', $txt[140], ':<br />', implode(', ', $context['list_users_online']);
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
// users in chat
if (isset($context['chat_links'])){
if (count($context['chat_links']) == 0 )
echo '<br />' . $txt['chat_no_user'];
elseif (count($context['chat_links']) == 1 )
echo '<br /> 1' . $txt['chat_aUser']. ':<br />', implode($context['chat_links']);
else
echo '<br /> ' . count($context['chat_links']). $txt['chat_users']. ':<br />', implode(', ', $context['chat_links']);
}
file $themedir/index.template.php
ค้นหา -->>
โค๊ด:
[Select]
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
แก้เป็น -->>
โค๊ด:
[Select]
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
ค้นหา -->>
โค๊ด:
[Select]
// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
echo '
</span>';
}
แก้เป็น -->>
โค๊ด:
[Select]
// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
if (!empty($modSettings['enableChatBelowPM'])){
$count = count(chatOnlineUsers());
if ($count == 0 )
echo '<br />' . $txt['chat_no_user'];
elseif ($count == 1 )
echo '<br /> 1' . $txt['chat_aUser']. '.<br />';
else
echo '<br /> ' . $count . $txt['chat_users']. '<br />';
}
echo '
</span>';
}
ค้นหา -->>
โค๊ด:
[Select]
// Otherwise, they might want to [logout]...
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
// the [chat] button
$chatPath = str_replace("index.php", "chat/index.php", $scripturl);
$num = (empty($modSettings['enableChatButtonNo'])) ? 0 : count(chatOnlineUsers());
echo $context['browser']['is_ie4'] ? '<td class="maintab_active_' . $first . '"> </td>' : '', '
<td valign="top" class="maintab_back">
<a href="', $chatPath, '"', empty($modSettings['chatPopUp']) ? 'target="_blank"' : ' onclick="openWindow(this.href);this.blur();return false;"', '>', $txt['chat'], ($num > 0) ? ('('.$num.')') : '' , '</a>
</td>';
file $languagedir/Help.thai-utf8.php
เพิ่ม -->>
โค๊ด:
[Select]
//Begin AjaxChat Integration
$helptxt['enableShoutBox'] = 'This enables the ajaxchat shoutbox on your index page.';
$helptxt['enableChatButtonNo'] = 'This shows number of chating users on chat button.';
$helptxt['enableChatBelowPM'] = 'This shows online chat users below total time logged in section.';
$helptxt['anyPageShoutBox'] = 'If you enable this ShoutBox will shown in all your forum pages but if disabled ShoutBox will shown only in index page.';
$helptxt['chatPopUp'] = 'If enabled when clicking on chat button chat will loads a new popup page.';
$helptxt['miniChat'] = 'If enabled shoutBox and chat became same thing and users can chat in every page';
//End AjaxChat Integration
file $languagedir/Modifications.thai-utf8.php
เพิ่ม -->>
โค๊ด:
[Select]
//Begin AjaxChat Integration
$txt['chat'] = 'Chat';
$txt['shoutBox'] = 'ShoutBox';
$txt['chat_aUser'] = ' user is in chat';
$txt['chat_users'] = ' users are in chat:';
$txt['chat_no_user'] = 'No user is in chat.';
$txt['enableShoutBox'] = 'Enable the ShoutBox?';
$txt['enableChatButtonNo'] = 'Enable online chat users numbering on chat button?';
$txt['enableChatBelowPM'] = 'Show online users below total logged in time section?';
$txt['anyPageShoutBox'] = 'Check for ShoutBox on any page or uncheck for only in index page:';
$txt['chatPopUp'] = 'Chat in popup page?';
$txt['miniChat'] = 'Integrate shout box and chat room?';
$txt['permissionname_chat_access'] = 'Access to chat';
$txt['permissionhelp_chat_access'] = 'Users can use the chat or can\'t.';
$txt['permissionname_shout_access'] = 'Can shout';
$txt['permissionhelp_shout_access'] = 'Give access to write in shout box.';
$txt['permissionname_shout_view'] = 'View shoutBox';
$txt['permissionhelp_shout_view'] = 'Give access to view the shoutBox';
$txt['permissionname_shout_mod'] = 'Moderate shoutBox';
$txt['permissionhelp_shout_mod'] = 'Give access to moderate the shoutBox.';
$txt['permissionname_chat_mod'] = 'Moderate chat';
$txt['permissionhelp_chat_mod'] = 'Give access to moderate the chat.';
$txt['permissiongroup_chat'] = 'Chat';
//End AjaxChat Integration
ดาวน์โหลด:
AjaxChat.rar
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน
เงื่อนไขการใช้งาน DexMore.Com
แตกไฟล์แล้วอัพโหลดไปไว้ที่
file Shout.template.php -->> $themedir
file Shout.english.php -->> $languagedir
file Shout.thai-utf8.php -->> $languagedir
file shoutbox.css -->> $themedir
folder chat -->> $boarddir
folder shoutBox -->> $boarddir
สร้างไฟล์:
Tables_1.1.X.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/Tables_1.1.X.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด:
[Select]
<?php
if(
file_exists
(
dirname
(
__FILE__
) .
'/SSI.php'
) && !
defined
(
'SMF'
))
require_once(
dirname
(
__FILE__
) .
'/SSI.php'
);
else if(!
defined
(
'SMF'
))
die(
'<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php and SSI.php files.'
);
if((
SMF
==
'SSI'
) && !
$user_info
[
'is_admin'
])
die(
'Admin priveleges required.'
);
//remove previous version's tabales
db_query
(
"DROP TABLE IF EXISTS ajax_chat_online"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_chat_messages"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_chat_bans"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_chat_invitations"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_shout_online"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_shout_messages"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_shout_bans"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS ajax_shout_invitations"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxchat_online"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxchat_messages"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxchat_bans"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxchat_invitations"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxchat_online (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxchat_messages (
id INT(11) NOT NULL AUTO_INCREMENT,
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL,
text TEXT,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxchat_bans (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxchat_invitations (
userID INT(11) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxshout_online"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxshout_messages"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxshout_bans"
,
__FILE__
,
__LINE__
);
db_query
(
"DROP TABLE IF EXISTS {$db_prefix}ajaxshout_invitations"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxshout_online (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxshout_messages (
id INT(11) NOT NULL AUTO_INCREMENT,
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL,
text TEXT,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxshout_bans (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
db_query
(
"
CREATE TABLE {$db_prefix}ajaxshout_invitations (
userID INT(11) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
"
,
__FILE__
,
__LINE__
);
if(
SMF
==
'SSI'
)
echo
'Database changes are complete!'
;
?>
การตั้งค่า:
ผู้ดูแล -->> ส่วนปรับแต่งค่าการใช้งาน
ผู้ดูแล -->> แก้ไขการอนุญาต -->> [กลุ่มสมาชิก] ขั้นสูง
ลิงค์หัวข้อ
:
http://dexmore.com/topic/2076
ghonee
,
artie
,
kornchai
บันทึกการเข้า
UnclEo
!Personal
Reputation :
5863
Chips :
9884 Mony
Age
: 33
Member ID
: 2
Level 44 : Exp 80%
HP: 50.5%
PD: 3.542
Login Time
: 471:22:51
Total Posts
: 3043
Total Topics
: 1519
Adviser
: 24
AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF
ความคิดเห็นที่ 1 เมื่อ:
22 มิถุนายน 2553, 20:47:18
สำหรับ SMF 2.0.xx
แก้ไขไฟล์:
file $sourcedir/Admin.php
ค้นหา -->>
โค๊ด:
[Select]
// Note the comma!! The setting with automatically appear with the first mod to be added.
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
'chat' => array($txt['chat']),
ค้นหา -->>
โค๊ด:
[Select]
// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
array('ModifyAjaxChatModSettings', 'area=modsettings;save;sa=chat'),
file $sourcedir/BoardIndex.php
ค้นหา -->>
โค๊ด:
[Select]
function BoardIndex()
{
global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl;
แก้เป็น -->>
โค๊ด:
[Select]
function BoardIndex()
{
global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl, $smcFunc;
ค้นหา -->>
โค๊ด:
[Select]
$context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
//ajax chat start
$userIDs = chatOnlineUsers();
$context['chat_links'] = array();
if (count($userIDs) > 0){
if (count($userIDs) == 1){
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM
{db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER = {int:the_id}' ,
array(
'the_id' => $userIDs[0],
)
);
}else{
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM
{db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER IN ({array_int:the_ids})',
array(
'the_ids' => $userIDs,
)
);
}
while ($row =$smcFunc['db_fetch_assoc']($result))
{
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
if($row['online_color'] != ""){
$link.= '" style="color: ' . $row['online_color'];
}
$link.= '">' . $row['real_name'] . '</a>';
array_push($context['chat_links'], $link);
}
$smcFunc['db_free_result']($result);
}
//set the flag true for home page
$context['chat_isHome'] = true;
//end ajax chat
file $sourcedir/Load.php
ค้นหา -->>
โค๊ด:
[Select]
// Load each template...
foreach ($templates as $template)
loadTemplate($template);
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
loadTemplate('Shout');
loadLanguage('Shout');
ค้นหา -->>
โค๊ด:
[Select]
$context['template_layers'] = array('html', 'body');
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
array_splice($context['template_layers'], 2, 0, 'shout');
ค้นหา -->>
โค๊ด:
[Select]
?>
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
function getShoutBoxContent($mini = false){
global $scripturl, $modSettings;
// Get the URL to the chat directory:
if (!defined('AJAX_CHAT_URL')){
if (empty($modSettings['miniChat']))
define('AJAX_CHAT_URL', str_replace("index.php", "shoutBox/", $scripturl));
else
define('AJAX_CHAT_URL', str_replace("index.php", "chat/", $scripturl));
}
// Get the real path to the chat directory:
if (!defined('AJAX_CHAT_PATH')){
if (empty($modSettings['miniChat']))
define('AJAX_CHAT_PATH', dirname(dirname(__FILE__)) . '/shoutBox/');
else
define('AJAX_CHAT_PATH', dirname(dirname(__FILE__)) . '/chat/');
}
// Validate the path to the chat:
if (@is_file(AJAX_CHAT_PATH . 'lib/classes.php')){
// Include Class libraries:
require_once(AJAX_CHAT_PATH.'lib/classes.php');
// Initialize the shoutbox:
$ajaxChat = new CustomAJAXChatShoutBox();
// Parse and return the shoutbox template content:
return $ajaxChat->getShoutBoxContent($mini);
}
return null;
}
function chatOnlineUsers(){
global $smcFunc;
$userIDs = array();
$result = $smcFunc['db_query']('', '
SELECT userID
FROM {db_prefix}ajaxchat_online
WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)' ,
array()
);
while($row = $smcFunc['db_fetch_assoc']($result)) {
array_push($userIDs, $row['userID']);
}
$smcFunc['db_free_result']($result);
return array_unique($userIDs);
}
file $sourcedir/ManagePermissions.php
ค้นหา -->>
โค๊ด:
[Select]
'karma_edit' => array(false, 'general', 'moderate_general'),
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
'chat_access' => array(false, 'general', 'view_basic_info'),
'chat_mod' => array(false, 'general', 'view_basic_info'),
'shout_view' => array(false, 'general', 'view_basic_info'),
'shout_access' => array(false, 'general', 'view_basic_info'),
'shout_mod' => array(false, 'general', 'view_basic_info'),
file $sourcedir/ManageSettings.php
ค้นหา -->>
โค๊ด:
[Select]
// Mod authors, once again, if you have a whole section to add do it AFTER this line, and keep a comma at the end.
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
'chat' => 'ModifyAjaxChatModSettings',
ค้นหา -->>
โค๊ด:
[Select]
'description' => $txt['modification_settings_desc'],
'tabs' => array(
'general' => array(
),
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
'chat' => array(
'label' => $txt['chat'],
'description' => $txt['chat_settings_desc'],
),
ค้นหา -->>
โค๊ด:
[Select]
?>
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
function ModifyAjaxChatModSettings($return_config = false)
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;
$config_vars = array(
array('check', 'enableShoutBox'),
array('check', 'anyPageShoutBox'),
array('check', 'miniChat'),
array('check', 'chatPopUp'),
array('check', 'enableChatButtonNo'),
array('check', 'enableChatBelowPM'),
);
if ($return_config)
return $config_vars;
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=chat';
$context['settings_title'] = $txt['chat'];
// No removing this line you, dirty unwashed mod authors. :p
if (empty($config_vars))
{
$context['settings_save_dont_show'] = true;
$context['settings_message'] = '<div style="text-align: center">' . $txt['modification_no_misc_settings'] . '</div>';
return prepareDBSettingContext($config_vars);
}
// Saving?
if (isset($_GET['save']))
{
checkSession();
$save_vars = $config_vars;
saveDBSettings($save_vars);
redirectexit('action=admin;area=modsettings;sa=chat');
}
prepareDBSettingContext($config_vars);
}
file $boarddir/SSI.php
ค้นหา -->>
โค๊ด:
[Select]
?>
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
function ssi_chatOnline($output_method = 'echo')
{
global $smcFunc, $scripturl, $txt;
$users = array();
$userIDs = chatOnlineUsers();
$users['links'] = array();
if (count($userIDs) > 0){
if (count($userIDs) == 1){
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM
{db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER = {int:the_id}' ,
array(
'the_id' => $userIDs[0],
)
);
}else{
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM
{db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER IN ({array_int:the_ids})',
array(
'the_ids' => $userIDs,
)
);
}
while ($row =$smcFunc['db_fetch_assoc']($result))
{
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
if($row['online_color'] != ""){
$link.= '" style="color: ' . $row['online_color'];
}
$link.= '">' . $row['real_name'] . '</a>';
array_push($users['links'], $link);
}
$smcFunc['db_free_result']($result);
}
if ($output_method != 'echo')
return $users;
else{
if (count($users['links']) == 0 )
echo $txt['chat_no_user'];
elseif (count($users['links']) == 1 )
echo '1' . $txt['chat_aUser']. ':<br />', implode($users['links']);
else
echo count($users['links']). $txt['chat_users']. ':<br />', implode(', ', $users['links']);
}
}
file $sourcedir/Subs.php
ค้นหา -->>
โค๊ด:
[Select]
$context['allow_pm'] = allowedTo('pm_read');
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
$num = empty($modSettings['enableChatButtonNo']) ? 0 : count(chatOnlineUsers());
$chatButton = 'Chat';
$chatButton .= ($num > 0) ? ('('.$num.')') : '';
$chatLink = str_replace("index.php", "chat/index.php", $scripturl);
if (!empty($modSettings['chatPopUp']))
$chatLink .= '" onclick="openWindow(this.href);this.blur();return false;';
ค้นหา -->>
โค๊ด:
[Select]
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
'is_last' => true,
),
),
),
เพิ่มไว้หลัง -->>
โค๊ด:
[Select]
'chat' => array(
'title' => $chatButton,
'href' => $chatLink,
'show' => true,
'sub_buttons' => array(
),
),
file $themedir/BoardIndex.template.php
ค้นหา -->>
โค๊ด:
[Select]
echo '
</p>
<p class="last smalltext">
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
// users in chat
if (isset($context['chat_links'])){
if (count($context['chat_links']) == 0 )
echo '<br />' . $txt['chat_no_user'];
elseif (count($context['chat_links']) == 1 )
echo '<br /> 1' . $txt['chat_aUser']. ':<br />', implode($context['chat_links']);
else
echo '<br /> ' . count($context['chat_links']). $txt['chat_users']. ':<br />', implode(', ', $context['chat_links']);
}
file $themedir/index.template.php
ค้นหา -->>
โค๊ด:
[Select]
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
แก้เป็น -->>
โค๊ด:
[Select]
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
ค้นหา -->>
โค๊ด:
[Select]
echo '
<li>', $context['current_time'], '</li>
</ul>';
เพิ่มไว้ก่อน -->>
โค๊ด:
[Select]
if (!empty($modSettings['enableChatBelowPM'])){
$count = count(chatOnlineUsers());
if ($count == 0 )
echo '<li>' . $txt['chat_no_user'] . '</li>';
elseif ($count == 1 )
echo '<li>1' . $txt['chat_aUser'] . '</li>';
else
echo '<li> ' . $count . $txt['chat_users'] . '.</li>';
}
file $languagedir/Help.thai-utf8.php
เพิ่ม -->>
โค๊ด:
[Select]
//Begin AjaxChat Integration
$helptxt['enableShoutBox'] = 'This enables the ajaxchat shoutbox on your index page.';
$helptxt['enableChatButtonNo'] = 'This shows number of chating users on chat button.';
$helptxt['enableChatBelowPM'] = 'This shows online chat users below total time logged in section.';
$helptxt['anyPageShoutBox'] = 'If you enable this ShoutBox will shown in all your forum pages but if disabled ShoutBox will shown only in index page.';
$helptxt['chatPopUp'] = 'If enabled when clicking on chat button chat will loads a new popup page.';
$helptxt['miniChat'] = 'If enabled shoutBox and chat became same thing and users can chat in every page';
//End AjaxChat Integration
ดาวน์โหลด:
AjaxChat.rar
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน
เงื่อนไขการใช้งาน DexMore.Com
แตกไฟล์แล้วอัพโหลดไปไว้ที่
file Shout.template.php -->> $themedir
file Shout.english.php -->> $languagedir
file Shout.thai-utf8.php -->> $languagedir
file shoutbox.css -->> $themedir
folder chat -->> $boarddir
folder shoutBox -->> $boarddir
สร้างไฟล์:
Tables_2.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/Tables_2.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด:
[Select]
<?php
if(
file_exists
(
dirname
(
__FILE__
) .
'/SSI.php'
) && !
defined
(
'SMF'
))
require_once(
dirname
(
__FILE__
) .
'/SSI.php'
);
else if(!
defined
(
'SMF'
))
die(
'<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php and SSI.php files.'
);
if((
SMF
==
'SSI'
) && !
$user_info
[
'is_admin'
])
die(
'Admin priveleges required.'
);
//remove previous version's tabales
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_chat_online'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_chat_messages'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_chat_bans'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_chat_invitations'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_shout_online'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_shout_messages'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_shout_bans'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS ajax_shout_invitations'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxchat_online'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxchat_messages'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxchat_bans'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxchat_invitations'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxchat_online (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxchat_messages (
id INT(11) NOT NULL AUTO_INCREMENT,
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime TIMESTAMP NOT NULL,
ip VARBINARY(16) NOT NULL,
text TEXT,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxchat_bans (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxchat_invitations (
userID INT(11) NOT NULL,
channel INT(11) NOT NULL,
dateTime TIMESTAMP NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxshout_online'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxshout_messages'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxshout_bans'
, array());
$smcFunc
[
'db_query'
](
''
,
'DROP TABLE IF EXISTS {db_prefix}ajaxshout_invitations'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxshout_online (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxshout_messages (
id INT(11) NOT NULL AUTO_INCREMENT,
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
userRole INT(1) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL,
text TEXT,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxshout_bans (
userID INT(11) NOT NULL,
userName VARCHAR(64) NOT NULL,
dateTime DATETIME NOT NULL,
ip VARBINARY(16) NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
$smcFunc
[
'db_query'
](
''
,
'CREATE TABLE {db_prefix}ajaxshout_invitations (
userID INT(11) NOT NULL,
channel INT(11) NOT NULL,
dateTime DATETIME NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin'
, array());
if(
SMF
==
'SSI'
)
echo
'Database changes are complete!'
;
?>
ลิงค์หัวข้อ
:
http://dexmore.com/topic/2076
ghonee
บันทึกการเข้า
หน้า:
1
-:-DexMoreGroup แหล่งมั่วสุมทางปัญญา-:-
Web Achieve
Simple Machines Forum
SMF Modifications
AjaxChat Integration ห้องสนทนาแบบ Ajax สำหรับ SMF
กระโดดไป:
เลือกหัวข้อ:
-----------------------------
Specialty
-----------------------------
=> เทิดพระเกียรติฯ
-----------------------------
Living room
-----------------------------
=> ห้องรับแขก
=> ประชาสัมพันธ์
-----------------------------
Web Achieve
-----------------------------
=> Web Basis
===> Cascading Style Sheet
=> Simple Machines Forum
===> SMF Modifications
===> SMF Thai Translation
=> CMS Joomla
===> Extention
=> Drupal
=> WordPress [WP]
=> jQuery Plugin
=> Web Graphics
-----------------------------
Tip Computer
-----------------------------
=> โปรแกรมคอมพิวเตอร์
=> ทริบเทคนิคการดูแล
=> ปัญหาคอมพิวเตอร์
=> Themes-Wallpaper
=> ข่าวสารวงการ IT
-----------------------------
Game Computer
-----------------------------
=> Game-Flash
=> Game-News
=> Game-Download
=> Game-Mobile
-----------------------------
Variety Talk
-----------------------------
=> สัพเพเหระ
=> เก็บของเก่า
=> เล่าความหลัง
=> คำคม-คำคน
=> มีรูปมาอวด
=> เมลดีดี
กำลังโหลด...