Example #1
0
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'update') {
        if (!empty($_REQUEST['posts'])) {
            fn_update_discussion_posts($_REQUEST['posts']);
        }
    }
    return;
}
if ($mode == 'update') {
    if (!fn_allowed_for('ULTIMATE')) {
        $discussion = fn_get_discussion($_REQUEST['company_id'], 'M', true, $_REQUEST);
        if (!empty($discussion) && $discussion['type'] != 'D') {
            Registry::set('navigation.tabs.discussion', array('title' => __('discussion_title_company'), 'js' => true));
            Registry::get('view')->assign('discussion', $discussion);
        }
    }
}
Example #2
0
 public function update($id, $params)
 {
     if (fn_allowed_for('MULTIVENDOR') && $this->auth['user_type'] == 'V') {
         return array('status' => Response::STATUS_FORBIDDEN);
     }
     $data = array();
     $status = Response::STATUS_BAD_REQUEST;
     if ($this->getParentName() == 'products') {
         $parent_product = $this->getParentData();
         $params['object_id'] = $parent_product['product_id'];
         $params['object_type'] = 'P';
     }
     if ($this->getPost($id, $params)) {
         $posts = array($id => $params);
         if (fn_update_discussion_posts($posts)) {
             $status = Response::STATUS_OK;
             $data = array('post_id' => $id);
         }
     }
     return array('status' => $status, 'data' => $data);
 }