public function install_bbcode()
 {
     $sql = 'SELECT bbcode_id FROM ' . $this->table_prefix . 'bbcodes WHERE LOWER(bbcode_tag) = \'image\'';
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if (!$row) {
         // Create new BBCode
         $sql = 'SELECT MAX(bbcode_id) AS max_bbcode_id FROM ' . $this->table_prefix . 'bbcodes';
         $result = $this->db->sql_query($sql);
         $row = $this->db->sql_fetchrow($result);
         $this->db->sql_freeresult($result);
         if ($row) {
             $bbcode_id = $row['max_bbcode_id'] + 1;
             // Make sure it is greater than the core BBCode ids...
             if ($bbcode_id <= NUM_CORE_BBCODES) {
                 $bbcode_id = NUM_CORE_BBCODES + 1;
             }
         } else {
             $bbcode_id = NUM_CORE_BBCODES + 1;
         }
         $url = generate_board_url() . '/';
         if ($this->config['enable_mod_rewrite']) {
             $url .= 'gallery/image/';
         } else {
             $url .= 'app.php/gallery/image/';
         }
         if ($bbcode_id <= BBCODE_LIMIT) {
             $this->db->sql_query('INSERT INTO ' . $this->table_prefix . 'bbcodes ' . $this->db->sql_build_array('INSERT', array('bbcode_tag' => 'image', 'bbcode_id' => (int) $bbcode_id, 'bbcode_helpline' => 'GALLERY_HELPLINE_ALBUM', 'display_on_posting' => 1, 'bbcode_match' => '[image]{NUMBER}[/image]', 'bbcode_tpl' => '<a href="' . $url . '{NUMBER}"><img src="' . $url . '{NUMBER}/mini" alt="{NUMBER}" /></a>', 'first_pass_match' => '!\\[image\\]([0-9]+)\\[/image\\]!i', 'first_pass_replace' => '[image:$uid]${1}[/image:$uid]', 'second_pass_match' => '!\\[image:$uid\\]([0-9]+)\\[/image:$uid\\]!s', 'second_pass_replace' => '<a href="' . $url . '${1}"><img src="' . $url . '${1}/mini" alt="${1}" /></a>')));
         }
     }
 }
Пример #2
0
 public static function path($directory = 'gallery')
 {
     if (!self::$loaded) {
         self::init();
     }
     switch ($directory) {
         case 'gallery':
             return self::$phpbb_root_path . self::$phpbb_gallery_path;
         case 'phpbb':
             return self::$phpbb_root_path;
         case 'admin':
             return self::$phpbb_admin_path;
         case 'relative':
             return self::$phpbb_gallery_path;
         case 'full':
             return generate_board_url() . '/' . self::$phpbb_gallery_path;
         case 'board':
             return generate_board_url();
         case 'images':
             return self::$phpbb_root_path . self::$phpbb_gallery_path . self::IMAGE_PATH;
         case 'upload':
             return self::$phpbb_root_path . self::$phpbb_gallery_path . self::IMAGE_PATH . self::UPLOAD_PATH;
         case 'upload_noroot':
             // stupid phpbb-upload class prepends the rootpath itself.
             return self::$phpbb_gallery_path . self::IMAGE_PATH . self::UPLOAD_PATH;
         case 'thumbnail':
             return self::$phpbb_root_path . self::$phpbb_gallery_path . self::IMAGE_PATH . self::THUMBNAIL_PATH;
         case 'medium':
             return self::$phpbb_root_path . self::$phpbb_gallery_path . self::IMAGE_PATH . self::MEDIUM_PATH;
         case 'import':
             return self::$phpbb_root_path . self::$phpbb_gallery_path . self::IMAGE_PATH . self::IMPORT_PATH;
     }
     return false;
 }
Пример #3
0
    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template, $phpbb_container;
        if (!$config['allow_password_reset']) {
            trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
        }
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new \phpbb\auth\auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            // Make password at least 8 characters long, make it longer if admin wants to.
            // gen_rand_string() however has a limit of 12 or 13.
            $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
            // For the activation key a random length between 6 and 10 will do.
            $user_actkey = gen_rand_string(mt_rand(6, 10));
            // Instantiate passwords manager
            $passwords_manager = $phpbb_container->get('passwords.manager');
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->set_addresses($user_row);
            $messenger->anti_abuse_headers($config, $user);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
Пример #4
0
 /**
  * Generate the SEO link for a forum
  *
  * @param	int		$forum_id		The ID of the forum
  * @param	string	$forum_name		The title of the forum
  * @param	int		$start			Optional start parameter
  * @param	bool	$full			Return the full URL
  * @return	string	The SEO URL
  * @access private
  */
 public function generate_forum_link($forum_id, $forum_name, $start = 0, $full = false)
 {
     if ($full) {
         return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');
     }
     return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . ($start ? 'index-s' . $start . '.html' : '');
 }
