Home Webboard ArticlesKnowledges  

ผู้เขียน หัวข้อ: เพิ่มการอนุญาตการใช้แฟร็ซ สำหรับสมาชิกแต่ละกลุ่ม  (อ่าน 4313 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ 1

  • Just
  • **
  • กระทู้: 94
  • เห็นด้วย&ขอบคุณ: 15
mod http://custom.simplemachines.org/mods/index.php?mod=742

โมนี้สามารถเลือกเฉพาะกลุ่มที่เราอนุญาตให้ใช้ไฟล์แฟร็ซได้ ในบร์อด


/Sources/Display.php

ต้นหาโค๊ดนี้
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['is_guest'] = true;
}


วางโค๊ดนี้ทับที่ค้นหา
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['is_guest'] = true;
$memberContext[$message['ID_MEMBER']]['embendedFlash'] = false;
}



ค้นหาโค๊ดนี้
โค๊ด: [Select]
$message['body'] = parse_bbc($message['body'], $message['smileysEnabled'], $message['ID_MSG']);
วางโค๊ดนี้ทับที่ค้นหา
โค๊ด: [Select]
$message['body'] = parse_bbc($message['body'], $message['smileysEnabled'], $message['ID_MSG'], $memberContext[$message['ID_MEMBER']]['embendedFlash']);

/Sources/Subs.php

ค้นหาโค๊ดนี้
โค๊ด: [Select]
function parse_bbc($message, $smileys = true, $cache_id = '')
{

วางโค๊ดนี้ทับ
โค๊ด: [Select]
function parse_bbc($message, $smileys = true, $cache_id = '', $allowedToFlash = false)
{


ค้นหาโค๊ดนี้
โค๊ด: [Select]
$codes = null;
}

วางโค๊ดนี้ทับ
โค๊ด: [Select]
$codes = null;
}

//Flash enable for some Groups only ;)
if($allowedToFlash && empty($modSettings['enableEmbeddedFlash']) && empty($modSettings['disabledBBC'])) {
$disableFlash = 1;
$modSettings['enableEmbeddedFlash'] = 1;
unset($disabled['flash']);
}

ค้นหาโค๊ดนี้
โค๊ด: [Select]
// Cache the output if it took some time...
if (isset($cache_key, $cache_t) && array_sum(explode(' ', microtime())) - array_sum(explode(' ', $cache_t)) > 0.05)
cache_put_data($cache_key, $message, 240);

วางโค๊ดนี้ทับ
โค๊ด: [Select]
// Cache the output if it took some time...
if (isset($cache_key, $cache_t) && array_sum(explode(' ', microtime())) - array_sum(explode(' ', $cache_t)) > 0.05)
cache_put_data($cache_key, $message, 240);

if(isset($disableFlash) && empty($modSettings['disabledBBC'])) {
unset($disableFlash);
$modSettings['enableEmbeddedFlash'] = 0;
$disabled['flash'] = true;
}


/Sources/ManagePosts.php

