Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
2972699b
Commit
2972699b
authored
Dec 05, 2007
by
Clare Lenihan
Committed by
Clare Lenihan
Dec 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added exception arguments + made exception arguments translatable
parent
6ab90c71
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
20 deletions
+31
-20
htdocs/interaction/forum/deletepost.php
htdocs/interaction/forum/deletepost.php
+2
-2
htdocs/interaction/forum/deletetopic.php
htdocs/interaction/forum/deletetopic.php
+4
-4
htdocs/interaction/forum/editpost.php
htdocs/interaction/forum/editpost.php
+4
-4
htdocs/interaction/forum/edittopic.php
htdocs/interaction/forum/edittopic.php
+4
-4
htdocs/interaction/forum/index.php
htdocs/interaction/forum/index.php
+2
-2
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
+11
-0
htdocs/interaction/forum/topic.php
htdocs/interaction/forum/topic.php
+2
-2
htdocs/interaction/forum/view.php
htdocs/interaction/forum/view.php
+2
-2
No files found.
htdocs/interaction/forum/deletepost.php
View file @
2972699b
...
...
@@ -49,7 +49,7 @@ $post = get_record_sql(
);
if
(
!
$post
)
{
throw
new
NotFoundException
(
"Couldn't
find
post
with id
$postid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findpost
'
,
'interaction.forum'
,
$postid
)
);
}
$membership
=
user_can_access_group
((
int
)
$post
->
group
);
...
...
@@ -59,7 +59,7 @@ $admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$post
->
forum
);
if
(
!
$moderator
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantdeletepost'
,
'interaction.forum'
)
);
}
define
(
'TITLE'
,
get_string
(
'deletepost'
,
'interaction.forum'
,
$post
->
subject
));
...
...
htdocs/interaction/forum/deletetopic.php
View file @
2972699b
...
...
@@ -43,7 +43,7 @@ $forum = get_record_sql(
);
if
(
!
$forum
)
{
throw
new
NotFoundException
(
"Couldn't
find
topic
with id
$topicid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findtopic
'
,
'interaction.forum'
,
$topicid
)
);
}
$membership
=
user_can_access_group
((
int
)
$forum
->
group
);
...
...
@@ -53,10 +53,10 @@ $admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$forum
->
id
);
if
(
!
$moderator
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantdeletetopic'
,
'interaction.forum'
)
);
}
$post
info
=
get_record_sql
(
$post
=
get_record_sql
(
'SELECT p.subject, p.body
FROM {interaction_forum_post} p
WHERE p.topic = ?
...
...
@@ -64,7 +64,7 @@ $postinfo = get_record_sql(
array
(
$topicid
)
);
define
(
'TITLE'
,
get_string
(
'deletetopic'
,
'interaction.forum'
,
$post
info
->
subject
));
define
(
'TITLE'
,
get_string
(
'deletetopic'
,
'interaction.forum'
,
$post
->
subject
));
require_once
(
'pieforms/pieform.php'
);
...
...
htdocs/interaction/forum/editpost.php
View file @
2972699b
...
...
@@ -57,7 +57,7 @@ if ($postid==0) {
);
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't
find
post
with id
$parentid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findpost
'
,
'interaction.forum'
,
$parentid
)
);
}
$membership
=
user_can_access_group
((
int
)
$topic
->
group
);
...
...
@@ -67,7 +67,7 @@ if ($postid==0) {
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$topic
->
forum
);
if
(
!
$membership
||
(
!
$moderator
&&
$topic
->
closed
))
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantaddpost'
,
'interaction.forum'
)
);
}
$topicid
=
$topic
->
id
;
...
...
@@ -94,7 +94,7 @@ if (isset($postid)) {
);
if
(
!
$post
)
{
throw
new
NotFoundException
(
"Couldn't
find
post
with id
$postid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findpost
'
,
'interaction.forum'
,
$postid
)
);
}
$topicid
=
$post
->
topic
;
...
...
@@ -109,7 +109,7 @@ if (isset($postid)) {
if
(
!
$moderator
&&
(
$post
->
poster
!=
$userid
||
(
time
()
-
strtotime
(
$post
->
ctime
))
>
(
30
*
60
)))
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'canteditpost'
,
'interaction.forum'
)
);
}
}
...
...
htdocs/interaction/forum/edittopic.php
View file @
2972699b
...
...
@@ -46,7 +46,7 @@ if ($topicid==0) {
);
if
(
!
$forum
)
{
throw
new
NotFoundException
(
"Couldn't
find
forum
with id
$forumid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findforum
'
,
'interaction.forum'
,
$forumid
)
);
}
$forumtitle
=
$forum
->
title
;
...
...
@@ -57,7 +57,7 @@ if ($topicid==0) {
$moderator
=
$admin
||
is_forum_moderator
(
$forumid
);
if
(
!
$membership
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantaddtopic'
,
'interaction.forum'
)
);
}
}
...
...
@@ -78,7 +78,7 @@ if (isset($topicid)) {
);
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't
find
topic
with id
$topicid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findtopic
'
,
'interaction.forum'
,
$topicid
)
);
}
$forumid
=
$topic
->
forumid
;
...
...
@@ -91,7 +91,7 @@ if (isset($topicid)) {
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$forumid
);
if
(
!
$moderator
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantedittopic'
,
'interaction.forum'
)
);
}
}
...
...
htdocs/interaction/forum/index.php
View file @
2972699b
...
...
@@ -33,7 +33,7 @@ define('TITLE', get_string('nameplural', 'interaction.forum'));
$groupid
=
param_integer
(
'group'
);
if
(
!
record_exists
(
'group'
,
'id'
,
$groupid
))
{
throw
new
GroupNotFoundException
(
"Couldn't find group with id
$groupid
"
);
throw
new
GroupNotFoundException
(
get_string
(
'groupnotfound'
,
'group'
,
$groupid
)
);
}
$groupname
=
get_record_sql
(
...
...
@@ -46,7 +46,7 @@ $groupname = get_record_sql(
$membership
=
user_can_access_group
(
$groupid
);
if
(
!
$membership
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantviewforums'
,
'interaction.forum'
)
);
}
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
...
...
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
View file @
2972699b
...
...
@@ -3,6 +3,17 @@
$string
[
'addtitle'
]
=
'Add forum'
;
$string
[
'addtopic'
]
=
'Add topic'
;
$string
[
'body'
]
=
'Body'
;
$string
[
'cantaddpost'
]
=
'You are not allowed to post in this forum'
;
$string
[
'cantaddtopic'
]
=
'You are not allowed to add topics to this forum'
;
$string
[
'cantdeletepost'
]
=
'You are not allowed to delete posts in this forum'
;
$string
[
'cantdeletetopic'
]
=
'You are not allowed to delete topics in this forum'
;
$string
[
'canteditpost'
]
=
'You are not allowed to edit that post'
;
$string
[
'cantedittopic'
]
=
'You are not allowed to edit topics in this forum'
;
$string
[
'cantfindforum'
]
=
'Coudn\'t find forum with id %s'
;
$string
[
'cantfindpost'
]
=
'Couldn\'t find post with id %s'
;
$string
[
'cantfindtopic'
]
=
'Couldn\'t find topic with id %s'
;
$string
[
'cantviewforums'
]
=
'You are not allowed to view forums in this group'
;
$string
[
'cantviewtopic'
]
=
'You are not allowed to view topics in this forum'
;
$string
[
'closed'
]
=
'Closed'
;
$string
[
'count'
]
=
'Count'
;
$string
[
'currentmoderators'
]
=
'Current Moderators'
;
...
...
htdocs/interaction/forum/topic.php
View file @
2972699b
...
...
@@ -54,13 +54,13 @@ $topic = get_record_sql(
);
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't
find
topic
with id
$topicid
"
);
throw
new
NotFoundException
(
get_string
(
'cant
findtopic
'
,
'interaction.forum'
,
$topicid
)
);
}
$membership
=
user_can_access_group
((
int
)
$topic
->
group
);
if
(
!
$membership
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantviewtopic'
,
'interaction.forum'
)
);
}
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
...
...
htdocs/interaction/forum/view.php
View file @
2972699b
...
...
@@ -47,13 +47,13 @@ $group = get_record_sql(
);
if
(
!
$group
)
{
throw
new
InteractionInstanceNotFoundException
(
"Couldn't
find
forum
with id
$forumid
"
);
throw
new
InteractionInstanceNotFoundException
(
get_string
(
'cant
findforum
'
,
'interaction.forum'
,
$forumid
)
);
}
$membership
=
user_can_access_group
((
int
)
$group
->
id
);
if
(
!
$membership
)
{
throw
new
AccessDeniedException
();
throw
new
AccessDeniedException
(
get_string
(
'cantviewforums'
,
'interaction.forum'
)
);
}
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
...
...
Write
Preview
Markdown
is supported
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