Пример #5
0
    public function get_bookmarks($ext_mode = '', $forums = array())
    {
        define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
        $start = $this->request->variable('start', 0);
        $sql = 'SELECT COUNT(post_id) as posts_count
			FROM ' . POSTS_BOOKMARKS_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'];
        $result = $this->db->sql_query($sql);
        $posts_count = (int) $this->db->sql_fetchfield('posts_count');
        $this->db->sql_freeresult($result);
        $sql_where = $sql_fields = '';
        if ($ext_mode != 'find') {
            $sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
            $sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
        }
        $pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
        $sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
			FROM ' . POSTS_BOOKMARKS_TABLE . ' b
			LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
			LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
			' . $sql_where . '
			WHERE b.user_id = ' . $this->user->data['user_id'] . '
			ORDER BY b.bookmark_time ASC';
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
            $post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
            // Send vars to template
            $this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
    }
Пример #6
0
    public function ucp_register_user_row_after($event)
    {
        if ($this->config['require_activation'] != USER_ACTIVATION_ADMIN) {
            // Grab an array of user_id's with a_user permissions ... these users can activate a user
            $admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
            $admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
            // Also include founders
            $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
            if (sizeof($admin_ary)) {
                $where_sql .= ' OR ' . $this->db->sql_in_set('user_id', $admin_ary);
            }
            $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
				FROM ' . USERS_TABLE . ' ' . $where_sql;
            $result = $this->db->sql_query($sql);
            $data = array('username' => $this->request->variable('username', '', true), 'email' => strtolower($this->request->variable('email', '')), 'user_regdate' => time(), 'user_ip' => $this->user->ip, 'lang' => basename($this->request->variable('lang', $this->user->lang_name)));
            while ($row = $this->db->sql_fetchrow($result)) {
                if (!class_exists('messenger')) {
                    include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
                }
                $messenger = new \messenger(false);
                $server_url = generate_board_url();
                $messenger->template('@dmzx_notifyadmin/admin_notify_registered', $data['lang']);
                $messenger->to($row['user_email'], $row['username']);
                $messenger->im($row['user_jabber'], $row['username']);
                $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'USER_MAIL' => $data['email'], 'USER_REGDATE' => date($this->config['default_dateformat'], $data['user_regdate']), 'USER_IP' => $data['user_ip']));
                $messenger->send(NOTIFY_EMAIL);
            }
            $this->db->sql_freeresult($result);
        }
    }