ค้นหา
โค๊ด: [Select]
// Update the actual settings.
updateSettings(array(
'removeNestedQuotes' => empty($_POST['removeNestedQuotes']) ? '0' : '1',

วางโค๊ดนี้ทับ
โค๊ด: [Select]
//Allowed Groups ;)
if(!empty($_POST['allowedFlashGroups'])) {
$new_array = array();
foreach($_POST['allowedFlashGroups'] as $i) {
$i = (int) $i;
if(!empty($i))
$new_array[$i] = $i;
}
$_POST['allowedFlashGroups'] = implode(',', $new_array);
}
// Update the actual settings.
updateSettings(array(
'removeNestedQuotes' => empty($_POST['removeNestedQuotes']) ? '0' : '1',

ค้นหาโค๊ดนี้
โค๊ด: [Select]
'edit_disable_time' => empty($_POST['edit_disable_time']) ? '0' : (int) $_POST['edit_disable_time'],
วางโค๊ดนี้ทับ
โค๊ด: [Select]
'edit_disable_time' => empty($_POST['edit_disable_time']) ? '0' : (int) $_POST['edit_disable_time'],
'allowedFlashGroups' => empty($_POST['allowedFlashGroups']) ? '' : $_POST['allowedFlashGroups'],
'embededHtmlFlashConvert' => empty($_POST['embededHtmlFlashConvert']) ? '0' : '1',


ค้นหาโค๊ดนี้
โค๊ด: [Select]
// Check if your PHP is able to use spell checking.
$context['spellcheck_installed'] = function_exists('pspell_new');

วางโค๊ดนี้ทับ
โค๊ด: [Select]
//Load membergroups.
$request = db_query("
SELECT groupName, ID_GROUP, minPosts
FROM {$db_prefix}membergroups
ORDER BY minPosts, ID_GROUP != 1, ID_GROUP != 2, ID_GROUP != 3, groupName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$context['groups'][(int) $row['ID_GROUP']] = array(
'id' => $row['ID_GROUP'],
'name' => trim($row['groupName']),
'checked' => in_array($row['ID_GROUP'], explode(',', $modSettings['allowedFlashGroups'])),
'is_post_group' => $row['minPosts'] != -1,
);
}
mysql_free_result($request);
//Sorry for the lazyness... but it's easier...
loadLanguage('ManageBoards');

// Check if your PHP is able to use spell checking.
$context['spellcheck_installed'] = function_exists('pspell_new');

/Sources/Load.php

ค้นหา
โค๊ด: [Select]
$profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['ID_MEMBER']);

วางโค๊ดนี้ทับ
โค๊ด: [Select]
if(!isset($modSettings['allowedFlashGroups']))
$modSettings['allowedFlashGroups'] = array();
if(!is_array($modSettings['allowedFlashGroups']))
$modSettings['allowedFlashGroups'] = explode(',', $modSettings['allowedFlashGroups']);
$profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['ID_MEMBER'], in_array($profile['ID_GROUP'], $modSettings['allowedFlashGroups']));

ค้นหา
โค๊ด: [Select]
else
{
$avatar_width = '';
$avatar_height = '';
}

วางโค๊ดนี้ทับ
โค๊ด: [Select]
else
{
$avatar_width = '';
$avatar_height = '';
}

if(!empty($profile['ID_MEMBER']) && !empty($board_info['moderators']))
$is_mod = in_array($profile['ID_MEMBER'], array_keys($board_info['moderators']));
else
$is_mod = false;

ค้นหา
โค๊ด: [Select]
'signature' => &$profile['signature'],
'location' => &$profile['location'],

วางโค๊ดนี้ทับ
โค๊ด: [Select]
'signature' => &$profile['signature'],
'embendedFlash' => in_array($profile['ID_GROUP'], $modSettings['allowedFlashGroups']) || in_array($profile['ID_POST_GROUP'], $modSettings['allowedFlashGroups']) || ($is_mod && in_array(3, $modSettings['allowedFlashGroups'])),
'location' => &$profile['location'],


/Sources/Subs-Post.php

ค้นหา
โค๊ด: [Select]
// Now let's quickly clean up things that will slow our parser (which are common in posted code.)
$message = strtr($message, array('[]' => '[]', '['' => '[''));


วางโค๊ดนี้ทับ
โค๊ด: [Select]
// Now let's quickly clean up things that will slow our parser (which are common in posted code.)
$message = strtr($message, array('[]' => '[]', '['' => '[''));

//Convert html flash into bbc flash
$message = convertFlashObjectHtml2BBC($message);

ค้นหา
โค๊ด: [Select]
?>
วางก่อนที่ค้นหา
โค๊ด: [Select]
//Find the way for the search :)
$html = strpos(strtolower($message), '<embed') !== false && strpos(strtolower($message), '</embed>') !== false;
$entities = strpos(strtolower($message), '&lt;embed') !== false && strpos(strtolower($message), '&lt;/embed&gt;') !== false;

if(!$html && !$entities)
return $message;

//Okay Let's see i need it nice and clean a little :X
$message = strtr($message, array('&lt;' => '<', '&gt;' => '>', '&quot;' => '"'));

//Before i start a will fix something ;)
$message = strtr($message, array('></' => '>#_#</'));

//I need to split it in two steps... it's the only way... to make a little bit good xD
if(strpos(strtolower($message), '<object') !== false && strpos(strtolower($message), '</object>') !== false) {
  preg_match_all('~(<object.*?>)(.+?)</object>~eis', $message, $objecttags);
foreach($objecttags[0] as $object) {
//All information i need in there?
if(strpos(strtolower($object), 'width') === false || strpos(strtolower($object), 'height') === false || strpos(strtolower($object), 'src=') === false)
continue;

//Okay i need to do some work << ..oO(hug haga huga haga ;D)
preg_match_all('~(src=.*?[ >])~eis', $object, $src);
$src = substr(trim($src[0][0]), 4);

if(empty($src))
continue;

//Fix some things :x
$src = stripslashes($src);
if(substr($src, 0, 1) == '"')
$src = substr($src, 1);
if(substr($src, -1) == '>')
$src = substr($src, 0, -1);
if(substr($src, -1) == '"')
$src = substr($src, 0, -1);
if(substr($src, -1) == "\\")
$src = substr($src, 0, -1);

if(empty($src))
continue;

preg_match_all('~(width.*?[ >])~eis', $object, $width);
preg_match_all('~(height.*?[ >])~eis', $object, $height);

$width = $width[0][0];
preg_match_all('/(?:([0-9]+)|.)/i', $width, $matches);
$width = implode('', $matches[1]);
$width = (int) $width;
$width = empty($width) ? 320 : $width;

$height = $height[0][0];
preg_match_all('/(?:([0-9]+)|.)/i', $height, $matches);
$height = implode('', $matches[1]);
$height = (int) $height;
$height = empty($height) ? 240 : $height;

$replace = '[flash='.$width.','.$height.']'.$src.'[/flash]';

$message = str_replace($object, $replace, $message);
}
}

if(strpos(strtolower($message), '<embed') !== false && strpos(strtolower($message), '</embed>') !== false) {
  preg_match_all('~(<embed.*?>)(.+?)</embed>~eis', $message, $objecttags);
foreach($objecttags[0] as $object) {
//All information i need in there?
if(strpos(strtolower($object), 'width') === false || strpos(strtolower($object), 'height') === false || strpos(strtolower($object), 'src=') === false)
continue;

//Okay i need to do some work << ..oO(hug haga huga haga ;D) second time :x
preg_match_all('~(src=.*?[ >])~eis', $object, $src);
$src = substr(trim($src[0][0]), 4);

if(empty($src))
continue;

//Fix some things :x
$src = stripslashes($src);
if(substr($src, 0, 1) == '"')
$src = substr($src, 1);
if(substr($src, -1) == '>')
$src = substr($src, 0, -1);
if(substr($src, -1) == '"')
$src = substr($src, 0, -1);
if(substr($src, -1) == "\\")
$src = substr($src, 0, -1);

if(empty($src))
continue;

preg_match_all('~(width.*?[ >])~eis', $object, $width);
preg_match_all('~(height.*?[ >])~eis', $object, $height);

$width = $width[0][0];
preg_match_all('/(?:([0-9]+)|.)/i', $width, $matches);
$width = implode('', $matches[1]);
$width = (int) $width;
$width = empty($width) ? 320 : $width;

$height = $height[0][0];
preg_match_all('/(?:([0-9]+)|.)/i', $height, $matches);
$height = implode('', $matches[1]);
$height = (int) $height;
$height = empty($height) ? 240 : $height;

$replace = '[flash='.$width.','.$height.']'.$src.'[/flash]';

$message = str_replace($object, $replace, $message);
}
}

//Back to the roots ;)
$message = strtr($message, array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
$message = strtr($message, array('&lt;br /&gt;' => '<br />'));

//Before i start a will fix something ;)
$message = strtr($message, array('>#_#</' => '></', '#_##_#' => '', '#_#' => ''));

//Phewwww... i need to return it...
return $message;
}

/Sources/Post.php

ค้นหา
โค๊ด: [Select]
// Do all bulletin board code tags, with or without smileys.
$context['preview_message'] = parse_bbc($context['preview_message'], isset($_REQUEST['ns']) ? 0 : 1);

วางโค๊ดนี้ทับ

โค๊ด: [Select]
//Check if the user is allowed to preview a Flash :D
$allowedToUseFlash = false;
if(!$user_info['is_guest']) {
//Let's see if the user allowed to use embended Flash ;D
if(!isset($modSettings['allowedFlashGroups']))
$modSettings['allowedFlashGroups'] = array();
if(!is_array($modSettings['allowedFlashGroups']))
$modSettings['allowedFlashGroups'] = explode(',', $modSettings['allowedFlashGroups']);

$compare = array_intersect($modSettings['allowedFlashGroups'], $user_info['groups']);
$allowedToUseFlash = !empty($compare);
}

// Do all bulletin board code tags, with or without smileys.
$context['preview_message'] = parse_bbc($context['preview_message'], (isset($_REQUEST['ns']) ? 0 : 1), '', $allowedToUseFlash);



/Themes/default/Admin.template.php

ค้นหา
โค๊ด: [Select]
<td valign="top">
<input type="checkbox" name="enableEmbeddedFlash" id="enableEmbeddedFlash_check"', empty($modSettings['enableEmbeddedFlash']) ? '' : ' checked="checked"', ' class="check" />
</td>

วางทับ
โค๊ด: [Select]
<td valign="top">
<input type="checkbox" name="enableEmbeddedFlash" id="enableEmbeddedFlash_check"', empty($modSettings['enableEmbeddedFlash']) ? '' : ' checked="checked"', ' class="check" />
</td>
</tr><tr class="windowbg2">
<th width="50%" align="right" valign="top">
<label for="allowedFlashGroups_input" onclick="return openAllowedFlashGroupList();">', $txt['allowedFlashGroups'], '</lable> <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=enableEmbeddedFlash" onclick="return reqWin(this.href);">?</a>)</span>:
</th>
<td valign="top" align="left"><a href="#" onclick="return openAllowedFlashGroupList();">'.$txt['mboards_groups'].'</a><br />
<div id="allowedFlashGroupsList" style="display:block;">';

// 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="allowedFlashGroups[]" 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 '
<input type="checkbox" onclick="invertAll(this, this.form, \'allowedFlashGroups[]\');" /> <i>', $txt[737], '</i><br />
<br /></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
//This Skript is only for Opening and Closing the group select list
var allowedFlashGroupListStatus = false;

function openAllowedFlashGroupList() {
if(allowedFlashGroupListStatus) {
allowedFlashGroupListStatus = false;
document.getElementById("allowedFlashGroupsList").style.display = "block";
}
else {
allowedFlashGroupListStatus = true;
document.getElementById("allowedFlashGroupsList").style.display = "none";
}

return false;
}

window.onload=openAllowedFlashGroupList;
// ]]></script>

</td>
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="embededHtmlFlashConvert_check">', $txt['embededHtmlFlashConvert'], '</lable>:
<div class="smalltext" style="font-weight: normal;">', $txt['embededHtmlFlashConvert_info'], '</div>
</th>
<td valign="top">
<input type="checkbox" name="embededHtmlFlashConvert" id="embededHtmlFlashConvert_check"', empty($modSettings['embededHtmlFlashConvert']) ? '' : ' checked="checked"', ' class="check" />
</td>

Themes/default/languages/Admin.english.php

ค้นหา
โค๊ด: [Select]
?>
วางก่อนที่ค้นหา
โค๊ด: [Select]
//Allowed Groups for Flash Mod
$txt['allowedFlashGroups'] = 'Allowed Groups for embedded flash into posts and signature';
$txt['allowedFlashGroups_info'] = 'Seperate each GroupID with a ","';
$txt['embededHtmlFlashConvert'] = 'Convert embeded HTML Flash into a [flash][/flash] code.';
$txt['embededHtmlFlashConvert_info'] = 'Work only if you save or edit a message (Old ones will not be changed, and also the html code must be complete for this if something missing it will not work).';


Themes/default/languages/Admin.thai.php

ค้นหา
โค๊ด: [Select]
?>
วางก่อนที่ค้นหา
โค๊ด: [Select]
//Allowed Groups for Flash Mod
$txt['allowedFlashGroups'] = 'Allowed Groups for embedded flash into posts and signature';
$txt['allowedFlashGroups_info'] = 'Seperate each GroupID with a ","';
$txt['embededHtmlFlashConvert'] = 'Convert embeded HTML Flash into a [flash][/flash] code.';
$txt['embededHtmlFlashConvert_info'] = 'Work only if you save or edit a message (Old ones will not be changed, and also the html code must be complete for this if something missing it will not work).';

ดูดี ระวัง error :yaahoo:

ช่วยแปลไทยให้ด้วยนะครับ



 

Sitemap 1 2 3 4 5 6 
Back to top