Esempio n. 1
0
 /**
  * Get the markers
  */
 public function marker()
 {
     if (!$this->auth->acl_get('u_usermap_view')) {
         trigger_error('NOT_AUTHORISED');
     }
     $data = array('min_lon' => (double) substr($this->request->variable('alon', ''), 0, 10), 'max_lat' => (double) substr($this->request->variable('alat', ''), 0, 10), 'max_lon' => (double) substr($this->request->variable('blon', ''), 0, 10), 'min_lat' => (double) substr($this->request->variable('blat', ''), 0, 10));
     $validate_array = array('min_lon' => array('match', false, self::REGEX_LON), 'max_lat' => array('match', false, self::REGEX_LAT), 'max_lon' => array('match', false, self::REGEX_LON), 'min_lat' => array('match', false, self::REGEX_LAT));
     if (!function_exists('validate_data')) {
         include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
     }
     $error = validate_data($data, $validate_array);
     if (sizeof($error)) {
         $error = array_map(array($this->user, 'lang'), $error);
         $json_response = new \phpbb\json_response();
         $json_response->send($error);
     }
     $return = array();
     $sql_array['FROM'][USERS_TABLE] = 'u';
     $sql_array['SELECT'] = 'u.user_id, u.username, u.user_colour, u.user_regdate, u.user_posts, u.group_id, u.user_usermap_lon, u.user_usermap_lat, g.group_usermap_marker';
     $sql_array['LEFT_JOIN'][] = array('FROM' => array(GROUPS_TABLE => 'g'), 'ON' => 'u.group_id = g.group_id');
     $sql_array['WHERE'] = "(u.user_usermap_lon >= {$data['min_lon']} AND u.user_usermap_lon <= {$data['max_lon']}) AND (u.user_usermap_lat >= {$data['min_lat']} AND u.user_usermap_lat<= {$data['max_lat']}) AND user_usermap_hide = 0";
     $sql = $this->db->sql_build_query('SELECT', $sql_array);
     $result = $this->db->sql_query_limit($sql, (int) $this->config['tas2580_usermap_max_marker']);
     while ($row = $this->db->sql_fetchrow($result)) {
         $distance = $this->get_distance($this->user->data['user_usermap_lon'], $this->user->data['user_usermap_lat'], $row['user_usermap_lon'], $row['user_usermap_lat']);
         $return[] = array('marker' => $row['group_usermap_marker'], 'lon' => $row['user_usermap_lon'], 'lat' => $row['user_usermap_lat'], 'title' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'distance' => $distance);
     }
     $json_response = new \phpbb\json_response();
     $json_response->send($return);
 }
    /**
     * Clear user reputation
     *
     * @param int $uid	User ID
     * @return null
     * @access public
     */
    public function clear_user($uid)
    {
        $this->user->add_lang_ext('pico/reputation', 'reputation_system');
        $is_ajax = $this->request->is_ajax();
        $submit = false;
        $sql_array = array('SELECT' => 'r.*, ut.username AS username_to', 'FROM' => array($this->reputations_table => 'r'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'ut'), 'ON' => 'r.user_id_to = ut.user_id ')), 'WHERE' => 'r.user_id_to = ' . $uid);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        //We couldn't find this reputation. May be it was deleted meanwhile?
        if (empty($row)) {
            $message = $this->user->lang('RS_NO_REPUTATION');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $redirect = $this->helper->route('reputation_details_controller', array('uid' => $uid));
        if ($this->request->is_set_post('cancel')) {
            redirect($redirect);
        }
        $post_ids = array();
        $post_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
        $sql = 'SELECT reputation_item_id
			FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}\n\t\t\t\tAND reputation_type_id = {$post_type_id}\n\t\t\tGROUP BY reputation_item_id";
        $result = $this->db->sql_query($sql);
        while ($post_row = $this->db->sql_fetchrow($result)) {
            $post_ids[] = $post_row['reputation_item_id'];
        }
        $this->db->sql_freeresult($result);
        $redirect_text = 'RETURN_PAGE';
        if ($this->auth->acl_gets('m_rs_moderate')) {
            if ($is_ajax) {
                $submit = true;
            } else {
                $s_hidden_fields = build_hidden_fields(array('u' => $uid));
                if (confirm_box(true)) {
                    $submit = true;
                } else {
                    confirm_box(false, $this->user->lang('RS_CLEAR_POST_CONFIRM'), $s_hidden_fields);
                }
            }
        } else {
            $message = $this->user->lang('RS_USER_CANNOT_DELETE');
            $json_data = array('error_msg' => $message);
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if ($submit) {
            try {
                $this->reputation_manager->clear_user_reputation($uid, $row, $post_ids);
            } catch (\pico\reputation\exception\base $e) {
                // Catch exception
                trigger_error($e->get_message($this->user));
            }
            $message = $this->user->lang('RS_CLEARED_USER');
            $json_data = array('clear_user' => true, 'post_ids' => $post_ids, 'poster_id' => $uid, 'user_reputation' => 0, 'post_reputation' => 0, 'reputation_class' => 'neutral');
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
    }
    /**
     * User details controller
     *
     * @param int $uid			User ID taken from the URL
     * @param string $sort_key	Sort key: id|username|time|point|action (default: id)
     * @param string $sort_dir	Sort direction: dsc|asc (descending|ascending) (default: dsc)
     * @return Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function userdetails($uid, $sort_key, $sort_dir)
    {
        $this->user->add_lang_ext('pico/reputation', array('reputation_system', 'reputation_rating'));
        $is_ajax = $this->request->is_ajax();
        $referer = $this->symfony_request->get('_referer');
        if (empty($this->config['rs_enable'])) {
            if ($is_ajax) {
                $json_response = new \phpbb\json_response();
                $json_data = array('error_msg' => $this->user->lang('RS_DISABLED'));
                $json_response->send($json_data);
            }
            redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
        }
        $sql = 'SELECT user_id, username, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> 2
				AND user_id =' . (int) $uid;
        $result = $this->db->sql_query($sql);
        $user_row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (empty($user_row)) {
            $message = $this->user->lang('RS_NO_USER_ID');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        if (!$this->auth->acl_get('u_rs_view')) {
            $message = $this->user->lang('RS_VIEW_DISALLOWED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&amp;u=' . $uid);
            $redirect_text = 'RETURN_PAGE';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $sort_key_sql = array('username' => 'u.username_clean', 'time' => 'r.reputation_time', 'point' => 'r.reputation_points', 'action' => 'rt.reputation_type_name', 'id' => 'r.reputation_id');
        // Sql order depends on sort key
        $order_by = $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'dsc' ? 'DESC' : 'ASC');
        $reputation_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
        $sql_array = array('SELECT' => 'r.*, rt.reputation_type_name, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, p.post_id, p.forum_id, p.post_subject', 'FROM' => array($this->reputations_table => 'r', $this->reputation_types_table => 'rt'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = r.user_id_from'), array('FROM' => array(POSTS_TABLE => 'p'), 'ON' => 'p.post_id = r.reputation_item_id
						AND r.reputation_type_id = ' . $reputation_type_id)), 'WHERE' => 'r.user_id_to = ' . $uid . '
				AND r.reputation_type_id = rt.reputation_type_id', 'ORDER_BY' => $order_by);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('reputation', array('ID' => $row['reputation_id'], 'USERNAME' => get_username_string('full', $row['user_id_from'], $row['username'], $row['user_colour']), 'ACTION' => $this->user->lang('RS_' . strtoupper($row['reputation_type_name']) . '_RATING'), 'AVATAR' => phpbb_get_user_avatar($row), 'TIME' => $this->user->format_date($row['reputation_time']), 'COMMENT' => $row['reputation_comment'], 'POINTS' => $row['reputation_points'], 'POINTS_CLASS' => $this->reputation_helper->reputation_class($row['reputation_points']), 'POINTS_TITLE' => $this->user->lang('RS_POINTS_TITLE', $row['reputation_points']), 'U_DELETE' => $this->helper->route('reputation_delete_controller', array('rid' => $row['reputation_id'])), 'S_COMMENT' => !empty($row['reputation_comment']), 'S_DELETE' => $this->auth->acl_get('m_rs_moderate') || $row['user_id_from'] == $this->user->data['user_id'] && $this->auth->acl_get('u_rs_delete') ? true : false));
            // Generate post url
            $this->reputation_manager->generate_post_link($row);
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('USER_ID' => $uid, 'U_USER_DETAILS' => $this->helper->route('reputation_details_controller', array('uid' => $uid)), 'U_SORT_USERNAME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'username', 'sort_dir' => $sort_key == 'username' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_TIME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'time', 'sort_dir' => $sort_key == 'time' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_POINT' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'point', 'sort_dir' => $sort_key == 'point' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_ACTION' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'action', 'sort_dir' => $sort_key == 'action' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_CLEAR' => $this->helper->route('reputation_clear_user_controller', array('uid' => $uid)), 'U_REPUTATION_REFERER' => $referer, 'L_RS_USER_REPUTATION' => $this->user->lang('RS_USER_REPUTATION', get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour'])), 'S_RS_AVATAR' => $this->config['rs_display_avatar'] ? true : false, 'S_RS_COMMENT' => $this->config['rs_enable_comment'] ? true : false, 'S_RS_POINTS_IMG' => $this->config['rs_point_type'] ? true : false, 'S_CLEAR' => $this->auth->acl_gets('m_rs_moderate') ? true : false, 'S_IS_AJAX' => $is_ajax ? true : false));
        return $this->helper->render('userdetails.html');
    }
 /**
  * Obtain an array of active users over the last 24 hours.
  *
  * @return array
  */
 private function obtain_active_user_data()
 {
     if (($active_users = $this->cache->get('_24hour_users')) === false) {
         $active_users = array();
         // grab a list of users who are currently online
         // and users who have visited in the last 24 hours
         $sql_ary = array('SELECT' => 'u.user_id, u.user_colour, u.username, u.user_type, u.user_lastvisit, MAX(s.session_time) as session_time', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array(SESSIONS_TABLE => 's'), 'ON' => 's.session_user_id = u.user_id')), 'WHERE' => 'u.user_lastvisit > ' . (time() - 86400) . ' OR s.session_user_id <> ' . ANONYMOUS, 'GROUP_BY' => 'u.user_id', 'ORDER_BY' => 'u.username');
         $result = $this->db->sql_query($this->db->sql_build_query('SELECT', $sql_ary));
         while ($row = $this->db->sql_fetchrow($result)) {
             $active_users[$row['user_id']] = $row;
         }
         $this->db->sql_freeresult($result);
         // cache this data for 1 hour, this improves performance
         $this->cache->put('_24hour_users', $active_users, 3600);
     }
     return $active_users;
 }
 /**
  * Get top_flags
  * displayed on the index page
  */
 public function top_flags()
 {
     // grab all the flags
     $sql_array = array('SELECT' => 'user_flag, COUNT(user_flag) AS fnum', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => $this->db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . ' AND user_flag > 0', 'GROUP_BY' => 'user_flag', 'ORDER_BY' => 'fnum DESC');
     // we limit the number of flags to display to the number set in the ACP settings
     $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_array), $this->config['flags_num_display']);
     $count = 0;
     $flags = $this->cache->get('_user_flags');
     while ($row = $this->db->sql_fetchrow($result)) {
         ++$count;
         $this->template->assign_block_vars('flag', array('FLAG' => $this->get_user_flag($row['user_flag']), 'FLAG_USERS' => $this->user->lang('FLAG_USERS', (int) $row['fnum']), 'U_FLAG' => $this->helper->route('rmcgirr83_nationalflags_getflags', array('flag_id' => $flags[$row['user_flag']]['flag_id']))));
     }
     $this->db->sql_freeresult($result);
     if ($count) {
         $this->template->assign_vars(array('U_FLAGS' => $this->helper->route('rmcgirr83_nationalflags_display'), 'S_FLAGS' => true));
     }
 }
Esempio n. 6
0
 /**
  * Query the permissions for a given user and store them in the database.
  */
 protected function query_auth_data($user_id)
 {
     //$albums = array();//@todo $this->cache->obtain_album_list();
     $albums = $this->cache->get('albums');
     $user_groups_ary = self::get_usergroups($user_id);
     $sql_select = '';
     foreach (self::$_permissions as $permission) {
         $sql_select .= " MAX({$permission}) as {$permission},";
     }
     $this->_auth_data[self::OWN_ALBUM] = new \phpbbgallery\core\auth\set();
     $this->_auth_data_never[self::OWN_ALBUM] = new \phpbbgallery\core\auth\set();
     $this->_auth_data[self::PERSONAL_ALBUM] = new \phpbbgallery\core\auth\set();
     $this->_auth_data_never[self::PERSONAL_ALBUM] = new \phpbbgallery\core\auth\set();
     foreach ($albums as $album) {
         if ($album['album_user_id'] == self::PUBLIC_ALBUM) {
             $this->_auth_data[$album['album_id']] = new \phpbbgallery\core\auth\set();
             $this->_auth_data_never[$album['album_id']] = new \phpbbgallery\core\auth\set();
         }
     }
     $sql_array = array('SELECT' => "p.perm_album_id, {$sql_select} p.perm_system", 'FROM' => array($this->table_permissions => 'p'), 'LEFT_JOIN' => array(array('FROM' => array($this->table_roles => 'pr'), 'ON' => 'p.perm_role_id = pr.role_id')), 'WHERE' => 'p.perm_user_id = ' . $user_id . ' OR ' . $this->db->sql_in_set('p.perm_group_id', $user_groups_ary, false, true), 'GROUP_BY' => 'p.perm_system, p.perm_album_id', 'ORDER_BY' => 'p.perm_system DESC, p.perm_album_id ASC');
     $sql = $this->db->sql_build_query('SELECT', $sql_array);
     $this->db->sql_return_on_error(true);
     $result = $this->db->sql_query($sql);
     if ($this->db->get_sql_error_triggered()) {
         trigger_error('DATABASE_NOT_UPTODATE');
     }
     $this->db->sql_return_on_error(false);
     while ($row = $this->db->sql_fetchrow($result)) {
         switch ($row['perm_system']) {
             case self::PERSONAL_ALBUM:
                 $this->store_acl_row(self::PERSONAL_ALBUM, $row);
                 break;
             case self::OWN_ALBUM:
                 $this->store_acl_row(self::OWN_ALBUM, $row);
                 break;
             case self::PUBLIC_ALBUM:
                 $this->store_acl_row((int) $row['perm_album_id'], $row);
                 break;
         }
     }
     $this->db->sql_freeresult($result);
     $this->merge_acl_row();
     $this->restrict_pegas($user_id);
     $this->set_user_permissions($user_id, $this->_auth_data);
 }
Esempio n. 7
0
 public function marker()
 {
     $data = array();
     $min_lon = (double) substr($this->request->variable('alon', ''), 0, 10);
     $max_lat = (double) substr($this->request->variable('alat', ''), 0, 10);
     $max_lon = (double) substr($this->request->variable('blon', ''), 0, 10);
     $min_lat = (double) substr($this->request->variable('blat', ''), 0, 10);
     $my_lon = $this->user->data['user_usermap_lon'];
     $my_lat = $this->user->data['user_usermap_lat'];
     $sql_array['FROM'][USERS_TABLE] = 'u';
     $sql_array['SELECT'] .= 'u.user_id, u.username, u.user_colour, u.user_regdate, u.user_posts, u.group_id, u.user_usermap_lon, u.user_usermap_lat, g.group_usermap_marker';
     $sql_array['LEFT_JOIN'][] = array('FROM' => array(GROUPS_TABLE => 'g'), 'ON' => 'u.group_id = g.group_id');
     $sql_array['WHERE'] = "(u.user_usermap_lon >= {$min_lon} AND u.user_usermap_lon <= {$max_lon}) AND (u.user_usermap_lat >= {$min_lat} AND u.user_usermap_lat<= {$max_lat})";
     $sql = $this->db->sql_build_query('SELECT', $sql_array);
     $result = $this->db->sql_query_limit($sql, (int) $this->config['tas2580_usermap_max_marker']);
     while ($row = $this->db->sql_fetchrow($result)) {
         $distance = $this->get_distance($my_lon, $my_lat, $row['user_usermap_lon'], $row['user_usermap_lat']);
         $data[] = array('marker' => $row['group_usermap_marker'], 'lon' => $row['user_usermap_lon'], 'lat' => $row['user_usermap_lat'], 'title' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'distance' => $distance);
     }
     $json_response = new \phpbb\json_response();
     $json_response->send($data);
 }
    /**
     * {@inheritDoc}
     */
    public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '')
    {
        $this->entry_count = 0;
        $this->last_page_offset = $offset;
        $topic_id_list = $reportee_id_list = array();
        $profile_url = $this->get_is_admin() && $this->phpbb_admin_path ? append_sid("{$this->phpbb_admin_path}index.{$this->php_ext}", 'i=users&amp;mode=overview') : append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=viewprofile');
        switch ($mode) {
            case 'admin':
                $log_type = LOG_ADMIN;
                $sql_additional = '';
                break;
            case 'mod':
                $log_type = LOG_MOD;
                $sql_additional = '';
                if ($topic_id) {
                    $sql_additional = 'AND l.topic_id = ' . (int) $topic_id;
                } else {
                    if (is_array($forum_id)) {
                        $sql_additional = 'AND ' . $this->db->sql_in_set('l.forum_id', array_map('intval', $forum_id));
                    } else {
                        if ($forum_id) {
                            $sql_additional = 'AND l.forum_id = ' . (int) $forum_id;
                        }
                    }
                }
                break;
            case 'user':
                $log_type = LOG_USERS;
                $sql_additional = 'AND l.reportee_id = ' . (int) $user_id;
                break;
            case 'users':
                $log_type = LOG_USERS;
                $sql_additional = '';
                break;
            case 'critical':
                $log_type = LOG_CRITICAL;
                $sql_additional = '';
                break;
            default:
                $log_type = false;
                $sql_additional = '';
        }
        /**
         * Overwrite log type and limitations before we count and get the logs
         *
         * NOTE: if log_type is false, no entries will be returned.
         *
         * @event core.get_logs_modify_type
         * @var	string	mode		Mode of the entries we display
         * @var	bool	count_logs	Do we count all matching entries?
         * @var	int		limit		Limit the number of entries
         * @var	int		offset		Offset when fetching the entries
         * @var	mixed	forum_id	Limit entries to the forum_id,
         *							can also be an array of forum_ids
         * @var	int		topic_id	Limit entries to the topic_id
         * @var	int		user_id		Limit entries to the user_id
         * @var	int		log_time	Limit maximum age of log entries
         * @var	string	sort_by		SQL order option
         * @var	string	keywords	Will only return entries that have the
         *							keywords in log_operation or log_data
         * @var	string	profile_url	URL to the users profile
         * @var	int		log_type	Limit logs to a certain type. If log_type
         *							is false, no entries will be returned.
         * @var	string	sql_additional	Additional conditions for the entries,
         *								e.g.: 'AND l.forum_id = 1'
         * @since 3.1.0-a1
         */
        $vars = array('mode', 'count_logs', 'limit', 'offset', 'forum_id', 'topic_id', 'user_id', 'log_time', 'sort_by', 'keywords', 'profile_url', 'log_type', 'sql_additional');
        extract($this->dispatcher->trigger_event('core.get_logs_modify_type', compact($vars)));
        if ($log_type === false) {
            $this->last_page_offset = 0;
            return array();
        }
        $sql_keywords = '';
        if (!empty($keywords)) {
            // Get the SQL condition for our keywords
            $sql_keywords = $this->generate_sql_keyword($keywords);
        }
        $get_logs_sql_ary = array('SELECT' => 'l.*, u.username, u.username_clean, u.user_colour', 'FROM' => array($this->log_table => 'l', USERS_TABLE => 'u'), 'WHERE' => 'l.log_type = ' . (int) $log_type . "\n\t\t\t\t\tAND l.user_id = u.user_id\n\t\t\t\t\t{$sql_keywords}\n\t\t\t\t\t{$sql_additional}", 'ORDER_BY' => $sort_by);
        if ($log_time) {
            $get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . '
					AND ' . $get_logs_sql_ary['WHERE'];
        }
        /**
         * Modify the query to obtain the logs data
         *
         * @event core.get_logs_main_query_before
         * @var	array	get_logs_sql_ary	The array in the format of the query builder with the query
         *									to get the log count and the log list
         * @var	string	mode				Mode of the entries we display
         * @var	bool	count_logs			Do we count all matching entries?
         * @var	int		limit				Limit the number of entries
         * @var	int		offset				Offset when fetching the entries
         * @var	mixed	forum_id			Limit entries to the forum_id,
         *									can also be an array of forum_ids
         * @var	int		topic_id			Limit entries to the topic_id
         * @var	int		user_id				Limit entries to the user_id
         * @var	int		log_time			Limit maximum age of log entries
         * @var	string	sort_by				SQL order option
         * @var	string	keywords			Will only return entries that have the
         *									keywords in log_operation or log_data
         * @var	string	profile_url			URL to the users profile
         * @var	int		log_type			Limit logs to a certain type. If log_type
         *									is false, no entries will be returned.
         * @var	string	sql_additional		Additional conditions for the entries,
         *									e.g.: 'AND l.forum_id = 1'
         * @since 3.1.5-RC1
         */
        $vars = array('get_logs_sql_ary', 'mode', 'count_logs', 'limit', 'offset', 'forum_id', 'topic_id', 'user_id', 'log_time', 'sort_by', 'keywords', 'profile_url', 'log_type', 'sql_additional');
        extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars)));
        if ($count_logs) {
            $count_logs_sql_ary = $get_logs_sql_ary;
            $count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries';
            unset($count_logs_sql_ary['ORDER_BY']);
            $sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary);
            $result = $this->db->sql_query($sql);
            $this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
            $this->db->sql_freeresult($result);
            if ($this->entry_count == 0) {
                // Save the queries, because there are no logs to display
                $this->last_page_offset = 0;
                return array();
            }
            // Return the user to the last page that is valid
            while ($this->last_page_offset >= $this->entry_count) {
                $this->last_page_offset = max(0, $this->last_page_offset - $limit);
            }
        }
        $sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary);
        $result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);
        $i = 0;
        $log = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $row['forum_id'] = (int) $row['forum_id'];
            if ($row['topic_id']) {
                $topic_id_list[] = (int) $row['topic_id'];
            }
            if ($row['reportee_id']) {
                $reportee_id_list[] = (int) $row['reportee_id'];
            }
            $log_entry_data = array('id' => (int) $row['log_id'], 'reportee_id' => (int) $row['reportee_id'], 'reportee_username' => '', 'reportee_username_full' => '', 'user_id' => (int) $row['user_id'], 'username' => $row['username'], 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, $profile_url), 'ip' => $row['log_ip'], 'time' => (int) $row['log_time'], 'forum_id' => (int) $row['forum_id'], 'topic_id' => (int) $row['topic_id'], 'viewforum' => $row['forum_id'] && $this->auth->acl_get('f_read', $row['forum_id']) ? append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']) : false, 'action' => isset($this->user->lang[$row['log_operation']]) ? $row['log_operation'] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}');
            /**
             * Modify the entry's data before it is returned
             *
             * @event core.get_logs_modify_entry_data
             * @var	array	row			Entry data from the database
             * @var	array	log_entry_data	Entry's data which is returned
             * @since 3.1.0-a1
             */
            $vars = array('row', 'log_entry_data');
            extract($this->dispatcher->trigger_event('core.get_logs_modify_entry_data', compact($vars)));
            $log[$i] = $log_entry_data;
            if (!empty($row['log_data'])) {
                $log_data_ary = unserialize($row['log_data']);
                $log_data_ary = $log_data_ary !== false ? $log_data_ary : array();
                if (isset($this->user->lang[$row['log_operation']])) {
                    // Check if there are more occurrences of % than
                    // arguments, if there are we fill out the arguments
                    // array. It doesn't matter if we add more arguments than
                    // placeholders.
                    $num_args = 0;
                    if (!is_array($this->user->lang[$row['log_operation']])) {
                        $num_args = substr_count($this->user->lang[$row['log_operation']], '%');
                    } else {
                        foreach ($this->user->lang[$row['log_operation']] as $case => $plural_string) {
                            $num_args = max($num_args, substr_count($plural_string, '%'));
                        }
                    }
                    if ($num_args - sizeof($log_data_ary) > 0) {
                        $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), ''));
                    }
                    $lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary);
                    $log[$i]['action'] = call_user_func_array(array($this->user, 'lang'), $lang_arguments);
                    // If within the admin panel we do not censor text out
                    if ($this->get_is_admin()) {
                        $log[$i]['action'] = bbcode_nl2br($log[$i]['action']);
                    } else {
                        $log[$i]['action'] = bbcode_nl2br(censor_text($log[$i]['action']));
                    }
                } else {
                    if (!empty($log_data_ary)) {
                        $log[$i]['action'] .= '<br />' . implode('', $log_data_ary);
                    }
                }
                /* Apply make_clickable... has to be seen if it is for good. :/
                			// Seems to be not for the moment, reconsider later...
                			$log[$i]['action'] = make_clickable($log[$i]['action']);
                			*/
            } else {
                $log[$i]['action'] = $this->user->lang($log[$i]['action']);
            }
            $i++;
        }
        $this->db->sql_freeresult($result);
        /**
         * Get some additional data after we got all log entries
         *
         * @event core.get_logs_get_additional_data
         * @var	array	log			Array with all our log entries
         * @var	array	topic_id_list		Array of topic ids, for which we
         *									get the permission data
         * @var	array	reportee_id_list	Array of additional user IDs we
         *									get the username strings for
         * @since 3.1.0-a1
         */
        $vars = array('log', 'topic_id_list', 'reportee_id_list');
        extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars)));
        if (sizeof($topic_id_list)) {
            $topic_auth = $this->get_topic_auth($topic_id_list);
            foreach ($log as $key => $row) {
                $log[$key]['viewtopic'] = isset($topic_auth['f_read'][$row['topic_id']]) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $topic_auth['f_read'][$row['topic_id']] . '&amp;t=' . $row['topic_id']) : false;
                $log[$key]['viewlogs'] = isset($topic_auth['m_'][$row['topic_id']]) ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=logs&amp;mode=topic_logs&amp;t=' . $row['topic_id'], true, $this->user->session_id) : false;
            }
        }
        if (sizeof($reportee_id_list)) {
            $reportee_data_list = $this->get_reportee_data($reportee_id_list);
            foreach ($log as $key => $row) {
                if (!isset($reportee_data_list[$row['reportee_id']])) {
                    continue;
                }
                $log[$key]['reportee_username'] = $reportee_data_list[$row['reportee_id']]['username'];
                $log[$key]['reportee_username_full'] = get_username_string('full', $row['reportee_id'], $reportee_data_list[$row['reportee_id']]['username'], $reportee_data_list[$row['reportee_id']]['user_colour'], false, $profile_url);
            }
        }
        /**
         * Allow modifying or execute extra final filter on log entries
         *
         * @event core.get_logs_after
         * @var	array	log			Array with all our log entries
         * @var	array	topic_id_list		Array of topic ids, for which we
         *									get the permission data
         * @var	array	reportee_id_list	Array of additional user IDs we
         *									get the username strings for
         * @var	string	mode		Mode of the entries we display
         * @var	bool	count_logs	Do we count all matching entries?
         * @var	int		limit		Limit the number of entries
         * @var	int		offset		Offset when fetching the entries
         * @var	mixed	forum_id	Limit entries to the forum_id,
         *							can also be an array of forum_ids
         * @var	int		topic_id	Limit entries to the topic_id
         * @var	int		user_id		Limit entries to the user_id
         * @var	int		log_time	Limit maximum age of log entries
         * @var	string	sort_by		SQL order option
         * @var	string	keywords	Will only return entries that have the
         *							keywords in log_operation or log_data
         * @var	string	profile_url	URL to the users profile
         * @var	int		log_type	The type of logs it was filtered
         * @since 3.1.3-RC1
         */
        $vars = array('log', 'topic_id_list', 'reportee_id_list', 'mode', 'count_logs', 'limit', 'offset', 'forum_id', 'topic_id', 'user_id', 'log_time', 'sort_by', 'keywords', 'profile_url', 'log_type');
        extract($this->dispatcher->trigger_event('core.get_logs_after', compact($vars)));
        return $log;
    }
    /**
     * Display the post rating page
     *
     * @param string $mode		Mode taken from the URL 
     * @param int $post_id		Post ID taken from the URL
     * @return Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function post($mode, $post_id)
    {
        $this->user->add_lang_ext('pico/reputation', 'reputation_rating');
        // Define basic variables
        $error = '';
        $is_ajax = $this->request->is_ajax();
        $referer = $this->symfony_request->get('_referer');
        if (empty($this->config['rs_enable'])) {
            if ($is_ajax) {
                $json_response = new \phpbb\json_response();
                $json_data = array('error_msg' => $this->user->lang('RS_DISABLED'));
                $json_response->send($json_data);
            }
            redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
        }
        $reputation_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
        $sql_array = array('SELECT' => 'p.forum_id, p.poster_id, p.post_subject, u.user_type, u.user_reputation, f.reputation_enabled, r.reputation_id, r.reputation_points', 'FROM' => array(POSTS_TABLE => 'p', USERS_TABLE => 'u', FORUMS_TABLE => 'f'), 'LEFT_JOIN' => array(array('FROM' => array($this->reputations_table => 'r'), 'ON' => 'p.post_id = r.reputation_item_id
						AND r.reputation_type_id = ' . $reputation_type_id . '
						AND r.user_id_from = ' . $this->user->data['user_id'])), 'WHERE' => 'p.post_id = ' . $post_id . '
				AND p.poster_id = u.user_id
				AND p.forum_id = f.forum_id');
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // We couldn't find this post. May be it was deleted while user voted?
        if (!$row) {
            $message = $this->user->lang('RS_NO_POST');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
            $redirect_text = 'RETURN_INDEX';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Cancel action
        if ($this->request->is_set_post('cancel')) {
            redirect(append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id);
        }
        // Fire error if post rating is disabled
        if (!$this->config['rs_post_rating'] || !$this->config['rs_negative_point'] && $mode == 'negative' || !$row['reputation_enabled']) {
            $message = $this->user->lang('RS_DISABLED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // No anonymous voting is allowed
        if ($row['user_type'] == USER_IGNORE) {
            $message = $this->user->lang('RS_USER_ANONYMOUS');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // You cannot rate your own post
        if ($row['poster_id'] == $this->user->data['user_id']) {
            $message = $this->user->lang('RS_SELF');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Don't allow to rate same post
        if ($row['reputation_id']) {
            $message = $this->user->lang('RS_SAME_POST', $row['reputation_points']);
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Check if user is allowed to vote
        if (!$this->auth->acl_get('f_rs_rate', $row['forum_id']) || !$this->auth->acl_get('f_rs_rate_negative', $row['forum_id']) && $mode == 'negative' || !$this->auth->acl_get('u_rs_rate_post')) {
            $message = $this->user->lang('RS_USER_DISABLED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        //Check if user reputation is enough to give negative points
        if ($this->config['rs_min_rep_negative'] && $this->user->data['user_reputation'] < $this->config['rs_min_rep_negative'] && $mode == 'negative') {
            $message = $this->user->lang('RS_USER_NEGATIVE', $this->config['rs_min_rep_negative']);
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Anti-abuse behaviour
        if (!empty($this->config['rs_anti_time']) && !empty($this->config['rs_anti_post'])) {
            $anti_time = time() - $this->config['rs_anti_time'] * 3600;
            $sql_and = !$this->config['rs_anti_method'] ? 'AND user_id_to = ' . $row['poster_id'] : '';
            $sql = 'SELECT COUNT(reputation_id) AS reputation_per_day
				FROM ' . $this->reputations_table . '
				WHERE user_id_from = ' . $this->user->data['user_id'] . '
					' . $sql_and . '
					AND reputation_type_id = ' . $reputation_type_id . '
					AND reputation_time > ' . $anti_time;
            $result = $this->db->sql_query($sql);
            $anti_row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            if ($anti_row['reputation_per_day'] >= $this->config['rs_anti_post']) {
                $message = $this->user->lang('RS_ANTISPAM_INFO');
                $json_data = array('error_msg' => $message);
                $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
                $redirect_text = 'RETURN_TOPIC';
                $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
            }
        }
        // Disallow rating banned users
        if ($this->user->check_ban($row['poster_id'], false, false, true)) {
            $message = $this->user->lang('RS_USER_BANNED');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Prevent overrating one user by another
        if ($this->reputation_manager->prevent_rating($row['poster_id'])) {
            $message = $this->user->lang('RS_ANTISPAM_INFO');
            $json_data = array('error_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        // Request variables
        $points = $this->request->variable('points', '');
        $comment = $this->request->variable('comment', '', true);
        // Submit vote
        $submit = false;
        if ($this->request->is_set_post('submit_vote')) {
            $submit = true;
        }
        // The comment
        if ($submit && $this->config['rs_enable_comment']) {
            // The comment is too long
            if (strlen($comment) > $this->config['rs_comment_max_chars']) {
                $submit = false;
                $error = $this->user->lang('RS_COMMENT_TOO_LONG', strlen($comment), $this->config['rs_comment_max_chars']);
                if ($is_ajax) {
                    $json_response = new \phpbb\json_response();
                    $json_data = array('comment_error' => $error);
                    $json_response->send($json_data);
                }
            }
            // Force the comment
            if (($this->config['rs_force_comment'] == self::RS_COMMENT_BOTH || $this->config['rs_force_comment'] == self::RS_COMMENT_POST) && empty($comment)) {
                $submit = false;
                $error = $this->user->lang('RS_NO_COMMENT');
                if ($is_ajax) {
                    $json_response = new \phpbb\json_response();
                    $json_data = array('comment_error' => $error);
                    $json_response->send($json_data);
                }
            }
        }
        // Sumbit vote when the comment and the reputation power are disabled
        if (!$this->config['rs_enable_comment'] && !$this->config['rs_enable_power']) {
            $submit = true;
            $points = $mode == 'negative' ? '-1' : '1';
        }
        // Get reputation power
        if ($this->config['rs_enable_power']) {
            $voting_power_pulldown = '';
            // Get details on user voting - how much power was used
            $used_power = $this->reputation_power->used($this->user->data['user_id']);
            // Calculate how much maximum power the user has
            $max_voting_power = $this->reputation_power->get($this->user->data['user_posts'], $this->user->data['user_regdate'], $this->user->data['user_reputation'], $this->user->data['user_warnings'], $this->user->data['group_id']);
            if ($max_voting_power < 1) {
                $message = $this->user->lang('RS_NO_POWER');
                $json_data = array('error_msg' => $message);
                $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
                $redirect_text = 'RETURN_TOPIC';
                $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
            }
            $voting_power_left = $max_voting_power - $used_power;
            // Don't allow to vote more than set in ACP per 1 vote
            $max_voting_allowed = $this->config['rs_power_renewal'] ? min($max_voting_power, $voting_power_left) : $max_voting_power;
            // If now voting power left - fire error and exit
            if ($voting_power_left <= 0 && $this->config['rs_power_renewal']) {
                $message = $this->user->lang('RS_NO_POWER_LEFT', $max_voting_power);
                $json_data = array('error_msg' => $message);
                $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
                $redirect_text = 'RETURN_TOPIC';
                $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
            }
            $this->template->assign_vars(array('RS_POWER_POINTS_LEFT' => $this->config['rs_power_renewal'] ? $this->user->lang('RS_VOTE_POWER_LEFT_OF_MAX', $voting_power_left, $max_voting_power, $max_voting_allowed) : '', 'RS_POWER_PROGRESS_EMPTY' => $this->config['rs_power_renewal'] && $max_voting_power ? round(($max_voting_power - $voting_power_left) / $max_voting_power * 100, 0) : ''));
            //Preparing HTML for voting by manual spending of user power
            for ($i = 1; $i <= $max_voting_allowed; ++$i) {
                if ($mode == 'negative') {
                    $voting_power_pulldown = '<option value="-' . $i . '">' . $this->user->lang('RS_NEGATIVE') . ' (-' . $i . ') </option>';
                } else {
                    $voting_power_pulldown = '<option value="' . $i . '">' . $this->user->lang('RS_POSITIVE') . ' (+' . $i . ')</option>';
                }
                $this->template->assign_block_vars('reputation', array('REPUTATION_POWER' => $voting_power_pulldown));
            }
        } else {
            $points = $mode == 'negative' ? '-1' : '1';
        }
        // Save vote
        if ($submit) {
            // Prevent cheater to break the forum permissions to give negative points or give more points than they can
            if (!$this->auth->acl_get('f_rs_rate_negative', $row['forum_id']) && $points < 0 || $points < 0 && $this->config['rs_min_rep_negative'] && $this->user->data['user_reputation'] < $this->config['rs_min_rep_negative'] || $this->config['rs_enable_power'] && ($points > $max_voting_allowed || $points < -$max_voting_allowed)) {
                $submit = false;
                $error = $this->user->lang('RS_USER_CANNOT_RATE');
                if ($is_ajax) {
                    $json_response = new \phpbb\json_response();
                    $json_data = array('comment_error' => $error);
                    $json_response->send($json_data);
                }
            }
        }
        if (!empty($error)) {
            $submit = false;
        }
        if ($submit) {
            $data = array('user_id_from' => $this->user->data['user_id'], 'user_id_to' => $row['poster_id'], 'reputation_type' => 'post', 'reputation_item_id' => $post_id, 'reputation_points' => $points, 'reputation_comment' => $comment);
            try {
                $this->reputation_manager->store_reputation($data);
            } catch (\pico\reputation\exception\base $e) {
                // Catch exception
                $error = $e->get_message($this->user);
            }
            // Notification data
            $notification_data = array('user_id_to' => $row['poster_id'], 'user_id_from' => $this->user->data['user_id'], 'post_id' => $post_id, 'post_subject' => $row['post_subject']);
            $notification_type = $points > 0 ? 'pico.reputation.notification.type.rate_post_positive' : 'pico.reputation.notification.type.rate_post_negative';
            $this->reputation_manager->add_notification($notification_type, $notification_data);
            // Get post reputation
            $post_reputation = $this->reputation_manager->get_post_reputation($post_id);
            $message = $this->user->lang('RS_VOTE_SAVED');
            $json_data = array('post_id' => $post_id, 'poster_id' => $row['poster_id'], 'post_reputation' => $post_reputation, 'user_reputation' => $this->reputation_manager->get_user_reputation($row['poster_id']), 'reputation_class' => $this->reputation_helper->reputation_class($post_reputation), 'reputation_vote' => $points > 0 ? 'rated_good' : 'rated_bad', 'success_msg' => $message);
            $redirect = append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;p=' . $post_id) . '#p' . $post_id;
            $redirect_text = 'RETURN_TOPIC';
            $this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
        }
        $this->template->assign_vars(array('ERROR_MSG' => $error, 'S_CONFIRM_ACTION' => $this->helper->route('reputation_post_rating_controller', array('mode' => $mode, 'post_id' => $post_id)), 'S_ERROR' => !empty($error) ? true : false, 'S_RS_COMMENT_ENABLE' => $this->config['rs_enable_comment'] ? true : false, 'S_RS_POWER_ENABLE' => $this->config['rs_enable_power'] ? true : false, 'S_IS_AJAX' => $is_ajax, 'U_RS_REFERER' => $referer));
        return $this->helper->render('ratepost.html', $this->user->lang('RS_POST_RATING'));
    }