Пример #7
0
 public function add_page_header_data($event)
 {
     $display = 'small';
     $display2 = 'panel';
     $fields = 'first_name,last_name,email';
     $optional = 'bdate,country,photo,city';
     $providers = 'vkontakte,odnoklassniki,facebook,mailru';
     $hidden = 'other';
     $redirect_uri = urlencode(generate_board_url() . '/ulogin/login?redirect=' . urlencode(generate_board_url(true) . '/' . $this->user->page['page']));
     $callback = 'uloginCallback';
     if (!$this->config['ulogin_id1']) {
         $data_ulogin1 = "display={$display}&fields={$fields}&optional={$optional}&providers={$providers}&hidden={$hidden}&redirect_uri={$redirect_uri}&callback={$callback}";
         $data_uloginid1 = '';
     } else {
         $data_ulogin1 = "redirect_uri={$redirect_uri}&callback={$callback}";
         $data_uloginid1 = $this->config['ulogin_id1'];
     }
     if (!$this->config['ulogin_id2']) {
         $data_ulogin2 = "display={$display2}&fields={$fields}&optional={$optional}&providers={$providers}&hidden={$hidden}&redirect_uri={$redirect_uri}&callback={$callback}";
         $data_uloginid2 = '';
     } else {
         $data_ulogin2 = "redirect_uri={$redirect_uri}&callback={$callback}";
         $data_uloginid2 = $this->config['ulogin_id2'];
     }
     $this->template->assign_vars(array('DATA_ULOGIN1' => $data_ulogin1, 'DATA_ULOGIN2' => $data_ulogin2, 'DATA_ULOGINID1' => $data_uloginid1, 'DATA_ULOGINID2' => $data_uloginid2));
     $this->template->assign_vars(array('ULOGIN_MESSAGE' => $this->request->variable('msg', '', false, \phpbb\request\request_interface::REQUEST)));
 }
 /**
  * Run links through append_sid(), prepend generate_board_url() and remove session id
  */
 public function get_board_url()
 {
     static $board_url;
     if (empty($board_url)) {
         $board_url = generate_board_url();
     }
     return $board_url;
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function get_template_side($module_id)
 {
     //doing the easy way ;)
     $u_link = generate_board_url();
     // Assign specific vars
     $this->template->assign_vars(array('LINK_US_TXT' => sprintf($this->user->lang['LINK_US_TXT'], $this->config['sitename']), 'U_LINK_US' => '&lt;a&nbsp;href=&quot;' . $u_link . '&quot;&nbsp;' . ($this->config['site_desc'] ? 'title=&quot;' . $this->config['site_desc'] . '&quot;' : '') . '&gt;' . ($this->config['sitename'] ? $this->config['sitename'] : $u_link) . '&lt;/a&gt;'));
     return 'link_us_side.html';
 }
Пример #10
0
 public function createAkismet()
 {
     if (empty($this->akismet_api_key)) {
         $this->log->add('critical', ANONYMOUS, $this->user->data['session_ip'], 'AKISMET_LOG_NO_KEY_CONFIGURED');
         return false;
     } else {
         return new \TijsVerkoyen\Akismet\Akismet($this->akismet_api_key, generate_board_url());
     }
 }
Пример #11
0
    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = max(6, $key_len);
            // we want at least 6
            $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
            // we want at most $config['max_pass_chars']
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
Пример #12
0
function get_tapatlk_location()
{
    global $user, $phpbb_root_path;
    $location = $user->extract_current_page($phpbb_root_path);
    $param_arr = array();
    switch ($location['page_name']) {
        case "viewforum.php":
            if (!empty($_GET['f'])) {
                $param_arr['fid'] = $_GET['f'];
            }
            $param_arr['location'] = 'forum';
            break;
        case "index.php":
        case '':
            $param_arr['location'] = 'index';
            break;
        case "ucp.php":
            if (!empty($_GET['i']) && $_GET['i'] == "pm") {
                $param_arr['location'] = 'message';
                if (!empty($_GET['p'])) {
                    $param_arr['mid'] = $_GET['p'];
                }
            }
            if (!empty($_GET['mode']) && $_GET['mode'] == 'login') {
                $param_arr['location'] = 'login';
            }
            break;
        case "search.php":
            $param_arr['location'] = "search";
            break;
        case "viewtopic.php":
            if (!empty($_GET['t'])) {
                //$param_arr['fid'] = $parameters['fid'];
                $param_arr['location'] = 'topic';
                $param_arr['tid'] = $_GET['t'];
            }
            break;
        case "memberlist.php":
            if (!empty($_GET['mode']) && $_GET['mode'] == "viewprofile" && !empty($_GET['u'])) {
                $param_arr['location'] = 'profile';
                $param_arr['uid'] = $_GET['u'];
            }
            break;
        case "viewonline.php":
            $param_arr['location'] = 'online';
            break;
        default:
            $param_arr['location'] = 'index';
            break;
    }
    $queryString = http_build_query($param_arr);
    $url = generate_board_url() . '/?' . $queryString;
    $url = preg_replace('/^(http|https)/isU', 'tapatalk', $url);
    return $url;
}
Пример #13
0
 public function redirect()
 {
     $url_root = generate_board_url();
     $rewrite_prefix = !empty($this->config['enable_mod_rewrite']) ? '' : 'app.php/';
     $redirects = array(array(append_sid($this->root_path . 'index.' . $this->php_ext), 'index.php'), array(append_sid($this->root_path . 'foo/bar/index.' . $this->php_ext), 'foo/bar/index.php'), array(append_sid($this->root_path . 'tests/index.' . $this->php_ext), 'tests/index.php'), array($this->helper->route('foo_index_controller'), $rewrite_prefix . 'index'), array($this->helper->route('foo_tests_index_controller'), $rewrite_prefix . 'tests/index'));
     foreach ($redirects as $redirect) {
         $this->template->assign_block_vars('redirects', array('URL' => redirect($redirect[0], true)));
         $this->template->assign_block_vars('redirects_expected', array('URL' => $this->path_helper->clean_url($url_root . '/' . $redirect[1])));
     }
     return $this->helper->render('redirect_body.html');
 }
Пример #14
0
 /**
  * Set data used in javascript
  */
 public function set_javascript_data($route, $style_id)
 {
     $board_url = generate_board_url();
     $ajax_url = $board_url . (!$this->config['enable_mod_rewrite'] ? '/app.' . $this->php_ext : '');
     $is_default_route = $u_default_route = false;
     if ($this->config['sitemaker_default_layout']) {
         $is_default_route = $this->config['sitemaker_default_layout'] === $route ? true : false;
         $u_default_route .= $board_url . '/' . $this->config['sitemaker_default_layout'];
         $u_default_route = reapply_sid($u_default_route);
     }
     $this->template->assign_vars(array('S_IS_DEFAULT' => $is_default_route, 'PAGE_URL' => build_url(array('style')), 'UA_ROUTE' => $route, 'UA_AJAX_URL' => $ajax_url, 'UA_BOARD_URL' => $board_url, 'UA_STYLE_ID' => $style_id, 'U_VIEW_DEFAULT' => $u_default_route));
 }
Пример #15
0
 public function submit_post_vk($event)
 {
     $mode = $event['mode'];
     if ($mode == 'post' && !isset($_POST['vkrepost']) && !empty($this->config['vk_repost_group']) && !empty($this->config['vk_token'])) {
         $data = $event['data'];
         if (!$this->exclude_forum($data['forum_id'], $this->config['vk_repost_forum'])) {
             include_once $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext;
             $text = $data['message'];
             strip_bbcode($text);
             $this->vkRepost($text, generate_board_url() . '/viewtopic.' . $this->php_ext . '?t=' . $data['topic_id'], $event['subject']);
         }
     }
 }
 function main($id, $mode)
 {
     global $cache, $config, $db, $phpbb_log, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
     $this->cache = $cache;
     $this->config = $config;
     $this->config_text = $phpbb_container->get('config_text');
     $this->db = $db;
     $this->log = $phpbb_log;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     $this->phpbb_container = $phpbb_container;
     // Add the board rules ACP lang file
     $this->user->add_lang_ext('darkdiesel/pagescroller', 'pagescroller_acp');
     $this->tpl_name = 'pagescroller';
     $this->page_title = $user->lang('ACP_PAGESCROLLER_SETTINGS');
     add_form_key('darkdiesel/pagescroller');
     /** @var \darkdiesel\pagescroller\event\main_listener $listener */
     $listener = $this->phpbb_container->get('darkdiesel.pagescroller.listener');
     $scroller_styles = $listener->get_images('.svg', 'chevron-up-style');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('darkdiesel/pagescroller')) {
             $this->user->add_lang('acp/common');
             trigger_error('FORM_INVALID');
         }
         $this->config->set('darkdiesel_pagescroller_horizontal_pos', $this->request->variable('darkdiesel_pagescroller_horizontal_pos', 'right'));
         $this->config->set('darkdiesel_pagescroller_vertical_pos', $this->request->variable('darkdiesel_pagescroller_vertical_pos', 'bottom'));
         $this->config->set('darkdiesel_pagescroller_style_type', $this->request->variable('darkdiesel_pagescroller_style_type', '1'));
         $this->config->set('darkdiesel_pagescroller_style_hide_btns', $this->request->variable('darkdiesel_pagescroller_style_hide_btns', 'false'));
         $this->config->set('darkdiesel_pagescroller_style_bgcolor', $this->request->variable('darkdiesel_pagescroller_style_bgcolor', '#0076b1'));
         $this->config->set('darkdiesel_pagescroller_style_chevroncolor', $this->request->variable('darkdiesel_pagescroller_style_chevroncolor', '#FFFFFF'));
         $this->config->set('darkdiesel_pagescroller_scroll_up_speed', $this->request->variable('darkdiesel_pagescroller_scroll_up_speed', '800'));
         $this->config->set('darkdiesel_pagescroller_scroll_down_speed', $this->request->variable('darkdiesel_pagescroller_scroll_down_speed', '800'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_enable', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_enable', 'false'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_show', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_show', '200'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_duration_hide', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_duration_hide', '500'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_visible_part', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_visible_part', '20'));
         $this->config->set('darkdiesel_pagescroller_animation_hideshow_distance_to_page', $this->request->variable('darkdiesel_pagescroller_animation_hideshow_distance_to_page', '0'));
         trigger_error($user->lang('ACP_PAGESCROLLER_SETTING_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'DARKDIESEL_PAGESCROLLER_HORIZONTAL_POS' => $this->config['darkdiesel_pagescroller_horizontal_pos'], 'DARKDIESEL_PAGESCROLLER_VERTICAL_POS' => $this->config['darkdiesel_pagescroller_vertical_pos'], 'DARKDIESEL_PAGESCROLLER_STYLE_TYPE' => $this->config['darkdiesel_pagescroller_style_type'], 'DARKDIESEL_PAGESCROLLER_STYLE_HIDE_BTNS' => $this->config['darkdiesel_pagescroller_style_hide_btns'], 'DARKDIESEL_PAGESCROLLER_STYLE_BGCOLOR' => $this->config['darkdiesel_pagescroller_style_bgcolor'], 'DARKDIESEL_PAGESCROLLER_STYLE_CHEVRONCOLOR' => $this->config['darkdiesel_pagescroller_style_chevroncolor'], 'DARKDIESEL_PAGESCROLLER_SCROLL_UP_SPEED' => $this->config['darkdiesel_pagescroller_scroll_up_speed'], 'DARKDIESEL_PAGESCROLLER_SCROLL_DOWN_SPEED' => $this->config['darkdiesel_pagescroller_scroll_down_speed'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_ENABLE' => $this->config['darkdiesel_pagescroller_animation_hideshow_enable'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_SHOW' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_show'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DURATION_HIDE' => $this->config['darkdiesel_pagescroller_animation_hideshow_duration_hide'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_VISIBLE_PART' => $this->config['darkdiesel_pagescroller_animation_hideshow_visible_part'], 'DARKDIESEL_PAGESCROLLER_ANIMATION_HIDESHOW_DISTANCE_TO_PAGE' => $this->config['darkdiesel_pagescroller_animation_hideshow_distance_to_page'], 'S_DARKDIESEL_PAGESCROLLER' => true));
     for ($i = 0; $i < count($scroller_styles); $i++) {
         $img = 'pagescroller/styles/all/theme/assets/images/' . 'chevron-up-style' . ($i + 1) . '.svg';
         $img_url = isset($scroller_styles['ext/' . $img]) ? '/ext/darkdiesel/' . $img : '';
         $this->template->assign_block_vars('style_images', array('STYLE' => $i + 1, 'IMAGE' => generate_board_url() . $img_url));
     }
 }
Пример #17
0
/**
* .com custom header and footer
*/
function phpbb_com_titania_page_header($hook, $page_title)
{
    if (defined('TEST_INSTALLATION')) {
        return;
    }
    phpbb::$template->assign_vars(array('S_BODY_CLASS' => 'customise customisation-database', 'S_IS_WEBSITE' => true));
    global $auth, $phpEx, $template, $user;
    $root_path = TITANIA_ROOT . '../../';
    $base_path = generate_board_url(true) . '/';
    include $root_path . 'vars.' . PHP_EXT;
    // Setup the phpBB.com header
    phpbb::$template->set_custom_template(TITANIA_ROOT . '../../template/', 'website');
    phpbb::$template->set_filenames(array('phpbb_com_header' => 'overall_header.html'));
    phpbb::$template->assign_display('phpbb_com_header', 'PHPBB_COM_HEADER', false);
    titania::set_custom_template();
}
Пример #18
0
    public function index()
    {
        header('Content-Type: application/xml');
        $board_url = generate_board_url();
        $sql = 'SELECT forum_id, forum_name, forum_last_post_time
			FROM ' . FORUMS_TABLE . '
			WHERE forum_type = ' . (int) FORUM_POST . '
			ORDER BY left_id ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            if ($this->auth->acl_get('f_list', $row['forum_id'])) {
                $this->template->assign_block_vars('forumlist', array('URL' => $board_url . '/seositemap-' . $row['forum_id'] . '.xml', 'TIME' => gmdate('Y-m-d\\TH:i:s+00:00', (int) $row['forum_last_post_time'])));
            }
        }
        return $this->helper->render('sitemap_index.html');
    }
Пример #19
0
    /**
     * Runs this cron task.
     *
     * @return null
     */
    public function run()
    {
        $time = $this->user->create_datetime();
        $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
        // Display birthdays of 29th february on 28th february in non-leap-years
        $leap_year_birthdays = '';
        if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) {
            $leap_year_birthdays = ' OR user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", 29, 2)) . '%"';
        }
        $sql = 'SELECT user_id, username, user_email, user_lang, 
				YEAR(CURRENT_TIMESTAMP) - YEAR(str_to_date(user_birthday, "%d-%m-%Y")) AS age
				FROM ' . USERS_TABLE . ' 
				WHERE user_birthday <> " 0- 0-   0" AND user_birthday <> "" AND 
				(user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", $now["mday"], $now["mon"])) . '%"' . $leap_year_birthdays . ') AND 
				email_on_birthday + 15778463 < UNIX_TIMESTAMP(now())';
        $result = $this->db->sql_query($sql);
        $msg_list = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $msg_list[] = array('user_id' => $row['user_id'], 'name' => $row['username'], 'email' => $row['user_email'], 'lang' => $row['user_lang'], 'age' => $this->convertNumber($row['age']) . $this->text_number($row['age']), 'time' => time());
        }
        if (sizeof($msg_list)) {
            if ($this->config['email_enable']) {
                if (!class_exists('messenger')) {
                    include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
                }
                $server_url = generate_board_url();
                $messenger = new \messenger(false);
                foreach ($msg_list as $key => $value) {
                    $messenger->template('@forumhulp_emailonbirthday/emailonbirthday', $value['lang']);
                    $messenger->to($value['email'], $value['name']);
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $value['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $value['name']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . '127.0.0.1');
                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($value['name']), 'BIRTHDAY' => $value['age'], 'SITENAME' => $this->config['sitename']));
                    $messenger->send(NOTIFY_EMAIL);
                    $sql = 'UPDATE ' . USERS_TABLE . ' SET email_on_birthday = ' . time() . ' WHERE user_id = ' . $value['user_id'];
                    $this->db->sql_query($sql);
                }
                $userlist = array_map(function ($entry) {
                    return $entry['name'];
                }, $msg_list);
                $this->log->add('admin', $this->user->data['user_id'], $this->user->data['session_ip'], 'BIRTHDAYSEND', false, array(implode(', ', $userlist)));
            }
        }
        $this->config->set('email_on_birthday_last_gc', time());
    }
Пример #20
0
 /**
  * Controller for /idea/{idea_id}
  *
  * @param $idea_id int The ID of the requested idea, maybe?
  * @throws http_exception
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function idea($idea_id)
 {
     if (!$this->is_available()) {
         throw new http_exception(404, 'IDEAS_NOT_AVAILABLE');
     }
     $this->data = $this->ideas->get_idea($idea_id);
     if (!$this->data) {
         throw new http_exception(404, 'IDEA_NOT_FOUND');
     }
     $mode = $this->request->variable('mode', '');
     if ($this->request->is_ajax() && !empty($mode)) {
         $result = call_user_func(array($this, $mode));
         return new \Symfony\Component\HttpFoundation\JsonResponse($result);
     }
     $url = append_sid(generate_board_url() . "/viewtopic.{$this->php_ext}", array('f' => $this->config['ideas_forum_id'], 't' => $this->data['topic_id']), false);
     return new RedirectResponse($url);
 }
Пример #21
0
 /**
  * @dataProvider email_parsing_data
  */
 public function test_email_parsing($author_name, $forum_name, $topic_title, $username)
 {
     global $config, $phpEx, $user;
     $this->messenger->set_addresses($user->data);
     $this->messenger->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), 'SITENAME' => htmlspecialchars_decode($config['sitename']), 'AUTHOR_NAME' => $author_name, 'FORUM_NAME' => $forum_name, 'TOPIC_TITLE' => $topic_title, 'USERNAME' => $username, 'U_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?f=1", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?uid=2&f=1&unwatch=forum"));
     $this->messenger->template('newtopic_notify', $user->data['user_lang'], '', '');
     $reflection_template = $this->reflection_template_property->getValue($this->messenger);
     $msg = trim($reflection_template->assign_display('body'));
     $this->assertContains($author_name, $msg);
     $this->assertContains($forum_name, $msg);
     $this->assertContains($topic_title, $msg);
     $this->assertContains($username, $msg);
     $this->assertContains(htmlspecialchars_decode($config['sitename']), $msg);
     $this->assertContains(str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), $msg);
     $this->assertNotContains('EMAIL_SIG', $msg);
     $this->assertNotContains('U_STOP_WATCHING_FORUM', $msg);
 }
 /**
  * Changes the regex replacement for second pass
  *
  * @param object $event
  * @return null
  * @access public
  */
 public function modify_case_img($event)
 {
     $bbcode_id = 4;
     // [img] has bbcode_id 4 hardcoded
     $bbcode_cache = $event['bbcode_cache'];
     if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) {
         return;
     }
     $this->template->set_filenames(array('bbcode.html' => 'bbcode.html'));
     $bbcode = new \bbcode();
     // We need these otherwise we cannot use $bbcode->bbcode_tpl()
     $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']);
     $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html');
     $extimgaslink_boardurl = generate_board_url() . '/';
     $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$2', $this->user->lang('EXTIMGLINK'), $bbcode->bbcode_tpl('url', $bbcode_id, true))));
     $event['bbcode_cache'] = $bbcode_cache;
 }
