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

fixed capitalisation

parent c28d8ccf
......@@ -95,7 +95,7 @@ function deletepost_submit(Pieform $form, $values) {
array('id' => $postid)
);
$topic = get_record_sql(
'SELECT topic as id
'SELECT topic AS id
FROM {interaction_forum_post}
WHERE id = ?',
array($postid)
......
......@@ -40,11 +40,26 @@ if ($postid==0) {
unset($postid);
$parentid = param_integer('parent');
$topic = get_record_sql(
'SELECT topic
FROM {interaction_forum_post}
WHERE id = ?',
'SELECT p.topic AS id, t.closed, f.id as forum, f.group
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON (p.topic = t.id)
INNER JOIN {interaction_instance} f
ON (t.forum = f.id)
WHERE p.id = ?',
array($parentid)
);
$membership = user_can_access_group((int)$topic->group);
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$moderator = $admin || is_forum_moderator((int)$topic->forum);
if (!$membership || (!$moderator && $topic->closed)) {
throw new AccessDeniedException();
}
if (!$topic) {
throw new NotFoundException("Couldn't find topic with id $parentid");
}
......@@ -122,7 +137,7 @@ function editpost_submit(Pieform $form, $values) {
if ($postid==0) {
$parentid = param_integer('parent');
$topic = get_record_sql(
'SELECT topic as id
'SELECT topic AS id
FROM {interaction_forum_post}
WHERE id = ?',
array($parentid)
......@@ -142,7 +157,7 @@ function editpost_submit(Pieform $form, $values) {
}
else {
$topic = get_record_sql(
'SELECT topic as id, poster, ctime as posttime
'SELECT topic AS id, poster, ctime AS posttime
FROM {interaction_forum_post}
WHERE id = ?',
array($postid)
......@@ -171,7 +186,7 @@ function editpost_submit(Pieform $form, $values) {
}
$smarty = smarty();
$smarty->assign('editform',$editform);
$smarty->assign('editform', $editform);
$smarty->display('interaction:forum:editpost.tpl');
?>
......@@ -38,7 +38,7 @@ if ($topicid==0) {
unset($topicid);
$forumid = param_integer('forum');
$group = get_record_sql(
'SELECT "group" as id
'SELECT "group" AS id
FROM {interaction_instance}
WHERE id = ?',
array($forumid)
......@@ -61,7 +61,7 @@ if ($topicid==0) {
if (isset($topicid)) {
$topicinfo = get_record_sql(
'SELECT p.subject, p.body, p.topic as id, t.sticky, t.closed
'SELECT p.subject, p.body, p.topic AS id, t.sticky, t.closed
FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t
ON (p.topic = t.id)
......
......@@ -45,7 +45,7 @@ if (!$membership) {
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
$forums = get_records_sql_array(
'SELECT f.id, f.title, f.description, COUNT(t.*), s.forum as subscribed
'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)
......@@ -63,21 +63,23 @@ $forums = get_records_sql_array(
require_once('pieforms/pieform.php');
$i = 0;
foreach ($forums as $forum) {
$forum->subscribe = pieform(array(
'name' => 'subscribe'.$i++,
'successcallback' => 'subscribe_submit',
'elements' => array(
'submit' => array(
'type' => 'submit',
'value' => $forum->subscribed ? get_string('unsubscribe', 'interaction.forum') : get_string('subscribe', 'interaction.forum')
),
'forum' => array(
'type' => 'hidden',
'value' => $forum->id
if ($forums) {
foreach ($forums as $forum) {
$forum->subscribe = pieform(array(
'name' => 'subscribe'.$i++,
'successcallback' => 'subscribe_submit',
'elements' => array(
'submit' => array(
'type' => 'submit',
'value' => $forum->subscribed ? get_string('unsubscribe', 'interaction.forum') : get_string('subscribe', 'interaction.forum')
),
'forum' => array(
'type' => 'hidden',
'value' => $forum->id
)
)
)
));
));
}
}
function subscribe_submit(Pieform $form, $values) {
......
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