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
6ab90c71
Commit
6ab90c71
authored
Dec 05, 2007
by
Clare Lenihan
Committed by
Clare Lenihan
Dec 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing up topics + posts in forums that have been deleted + general clean up
parent
1188ef33
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
137 additions
and
129 deletions
+137
-129
htdocs/interaction/forum/deletepost.php
htdocs/interaction/forum/deletepost.php
+14
-24
htdocs/interaction/forum/deletetopic.php
htdocs/interaction/forum/deletetopic.php
+5
-5
htdocs/interaction/forum/editpost.php
htdocs/interaction/forum/editpost.php
+12
-5
htdocs/interaction/forum/edittopic.php
htdocs/interaction/forum/edittopic.php
+30
-38
htdocs/interaction/forum/index.php
htdocs/interaction/forum/index.php
+9
-6
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
+2
-1
htdocs/interaction/forum/lib.php
htdocs/interaction/forum/lib.php
+16
-14
htdocs/interaction/forum/topic.php
htdocs/interaction/forum/topic.php
+24
-22
htdocs/interaction/forum/view.php
htdocs/interaction/forum/view.php
+25
-14
No files found.
htdocs/interaction/forum/deletepost.php
View file @
6ab90c71
...
...
@@ -30,43 +30,38 @@ require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require
(
'interaction'
,
'forum'
);
require_once
(
'group.php'
);
$userid
=
$USER
->
get
(
'id'
);
$postid
=
param_integer
(
'id'
);
$
info
=
get_record_sql
(
'SELECT p.topic, p.parent, t.forum, p2.subject, f.group
$
post
=
get_record_sql
(
'SELECT
p.subject,
p.topic, p.parent, t.forum, p2.subject
as topicsubject
, f.group
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON p.topic = t.id
AND t.deleted != 1
INNER JOIN {interaction_forum_post} p2
ON p2.topic = t.id
AND p2.parent IS NULL
INNER JOIN {interaction_instance} f
ON t.forum = f.id
WHERE p.id = ?'
,
AND f.deleted != 1
WHERE p.id = ?
AND p.deleted != 1'
,
array
(
$postid
)
);
if
(
!
$
info
)
{
if
(
!
$
post
)
{
throw
new
NotFoundException
(
"Couldn't find post with id
$postid
"
);
}
$membership
=
user_can_access_group
((
int
)
$
info
->
group
);
$membership
=
user_can_access_group
((
int
)
$
post
->
group
);
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$
info
->
forum
);
$moderator
=
$admin
||
is_forum_moderator
((
int
)
$
post
->
forum
);
if
(
!
$moderator
)
{
throw
new
AccessDeniedException
();
}
$post
=
get_record_sql
(
'SELECT p.subject
FROM {interaction_forum_post} p
WHERE p.id = ?'
,
array
(
$postid
)
);
define
(
'TITLE'
,
get_string
(
'deletepost'
,
'interaction.forum'
,
$post
->
subject
));
require_once
(
'pieforms/pieform.php'
);
...
...
@@ -80,29 +75,24 @@ $form = pieform(array(
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'yes'
),
get_string
(
'no'
)),
'goto'
=>
get_config
(
'wwwroot'
)
.
'interaction/forum/topic.php?id='
.
$
info
->
topic
,
'goto'
=>
get_config
(
'wwwroot'
)
.
'interaction/forum/topic.php?id='
.
$
post
->
topic
,
)
)
));
function
deletepost_submit
(
Pieform
$form
,
$values
)
{
$postid
=
param_integer
(
'id'
);
global
$postid
;
global
$post
;
update_record
(
'interaction_forum_post'
,
array
(
'deleted'
=>
1
),
array
(
'id'
=>
$postid
)
);
$topic
=
get_record_sql
(
'SELECT topic AS id
FROM {interaction_forum_post}
WHERE id = ?'
,
array
(
$postid
)
);
redirect
(
'/interaction/forum/topic.php?id='
.
$topic
->
id
);
redirect
(
'/interaction/forum/topic.php?id='
.
$post
->
topic
);
}
$smarty
=
smarty
();
$smarty
->
assign
(
'topicsubject'
,
$
info
->
subject
);
$smarty
->
assign
(
'topicsubject'
,
$
post
->
topic
subject
);
$smarty
->
assign
(
'heading'
,
TITLE
);
$smarty
->
assign
(
'deleteform'
,
$form
);
$smarty
->
display
(
'interaction:forum:deletepost.tpl'
);
...
...
htdocs/interaction/forum/deletetopic.php
View file @
6ab90c71
...
...
@@ -29,16 +29,16 @@ define('MENUITEM', 'groups');
require
(
dirname
(
dirname
(
dirname
(
__FILE__
)))
.
'/init.php'
);
safe_require
(
'interaction'
,
'forum'
);
require
(
'group.php'
);
$userid
=
$USER
->
get
(
'id'
);
$topicid
=
param_integer
(
'id'
);
$forum
=
get_record_sql
(
'SELECT f."group", f.id, f.title
FROM {interaction_forum_topic} t
INNER JOIN {interaction_instance} f
ON (f.id = t.forum)
WHERE t.id = ?'
,
ON f.id = t.forum
AND f.deleted != 1
WHERE t.id = ?
AND t.deleted != 1'
,
array
(
$topicid
)
);
...
...
@@ -60,7 +60,7 @@ $postinfo = get_record_sql(
'SELECT p.subject, p.body
FROM {interaction_forum_post} p
WHERE p.topic = ?
AND p.parent
is null
'
,
AND p.parent
IS NULL
'
,
array
(
$topicid
)
);
...
...
htdocs/interaction/forum/editpost.php
View file @
6ab90c71
...
...
@@ -44,15 +44,22 @@ if ($postid==0) {
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON p.topic = t.id
AND t.deleted != 1
INNER JOIN {interaction_forum_post} p2
ON p2.topic = t.id
AND p2.parent IS NULL
INNER JOIN {interaction_instance} f
ON t.forum = f.id
WHERE p.id = ?'
,
AND f.deleted != 1
WHERE p.id = ?
AND p.deleted != 1'
,
array
(
$parentid
)
);
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't find post with id
$parentid
"
);
}
$membership
=
user_can_access_group
((
int
)
$topic
->
group
);
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
...
...
@@ -63,9 +70,6 @@ if ($postid==0) {
throw
new
AccessDeniedException
();
}
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't find topic with id
$parentid
"
);
}
$topicid
=
$topic
->
id
;
$topicsubject
=
$topic
->
subject
;
}
...
...
@@ -77,12 +81,15 @@ if (isset($postid)) {
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON p.topic = t.id
AND t.deleted != 1
INNER JOIN {interaction_forum_post} p2
ON p2.topic = t.id
AND p2.parent IS NULL
INNER JOIN {interaction_instance} f
ON t.forum = f.id
WHERE p.id = ?'
,
AND f.deleted != 1
WHERE p.id = ?
AND p.deleted != 1'
,
array
(
$postid
)
);
...
...
htdocs/interaction/forum/edittopic.php
View file @
6ab90c71
...
...
@@ -37,18 +37,20 @@ if ($topicid==0) {
unset
(
$topicid
);
define
(
'TITLE'
,
get_string
(
'addtopic'
,
'interaction.forum'
));
$forumid
=
param_integer
(
'forum'
);
$
group
=
get_record_sql
(
'SELECT "group" AS
id
$
forum
=
get_record_sql
(
'SELECT "group" AS
groupid, title
FROM {interaction_instance}
WHERE id = ?'
,
WHERE id = ?
AND deleted != 1'
,
array
(
$forumid
)
);
if
(
!
$
group
)
{
if
(
!
$
forum
)
{
throw
new
NotFoundException
(
"Couldn't find forum with id
$forumid
"
);
}
$membership
=
user_can_access_group
((
int
)
$group
->
id
);
$forumtitle
=
$forum
->
title
;
$membership
=
user_can_access_group
((
int
)
$forum
->
groupid
);
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
...
...
@@ -61,47 +63,37 @@ if ($topicid==0) {
if
(
isset
(
$topicid
))
{
define
(
'TITLE'
,
get_string
(
'edittopic'
,
'interaction.forum'
));
$topic
info
=
get_record_sql
(
'SELECT p.subject, p.body, p.topic AS id, t.sticky, t.closed
$topic
=
get_record_sql
(
'SELECT p.subject, p.body, p.topic AS id, t.sticky, t.closed
, f.id as forumid, f.group as groupid, f.title
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON (p.topic = t.id)
WHERE parent IS NULL
AND topic = ?'
,
ON p.topic = t.id
AND t.deleted != 1
INNER JOIN {interaction_instance} f
ON f.id = t.forum
AND f.deleted != 1
WHERE p.parent IS NULL
AND p.topic = ?'
,
array
(
$topicid
)
);
if
(
!
$topic
info
)
{
if
(
!
$topic
)
{
throw
new
NotFoundException
(
"Couldn't find topic with id
$topicid
"
);
}
$info
=
get_record_sql
(
'SELECT f.group, t.forum
FROM {interaction_forum_topic} t
INNER JOIN {interaction_instance} f
ON (t.forum = f.id)
WHERE t.id = ?'
,
array
(
$topicinfo
->
id
)
);
$forumid
=
$info
->
forum
;
$forumid
=
$topic
->
forumid
;
$forumtitle
=
$topic
->
title
;
$membership
=
user_can_access_group
((
int
)
$
info
->
group
);
$membership
=
user_can_access_group
((
int
)
$
topic
->
group
id
);
$admin
=
(
bool
)(
$membership
&
GROUP_MEMBERSHIP_OWNER
);
$moderator
=
$admin
||
is_forum_moderator
(
$forumid
);
$moderator
=
$admin
||
is_forum_moderator
(
(
int
)
$forumid
);
if
(
!
$moderator
)
{
throw
new
AccessDeniedException
();
}
}
$forum
=
get_record_sql
(
'SELECT title
FROM {interaction_instance}
WHERE id = ?'
,
array
(
$forumid
)
);
require_once
(
'pieforms/pieform.php'
);
...
...
@@ -112,7 +104,7 @@ $editform = array(
'subject'
=>
array
(
'type'
=>
'text'
,
'title'
=>
get_string
(
'subject'
,
'interaction.forum'
),
'defaultvalue'
=>
isset
(
$topic
info
)
?
$topic
info
->
subject
:
null
,
'defaultvalue'
=>
isset
(
$topic
)
?
$topic
->
subject
:
null
,
'rules'
=>
array
(
'required'
=>
true
,
'maxlength'
=>
255
...
...
@@ -123,26 +115,26 @@ $editform = array(
'title'
=>
get_string
(
'body'
,
'interaction.forum'
),
'rows'
=>
10
,
'cols'
=>
70
,
'defaultvalue'
=>
isset
(
$topic
info
)
?
$topic
info
->
body
:
null
,
'defaultvalue'
=>
isset
(
$topic
)
?
$topic
->
body
:
null
,
'rules'
=>
array
(
'required'
=>
true
)
),
'sticky'
=>
array
(
'type'
=>
'checkbox'
,
'title'
=>
get_string
(
'sticky'
,
'interaction.forum'
),
'defaultvalue'
=>
isset
(
$topic
info
)
&&
$topic
info
->
sticky
==
1
?
'checked'
:
null
'defaultvalue'
=>
isset
(
$topic
)
&&
$topic
->
sticky
==
1
?
'checked'
:
null
),
'closed'
=>
array
(
'type'
=>
'checkbox'
,
'title'
=>
get_string
(
'closed'
,
'interaction.forum'
),
'defaultvalue'
=>
isset
(
$topic
info
)
&&
$topic
info
->
closed
==
1
?
'checked'
:
null
'defaultvalue'
=>
isset
(
$topic
)
&&
$topic
->
closed
==
1
?
'checked'
:
null
),
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
isset
(
$topic
info
)
?
get_string
(
'edit'
)
:
get_string
(
'post'
,
'interaction.forum'
),
isset
(
$topic
)
?
get_string
(
'edit'
)
:
get_string
(
'post'
,
'interaction.forum'
),
get_string
(
'cancel'
)
),
'goto'
=>
get_config
(
'wwwroot'
)
.
'interaction/forum/'
.
(
isset
(
$topic
info
)
?
'topic.php?id='
.
$topicid
:
'view.php?id='
.
$forumid
)
'goto'
=>
get_config
(
'wwwroot'
)
.
'interaction/forum/'
.
(
isset
(
$topic
)
?
'topic.php?id='
.
$topicid
:
'view.php?id='
.
$forumid
)
),
),
);
...
...
@@ -225,8 +217,8 @@ function edittopic_submit(Pieform $form, $values) {
$smarty
=
smarty
();
$smarty
->
assign
(
'heading'
,
TITLE
);
$smarty
->
assign
(
'forum'
,
$forum
->
title
);
$smarty
->
assign
(
'editform'
,
$editform
);
$smarty
->
assign
(
'forum'
,
$forumtitle
);
$smarty
->
assign
(
'editform'
,
$editform
);
$smarty
->
display
(
'interaction:forum:edittopic.tpl'
);
?>
htdocs/interaction/forum/index.php
View file @
6ab90c71
...
...
@@ -55,13 +55,16 @@ $forums = get_records_sql_array(
'SELECT f.id, f.title, f.description, COUNT(t.*), s.forum AS subscribed
FROM {interaction_instance} f
LEFT JOIN {interaction_forum_topic} t
ON (t.forum = f.id AND t.deleted != 1)
ON t.forum = f.id
AND t.deleted != 1
INNER JOIN {interaction_forum_instance_config} c
ON (c.forum = f.id AND c.field = \'weight\')
ON c.forum = f.id
AND c.field = \'weight\'
LEFT JOIN {interaction_forum_subscription_forum} s
ON (s.forum = f.id AND s."user" = ?)
WHERE f.group=?
AND f.deleted!=1
ON s.forum = f.id
AND s."user" = ?
WHERE f.group = ?
AND f.deleted != 1
GROUP BY 1, 2, 3, 5, c.value
ORDER BY c.value'
,
array
(
$USER
->
get
(
'id'
),
$groupid
)
...
...
@@ -91,7 +94,7 @@ if ($forums) {
function
subscribe_submit
(
Pieform
$form
,
$values
)
{
global
$USER
;
$groupid
=
param_integer
(
'
group
'
)
;
global
$
group
id
;
if
(
$values
[
'submit'
]
==
get_string
(
'subscribe'
,
'interaction.forum'
))
{
insert_record
(
'interaction_forum_subscription_forum'
,
...
...
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
View file @
6ab90c71
...
...
@@ -7,6 +7,7 @@ $string['closed'] = 'Closed';
$string
[
'count'
]
=
'Count'
;
$string
[
'currentmoderators'
]
=
'Current Moderators'
;
$string
[
'delete'
]
=
'Delete'
;
$string
[
'deletedpost'
]
=
'This post has been deleted'
;
$string
[
'deletepost'
]
=
'Delete post \'%s\''
;
$string
[
'deletepostsure'
]
=
'Are you sure you want to do this? It cannot be undone.'
;
$string
[
'deletetopic'
]
=
'Delete topic \'%s\''
;
...
...
@@ -31,7 +32,7 @@ $string['poster'] = 'Poster';
$string
[
'postreply'
]
=
'Post reply'
;
$string
[
'posts'
]
=
'Posts'
;
$string
[
'potentialmoderators'
]
=
'Potential Moderators'
;
$string
[
're'
]
=
'Re: '
;
$string
[
're'
]
=
'Re:
%s
'
;
$string
[
'regulartopics'
]
=
'Regular topics'
;
$string
[
'reply'
]
=
'Reply'
;
$string
[
'sticky'
]
=
'Sticky'
;
...
...
htdocs/interaction/forum/lib.php
View file @
6ab90c71
...
...
@@ -102,9 +102,16 @@ class PluginInteractionForum extends PluginInteraction {
ON t.forum = sf.forum
) s
INNER JOIN {interaction_forum_topic} t
ON t.deleted != 1 AND t.id = s.topic
ON t.deleted != 1
AND t.id = s.topic
INNER JOIN {interaction_forum_post} p
ON p.sent != 1 AND p.ctime < ? AND p.deleted != 1 AND p.topic = t.id
ON p.sent != 1
AND p.ctime < ?
AND p.deleted != 1
AND p.topic = t.id
INNER JOIN {interaction_instance} f
ON f.id = t.forum
AND f.deleted != 1
ORDER BY type, p.id'
,
array
(
db_format_timestamp
(
$currenttime
-
30
*
60
))
);
...
...
@@ -151,22 +158,13 @@ class InteractionForumInstance extends InteractionInstance {
return
'forum'
;
}
public
function
delete
()
{
parent
::
delete
();
update_record
(
'interaction_forum_topic'
,
(
object
)
array
(
'deleted'
=>
1
),
array
(
'forum'
=>
$this
->
id
)
);
}
}
class
ActivityTypeInteractionForumNewPost
extends
ActivityTypePlugin
{
protected
$postid
;
protected
$type
;
// forum
/
topic
protected
$type
;
// forum
or
topic
public
function
__construct
(
$data
)
{
parent
::
__construct
(
$data
);
...
...
@@ -181,11 +179,15 @@ class ActivityTypeInteractionForumNewPost extends ActivityTypePlugin {
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON t.id = p.topic
AND t.deleted != 1
INNER JOIN {interaction_forum_post} p2
ON p2.parent IS NULL AND p2.topic = t.id
ON p2.parent IS NULL
AND p2.topic = t.id
INNER JOIN {interaction_instance} f
ON t.forum = f.id
WHERE p.id = ?'
,
AND f.deleted != 1
WHERE p.id = ?
AND p.deleted != 1'
,
array
(
$this
->
postid
)
);
$this
->
url
=
get_config
(
'wwwroot'
)
.
'interaction/forum/topic.php?id='
.
$post
->
topicid
;
...
...
htdocs/interaction/forum/topic.php
View file @
6ab90c71
...
...
@@ -34,17 +34,22 @@ define('TITLE', get_string('topic','interaction.forum'));
$topicid
=
param_integer
(
'id'
);
$topic
=
get_record_sql
(
'SELECT p.subject, f.group, f.id AS forumid, f.title as forumtitle, t.closed, sf.forum AS forumsubscribed, st.topic AS topicsubscribed
'SELECT p.subject, f.group, f.id AS forumid, f.title as forumtitle, t.closed,
t.id,
sf.forum AS forumsubscribed, st.topic AS topicsubscribed
FROM {interaction_forum_topic} t
INNER JOIN {interaction_instance} f
ON (t.forum = f.id)
ON t.forum = f.id
AND f.deleted != 1
INNER JOIN {interaction_forum_post} p
ON (p.topic = t.id AND p.parent IS NULL)
ON p.topic = t.id
AND p.parent IS NULL
LEFT JOIN {interaction_forum_subscription_forum} sf
ON (sf.forum = f.id AND sf.user = ?)
ON sf.forum = f.id
AND sf.user = ?
LEFT JOIN {interaction_forum_subscription_topic} st
ON (st.topic = t.id AND st.user = ?)
WHERE t.id = ?'
,
ON st.topic = t.id
AND st.user = ?
WHERE t.id = ?
AND t.deleted != 1'
,
array
(
$USER
->
get
(
'id'
),
$USER
->
get
(
'id'
),
$topicid
)
);
...
...
@@ -78,21 +83,18 @@ if (!$topic->forumsubscribed) {
$posts
=
get_records_sql_array
(
'SELECT p1.id, p1.parent, p1.poster, p1.subject, p1.body, p1.ctime AS posttime, p1.deleted, COUNT(p2.*), e.ctime AS edit, e.user AS editor
FROM interaction_forum_post p1
INNER JOIN interaction_forum_post p2
ON
(
p1.poster = p2.poster
FROM
{
interaction_forum_post
}
p1
INNER JOIN
{
interaction_forum_post
}
p2
ON p1.poster = p2.poster
AND p2.deleted != 1
AND p2.topic IN (
SELECT t.id
FROM interaction_forum_topic t
WHERE t.deleted != 1
AND t.forum IN (
SELECT id
FROM {interaction_instance} f
WHERE "group" = ?
)
))
LEFT JOIN interaction_forum_edit e
INNER JOIN {interaction_forum_topic} t
ON t.deleted != 1
AND p2.topic = t.id
INNER JOIN {interaction_instance} f
ON t.forum = f.id
AND f.deleted != 1
AND f.group = ?
LEFT JOIN {interaction_forum_edit} e
ON (e.post = p1.id)
WHERE p1.topic = ?
GROUP BY 1, 2, 3, 4, 5, 6, 7, 9, 10
...
...
@@ -145,7 +147,7 @@ function buildthread($parent, $parentsubject, &$posts){
$parentsubject
=
$posts
[
$parent
]
->
subject
;
}
else
{
$posts
[
$parent
]
->
subject
=
get_string
(
're'
,
'interaction.forum'
)
.
$parentsubject
;
$posts
[
$parent
]
->
subject
=
get_string
(
're'
,
'interaction.forum'
,
$parentsubject
)
;
}
$children
=
array
();
foreach
(
$posts
as
$index
=>
$post
)
{
...
...
@@ -163,7 +165,7 @@ function buildthread($parent, $parentsubject, &$posts){
function
subscribe_submit
(
Pieform
$form
,
$values
)
{
global
$USER
;
$topicid
=
param_integer
(
'id'
)
;
global
$topicid
;
if
(
$values
[
'submit'
]
==
get_string
(
'subscribe'
,
'interaction.forum'
))
{
insert_record
(
'interaction_forum_subscription_topic'
,
...
...
htdocs/interaction/forum/view.php
View file @
6ab90c71
...
...
@@ -41,7 +41,8 @@ $group = get_record_sql(
FROM {interaction_instance} f
INNER JOIN {group} g
ON g.id = f."group"
WHERE f.id = ?'
,
WHERE f.id = ?
AND f.deleted != 1'
,
array
(
$forumid
)
);
...
...
@@ -80,16 +81,16 @@ if (isset($_POST['subscribe'])) {
}
if
(
$moderator
&&
isset
(
$_POST
[
'update'
]))
{
if
(
!
isset
(
$_POST
[
'sticky'
]))
{
if
(
!
isset
(
$_POST
[
'sticky'
])
||
!
is_numeric
(
implode
(
array_keys
(
$_POST
[
'sticky'
])))
)
{
$_POST
[
'sticky'
]
=
array
();
}
if
(
!
isset
(
$_POST
[
'closed'
]))
{
if
(
!
isset
(
$_POST
[
'closed'
])
||
!
is_numeric
(
implode
(
array_keys
(
$_POST
[
'closed'
])))
)
{
$_POST
[
'closed'
]
=
array
();
}
if
(
!
isset
(
$POST
[
'prevsticky'
]))
{
if
(
!
isset
(
$
_
POST
[
'prevsticky'
])
||
!
is_numeric
(
implode
(
array_keys
(
$_POST
[
'prevsticky'
])))
)
{
$_POST
[
'prevsticky'
]
=
array
();
}
if
(
!
isset
(
$POST
[
'prevclosed'
]))
{
if
(
!
isset
(
$
_
POST
[
'prevclosed'
])
||
!
is_numeric
(
implode
(
array_keys
(
$_POST
[
'prevclosed'
])))
)
{
$_POST
[
'prevclosed'
]
=
array
();
}
updatetopics
(
$_POST
[
'sticky'
],
$_POST
[
'prevsticky'
],
'sticky = 1'
);
...
...
@@ -102,10 +103,14 @@ $forum = get_record_sql(
'SELECT f.title, f.description, f.id, COUNT(t.*), s.forum AS subscribed
FROM {interaction_instance} f
LEFT JOIN {interaction_forum_topic} t
ON (t.forum = f.id AND t.deleted != 1 AND t.sticky != 1)
ON t.forum = f.id
AND t.deleted != 1
AND t.sticky != 1
LEFT JOIN {interaction_forum_subscription_forum} s
ON (s.forum = f.id AND s."user" = ?)
WHERE f.id=?
ON s.forum = f.id
AND s."user" = ?
WHERE f.id = ?
AND f.deleted != 1
GROUP BY 1, 2, 3, 5'
,
array
(
$userid
,
$forumid
)
);
...
...
@@ -126,11 +131,14 @@ $stickytopics = get_records_sql_array(
'SELECT t.id, p1.subject, p1.poster, COUNT(p2.*), t.closed, s.topic AS subscribed
FROM {interaction_forum_topic} t
INNER JOIN {interaction_forum_post} p1
ON (p1.topic = t.id AND p1.parent is null)
ON p1.topic = t.id
AND p1.parent IS NULL
LEFT JOIN {interaction_forum_post} p2
ON (p2.topic = t.id AND p2.deleted != 1)
ON p2.topic = t.id
AND p2.deleted != 1
LEFT JOIN {interaction_forum_subscription_topic} s
ON (s.topic = t.id AND s."user" = ?)
ON s.topic = t.id
AND s."user" = ?
WHERE t.forum = ?
AND t.sticky = 1
AND t.deleted != 1
...
...
@@ -143,11 +151,14 @@ $regulartopics = get_records_sql_array(
'SELECT t.id, p1.subject, p1.poster, COUNT(p2.*), t.closed, s.topic AS subscribed
FROM {interaction_forum_topic} t
INNER JOIN {interaction_forum_post} p1
ON (p1.topic = t.id AND p1.parent IS NULL)
ON p1.topic = t.id
AND p1.parent IS NULL
LEFT JOIN {interaction_forum_post} p2
ON (p2.topic = t.id AND p2.deleted != 1)
ON p2.topic = t.id
AND p2.deleted != 1
LEFT JOIN {interaction_forum_subscription_topic} s
ON (s.topic = t.id AND s."user" = ?)
ON s.topic = t.id
AND s."user" = ?
WHERE t.forum = ?
AND t.sticky != 1
AND t.deleted != 1
...
...
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