Commit cfa20553 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

fix whitespace

parent 3c7da73e
......@@ -53,7 +53,7 @@ $admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator = $admin || is_forum_moderator((int)$info->forum);
if (!$moderator) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
$postinfo = get_record_sql(
......
......@@ -39,7 +39,7 @@ $forum = get_record_sql(
INNER JOIN {interaction_instance} f
ON (f.id = t.forum)
WHERE t.id = ?',
array($topicid)
array($topicid)
);
$membership = user_can_access_group((int)$forum->group);
......@@ -49,7 +49,7 @@ $admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator = $admin || is_forum_moderator((int)$forum->id);
if (!$moderator) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
$postinfo = get_record_sql(
......
......@@ -48,7 +48,7 @@ if ($postid==0) {
}
if (isset($postid)) {
$post = get_record_sql(
$post = get_record_sql(
'SELECT p.subject, p.body, p.parent, p.topic, p.poster, p.ctime, t.forum, f.group
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
......@@ -65,7 +65,7 @@ if (isset($postid)) {
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator = $admin || is_forum_moderator((int)$post->forum);
if (!$moderator &&
($post->poster != $userid
|| (time() - strtotime($post->ctime)) > (30 * 60))) {
......@@ -148,14 +148,14 @@ function editpost_submit(Pieform $form, $values) {
);
if ($topic->poster != $USER->get('id') ||
(time() - strtotime($topic->posttime)) > (30 * 60)) {
insert_record(
'interaction_forum_edit',
(object)array(
'user' => $USER->get('id'),
'post' => $postid,
'ctime' => db_format_timestamp(time())
)
);
insert_record(
'interaction_forum_edit',
(object)array(
'user' => $USER->get('id'),
'post' => $postid,
'ctime' => db_format_timestamp(time())
)
);
}
}
redirect('/interaction/forum/topic.php?id='.$topic->id);
......
......@@ -51,7 +51,7 @@ if ($topicid==0) {
$moderator = $admin || is_forum_moderator($forumid);
if (!$membership) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
}
......@@ -81,7 +81,7 @@ if (isset($topicid)) {
$moderator = $admin || is_forum_moderator((int)$info->forum);
if (!$moderator) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
}
......@@ -112,7 +112,7 @@ $editform =array(
'type' => 'checkbox',
'title' => get_string('sticky', 'interaction.forum'),
'defaultvalue' => isset($topicinfo) && $topicinfo->sticky == 1 ? 'checked' : null
),
),
'closed' => array(
'type' => 'checkbox',
'title' => get_string('closed', 'interaction.forum'),
......@@ -130,8 +130,8 @@ $editform =array(
);
if(!$moderator){
unset($editform['elements']['sticky']);
unset($editform['elements']['closed']);
unset($editform['elements']['sticky']);
unset($editform['elements']['closed']);
}
$editform = pieform($editform);
......@@ -164,13 +164,13 @@ function edittopic_submit(Pieform $form, $values) {
);
}
else {
$post = get_record_sql(
'SELECT id
FROM {interaction_forum_post}
WHERE parent IS NULL
AND topic = ?',
array($topicid)
);
$post = get_record_sql(
'SELECT id
FROM {interaction_forum_post}
WHERE parent IS NULL
AND topic = ?',
array($topicid)
);
update_record(
'interaction_forum_post',
array(
......
......@@ -35,7 +35,7 @@ $group = param_integer('group');
$membership = user_can_access_group($group);
if (!$membership) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
......@@ -77,33 +77,33 @@ foreach ($forums as $forum) {
}
function subscribe_submit(Pieform $form, $values) {
global $USER;
$groupid = param_integer('group');
if ($values['submit'] == get_string('subscribe', 'interaction.forum')) {
insert_record(
global $USER;
$groupid = param_integer('group');
if ($values['submit'] == get_string('subscribe', 'interaction.forum')) {
insert_record(
'interaction_forum_subscription_forum',
(object)array(
'forum' => $values['forum'],
'user' => $USER->get('id')
)
);
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $values['forum'],
'user', $USER->get('id')
);
delete_records_sql(
'DELETE FROM {interaction_forum_subscription_topic}
WHERE topic IN (
SELECT id
FROM {interaction_forum_topic}
WHERE forum = ?
)',
array($values['forum'])
);
}
}
else {
delete_records(
'interaction_forum_subscription_forum',
'forum', $values['forum'],
'user', $USER->get('id')
);
delete_records_sql(
'DELETE FROM {interaction_forum_subscription_topic}
WHERE topic IN (
SELECT id
FROM {interaction_forum_topic}
WHERE forum = ?
)',
array($values['forum'])
);
}
redirect('/interaction/forum/index.php?group=' . $groupid);
}
......
......@@ -3,9 +3,7 @@
class PluginInteractionForum extends PluginInteraction {
public static function instance_config_form($instance=null) {
return array(
);
return array();
}
public static function get_activity_types() {
......@@ -36,7 +34,7 @@ class ActivityTypeInteractionForumNewPost extends ActivityType {
/**
* Is a user a moderator of a given forum
*
*
* @param int $forumid id of forum
* @param int $userid optional id of user, defaults to logged in user
*
......@@ -50,7 +48,7 @@ function is_forum_moderator($forumid, $userid=null) {
else if (!is_int($userid)) {
throw new InvalidArgumentException("non integer user id given to is_forum_moderator: $userid");
}
if (!is_int($forumid)) {
throw new InvalidArgumentException("non integer forum id given to is_forum_moderator: $forumid");
......
......@@ -84,7 +84,7 @@
</tr>
{/foreach}
{/if}
</table>
{$pagination}
......
......@@ -46,7 +46,7 @@ $info = get_record_sql(
$membership = user_can_access_group((int)$info->group);
if (!$membership) {
throw new AccessDeniedException();
throw new AccessDeniedException();
}
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
......@@ -75,19 +75,19 @@ $posts = get_records_sql_array(
$count = count($posts);
for ($i = 0; $i < $count; $i++) {
$postedits = array();
$postedits = array();
if (!empty($posts[$i]->edit)) {
$postedits[] = array(
'edittime' => $posts[$i]->edit,
'editor' => $posts[$i]->editor
'editor' => $posts[$i]->editor
);
}
$temp = $i;
while (isset($posts[$i+1]) && $posts[$i+1]->id == $posts[$temp]->id) {
$i++;
$i++;
$postedits[] = array(
'edittime' => $posts[$i]->edit,
'editor' => $posts[$i]->editor
'editor' => $posts[$i]->editor
);
unset($posts[$i]);
}
......@@ -99,7 +99,7 @@ foreach ($posts as $post) {
$post->editor = true;
}
else {
$post->editor = false;
$post->editor = false;
}
}
......@@ -114,23 +114,23 @@ $smarty->assign('posts', $threadedposts);
$smarty->display('interaction:forum:topic.tpl');
function buildthread($parent, $parentsubject, &$posts){
global $moderator;
global $info;
if ($posts[$parent]->subject) {
$parentsubject = $posts[$parent]->subject;
}
else {
global $moderator;
global $info;
if ($posts[$parent]->subject) {
$parentsubject = $posts[$parent]->subject;
}
else {
$posts[$parent]->subject = get_string('re', 'interaction.forum') . $parentsubject;
}
}
$children = array();
foreach ($posts as $index => $post) {
if ($posts[$index]->parent == $posts[$parent]->id) {
$children[] = buildthread($index, $parentsubject, $posts);
}
}
$smarty = smarty_core();
$smarty->assign('post', $posts[$parent]);
$smarty->assign('children', $children);
foreach ($posts as $index => $post) {
if ($posts[$index]->parent == $posts[$parent]->id) {
$children[] = buildthread($index, $parentsubject, $posts);
}
}
$smarty = smarty_core();
$smarty->assign('post', $posts[$parent]);
$smarty->assign('children', $children);
$smarty->assign('moderator', $moderator);
$smarty->assign('closed', $info->closed);
return $smarty->fetch('interaction:forum:post.tpl');
......
......@@ -219,8 +219,8 @@ function subscribe_topic_submit(Pieform $form, $values) {
'interaction_forum_subscription_topic',
'topic', $values['topic'],
'user', $USER->get('id')
);
}
);
}
redirect('/interaction/forum/view.php?id=' . $forumid . '&offset=' . $offset);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment