mirror of
https://github.com/e107inc/e107.git
synced 2025-04-13 09:01:59 +02:00
added "Make Admin" to 'Quick Add User" and cleaned up administrator routines.
This commit is contained in:
parent
f8b49748d5
commit
2c9190de6b
11
class2.php
11
class2.php
@ -9,8 +9,8 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.154 $
|
||||
* $Date: 2009-11-11 16:02:36 $
|
||||
* $Revision: 1.155 $
|
||||
* $Date: 2009-11-12 01:53:15 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -1891,7 +1891,12 @@ function class_list($uid = '')
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
//DEPRECATED - use e107::includeLan();
|
||||
/**
|
||||
* DEPRECATED - use e107::includeLan();
|
||||
* @param object $path
|
||||
* @param object $force [optional]
|
||||
* @return
|
||||
*/
|
||||
function include_lan($path, $force = false)
|
||||
{
|
||||
return e107::includeLan($path, $force);
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Administrators Management
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/administrator.php,v $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 2009-09-27 21:24:02 $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 2009-11-12 01:53:16 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -135,9 +135,16 @@ else
|
||||
|
||||
function show_admins()
|
||||
{
|
||||
global $sql, $emessage, $e107, $frm;
|
||||
|
||||
$sql = e107::getDb();
|
||||
$frm = e107::getForm();
|
||||
$ns = e107::getRender();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
|
||||
require_once(e_HANDLER."user_handler.php");
|
||||
$prm = new e_userperms;
|
||||
|
||||
|
||||
$sql->db_Select("user", "*", "user_admin='1'");
|
||||
|
||||
$text = "
|
||||
@ -171,7 +178,7 @@ function show_admins()
|
||||
<td>".$row['user_id']."</td>
|
||||
<td><a href='".$e107->url->getUrl('core:user', 'main', "func=profile&id={$row['user_id']}")."'>".$row['user_name']."</a></td>
|
||||
<td>
|
||||
".renderperms($row['user_perms'],$row['user_id'],"words")."
|
||||
".$prm->renderperms($row['user_perms'],$row['user_id'],"words")."
|
||||
</td>
|
||||
<td class='center'>
|
||||
";
|
||||
@ -198,13 +205,19 @@ function show_admins()
|
||||
</form>
|
||||
|
||||
";
|
||||
$e107->ns->tablerender(ADMSLAN_13, $emessage->render().$text);
|
||||
$ns->tablerender(ADMSLAN_13, $mes->render().$text);
|
||||
}
|
||||
|
||||
function edit_administrator($row)
|
||||
{
|
||||
global $sql, $e107, $pref, $frm;
|
||||
global $pref;
|
||||
$lanlist = explode(",",e_LANLIST);
|
||||
require_once(e_HANDLER."user_handler.php");
|
||||
$prm = new e_userperms;
|
||||
$ns = e107::getRender();
|
||||
$sql = e107::getDb();
|
||||
$frm = e107::getForm();
|
||||
|
||||
|
||||
$a_id = $row['user_id'];
|
||||
$ad_name = $row['user_name'];
|
||||
@ -232,102 +245,26 @@ function edit_administrator($row)
|
||||
<td class='control'>
|
||||
|
||||
";
|
||||
//XXX Lan - General
|
||||
$text .= "
|
||||
<div class='field-section'>
|
||||
<h4>".ADMSLAN_74."</h4>
|
||||
";
|
||||
$text .= checkb("1", $a_perms, ADMSLAN_19); // Alter site preferences
|
||||
$text .= checkb("2", $a_perms, ADMSLAN_20); // Alter Menus
|
||||
$text .= checkb("3", $a_perms, ADMSLAN_21); // Modify administrator permissions
|
||||
$text .= checkb("4", $a_perms, ADMSLAN_22); // Moderate users/bans etc
|
||||
$text .= checkb("5", $a_perms, ADMSLAN_23); // create/edit custom pages
|
||||
$text .= checkb("J", $a_perms, ADMSLAN_41); // create/edit custom menus
|
||||
$text .= checkb("Q", $a_perms, ADMSLAN_24); // Manage download categories
|
||||
$text .= checkb("6", $a_perms, ADMSLAN_25); // Upload /manage files
|
||||
$text .= checkb("Y", $a_perms, ADMSLAN_67); // file inspector
|
||||
$text .= checkb("O", $a_perms, ADMSLAN_68); // notify
|
||||
$text .= checkb("7", $a_perms, ADMSLAN_26); // Oversee news categories
|
||||
// $text .= checkb("8", $a_perms, ADMSLAN_27); // Oversee link categories
|
||||
$text .= checkb("C", $a_perms, ADMSLAN_64); // Clear Cache - Previously moderate chatbox
|
||||
$text .= checkb("9", $a_perms, ADMSLAN_28); // Take site down for maintenance
|
||||
$text .= checkb("W", $a_perms, ADMSLAN_65); // Configure mail settings and mailout
|
||||
|
||||
$text .= checkb("D", $a_perms, ADMSLAN_29); // Manage banners
|
||||
// $text .= checkb("E", $a_perms, ADMSLAN_30); // Configure news feed headlines - now plugin
|
||||
$text .= checkb("F", $a_perms, ADMSLAN_31); // Configure emoticons
|
||||
$text .= checkb("G", $a_perms, ADMSLAN_32); // Configure front page content
|
||||
$text .= checkb("S", $a_perms, ADMSLAN_33); // Configure system logs (previously log/stats - now plugin)
|
||||
$text .= checkb("T", $a_perms, ADMSLAN_34); // Configure meta tags
|
||||
$text .= checkb("V", $a_perms, ADMSLAN_35); // Configure public file uploads
|
||||
$text .= checkb("X", $a_perms, ADMSLAN_66); // Configure Search
|
||||
$text .= checkb("A", $a_perms, ADMSLAN_36); // Configure Image Settings (Previously Moderate forums - NOW PLUGIN)
|
||||
$text .= checkb("B", $a_perms, ADMSLAN_37); // Moderate comments
|
||||
$text .= checkb("H", $a_perms, ADMSLAN_39); // Post news
|
||||
$text .= checkb("I", $a_perms, ADMSLAN_40); // Post links
|
||||
|
||||
// $text .= checkb("K", $a_perms, ADMSLAN_42); // Post reviews - NOW PLUGIN
|
||||
$text .= checkb("L", $a_perms, ADMSLAN_43); // Configure URLs
|
||||
$text .= checkb("R", $a_perms, ADMSLAN_44); // Post downloads
|
||||
$text .= checkb("U", $a_perms, ADMSLAN_45); // Schedule Tasks
|
||||
$text .= checkb("M", $a_perms, ADMSLAN_46); // Welcome message
|
||||
$text .= checkb("N", $a_perms, ADMSLAN_47); // Moderate submitted news
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
<div class='field-section'>
|
||||
<h4>".ADLAN_CL_7."</h4>";
|
||||
$text .= checkb("Z", $a_perms, ADMSLAN_62); // Plugin Manager
|
||||
|
||||
$sql->db_Select("plugin", "*", "plugin_installflag='1'");
|
||||
while ($row = $sql->db_Fetch())
|
||||
|
||||
$groupedList = $prm->getPermList('grouped');
|
||||
|
||||
foreach($groupedList as $section=>$list)
|
||||
{
|
||||
$text .= checkb("P".$row['plugin_id'], $a_perms, LAN_PLUGIN." - ".$e107->tp->toHTML($row['plugin_name'] ,FALSE , 'RAWTEXT,defs'));
|
||||
}
|
||||
$text .= "
|
||||
</div>";
|
||||
// Language Rights.. --------------
|
||||
if($pref['multilanguage'])
|
||||
{
|
||||
sort($lanlist);
|
||||
$text .= "
|
||||
<div class='field-section'>
|
||||
<h4>".ADLAN_132."</h4>";
|
||||
|
||||
$text .= checkb($pref['sitelanguage'], $a_perms, $pref['sitelanguage']);
|
||||
foreach($lanlist as $langval)
|
||||
$text .= "\t\t<div class='field-section'><h4>".$prm->renderSectionDiz($section)."</h4>"; //XXX Lan - General
|
||||
foreach($list as $key=>$diz)
|
||||
{
|
||||
//$langname = $langval;
|
||||
$langval = ($langval == $pref['sitelanguage']) ? "" : $langval;
|
||||
if ($langval)
|
||||
{
|
||||
$text .= checkb($langval, $a_perms, $langval);
|
||||
}
|
||||
$text .= $prm->checkb($key, $a_perms, $diz);
|
||||
}
|
||||
$text .= "
|
||||
</div>";
|
||||
}
|
||||
// -------------------------
|
||||
|
||||
if (getperms('0'))
|
||||
{
|
||||
$text .= "
|
||||
<div class='field-section'>
|
||||
<h4>".ADMSLAN_58."</h4>";
|
||||
$text .= checkb("0", $a_perms, ADMSLAN_58);
|
||||
$text .= "
|
||||
</div>";
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
<div class='field-section'>
|
||||
".$frm->admin_button('check_all', 'jstarget:perms', 'action', LAN_CHECKALL)."
|
||||
".$frm->admin_button('uncheck_all', 'jstarget:perms', 'action', LAN_UNCHECKALL)."
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
$text .= "<div class='field-section'>
|
||||
".$frm->admin_button('check_all', 'jstarget:perms', 'action', LAN_CHECKALL)."
|
||||
".$frm->admin_button('uncheck_all', 'jstarget:perms', 'action', LAN_UNCHECKALL)."
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
<input type='hidden' name='a_id' value='{$a_id}' />
|
||||
@ -338,7 +275,7 @@ function edit_administrator($row)
|
||||
</form>
|
||||
";
|
||||
|
||||
$e107->ns->tablerender(ADMSLAN_52, $text);
|
||||
$ns->tablerender(ADMSLAN_52, $text);
|
||||
}
|
||||
require_once("footer.php");
|
||||
|
||||
@ -346,113 +283,6 @@ require_once("footer.php");
|
||||
|
||||
|
||||
|
||||
|
||||
function checkb($arg, $perms, $label='')
|
||||
{
|
||||
global $frm;
|
||||
$par = "<div class='field-spacer'>";
|
||||
$par .= $frm->checkbox('perms[]', $arg, getperms($arg, $perms));
|
||||
if ($label)
|
||||
{
|
||||
$par .= $frm->label($label,'perms[]', $arg);
|
||||
}
|
||||
$par .= "</div>";
|
||||
|
||||
return $par;
|
||||
}
|
||||
|
||||
|
||||
function renderperms($perm, $id)
|
||||
{
|
||||
global $pref, $pt, $e107;
|
||||
if($perm == "0")
|
||||
{
|
||||
return ADMSLAN_58;
|
||||
}
|
||||
$sql2 = e107::getDb('sql2');
|
||||
$lanlist = explode(",",e_LANLIST);
|
||||
|
||||
|
||||
if(!$pt)
|
||||
{
|
||||
$pt["1"] = ADMSLAN_19;
|
||||
$pt["2"] = ADMSLAN_20;
|
||||
$pt["3"] = ADMSLAN_21;
|
||||
$pt["4"] = ADMSLAN_22; // Moderate users/bans etc
|
||||
$pt["5"] = ADMSLAN_23; // create/edit custom pages
|
||||
$pt["J"] = ADMSLAN_41; // create/edit custom menus
|
||||
|
||||
$pt["Q"] = ADMSLAN_24; // Manage download categories
|
||||
$pt["6"] = ADMSLAN_25; // Upload /manage files
|
||||
$pt["Y"] = ADMSLAN_67; // file inspector
|
||||
$pt["O"] = ADMSLAN_68; // notify
|
||||
$pt["7"] = ADMSLAN_26;
|
||||
$pt["8"] = ADMSLAN_27;
|
||||
$pt["C"] = ADMSLAN_64;
|
||||
$pt["9"] = ADMSLAN_28;
|
||||
$pt["W"] = ADMSLAN_65;
|
||||
$pt["D"] = ADMSLAN_29;
|
||||
$pt["E"] = ADMSLAN_30;
|
||||
$pt["F"] = ADMSLAN_31;
|
||||
$pt["G"] = ADMSLAN_32;
|
||||
$pt["S"] = ADMSLAN_33;
|
||||
$pt["T"] = ADMSLAN_34;
|
||||
$pt["V"] = ADMSLAN_35;
|
||||
$pt["X"] = ADMSLAN_66;
|
||||
$pt["A"] = ADMSLAN_36; // Configure Image Settings
|
||||
$pt["B"] = ADMSLAN_37;
|
||||
$pt["H"] = ADMSLAN_39;
|
||||
$pt["I"] = ADMSLAN_40;
|
||||
$pt["L"] = ADMSLAN_43;
|
||||
$pt["R"] = ADMSLAN_44;
|
||||
$pt["U"] = ADMSLAN_45;
|
||||
$pt["M"] = ADMSLAN_46;
|
||||
$pt["N"] = ADMSLAN_47;
|
||||
$pt["Z"] = ADMSLAN_62;
|
||||
|
||||
|
||||
$sql2->db_Select("plugin", "*", "plugin_installflag='1'");
|
||||
while ($row2 = $sql2->db_Fetch())
|
||||
{
|
||||
$pt[("P".$row2['plugin_id'])] = LAN_PLUGIN." - ".$e107->tp->toHTML($row2['plugin_name'], FALSE, 'RAWTEXT,defs');
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = explode(".", $perm);
|
||||
$langperm = "";
|
||||
foreach($tmp as $pms)
|
||||
{
|
||||
if(in_array($pms, $lanlist))
|
||||
{
|
||||
$langperm .= $pms." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$permtxt[] = $pms;
|
||||
if($pt[$pms])
|
||||
{
|
||||
$ptext[] = $pt[$pms];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = implode(" ",$permtxt);
|
||||
if($pref['multilanguage'])
|
||||
{
|
||||
$ret .= $langperm;
|
||||
}
|
||||
|
||||
$text = "<div onclick=\"e107Helper.toggle('id_{$id}')\" class='e-pointer' title='".ADMSLAN_71."'>{$ret}</div>";
|
||||
|
||||
if(varset($ptext))
|
||||
{
|
||||
$text .= "<div id='id_{$id}' class='e-hideme'><ul><li>".implode("</li><li>",$ptext)."</li></ul></div>";
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle page DOM within the page header
|
||||
*
|
||||
|
@ -10,8 +10,8 @@
|
||||
* Administration Area - Users
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $
|
||||
* $Revision: 1.63 $
|
||||
* $Date: 2009-11-08 09:14:22 $
|
||||
* $Revision: 1.64 $
|
||||
* $Date: 2009-11-12 01:53:16 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -281,6 +281,14 @@ if (isset ($_POST['adduser']))
|
||||
$user_data = & $allData['data'];
|
||||
if (!$error)
|
||||
{
|
||||
|
||||
if(varset($_POST['perms']))
|
||||
{
|
||||
$allData['data']['user_admin'] = 1;
|
||||
$allData['data']['user_perms'] = implode('.',$_POST['perms']);
|
||||
}
|
||||
|
||||
|
||||
$message = '';
|
||||
$user_data['user_password'] = $userMethods->HashPassword($savePassword,$loginname);
|
||||
$user_data['user_join'] = time();
|
||||
@ -1132,6 +1140,7 @@ class users
|
||||
$e107 = e107 :: getInstance();
|
||||
$type = $this->fields[$key]['type'];
|
||||
$pref = e107::getConfig()->getPref();
|
||||
$prm = new e_userperms;
|
||||
|
||||
switch($key) // switch based on field.
|
||||
{
|
||||
@ -1165,7 +1174,8 @@ class users
|
||||
break;
|
||||
|
||||
case 'user_perms': //TODO display link to popup window with editable perms.
|
||||
return $row[$key].' ';
|
||||
// return $row[$key].' ';
|
||||
return $prm->renderPerms($row[$key],$row['user_id']);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -1398,10 +1408,15 @@ class users
|
||||
}
|
||||
|
||||
|
||||
// Add a new user - may be passed existing data if there was an entry error on first pass
|
||||
// Quick Add a new user - may be passed existing data if there was an entry error on first pass
|
||||
function user_add($user_data)
|
||||
{
|
||||
global $rs,$ns,$pref,$e_userclass;
|
||||
|
||||
$prm = new e_userperms;
|
||||
$list = $prm->getPermList();
|
||||
|
||||
|
||||
if (!is_object($e_userclass))
|
||||
$e_userclass = new user_class;
|
||||
$text = "<div>".$rs->form_open("post",e_SELF.(e_QUERY ? '?'.e_QUERY : ''),"adduserform")."
|
||||
@ -1411,57 +1426,89 @@ class users
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>".USRLAN_61."</td>
|
||||
<td>
|
||||
".$rs->form_text('username',40,varset($user_data['user_name'],""),varset($pref['displayname_maxlength'],15))."
|
||||
</td>
|
||||
<td>".USRLAN_61."</td>
|
||||
<td>
|
||||
".$rs->form_text('username',40,varset($user_data['user_name'],""),varset($pref['displayname_maxlength'],15))."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_128."</td>
|
||||
<td>
|
||||
".$rs->form_text('loginname',40,varset($user_data['user_loginname'],""),varset($pref['loginname_maxlength'],30))."
|
||||
".$rs->form_checkbox('generateloginname',1,varset($pref['predefinedLoginName'],false)).USRLAN_170."
|
||||
</td>
|
||||
<td>".USRLAN_128."</td>
|
||||
<td>
|
||||
".$rs->form_text('loginname',40,varset($user_data['user_loginname'],""),varset($pref['loginname_maxlength'],30))."
|
||||
".$rs->form_checkbox('generateloginname',1,varset($pref['predefinedLoginName'],false)).USRLAN_170."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_129."</td>
|
||||
<td>
|
||||
".$rs->form_text("realname",40,varset($user_data['user_login'],""),30)."
|
||||
</td>
|
||||
<td>".USRLAN_129."</td>
|
||||
<td>
|
||||
".$rs->form_text("realname",40,varset($user_data['user_login'],""),30)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_62."</td>
|
||||
<td>
|
||||
".$rs->form_password("password1",40,"",20)."
|
||||
".$rs->form_checkbox('generatepassword',1,false).USRLAN_171."
|
||||
</td>
|
||||
<td>".USRLAN_62."</td>
|
||||
<td>
|
||||
".$rs->form_password("password1",40,"",20)."
|
||||
".$rs->form_checkbox('generatepassword',1,false).USRLAN_171."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_63."</td>
|
||||
<td>
|
||||
".$rs->form_password("password2",40,"",20)."
|
||||
</td>
|
||||
<td>".USRLAN_63."</td>
|
||||
<td>
|
||||
".$rs->form_password("password2",40,"",20)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_64."</td>
|
||||
<td>
|
||||
".$rs->form_text("email",60,varset($user_data['user_email'],""),100)."
|
||||
</td>
|
||||
<td>".USRLAN_64."</td>
|
||||
<td>
|
||||
".$rs->form_text("email",60,varset($user_data['user_email'],""),100)."
|
||||
</td>
|
||||
</tr>\n";
|
||||
|
||||
if (!isset ($user_data['user_class']))
|
||||
$user_data['user_class'] = varset($pref['initial_user_classes'],'');
|
||||
$temp = $e_userclass->vetted_tree('class',array($e_userclass,'checkbox_desc'),$user_data['user_class'],'classes');
|
||||
|
||||
if ($temp)
|
||||
{
|
||||
$text .= "<tr style='vertical-align:top'>
|
||||
<td>
|
||||
".USRLAN_120."
|
||||
</td><td>{$temp}</td>
|
||||
</td><td>
|
||||
<a href='#set_class' class='e-expandit'>".USRLAN_120."</a>
|
||||
<div class='e-hideme' id='set_class' >
|
||||
{$temp}
|
||||
</div></td>
|
||||
</tr>\n";
|
||||
}
|
||||
|
||||
// Make Admin.
|
||||
$text .= "<tr>
|
||||
<td>".USRLAN_35."</td>
|
||||
<td>
|
||||
<a href='#set_perms' class='e-expandit'>Set Permissions</a>
|
||||
<div class='e-hideme' id='set_perms' >\n";
|
||||
|
||||
$groupedList = $prm->getPermList('grouped');
|
||||
|
||||
foreach($groupedList as $section=>$list)
|
||||
{
|
||||
$text .= "\t\t<div class='field-section'><h4>".$prm->renderSectionDiz($section)."</h4>"; //XXX Lan - General
|
||||
foreach($list as $key=>$diz)
|
||||
{
|
||||
$text .= $prm->checkb($key, '', $diz);
|
||||
}
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
$text .= "</div></td>
|
||||
</tr>\n";
|
||||
|
||||
|
||||
$text .= "
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='2' class='center'>
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Handler - user-related functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_handler.php,v $
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 2009-11-07 02:16:52 $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 2009-11-12 01:53:16 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -647,6 +647,190 @@ Following fields auto-filled in code as required:
|
||||
}
|
||||
}
|
||||
|
||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_administrator.php");
|
||||
|
||||
class e_userperms
|
||||
{
|
||||
protected $core_perms = array(
|
||||
|
||||
"1"=> ADMSLAN_19,
|
||||
"2"=> ADMSLAN_20,
|
||||
"3"=> ADMSLAN_21,
|
||||
"4"=> ADMSLAN_22, // Moderate users/bans etc
|
||||
"5"=> ADMSLAN_23, // create/edit custom pages
|
||||
"J"=> ADMSLAN_41, // create/edit custom menus
|
||||
"Q"=> ADMSLAN_24, // Manage download categories
|
||||
"6"=> ADMSLAN_25, // Upload /manage files
|
||||
"Y"=> ADMSLAN_67, // file inspector
|
||||
"O"=> ADMSLAN_68, // notify
|
||||
"7"=> ADMSLAN_26,
|
||||
"8"=> ADMSLAN_27,
|
||||
"C"=> ADMSLAN_64,
|
||||
"9"=> ADMSLAN_28,
|
||||
"W"=> ADMSLAN_65,
|
||||
"D"=> ADMSLAN_29,
|
||||
"E"=> ADMSLAN_30,
|
||||
"F"=> ADMSLAN_31,
|
||||
"G"=> ADMSLAN_32,
|
||||
"S"=> ADMSLAN_33,
|
||||
"T"=> ADMSLAN_34,
|
||||
"V"=> ADMSLAN_35,
|
||||
"X"=> ADMSLAN_66,
|
||||
"A"=> ADMSLAN_36, // Configure Image Settings
|
||||
"B"=> ADMSLAN_37,
|
||||
"H"=> ADMSLAN_39,
|
||||
"I"=> ADMSLAN_40,
|
||||
"L"=> ADMSLAN_43,
|
||||
"R"=> ADMSLAN_44,
|
||||
"U"=> ADMSLAN_45,
|
||||
"M"=> ADMSLAN_46,
|
||||
"N"=> ADMSLAN_47,
|
||||
// "Z"=> ADMSLAN_62,
|
||||
);
|
||||
|
||||
protected $plugin_perms = array();
|
||||
|
||||
protected $language_perms = array();
|
||||
|
||||
protected $main_perms = array();
|
||||
|
||||
protected $permSectionDiz = array(
|
||||
'core' => ADMSLAN_74,
|
||||
'plugin' => ADLAN_CL_7,
|
||||
'language' => ADLAN_132,
|
||||
'main' => ADMSLAN_58
|
||||
);
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
|
||||
$sql = e107::getDb('sql2');
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
$sql->db_Select("plugin", "*", "plugin_installflag='1'");
|
||||
while ($row2 = $sql->db_Fetch())
|
||||
{
|
||||
$this->plugin_perms[("P".$row2['plugin_id'])] = LAN_PLUGIN." - ".$tp->toHTML($row2['plugin_name'], FALSE, 'RAWTEXT,defs');
|
||||
}
|
||||
|
||||
asort($this->plugin_perms);
|
||||
|
||||
$this->plugin_perms = array("Z"=>ADMSLAN_62) + $this->plugin_perms;
|
||||
|
||||
if(e107::getConfig()->getPref('multilanguage'))
|
||||
{
|
||||
$lanlist = explode(",",e_LANLIST);
|
||||
sort($lanlist);
|
||||
foreach($lanlist as $langs)
|
||||
{
|
||||
$this->language_perms[$langs] = $langs;
|
||||
}
|
||||
}
|
||||
|
||||
if(getperms('0'))
|
||||
{
|
||||
$this->main_perms = array('0' => ADMSLAN_58);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function renderSectionDiz($key)
|
||||
{
|
||||
return $this->permSectionDiz[$key];
|
||||
}
|
||||
|
||||
|
||||
function getPermList($type='all')
|
||||
{
|
||||
if($type == 'core')
|
||||
{
|
||||
return $this->core_perms;
|
||||
}
|
||||
if($type == 'plugin')
|
||||
{
|
||||
return $this->plugin_perms;
|
||||
}
|
||||
if($type == 'language')
|
||||
{
|
||||
return $this->language_perms;
|
||||
}
|
||||
if($type == 'main')
|
||||
{
|
||||
return $this->main_perms;
|
||||
}
|
||||
|
||||
if($type == 'grouped')
|
||||
{
|
||||
$ret = array();
|
||||
$ret['core'] = $this->core_perms;
|
||||
$ret['plugin'] = $this->plugin_perms;
|
||||
|
||||
if(vartrue($this->language_perms))
|
||||
{
|
||||
$ret['language'] = $this->language_perms;
|
||||
}
|
||||
|
||||
if(vartrue($this->main_perms))
|
||||
{
|
||||
$ret['main'] = $this->main_perms;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
return array_merge($this->core_perms,$this->plugin_perms,$this->language_perms,$this->main_perms);
|
||||
}
|
||||
|
||||
function checkb($arg, $perms, $label='')
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
$par = "<div class='field-spacer'>";
|
||||
$par .= $frm->checkbox('perms[]', $arg, getperms($arg, $perms));
|
||||
if ($label)
|
||||
{
|
||||
$par .= $frm->label($label,'perms[]', $arg);
|
||||
}
|
||||
$par .= "</div>\n";
|
||||
|
||||
return $par;
|
||||
}
|
||||
|
||||
function renderPerms($perms,$uniqueID='')
|
||||
{
|
||||
$tmp = explode(".",$perms);
|
||||
$permdiz = $this->getPermList();
|
||||
$ptext = array();
|
||||
|
||||
foreach($tmp as $p)
|
||||
{
|
||||
$ptext[] = $permdiz[$p];
|
||||
}
|
||||
|
||||
$id = "id_".$uniqueID;
|
||||
|
||||
|
||||
$text = "<div onclick=\"e107Helper.toggle('id_{$id}')\" class='e-pointer' title='".ADMSLAN_71."'>{$perms}</div>";
|
||||
|
||||
if(varset($ptext))
|
||||
{
|
||||
$text .= "<div id='id_{$id}' class='e-hideme'><ul><li>".implode("</li><li>",$ptext)."</li></ul></div>";
|
||||
}
|
||||
|
||||
/*
|
||||
$text = "<a href='#".$id."' class='e-expandit' title='".ADMSLAN_71."'>{$perms}</a>";
|
||||
|
||||
if(varset($ptext))
|
||||
{
|
||||
$text .= "<div class='e-hideme' id='".$id."' ><ul><li>".implode("</li><li>",$ptext)."</li></ul></div>";
|
||||
}
|
||||
*/
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user