mod phân quyền cho nhóm admins khác trong ACP
OG upgrade lên 2.x .
===================================
Mod này để cho Root admin phân quyền cho các nhóm admin khác được sử dụng những khu vực nào trong acp.
Here we go.
Pretty simple edits:
Đầu tiên phải vô acp chạy query này. (phpmyadmin cũng được)
SQL
ALTER TABLE ibf_groups ADD `g_acp_extra` VARCHAR(255) NOT NULL DEFAULT '';
Mở admin.php ra tìm
CODE
else if ($ibforums->input['act'] == 'csite')
{
require ROOT_PATH."sources/dynamiclite/ad_dynamiclite.php";
}
else
{
require ROOT_PATH."sources/admin/ad_".$choice[ $ibforums->input['act'] ][0].".php";
$choice[ $ibforums->input['act'] ][1] = 'ad_'.$choice[ $ibforums->input['act'] ][1];
$runme = new $choice[ $ibforums->input['act'] ][1];
$runme->auto_run();
}
Thay bằng
CODE
else if ($ibforums->input['act'] == 'csite')
{
require ROOT_PATH."sources/dynamiclite/ad_dynamiclite.php";
}
else
{
// Phan Quyen ACP Mod
global $PAGES, $CATS;
$DB->query("SELECT * FROM ibf_groups WHERE g_id='{$ibforums->member['mgroup']}'");
$mgroup = $DB->fetch_row();
if($ibforums->member['mgroup'] == $ibforums->vars['admin_group'])
{
require ROOT_PATH."sources/admin/ad_".$choice[ $ibforums->input['act'] ][0].".php";
$choice[ $ibforums->input['act'] ][1] = 'ad_'.$choice[ $ibforums->input['act'] ][1];
$runme = new $choice[ $ibforums->input['act'] ][1];
$runme->auto_run();
} else
if($mgroup['g_access_cp'] == '1' AND $ibforums->member['mgroup'] != $ibforums->vars['admin_group'])
{
// Grab the PAGES & CATS
$DB->query("SELECT g_acp_extra FROM ibf_groups WHERE g_id='{$ibforums->member['mgroup']}'");
$row = $DB->fetch_row();
$allow = explode("|", $row['g_acp_extra']);
foreach($CATS as $num => $name)
{
foreach($PAGES[$num] as $num2 => $num3)
{
foreach($num3 as $num4 =>$url)
{
if(substr_count($url, "act=" . $ibforums->input['act']) > 0)
{
$cat_code = intval($num);
}
}
}
}
if(in_array($cat_code, $allow) OR $ibforums->input['act'] == 'index')
{
require ROOT_PATH."sources/admin/ad_".$choice[ $ibforums->input['act'] ][0].".php";
$choice[ $ibforums->input['act'] ][1] = 'ad_'.$choice[ $ibforums->input['act'] ][1];
$runme = new $choice[ $ibforums->input['act'] ][1];
$runme->auto_run();
}else
{
$ibforums->admin->error("You do not have permission to view this section.<br />
If you feel you should, please contact a ROOT administrator.");
}
} else
{
print "You do not have permission to use this feature.Please check back with your root admin if you feel this is an error.";
exit();
}
// Phan Quyen ACP Mod End
}
Save & Upload
==============
Mở sources/ad_groups.php ra tìm
CODE
$ibforums->input['p_max'] = str_replace( ":", "", $ibforums->input['p_max'] );
$ibforums->input['p_width'] = str_replace( ":", "", $ibforums->input['p_width'] );
$ibforums->input['p_height'] = str_replace( ":", "", $ibforums->input['p_height'] );
$db_string = array(
'g_view_board' => $ibforums->input['g_view_board'],
'g_mem_info' => $ibforums->input['g_mem_info'],
'g_other_topics' => $ibforums->input['g_other_topics'],
Thay bằng
CODE
$ibforums->input['p_max'] = str_replace( ":", "", $ibforums->input['p_max'] );
$ibforums->input['p_width'] = str_replace( ":", "", $ibforums->input['p_width'] );
$ibforums->input['p_height'] = str_replace( ":", "", $ibforums->input['p_height'] );
// Mod Phan Quyen ACP
if(isset($ibforums->input['admin_cats']))
{
global $CATS;
foreach($CATS as $num => $name)
{
if(in_array($num, $ibforums->input['admin_cats']))
{
$g_acp_extra[( count($g_acp_extra) + 1 )] = intval($num);
}
}
$g_acp_extra = implode("|", $g_acp_extra);
}
// Mod Phan Quyen ACP End
$db_string = array(
'g_acp_extra' => $g_acp_extra,
'g_view_board' => $ibforums->input['g_view_board'],
'g_mem_info' => $ibforums->input['g_mem_info'],
'g_other_topics' => $ibforums->input['g_other_topics'],
Tìm tiếp
CODE
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can access the Admin CP?$guest_legend" ,
$ibforums->adskin->form_yes_no("g_access_cp", $group['g_access_cp'] )
) );
Thêm dzô bên dưới
CODE
// Mod Phan Quyen ACP
if($group['g_id'] != $ibforums->vars['admin_group'] AND $group['g_access_cp'] == '1')
{
global $CATS;
$DB->query("SELECT g_acp_extra FROM ibf_groups WHERE g_id='{$group['g_id']}'");
$row = $DB->fetch_row();
foreach($CATS as $num => $name)
{
$available_cats[( count($available_cats) + 1 )] = array( $num, $name[0]);
$cat_codes[$num] = intval($num);
$allow = explode("|", $row['g_acp_extra']);
if(in_array(intval($num), $allow))
{
$current_cats[( count($current_cats) + 1 )] = $num;
}
}
$ibforums->html .= $ibforums->adskin->add_td_row( array ("<b>Administrative Categories to Allow:</b><br />
No effect for ROOT admin group.",
$ibforums->adskin->form_multiselect("admin_cats[]", $available_cats, $current_cats, 8 ) ) );
}
// Mod Phan Quyen ACP End
Save & Upload
===========
Okie done. Xong rùi.
Sử dụng:
Ví dụ bạn có các nhóm sau
Admin (root)
Members
Guest
Validating
Banned
Thì khi hack mod này xong.. bạn sẽ ko thấy gì khác biệt hết... tại sao.. nếu đã là root mà muốn giới hạn thì rất khó. vì phải tính theo ID.. or second group or something.. vì vậy root là toàn quyền rùi.. nên khi edit nhóm root sẽ ko thấy gì hiện ra hết.. Các nhóm còn lại... vì ko có acp access nên cũng ko hiện ra nốt.
Muốn dùng nó ...bạn phải tạo ra 1 nhóm admin khác.. (non root )
ví dụ bây giờ là như vầy
Admin (root)
Admin2
Members
Guests
Validating
Banned
Xong rùi move những thành viên nào bạn muốn add vào nhóm mới này.. ví dụ như bây giờ OG muốn add Nothing vào nhóm Admin2 thì OG move him vào nhóm đó..
Xong Edit nhóm Admin2 này.. thì sẽ thấy cái khung của mod này hiện ra.. hỏi cho access những phần nào.. bạn cho phần nào thì chọn vô...
Phải có 2 điều kiện thì cái mod này nó mới show ra..
thứ nhất : Phải có acp access .. tức là vô acp được
thứ hai : Không phải root admins
Đọc kỹ kỹ xíu nha.. mod này hơi khó dùng 1 chúc nếu ko wen.