forked from nbuy/xoops-modules-eguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perm.php
31 lines (29 loc) · 962 Bytes
/
perm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// checking permittion for event adiminstration.
// $Id: perm.php,v 1.8 2010/06/27 04:12:30 nobu Exp $
function eguide_perm( $eid ) {
global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $_POST;
if ( ! $xoopsUser ) {
return false;
} // need login
elseif ( $xoopsUser->isAdmin( $xoopsModule->getVar( 'mid' ) ) ) {
;
} // ok admin
elseif ( ! empty( $eid ) ) { // edit? check poster
$result = $xoopsDB->query( "SELECT uid FROM " . EGTBL . " WHERE eid=$eid" );
$data = $xoopsDB->fetchArray( $result );
if ( $xoopsUser->getVar( 'uid' ) != $data['uid'] ) {
return false;
} // need poster
} elseif ( empty( $_POST['op'] ) || $_POST['op'] == "new" ) {
$groups = $xoopsUser->groups();
if ( ! in_array( $xoopsModuleConfig['group'], $groups ) ) {
return false;
}
}
return true;
}
if ( ! eguide_perm( param( 'eid' ) ) ) {
redirect_header( EGUIDE_URL . "/index.php", 2, _NOPERM );
exit();
}