Пример #23
0
 public function medal_row($rowset2)
 {
     $medal_width = $this->config['medal_small_img_width'] ? ' width="' . $this->config['medal_small_img_width'] . '"' : '';
     $medal_height = $this->config['medal_small_img_ht'] ? ' height="' . $this->config['medal_small_img_ht'] . '"' : '';
     $medal_rows = $this->config['medal_topic_col'] ? $this->config['medal_topic_col'] : 1;
     $medal_cols = $this->config['medal_topic_row'] ? $this->config['medal_topic_row'] : 1;
     $split_row = $medal_cols - 1;
     $s_colspan = 0;
     $row = 0;
     $col = 0;
     $img = '';
     while (list($image, $medal) = @each($rowset2)) {
         if (!$col) {
             $img .= '<br />';
         }
         if ($medal['count'] > 1) {
             if ($medal['dynamic']) {
                 $device = generate_board_url() . '/images/medals/devices/' . $medal['device'] . '-' . ($medal['count'] - 1) . '.gif';
                 $image = generate_board_url() . '/medals.php?m=mi&med=' . generate_board_url() . '/images/medals/' . $image . '&' . 'd=' . $device;
                 // $image = generate_board_url() . '/images/medals/' . $image ;
             } else {
                 $cluster = '-' . $medal['count'];
                 $device_image = substr_replace($image, $cluster, -4) . substr($image, -4);
                 if (file_exists($device_image)) {
                     $image = $device_image;
                 }
                 $image = generate_board_url() . '/images/medals/' . $image;
             }
         } else {
             $image = generate_board_url() . '/images/medals/' . $image;
         }
         $img .= '<img src="' . $image . '" alt="' . $medal['name'] . '" title="' . $medal['name'] . ' (' . $medal['count'] . ')"' . $medal_width . $medal_height . ' /> ';
         $s_colspan = max($s_colspan, $col + 1);
         if ($col == $split_row) {
             if ($row == $medal_rows - 1) {
                 break;
             }
             $col = 0;
             $row++;
         } else {
             $col++;
         }
     }
     return array('PROFILE_FIELD_IDENT' => 'medals', 'PROFILE_FIELD_NAME' => '', 'PROFILE_FIELD_VALUE' => $img, 'S_PROFILE_CONTACT' => false);
 }
Пример #24
0
 /**
  * Changes the regex replacement for second pass
  *
  * Based on phpBB.de - External Image as Link from Christian Schnegelberger<*****@*****.**> and Oliver Schramm <*****@*****.**>
  *
  * @param object $event
  * @return null
  * @access public
  */
 public function bbcode_cache_init_end($event)
 {
     $bbcode_id = 4;
     // [img] has bbcode_id 4 hardcoded
     $bbcode_cache = $event['bbcode_cache'];
     if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) {
         return;
     }
     $this->template->set_filenames(array('bbcode.html' => 'bbcode.html'));
     $bbcode = new \bbcode();
     // We need these otherwise we cannot use $bbcode->bbcode_tpl()
     $bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']);
     $bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html');
     $extimgaslink_boardurl = generate_board_url() . '/';
     $url = $this->helper->route('tas2580_imageproxy_main', array());
     $bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$1', $url . '?img=$1', $bbcode->bbcode_tpl('img', $bbcode_id, true))));
     $event['bbcode_cache'] = $bbcode_cache;
 }
