예제 #1
0
 /**
  * Process enable/disable
  *
  * @param \phpbb\event\data $event
  * @param bool $is_owner
  */
 protected function process_disable($event, $is_owner)
 {
     $action = $this->request->variable('delete_hookup', 'no');
     if ($action != 'disable' && $action != 'delete') {
         return array();
     }
     if (!$is_owner) {
         return array($this->user->lang('NOT_AUTH_HOOKUP'));
     }
     if (confirm_box(true)) {
         if ($action == 'disable') {
             $this->hookup->hookup_enabled = false;
             $this->hookup->submit(false);
         } else {
             if ($action == 'delete') {
                 $this->hookup->delete();
                 $this->hookup->submit(false);
             }
         }
     } else {
         $s_hidden_fields = build_hidden_fields(array('t' => $event['topic_id'], 'delete_hookup' => $action));
         confirm_box(false, $this->user->lang['DELETE_HOOKUP_' . strtoupper($action) . '_CONFIRM'], $s_hidden_fields);
     }
     return array();
 }
예제 #2
0
 /**
  * Process enable/disable
  *
  * @param \phpbb\event\data $event
  * @param bool $is_owner
  */
 protected function process_disable($event, $is_owner)
 {
     $action = $this->request->variable('delete_hookup', 'no');
     if ($action != 'disable' && $action != 'delete') {
         return array();
     }
     if (!$is_owner) {
         return array($this->user->lang('NOT_AUTH_HOOKUP'));
     }
     if (confirm_box(true)) {
         if ($action == 'disable') {
             $this->hookup->hookup_enabled = false;
             $this->hookup->submit(false);
             // TODO: is there a way to hide notifications?
             $this->notification_manager->delete_notifications(array('gn36.hookup.notification.type.invited', 'gn36.hookup.notification.type.user_added', 'gn36.hookup.notification.type.date_added', 'gn36.hookup.notification.type.active_date_set', 'gn36.hookup.notification.type.active_date_reset'), $event['topic_id']);
         } else {
             if ($action == 'delete') {
                 $this->hookup->delete();
                 $this->hookup->submit(false);
                 $this->notification_manager->delete_notifications(array('gn36.hookup.notification.type.invited', 'gn36.hookup.notification.type.user_added', 'gn36.hookup.notification.type.date_added', 'gn36.hookup.notification.type.active_date_set', 'gn36.hookup.notification.type.active_date_reset'), $event['topic_id']);
             }
         }
     } else {
         $s_hidden_fields = build_hidden_fields(array('t' => $event['topic_id'], 'delete_hookup' => $action));
         confirm_box(false, $this->user->lang['DELETE_HOOKUP_' . strtoupper($action) . '_CONFIRM'], $s_hidden_fields);
     }
     return array();
 }