/****************************************************************/ /* Copyright (c) 2002-2010 */ /* Inclusive Design Institute */ /* http://atutor.ca */ /* */ /* This program is free software. You can redistribute it and/or*/ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /****************************************************************/ // $Id$ define('AT_INCLUDE_PATH', '../../../include/'); require_once AT_INCLUDE_PATH . 'vitals.inc.php'; // authenticate ot+oid.. $owner_type = abs($_REQUEST['ot']); $owner_id = abs($_REQUEST['oid']); if (!($owner_status = blogs_authenticate($owner_type, $owner_id))) { $msg->addError('ACCESS_DENIED'); header('Location: ' . url_rewrite('mods/_standard/blogs/index.php')); exit; } $id = abs($_REQUEST['id']); $auth = ''; if (!query_bit($owner_status, BLOGS_AUTH_WRITE)) { $auth = 'private=0 AND '; } $sql = "SELECT member_id, private, date, title, body FROM %sblog_posts WHERE {$auth} owner_type=%d AND owner_id=%d AND post_id=%d ORDER BY date DESC"; $post_row = queryDB($sql, array(TABLE_PREFIX, BLOGS_GROUP, $owner_id, $id), TRUE); if (isset($_POST['submit']) && $_SESSION['member_id']) { // post a comment $_POST['body'] = $addslashes(trim($_POST['body'])); $_POST['private'] = abs($_POST['private']);
/* Copyright (c) 2002-2010 */ /* Inclusive Design Institute */ /* http://atutor.ca */ /* */ /* This program is free software. You can redistribute it and/or*/ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /****************************************************************/ // $Id$ define('AT_INCLUDE_PATH', '../../../include/'); require (AT_INCLUDE_PATH.'vitals.inc.php'); // authenticate ot+oid .... $owner_type = abs($_REQUEST['ot']); $owner_id = abs($_REQUEST['oid']); if (!($owner_status = blogs_authenticate($owner_type, $owner_id)) || !query_bit($owner_status, BLOGS_AUTH_WRITE)) { $msg->addError('ACCESS_DENIED'); header('Location: index.php'); exit; } if (isset($_POST['cancel'])) { $msg->addFeedback('CANCELLED'); header('Location: '.url_rewrite('mods/_standard/blogs/view.php?ot='.BLOGS_GROUP.SEP.'oid='.$_POST['oid'], AT_PRETTY_URL_IS_HEADER)); exit; } else if (isset($_POST['submit'])) { $_POST['title'] = $addslashes(trim($_POST['title'])); $_POST['body'] = $addslashes(trim($_POST['body'])); $id = abs($_POST['id']); if ($_POST['body'] == '') {
$rows_groups = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $_SESSION['course_id'])); echo '<ol id="tools">'; $blogs = false; foreach ($rows_groups as $row) { if (strpos($row['modules'], '_standard/blogs') !== FALSE) { // retrieve the last posted date/time from this blog $sql = "SELECT MAX(date) AS date FROM %sblog_posts WHERE owner_type=%d AND owner_id=%d"; $date_row = queryDB($sql, array(TABLE_PREFIX, BLOGS_GROUP, $row['group_id']), TRUE); if (count($date_row) > 0) { $last_updated = ' - ' . _AT('last_updated', AT_date(_AT('forum_date_format'), $date_row['date'], AT_DATE_MYSQL_DATETIME)); } else { $last_updated = ''; } echo '<li class="top-tool"><a href="' . url_rewrite('mods/_standard/blogs/view.php?ot=' . BLOGS_GROUP . SEP . 'oid=' . $row['group_id']) . '">' . AT_print($row['title'], 'blog_posts.title') . $last_updated . '</a>'; // Check if subscribed and make appropriate button if (blogs_authenticate(BLOGS_GROUP, $row['group_id'])) { if ($sub->is_subscribed('blog', $_SESSION['member_id'], $row['group_id'])) { echo '<a href="' . $_SERVER['PHP_SELF'] . '?group_id=' . $row['group_id'] . SEP . 'subscribe=unset"><img border="0" src="' . AT_BASE_HREF . 'images/unsubscribe-envelope.png" alt="" /> ' . _AT('blog_unsubscribe') . '</a>'; } else { echo '<a href="' . $_SERVER['PHP_SELF'] . '?group_id=' . $row['group_id'] . SEP . 'subscribe=set"><img border="0" src="' . AT_BASE_HREF . 'images/subscribe-envelope.png" alt="" /> ' . _AT('blog_subscribe') . '</a>'; } } echo '</li>'; $blogs = true; } } echo '</ol>'; if (!$blogs) { echo _AT('none_found'); } ?>