Пример #25
0
 public function info($user_id)
 {
     if (!$this->auth->acl_gets('u_viewprofile')) {
         trigger_error('NOT_AUTHORISED');
     }
     $sql_ary = array('SELECT' => 'u.username, u.user_colour, u.user_regdate, u.user_posts, u.user_lastvisit, u.user_rank, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'u.user_id = ' . (int) $user_id);
     /**
      * Modify SQL query in tas2580 AJAX userinfo extension
      *
      * @event tas2580.userinfo_modify_sql
      * @var    string		sql_ary	The SQL query
      * @var    int		user_id	The ID of the user
      * @since 0.2.3
      */
     $vars = array('sql_ary', 'user_id');
     extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_sql', compact($vars)));
     $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1);
     $this->data = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if (!function_exists('phpbb_get_user_rank')) {
         include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     }
     $user_rank_data = phpbb_get_user_rank($this->data, $this->data['user_posts']);
     // Get the avatar
     // Wen need to use the full URL here because we don't know the path where userinfo is called
     define('PHPBB_USE_BOARD_URL_PATH', true);
     $avatar = phpbb_get_user_avatar($this->data);
     $avatar = empty($avatar) ? '<img src="' . generate_board_url() . '/styles/' . $this->user->style['style_name'] . '/theme/images/no_avatar.gif" width="100" height="100" alt="' . $this->user->lang('USER_AVATAR') . '">' : $avatar;
     $memberdays = max(1, round((time() - $this->data['user_regdate']) / 86400));
     $posts_per_day = $this->data['user_posts'] / $memberdays;
     $percentage = $this->config['num_posts'] ? min(100, $this->data['user_posts'] / $this->config['num_posts'] * 100) : 0;
     $result = array('userinfo_header' => sprintf($this->user->lang['VIEWING_PROFILE'], $this->data['username']), 'username' => get_username_string('no_profile', $user_id, $this->data['username'], $this->data['user_colour']), 'regdate' => $this->user->format_date($this->data['user_regdate']), 'posts' => $this->data['user_posts'], 'lastvisit' => $this->user->format_date($this->data['user_lastvisit']), 'avatar' => $avatar, 'rank' => empty($user_rank_data['title']) ? $this->user->lang('NA') : $user_rank_data['title'], 'postsperday' => $this->user->lang('POST_DAY', $posts_per_day), 'percentage' => $this->user->lang('POST_PCT', $percentage));
     /**
      * Modify return data in tas2580 AJAX userinfo extension
      *
      * @event tas2580.userinfo_modify_result
      * @var    array	result	The result array
      * @var    int	user_id	The ID of the user
      * @since 0.2.3
      */
     $vars = array('result', 'user_id');
     extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_result', compact($vars)));
     return new JsonResponse($result);
 }
Пример #26
0
 public function handle($action)
 {
     $return_data = array();
     if ($this->request->is_ajax() === false) {
         redirect(generate_board_url(), $this->return_url);
         $return_data['message'] = $this->user->lang('NOT_AUTHORISED');
         return new Response(json_encode($return_data), 401);
     }
     try {
         $command = $this->action_handler->create($action);
         $return_data = $command->execute();
         $this->action_handler->clear_cache();
     } catch (\blitze\sitemaker\exception\base $e) {
         $return_data['message'] = $e->get_message($this->user);
     } catch (\Exception $e) {
         $return_data['message'] = $this->user->lang($e->getMessage());
     }
     return new Response(json_encode($return_data));
 }
