22 พฤษภาคม 2555, 15:39:26
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: View Only Boards ให้สมาชิกบางกลุ่มมองเห็นบอร์ดแต่เข้าไม่ได้  (อ่าน 1298 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
***



Thailand   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์Onizuka.Arm ArM_Onizuka
  • ชื่อ: View Only Boards
  • ผู้เขียน: Rudolf
  • นำเสนอโดย: อศูรดำ
  • ประเภท: Administrative
  • รองรับ: SMF 1.1.xx, 2.0.xx
  • ปรับปรุงล่าสุด: 21 มกราคม 2552
  • ต้นฉบับ: View Only Boards

รายละเอียด
      เหมาะสำหรับท่านที่ต้องการปิดข้อมูล ต้องการเปิดเผยเพียงบางส่วน หรือสร้างเงื่อนไขการเข้าชมสำหรับสมาชิกบางกลุ่ม

สำหรับ SMF 1.1.xx

แก้ไขไฟล์:

file $sourcedir/BoardIndex.php

ค้นหา -->>
โค๊ด: [Select]
$this_category[$row_board['ID_BOARD']] = array(
'new' => empty($row_board['isRead']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array(
'id' => $row_board['ID_BOARD'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$this_last_post = array(
'id' => $row_board['ID_MSG'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
// Set the last post in the parent board.
if (empty($row_board['ID_PARENT']) || ($isChild && !empty($row_board['posterTime']) && $this_category[$row_board['ID_PARENT']]['last_post']['timestamp'] < forum_time(true, $row_board['posterTime'])))

แก้เป็น -->>
โค๊ด: [Select]
// Set the last post in the parent board. //- View Only Boards MOD- modified condition
if (empty($row_board['ID_PARENT']) || ($isChild && !empty($row_board['posterTime']) && (!$this_last_post['protected'] || !empty($modSettings['vob_allowMessageIndexView'])) && $this_category[$row_board['ID_PARENT']]['last_post']['timestamp'] < forum_time(true, $row_board['posterTime'])))


file $sourcesdir/MessageIndex.php

ค้นหา -->>
โค๊ด: [Select]
$context['boards'][$row_board['ID_BOARD']] = array(
'id' => $row_board['ID_BOARD'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'last_post' => array(
'id' => $row_board['ID_MSG'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$context['boards'][$row['ID_PARENT']]['children'][$row['ID_BOARD']] = array(
'id' => $row['ID_BOARD'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$context['boards'][$row['ID_PARENT']]['last_post'] = array(
'id' => $row['ID_MSG'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-


file $sourcesdir/ManageBoards.php

ค้นหา -->>
โค๊ด: [Select]
// Change '1 & 2' to '1 &amp; 2', but not '&amp;' to '&amp;amp;'...

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start - prepare the view information to save
$boardOptions['access_groups_view'] = array();
if (!empty($_POST['groupsView']))
foreach ($_POST['groupsView'] as $group)
$boardOptions['access_groups_view'][] = (int) $group;
//-View Only Boards MOD- End

ค้นหา -->>
โค๊ด: [Select]
'memberGroups' => array(0, -1),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'memberGroupsView' => array(), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array('-1', $curBoard['memberGroups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array('-1', $curBoard['memberGroupsView']), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array('0', $curBoard['memberGroups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array('0', $curBoard['memberGroupsView']), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array($row['ID_GROUP'], $curBoard['memberGroups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array($row['ID_GROUP'], $curBoard['memberGroupsView']), //-View Only Boards MOD-


file $sourcesdir/Subs-Boards.php

ค้นหา -->>
โค๊ด: [Select]
// Who's allowed to access this board.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Who's allowed to view this board.
if (isset($boardOptions['access_groups_view']))
$boardUpdates[] = 'memberGroupsView = \'' . implode(',', $boardOptions['access_groups_view']) . '\'';

ค้นหา -->>
โค๊ด: [Select]
b.memberGroups,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
b.memberGroupsView,

ค้นหา -->>
โค๊ด: [Select]
// Getting all the board and category information you'd ever wanted.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- query modified

ค้นหา -->>
โค๊ด: [Select]
'memberGroups' => explode(',', $row['memberGroups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'memberGroupsView' => explode(',', $row['memberGroupsView']), //-View Only Boards MOD-


file $sourcesdir/Load.php

ค้นหา -->>
โค๊ด: [Select]
b.memberGroups,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
b.memberGroupsView,

ค้นหา -->>
โค๊ด: [Select]
AND t.ID_TOPIC = $topic"), __FILE__, __LINE__);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
//-View Only Boards MOD- query modified

ค้นหา -->>
โค๊ด: [Select]
$board_info['groups'] = $row['memberGroups'] == '' ? array() : explode(',', $row['memberGroups']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$board_info['groups_view'] = $row['memberGroupsView'] == '' ? array() : explode(',', $row['memberGroupsView']);//-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
$board_info['error'] = 'access';

แก้เป็น -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
if (!empty($topic) || isset($_REQUEST['action']))
$board_info['error'] = 'access';
elseif (count(array_intersect($user_info['groups'], $board_info['groups_view'])) == 0 || empty($modSettings['vob_allowMessageIndexView']))
$board_info['error'] = 'access';
//-View Only Boards MOD- End

ค้นหา -->>
โค๊ด: [Select]
}

// Check for moderators and see if they have access to the board.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
$user_info['view_only_boards'] = array();

$result = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards as b
WHERE (FIND_IN_SET(" . implode(', b.memberGroupsView) OR FIND_IN_SET(', $user_info['groups']) . ', b.memberGroupsView)) AND NOT ' . $user_info['query_see_board'],__FILE__,__LINE__);

while ($row = mysql_fetch_row($result))
$user_info['view_only_boards'][] = $row[0];

$query_see_board = $user_info['query_see_board'];
if ($user_info['query_see_board'] != '1' && (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('recent','profile'))))
if (!$user_info['is_guest'])
$user_info['query_see_board'] =  substr($query_see_board,0,-1) . ' OR FIND_IN_SET(\'' . implode('\', b.memberGroupsView) OR FIND_IN_SET(\'', $user_info['groups']) . '\', b.memberGroupsView))';
else
$user_info['query_see_board'] =  '(' . $query_see_board . ' OR FIND_IN_SET(-1, b.memberGroupsView))';
//-View Only Boards MOD- End


file $sourcesdir/Recent.php

ค้นหา -->>
โค๊ด: [Select]
// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],

แก้เป็น -->>
โค๊ด: [Select]
//- View Only Boards MOD- START
// Do not show protected topics
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['ID_BOARD'],$user_info['view_only_boards']))
continue;
//- View Only Boards MOD- END

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'protected' => in_array($row['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
// And build the array.
$context['topics'][$row['ID_TOPIC']] = array(

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//- View Only Boards MOD- START
// Do not show protected topics
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['ID_BOARD'],$user_info['view_only_boards']))
continue;
//- View Only Boards MOD- END

ค้นหา -->>
โค๊ด: [Select]
'views' => $row['numViews'],
'board' => array(
'id' => $row['ID_BOARD'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row['ID_BOARD'],$user_info['view_only_boards']), //- View Only Boards MOD-


file $sourcesdir/ModSettings.php

ค้นหา -->>
โค๊ด: [Select]
array('check', 'allow_guestAccess'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
array('check', 'vob_allowMessageIndexView'), //-View Only Boards MOD-


file $themesdir/BoardIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']) , '<br />
', $txt['smf88'], ' ', ( $board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link'] ), '<br />
', $txt[30], ' ', $board['last_post']['time'];

ค้นหา -->>
โค๊ด: [Select]
foreach ($category['boards'] as $board)
{
echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($category['boards'] as $board)
{
echo '
<tr ' , $board['protected'] ? 'style="vob_protected"' : '' , '>

ค้นหา -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];

แก้เป็น -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : $child['link'];

ค้นหา -->>
โค๊ด: [Select]
<b><a href="', $scripturl, '?action=recent">', $txt[214], '</a></b>
<div class="smalltext">

แก้เป็น -->>
โค๊ด: [Select]
<b><a href="', $scripturl, '?action=recent">', $txt[214], '</a></b>
<div class="smalltext', $context['latest_post']['protected'] ? ' vob_protected' : '' ,'">

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['latest_posts'] as $post)
echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['latest_posts'] as $post)
echo '
<tr ' , $post['board']['protected'] ? 'class="vob_protected"' : '' , '>


file $themesdir/MessageIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['boards'] as $board)
{
echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['boards'] as $board)
{
echo '
<tr ' , $board['protected'] ? 'style="vob_protected"' : '' , '>

ค้นหา -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b> ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']) , '<br />
', $txt['smf88'], ' ', ( $board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link'] ), '<br />
', $txt[30], ' ', $board['last_post']['time'];

ค้นหา -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];

แก้เป็น -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : $child['link'];


file $themesdir/Recent.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['topics'] as $topic)
{
// Do we want to seperate the sticky and lock status out?
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['topics'] as $topic)
{
// Do we want to seperate the sticky and lock status out?
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

echo '
<tr ', $topic['board']['protected'] ? 'class="vob_protected"' : '' ,'>


file $themesdir/ManageBoards.template.php

ค้นหา -->>
โค๊ด: [Select]
// List all the membergroups so the user can choose who may access this board.
foreach ($context['groups'] as $group)
echo '
<label for="groups_', $group['id'], '"><span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span> <input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' /></label><br />';
echo '
<i>', $txt[737], '</i> <input type="checkbox" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
<br />
</td>
</tr>';

แก้เป็น -->>
โค๊ด: [Select]
//-View Only Boards MOD- echo in foreach modified to show additional checkbox
// List all the membergroups so the user can choose who may access this board.
foreach ($context['groups'] as $group)
echo '
<label for="groups_', $group['id'], '"><span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span> <input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' /></label> <input type="checkbox" name="groupsView[]" value="', $group['id'], '" id="groupsView_', $group['id'], '"', $group['view'] ? ' checked="checked"' : '', ' /><br />';
echo '
<i>', $txt[737], '</i> <input type="checkbox" onclick="invertAll(this, this.form, \'groups[]\');" /> <input type="checkbox" onclick="invertAll(this, this.form, \'groupsView[]\');" /><br />
<br />
</td>
</tr>';

file $themesdir/style.css

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
/* //-View Only Boards MOD- START */
/* You can customize here the appearence of the protected areas */
.vob_protected
{
cursor: default;
}

.vob_protected, .vob_protected a:link, .vob_protected a:visited, .vob_protected a:hover
{
color: #666;
color: red;
text-decoration: none;
cursor: default;
}
/* //-View Only Boards MOD- END */


file $languagesdir/Modifications.thai-utf8.php

เพิ่ม -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
$txt['vob_allowMessageIndexView'] = 'แสดงข้อความปกติแทนข้อความป้องกัน';
$txt['vob_protected'] = 'ป้องกัน';
//-View Only Boards MOD- End

สร้างไฟล์: DB.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/DB.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด: [Select]
<?php
/***********************************************************************
View Only Boards MOD - version 1.2
This file makes the necessary changes in the database.
***********************************************************************/
if (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

//create the column and index if not exists
$result db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'memberGroupsView'",__FILE__,__LINE__);
if (!
mysql_num_rows($result))
{
$result db_query("ALTER IGNORE TABLE {$db_prefix}boards ADD column memberGroupsView TINYTEXT NULL AFTER memberGroups",__FILE__,__LINE__);
$result db_query("ALTER IGNORE TABLE {$db_prefix}boards ADD INDEX memberGroupsView (memberGroupsView(48))",__FILE__,__LINE__);
}

//Rename a settings variable
db_query("
UPDATE IGNORE {$db_prefix}settings
SET variable='vob_allowMessageIndexView'
WHERE variable='cbv_allowMessageIndexView'
LIMIT 1"
,__FILE__,__LINE__);
?>

การตั้งค่า: ผู้ดูแล --> แก้ไขบอร์ด --> แก้ไข


ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows Vista    Safari   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 25 กรกฎาคม 2553, 00:00:05
สำหรับ SMF 2.0.xx

แก้ไขไฟล์:

file $sourcedir/Subs-BoardIndex.php

ค้นหา -->>
โค๊ด: [Select]
$this_category[$row_board['id_board']] = array(
'new' => empty($row_board['is_read']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['id_board'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$this_category[$row_board['id_parent']]['children'][$row_board['id_board']] = array(
'id' => $row_board['id_board'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['id_board'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
$this_last_post = array(
'id' => $row_board['id_msg'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row_board['id_board'],$user_info['view_only_boards']), //- View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
// Set the last post in the parent board.
if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))

แก้เป็น -->>
โค๊ด: [Select]
// Set the last post in the parent board. //- View Only Boards MOD- modified condition
if (empty($row_board['id_parent']) || ($isChild && !empty($row_board['poster_time']) && (!$this_last_post['protected'] || !empty($modSettings['vob_allowMessageIndexView'])) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))

file $sourcedir/ManageBoards.php

ค้นหา -->>
โค๊ด: [Select]
// Change '1 & 2' to '1 &amp; 2', but not '&amp;' to '&amp;amp;'...

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start - prepare the view information to save
$boardOptions['access_groups_view'] = array();
if (!empty($_POST['groupsView']))
foreach ($_POST['groupsView'] as $group)
$boardOptions['access_groups_view'][] = (int) $group;
//-View Only Boards MOD- End


ค้นหา -->>
โค๊ด: [Select]
'member_groups' => array(0, -1),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'member_groups_view' => array(), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array('-1', $curBoard['member_groups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array('-1', $curBoard['member_groups_view']), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array('0', $curBoard['member_groups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array('0', $curBoard['member_groups_view']), //-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
'checked' => in_array($row['id_group'], $curBoard['member_groups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'view' => in_array($row['id_group'], $curBoard['member_groups_view']), //-View Only Boards MOD-

file $sourcedir/Subs-Boards.php

ค้นหา -->>
โค๊ด: [Select]
// Who's allowed to access this board.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Who's allowed to view this board.
if (isset($boardOptions['access_groups_view']))
$boardUpdates[] = 'member_groups_view = \'' . implode(',', $boardOptions['access_groups_view']) . '\'';


ค้นหา -->>
โค๊ด: [Select]
b.member_groups,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
b.member_groups_view,

ค้นหา -->>
โค๊ด: [Select]
// Getting all the board and category information you'd ever wanted.

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
//-View Only Boards MOD- query modified

ค้นหา -->>
โค๊ด: [Select]
'member_groups' => explode(',', $row['member_groups']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'member_groups_view' => explode(',', $row['member_groups_view']), //-View Only Boards MOD-

file $sourcedir/Load.php

ค้นหา -->>
โค๊ด: [Select]
b.member_groups,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
b.member_groups_view,

ค้นหา -->>
โค๊ด: [Select]
$board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$board_info['groups_view'] = $row['member_groups_view'] == '' ? array() : explode(',', $row['member_groups_view']);//-View Only Boards MOD-

ค้นหา -->>
โค๊ด: [Select]
if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
$board_info['error'] = 'access';

แก้เป็น -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
if (!empty($topic) || isset($_REQUEST['action']))
$board_info['error'] = 'access';
elseif (count(array_intersect($user_info['groups'], $board_info['groups_view'])) == 0 || empty($modSettings['vob_allowMessageIndexView']))
$board_info['error'] = 'access';
//-View Only Boards MOD- End

ค้นหา -->>
โค๊ด: [Select]
// Load the mod cache so we can know what additional boards they should see, but no sense in doing it for admins and guests

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
$user_info['view_only_boards'] = array();

$result = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards as b
WHERE (FIND_IN_SET(' . implode(', b.member_groups_view) OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups_view)) AND NOT ' . $user_info['query_see_board']
);

while ($row = $smcFunc['db_fetch_row']($result))
$user_info['view_only_boards'][] = $row[0];

$query_see_board = $user_info['query_see_board'];
if ($user_info['query_see_board'] != '1=1' && (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('recent','profile','.xml','search','search2'))))
if (!$user_info['is_guest'])
$user_info['query_see_board'] =  substr($query_see_board,0,-1) . ' OR FIND_IN_SET(\'' . implode('\', b.member_groups_view) OR FIND_IN_SET(\'', $user_info['groups']) . '\', b.member_groups_view))';
else
$user_info['query_see_board'] =  '(' . $query_see_board . ' OR FIND_IN_SET(-1, b.member_groups_view))';
//-View Only Boards MOD- End


file $sourcedir/Subs-Recent.php

ค้นหา -->>
โค๊ด: [Select]
'id' => $row['id_board'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($post['board'], $user_info['view_only_boards']), //- View Only Boards MOD-

file $sourcedir/Recent.php

ค้นหา -->>
โค๊ด: [Select]
// Censor everything.
censorText($row['body']);
censorText($row['subject']);

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//- View Only Boards MOD- START
// Do not show protected topics
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['id_board'],$user_info['view_only_boards']))
continue;
//- View Only Boards MOD- END


ค้นหา -->>
โค๊ด: [Select]
if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0')
continue;

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
//- View Only Boards MOD- START
// Do not show protected topics
if (empty($modSettings['vob_allowMessageIndexView']) && in_array($row['id_board'],$user_info['view_only_boards']))
continue;
//- View Only Boards MOD- END


ค้นหา -->>
โค๊ด: [Select]
'views' => $row['num_views'],
'board' => array(
'id' => $row['id_board'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'protected' => in_array($row['id_board'],$user_info['view_only_boards']), //- View Only Boards MOD-

file $sourcedir/ManageSettings.php

ค้นหา -->>
โค๊ด: [Select]
array('check', 'allow_guestAccess'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
array('check', 'vob_allowMessageIndexView'), //-View Only Boards MOD-

file $themedir/BoardIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'];

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']) , '<br />
', $txt['in'], ' ', ( $board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link'] ), '<br />
', $txt['on'], ' ', $board['last_post']['time'];

ค้นหา -->>
โค๊ด: [Select]
foreach ($category['boards'] as $board)
{
echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($category['boards'] as $board)
{
echo '
<tr ' , $board['protected'] ? 'style="vob_protected"' : '' , '>

ค้นหา -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];

แก้เป็น -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : $child['link'];

ค้นหา -->>
โค๊ด: [Select]
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="smalltext">

แก้เป็น -->>
โค๊ด: [Select]
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="smalltext', $context['latest_post']['protected'] ? ' vob_protected' : '' ,'">

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['latest_posts'] as $post)
echo '
<dt>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['latest_posts'] as $post)
echo '
<dt ' , $post['board']['protected'] ? 'class="vob_protected"' : '' , '>

file $themedir/MessageIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['boards'] as $board)
{
echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['boards'] as $board)
{
echo '
<tr ' , $board['protected'] ? 'style="vob_protected"' : '' , '>

ค้นหา -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'];

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($board['last_post']['id']))
echo '
<strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', ($board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['member']['link']) . '</span>' : $board['last_post']['member']['link']) , '<br />
', $txt['in'], ' ', ( $board['last_post']['protected'] ? '<span class="vob_protected">' . (empty($modSettings['vob_allowMessageIndexView']) ? $txt['vob_protected'] : $board['last_post']['link']) . '</span>' : $board['last_post']['link'] ), '<br />
', $txt['on'], ' ', $board['last_post']['time'];

ค้นหา -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<b>' . $child['link'] . '</strong>' : $child['link'];

แก้เป็น -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : $child['link'];

ค้นหา -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];

แก้เป็น -->>
โค๊ด: [Select]
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['protected'] ? '<span class="vob_protected">' . $child['link'] . '</span>' : $child['link'];

file $themedir/Recent.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['topics'] as $topic)
{
// Do we want to separate the sticky and lock status out?
if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

echo '
<tr>

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['topics'] as $topic)
{
// Do we want to separate the sticky and lock status out?
if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['separate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

echo '
<tr ', $topic['board']['protected'] ? 'class="vob_protected"' : '' ,'>

file $themedir/ManageBoards.template.php

ค้นหา -->>
โค๊ด: [Select]
// List all the membergroups so the user can choose who may access this board.
foreach ($context['groups'] as $group)
echo '
<label for="groups_', $group['id'], '"><input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' /><span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span></label><br />';
echo '
<i>', $txt['check_all'], '</i> <input type="checkbox" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
<br />
</td>
</tr>';

แก้เป็น -->>
โค๊ด: [Select]
//-View Only Boards MOD- echo in foreach modified to show additional checkbox
// List all the membergroups so the user can choose who may access this board.
foreach ($context['groups'] as $group)
echo '
<input type="checkbox" name="groups[]" value="', $group['id'], '" id="groups_', $group['id'], '"', $group['checked'] ? ' checked="checked"' : '', ' /> <input type="checkbox" name="groupsView[]" value="', $group['id'], '" id="groupsView_', $group['id'], '"', $group['view'] ? ' checked="checked"' : '', ' /> <label for="groups_', $group['id'], '"><span', $group['is_post_group'] ? ' style="border-bottom: 1px dotted;" title="' . $txt['mboards_groups_post_group'] . '"' : '', '>', $group['name'], '</span></label><br />';
echo '
<i>', $txt['check_all'], '</i> <input type="checkbox" onclick="invertAll(this, this.form, \'groups[]\');" /><br />
<br />
</td>
</tr>';

file $themedir/css/index.css

เพิ่ม -->>
โค๊ด: [Select]
/* //-View Only Boards MOD- START */
/* You can customize here the appearence of the protected areas */
.vob_protected
{
cursor: default;
}

.vob_protected, .vob_protected a:link, .vob_protected a:visited, .vob_protected a:hover
{
color: #666;
color: red;
text-decoration: none;
cursor: default;
}
/* //-View Only Boards MOD- END */

file $themedir/languages/Modifications.thai-utf8.php

เพิ่ม -->>
โค๊ด: [Select]
//-View Only Boards MOD- Start
$txt['vob_allowMessageIndexView'] = 'แสดงข้อความปกติแทนข้อความป้องกัน';
$txt['vob_protected'] = 'ป้องกัน';
//-View Only Boards MOD- End

สร้างไฟล์: DB_2_x.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/DB_2_x.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด: [Select]
<?php
/***********************************************************************
View Only Boards MOD - version 1.2
This file makes the necessary changes in the database.
***********************************************************************/
if (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

vob_install();

// Used to avoid collision with variables in the global scope...
function vob_install()
{
global $smcFunc;

db_extend('packages');

$table_columns $smcFunc['db_list_columns']('boards');

// The column exists so there's nothing to do here ...
if (in_array('member_groups_view'$table_columns))
return;

$vob_column = array(
'name' => 'member_groups_view',
'type' => 'varchar',
'size' => 255,
);

// Are we upgrading from smf 1.x?
if (in_array('memberGroupsView'$table_columns))
return $smcFunc['db_change_column']('boards''memberGroupsView'$vob_column);

// Add the column the new column
return $smcFunc['db_add_column']('boards'$vob_columnnull'skip_if_exists');
}
?>

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 3.6.8   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
***



Thailand   ชาย ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 2 เมื่อ: 31 สิงหาคม 2554, 19:06:46
DB.php  รันแล้วครับผมแต่ไม่เกิดผลเลยครับผม จะแก้ปัญหาอย่างไรได้บ้างครับผม

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 3.6.13   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 1 กันยายน 2554, 14:01:08
ก็แทรกฟิลด์ memberGroupsView ชนิด varchar ความยาว 255 เข้าไปในตาราง _boards

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 6.0.1   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 4 เมื่อ: 25 ธันวาคม 2554, 19:20:30
แก้ไขที่ไฟล์ไหนดีครับ พอรันแล้วกดรีเฟชรที่บอร์ด

Unknown column 'b.memberGroupsView' in 'where clause'

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 5 เมื่อ: 25 ธันวาคม 2554, 19:40:13
คำตอบมันอยู่ก่อนกระทู้ที่คุณถามนั่นครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 9.0.1   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 6 เมื่อ: 26 ธันวาคม 2554, 17:11:50
จากภาพ ใช้ตรงนี้เปล่าครับ แล้วผมต้องตั้งค่ายังไงครับ



ลิงค์หัวข้อ: http://dexmore.com/topic/1941
« แก้ไขครั้งสุดท้าย: 26 ธันวาคม 2554, 17:14:21 โดย asia » Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 7 เมื่อ: 26 ธันวาคม 2554, 18:46:20
ดูกระทู้นี้ครับ การแทรก เพิ่มตาราง และฟิลด์ใน phpMyadmin ของ mod SMF

mod นี้คุณต้องเพิ่มฟิลด์ในตาราง _boards ครับ ไม่ใช่แทรก

ลิงค์หัวข้อ: http://dexmore.com/topic/1941
Windows XP    Firefox 9.0.1   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 16 พฤษภาคม 2555, 20:10:57

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla