/**
     * Check if comments are enable in a category
     *
     * @param	int		$link_id		The link ID
     * @return	null					Retun null if comments are allowed, http_exception if not
     * @throws	\phpbb\exception\http_exception
     */
    private function _check_comments_enable($link_id)
    {
        $sql = 'SELECT link_cat
			FROM ' . DIR_LINK_TABLE . '
			WHERE link_id = ' . (int) $link_id;
        $result = $this->db->sql_query($sql);
        $cat_id = (int) $this->db->sql_fetchfield('link_cat');
        $this->db->sql_freeresult($result);
        if ($cat_id) {
            $this->categorie->get($cat_id);
            if (!$this->categorie->data['cat_allow_comments']) {
                throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH');
            }
        } else {
            throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_LINKS');
        }
    }
Example #2
0
    /**
     * Display categories page
     *
     * @return null
     */
    public function display_cats()
    {
        // Default management page
        if (!$this->parent_id) {
            $navigation = $this->user->lang['DIR_INDEX'];
        } else {
            $navigation = '<a href="' . $this->u_action . '">' . $this->user->lang['DIR_INDEX'] . '</a>';
            $cats_nav = $this->nestedset_category->get_path_data($this->parent_id);
            foreach ($cats_nav as $row) {
                if ($row['cat_id'] == $this->parent_id) {
                    $navigation .= ' -&gt; ' . $row['cat_name'];
                } else {
                    $navigation .= ' -&gt; <a href="' . $this->u_action . '&amp;parent_id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a>';
                }
            }
        }
        // Jumpbox
        $cat_box = $this->categorie->make_cat_select($this->parent_id);
        if ($this->action == 'sync' || $this->action == 'sync_cat') {
            $this->template->assign_var('S_RESYNCED', true);
        }
        $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_name, cat_icon, cat_desc_uid, cat_desc_bitfield, cat_desc, cat_desc_options, cat_links
			FROM ' . DIR_CAT_TABLE . '
			WHERE parent_id = ' . (int) $this->parent_id . '
			ORDER BY left_id';
        $result = $this->db->sql_query($sql);
        if ($row = $this->db->sql_fetchrow($result)) {
            do {
                $folder_image = $row['left_id'] + 1 != $row['right_id'] ? '<img src="images/icon_subfolder.gif" alt="' . $this->user->lang['DIR_SUBCAT'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $this->user->lang['FOLDER'] . '" />';
                $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;c={$row['cat_id']}";
                $this->template->assign_block_vars('cats', array('FOLDER_IMAGE' => $folder_image, 'CAT_IMAGE' => $row['cat_icon'] ? '<img src="' . $this->dir_helper->get_img_path('icons', $row['cat_icon']) . '" alt="" />' : '', 'CAT_NAME' => $row['cat_name'], 'CAT_DESCRIPTION' => generate_text_for_display($row['cat_desc'], $row['cat_desc_uid'], $row['cat_desc_bitfield'], $row['cat_desc_options']), 'CAT_LINKS' => $row['cat_links'], 'U_CAT' => $this->u_action . '&amp;parent_id=' . $row['cat_id'], 'U_MOVE_UP' => $url . '&amp;action=move_up', 'U_MOVE_DOWN' => $url . '&amp;action=move_down', 'U_EDIT' => $url . '&amp;action=edit', 'U_DELETE' => $url . '&amp;action=delete', 'U_SYNC' => $url . '&amp;action=sync'));
            } while ($row = $this->db->sql_fetchrow($result));
        } else {
            if ($this->parent_id) {
                $row = $this->_get_cat_info($this->parent_id);
                $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;c=' . $row['cat_id'];
                $this->template->assign_vars(array('S_NO_CATS' => true, 'U_EDIT' => $url . '&amp;action=edit', 'U_DELETE' => $url . '&amp;action=delete', 'U_SYNC' => $url . '&amp;action=sync'));
            }
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('ERROR_MSG' => sizeof($this->errors) ? implode('<br />', $this->errors) : '', 'NAVIGATION' => $navigation, 'CAT_BOX' => $cat_box, 'U_SEL_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'U_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar', 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&amp;action=progress_bar')));
    }
Example #3
0
 /**
  * Populate form when an error occurred
  *
  * @param	int		$cat_id		The category ID
  * @param	string	$mode		add|edit
  * @param	string	$title		Page title (depends of $mode)
  * @return	null
  */
 private function _populate_form($cat_id, $mode, $title)
 {
     global $phpbb_extension_manager;
     if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm'] && $mode == 'new') {
         $this->s_hidden_fields = array_merge($this->s_hidden_fields, $this->captcha->get_hidden_fields());
         $this->user->add_lang('ucp');
         $this->template->assign_vars(array('CAPTCHA_TEMPLATE' => $this->captcha->get_template()));
     }
     $this->user->add_lang('posting');
     if (!function_exists('display_custom_bbcodes')) {
         include $this->root_path . 'includes/functions_display.' . $this->php_ext;
     }
     display_custom_bbcodes();
     add_form_key('dir_form');
     $ext_path = $phpbb_extension_manager->get_extension_path('ernadoo/phpbbdirectory', false);
     $flag_path = $ext_path . 'images/flags/';
     $s_guest = !$this->user->data['is_registered'] || !empty($this->guest_email);
     $s_rss = $this->config['dir_activ_rss'];
     $s_banner = $this->config['dir_activ_banner'];
     $s_back = $this->categorie->data['cat_link_back'];
     $s_flag = $this->config['dir_activ_flag'];
     $this->template->assign_vars(array('BBCODE_STATUS' => $this->config['allow_bbcode'] ? $this->user->lang('BBCODE_IS_ON', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : $this->user->lang('BBCODE_IS_OFF', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->config['allow_bbcode'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'SMILIES_STATUS' => $this->config['allow_smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->config['allow_post_links'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'FLASH_STATUS' => $this->config['allow_bbcode'] && $this->config['allow_post_flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'L_TITLE' => $title, 'L_DIR_DESCRIPTION_EXP' => $this->user->lang('DIR_DESCRIPTION_EXP', $this->config['dir_length_describe']), 'L_DIR_SUBMIT_TYPE' => $this->categorie->dir_submit_type($this->categorie->need_approval()), 'L_DIR_SITE_BANN_EXP' => $this->user->lang('DIR_SITE_BANN_EXP', $this->config['dir_banner_width'], $this->config['dir_banner_height']), 'S_GUEST' => $s_guest ? true : false, 'S_RSS' => $s_rss ? true : false, 'S_BANNER' => $s_banner ? true : false, 'S_BACK' => $s_back ? true : false, 'S_FLAG' => $s_flag ? true : false, 'S_BBCODE_ALLOWED' => (bool) $this->config['allow_bbcode'], 'S_BBCODE_IMG' => (bool) $this->config['allow_bbcode'], 'S_BBCODE_FLASH' => $this->config['allow_bbcode'] && $this->config['allow_post_flash'] ? true : false, 'S_BBCODE_QUOTE' => true, 'S_LINKS_ALLOWED' => (bool) $this->config['allow_post_links'], 'DIR_FLAG_PATH' => $flag_path, 'DIR_FLAG_IMAGE' => $this->flag ? $this->dir_helper->get_img_path('flags', $this->flag) : '', 'EDIT_MODE' => $mode == 'edit' ? true : false, 'SITE_NAME' => isset($this->site_name) ? $this->site_name : '', 'SITE_URL' => isset($this->url) ? $this->url : '', 'DESCRIPTION' => isset($this->description) ? $this->description : '', 'GUEST_EMAIL' => isset($this->guest_email) ? $this->guest_email : '', 'RSS' => isset($this->rss) ? $this->rss : '', 'BANNER' => isset($this->banner) ? $this->banner : '', 'BACK' => isset($this->back) ? $this->back : '', 'S_POST_ACTION' => '', 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), 'S_LIST_FLAG' => $this->link->get_dir_flag_list($flag_path, $this->flag), 'S_DESC_STAR' => @$this->categorie->data['cat_must_describe'] ? '*' : '', 'S_ROOT' => $cat_id, 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields)));
 }
    /**
     * View controller for display a category
     *
     * @param	int		$cat_id		The category ID
     * @param	int		$page		Page number taken from the URL
     * @param	int		$sort_days	Specifies the maximum amount of days a link may be old
     * @param	string	$sort_key	is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p
     * @param	string	$sort_dir	is either a or d representing ASC and DESC (ascending|descending)
     * @param	string	$mode		watch|unwatch
     * @return	\Symfony\Component\HttpFoundation\Response	A Symfony Response object
     * @throws	\phpbb\exception\http_exception
     */
    public function view($cat_id, $page, $sort_days, $sort_key, $sort_dir, $mode = '')
    {
        if (false === $this->categorie->get($cat_id)) {
            throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_CATS');
        }
        $start = ($page - 1) * $this->config['dir_show'];
        $default_sort_days = 0;
        $default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1);
        $default_sort_dir = (string) substr($this->config['dir_default_order'], 2);
        $sort_days = !$sort_days ? $this->request->variable('st', $default_sort_days) : $sort_days;
        $sort_key = !$sort_key ? $this->request->variable('sk', $default_sort_key) : $sort_key;
        $sort_dir = !$sort_dir ? $this->request->variable('sd', $default_sort_dir) : $sort_dir;
        $link_list = $rowset = array();
        // Categorie ordering options
        $limit_days = array(0 => $this->user->lang['SEE_ALL'], 1 => $this->user->lang['1_DAY'], 7 => $this->user->lang['7_DAYS'], 14 => $this->user->lang['2_WEEKS'], 30 => $this->user->lang['1_MONTH'], 90 => $this->user->lang['3_MONTHS'], 180 => $this->user->lang['6_MONTHS'], 365 => $this->user->lang['1_YEAR']);
        $sort_by_text = array('a' => $this->user->lang['AUTHOR'], 't' => $this->user->lang['POST_TIME'], 'r' => $this->user->lang['DIR_COMMENTS_ORDER'], 's' => $this->user->lang['DIR_NAME_ORDER'], 'v' => $this->user->lang['DIR_NB_CLICKS_ORDER']);
        $sort_by_sql = array('a' => 'u.username_clean', 't' => array('l.link_time', 'l.link_id'), 'r' => 'l.link_comment', 's' => 'LOWER(l.link_name)', 'v' => 'l.link_view');
        if ($this->config['dir_activ_pagerank']) {
            $sort_by_text['p'] = $this->user->lang['DIR_PR_ORDER'];
            $sort_by_sql['p'] = 'l.link_pagerank';
        }
        $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
        gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
        $u_sort_param = $sort_days === $default_sort_days && $sort_key == $default_sort_key && $sort_dir == $default_sort_dir ? array() : array('sort_days' => $sort_days, 'sort_key' => $sort_key, 'sort_dir' => $sort_dir);
        // Are we watching this categorie?
        $s_watching_categorie = array('link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false);
        if ($this->config['email_enable'] && $this->user->data['is_registered']) {
            $notify_status = isset($this->categorie->data['notify_status']) ? $this->categorie->data['notify_status'] : null;
            if ($message = $this->categorie->watch_categorie($mode, $s_watching_categorie, $this->user->data['user_id'], $cat_id, $notify_status)) {
                return $this->helper->message($message);
            }
        }
        // A deadline has been selected
        if ($sort_days) {
            $min_post_time = time() - $sort_days * 86400;
            $sql = 'SELECT COUNT(link_id) AS nb_links
				FROM ' . DIR_LINK_TABLE . '
				WHERE link_cat = ' . (int) $cat_id . '
					AND link_time >= ' . $min_post_time;
            $result = $this->db->sql_query($sql);
            $nb_links = (int) $this->db->sql_fetchfield('nb_links');
            $this->db->sql_freeresult($result);
            if ($this->request->is_set_post('sort')) {
                $start = 0;
            }
            $sql_limit_time = " AND l.link_time >= {$min_post_time}";
        } else {
            $sql_limit_time = '';
            $nb_links = (int) $this->categorie->data['cat_links'];
        }
        // Make sure $start is set to the last page if it exceeds the amount
        $start = $this->pagination->validate_start($start, $this->config['dir_show'], $nb_links);
        // Build navigation links
        $this->categorie->generate_dir_nav($this->categorie->data);
        // Jumpbox
        $this->categorie->make_cat_jumpbox();
        $base_url = array('routes' => 'ernadoo_phpbbdirectory_page_controller', 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param));
        $this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_links, $this->config['dir_show'], $start);
        $this->template->assign_vars(array('S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_page_controller', array('cat_id' => $cat_id, 'page' => $page)), 'S_CAT_ID' => $cat_id, 'TOTAL_LINKS' => $this->user->lang('DIR_NB_LINKS', (int) $nb_links), 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), 'U_WATCH_CAT' => $s_watching_categorie['link'], 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], 'S_WATCH_CAT_TOGGLE' => $s_watching_categorie['title_toggle'], 'S_WATCHING_CAT' => $s_watching_categorie['is_watching']));
        // If the user is trying to reach late pages, start searching from the end
        $store_reverse = false;
        $sql_limit = $this->config['dir_show'];
        if ($start > $nb_links / 2) {
            $store_reverse = true;
            // Select the sort order
            $direction = $sort_dir == 'd' ? 'ASC' : 'DESC';
            $sql_limit = $this->pagination->reverse_limit($start, $sql_limit, $nb_links);
            $sql_start = $this->pagination->reverse_start($start, $sql_limit, $nb_links);
        } else {
            // Select the sort order
            $direction = $sort_dir == 'd' ? 'DESC' : 'ASC';
            $sql_start = $start;
        }
        if (is_array($sort_by_sql[$sort_key])) {
            $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
        } else {
            $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
        }
        // Grab just the sorted link ids
        $sql_array = array('SELECT' => 'l.link_id', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id')), 'WHERE' => "l.link_cat = {$cat_id}\n\t\t\t\tAND l.link_active = 1\n\t\t\t\t\t{$sql_limit_time}", 'ORDER_BY' => $sql_sort_order);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $sql_limit, $sql_start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $link_list[] = (int) $row['link_id'];
        }
        $this->db->sql_freeresult($result);
        if (sizeof($link_list)) {
            // We get links, informations about poster, votes and number of comments
            $sql_array = array('SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_banner, l.link_rss, l. link_uid, l.link_bitfield, l.link_flags, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_flag, l.link_pagerank, l.link_thumb, u.user_id, u.username, u.user_colour, v.vote_user_id', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id'), array('FROM' => array(DIR_VOTE_TABLE => 'v'), 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'])), 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list));
            $sql = $this->db->sql_build_query('SELECT', $sql_array);
            $result = $this->db->sql_query($sql);
            while ($site = $this->db->sql_fetchrow($result)) {
                $rowset[$site['link_id']] = $site;
            }
            $this->db->sql_freeresult($result);
            $link_list = $store_reverse ? array_reverse($link_list) : $link_list;
            $votes_status = $this->categorie->data['cat_allow_votes'] ? true : false;
            $comments_status = $this->categorie->data['cat_allow_comments'] ? true : false;
            foreach ($link_list as $link_id) {
                $site =& $rowset[$link_id];
                $s_flag = $this->link->display_flag($site);
                $s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status);
                $s_thumb = $this->link->display_thumb($site);
                $s_vote = $this->link->display_vote($site);
                $s_banner = $this->link->display_bann($site);
                $s_pr = $this->link->display_pagerank($site);
                $s_rss = $this->link->display_rss($site);
                $edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || $this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir'));
                $delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_dir') || $this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_delete_dir'));
                $this->template->assign_block_vars('site', array('BANNER' => $s_banner, 'COUNT' => $this->user->lang('DIR_NB_CLICKS', (int) $site['link_view']), 'DESCRIPTION' => generate_text_for_display($site['link_description'], $site['link_uid'], $site['link_bitfield'], $site['link_flags']), 'LINK_ID' => $site['link_id'], 'NAME' => $site['link_name'], 'NB_COMMENT' => $comments_status ? $this->user->lang('DIR_NB_COMMS', (int) $site['link_comment']) : '', 'NB_VOTE' => $this->user->lang('DIR_NB_VOTES', (int) $site['link_vote']), 'NOTE' => $s_note, 'PAGERANK' => $s_pr, 'RSS' => $s_rss, 'TIME' => $site['link_time'] ? $this->user->format_date($site['link_time']) : '', 'USER' => get_username_string('full', $site['link_user_id'], $site['username'], $site['user_colour']), 'VOTE_LIST' => $votes_status ? $s_vote : '', 'IMG_FLAG' => $s_flag, 'ON_CLICK' => "onclick=\"window.open('" . $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $site['link_id'])) . "'); return false;\"", 'S_NEW_LINK' => (time() - $site['link_time']) / 86400 <= $this->config['dir_new_time'] ? true : false, 'U_COMMENT' => $comments_status ? $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $site['link_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_delete_controller', array('cat_id' => (int) $cat_id, 'link_id' => (int) $site['link_id'], '_referer' => $this->helper->get_current_url())) : '', 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_edit_controller', array('cat_id' => (int) $cat_id, 'link_id' => (int) $site['link_id'])) : '', 'U_FORM_VOTE' => $votes_status ? $this->helper->route('ernadoo_phpbbdirectory_vote_controller', array('cat_id' => (int) $site['link_cat'], 'link_id' => (int) $site['link_id'])) : '', 'U_LINK' => $site['link_url'], 'U_THUMB' => $s_thumb));
            }
        } else {
            $this->template->assign_block_vars('no_draw_link', array());
        }
        $page_title = $this->user->lang['DIRECTORY'] . ' - ' . $this->categorie->data['cat_name'];
        $this->categorie->display();
        return $this->helper->render('view_cat.html', $page_title);
    }
 /**
  * Notify users which watch categories
  *
  * @param	$row Informations about website
  * @return	null
  */
 private function _notify_suscribers($row)
 {
     $notification_data = array('user_from' => (int) $row['link_user_id'], 'link_id' => (int) $row['link_id'], 'link_name' => $row['link_name'], 'link_url' => $row['link_url'], 'link_description' => preg_replace('/(\\[.*?\\])(.*?)(\\[\\/.*?\\])/si', '\\1', $row['link_description']), 'cat_name' => \ernadoo\phpbbdirectory\core\categorie::getname((int) $row['link_cat']), 'cat_id' => (int) $row['link_cat']);
     $this->notification->add_notifications('ernadoo.phpbbdirectory.notification.type.directory_website', $notification_data);
 }
Example #6
0
    /**
     * 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);
            }
        }
    }