Пример #27
0
    public function handle()
    {
        // Do we have the donation extension enabled
        if (isset($this->config['donation_enable']) && $this->config['donation_enable'] == 0) {
            trigger_error($this->user->lang['DONATION_DISABLED'], E_USER_NOTICE);
        }
        if (isset($this->config['donation_email']) && $this->config['donation_email'] == '') {
            trigger_error($this->user->lang['DONATION_DISABLED_EMAIL'], E_USER_NOTICE);
        }
        $sql = 'SELECT *
		FROM ' . $this->donation_table;
        $result = $this->db->sql_query($sql);
        $donation = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $donation[$row['config_name']] = $row['config_value'];
        }
        $this->db->sql_freeresult($result);
        $donation_body = isset($donation['donation_body']) ? $donation['donation_body'] : '';
        $donation_cancel = isset($donation['donation_cancel']) ? $donation['donation_cancel'] : '';
        $donation_success = isset($donation['donation_success']) ? $donation['donation_success'] : '';
        $success_url = generate_board_url() . '/app.php/donation?mode=success';
        $cancel_url = generate_board_url() . '/app.php/donation?mode=cancel';
        $mode = $this->request->variable('mode', '');
        if (!empty($this->config['donation_goal_enable']) && $this->config['donation_goal'] > 0) {
            $donation_goal_number = $this->config['donation_achievement'] * 100 / $this->config['donation_goal'];
            $this->template->assign_vars(array('DONATION_GOAL_NUMBER' => round($donation_goal_number)));
        }
        // Lets build a page ...
        $this->template->assign_vars(array('U_DONATE_SUCCESS' => $success_url, 'U_DONATE_CANCEL' => $cancel_url, 'DONATION_EMAIL' => $this->config['donation_email'], 'DONATION_ACHIEVEMENT_ENABLE' => $this->config['donation_achievement_enable'], 'DONATION_ACHIEVEMENT' => $this->config['donation_achievement'], 'DONATION_GOAL_ENABLE' => $this->config['donation_goal_enable'], 'DONATION_GOAL' => $this->config['donation_goal'], 'DONATION_GOAL_CURRENCY_ENABLE' => $this->config['donation_goal_currency_enable'], 'DONATION_GOAL_CURRENCY' => $this->config['donation_goal_currency'], 'DONATION_BODY' => html_entity_decode($donation_body), 'DONATION_CANCEL' => html_entity_decode($donation_cancel), 'DONATION_SUCCESS' => html_entity_decode($donation_success)));
        // Set up Navlinks
        $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('DONATION_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('dmzx_donation_controller')));
        switch ($mode) {
            case 'success':
                return $this->helper->render('donate/success_body.html', $this->user->lang('DONATION_SUCCESSFULL_TITLE'));
                break;
            case 'cancel':
                return $this->helper->render('donate/cancel_body.html', $this->user->lang('DONATION_CANCELLED_TITLE'));
                break;
            default:
                return $this->helper->render('donate/donate_body.html', $this->user->lang('DONATION_TITLE'));
                break;
        }
    }
Пример #28
0
 /**
  * Notify using phpBB messenger
  *
  * @param int $notify_method				Notify method for messenger (e.g. NOTIFY_IM)
  * @param string $template_dir_prefix	Base directory to prepend to the email template name
  *
  * @return null
  */
 protected function notify_using_messenger($notify_method, $template_dir_prefix = '')
 {
     if (empty($this->queue)) {
         return;
     }
     // Load all users we want to notify (we need their email address)
     $user_ids = $users = array();
     foreach ($this->queue as $notification) {
         $user_ids[] = $notification->user_id;
     }
     // We do not send emails to banned users
     if (!function_exists('phpbb_get_banned_user_ids')) {
         include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
     }
     $banned_users = phpbb_get_banned_user_ids($user_ids);
     // Load all the users we need
     $this->user_loader->load_users($user_ids);
     // Load the messenger
     if (!class_exists('messenger')) {
         include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
     }
     $messenger = new \messenger();
     // Time to go through the queue and send emails
     /** @var \phpbb\notification\type\type_interface $notification */
     foreach ($this->queue as $notification) {
         if ($notification->get_email_template() === false) {
             continue;
         }
         $user = $this->user_loader->get_user($notification->user_id);
         if ($user['user_type'] == USER_IGNORE || $user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL || in_array($notification->user_id, $banned_users)) {
             continue;
         }
         $messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
         $messenger->set_addresses($user);
         $messenger->assign_vars(array_merge(array('USERNAME' => $user['username'], 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications&mode=notification_options'), $notification->get_email_template_variables()));
         $messenger->send($notify_method);
     }
     // Save the queue in the messenger class (has to be called or these emails could be lost?)
     $messenger->save_queue();
     // We're done, empty the queue
     $this->empty_queue();
 }
Пример #29
0
    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = request_var('email', '');
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_type, user_lang
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND LOWER(username) = '" . $db->sql_escape(strtolower($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                trigger_error('ACCOUNT_NOT_ACTIVATED');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = $key_len < 6 ? 6 : $key_len;
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(md5($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $row['user_lang']);
            $messenger->replyto($user->data['user_email']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'PASSWORD' => html_entity_decode($user_password), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
Пример #30
0
 /**
  * Delete the user
  *
  * @param type $event
  */
 public function ucp_profile_reg_details_data($event)
 {
     $this->user->add_lang(array('acp/common', 'acp/users'));
     $delete_type = request_var('delete_type', '');
     $this->template->assign_vars(array('AUTH_DELETE_POSTS' => $this->auth->acl_get('u_self_delete_posts') ? true : false));
     if ($event['submit'] && $delete_type) {
         if ($this->user->data['user_type'] == USER_FOUNDER) {
             $this->error[] = 'CANNOT_REMOVE_FOUNDER';
         }
         if (!sizeof($this->error)) {
             if (confirm_box(true)) {
                 $delete_type = $this->auth->acl_get('u_self_delete_posts') ? $delete_type : 'remove';
                 user_delete($delete_type, $this->user->data['user_id'], $this->user->data['username']);
                 add_log('admin', 'LOG_USER_DELETED', $this->user->data['username']);
                 trigger_error($this->user->lang['USER_DELETED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . generate_board_url() . '">', '</a>'));
             } else {
                 confirm_box(false, $this->user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('delete' => 1, 'form_token' => $this->request->variable('form_token', ''), 'submit' => true, 'cur_password' => $this->request->variable('cur_password', '', true), 'delete_type' => $delete_type)));
             }
         }
     }
 }