Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804560
addpermission.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 1:36 PM
Size
12 KB
Mime Type
text/x-php
Expires
Fri, Feb 28, 1:36 PM (20 h, 55 m)
Engine
blob
Format
Raw Data
Handle
577064
Attached To
rINP In-Portal
addpermission.php
View Options
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if
(!
strlen
(
$pathtoroot
))
{
$path
=
dirname
(
realpath
(
__FILE__
));
if
(
strlen
(
$path
))
{
/* determine the OS type for path parsing */
$pos
=
strpos
(
$path
,
":"
);
if
(
$pos
===
false
)
{
$gOS_TYPE
=
"unix"
;
$pathchar
=
"/"
;
}
else
{
$gOS_TYPE
=
"win"
;
$pathchar
=
"
\\
"
;
}
$p
=
$path
.
$pathchar
;
/*Start looking for the root flag file */
while
(!
strlen
(
$pathtoroot
)
&&
strlen
(
$p
))
{
$sub
=
substr
(
$p
,
strlen
(
$pathchar
)*-
1
);
if
(
$sub
==
$pathchar
)
{
$filename
=
$p
.
"root.flg"
;
}
else
$filename
=
$p
.
$pathchar
.
"root.flg"
;
if
(
file_exists
(
$filename
))
{
$pathtoroot
=
$p
;
}
else
{
$parent
=
realpath
(
$p
.
$pathchar
.
".."
.
$pathchar
);
if
(
$parent
!=
$p
)
{
$p
=
$parent
;
}
else
$p
=
""
;
}
}
if
(!
strlen
(
$pathtoroot
))
$pathtoroot
=
"."
.
$pathchar
;
}
else
{
$pathtoroot
=
"."
.
$pathchar
;
}
}
$sub
=
substr
(
$pathtoroot
,
strlen
(
$pathchar
)*-
1
);
if
(
$sub
!=
$pathchar
)
{
$pathtoroot
=
$pathtoroot
.
$pathchar
;
}
require_once
(
$pathtoroot
.
"kernel/startup.php"
);
//admin only util
$rootURL
=
"http://"
.
ThisDomain
().
$objConfig
->
Get
(
"Site_Path"
);
$admin
=
$objConfig
->
Get
(
"AdminDirectory"
);
if
(!
strlen
(
$admin
))
$admin
=
"admin"
;
$localURL
=
$rootURL
.
"kernel/"
;
$adminURL
=
$rootURL
.
$admin
;
$imagesURL
=
$adminURL
.
"/images"
;
$cssURL
=
$adminURL
.
"/include"
;
$browseURL
=
$adminURL
.
"/browse"
;
//$pathtolocal = $pathtoroot."in-news/";
require_once
(
$pathtoroot
.
$admin
.
"/include/elements.php"
);
require_once
(
$pathtoroot
.
"kernel/admin/include/navmenu.php"
);
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once
(
$pathtoroot
.
$admin
.
"/browse/toolbar.php"
);
require_once
(
$pathtoroot
.
$admin
.
"/listview/listview.php"
);
$m
=
GetModuleArray
();
foreach
(
$m
as
$key
=>
$value
)
{
$path
=
$pathtoroot
.
$value
.
"admin/include/parser.php"
;
if
(
file_exists
(
$path
))
{
include_once
(
$path
);
}
}
unset
(
$objEditItems
);
$objEditItems
=
new
clsCatList
();
$objEditItems
->
SourceTable
=
$objSession
->
GetEditTable
(
"Category"
);
//Multiedit init
$en
=
(
int
)
$_GET
[
"en"
];
$objEditItems
->
Query_Item
(
"SELECT * FROM "
.
$objEditItems
->
SourceTable
);
$itemcount
=
$objEditItems
->
NumItems
();
$c
=
$objEditItems
->
GetItemByIndex
(
$en
);
if
(!
is_object
(
$c
))
{
$c
=
new
clsCategory
();
$c
->
Set
(
"CategoryId"
,
0
);
}
if
(
$itemcount
>
1
)
{
if
(
$en
+
1
==
$itemcount
)
$en_next
=
-
1
;
else
$en_next
=
$en
+
1
;
if
(
$en
==
0
)
$en_prev
=
-
1
;
else
$en_prev
=
$en
-
1
;
}
$action
=
"m_edit_permissions"
;
$envar
=
"env="
.
BuildEnv
()
.
"&en=$en"
;
$section
=
'in-portal:catperm_setperm'
;
$Module
=
$_GET
[
"module"
];
$GroupId
=
$_GET
[
"GroupId"
];
$g
=
$objGroups
->
GetItem
(
$GroupId
);
$objPermList
=
new
clsPermList
(
$c
->
Get
(
"CategoryId"
),
$GroupId
);
$objPermList
->
LoadPermTree
(
$c
);
$objParentPerms
=
new
clsPermList
(
$c
->
Get
(
"ParentId"
),
$GroupId
);
$p
=
$objCatList
->
GetCategory
(
$c
->
Get
(
"ParentId"
));
$objParentPerms
->
LoadPermTree
(
$p
);
$ado
=
&
GetADODBConnection
();
/* page header */
print
<<<END
<html>
<head>
<title>In-portal</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
imagesPath='$imagesURL'+'/';
</script>
<script src="$browseURL/common.js"></script>
<script src="$browseURL/toolbar.js"></script>
<script src="$browseURL/utility.js"></script>
<script src="$browseURL/checkboxes.js"></script>
<script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
<link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
<link rel="stylesheet" type="text/css" href="$cssURL/style.css">
<link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
END;
//int_SectionHeader();
//$back_url = $rootURL."admin/category/addpermission_modules.php?env=".BuildEnv()."&GroupId=$GroupId";
$back_url
=
"javascript:do_edit_save('category','CatEditStatus','"
.
$admin
.
"/category/addpermission_modules.php',0);"
;
if
(
$c
->
Get
(
"CategoryId"
)>
0
)
{
$title
=
prompt_language
(
"la_Text_Editing"
).
" "
.
prompt_language
(
"la_Text_Category"
).
" '"
.
$c
->
Get
(
"Name"
).
"' - "
.
prompt_language
(
"la_tab_Permissions"
);
$title
.=
" "
.
prompt_language
(
"la_text_for"
).
" '"
.
$g
->
parsetag
(
"group_name"
).
"'"
;
}
else
{
$title
=
prompt_language
(
"la_Text_Editing"
).
" "
.
prompt_language
(
"la_Text_Root"
).
" "
.
prompt_language
(
"la_Text_Category"
).
" - "
.
"' - "
.
prompt_language
(
"la_tab_Permissions"
);
$title
.=
" "
.
prompt_language
(
"la_text_for"
).
" '"
.
$g
->
parsetag
(
"group_name"
).
"'"
;
}
$objListToolBar
=
new
clsToolBar
();
$objListToolBar
->
Add
(
"img_save"
,
"la_Save"
,
"#"
,
"swap('img_save','toolbar/tool_select_f2.gif');"
,
"swap('img_save', 'toolbar/tool_select.gif');"
,
"do_edit_save('category','CatEditStatus','"
.
$admin
.
"/category/addpermission_modules.php',0);"
,
$imagesURL
.
"/toolbar/tool_select.gif"
);
//$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','admin/category/addpermission_modules.php',-1);", $imagesURL."/toolbar/tool_cancel.gif");
$objListToolBar
->
Add
(
"img_cancel"
,
"la_Cancel"
,
$back_url
,
"swap('img_cancel','toolbar/tool_cancel_f2.gif');"
,
"swap('img_cancel', 'toolbar/tool_cancel.gif');"
,
""
,
$imagesURL
.
"/toolbar/tool_cancel.gif"
);
$sec
=&
$objSections
->
GetSection
(
$section
);
if
(
$c
->
Get
(
"CategoryId"
)==
0
)
{
$sec
->
Set
(
"left"
,
NULL
);
$sec
->
Set
(
"right"
,
NULL
);
}
int_header
(
$objListToolBar
,
NULL
,
$title
);
if
(
$objSession
->
GetVariable
(
"HasChanges"
)
==
1
)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php
int_hint_red
(
admin_language
(
"la_Warning_Save_Item"
));
?>
</td>
</tr>
</table>
<?php
}
?>
<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
<TBODY>
<tr BGCOLOR="#e0e0da">
<td WIDTH="100%" CLASS="navar">
<img height="15" src="
<?php
echo
$imagesURL
;
?>
/arrow.gif" width="15" align="middle" border="0">
<span class="navbar"><A CLASS="control_link" HREF="
<?php
echo
$back_url
;
?>
">
<?php
echo
prompt_language
(
"la_Prompt_CategoryPermissions"
).
"</A>>"
;
?>
</span>
<SPAN CLASS="NAV_CURRENT_ITEM">
<?php
echo
$Module
;
?>
</SPAN>
</td>
</TR>
</TBODY>
</TABLE>
<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
<FORM ID="category" NAME="category" method="POST" ACTION="">
<TBODY>
<TR class="subsectiontitle">
<?php
echo
"<TD>"
.
prompt_language
(
"la_prompt_Description"
).
"</TD>"
;
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
{
echo
"<TD>"
.
prompt_language
(
"la_ColHeader_PermInherited"
).
"</TD>"
;
}
echo
"<TD>"
.
prompt_language
(
"la_ColHeader_PermAccess"
).
"</TD>
\n
"
;
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
{
echo
"<td>"
.
prompt_language
(
"la_ColHeader_InheritFrom"
).
"</TD>"
;
}
?>
</TR>
<?php
if
(
$c
->
Get
(
"CategoryId"
)>
0
)
{
$ParentCatList
=
"0"
.
$c
->
Get
(
"ParentPath"
);
}
else
$ParentCatList
=
"0"
.
$c
->
GetParentField
(
"ParentPath"
,
""
,
""
);
$ParentCats
=
explode
(
"|"
,
$ParentCatList
);
$ParentCats
=
array_reverse
(
$ParentCats
);
$sql
=
"SELECT * FROM "
.
GetTablePrefix
().
"PermissionConfig WHERE ModuleId='$Module'"
;
$rs
=
$ado
->
Execute
(
$sql
);
while
(
$rs
&&
!
$rs
->
EOF
)
{
$perm
=
$rs
->
fields
;
$Permission
=
$perm
[
"PermissionName"
];
$Desc
=
$perm
[
"Description"
];
echo
"<TR "
.
int_table_color_ret
().
">
\n
"
;
echo
"<TD>"
.
prompt_language
(
"$Desc"
).
" [$Permission]</TD>"
;
$p
=
$objPermList
->
GetPermByName
(
$Permission
);
$checked
=
""
;
$MatchCatPath
=
""
;
if
(
is_object
(
$p
))
{
//echo $p->Get("Permission")." Found<br>\n";
if
(
$p
->
Inherited
)
{
$checked
=
" CHECKED"
;
$MatchCatPath
=
""
;
if
(
$c
->
Get
(
"CategoryId"
)>
0
)
{
$MatchedCat
=
$objPermList
->
GetDefinedCategory
(
$Permission
,
$GroupId
);
}
else
$MatchedCat
=
$objParentPerms
->
GetDefinedCategory
(
$Permission
,
$GroupId
);
if
(
is_numeric
(
$MatchedCat
))
{
if
(
$MatchedCat
!=
0
)
{
$mcat
=
$objCatList
->
GetCategory
(
$MatchedCat
);
$MatchCatPath
=
language
(
$objConfig
->
Get
(
"Root_Name"
)).
">"
.
$mcat
->
Get
(
"CachedNavbar"
);
}
else
$MatchCatPath
=
language
(
$objConfig
->
Get
(
"Root_Name"
));
}
else
$MatchCatPath
=
""
;
}
}
else
$checked
=
" CHECKED"
;
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
{
echo
" <TD><INPUT access=
\"
chk"
.
$Permission
.
"
\"
ONCLICK=
\"
SetAccessEnabled(this);
\"
TYPE=CHECKBOX name=
\"
inherit[]
\"
VALUE=
\"
"
.
$Permission
.
"
\"
$checked></TD>
\n
"
;
}
else
{
if
(
is_object
(
$p
))
$p
->
Inherited
=
FALSE
;
}
$checked
=
""
;
$imgsrc
=
"red"
;
if
(
is_object
(
$p
))
{
if
(
$p
->
Get
(
"PermissionValue"
))
{
$checked
=
" CHECKED"
;
$imgsrc
=
"green"
;
$current
=
"true"
;
}
else
{
$imgsrc
=
"red"
;
$current
=
"false"
;
}
$disabled
=
""
;
if
(
$p
->
Inherited
)
{
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
{
$InheritValue
=
$current
;
$UnInheritValue
=
"false"
;
$disabled
=
"DISABLED=
\"
true
\"
"
;
}
else
{
$disabled
=
""
;
$UnInheritValue
=
"false"
;
$InheritValue
=
"false"
;
}
}
else
{
$disabled
=
""
;
if
(
$p
->
Get
(
"PermissionValue"
))
{
$InheritValue
=
"false"
;
//need to look this up!
}
else
$InheritValue
=
"false"
;
$UnInheritValue
=
$current
;
}
}
else
{
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
{
$disabled
=
"DISABLED=
\"
true
\"
"
;
$InheritValue
=
"false"
;
$UnInheritValue
=
"false"
;
$Matched
=
FALSE
;
$MatchCatPath
=
""
;
$MatchedCat
=
$objPermList
->
GetDefinedCategory
(
$Permission
,
$GroupId
);
if
(
is_numeric
(
$MatchedCat
))
{
if
(
$MatchedCat
>
0
)
{
$mcat
=
$objCatList
->
GetCategory
(
$MatchedCat
);
$MatchCatPath
=
language
(
$objConfig
->
Get
(
"Root_Name"
)).
">"
.
$mcat
->
Get
(
"CachedNavbar"
);
}
else
$MatchCatPath
=
language
(
$objConfig
->
Get
(
"Root_Name"
));
}
else
$MatchCatPath
=
""
;
}
else
{
$disabled
=
""
;
$UnInheritValue
=
"false"
;
$InheritValue
=
"false"
;
}
}
echo
" <TD><INPUT $disabled InheritValue=
\"
$InheritValue
\"
UnInheritValue=
\"
$UnInheritValue
\"
ID=
\"
chk"
.
$Permission
.
"
\"
ONCLICK=
\"
SetPermImage(this);
\"
permimg=
\"
img"
.
$Permission
.
"
\"
TYPE=CHECKBOX name=
\"
permvalue[]
\"
VALUE=
\"
"
.
$Permission
.
"
\"
$checked>"
;
echo
" <img ID=
\"
img"
.
$Permission
.
"
\"
SRC=
\"
$imagesURL/perm_"
.
$imgsrc
.
".gif
\"
>"
;
echo
" </TD>
\n
"
;
if
(
$c
->
Get
(
"CategoryId"
)!=
0
)
echo
"<TD>$MatchCatPath</TD>"
;
echo
"</TR>
\n
"
;
$rs
->
MoveNext
();
}
?>
</TBODY>
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="m_edit_permissions">
<input type="hidden" NAME="GroupId" VALUE="
<?php
echo
$GroupId
;
?>
">
<input TYPE="HIDDEN" NAME="CategoryId" VALUE="
<?php
echo
$c
->
Get
(
"CategoryId"
);
?>
">
<input type="hidden" name="CatEditStatus" VALUE="0">
<input TYPE="HIDDEN" NAME="Module" VALUE="
<?php
echo
$Module
;
?>
">
</FORM>
</TABLE>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="user_groups.php?
<?php
echo
$envar
;
?>
" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<!-- END CODE-->
<?php
int_footer
();
?>
Event Timeline
Log In to Comment