/** * 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(); }
/** * Activate user * * @param object $event The event object * @return null * @access public */ private function user_justification_activate() { $user = $this->data; if (!function_exists('user_active_flip')) { include $this->root_path . 'includes/functions_user.' . $this->php_ext; } if (!class_exists('messenger')) { include $this->root_path . 'includes/functions_messenger.' . $this->php_ext; } user_active_flip('activate', $user['user_id']); $messenger = new \messenger(false); $messenger->template('admin_welcome_activated', $user['user_lang']); $messenger->to($user['user_email'], $user['username']); $messenger->anti_abuse_headers($this->config, $this->user); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user['username']))); $messenger->send(NOTIFY_EMAIL); $messenger->save_queue(); // Remove the notification $this->notification_manager->delete_notifications('notification.type.admin_activate_user', $user['user_id']); $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\tSET user_actkey = ''\n\t\t\tWHERE user_id = {$user['user_id']}"; $this->db->sql_query($sql); // Create the correct logs $this->log->add('user', $this->user->data['user_id'], $this->user->ip, 'LOG_USER_ACTIVE_USER', false, array('reportee_id' => $user['user_id'])); $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USER_ACTIVE', false, array($user['username'])); }
/** * Update website verification number after a missing backlink, and send notificaton * * @param array $u_array Information about website * @param int $next_prune Date of next auto check * @return null */ private function _update_check($u_array, $next_prune) { if (!class_exists('messenger')) { include $this->root_path . 'includes/functions_messenger.' . $this->php_ext; } $messenger = new \messenger(false); // cron.php don't call $user->setup(), so $this->timezone is unset. // We need to define it, because we use user->format_date below $this->user->timezone = new \DateTimeZone($this->config['board_timezone']); $sql = 'UPDATE ' . DIR_LINK_TABLE . ' SET link_nb_check = link_nb_check + 1 WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array)); $this->db->sql_query($sql); foreach ($u_array as $data) { strip_bbcode($data['link_description']); $notification_data = array('cat_name' => \ernadoo\phpbbdirectory\core\categorie::getname((int) $data['link_cat']), 'link_id' => $data['link_id'], 'link_name' => $data['link_name'], 'link_url' => $data['link_url'], 'link_description' => $data['link_description'], 'next_cron' => $this->user->format_date($next_prune, $data['user_dateformat'])); if ($data['link_nb_check']) { $this->notification->delete_notifications('ernadoo.phpbbdirectory.notification.type.directory_website_error_cron', $notification_data); } // New notification system can't send mail to an anonymous user with an email address stored in another table than phpbb_users if ($data['link_user_id'] == ANONYMOUS) { $username = $email = $data['link_guest_email']; $messenger->template('@ernadoo_phpbbdirectory/directory_website_error_cron', $data['user_lang']); $messenger->to($email, $username); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($username), 'LINK_NAME' => $data['link_name'], 'LINK_URL' => $data['link_url'], 'LINK_DESCRIPTION' => $data['link_description'], 'NEXT_CRON' => $this->user->format_date($next_prune, $data['user_dateformat']))); $messenger->send(NOTIFY_EMAIL); } else { $this->notification->add_notifications('ernadoo.phpbbdirectory.notification.type.directory_website_error_cron', $notification_data); } } }
/** * Send account activation notification to user * * @param array $user_row The user data array * @param InputInterface $input The input stream used to get the options * @return null */ protected function send_notification($user_row, InputInterface $input) { $this->notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); if ($input->getOption('send-email')) { if (!class_exists('messenger')) { require $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext; } $messenger = new \messenger(false); $messenger->template('admin_welcome_activated', $user_row['user_lang']); $messenger->set_addresses($user_row); $messenger->anti_abuse_headers($this->config, $this->user); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']))); $messenger->send(NOTIFY_EMAIL); } }