Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
735e9d95
Commit
735e9d95
authored
Jun 13, 2012
by
Melissa Draper
Committed by
Gerrit Code Review
Jun 13, 2012
Browse files
Merge "Remove use of bitwise assignments on boolean values"
parents
1bf27bcf
b8ecc4e2
Changes
6
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/download.php
View file @
735e9d95
...
...
@@ -82,16 +82,16 @@ else {
}
// If the file is in the public directory, it's fine to serve
$fileispublic
=
(
bool
)
get_field
(
'artefact_parent_cache'
,
'artefact'
,
'artefact'
,
$fileid
,
'parent'
,
ArtefactTypeFolder
::
admin_public_folder_id
())
;
$fileispublic
&
=
$file
->
get
(
'institution'
)
==
'mahara'
;
$fileispublic
=
$file
->
get
(
'institution'
)
==
'mahara'
;
$fileispublic
=
$file
ispublic
&&
(
bool
)
get_field
(
'artefact_parent_cache'
,
'artefact'
,
'artefact'
,
$fileid
,
'parent'
,
ArtefactTypeFolder
::
admin_public_folder_id
())
;
if
(
!
$fileispublic
)
{
// If the file is in the logged in menu and the user is logged in then
// they can view it
$fileinloggedinmenu
=
$file
->
get
(
'institution'
)
==
'mahara'
;
$fileinloggedinmenu
&
=
$file
->
get
(
'parent'
)
==
null
;
$fileinloggedinmenu
&
=
record_exists
(
'site_menu'
,
'file'
,
$fileid
,
'public'
,
0
);
$fileinloggedinmenu
&
=
$
USER
->
is_logged_in
(
);
$fileinloggedinmenu
=
$fileinloggedinmenu
&&
$file
->
get
(
'parent'
)
==
null
;
$fileinloggedinmenu
=
$fileinloggedinmenu
&&
$USER
->
is_logged_in
(
);
$fileinloggedinmenu
=
$
fileinloggedinmenu
&&
record_exists
(
'site_menu'
,
'file'
,
$fileid
,
'public'
,
0
);
if
(
!
$fileinloggedinmenu
)
{
// Alternatively, if you own the file or you are an admin, it should always work
...
...
htdocs/lib/mahara.php
View file @
735e9d95
...
...
@@ -2028,6 +2028,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
}
$data
=
array
();
$done
=
false
;
// public, logged in, or friends' views
if
(
$results
=
get_records_sql_assoc
(
...
...
@@ -2093,7 +2094,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
$data
=
array_merge
(
$data
,
$results
);
// bail if we've filled all users to the limit
$done
&
=
_get_views_trim_list
(
$list
,
$users
,
$limit
,
$data
);
$done
=
$done
&&
_get_views_trim_list
(
$list
,
$users
,
$limit
,
$data
);
}
// check group access
...
...
@@ -2122,7 +2123,7 @@ function get_views($users, $userlooking=null, $limit=5, $type=null) {
$data
=
array_merge
(
$data
,
$results
);
// bail if we've filled all users to the limit
$done
&
=
_get_views_trim_list
(
$list
,
$users
,
$limit
,
$data
);
$done
=
$done
&&
_get_views_trim_list
(
$list
,
$users
,
$limit
,
$data
);
}
require_once
(
'view.php'
);
...
...
htdocs/lib/searchlib.php
View file @
735e9d95
...
...
@@ -272,7 +272,7 @@ function get_admin_user_search_results($search, $offset, $limit) {
// Remove email address when viewed by staff
if
(
!
$hideemail
=
(
empty
(
$admininstitutions
)
||
empty
(
$result
[
'institutions'
])))
{
$commoninstitutions
=
array_intersect
(
$admininstitutions
,
$result
[
'institutions'
]);
$hideemail
|
=
empty
(
$commoninstitutions
);
$hideemail
=
$hideemail
||
empty
(
$commoninstitutions
);
}
if
(
$hideemail
)
{
unset
(
$result
[
'email'
]);
...
...
htdocs/lib/user.php
View file @
735e9d95
...
...
@@ -886,8 +886,8 @@ function get_user_for_display($user=null) {
foreach
(
$fields
as
$f
)
{
$user
->
$f
=
$USER
->
get
(
$f
);
}
$user
->
admin
|
=
$USER
->
is_institutional_admin
();
$user
->
staff
|
=
$USER
->
is_institutional_staff
();
$user
->
admin
=
$user
->
admin
||
$USER
->
is_institutional_admin
();
$user
->
staff
=
$user
->
staff
||
$USER
->
is_institutional_staff
();
}
else
if
(
$user
instanceof
User
)
{
$userObj
=
$user
;
...
...
htdocs/lib/view.php
View file @
735e9d95
...
...
@@ -3942,8 +3942,8 @@ class View {
}
if
(
$a
->
allowcomments
)
{
$allowcomments
|
=
$a
->
allowcomments
;
$approvecomments
&
=
$a
->
approvecomments
;
$allowcomments
=
$allowcomments
||
$a
->
allowcomments
;
$approvecomments
=
$approvecomments
&&
$a
->
approvecomments
;
}
if
(
!
$approvecomments
)
{
return
true
;
...
...
htdocs/view/edit.php
View file @
735e9d95
...
...
@@ -90,12 +90,12 @@ if ($studentid !== '') {
if
(
$urlallowed
=
get_config
(
'cleanurls'
)
&&
$view
->
get
(
'type'
)
==
'portfolio'
&&
!
$institution
)
{
if
(
$group
)
{
$groupdata
=
get_record
(
'group'
,
'id'
,
$group
);
$urlallowed
&
=
strlen
(
$groupdata
->
urlid
);
$urlallowed
=
$urlallowed
&&
strlen
(
$groupdata
->
urlid
);
$cleanurlbase
=
get_config
(
'wwwroot'
)
.
get_config
(
'cleanurlgroupdefault'
)
.
'/'
.
$groupdata
->
urlid
.
'/'
;
}
else
{
$userurlid
=
$USER
->
get
(
'urlid'
);
if
(
$urlallowed
&
=
(
!
is_null
(
$userurlid
)
&&
strlen
(
$userurlid
)))
{
if
(
$urlallowed
=
(
$urlallowed
&&
!
is_null
(
$userurlid
)
&&
strlen
(
$userurlid
)))
{
$cleanurlbase
=
get_config
(
'wwwroot'
)
.
get_config
(
'cleanurluserdefault'
)
.
'/'
.
$userurlid
.
'/'
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment