protected function preFilter($filterChain)
 {
     if (MessageBoard::isUnderConstruction() && Yii::app()->getUser()->getId() !== 'administrator') {
         Yii::app()->request->redirect("/underconstruction");
         return false;
     } else {
         return true;
     }
 }
 function render()
 {
     $thread_obj = new MessageBoard();
     $request_info = load_info();
     $this->parent_id = $request_info['parent_id'];
     $this->parent_name_hidden = $request_info['parent_name_hidden'];
     $this->parent_type = $request_info['parent_type'];
     $this->header_title = $request_info['header_title'];
     $thread_obj->set_parent($this->parent_id, $this->parent_type);
     $this->Paging["count"] = $thread_obj->get($count = TRUE);
     $this->forum_details = $thread_obj->get($count = FALSE, $this->Paging["show"], $this->Paging["page"], 'changed', 'ASC');
     // Here we finding the ID of group owner
     $group_owner = Group::get_admin_id($_GET['ccid']);
     $this->group_owner_id = $group_owner['user_id'];
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 function render()
 {
     global $base_url;
     $request_info = load_info();
     $parent_id = $request_info['parent_id'];
     $parent_type = $request_info['parent_type'];
     $msg_board_obj = new MessageBoard();
     $msg_board_obj->parent_id = $parent_id;
     $msg_board_obj->parent_type = $parent_type;
     $this->forum_messages = $msg_board_obj->get($count = FALSE, $show = 5, $page = 1, $sort_by = 'changed', $direction = 'DESC');
     if (sizeof($this->forum_messages)) {
         $this->view_all_url = "{$base_url}/forum_home.php?gid={$parent_id}";
     }
     $this->parent_id = $parent_id;
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 private function get_links()
 {
     $network = new Network();
     $condition = array('keyword' => $this->keyword, 'month' => $this->month);
     $this->Paging["count"] = MessageBoard::get_all_network_forum($cnt = TRUE);
     $contents = MessageBoard::get_all_network_forum($cnt = FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC');
     $contents_link = $this->manage_content($contents);
     $this->links = $contents_link;
     return $this->links;
 }
Пример #5
0
 function render()
 {
     global $paging;
     $request_info = load_info();
     $this->parent_id = $request_info['parent_id'];
     $this->parent_type = $request_info['parent_type'];
     $this->parent_name_hidden = $request_info['parent_name_hidden'];
     $this->header_title = $request_info['header_title'];
     $thread_obj = new MessageBoard();
     $thread_obj->set_parent($this->parent_id, $this->parent_type);
     $this->Paging["count"] = $thread_obj->get($count = TRUE);
     $this->Paging['show'] = $paging['show'];
     $this->Paging['page'] = $paging['page'];
     $this->forum_details = $thread_obj->get($count = FALSE, $this->Paging["show"], $this->Paging["page"]);
     $group_data = Group::load_group_by_id((int) $_GET['gid']);
     $this->group_name = $group_data->title;
     $this->topic_count = $this->Paging["count"];
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 function get_forum_links()
 {
     global $paging, $base_url;
     $request_info = load_info();
     $this->parent_id = $request_info['parent_id'];
     $this->parent_type = $request_info['parent_type'];
     $this->parent_name_hidden = $request_info['parent_name_hidden'];
     $this->header_title = $request_info['header_title'];
     $thread_obj = new MessageBoard();
     $thread_obj->set_parent($this->parent_id, $this->parent_type);
     $this->Paging["count"] = $thread_obj->get($count = TRUE);
     $forum_details = $thread_obj->get($count = FALSE, $this->Paging["show"], $this->Paging["page"]);
     $cnt = count($forum_details);
     if ($cnt > 0) {
         for ($i = 1; $i <= $cnt; $i++) {
             $forum_details[$i]['hyper_link'] = $base_url . '/forum_messages.php?mid=' . $forum_details[$i]['boardmessage_id'] . '&amp;ccid=' . $_GET['gid'];
             $forum_details[$i]['edit_link'] = $base_url . '/edit_forum.php?mid=' . $forum_details[$i]['boardmessage_id'] . '&amp;gid=' . $_GET['gid'];
             $forum_details[$i]['delete_link'] = $base_url . '/deleteforumbyadmin.php?mid=' . $forum_details[$i]['boardmessage_id'] . '&amp;ccid=' . $_GET['gid'] . '" onclick="javascript:return confirm(\'Are you sure you want to delete this forum ? \');"';
         }
     }
     return $forum_details;
 }
        try {
            MessageBoard::delete_all_in_parent($mid, PARENT_TYPE_MESSAGE);
        } catch (Exception $e) {
            // catch if delete is fail
        }
        $location = $_SERVER['HTTP_REFERER'];
        header("Location: {$location}");
        exit;
    }
} else {
    // When User wants to delete repllies of forum
    $mid = $_GET['mid'];
    $params['action'] = 'delete_rep';
    // fiding the parent for the replly
    $request_info = load_info();
    $msg = new MessageBoard();
    $rep_details = $msg->get_by_id($_REQUEST['mid']);
    $cond_array = array('boardmessage_id' => $request_info['parent_id']);
    $forum_detail = MessageBoard::get_forums($cond_array);
    $owner = Group::get_admin_id($_REQUEST['ccid']);
    $params['forum_owner'] = $forum_detail[0]->user_id;
    $params['rep_owner'] = $rep_details['user_id'];
    $params['group_owner'] = $owner['user_id'];
    if (user_can($params)) {
        try {
            MessageBoard::delete($mid);
        } catch (Exception $e) {
            // catch if delete is fail
        }
        $location = $_SERVER['HTTP_REFERER'];
        header("Location: {$location}");
Пример #8
0
    </div>
</div>

<div class="subnav navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <?php 
if (false) {
    ?>
            <?php 
    //if (  MessageBoard::isUnderConstruction()   ):
    ?>
                <h3 style="color: red;">
                    <i class="fa fa-asterisk"></i>
                    <?php 
    echo MessageBoard::model()->find()->messageStatus;
    ?>
                    <small>
                        <?php 
    echo MessageBoard::model()->find()->fullMessage;
    ?>
                    </small>
                </h3>
            <?php 
}
?>

        </div><!-- container -->
    </div><!-- navbar-inner -->
</div><!-- subnav -->
Пример #9
0
 /* Function for Filtering the POST data Array */
 filter_all_post($_POST);
 $error = FALSE;
 $msg = '';
 $title = trim($_POST['title_form']);
 $body = trim($_POST['body']);
 if ($title == '') {
     $error = TRUE;
     $msg .= "<br><font color=\"red\">Please specify title</font>";
 }
 if ($body == '') {
     $error = TRUE;
     $msg .= "<br><font color=\"red\">Please enter contents</font>";
 }
 if (!$error) {
     $cat_obj = new MessageBoard();
     $cat_obj->set_parent($parent_id, $parent_type);
     $cat_obj->title = $title;
     $cat_obj->body = $body;
     $cat_obj->user_id = $uid;
     if (!$_POST['chk_allow_anonymous']) {
         $cat_obj->allow_anonymous = 0;
     } else {
         $cat_obj->allow_anonymous = 1;
     }
     try {
         $mid = $cat_obj->save();
     } catch (PAException $e) {
         $msg = "Error occured in saving thread\n";
         $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
         $error = TRUE;
Пример #10
0
        exit;
    }
}
if (isset($_POST['submit'])) {
    $txt_title = trim($_POST['txt_title']);
    $textarea_contents = trim($_POST['textarea_contents']);
    if ($txt_title == '') {
        $post_error = TRUE;
        $msg .= "<font color=\"red\">Please specify title</font><br>";
    }
    if ($textarea_contents == '') {
        $post_error = TRUE;
        $msg .= "<font color=\"red\">Please enter contents</font><br>";
    }
    if (!$error) {
        $cat_obj = new MessageBoard();
        if ($parent_id) {
            $cat_obj->set_category_id($parent_id);
        } else {
            if ($group_id) {
                $cat_obj->set_collection_id($group_id);
            }
        }
        $cat_obj->title = $txt_title;
        $cat_obj->body = $textarea_contents;
        $cat_obj->user_id = $uid;
        if (!$_POST['chk_allow_anonymous']) {
            $cat_obj->allow_anonymous = 0;
        } else {
            $cat_obj->allow_anonymous = 1;
        }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return MessageBoard the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = MessageBoard::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #12
0
/**
This function is used for loading the information from the get variables
Usage:on forum page for message board
**/
function load_info()
{
    $request_info = array();
    if (!empty($_REQUEST['gid'])) {
        $request_info['parent_id'] = $_REQUEST['gid'];
        $request_info['parent_name_hidden'] = 'gid';
        $request_info['parent_type'] = PARENT_TYPE_COLLECTION;
        $obj = new Group();
        $obj->load($_REQUEST['gid']);
        $request_info['header_title'] = stripslashes($obj->title);
    } else {
        if (!empty($_REQUEST['mid'])) {
            $request_info['parent_id'] = $_REQUEST['mid'];
            $request_info['parent_name_hidden'] = 'mid';
            $request_info['parent_type'] = PARENT_TYPE_MESSAGE;
            $obj = new MessageBoard();
            $data = $obj->get_by_id($_REQUEST['mid']);
            $request_info['header_title'] = stripslashes($data['title']);
        } else {
            if (!empty($_REQUEST['cid'])) {
                $content = Content::load_content((int) $_REQUEST['cid'], (int) PA::$login_uid);
                $ccid = $content->parent_collection_id;
                if ($ccid != 0 && $ccid != -1) {
                    //here parent collection 0 is for deleted content and -1 is for home page routed thus checking that its not a group id
                    $content_collection = ContentCollection::load_collection((int) $ccid, PA::$login_uid);
                    if ($content_collection->type == GROUP_COLLECTION_TYPE) {
                        $request_info['parent_id'] = $ccid;
                        $request_info['parent_name_hidden'] = 'gid';
                        $request_info['parent_type'] = PARENT_TYPE_COLLECTION;
                    }
                }
            } else {
                return false;
            }
        }
    }
    return $request_info;
}
function peopleaggregator_newBoardMessage($args)
{
    if ($args['authToken']) {
        $user = User::from_auth_token($args['authToken']);
    } else {
        $user = NULL;
    }
    $context = $args['context'];
    $title = $args['title'];
    $body = $args['content'];
    $allow_anon = $args['allowAnonymous'];
    if (preg_match("/^group:(\\d+)\$/", $context, $m)) {
        // posting a new topic to a group
        $parent_id = $m[1];
        $parent_type = "collection";
        //FIXME: check that we can access the group.  or does MessageBoard do this?
    } else {
        if (preg_match("/^msg:(\\d+)\$/", $context, $m)) {
            // replying to an existing topic
            $parent_id = $m[1];
            $parent_type = "message";
            //FIXME: load parent, make sure it is a topic
            //FIXME: check if we are allowed to access this group
        } else {
            throw new PAException(INVALID_ID, "You can only post a message to a group or a topic.  Parent ID '{$context}' is not allowed.");
        }
    }
    // create topic
    $cat_obj = new MessageBoard();
    $cat_obj->set_parent($parent_id, $parent_type);
    $cat_obj->title = $title;
    $cat_obj->body = $body;
    $cat_obj->user_id = $user ? $user->user_id : NULL;
    $cat_obj->allow_anonymous = $allow_anon ? 1 : 0;
    $mid = $cat_obj->save($cat_obj->user_id);
    return array('success' => TRUE, 'id' => "msg:" . $mid);
}
Пример #14
0
             $msg[] = "Please enter a valid email address";
         } else {
             $email = trim($_POST['email']);
         }
     }
 }
 if ($title == '') {
     $error = TRUE;
     $msg[] = "-> Please specify title for your comments.";
 }
 if ($body == '') {
     $error = TRUE;
     $msg[] = "-> Please enter your comments.";
 }
 if (!$error) {
     $cat_obj = new MessageBoard();
     $cat_obj->set_parent($parent_id, $parent_type);
     $cat_obj->title = $title;
     $cat_obj->body = $body;
     $cat_obj->user_id = $uid;
     $cat_obj->user_name = $name;
     $cat_obj->email = $email;
     if (!$_POST['chk_allow_anonymous']) {
         $cat_obj->allow_anonymous = 0;
     } else {
         $cat_obj->allow_anonymous = 1;
     }
     try {
         $mid = $cat_obj->save($_SESSION['user']['id']);
     } catch (PAException $e) {
         $msg = "Error occured in saving thread\n";
Пример #15
0
 /**
  * @return bool Returns true if message board is underconstruction . else returns false.
  */
 public static function isUnderConstruction()
 {
     /*@var $model MessageBoard*/
     $model = MessageBoard::model()->find();
     return $model->messageType == "warning" ? true : false;
 }
Пример #16
0
header("Content-type:text/html;charset=utf-8");
abstract class MessageBoardHandler
{
    public function __construct()
    {
    }
    public abstract function filter($msg);
}
class MessageBoard extends MessageBoardHandler
{
    public function filter($msg)
    {
        return "处理留言板上的内容|" . $msg;
    }
}
$obj = new MessageBoard();
echo $obj->filter("一定要学好装饰模式<br/>");
// --- 以下是使用装饰模式 ----
class MessageBoardDecorator extends MessageBoardHandler
{
    private $_handler = null;
    public function __construct($handler)
    {
        parent::__construct();
        $this->_handler = $handler;
    }
    public function filter($msg)
    {
        return $this->_handler->filter($msg);
    }
}
Пример #17
0
/**
 * SkeliCZ - Login page
 *
 * @package    SkeliCZ
 * @author     Vitex <*****@*****.**>
 * @copyright  2009-2016 info@vitexsoftware.cz (G)
 */
namespace SkeliCZ;

require_once 'includes/SkeliInit.php';
$oPage->addCss('body { background-image: url("images/skelilogo.jpg"); background-position: left top;  background-repeat: no-repeat; }');
$oPage->addItem(new PageTop(_('Messages for skeli')));
$indexrow = new \Ease\TWB\Row();
$indexrow->addColumn(2);
$messageBoardcolumn = $indexrow->addColumn(4, new \Ease\Html\H1Tag(_('Messages')));
$messageBoard = new MessageBoard();
$messageBoardcolumn->addItem(new NewsShow($messageBoard));
$formColumn = $indexrow->addColumn(6, new \Ease\Html\H1Tag(_('Write message')));
if ($oUser->getUserID()) {
    $id = $oPage->getRequestValue('id', 'int');
    if ($id) {
        $messageBoard->loadFromSQL($id);
    }
    if ($oPage->isPosted()) {
        $messageBoard->takeData($_POST);
        $messageBoard->setDataValue('author', $oUser->getUserID());
        if ($messageBoard->saveToSQL()) {
            $messageBoard->addStatusMessage(_('Message was saved'), 'success');
        } else {
            $messageBoard->addStatusMessage(_('Message was not saved'), 'warning');
        }
Пример #18
0
header("Content-type:text/html;charset=utf-8");
abstract class MessageBoardHandler
{
    public function __construct()
    {
    }
    public abstract function filter($msg);
}
class MessageBoard extends MessageBoardHandler
{
    public function filter($msg)
    {
        return "处理留言板上的内容|" . $msg;
    }
}
$obj = new MessageBoard();
echo $obj->filter("一定要学好装饰模式\n");
//以下是用装饰模式
class MessageBoardDecorator extends MessageBoardHandler
{
    private $_handler = null;
    public function __construct($handler)
    {
        parent::__construct();
        $this->_handler = $handler;
    }
    public function filter($msg)
    {
        return $this->_handler->filter($msg);
    }
}
Пример #19
0
    } catch (PAException $e) {
        $msg = "Error occured in retreiving group information\n";
        $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
        $error_code = $e->code;
        $error = TRUE;
    }
    if (!Group::member_exists((int) $obj_group->collection_id, (int) $_SESSION['user']['id'])) {
        $error = TRUE;
    }
    if ($error) {
        $redirect_msg = "Group does not exist.";
        $back_to_page = $base_url . '/forums.php';
        header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}");
        exit;
    }
    $thread_obj = new MessageBoard();
    $thread_obj->set_collection_id($group_id);
    $arr_threads = $thread_obj->get();
}
html_header($HTML_TITLE, '');
$content =& new Template(CURRENT_THEME_FSPATH . "/threads.tpl");
if ($error == TRUE) {
    $content->set('msg', $msg);
}
$content->set('uid', $uid);
$content->set('gid', $group_id);
$header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('user_name', $first_name . " " . $last_name);
if ($network_info) {
    $header->set_object('network_info', $network_info);
}
Пример #20
0
function edit_forum_topic($_form)
{
    filter_all_post($_POST);
    $error = FALSE;
    $msg = '';
    $title = trim($_POST['forum_title']);
    $body = trim($_POST['forum_contents']);
    if (empty($title)) {
        $error = TRUE;
        $msg .= "Please specify a title for the forum topic";
    }
    if (empty($body)) {
        $error = TRUE;
        $msg .= "Please enter small description of the topic";
    }
    if (!$error) {
        $request_info = load_info();
        $cat_obj = new MessageBoard();
        $cat_obj->title = $title;
        $cat_obj->body = $body;
        $cat_obj->boardmessage_id = $_REQUEST['mid'];
        if ($_POST['chk_allow_anonymous'] != ALLOW_ANONYMOUS) {
            $cat_obj->allow_anonymous = 0;
        } else {
            $cat_obj->allow_anonymous = 1;
        }
        try {
            $mid = $cat_obj->save($login_uid, NULL);
        } catch (PAException $e) {
            $msg = "Error occured in saving data";
            $error = TRUE;
        }
    }
    $msg_array = array();
    $msg_array['failure_msg'] = $msg;
    $msg_array['success_msg'] = NULL;
    $return_array = array('msg' => $msg_array);
    return $return_array;
}
Пример #21
0
<?php

$board = new MessageBoard();
$board->go();
class MessageBoard
{
    protected $db;
    protected $form_errors = array();
    protected $inTransaction = false;
    public function __construct()
    {
        set_exception_handler(array($this, 'logAndDie'));
        $this->db = new PDO('sqlite:/tmp/message.db');
        $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    public function go()
    {
        // The value of $_REQUEST['cmd'] tells us what to do
        $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'show';
        switch ($cmd) {
            case 'read':
                // read an individual message
                $this->read();
                break;
            case 'post':
                // display the form to post a message
                $this->post();
                break;
            case 'save':
                // save a posted message
                if ($this->valid()) {
Пример #22
0
        $parent_cat_obj->load();
        $parent_cat_name = stripslashes($parent_cat_obj->name);
        $parent_cat_description = stripslashes($parent_cat_obj->description);
    } catch (PAException $e) {
        $msg = "Error occured in retreiving category information\n";
        $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
        $error_code = $e->code;
        $error = TRUE;
    }
    if ($error) {
        $redirect_msg = "Category does not exist.";
        $back_to_page = $base_url . '/forums.php';
        header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}");
        exit;
    }
    $thread_obj = new MessageBoard();
    $thread_obj->set_category_id($parent_id);
    $arr_threads = $thread_obj->get();
}
html_header($HTML_TITLE, '');
?>

<?php 
$content =& new Template(CURRENT_THEME_FSPATH . "/threads.tpl");
if ($error == TRUE) {
    $content->set('msg', $msg);
}
$content->set('uid', $uid);
$content->set('cid', $parent_id);
$header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('user_name', $first_name . " " . $last_name);
Пример #23
0
 /**
  * builds list of children of a given category
  * @access public static
  * @param int parent_id ID of category
  * array of objects of all children
  */
 static function build_children_list($parent_id, $attached_type = NULL)
 {
     Logger::log("Enter: function Category::build_children_list");
     $cat_obj = new category_item_list();
     $position = Category::get_position($parent_id);
     if ($position) {
         $sql = "SELECT * FROM {categories} WHERE position RLIKE  '^" . $position . "[0-9]+>\$'";
         $res = Dal::query($sql);
         $total_threads = NULL;
         if ($res->numRows() > 0) {
             while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
                 //         $total_threads = MessageBoard::get_threads_count_of_category($row->category_id);
                 if ($attached_type == 'MessageBoard') {
                     $total_threads = MessageBoard::get_threads_count_of_category($row->category_id);
                 }
                 if ($attached_type == 'Default') {
                     $total_threads = Group::get_threads_count_of_category($row->category_id);
                 }
                 if ($attached_type == 'Network') {
                     $total_threads = Network::get_threads_count_of_category($row->category_id);
                 }
                 $category_item = new category_item($row->category_id, $row->name, $row->description, $total_threads, $row->position, $row->type);
                 $cat_obj->add_cat_item($category_item);
             }
         }
         $cat_list = $cat_obj->get_cat_list();
     } else {
         $cat_list = '';
     }
     Logger::log("Exit: function Category::build_children_list");
     return $cat_list;
 }
Пример #24
0
 /**
  * delete collection
  * @access private
  */
 public function delete()
 {
     Logger::log("Enter: Group::delete()");
     $res = Dal::query("DELETE FROM {groups_users} WHERE group_id = ?", array($this->collection_id));
     ModerationQueue::remove_content_from_collection($this->collection_id);
     $res = Dal::query("DELETE FROM {groups} WHERE group_id = ?", array($this->collection_id));
     // delete all forums in a group
     MessageBoard::delete_all_in_parent($this->collection_id, 'collection');
     parent::delete();
     Logger::log("Exit: Group::delete()");
 }
Пример #25
0
 /**
  * function used to delete a group or groups.
  * @param $user_id and $group_id
  */
 public function delete_user_groups($user_id, $group_id = NULL)
 {
     //getting user groups
     $group_users = Group::get_user_groups($user_id);
     if (count($group_users) > 0) {
         foreach ($group_users as $group) {
             $this->collection_id = $group['gid'];
             if ($group['access'] == OWNER) {
                 //delete all data related to that group
                 //deleting content posted by other users in that group
                 $this->delete();
             } else {
                 if ($group['access'] == MEMBER) {
                     $MessageBoard = new MessageBoard();
                     $MessageBoard->user_id = $user_id;
                     $MessageBoard->delete_user_forums();
                     //voiding user membership
                     $this->leave($user_id);
                 }
             }
         }
     }
 }
 /**
  * function used to delete all the forum and replies given by a user.
  * if group_id is given then the forums of that particular group will be deleted
  * otherwise all forums related to that in all the groups will be deleted
  */
 public function delete_user_forums()
 {
     Logger::log("Enter: function MessageBoard::delete_user_forums");
     //$forums = MessageBoard::get_forums( $params );
     // delete replies posted by user
     Dal::query("DELETE FROM {boardmessages} WHERE user_id = {$this->user_id} AND parent_type = '" . PARENT_TYPE_MESSAGE . "'");
     //find threads
     //now we have only threads left
     $sql = "SELECT  boardmessage_id FROM {boardmessages} WHERE user_id = {$this->user_id} ";
     $res = Dal::query($sql);
     if ($res->numRows() > 0) {
         while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
             $pid = $row->boardmessage_id;
             MessageBoard::delete_replies($pid);
             //delete replies
             MessageBoard::delete($pid);
             //delete the board message itself
         }
     }
     Logger::log("Exit: function MessageBoard::delete_user_forums");
 }
Пример #27
0
echo "This script has huge security problems, so has been disabled.  It's also not used in the Beta theme, so you should never get here.";
exit;

$login_required = TRUE;
include "includes/page.php";
require_once "../api/MessageBoard/MessageBoard.php";

$back = $_REQUEST['back_page'];
//print_r($_REQUEST);exit;
$mid = trim($_REQUEST['message_id']);
if ($_REQUEST['do'] == 'edit') {
  filter_all_post($_REQUEST);  
  $title = trim($_REQUEST['edit_title']);
  $body = trim($_REQUEST['edit_body']);
  
  $m = new MessageBoard();
  $m->title = $title;
  $m->body = $body;
  $m->boardmessage_id = $mid;
  $id = $m->save($uid=NULL,$is_insert=0);
}
if ($_REQUEST['do'] == 'delete') {
  
  MessageBoard::delete_all_in_parent($mid,PARENT_TYPE_MESSAGE);
}
if ($_REQUEST['groupurl']) {
  $url = $_REQUEST['groupurl'];
  header("Location:$url"); exit;
}
header("location:$back");exit;
?>
Пример #28
0
include "includes/page.php";
include_once "{$path_prefix}/ext/Group/Group.php";
require_once "{$path_prefix}/api/MessageBoard/MessageBoard.php";
/*including Js files */
$parameter .= js_includes('common.js');
// for query count
global $query_count_on_page, $login_uid;
$query_count_on_page = 0;
$mid = $_REQUEST['mid'];
$request_info = load_info();
$parent_id = $request_info['parent_id'];
$parent_type = $request_info['parent_type'];
$member_type = Group::get_user_type($login_uid, $parent_id);
$gid = (int) $_GET['gid'];
$group_data = ContentCollection::load_collection((int) $gid, $login_uid);
$cat_obj = new MessageBoard();
$edit_data = $cat_obj->get_by_id($mid);
$params['action'] = 'edit_forum';
$params['group_owner'] = $group_data->author_id;
$params['forum_owner'] = $edit_data['user_id'];
if (user_can($params)) {
    $is_edit = TRUE;
} else {
    $is_edit = FALSE;
    $msg = 'You are not authorized to edit forum';
}
function setup_module($column, $module, $obj)
{
    global $group_data, $gid, $request_info, $is_edit, $edit_data, $member_type;
    $obj->gid = $gid;
    switch ($module) {