Beispiel #1
0
 /**
  * Updates forum plugin configuration
  *
  * @return boolean
  */
 public function process()
 {
     $values = $this->getValues();
     $enableAttachmentsValue = empty($values['enableAttachments']) ? false : (bool) $values['enableAttachments'];
     $config = OW::getConfig();
     $enableAttachmentsValue = true;
     //TODO tmp solution, remove this assignment when it will be necessary
     $config->saveConfig('mailbox', 'enable_attachments', $enableAttachmentsValue);
     $config->saveConfig('mailbox', 'show_all_members', 0);
     $send_message_interval = empty($values['send_message_interval']) ? 0 : (int) $values['send_message_interval'];
     $config->saveConfig('mailbox', 'send_message_interval', $send_message_interval);
     $authorization = OW::getAuthorization();
     $groupName = 'mailbox';
     $authorization->deleteAction($groupName, 'read_message');
     $authorization->deleteAction($groupName, 'send_message');
     $authorization->deleteAction($groupName, 'reply_to_message');
     $authorization->deleteAction($groupName, 'read_chat_message');
     $authorization->deleteAction($groupName, 'send_chat_message');
     $authorization->deleteAction($groupName, 'reply_to_chat_message');
     switch ($values['active_mode_list']) {
         case 'chat':
             $modes = array($values['active_mode_list']);
             $config->saveConfig('mailbox', 'active_modes', json_encode($modes));
             $authorization->addAction($groupName, 'read_chat_message');
             $authorization->addAction($groupName, 'send_chat_message');
             $authorization->addAction($groupName, 'reply_to_chat_message');
             break;
         case 'mail':
             $modes = array($values['active_mode_list']);
             $config->saveConfig('mailbox', 'active_modes', json_encode($modes));
             $authorization->addAction($groupName, 'read_message');
             $authorization->addAction($groupName, 'send_message');
             $authorization->addAction($groupName, 'reply_to_message');
             break;
         case 'mailchat':
             $modes = array('mail', 'chat');
             $config->saveConfig('mailbox', 'active_modes', json_encode($modes));
             $authorization->addAction($groupName, 'read_message');
             $authorization->addAction($groupName, 'send_message');
             $authorization->addAction($groupName, 'reply_to_message');
             $authorization->addAction($groupName, 'read_chat_message');
             $authorization->addAction($groupName, 'send_chat_message');
             $authorization->addAction($groupName, 'reply_to_chat_message');
             break;
     }
     if ($values['active_mode_list'] != 'mail') {
         $show_all_members = empty($values['show_all_members']) ? 0 : 1;
         $config->saveConfig('mailbox', 'show_all_members', $show_all_members);
     }
     if (OW::getPluginManager()->isPluginActive('usercredits')) {
         USERCREDITS_BOL_CreditsService::getInstance()->deleteActionsByPluginKey('mailbox');
         $credits = new MAILBOX_CLASS_Credits();
         $credits->triggerCreditActionsAdd();
     }
     return array('result' => true);
 }
Beispiel #2
0
 * ---
 * Copyright (c) 2011, Oxwall Foundation
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 *
 *  - Redistributions of source code must retain the above copyright notice, this list of conditions and
 *  the following disclaimer.
 *
 *  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
 *  the following disclaimer in the documentation and/or other materials provided with the distribution.
 *
 *  - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products
 *  derived from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * @author Podyachev Evgeny <*****@*****.**>
 * @package ow_plugins.mailbox
 * @since 1.0
 */
// credits
require_once dirname(__FILE__) . DS . 'classes' . DS . 'credits.php';
$credits = new MAILBOX_CLASS_Credits();
$credits->triggerCreditActionsAdd();