function cms_block_user_block() { global $db, $cache, $config, $template, $user, $lang; /* if($user->data['session_logged_in']) { $sql = "SELECT COUNT(post_id) as total FROM " . POSTS_TABLE . " WHERE post_time >= " . $user->data['user_lastvisit'] . " AND poster_id <> " . $user->data['user_id'] . " AND post_time < " . time(); $db->sql_return_on_error(true); $result = $db->sql_query($sql); $db->sql_return_on_error(false); if($result) { $row = $db->sql_fetchrow($result); $lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")"; $db->sql_freeresult($result); } } */ // Check For Anonymous User if ($user->data['user_id'] != ANONYMOUS) { $name_link = colorize_username($user->data['user_id'], $user->data['username'], $user->data['user_color'], $user->data['user_active']); $avatar_img = user_get_avatar($user->data['user_id'], $user->data['user_level'], $user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_allowavatar']); } else { $name_link = $lang['Guest']; $avatar_img = '<img src="' . $config['default_avatar_guests_url'] . '" alt="" />'; } $s_last_visit = create_date($config['default_dateformat'], $user->data['user_lastvisit'], $config['board_timezone']); $template->assign_vars(array('U_PORTAL_NOSID' => CMS_PAGE_HOME, 'AVATAR_IMG' => $avatar_img, 'U_NAME_LINK' => $name_link, 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'L_REMEMBER_ME' => $lang['Remember_me'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'U_SEND_PASSWORD' => append_sid(CMS_PAGE_PROFILE . '?mode=sendpassword'), 'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=register') . '">', '</a>'), 'L_NEW_SEARCH' => $lang['Search_new'])); }
/** * Returns html string representing the beginning block of a timeline entry * @return string */ public function html_start() { $t_avatar = user_get_avatar($this->user_id, 32); # Avatar div if (!empty($t_avatar)) { $t_class = 'avatar'; $t_src = $t_avatar[0]; } else { $t_class = 'no-avatar'; $t_src = 'images/notice.gif'; } return sprintf('<div class="entry"><div class="%s"><img class="%s" src="%s" /></div><div class="timestamp">%s</div>', $t_class, $t_class, $t_src, $this->format_timestamp($this->timestamp)); }
function cms_block_top_posters() { global $db, $cache, $config, $template, $lang, $block_id, $cms_config_vars; include_once IP_ROOT_PATH . 'includes/functions_users.' . PHP_EXT; $top_posters_n = intval($cms_config_vars['md_total_poster'][$block_id]) ? $cms_config_vars['md_total_poster'][$block_id] : 10; $show_admins = true; $show_mods = true; $top_posters_array = top_posters($top_posters_n, $show_admins, $show_mods, true); $show_avatars = $cms_config_vars['md_show_avatars'][$block_id] == true ? true : false; $template->assign_var('S_SHOW_AVATARS', $show_avatars); for ($i = 0; $i < sizeof($top_posters_array); $i++) { $username2 = $top_posters_array[$i]['username']; $username = colorize_username($top_posters_array[$i]['user_id'], $top_posters_array[$i]['username'], $top_posters_array[$i]['user_color'], $top_posters_array[$i]['user_active']); $user_id = $top_posters_array[$i]['user_id']; $posts = $top_posters_array[$i]['user_posts'] ? $top_posters_array[$i]['user_posts'] : 0; $poster_avatar = user_get_avatar($top_posters_array[$i]['user_id'], $top_posters_array[$i]['user_level'], $top_posters_array[$i]['user_avatar'], $top_posters_array[$i]['user_avatar_type'], $top_posters_array[$i]['user_allowavatar']); $template->assign_block_vars('topposter', array('USERNAME' => $username, 'POSTS' => $posts, 'AVATAR_IMG' => $poster_avatar, 'U_VIEWPOSTER' => append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id), 'U_VIEWPOSTS' => append_sid(CMS_PAGE_SEARCH . '?search_author=' . urlencode(ip_utf8_decode($username2)) . '&showresults=posts'))); } }
// $template->assign_vars(array('L_TITLE' => $lang['Userlist'], 'L_DESCRIPTION' => $lang['Userlist_description'], 'L_OPEN_CLOSE' => $lang['Open_close'], 'L_ACTIVE' => $lang['Active'], 'L_USERNAME' => $lang['Username'], 'L_GROUP' => $lang['Group'], 'L_RANK' => $lang['Rank'], 'L_POSTS' => $lang['Posts'], 'L_FIND_ALL_POSTS' => $lang['Find_all_posts'], 'L_JOINED' => $lang['Joined'], 'L_ACTIVTY' => $lang['Last_activity'], 'L_MANAGE' => $lang['User_manage'], 'L_PERMISSIONS' => $lang['Permissions'], 'L_EMAIL' => $lang['Email'], 'L_PM' => $lang['Private_Message'], 'L_WEBSITE' => $lang['Website'], 'L_BIRTHDAY' => $lang['Birthday'], 'L_LANG' => $lang['Board_lang'], 'L_STYLE' => $lang['Board_style'], 'S_USER_VARIABLE' => POST_USERS_URL, 'S_ACTION' => append_sid(IP_ROOT_PATH . ADM . '/admin_userlist.' . PHP_EXT), 'L_GO' => $lang['Go'], 'L_SELECT' => $lang['Select_one'], 'L_DELETE' => $lang['Delete'], 'L_BAN' => $lang['Ban'], 'L_ACTIVATE_DEACTIVATE' => $lang['Activate_deactivate'], 'L_ADD_GROUP' => $lang['Add_group'], 'S_SHOW' => $show, 'L_SORT_BY' => $lang['Sort_by'], 'L_USER_ID' => $lang['User_id'], 'L_USER_LEVEL' => $lang['User_level'], 'L_ASCENDING' => $lang['Ascending'], 'L_DESCENDING' => $lang['Descending'], 'L_SHOW' => $lang['Show'], 'S_SORT' => $lang['Sort'], 'S_SELECT_SORT' => $select_sort, 'S_SELECT_SORT_ORDER' => $select_sort_order, 'S_HIDDEN_FIELDS' => $hidden_fields)); $order_by = "ORDER BY {$sort_method} {$sort_order} "; $sql = "SELECT *\n\t\t\tFROM " . USERS_TABLE . "\n\t\t\tWHERE user_id <> " . ANONYMOUS . "\n\t\t\t\t{$alpha_where}\n\t\t\t{$order_by}\n\t\t\tLIMIT {$start}, {$show}"; $result = $db->sql_query($sql); // Query Ranks $rank_sql = "SELECT * FROM " . RANKS_TABLE . " ORDER BY rank_special ASC, rank_min ASC"; $rank_result = $db->sql_query($rank_sql); while ($rank_row = $db->sql_fetchrow($rank_result)) { $ranksrow[] = $rank_row; } $db->sql_freeresult($rank_result); // loop through users $i = 1; while ($row = $db->sql_fetchrow($result)) { $avatar_img = user_get_avatar($row['user_id'], $row['user_level'], $row['user_avatar'], $row['user_avatar_type'], $row['user_allowavatar'], '../'); $poster_rank = ''; $rank_image = ''; if ($row['user_rank']) { for ($ji = 0; $ji < sizeof($ranksrow); $ji++) { if ($row['user_rank'] == $ranksrow[$ji]['rank_id'] && $ranksrow[$ji]['rank_special']) { $poster_rank = $ranksrow[$ji]['rank_title']; $rank_image = $ranksrow[$ji]['rank_image'] ? '<img src="' . IP_ROOT_PATH . $ranksrow[$ji]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : ''; } } } else { for ($ji = 0; $ji < sizeof($ranksrow); $ji++) { if ($row['user_posts'] >= $ranksrow[$ji]['rank_min'] && !$ranksrow[$ji]['rank_special']) { $poster_rank = $ranksrow[$ji]['rank_title']; $rank_image = $ranksrow[$ji]['rank_image'] ? '<img src="' . IP_ROOT_PATH . $ranksrow[$ji]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : ''; }
function print_avatar($p_user_id, $p_size = 80, $t_class = "avatar") { $t_avatar_exist = false; if (OFF === config_get('show_avatar')) { return; } if (!user_exists($p_user_id)) { return; } if (access_has_project_level(config_get('show_avatar_threshold'), null, $p_user_id)) { $t_use_gravatar = config_get('use_gravatar', false, $p_user_id, ALL_PROJECTS); if ($t_use_gravatar) { $t_avatar = user_get_avatar($p_user_id, $p_size); if (false !== $t_avatar) { $t_avatar_url = $t_avatar[0]; $t_width = $t_avatar[1]; $t_height = $t_avatar[2]; echo '<a rel="nofollow" href="http://site.gravatar.com">' . '<img class="avatar" src="' . $t_avatar_url . '" alt="User avatar"' . ' width="' . $t_width . '" height="' . $t_height . '" /></a>'; } } else { $t_avatar = user_get_local_avatar($p_user_id); $t_avatar_url = htmlspecialchars($t_avatar[0]); $t_width = $t_avatar[1]; $t_height = $t_avatar[2]; $t_avatar_exist = $t_avatar[3]; if ($t_avatar_exist) { echo '<img class="' . $t_class . '" src="' . $t_avatar_url . '" alt=""' . ' width="' . $t_width . '" height="' . $t_height . '" />'; } } } return $t_avatar_exist; }
$avatar_text = !empty($avatar_text) ? $avatar_text : $username; $template_to_parse = 'profile_avatar_generator.tpl'; // Replaced: $aim, $facebook, $flickr, $googleplus, $icq, $jabber, $linkedin, $msn, $skype, $twitter, $yim, $youtube, $user_sn_im_array = get_user_sn_im_array(); foreach ($user_sn_im_array as $k => $v) { $this_user_im[$v['form']] = ${$v}['form']; } display_avatar_generator($mode, $avatar_filename, $avatar_image, $avatar_text, $user_id, $email, $current_email, $email_confirm, $coppa, $username, $new_password, $cur_password, $password_confirm, $this_user_im, $website, $location, $user_flag, $user_first_name, $user_last_name, $occupation, $interests, $phone, $selfdes, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $setbm, $allowhtml, $allowbbcode, $allowsmilies, $showavatars, $showsignatures, $allowswearywords, $allowmassemail, $allowpmin, $allowviewonline, $user_style, $user_lang, $user_timezone, $time_mode, $dst_time_lag, $user_dateformat, $profile_view_popup, $user->data['session_id'], $birthday, $gender, $upi2db_which_system, $upi2db_new_word, $upi2db_edit_word, $upi2db_unread_color); } else { if (!isset($coppa)) { $coppa = false; } if (!isset($user_style)) { $user_style = $config['default_style']; } $avatar_img = user_get_avatar($user->data['user_id'], $user->data['user_level'], $user_avatar, $user_avatar_type, $user->data['user_allowavatar']); $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="privacy" value="1" /><input type="hidden" name="coppa" value="' . $coppa . '" />'; $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />'; if ($mode == 'editprofile') { $s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $user->data['user_id'] . '" />'; // // Send the users current email address. If they change it, and account activation is turned on // the user account will be disabled and the user will have to reactivate their account. // $s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $user->data['user_email'] . '" />'; } if (!empty($user_avatar_local)) { $s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" /><input type="hidden" name="avatarcatname" value="' . $user_avatar_category . '" />'; } if (!empty($user_avatar_generator)) { $s_hidden_fields .= '<input type="hidden" name="avatargenerator" value="' . $user_avatar_generator . '" />';
function process_tag(&$item) { global $db, $cache, $config, $user, $lang, $topic_id, $local_urls, $meta_content; if (function_exists('create_server_url')) { $server_url = create_server_url(); $local_urls = empty($local_urls) ? array($server_url) : array_merge(array($server_url), $local_urls); } else { $host = getenv('HTTP_HOST'); $host = !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (!empty($host) ? $host : $config['server_name']); $server_url = 'http://' . $host . $config['script_path']; } //LIW - BEGIN $max_image_width = intval($config['liw_max_width']); //LIW - END $tag = $item['tag']; //echo 'process_tag(', $tag, ')<br />'; $start = substr($this->text, $item['start'], $item['start_len']); $end = substr($this->text, $item['end'], $item['end_len']); $content = substr($this->text, $item['start'] + $item['start_len'], $item['end'] - $item['start'] - $item['start_len']); $error = array('valid' => false, 'start' => $this->process_text($start), 'end' => $this->process_text($end)); if (isset($item['valid']) && $item['valid'] == false) { return $error; } // check if empty item is allowed if (!strlen($content)) { $allow_empty = true; if ($item['is_html'] && isset($this->allowed_html[$tag]['allow_empty']) && !$this->allowed_html[$tag]['allow_empty']) { $allow_empty = false; } if (!$item['is_html'] && isset($this->allowed_bbcode[$tag]['allow_empty']) && !$this->allowed_bbcode[$tag]['allow_empty']) { $allow_empty = false; } if (!$allow_empty) { return array('valid' => true, 'html' => '', 'end' => '', 'allow_nested' => false); } } // check if nested item is allowed if ($item['iteration']) { if ($item['is_html'] && !$this->allowed_html[$tag]['nested']) { return $error; } if (!$item['is_html'] && !$this->allowed_bbcode[$tag]['nested']) { return $error; } } // Simple tags: B, EM, STRONG, I, U, TT, STRIKE, SUP, SUB, DIV, SPAN, CENTER if ($tag === 'b' || $tag === 'em' || $tag === 'strong' || $tag === 'i' || $tag === 'u' || $tag === 'tt' || $tag === 'strike' || $tag === 'sup' || $tag === 'sub' || $tag === 'div' || $tag === 'span' || $tag === 'center') { $extras = $this->allow_styling ? array('style', 'class', 'name') : array('class', 'name'); $html = '<' . $tag . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</' . $tag . '>'); } // COLOR if ($tag === 'color') { $extras = $this->allow_styling ? array('class') : array(); $color = $this->valid_color(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['color']) ? $item['params']['color'] : false)); if ($color === false) { return $error; } $html = '<span style="' . ($this->allow_styling && isset($item['params']['style']) ? htmlspecialchars($this->valid_style($item['params']['style'], '')) : '') . 'color: ' . $color . ';"' . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</span>'); } // RAINBOW if ($tag === 'rainbow') { /* if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } */ $html = $this->rainbow($content); return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // GRADIENT if ($tag === 'gradient') { /* if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } */ $default_color1 = '#000080'; $color1 = $this->valid_color(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['cols']) ? $item['params']['cols'] : $default_color1), true); $color1 = $color1 === false ? $default_color1 : $color1; $default_color2 = '#aaccee'; $color2 = $this->valid_color(isset($item['params']['cole']) ? $item['params']['cole'] : $default_color2, true); $color2 = $color2 === false ? $default_color2 : $color2; $mode = $this->process_text(isset($item['params']['mode']) ? $item['params']['mode'] : ''); $default_iterations = 10; $iterations = intval(isset($item['params']['iterations']) ? $item['params']['iterations'] : $default_iterations); $iterations = $iterations < 10 || $iterations > 100 ? $default_iterations : $iterations; $html = $this->gradient($content, $color1, $color2, $mode, $iterations); return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // HIGHLIGHT if ($tag === 'highlight') { $extras = $this->allow_styling ? array('class') : array(); $default_param = '#ffffaa'; $color = isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['color']) ? $item['params']['color'] : $default_param); $color = $this->valid_color($color); if ($color === false) { return $error; } $html = '<span style="' . ($this->allow_styling && isset($item['params']['style']) ? htmlspecialchars($this->valid_style($item['params']['style'], '')) : '') . 'background-color: ' . $color . ';"' . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</span>'); } // SIZE if ($tag === 'size') { $extras = $this->allow_styling ? array('class') : array(); $default_param = 0; $size = intval(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['size']) ? $item['params']['size'] : $default_param)); if ($size > 0 && $size < 7) { // vBulletin-style sizes switch ($size) { case 1: $size = 7; break; case 2: $size = 8; break; case 3: $size = 10; break; case 4: $size = 12; break; case 5: $size = 15; break; case 6: $size = 24; break; } } if ($size < 6 || $size > 48) { return $error; } $html = '<span style="' . ($this->allow_styling && isset($item['params']['style']) ? htmlspecialchars($this->valid_style($item['params']['style'], '')) : '') . 'font-size: ' . $size . 'px; line-height: 116%;"' . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</span>'); } // Single tags: HR if ($tag === 'hr') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $extras = $this->allow_styling ? array('style', 'class') : array(); $color = $this->valid_color(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['color']) ? $item['params']['color'] : false)); $html = '<' . $tag . ($color === false ? $this->allow_styling && isset($item['params']['style']) ? ' style="' . htmlspecialchars($this->valid_style($item['params']['style'], '')) . '"' : '' : ' style="border-color: ' . $color . ';"') . ' />'; return array('valid' => true, 'html' => $html); } // ALIGN if ($tag === 'align') { $extras = $this->allow_styling ? array('style', 'class') : array(); $default_param = 'left'; $align = isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['align']) ? $item['params']['align'] : $default_param); if ($align === 'left' || $align === 'right' || $align === 'center' || $align === 'justify') { $html = '<div style="text-align: ' . $align . ';' . ($align === 'center' ? ' margin-left: auto; margin-right: auto;' : '') . '">'; return array('valid' => true, 'start' => $html, 'end' => '</div>'); } else { return $error; } } // IMG if ($tag === 'img') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // main parameters $params = array('src' => false, 'alt' => false, 'slide' => false); // additional allowed parameters $extras = $this->allow_styling ? array('width', 'height', 'border', 'style', 'class', 'title', 'align') : array('width', 'height', 'border', 'title', 'align'); if ($config['thumbnail_highslide']) { $slideshow = !empty($item['params']['slide']) ? ', { slideshowGroup: \'' . $this->process_text($item['params']['slide']) . '\' } ' : ''; } $liw_bypass = false; // [img=blah]blah2[/img] if (isset($item['params']['param'])) { $params['src'] = $item['params']['param']; $img_url = $params['src']; $img_url_enc = urlencode(ip_utf8_decode($params['src'])); $path_parts = pathinfo($img_url); $params['alt'] = !empty($content) ? $content : ip_clean_string($path_parts['filename'], $lang['ENCODING'], true); } elseif (isset($item['params']['src'])) { $params['src'] = $item['params']['src']; $img_url = $params['src']; $img_url_enc = urlencode(ip_utf8_decode($params['src'])); $path_parts = pathinfo($img_url); $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : (!empty($content) ? $content : ip_clean_string($path_parts['filename'], $lang['ENCODING'], true)); for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } elseif (!empty($content)) { $params['src'] = $content; $img_url = $params['src']; $img_url_enc = urlencode(ip_utf8_decode($params['src'])); $path_parts = pathinfo($img_url); $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : (isset($params['title']) ? $params['title'] : ip_clean_string($path_parts['filename'], $lang['ENCODING'], true)); // LIW - BEGIN if ($config['liw_enabled'] == 1 && $max_image_width > 0 && $config['thumbnail_posts'] == 0) { $liw_bypass = true; if (isset($item['params']['width'])) { $item['params']['width'] = $item['params']['width'] > $max_image_width ? $max_image_width : $item['params']['width']; } else { $image_size = @getimagesize($content); $item['params']['width'] = $image_size[0] > $max_image_width ? $max_image_width : $image_size[0]; } } // LIW - END for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } $is_smiley = false; if (substr($params['src'], 0, strlen(BBCODE_SMILIES_PATH)) == BBCODE_SMILIES_PATH) { $is_smiley = true; } if (!$is_smiley && $config['thumbnail_posts'] && $liw_bypass == false) { $process_thumb = !empty($config['thumbnail_cache']) ? true : false; $thumb_exists = false; $thumb_processed = false; $is_light_view = false; if (isset($item['params']['thumb'])) { if ($item['params']['thumb'] == 'false') { $process_thumb = false; } } if (!empty($process_thumb)) { $thumb_processed = true; $pic_id = $img_url; $pic_fullpath = str_replace(array(' '), array('%20'), $pic_id); $pic_id = str_replace('http://', '', str_replace('https://', '', $pic_id)); $pic_path[] = array(); $pic_path = explode('/', $pic_id); $pic_filename = end($pic_path); $file_part = explode('.', strtolower($pic_filename)); $pic_filetype = end($file_part); $thumb_ext_array = array('gif', 'jpg', 'png'); if (in_array($pic_filetype, $thumb_ext_array)) { $user_dir = ''; $users_images_path = str_replace('http://', '', str_replace('https://', '', $server_url . str_replace(IP_ROOT_PATH, '', POSTED_IMAGES_PATH))); $pic_title = substr($pic_filename, 0, strlen($pic_filename) - strlen($pic_filetype) - 1); $pic_title_reg = preg_replace('/[^A-Za-z0-9]+/', '_', $pic_title); $pic_thumbnail = 'mid_' . md5($pic_id) . '_' . $pic_filename; if (strpos($pic_id, $users_images_path) !== false) { $user_dir = str_replace($pic_filename, '', str_replace($users_images_path, '', $pic_id)); $pic_thumbnail = $pic_filename; } $pic_thumbnail_fullpath = POSTED_IMAGES_THUMBS_PATH . $user_dir . $pic_thumbnail; // Light View - BEGIN $light_view = request_var('light_view', 0); // Force to false for debugging purpose... $light_view = 0; if (!empty($light_view) && !empty($user_dir)) { $is_light_view = true; $pic_thumbnail_fullpath = POSTED_IMAGES_THUMBS_S_PATH . $user_dir . $pic_thumbnail; } // Light View - END if (file_exists($pic_thumbnail_fullpath)) { $thumb_exists = true; $params['src'] = $server_url . str_replace(IP_ROOT_PATH, '', $pic_thumbnail_fullpath); } } } $cache_image = true; $cache_append = ''; if (isset($item['params']['cache'])) { if ($item['params']['cache'] == 'false') { //$bbc_eamp = '&'; $bbc_eamp = '&'; $cache_image = false; $cache_append = 'cache=false' . $bbc_eamp . 'rand=' . md5(rand()) . $bbc_eamp; } else { $cache_image = true; } } if (!empty($process_thumb) && ($thumb_exists == false || $cache_image == false)) { $pic_thumbnail_script = $server_url . CMS_PAGE_IMAGE_THUMBNAIL . '?' . $cache_append . 'pic_id=' . $img_url_enc; // Light View - BEGIN if (!empty($thumb_processed) && !empty($is_light_view)) { $img_url_enc = $user_dir . $pic_thumbnail; $pic_thumbnail_script = $server_url . CMS_PAGE_IMAGE_THUMBNAIL_S . '?' . $cache_append . 'pic_id=' . $img_url_enc; } // Light View - END $params['src'] = $pic_thumbnail_script; } } // generate html $html = '<img'; foreach ($params as $var => $value) { if ($this->process_text($value) != '') { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } if ($var == 'src' && !$this->is_sig) { $meta_content['og_img'][] = $value; } } if (!isset($params['title'])) { $html .= ' title="' . $this->process_text($params['alt']) . '"'; } $html .= ' />'; // add url /* if (strpos($params['src'], trim($config['server_name'])) == false) { $html = $this->process_text($params['alt']); } */ // Light View - BEGIN if (!empty($thumb_processed) && !empty($is_light_view)) { $item['inurl'] = true; } // Light View - END if (empty($item['inurl']) && !$is_smiley) { if ($this->allow_hs && $config['thumbnail_posts'] && $config['thumbnail_highslide']) { $extra_html = ' class="highslide" onclick="return hs.expand(this' . $slideshow . ')"'; } else { $extra_html = ' target="_blank" title="' . $lang['OpenNewWindow'] . '"'; } $html = '<a href="' . $this->process_text($img_url) . '"' . $extra_html . '>' . $html . '</a>'; } return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // IMGBA if ($tag === 'imgba') { if ($this->is_sig) { return $error; } // main parameters $params = array('before' => false, 'after' => false, 'width' => false, 'w' => false, 'height' => false, 'h' => false, 'alt' => false, 'title' => false); foreach ($params as $k => $v) { $params[$k] = $item['params'][$k]; } if (empty($params['before']) || empty($params['after'])) { return $error; } $path_parts = pathinfo($params['before']); (int) ($params['width'] = !empty($params['w']) ? intval($params['w']) : intval($params['width'])); (int) ($params['height'] = !empty($params['h']) ? intval($params['h']) : intval($params['height'])); $params['alt'] = !empty($params['alt']) ? $params['alt'] : ip_clean_string($path_parts['filename'], $lang['ENCODING'], true); if (empty($params['width']) || empty($params['height'])) { return $error; } // Since we passed the main tests, we may force all needed JS inclusions... $config['jquery_ui'] = true; $config['jquery_ui_ba'] = true; $max_width = 600; $or_width = $params['width']; $or_height = $params['height']; if ($params['width'] > $max_width) { $params['width'] = $max_width; $params['height'] = $max_width / ($or_width / $or_height); } // additional allowed parameters $extras = $this->allow_styling ? array('style', 'class') : array(); for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } $container = 'imgba_' . substr(md5($params['before']), 0, 6); $imgba_error = false; $allowed_ext = array('gif', 'jpeg', 'jpg', 'png'); $img_test_array = array('before', 'after'); // Few "pseudo-security" tests foreach ($img_test_array as $img_test) { $file_ext = substr(strrchr($params[$img_test], '.'), 1); //if (!in_array($file_ext, $allowed_ext) || (strpos($params[$img_test], $server_url) !== 0) || (strpos($params[$img_test], '?') !== 0)) if (!in_array($file_ext, $allowed_ext)) { $imgba_error = true; } } if (!empty($imgba_error)) { return $error; } // generate html $html = ''; $html .= '<div id="' . $container . '"'; foreach ($params as $var => $value) { if (in_array($value, array('width', 'height')) && $this->process_text($value) != '') { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } } $html .= '>'; $img_alt = $this->process_text($params['alt']); $img_title = !empty($params['title']) ? ' title="' . $this->process_text($params['title']) . '"' : ''; $html .= '<div><img src="' . $params['before'] . '" width="' . $params['width'] . '" height="' . $params['height'] . '" alt="Before: ' . $img_alt . '"' . $img_title . ' /></div>'; $html .= '<div><img src="' . $params['after'] . '" width="' . $params['width'] . '" height="' . $params['height'] . '" alt="After: ' . $img_alt . '"' . $img_title . ' /></div>'; $html .= '</div>'; $html .= '<script type="text/javascript">$(function(){ $(\'#' . $container . '\').beforeAfter({imagePath: \'' . $server_url . 'templates/common/jquery/\', showFullLinks: true, cursor: \'e-resize\', dividerColor: \'#dd2222\', beforeLinkText: \'' . $lang['IMG_BA_SHOW_ONLY_BEFORE'] . '\', afterLinkText: \'' . $lang['IMG_BA_SHOW_ONLY_AFTER'] . '\'}); });</script>'; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // ALBUMIMG if ($tag === 'albumimg') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // main parameters $params = array('src' => false, 'alt' => false); // additional allowed parameters $extras = $this->allow_styling ? array('width', 'height', 'border', 'style', 'class', 'title', 'align') : array('width', 'height', 'border', 'title', 'align'); // [albumimg=blah]blah2[/albumimg] if (isset($item['params']['param'])) { $params['src'] = $item['params']['param']; $pic_url = $item['params']['param']; $params['alt'] = $content; } elseif (isset($item['params']['src'])) { $params['src'] = $item['params']['src']; $pic_url = $item['params']['src']; $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : $content; for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } elseif (!empty($content)) { $params['src'] = $content; $pic_url = $content; $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : (isset($params['title']) ? $params['title'] : ''); for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } // generate html $pic_url = $server_url . 'album_showpage.' . PHP_EXT . '?pic_id=' . $pic_url; if (isset($item['params']['mode'])) { $pic_mode = $item['params']['mode']; if ($pic_mode === 'full') { $params['src'] = $server_url . 'album_picm.' . PHP_EXT . '?pic_id=' . $params['src']; } else { $params['src'] = $server_url . 'album_thumbnail.' . PHP_EXT . '?pic_id=' . $params['src']; } } else { $params['src'] = $server_url . 'album_thumbnail.' . PHP_EXT . '?pic_id=' . $params['src']; } $html = '<img'; foreach ($params as $var => $value) { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; if ($var == 'src' && !$this->is_sig) { $meta_content['og_img'][] = $value; } } if (!isset($params['title'])) { $html .= ' title="' . $this->process_text($params['alt']) . '"'; } $html .= ' />'; // add url if (empty($item['inurl'])) { $html = '<a href="' . $this->process_text($pic_url) . '" title="' . $lang['Click_enlarge_pic'] . '">' . $html . '</a>'; } return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // ATTACHMENT if ($tag === 'attachment' || $tag === 'download') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $html = ''; $params['id'] = isset($item['params']['param']) ? intval($item['params']['param']) : (isset($item['params']['id']) ? intval($item['params']['id']) : false); $params['title'] = isset($item['params']['title']) ? $this->process_text($item['params']['title']) : false; $params['description'] = isset($item['params']['description']) ? $this->process_text($item['params']['description']) : (!empty($content) ? $this->process_text($content) : false); $params['icon'] = isset($item['params']['icon']) ? $this->process_text($item['params']['icon']) : false; $color = $this->valid_color(isset($item['params']['color']) ? $item['params']['color'] : false); $bgcolor = $this->valid_color(isset($item['params']['bgcolor']) ? $item['params']['bgcolor'] : false); $errored = false; if ($params['id'] <= 0) { $errored = true; } if (!$errored) { if ($tag === 'attachment') { if (!function_exists('get_attachment_details')) { include_once IP_ROOT_PATH . 'includes/functions_bbcode.' . PHP_EXT; } $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $user->data); $is_download_auth_ary = auth(AUTH_DOWNLOAD, AUTH_LIST_ALL, $user->data); $attachment_details = get_attachment_details($params['id']); if ($attachment_details == false || !$is_auth_ary[$attachment_details['forum_id']]['auth_read'] || !$is_download_auth_ary[$attachment_details['forum_id']]['auth_download']) { $errored = true; } } else { if (!function_exists('get_download_details')) { include_once IP_ROOT_PATH . 'includes/functions_bbcode.' . PHP_EXT; } $attachment_details = get_download_details($params['id']); $errored = $attachment_details == false ? true : false; } } if (!$errored) { if ($tag === 'attachment') { $params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['real_filename']) ? $attachment_details['real_filename'] : ' '); $params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['comment']) ? $attachment_details['comment'] : ' '); $params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : 'default.png'); $download_url = IP_ROOT_PATH . 'download.' . PHP_EXT . '?id=' . $params['id']; } else { $params['title'] = $params['title'] ? $params['title'] : (!empty($attachment_details['file_name']) ? $attachment_details['file_name'] : ' '); $params['description'] = $params['description'] ? $params['description'] : (!empty($attachment_details['file_desc']) ? $attachment_details['file_desc'] : ' '); $params['icon'] = IP_ROOT_PATH . FILES_ICONS_DIR . ($params['icon'] ? $params['icon'] : (!empty($attachment_details['file_posticon']) ? $attachment_details['file_posticon'] : 'default.png')); $attachment_details['filesize'] = $attachment_details['file_size']; $attachment_details['download_count'] = $attachment_details['file_dls']; $download_url = IP_ROOT_PATH . 'dload.' . PHP_EXT . '?action=file&file_id=' . $params['id']; } $params['title'] = htmlspecialchars($params['title']); $params['description'] = htmlspecialchars($params['description']); $params['icon'] = file_exists($params['icon']) ? $params['icon'] : IP_ROOT_PATH . FILES_ICONS_DIR . 'default.png'; $style = $color || $bgcolor ? ' style="' . ($color ? 'color: ' . $color . ';' : '') . ($bgcolor ? 'background-color: ' . $bgcolor . ';' : '') . '"' : ''; $html .= '<div class="mg_attachtitle"' . $style . '>' . $params['title'] . '</div>'; $html .= '<div class="mg_attachdiv"><table>'; $html .= '<tr><td style="width: 15%;"><b class="gensmall">' . $lang['Description'] . ':</b></td><td style="width: 75%;"><span class="gensmall">' . $params['description'] . '</span></td><td rowspan="3" class="row-center" style="width: 10%;"><img src="' . $params['icon'] . '" alt="' . $params['description'] . '" /><br /><a href="' . append_sid($download_url) . '" title="' . $lang['Download'] . ' ' . $params['title'] . '"><b>' . $lang['Download'] . '</b></a></td></tr>'; $html .= '<tr><td><b class="gensmall">' . $lang['FILESIZE'] . ':</b></td><td><span class="gensmall">' . round($attachment_details['filesize'] / 1024, 2) . ' KB</span></td></tr>'; $html .= '<tr><td><b class="gensmall">' . $lang['DOWNLOADED'] . ':</b></td><td><span class="gensmall">' . $attachment_details['download_count'] . '</span></td></tr>'; $html .= '</table></div>'; } else { $style = $color || $bgcolor ? ' style="' . ($color ? 'color: ' . $color . ';' : '') . ($bgcolor ? 'background-color: ' . $bgcolor . ';' : '') . '"' : ''; $html .= '<div class="mg_attachtitle"' . $style . '>' . $lang['Not_Authorized'] . '</div>'; $html .= '<div class="mg_attachdiv"><div style="text-align: center;">' . $lang['FILE_NOT_AUTH'] . '</div></div>'; } return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // LIST if ($tag === 'list' || $tag === 'ul' || $tag === 'ol') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $extras = $this->allow_styling ? array('style', 'class') : array(); // check if nested tags are all [*] $nested_count = 0; for ($i = 0; $i < sizeof($item['items']); $i++) { $tag2 = $item['items'][$i]['tag']; if ($tag2 === '*' || $tag2 === 'li') { $nested_count++; } } if (!$nested_count) { // no <li> items. return error return $error; } // replace "list" with html tag if ($tag === 'list') { if (isset($item['params']['param']) || isset($item['params']['type'])) { $tag = 'ol'; } else { $tag = 'ul'; } } // valid tag. process subitems to make sure there are no extra items and remove all code between elements $last_item = false; for ($i = 0; $i < sizeof($item['items']); $i++) { $item2 =& $item['items'][$i]; $tag2 = $item2['tag']; if ($tag2 === '*' || $tag2 === 'li') { // mark as valid $item2['list_valid'] = true; if ($last_item === false) { // change start position to end of [list] $pos = !empty($pos) ? $pos : 0; $pos2 = $item2['start'] + $item2['start_len']; $item2['start'] = $pos; $item2['start_len'] = $pos2 - $pos; $item2['first_entry'] = true; } $last_item =& $item['items'][$i]; } } // generate html $html = '<' . $tag; if (isset($item['params']['param'])) { $html .= ' type="' . htmlspecialchars($item['params']['param']) . '"'; } elseif (isset($item['params']['type'])) { $html .= ' type="' . htmlspecialchars($item['params']['type']) . '"'; } $html .= $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</li></' . $tag . '>'); } // [*], LI if ($tag === '*' || $tag === 'li') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $extras = $this->allow_styling ? array('style', 'class') : array(); // if not marked as valid return error if (empty($item['list_valid'])) { return $error; } $html = '<li'; if (empty($item['first_entry'])) { // add closing tag for previous list entry $html = '</li>' . $html; } $html .= $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => ''); } // FONT if ($tag === 'font') { $fonts = array('Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Impact', 'Lucida Console', 'Lucida Sans Unicode', 'Microsoft Sans Serif', 'Symbol', 'Tahoma', 'Times New Roman', 'Traditional Arabic', 'Trebuchet MS', 'Verdana', 'Webdings', 'Wingdings'); if (defined('FONTS_DIR')) { foreach ($cache->obtain_fonts() as $font_file) { $fonts[] = substr($font_file, 0, -4); } } $extras = $this->allow_styling ? array('style', 'class') : array(); $default_param = 'Verdana'; $font = isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['font']) ? $item['params']['font'] : $default_param); $font = in_array($font, $fonts) ? $font : $default_param; $html = '<span style="font-family: \'' . $font . '\';">'; return array('valid' => true, 'start' => $html, 'end' => '</span>'); } // CELL if ($tag === 'cell') { $extras = $this->allow_styling ? array('style', 'class', 'align', 'border') : array('class', 'align'); $width = isset($item['params']['width']) ? ' width: ' . intval($item['params']['width']) . 'px;' : ''; $height = isset($item['params']['height']) ? ' height: ' . intval($item['params']['height']) . 'px;' : ''; $padding = isset($item['params']['padding']) ? ' padding: ' . intval($item['params']['padding']) . 'px;' : ''; $margin = isset($item['params']['margin']) ? ' margin: ' . intval($item['params']['margin']) . 'px;' : ''; $borderwidth = isset($item['params']['borderwidth']) ? ' border-width: ' . intval($item['params']['borderwidth']) . 'px;' : ''; $bgcolor = $this->valid_color(isset($item['params']['bgcolor']) ? $item['params']['bgcolor'] : false); $bgcolor = $bgcolor !== false ? ' background-color: ' . $bgcolor . ';' : ''; $bordercolor = $this->valid_color(isset($item['params']['bordercolor']) ? $item['params']['bordercolor'] : false); $bordercolor = $bordercolor !== false ? ' border-color: ' . $bordercolor . ';' : ''; $color = $this->valid_color(isset($item['params']['color']) ? $item['params']['color'] : false); $color = $color !== false ? ' color: ' . $color . ';' : ''; $html = '<div style="' . ($this->allow_styling && isset($item['params']['style']) ? htmlspecialchars($this->valid_style($item['params']['style'], '')) : '') . $height . $width . $bgcolor . $bordercolor . $borderwidth . $color . $padding . $margin . '"' . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</div>'); } // URL, A if ($tag === 'url' || $tag === 'a') { $extras = $this->allow_styling ? array('style', 'class', 'name', 'title') : array('name', 'title'); $allow_nested = true; $strip_text = false; $show_content = true; $url = ''; // get url if (!empty($item['params']['param'])) { $url = $item['params']['param']; } elseif (!empty($item['params']['href'])) { $url = $item['params']['href']; } elseif (!$item['is_html']) { $url = $content; $allow_nested = false; $strip_text = true; } else { return $error; } if ($url === $content && strlen($content) > 64) { $content = htmlspecialchars(substr($content, 0, 35) . '...' . substr($content, strlen($content) - 15)); $show_content = false; } // check if its email if (substr(strtolower($url), 0, 7) === 'mailto:') { $item['tag'] = 'email'; return $this->process_tag($item); } // check for invalid urls $url = $this->valid_url($url, ''); if (empty($url)) { return $error; } // check nested items if (!$allow_nested) { for ($i = 0; $i < sizeof($item['items']); $i++) { $item['items'][$i]['valid'] = false; } } else { for ($i = 0; $i < sizeof($item['next']); $i++) { $tag2 = $item['next'][$i]['tag']; $is_html = $item['next'][$i]['item']['is_html']; $item['next'][$i]['item']['inurl'] = true; if ($is_html && !$this->allowed_html[$tag2]['inurl']) { $item['next'][$i]['item']['valid'] = false; } if (!$is_html && !$this->allowed_bbcode[$tag2]['inurl']) { $item['next'][$i]['item']['valid'] = false; } } } // check for incomplete url if (substr(strtolower($url), 0, 4) === 'www.') { $url = 'http://' . $url; } // remove extra characters at the end $last_char = substr($url, strlen($url) - 1); $last_char_i = ord($last_char); if ($last_char_i > 32 && $last_char_i < 47 || $last_char_i > 57 && $last_char_i < 65) { $url = substr($url, 0, strlen($url) - 1); } // check if url is local $is_local_url = false; if (!empty($local_urls)) { foreach ($local_urls as $local_url) { if (strlen($url) > strlen($local_url) && strpos($url, $local_url) === 0) { $is_local_url = true; } } } if (empty($is_local_url) && strpos($url, ':') === false) { $is_local_url = true; } // generate html $url_target = isset($item['params']['target']) && ($item['params']['target'] != 0 || $item['params']['target'] != 'false') ? true : false; $html = '<a' . ($this->allow_styling && isset($item['params']['class']) ? '' : ' class="post-url"') . ' href="' . htmlspecialchars($url) . '"' . ($is_local_url && empty($url_target) ? '' : ' target="_blank"' . (!empty($item['params']['nofollow']) || $this->is_sig ? ' rel="nofollow"' : '')) . $this->add_extras($item['params'], $extras) . '>'; if ($config['disable_html_guests'] && !$user->data['session_logged_in']) { return array('valid' => true, 'html' => $lang['Links_For_Guests'], 'allow_nested' => false); } else { if ($show_content) { return array('valid' => true, 'start' => $html, 'end' => '</a>'); } else { return array('valid' => true, 'html' => $html . $content . '</a>', 'allow_nested' => false); } } } // EMAIL if ($tag === 'email') { $extras = $this->allow_styling ? array('style', 'class', 'name', 'title') : array('name', 'title'); $allow_nested = true; $strip_text = false; $url = ''; // get url if (!empty($item['params']['param'])) { $url = $item['params']['param']; } elseif (!empty($item['params']['href'])) { $url = $item['params']['href']; } elseif (!empty($item['params']['addr'])) { $url = $item['params']['addr']; } else { $url = $content; $pos = strpos($url, '?'); if ($pos) { $content = substr($url, 0, $pos); } if (substr(strtolower($url), 0, 7) === 'mailto:') { $content = substr($content, 7); } $allow_nested = false; $strip_text = true; } if (empty($url)) { return $error; } // disable nested items for ($i = 0; $i < sizeof($item['items']); $i++) { $item['items'][$i]['valid'] = false; } // generate html if (substr(strtolower($url), 0, 7) === 'mailto:') { $url = substr($url, 7); } $email = '<a' . ($this->allow_styling && isset($item['params']['class']) ? '' : ' class="post-email"') . ' href="mailto:' . htmlspecialchars($url) . '"' . $this->add_extras($item['params'], $extras) . '>' . $content . '</a>'; $pos = strpos($url, '?'); if ($pos) { $str = substr($url, 0, $pos); } else { $str = $url; } if (defined('IN_AJAX_CHAT')) { $html = htmlspecialchars(str_replace(array('@', '.'), array(' [at] ', ' [dot] '), $str)); } else { $noscript = '<noscript>' . htmlspecialchars(str_replace(array('@', '.'), array(' [at] ', ' [dot] '), $str)) . '</noscript>'; // make javascript from it $html = BBCODE_NOSMILIES_START . '<script type="text/javascript">' . "\n" . '// <![CDATA[' . "\n"; $bit_lenght = 5; for ($i = 0; $i < strlen($email); $i += $bit_lenght) { $str = substr($email, $i, $bit_lenght); //$str = preg_replace('/[^A-Za-z0-9_\-@.]+/', '_', $str); $html .= 'document.write(\'' . str_replace('/', '\\/', addslashes($str)) . '\');' . "\n"; } $html .= "\n" . '// ]]>' . "\n" . '</script>' . "\n" . $noscript . BBCODE_NOSMILIES_END; } return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // QUOTE if ($tag === 'quote' || $tag === 'blockquote' || $tag === 'ot') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if ($item['iteration'] > $config['quote_iterations']) { return $error; } // check user $target_user = ''; $post_rev = ''; if (isset($item['params']['param'])) { $target_user = htmlspecialchars($item['params']['param']); } elseif (isset($item['params']['user'])) { $target_user = htmlspecialchars($item['params']['user']); if (isset($item['params']['userid']) && intval($item['params']['userid'])) { $target_user = '******' . CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . intval($item['params']['userid']) . '">' . $target_user . '</a>'; } } // generate html $html = '<blockquote class="quote"'; if (isset($item['params']['post']) && intval($item['params']['post'])) { $post_rev = $user->data['is_bot'] ? ' ' : '[<a href="#" onclick="open_postreview(\'show_post.php?p=' . intval($item['params']['post']) . '\'); return false;" class="genmed">' . $lang['ReviewPost'] . '</a>]'; $html .= ' cite="' . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . intval($item['params']['post']) . '#p' . intval($item['params']['post']) . '"'; } $html .= '>'; if ($target_user) { if ($tag === 'ot') { $html .= '<div class="quote-user"><div class="error-message" style="display:inline;">' . $lang['OffTopic'] . '</div> ' . $target_user . ': ' . $post_rev . '</div>'; } else { $html .= '<div class="quote-user">' . $target_user . ' ' . $lang['wrote'] . ': ' . $post_rev . '</div>'; } } else { if ($tag === 'ot') { $html .= '<div class="quote-nouser"> <div class="error-message" style="display: inline;">' . $lang['OffTopic'] . '</div>:</div>'; } else { $html .= '<div class="quote-nouser">' . $lang['Quote'] . ':</div>'; } } $html .= '<div class="post-text post-text-hide-flow">'; return array('valid' => true, 'start' => $html, 'end' => '</div></blockquote>'); } // INLINE CODE if ($tag === 'c') { $extras = $this->allow_styling ? array('style', 'name') : array('name'); $html = '<code class="inline"' . $this->add_extras($item['params'], $extras) . '>'; return array('valid' => true, 'start' => $html, 'end' => '</code>'); } // CODE if ($tag === 'code') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // replace spaces and tabs with if (!defined('EXTRACT_CODE')) { /* $search = array( ' ', "\t" ); $replace = array( ' ', ' ' ); $text = str_replace($search, $replace, $this->process_text($content, false, true)); */ $text = $this->process_text($content, false, true); } else { $text = $this->process_text($content, false, true); $search = array('[highlight]', '[/highlight]'); $replace = array('', ''); $text = str_replace($search, $replace, $text); } // check filename if (isset($item['params']['filename'])) { $item['params']['file'] = $item['params']['filename']; } if (defined('EXTRACT_CODE') && $this->code_counter == EXTRACT_CODE) { $GLOBALS['code_text'] = $text; if (!empty($item['params']['file'])) { $GLOBALS['code_filename'] = $item['params']['file']; } } if (substr($text, 0, 1) === "\n") { $text = substr($text, 1); } elseif (substr($text, 0, 2) === "\r\n") { $text = substr($text, 2); } $linenumbers = true; if (isset($item['params']['linenumbers'])) { $linenumbers = $item['params']['linenumbers'] == 'true' ? true : false; } if ($linenumbers == true) { // convert to list if (isset($item['params']['syntax'])) { if ($item['params']['syntax'] == 'php') { /* $html = strtr($text, array_flip(get_html_translation_table(HTML_ENTITIES))); $html = highlight_string($html, true); $html_search = array('<font color="', '</font', ' '); $xhtml_replace = array('<code style="color:', '</code', ' '); //$xhtml_replace = array('<div style="display:inline;color:', '</div', ' '); //$xhtml_replace = array('<span style="display:inline;color:', '</span', ' '); $html = str_replace ($html_search, $xhtml_replace, $html); $html = '<li class="code-row"><div class="code-row-text">' . $html . '</div></li>'; */ /* $html_search = array('<br />'); $xhtml_replace = array('</div></li><li class="code-row"><div class="code-row-text">'); $html = str_replace ($html_search, $xhtml_replace, $html); */ //PHP Highlight - Start $code_ary = explode("\n", $text); $open_php_tag = 0; $close_php_tag = 0; for ($i = 0; $i < sizeof($code_ary); $i++) { if ($code_ary[$i] == '' || $code_ary[$i] == ' ' || $code_ary[$i] == ' ' || $code_ary[$i] == "\n" || $code_ary[$i] == "\r" || $code_ary[$i] == "\n\r") { $html .= '<li class="code-row"><span class="code-row-text"> </span></li>'; } else { $prefix = strpos(' ' . $code_ary[$i], '<?') ? '' : '<?php '; $suffix = strpos(' ' . $code_ary[$i], '?>') ? '' : '?>'; $code_ary[$i] = str_replace(array('<', '>'), array('<', '>'), $code_ary[$i]); $code_ary[$i] = highlight_string(strtr($prefix . $code_ary[$i] . $suffix, array_flip(get_html_translation_table(HTML_ENTITIES))), true); $html_search = array('<code>', '</code>'); $xhtml_replace = array('', ''); $code_ary[$i] = str_replace($html_search, $xhtml_replace, $code_ary[$i]); if ($open_php_tag || $prefix != '') { $html_search = array('<?php'); $xhtml_replace = array(''); $code_ary[$i] = str_replace($html_search, $xhtml_replace, $code_ary[$i]); } if ($close_php_tag || $suffix != '') { $html_search = array('?> ', '?>'); $xhtml_replace = array('', ''); $code_ary[$i] = str_replace($html_search, $xhtml_replace, $code_ary[$i]); } $prefix == '' ? $open_php_tag++ : ($open_php_tag ? $open_php_tag-- : ''); $suffix == '' ? $close_php_tag++ : ($close_php_tag ? $close_php_tag-- : ''); $html .= '<li class="code-row"><span class="code-row-text">' . $code_ary[$i] . ' </span></li>'; } } $html_search = array('<font color="', '</font', ' ', '<code style="color:#0000BB"></code>', '<code style="color:#0000BB"> </code>', '> <'); $xhtml_replace = array('<code style="color:', '</code', ' ', '', '', '> <'); $html = str_replace($html_search, $xhtml_replace, $html); //PHP Highlight - End } else { $search = array("\n", '[highlight]', '[/highlight]'); $replace = array(' </span></li><li class="code-row"><span class="code-row-text">', '<span class="code-row-highlight">', '</span>'); $html = '<li class="code-row code-row-first"><span class="code-row-text">' . str_replace($search, $replace, $text) . ' </span></li>'; } } else { $search = array("\n", '[highlight]', '[/highlight]'); $replace = array(' </span></li><li class="code-row"><span class="code-row-text">', '<span class="code-row-highlight">', '</span>'); $html = '<li class="code-row code-row-first"><span class="code-row-text">' . str_replace($search, $replace, $text) . ' </span></li>'; } $str = '<li class="code-row"><div class="code-row-text"> </div></li>'; if (substr($html, strlen($html) - strlen($str)) === $str) { $html = substr($html, 0, strlen($html) - strlen($str)); } $start = isset($item['params']['start']) ? intval($item['params']['start']) : 1; $can_download = !empty($this->code_post_id) ? $this->code_post_id : 0; if ($can_download) { //$download_text = ' [<a href="download.php?post=' . $can_download; $download_text = ' [<a href="download_post.' . PHP_EXT . '?post=' . $can_download; if ($this->code_counter) { $download_text .= '&item=' . $this->code_counter; } $download_text .= '">' . $lang['Download'] . '</a>]'; } else { $download_text = ''; } $code_id = substr(md5($content . mt_rand()), 0, 8); $str = BBCODE_NOSMILIES_START . '<div class="code">'; $str .= '<div class="code-header" id="codehdr2_' . $code_id . '" style="position: relative;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\', \'codehdr2_' . $code_id . '\', \'\'); return false;">' . $lang['Hide'] . '</a>]</div>'; $str .= '<div class="code-header" id="codehdr_' . $code_id . '" style="position: relative; display: none;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\',\'codehdr2_' . $code_id . '\',\'\'); return false;">' . $lang['Show'] . '</a>]</div>'; $html = $str . '<div class="code-content" id="code_' . $code_id . '" style="position: relative;"><ol class="code-list" start="' . $start . '">' . $html . '</ol></div></div>' . BBCODE_NOSMILIES_END; // check highlight // format: highlight="1,2,3-10" if (isset($item['params']['highlight'])) { $search = '<li class="code-row'; $replace = '<li class="code-row code-row-highlight'; $search_len = strlen($search); $replace_len = strlen($replace); // get highlight string $items = array(); $str = $item['params']['highlight']; $list = explode(',', $str); for ($i = 0; $i < sizeof($list); $i++) { $str = trim($list[$i]); if (strpos($str, '-')) { $row = explode('-', $str); if (sizeof($row) == 2) { $num1 = intval($row[0]); if ($num1 == 0) { $num1 = 1; } $num2 = intval($row[1]); if ($num1 > 0 && $num2 > $num1 && $num2 - $num1 < 256) { for ($j = $num1; $j <= $num2; $j++) { $items['row' . $j] = true; } } } } else { $num = intval($str); if ($num) { $items['row' . $num] = true; } } } if (sizeof($items)) { // process all lines $num = $start - 1; $pos = strpos($html, $search); $total = sizeof($items); $found = 0; while ($pos !== false) { $num++; if (isset($items['row' . $num])) { $found++; $html = substr($html, 0, $pos) . $replace . substr($html, $pos + $search_len); $pos += $replace_len; } else { $pos += $search_len; } $pos = $found < $total ? strpos($html, $search, $pos) : false; } } } // $html = BBCODE_NOSMILIES_START . '<div class="code"><div class="code-header">Code:</div><div class="code-content">' . $text . '</div></div>' . BBCODE_NOSMILIES_END; $this->code_counter++; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } else { $syntax_highlight = false; if (isset($item['params']['syntax'])) { if ($item['params']['syntax'] == 'php') { $html = strtr($text, array_flip(get_html_translation_table(HTML_ENTITIES))); $html = highlight_string($html, true); $html_search = array('<code>', '</code>', '<font color="', '</font', ' ', '<code style="color:#0000BB"></code>', '<code style="color:#0000BB"> </code>'); $xhtml_replace = array('', '', '<code style="color:', '</code', ' ', '', ''); $html = str_replace($html_search, $xhtml_replace, $html); $syntax_highlight = true; } } if ($syntax_highlight == false) { $html = $text; $search = array('[highlight]', '[/highlight]'); $replace = array('</span><span class="code-row code-row-highlight">', '</span><span class="code-row-text">'); $html = str_replace($search, $replace, $html); $html = str_replace(array("\n", "\r\n"), array("<br />\n", "<br />\r\n"), $html); } $can_download = !empty($this->code_post_id) ? $this->code_post_id : 0; if ($can_download) { $download_text = ' [<a href="download_post.' . PHP_EXT . '?post=' . $can_download; if ($this->code_counter) { $download_text .= '&item=' . $this->code_counter; } $download_text .= '">' . $lang['Download'] . '</a>]'; } else { $download_text = ''; } $code_id = substr(md5($content . mt_rand()), 0, 8); $str = BBCODE_NOSMILIES_START . '<div class="code">'; $str .= '<div class="code-header" id="codehdr2_' . $code_id . '" style="position: relative;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\',\'codehdr2_' . $code_id . '\',\'\'); return false;">' . $lang['Hide'] . '</a>] [<a href="#" onclick="select_text(\'code_' . $code_id . '\'); return false;">' . $lang['Select'] . '</a>]</div>'; $str .= '<div class="code-header" id="codehdr_' . $code_id . '" style="position: relative; display: none;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\',\'codehdr2_' . $code_id . '\',\'\'); return false;">' . $lang['Show'] . '</a>]</div>'; $html = $str . '<div class="code-content" id="code_' . $code_id . '" style="position: relative;"><span class="code-row-text">' . $html . '</span></div></div>' . BBCODE_NOSMILIES_END; $this->code_counter++; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } } // CODEBLOCK if ($tag === 'codeblock') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if (!defined('EXTRACT_CODE')) { /* $search = array( ' ', "\t" ); $replace = array( ' ', ' ' ); $text = str_replace($search, $replace, $this->process_text($content, false, true)); */ $text = $this->process_text($content, false, true); } else { $text = $this->process_text($content, false, true); $search = array('[highlight]', '[/highlight]'); $replace = array('', ''); $text = str_replace($search, $replace, $text); } // check filename if (isset($item['params']['filename'])) { $item['params']['file'] = $item['params']['filename']; } if (defined('EXTRACT_CODE') && $this->code_counter == EXTRACT_CODE) { $GLOBALS['code_text'] = $text; if (!empty($item['params']['file'])) { $GLOBALS['code_filename'] = $item['params']['file']; } } if (substr($text, 0, 1) === "\n") { $text = substr($text, 1); } elseif (substr($text, 0, 2) === "\r\n") { $text = substr($text, 2); } $syntax_highlight = false; if (isset($item['params']['syntax'])) { if ($item['params']['syntax'] == 'php') { $html = strtr($text, array_flip(get_html_translation_table(HTML_ENTITIES))); $html = highlight_string($html, true); $html_search = array('<code>', '</code>', '<font color="', '</font', ' ', '<code style="color:#0000BB"></code>', '<code style="color:#0000BB"> </code>'); $xhtml_replace = array('', '', '<code style="color:', '</code', ' ', '', ''); $html = str_replace($html_search, $xhtml_replace, $html); $syntax_highlight = true; } } if ($syntax_highlight == false) { $html = $text; $search = array('[highlight]', '[/highlight]'); $replace = array('</span><span class="code-row code-row-highlight">', '</span><span class="code-row-text">'); $html = str_replace($search, $replace, $html); $html = str_replace(array("\n", "\r\n"), array("<br />\n", "<br />\r\n"), $html); } $can_download = !empty($this->code_post_id) ? $this->code_post_id : 0; if ($can_download) { $download_text = ' [<a href="download_post.' . PHP_EXT . '?post=' . $can_download; if ($this->code_counter) { $download_text .= '&item=' . $this->code_counter; } $download_text .= '">' . $lang['Download'] . '</a>]'; } else { $download_text = ''; } $code_id = substr(md5($content . mt_rand()), 0, 8); $str = BBCODE_NOSMILIES_START . '<div class="code">'; $str .= '<div class="code-header" id="codehdr2_' . $code_id . '" style="position: relative;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\',\'codehdr2_' . $code_id . '\',\'\'); return false;">' . $lang['Hide'] . '</a>] [<a href="#" onclick="select_text(\'code_' . $code_id . '\'); return false;">' . $lang['Select'] . '</a>]</div>'; $str .= '<div class="code-header" id="codehdr_' . $code_id . '" style="position: relative; display: none;">' . $lang['Code'] . ':' . (empty($item['params']['file']) ? '' : ' (' . htmlspecialchars($item['params']['file']) . ')') . $download_text . ' [<a href="#" onclick="ShowHide(\'code_' . $code_id . '\',\'code2_' . $code_id . '\',\'\'); ShowHide(\'codehdr_' . $code_id . '\',\'codehdr2_' . $code_id . '\',\'\'); return false;">' . $lang['Show'] . '</a>]</div>'; $html = $str . '<div class="code-content" id="code_' . $code_id . '" style="position: relative;"><span class="code-row-text">' . $html . '</span></div></div>' . BBCODE_NOSMILIES_END; $this->code_counter++; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // HIDE if ($tag === 'hide') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if ($item['iteration'] > 1) { return $error; } $show = false; if (defined('IS_ICYPHOENIX') && $user->data['session_logged_in']) { if ($user->data['user_level'] == ADMIN || $user->data['user_level'] == MOD) { $show = true; } else { $sql = "SELECT p.poster_id, p.topic_id\n\t\t\t\t\t\tFROM " . POSTS_TABLE . " p\n\t\t\t\t\t\tWHERE p.topic_id = " . intval($topic_id) . "\n\t\t\t\t\t\tAND p.poster_id = " . $user->data['user_id']; $db->sql_return_on_error(true); $result = $db->sql_query($sql); $db->sql_return_on_error(false); if ($result) { $show = $db->sql_numrows($result) ? true : false; $db->sql_freeresult($result); } $sql = "SELECT *\n\t\t\t\t\t\tFROM " . POSTS_LIKES_TABLE . "\n\t\t\t\t\t\tWHERE topic_id = " . intval($topic_id) . "\n\t\t\t\t\t\tAND user_id = " . $user->data['user_id']; $db->sql_return_on_error(true); $result = $db->sql_query($sql); $db->sql_return_on_error(false); if ($result) { $show = $db->sql_numrows($result) || $show == true ? true : false; $db->sql_freeresult($result); } } } // generate html $html = '<blockquote class="quote"><div class="quote-nouser">' . $lang['xs_bbc_hide_message'] . ':</div><div class="post-text post-text-hide-flow">'; if (!$show) { return array('valid' => true, 'html' => $html . $lang['xs_bbc_hide_message_explain'] . '</div></blockquote>', 'allow_nested' => false); } else { return array('valid' => true, 'start' => $html, 'end' => '</div></blockquote>'); } } // SPOILER if ($tag === 'spoiler') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if ($item['iteration'] > 1) { return $error; } $spoiler_id = substr(md5($content . mt_rand()), 0, 8); $str = '<div class="spoiler">'; $str .= '<div class="code-header" id="spoilerhdr_' . $spoiler_id . '" style="position: relative;">' . $lang['bbcb_mg_spoiler'] . ': [ <a href="#" onclick="ShowHide(\'spoiler_' . $spoiler_id . '\', \'spoiler2_' . $spoiler_id . '\', \'\'); ShowHide(\'spoilerhdr_' . $spoiler_id . '\', \'spoilerhdr2_' . $spoiler_id . '\', \'\'); return false;">' . $lang['Show'] . '</a> ]</div>'; $str .= '<div class="code-header" id="spoilerhdr2_' . $spoiler_id . '" style="position: relative; display: none;">' . $lang['bbcb_mg_spoiler'] . ': [ <a href="#" onclick="ShowHide(\'spoiler_' . $spoiler_id . '\', \'spoiler2_' . $spoiler_id . '\', \'\'); ShowHide(\'spoilerhdr_' . $spoiler_id . '\', \'spoilerhdr2_' . $spoiler_id . '\', \'\'); return false;">' . $lang['Hide'] . '</a> ]</div>'; $str .= '<div class="spoiler-content" id="spoiler2_' . $spoiler_id . '" style="position: relative; display: none;">' . $html; return array('valid' => true, 'start' => $str, 'end' => '</div></div>'); } // USER // Insert the username and avatar for the selected id if ($tag === 'user') { if ($this->is_sig) { return $error; } if (isset($item['params']['param'])) { $bb_userid = (int) $item['params']['param']; } else { $bb_userid = (int) $content; } if ($bb_userid < 2) { return $error; } $bb_user_data = get_userdata($bb_userid); if (empty($bb_user_data)) { return $error; } $bb_name_link = colorize_username($bb_user_data['user_id'], $bb_user_data['username'], $bb_user_data['user_color'], $bb_user_data['user_active']); $bb_avatar_img = user_get_avatar($bb_user_data['user_id'], $bb_user_data['user_level'], $bb_user_data['user_avatar'], $bb_user_data['user_avatar_type'], $bb_user_data['user_allowavatar'], '', 30); $html = $bb_avatar_img . ' ' . $bb_name_link; return array('valid' => true, 'html' => $html); } // LANGVAR // Insert the content of a lang var into post... maybe we need to filter something? if ($tag === 'langvar') { if (isset($item['params']['param'])) { $langvar = $item['params']['param']; } else { $langvar = $content; } $html = isset($lang[$langvar]) ? $lang[$langvar] : ''; return array('valid' => true, 'html' => $html); } // LANGUAGE // Parse the content only if in the same language of the user viewing it!!! if ($tag === 'language') { $language = ''; if (isset($item['params']['param'])) { $language = $item['params']['param']; } $content = $config['default_lang'] != $language ? '' : $content; // We need this trick to process BBCodes withing language BBCode if (empty($content)) { return array('valid' => true, 'html' => ''); } else { return array('valid' => true, 'start' => '', 'end' => ''); } } // SEARCH if ($tag === 'search') { if (empty($content)) { return $error; } $str = '<a href="' . CMS_PAGE_SEARCH . '?search_keywords=' . urlencode($this->process_text($content)) . '">'; return array('valid' => true, 'start' => $str, 'end' => '</a>'); } // TAG if ($tag === 'tag') { if (empty($content)) { return $error; } $str = '<a href="tags.' . PHP_EXT . '?tag_text=' . urlencode($this->process_text($content)) . '">'; return array('valid' => true, 'start' => $str, 'end' => '</a>'); } // Random number or quote (quote not implemented yet) if ($tag === 'random') { $max_n = 6; $max_n = intval(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['max']) ? $item['params']['max'] : 6)); $max_n = $max_n <= 0 ? 6 : $max_n; /* include_once(IP_ROOT_PATH . 'language/lang_' . $config['default_lang'] . '/lang_randomquote.' . PHP_EXT); $randomquote_phrase = $randomquote[rand(0, sizeof($randomquote) - 1)]; */ $html = rand(1, $max_n); return array('valid' => true, 'html' => $html); } // MARQUEE if ($tag === 'marquee') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $extras = $this->allow_styling ? array('style', 'class') : array(); $directions_array = array('up', 'right', 'down', 'left'); $default_param = 'right'; $direction = isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['direction']) ? $item['params']['direction'] : $default_param); $direction = in_array($direction, $directions_array) ? $direction : $default_param; $default_scroll = '120'; $scrolldelay = isset($item['params']['scrolldelay']) ? intval($item['params']['scrolldelay']) : $default_scroll; $scrolldelay = $scrolldelay > 10 && $scrolldelay < 601 ? $scrolldelay : $default_scroll; $default_behavior = 'scroll'; $behavior = isset($item['params']['behavior']) ? intval($item['params']['behavior']) : $default_behavior; $behavior = $behavior === 'alternate' || $behavior === 'slide' ? $behavior : $default_behavior; $html = '<marquee behavior="' . $behavior . '" direction="' . $direction . '" scrolldelay="' . $scrolldelay . '" loop="true" onmouseover="this.stop()" onmouseout="this.start()">'; return array('valid' => true, 'start' => $html, 'end' => '</marquee>'); } // Active Content - BEGIN // Added by Tom XS2 Build 054 if ($config['switch_bbcb_active_content'] == 1) { // FLASH, SWF, FLV, VIDEO, REAL, QUICK, STREAM, EMFF, VIMEO, YOUTUBE, GOOGLEVIDEO if ($tag === 'flash' || $tag === 'swf' || $tag === 'flv' || $tag === 'video' || $tag === 'ram' || $tag === 'quick' || $tag === 'stream' || $tag === 'emff' || $tag === 'mp3' || $tag === 'vimeo' || $tag === 'youtube' || $tag === 'googlevideo') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $content = $this->process_text(isset($item['params']['param']) ? $item['params']['param'] : $content); $color_1 = $this->valid_color(isset($item['params']['colors']) ? $item['params']['colors'] : false); $color_2 = $this->valid_color(isset($item['params']['colore']) ? $item['params']['colore'] : false); $width_array = array(320, 425, 400, 480, 540, 640); $height_array = array(240, 350, 300, 360, 420, 480, 385); // 4/3 YouTube width and height: 425x350 // 16/9 YouTube width and height: 640x385 $default_width = $tag === 'vimeo' || $tag === 'youtube' || $tag === 'googlevideo' ? 640 : 320; $width = isset($item['params']['width']) ? intval($item['params']['width']) : $default_width; $width = $width > 10 && $width < 641 ? $width : $default_width; $default_height = $tag === 'vimeo' || $tag === 'youtube' || $tag === 'googlevideo' ? 385 : 240; $height = isset($item['params']['height']) ? intval($item['params']['height']) : $default_height; $height = $height > 10 && $height < 481 ? $height : $default_height; if ($tag === 'flash' || $tag === 'swf') { $html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' . $width . '" height="' . $height . '"><param name="movie" value="' . $content . '"><param name="quality" value="high"><param name="scale" value="noborder"><param name="wmode" value="transparent"><param name="bgcolor" value="#000000"><embed src="' . $content . '" quality="high" scale="noborder" wmode="transparent" bgcolor="#000000" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>'; } elseif ($tag === 'flv') { $html = '<object type="application/x-shockwave-flash" width="' . $width . '" height="' . $height . '" wmode="transparent" data="flv_player.swf?file=' . $content . '&autoStart=false"><param name="movie" value="flv_player.swf?file=' . $content . '&autoStart=false"/><param name="wmode" value="transparent"/></object>'; } elseif ($tag === 'video') { $html = '<div align="center"><embed src="' . $content . '" width="' . $width . '" height="' . $height . '" autostart="false"></embed></div>'; } elseif ($tag === 'ram') { $html = '<div align="center"><embed src="' . $content . '" align="center" width="275" height="40" type="audio/x-pn-realaudio-plugin" console="cons" controls="ControlPanel" autostart="false"></embed></div>'; } elseif ($tag === 'quick') { $html = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="' . $width . '" height="' . $height . '" align="middle"><param name="controller" value="true"><param name="type" value="video/quicktime"><param name="autoplay" value="true"><param name="target" value="myself"><param name="src" value="' . $content . '"><param name="pluginspage" value="http://www.apple.com/quicktime/download/indext.html"><param name="kioskmode" value="true"><embed src="' . $content . '" width="' . $width . '" height="' . $height . '" align="middle" kioskmode="true" controller="true" target="myself" type="video/quicktime" border="0" pluginspage="http://www.apple.com/quicktime/download/indext.html"></embed></object>'; } elseif ($tag === 'stream') { $html = '<object id="wmp" width="' . $width . '" height="' . $height . '" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><param name="FileName" value="' . $content . '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="' . $content . '" name="MediaPlayer2" showcontrols="1" showdisplay="0" showstatusbar="1" autosize="1" visible="1" animationatstart="0" transparentatstart="1" loop="0" height="70" width="300"></embed></object>'; } elseif ($tag === 'emff' || $tag === 'mp3') { $html = '<object data="emff_player.swf" type="application/x-shockwave-flash" width="200" height="55" align="top" ><param name="FlashVars" value="src=' . $content . '" /><param name="movie" value="emff_player.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#f8f8f8" /></object>'; } elseif ($tag === 'vimeo') { $width = in_array($width, $width_array) ? $width : 640; $height = in_array($height, $height_array) ? $height : 385; $html = '<object type="application/x-shockwave-flash" width="' . $width . '" height="' . $height . '" data="http://www.vimeo.com/moogaloop.swf?clip_id=' . $content . '"><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $content . '" /></object><br /><a href="http://www.vimeo.com/moogaloop.swf?clip_id=' . $content . '" target="_blank">Link</a><br />'; } elseif ($tag === 'youtube') { //check URL type $video_file = $content; if (strpos($content, 'youtu.be') !== false) { // Short URL // parse the URL to split it in parts $parsed_url = parse_url($content); // get the path and delete the initial / simbol $video_file = str_replace('/', '', $parsed_url['path']); } elseif (strrpos($content, 'youtube') !== false) { // Long URL // parse the URL to split it in parts $parsed_url = parse_url($content); // get the query part (vars) and parse them into name and value parse_str($parsed_url['query'], $qvars); // send the value to the destination var. $video_file = $qvars['v']; } $video_file = preg_replace('/[^A-Za-z0-9_-]+/', '', $video_file); $color_append = ''; if ($color_1 || $color_2) { $color_append .= $color_1 ? '&color1=0x' . str_replace('#', '', $color_1) : ''; $color_append .= $color_2 ? '&color2=0x' . str_replace('#', '', $color_2) : ''; } $width = in_array($width, $width_array) ? $width : 640; $height = in_array($height, $height_array) ? $height : 385; $video_link = '<br /><a href="http://youtube.com/watch?v=' . $video_file . $color_append . '" target="_blank">YouTube Link</a><br />'; // OLD OBJECT Version //$html = '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.youtube.com/v/' . $video_file . $color_append . '" /><embed src="http://www.youtube.com/v/' . $video_file . $color_append . '" type="application/x-shockwave-flash" width="' . $width . '" height="' . $height . '"></embed></object>' . $video_link; // IFRAME Version $html = '<iframe width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $video_file . '?autoplay=0' . $color_append . '" frameborder="0"></iframe>' . $video_link; } elseif ($tag === 'googlevideo') { $width = in_array($width, $width_array) ? $width : 640; $height = in_array($height, $height_array) ? $height : 385; $html = '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://video.google.com/googleplayer.swf?docId=' . $content . '"></param><embed style="width:' . $width . 'px; height:' . $height . 'px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=' . $content . '" allowScriptAccess="sameDomain" quality="best" bgcolor="#f8f8f8" scale="noScale" salign="TL" FlashVars="playerMode=embedded"></embed></object><br /><a href="http://video.google.com/videoplay?docid=' . $content . '" target="_blank">Link</a><br />'; } return array('valid' => true, 'html' => $html); } } // Active Content - END // SMILEY if ($tag === 'smiley') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $extras = $this->allow_styling ? array('style', 'class') : array(); $text = htmlspecialchars(isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['text']) ? $item['params']['text'] : $content)); if (isset($item['params']['smilie'])) { if ($item['params']['smilie'] == 'standard' || $item['params']['smilie'] == 'random') { //$smilie = $item['params']['smilie']; $smilie = '1'; } else { $smilie = intval($item['params']['smilie']); } } else { $smilie = '1'; } $default_fontcolor = '000000'; $fontcolor = $this->valid_color(isset($item['params']['fontcolor']) ? $item['params']['fontcolor'] : $default_fontcolor); $fontcolor = $fontcolor === false ? $default_fontcolor : str_replace('#', '', $fontcolor); $default_shadowcolor = '888888'; $shadowcolor = $this->valid_color(isset($item['params']['shadowcolor']) ? $item['params']['shadowcolor'] : $default_shadowcolor); $shadowcolor = $shadowcolor === false ? $default_shadowcolor : str_replace('#', '', $shadowcolor); $default_shieldshadow = 0; $shieldshadow = isset($item['params']['shieldshadow']) ? $item['params']['shieldshadow'] == 1 ? 1 : $default_param : $default_param; //$html = '<img src="text2shield.' . PHP_EXT . '?smilie=' . $smilie . '&fontcolor=' . $fontcolor . '&shadowcolor=' . $shadowcolor . '&shieldshadow=' . $shieldshadow . '&text=' . $text . '" alt="Smiley" title="Smiley" />'; $html = '<img src="text2shield.' . PHP_EXT . '?smilie=' . $smilie . '&fontcolor=' . $fontcolor . '&shadowcolor=' . $shadowcolor . '&shieldshadow=' . $shieldshadow . '&text=' . urlencode(ip_utf8_decode($text)) . '" alt="' . $text . '" title="' . $text . '" />'; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // OPACITY if ($tag === 'opacity') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if (isset($item['params']['param'])) { $opacity = intval($item['params']['param']); if ($opacity > 0 && $opacity < 101) { $opacity = $opacity; } } else { $opacity = '100'; } $opacity_dec = $opacity / 100; $html = '<div class="opacity" style="opacity: ' . $opacity_dec . '; filter: Alpha(Opacity=' . $opacity . ');">'; return array('valid' => true, 'start' => $html, 'end' => '</div>'); } // FADE if ($tag === 'fade') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if (isset($item['params']['param'])) { $opacity = intval($item['params']['param']); if ($opacity > 0 && $opacity < 101) { $opacity = $opacity; } } else { $opacity = '100'; } $opacity_dec = $opacity / 100; $html = '<div style="display: inline; height: 1; opacity: ' . $opacity_dec . '; filter: Alpha(Opacity=' . $opacity . ',FinishOpacity=0,Style=1,StartX=0,FinishX=100%);">'; //$html = '<div style="display:inline;height:1;filter:Alpha(Opacity=' . $opacity . ',FinishOpacity=0,Style=1,StartX=0,FinishX=100%);">'; return array('valid' => true, 'start' => $html, 'end' => '</div>'); } // IE AND HTML 4 ONLY TAGS - BEGIN // Let's add a global IF so we can skip them all in once to speed up things... // Enable these tags only if you know how to make them work... if ($tag === 'glow' || $tag === 'shadow' || $tag === 'blur' || $tag === 'wave' || $tag === 'fliph' || $tag === 'flipv') { return array('valid' => true, 'start' => '', 'end' => ''); } /* if(($tag === 'glow') || ($tag === 'shadow') || ($tag === 'blur') || ($tag === 'wave') || ($tag === 'fliph') || ($tag === 'flipv')) { // GLOW if($tag === 'glow') { $default_color = '#fffffa'; $color = $this->valid_color((isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['color']) ? $item['params']['color'] : $default_color))); if($color === false) { return $error; } $html = '<div style="display: inline; filter: glow(color=' . $color . '); height: 20px;">'; return array( 'valid' => true, 'start' => $html, 'end' => '</div>', ); } // SHADOW if($tag === 'shadow') { $default_color = '#666666'; $color = $this->valid_color((isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['color']) ? $item['params']['color'] : $default_color))); if($color === false) { return $error; } $html = '<div style="display: inline; filter: shadow(color=' . $color . '); height: 20;">'; return array( 'valid' => true, 'start' => $html, 'end' => '</div>', ); } // BLUR if($tag === 'blur') { if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if(isset($item['params']['param'])) { $strenght = intval($item['params']['param']); if (($strenght > 0) && ($strenght < 101)) { $strenght = $strenght; } } else { $strenght = '100'; } $strenght_dec = $strenght / 100; $html = '<div style="display: inline; width: 100%; height: 20; filter: Blur(add=1,direction=270,strength=' . $strenght . ');">'; return array( 'valid' => true, 'start' => $html, 'end' => '</div>', ); } // WAVE if($tag === 'wave') { if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } if(isset($item['params']['param'])) { $strenght = intval($item['params']['param']); if (($strenght > 0) && ($strenght < 101)) { $strenght = $strenght; } } else { $strenght = '100'; } $strenght_dec = $strenght / 100; $html = '<div style="display: inline; width: 100%; height: 20; filter: Wave(add=1,direction=270,strength=' . $strenght . ');">'; return array( 'valid' => true, 'start' => $html, 'end' => '</div>', ); } // FLIPH, FLIPV if(($tag === 'fliph') || ($tag === 'flipv')) { if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $html = '<div style="display: inline; filter: ' . $tag . '; height: 1;">'; return array( 'valid' => true, 'start' => $html, 'end' => '</div>', ); } } */ // OLD IE AND HTML 4 ONLY TAGS - END // TEX if ($tag === 'tex') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } $html = '<img src="cgi-bin/mimetex.cgi?' . $content . '" alt="" border="0" style="vertical-align: middle;" />'; return array('valid' => true, 'html' => $html, 'allow_nested' => false); } // TABLE if ($tag === 'table') { if ($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // additional allowed parameters $extras = $this->allow_styling ? array('style', 'class', 'align', 'width', 'height', 'border', 'cellspacing', 'cellpadding') : array('style', 'class', 'align', 'width'); if (isset($item['params']['param'])) { $table_class = $item['params']['param']; } else { $table_class = ''; } for ($i = 0; $i < sizeof($extras); $i++) { if (!empty($item['params'][$extras[$i]])) { if ($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if ($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } if (!isset($params['class'])) { $params['class'] = $table_class; } // generate html $html = '<table'; foreach ($params as $var => $value) { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } $html .= ' >' . $content . '</table>'; return array('valid' => true, 'html' => $html, 'allow_nested' => true); } /* // TR if($tag === 'tr') { if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // generate html $html = '<tr>' . $content . '</tr>'; return array( 'valid' => true, 'html' => $html, 'allow_nested' => true, ); } // TD if($tag === 'td') { if($this->is_sig && !$config['allow_all_bbcode']) { return $error; } // additional allowed parameters $extras = $this->allow_styling ? array('class', 'align', 'width', 'height') : array('class', 'align', 'width', 'height'); for($i = 0; $i < sizeof($extras); $i++) { if(!empty($item['params'][$extras[$i]])) { if($extras[$i] === 'style') { $style = $this->valid_style($item['params']['style']); if($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } // generate html $html = '<td'; foreach($params as $var => $value) { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } $html .= ' >' . $content . '</td>'; return array( 'valid' => true, 'html' => $html, 'allow_nested' => true, ); } */ // To use IFRAMES you just need to decomment this block of code (and allow the tag on top of this file)... good luck! // IFRAME //<iframe src="index.html" scrolling="no" width="100%" height="190" frameborder="0" marginheight="0" marginwidth="0"></iframe> //[iframe height=100]docs/index.html[/iframe] //[iframe src=docs/index.html height=100] [/iframe] /* if($tag === 'iframe') { if(isset($item['params']['param'])) { $params['src'] = $item['params']['param']; } elseif(isset($item['params']['src'])) { $params['src'] = $item['params']['src']; } elseif(!empty($content)) { $params['src'] = $content; } if(isset($item['params']['scrolling']) && ($params['scrolling'] == 'no')) { $params['scrolling'] = 'no'; //$params['scrolling'] = $item['params']['scrolling']; } else { $params['scrolling'] = 'yes'; } if(isset($item['params']['width'])) { $params['width'] = $item['params']['width']; } else { $params['width'] = '100%'; } if(isset($item['params']['height'])) { $params['height'] = $item['params']['height']; } else { $params['height'] = '600'; } foreach($params as $var => $value) { if ($this->process_text($value) != '') { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } } $extras = $this->allow_styling ? array('style', 'class') : array('class'); $html = '<iframe' . $html . '>'; return array( 'valid' => true, 'start' => $html, 'end' => '</iframe>' ); } */ // Invalid tag return $error; }
if (album_check_permission($auth_data, ALBUM_AUTH_UPLOAD) == true && $enable_picture_upload_switch == false || ($no_personal_gallery = false)) { $template->assign_block_vars('enable_picture_upload_pg', array()); } // Enable download only for own personal galleries //if (($total_pics > 0) && ($enable_picture_download_switch == false) && ($thiscat['cat_user_id'] == $user->data['user_id'])) if ($total_pics > 0 && $enable_picture_download_switch == false) { $template->assign_block_vars('enable_picture_download_pg', array()); } if ($no_personal_gallery == false) { $auth_data = album_permissions($album_user_id, $cat_id, ALBUM_AUTH_ALL, $thiscat); $auth_list = album_build_auth_list($album_user_id, $cat_id); //if((album_check_permission($auth_data, ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES) == true) && ($is_root_cat) && (!$has_sub_cats && !$has_parent_cats)) if (album_check_permission($auth_data, ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES) == true && ($is_root_cat && $row['count'] >= 0 || !$is_root_cat)) { $template->assign_block_vars('manage_personal_gal_folders', array()); } } // ------------------------------------------------------------------------ // Check if we should show the view toggle button // ------------------------------------------------------------------------ if ($album_config['show_all_in_personal_gallery'] == 1) { $template->assign_block_vars('enable_view_toggle', array()); } if ($thiscat['cat_user_id'] == $user->data['user_id']) { $template->assign_block_vars('switch_own_gallery', array()); } $template->assign_block_vars('personal_gallery_header', array()); // ------------------------------------------------------------------------ // Do our template info... // ------------------------------------------------------------------------ $template->assign_vars(array('L_ALBUM' => $lang['Album'], 'U_VIEW_CAT' => append_sid(album_append_uid($album_page_url . '?cat_id=' . intval($cat_id))), 'CAT_TITLE' => $is_root_cat || $album_view_mode == ALBUM_VIEW_ALL ? htmlspecialchars(sprintf($lang['Personal_Gallery_Of_User'], $username)) : $thiscat['cat_title'], 'ALBUM_NAVIGATION_ARROW' => ALBUM_NAV_ARROW, 'NAV_CAT_DESC' => $album_nav_cat_desc, 'ALBUM_AUTHOR_AVATAR' => user_get_avatar($album_user['user_id'], $album_user['user_level'], $album_user['user_avatar'], $album_user['user_avatar_type'], $album_user['user_allowavatar']), 'L_PERSONAL_GALLERY_EXPLAIN' => $lang['Personal_Gallery_Explain'], 'L_MODERATORS' => $lang['Moderators'], 'MODERATORS' => $moderators_list, 'L_ALBUM_ALLPICS' => $lang['All_Picture_List_Of_User'], 'L_ALBUM_OTF' => $lang['Pic_Gallery'], 'L_ALBUM_HON' => $lang['Hot_Or_Not'], 'L_ALBUM_RDF' => $lang['Pic_RDF'], 'L_ALBUM_RSS' => $lang['Pic_RSS'], 'U_ALBUM_ALLPICS' => append_sid(album_append_uid('album_allpics.' . PHP_EXT)), 'U_ALBUM_OTF' => append_sid(album_append_uid('album_otf.' . PHP_EXT)), 'U_ALBUM_HON' => append_sid(album_append_uid('album_hotornot.' . PHP_EXT)), 'U_ALBUM_RDF' => append_sid(album_append_uid('album_rdf.' . PHP_EXT)), 'U_ALBUM_RSS' => append_sid(album_append_uid('album_rss.' . PHP_EXT)), 'L_UPLOAD_PIC' => $lang['Upload_Pic'], 'U_UPLOAD_PIC' => $upload_link, 'UPLOAD_PIC_IMG' => $upload_img, 'UPLOAD_LINK' => $upload_link, 'UPLOAD_FULL_LINK' => $upload_full_link, 'L_DOWNLOAD_PICS' => $lang['Download_pics'], 'L_DOWNLOAD_PAGE' => $lang['Download_page'], 'U_DOWNLOAD' => $download_link, 'DOWNLOAD_PIC_IMG' => $download_img, 'DOWNLOAD_LINK' => $download_link, 'DOWNLOAD_FULL_LINK' => $download_full_link, 'U_CREATE_PERSONAL_GALLERY' => $create_personal_cat_link, 'CREATE_CATEGORY_IMG' => $images['manage_pic'], 'U_MANAGE_PIC' => append_sid(album_append_uid('album_personal_cat_admin.' . PHP_EXT . '?cat_id=' . $cat_id)), 'MANAGE_PIC_IMG' => $images['manage_pic'], 'L_MANAGE_PIC' => $lang['manage_Pic'], 'U_TOGGLE_VIEW_ALL' => $view_mode_url, 'TOGGLE_VIEW_ALL_IMG' => $image_toggle_button, 'L_TOGGLE_VIEW_ALL' => $view_mode_text, 'L_CATEGORY' => htmlspecialchars(sprintf($lang['Personal_Gallery_Of_User'], $username)), 'L_NO_PICS' => $no_picture_message, 'L_PERSONAL_GALLERY_NOT_CREATED' => htmlspecialchars(sprintf($lang['Personal_gallery_not_created'], $username)), 'L_RECENT_PUBLIC_PICS' => htmlspecialchars(sprintf($lang['Recent_Personal_Pics'], $username)), 'S_COLS' => $album_config['cols_per_page'], 'S_COL_WIDTH' => 100 / $album_config['cols_per_page'] . '%', 'S_THUMBNAIL_SIZE' => $album_config['thumbnail_size'], 'L_VIEW' => $lang['View'], 'L_PIC_CAT' => $lang['Pic_Cat'], 'L_POSTER' => $lang['Pic_Poster'], 'L_POSTED' => $lang['Posted'], 'ALBUM_JUMPBOX' => $album_jumpbox, 'S_ALBUM_ACTION' => append_sid(album_append_uid($album_page_url . '?cat_id=' . intval($cat_id))), 'TARGET_BLANK' => $album_config['fullpic_popup'] ? 'target="_blank"' : '', 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'L_TIME' => $lang['Time'], 'L_PIC_ID' => $lang['Pic_ID'], 'L_PIC_TITLE' => $lang['Pic_Image'], 'SORT_TIME' => $sort_method == 'pic_time' ? 'selected="selected"' : '', 'SORT_PIC_TITLE' => $sort_method == 'pic_title' ? 'selected="selected"' : '', 'SORT_VIEW' => $sort_method == 'pic_view_count' ? 'selected="selected"' : '', 'SORT_RATING_OPTION' => $sort_rating_option, 'SORT_COMMENTS_OPTION' => $sort_comments_option, 'SORT_NEW_COMMENT_OPTION' => $sort_new_comment_option, 'SORT_USERNAME_OPTION' => $sort_username_option, 'L_ASC' => $lang['Sort_Ascending'], 'L_DESC' => $lang['Sort_Descending'], 'SORT_ASC' => $sort_order == 'ASC' ? 'selected="selected"' : '', 'SORT_DESC' => $sort_order == 'DESC' ? 'selected="selected"' : '', 'S_AUTH_LIST' => $auth_list));
$k = 0; $row_class = (!($k % 2)) ? $theme['td_class1'] : $theme['td_class2']; $user_id = $staff['user_id']; // Mighty Gorgon - Multiple Ranks - BEGIN $user_ranks = generate_ranks($staff, $ranks_array); if (($user_ranks['rank_01_html'] == '') && ($user_ranks['rank_01_img_html'] == '') && ($user_ranks['rank_02_html'] == '') && ($user_ranks['rank_02_img_html'] == '') && ($user_ranks['rank_03_html'] == '') && ($user_ranks['rank_03_img_html'] == '') && ($user_ranks['rank_04_html'] == '') && ($user_ranks['rank_04_img_html'] == '') && ($user_ranks['rank_05_html'] == '') && ($user_ranks['rank_05_img_html'] == '')) { $user_ranks['rank_01_html'] = ' '; } // Mighty Gorgon - Multiple Ranks - END $rank = $user_ranks['rank_01_html']; $rank_image = $user_ranks['rank_01_img_html']; $avatar = user_get_avatar($staff['user_id'], $staff['user_level'], $staff['user_avatar'], $staff['user_avatar_type'], $staff['user_allowavatar']); $forums = ''; if(!empty($staff2[$staff['user_id']])) { asort($staff2[$staff['user_id']]); $forums = implode(' ', $staff2[$staff['user_id']]); } /* // Mighty Gorgon: OLD SQL REMOVED - BEGIN $sql_posts = "SELECT DISTINCT p.post_time, p.post_id, count(DISTINCT t.topic_id) AS user_topics FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t WHERE p.poster_id = '$user_id' AND t.topic_poster = '$user_id' GROUP BY p.post_time ORDER BY p.post_time DESC LIMIT 1";
/** * Print the avatar in the user row of the plugin table * * @param $data_row * @param $group_index */ function print_user_avatar($data_row, $group_index) { $user_id = $data_row['user_id']; $user_global_access_level = user_get_field(auth_get_current_user_id(), 'access_level'); $no_user = userprojectapi::get_no_user($user_id); $no_issue = $data_row['no_issue']; $assigned_project_id = $data_row['assigned_project_id']; $assigned_to_project = userprojectapi::get_assigned_to_project($user_id, $assigned_project_id); $unreachable_issue = userprojectapi::get_unreachable_issue($assigned_to_project); if (plugin_config_get('ShowAvatar') && config_get('show_avatar')) { if ($group_index > 0) { if (!user_exists($user_id) && !$no_user || userprojectapi::check_user_id_is_valid($user_id) && !userprojectapi::check_user_id_is_enabled($user_id) && plugin_config_get('IAUHighlighting')) { echo '<td align="center" width="25px" style="background-color:' . plugin_config_get('IAUHBGColor') . '">'; } elseif ($no_issue && plugin_config_get('ZIHighlighting')) { echo '<td align="center" width="25px" style="background-color:' . plugin_config_get('ZIHBGColor') . '">'; } elseif ($no_user && plugin_config_get('NUIHighlighting')) { echo '<td align="center" width="25px" style="background-color:' . plugin_config_get('NUIHBGColor') . '">'; } elseif ($unreachable_issue && plugin_config_get('URIUHighlighting')) { echo '<td align="center" width="25px" style="background-color:' . plugin_config_get('URIUHBGColor') . '">'; } else { echo '<td class="user_row_bg" align="center" width="25px">'; } if (user_exists($user_id)) { if ($group_index != 1) { echo '<a href="search.php?' . userprojectapi::generate_status_link() . '&handler_id=' . userprojectapi::get_link_user_id($user_id) . '&sortby=last_updated' . '&dir=DESC' . '&hide_status_id=-2' . '&match_type=0">'; } if (config_get('show_avatar') && $user_global_access_level >= config_get('show_avatar_threshold')) { if ($user_id > 0) { $avatar = user_get_avatar($user_id); echo '<img class="avatar" src="' . $avatar[0] . '" />'; } } if ($group_index != 1) { echo '</a>'; } } echo '</td>' . PHP_EOL; } else { $assigned_to_project = userprojectapi::get_assigned_to_project($user_id, $assigned_project_id); $unreachable_issue = userprojectapi::get_unreachable_issue($assigned_to_project); echo '<td>'; if (!$no_user && !$unreachable_issue) { echo '<label>'; echo '<input type="checkbox" name="dataRow[]" value="' . $user_id . ',' . $assigned_project_id . '"/>'; echo '</label>'; } echo '</td>' . PHP_EOL; } } else { echo '<td width="25px"></td>'; } }
function cms_block_news_posters() { global $db, $cache, $config, $template, $images, $lang, $block_id, $cms_config_vars; include_once IP_ROOT_PATH . 'includes/functions_users.' . PHP_EXT; $template->_tpldata['news_poster.'] = array(); $page_link = htmlspecialchars($cms_config_vars['md_news_posters_page_link'][$block_id]); //0 = alphabetical || 1 = News $list_sort = request_var('list_sort', ''); $list_sort = $list_sort == POST_TOPIC_URL ? 1 : ($list_sort == POST_USERS_URL ? 0 : false); $list_sort = $list_sort === false ? $cms_config_vars['md_news_posters_sort'][$block_id] == 1 ? 1 : 0 : $list_sort; $show_avatars = $cms_config_vars['md_news_posters_avatar'][$block_id] == 1 ? 1 : 0; $start = request_var('start', 0); $start = $start < 0 ? 0 : $start; $per_page = request_var('per_page', $config['topics_per_page']); $per_page = $per_page < 0 ? $config['topics_per_page'] : $per_page; $quick_list = request_var('quick_list', ''); $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME'); $portal_page_id = request_var('page', 0); $portal_page_id = !empty($portal_page_id) ? '&page=' . $portal_page_id : ''; $base_url = htmlspecialchars(urldecode($index_file)); $base_url .= '?list_sort=' . ($list_sort == 1 ? POST_TOPIC_URL : POST_USERS_URL); $base_url .= '&per_page=' . $per_page; $base_url .= $portal_page_id; $sort_sql = "ORDER BY " . ($list_sort == 1 ? "num_topics DESC" : "u.username ASC"); $template->assign_vars(array('S_QUICK_LIST' => $quick_list == 'true' ? true : false, 'U_QUICK_LIST' => $base_url . '&quick_list=true', 'U_NORMAL_LIST' => $base_url, 'L_NEWS_POSTERS' => $lang['cms_block_news_posters'], 'L_USER_PROFILE' => $lang['Profile'], 'L_PM' => $lang['Private_Message'], 'L_USER_WWW' => $lang['Website'])); $tpl_block_var_name = 'news_poster' . ($show_avatars == 1 ? '_av' : ''); if ($quick_list == 'true') { $sql = "SELECT t.topic_poster, COUNT(t.topic_poster) num_topics,\n\t\t\t\t\t\t\t\tu.user_id, u.username, u.user_active, u.user_color\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE t.news_id > 0\n\t\t\t\t\t\t\t\tAND t.topic_status <> '" . TOPIC_MOVED . "'\n\t\t\t\t\t\t\t\tAND u.user_id = t.topic_poster\n\t\t\t\t\t\t\tGROUP BY t.topic_poster\n\t\t\t\t\t\t\t" . $sort_sql; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $username_clean = $row['username']; $username = colorize_username($row['user_id'], $row['username'], $row['user_color'], $row['user_active']); $user_id = $row['user_id']; $posts = $row['user_posts'] ? $row['user_posts'] : 0; $template->assign_block_vars('news_poster', array('USERNAME' => $username . $gender_image, 'NEWS' => $row['num_topics'], 'U_VIEWNEWS' => append_sid($page_link . (strpos($page_link, '?') === false ? '?' : '&') . 'ubid=' . $user_id))); } $db->sql_freeresult($result); } else { $sql = "SELECT t.topic_poster, COUNT(t.topic_poster) num_topics,\n\t\t\t\t\t\t\t\tu.user_id, u.username, u.user_active, u.user_color, u.user_level, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_posts,\n\t\t\t\t\t\t\t\tu.user_from, u.user_from_flag, u.user_regdate, u.user_gender,\n\t\t\t\t\t\t\t\tu.user_website, u.user_icq, u.user_aim, u.user_msnm, u.user_yim, u.user_skype\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE t.news_id > 0\n\t\t\t\t\t\t\t\tAND t.topic_status <> '" . TOPIC_MOVED . "'\n\t\t\t\t\t\t\t\tAND u.user_id = t.topic_poster\n\t\t\t\t\t\t\tGROUP BY t.topic_poster\n\t\t\t\t\t\t\t" . $sort_sql . "\n\t\t\t\t\t\t\tLIMIT " . $start . ", " . $per_page; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $username_clean = $row['username']; $username = colorize_username($row['user_id'], $row['username'], $row['user_color'], $row['user_active']); $user_id = $row['user_id']; $posts = $row['user_posts'] ? $row['user_posts'] : 0; $poster_avatar = user_get_avatar($row['user_id'], $row['user_level'], $row['user_avatar'], $row['user_avatar_type'], $row['user_allowavatar']); $poster_from = $row['user_from'] ? $lang['Location'] . ': ' . $row['user_from'] : $lang['Location'] . ': ???'; $poster_from_flag = $row['user_from_flag'] ? ' <img src="images/flags/' . $row['user_from_flag'] . '" alt="' . $row['user_from_flag'] . '" title="' . $row['user_from'] . '" />' : ''; $poster_joined = $lang['Joined'] . ': ' . create_date($lang['JOINED_DATE_FORMAT'], $row['user_regdate'], $config['board_timezone']); $temp_url = append_sid(CMS_PAGE_PRIVMSG . '?mode=post&' . POST_USERS_URL . '=' . $poster_id); $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" /></a>'; $pm = '<a href="' . $temp_url . '">' . $lang['PM'] . '</a>'; switch ($row['user_gender']) { case 1: $gender_image = ' <img src="' . $images['icon_minigender_male'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Male'] . '" title="' . $lang['Gender'] . ': ' . $lang['Male'] . '" />'; break; case 2: $gender_image = ' <img src="' . $images['icon_minigender_female'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Female'] . '" title="' . $lang['Gender'] . ': ' . $lang['Female'] . '" />'; break; default: $gender_image = ''; } $user_info = array(); $user_info = generate_user_info($row); foreach ($user_info as $k => $v) { ${$k} = $v; } $template->assign_block_vars($tpl_block_var_name, array('USERNAME' => $username . $gender_image, 'POSTS' => $posts, 'NEWS' => $row['num_topics'], 'AVATAR_IMG' => $poster_avatar, 'POSTER_FROM' => $poster_from . $poster_from_flag, 'POSTER_JOINED' => $poster_joined, 'CONTACTS' => $pm_img . $www_img . $icq_img . $aim_img . $msn_img . $yahoo_img . $skype_img, 'PROFILE_IMG' => $profile_img, 'PROFILE' => $profile, 'PM_IMG' => $pm_img, 'PM' => $pm, 'WWW_IMG' => $www_img, 'WWW' => $www, 'AIM_IMG' => $aim_img, 'AIM' => $aim, 'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_IMG' => $icq_img, 'ICQ' => $icq, 'MSN_IMG' => $msn_img, 'MSN' => $msn, 'SKYPE_IMG' => $skype_img, 'SKYPE' => $skype, 'YIM_IMG' => $yahoo_img, 'YIM' => $yahoo, 'U_PROFILE' => $profile_url, 'U_PM' => $pm_url, 'U_WWW' => $www_url, 'U_AIM' => $aim_url, 'U_ICQ' => $icq_url, 'U_MSN' => $msn_url, 'U_SKYPE' => $skype_url, 'U_YIM' => $yahoo_url, 'U_VIEWPOSTER' => append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id), 'U_VIEWNEWS' => append_sid($page_link . (strpos($page_link, '?') === false ? '?' : '&') . 'ubid=' . $user_id), 'U_VIEWTOPICS' => append_sid(CMS_PAGE_SEARCH . '?search_author=' . urlencode(ip_utf8_decode($username_clean)) . '&search_topic_starter=1&show_results=topics'), 'U_VIEWPOSTS' => append_sid(CMS_PAGE_SEARCH . '?search_author=' . urlencode(ip_utf8_decode($username_clean)) . '&showresults=posts'))); } $db->sql_freeresult($result); $sql = "SELECT COUNT(DISTINCT t.topic_poster) as news_posters\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " t\n\t\t\t\t\t\t\tWHERE t.news_id > 0\n\t\t\t\t\t\t\t\tAND t.topic_status <> '" . TOPIC_MOVED . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $total_news_posters = $row['news_posters']; $db->sql_freeresult($result); $number_of_page = ceil($total_news_posters / $per_page) == 0 ? 1 : ceil($total_news_posters / $per_page); $template->assign_vars(array('PAGINATION' => generate_pagination($base_url, $total_news_posters, $per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $per_page) + 1, $number_of_page), 'L_GOTO_PAGE' => $lang['Goto_page'])); } }
// BIRTHDAY - END $post_date = create_date_ip($config['default_dateformat'], $postrow[$i]['post_time'], $config['board_timezone']); $poster_posts = ($postrow[$i]['user_id'] != ANONYMOUS) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : ''; $poster_flag_country = ($postrow[$i]['user_from_flag'] == 'blank.gif') ? '' : ucwords(str_replace(array('.gif', '.png', '_'), array('', '', ' '), $postrow[$i]['user_from_flag'])); $poster_from_flag = (!empty($postrow[$i]['user_from_flag']) && ($postrow[$i]['user_id'] != ANONYMOUS)) ? '<img src="images/flags/' . $postrow[$i]['user_from_flag'] . '" alt="' . $postrow[$i]['user_from_flag'] . '" title="' . $postrow[$i]['user_from'] . (!empty($poster_flag_country) ? (' (' . $poster_flag_country . ')') : '') . '" />' : ''; $poster_from = (!empty($postrow[$i]['user_from']) && ($postrow[$i]['user_id'] != ANONYMOUS)) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; $poster_from_full = ((!empty($poster_from_flag) || !empty($postrow[$i]['user_from'])) && ($postrow[$i]['user_id'] != ANONYMOUS)) ? $lang['Location'] . ':' . (!empty($poster_from_flag) ? (' ' . $poster_from_flag) : '') . (!empty($postrow[$i]['user_from']) ? (' ' . $postrow[$i]['user_from']) : '') : ''; $poster_joined = ($postrow[$i]['user_id'] != ANONYMOUS) ? $lang['Joined'] . ': ' . create_date($lang['JOINED_DATE_FORMAT'], $postrow[$i]['user_regdate'], $config['board_timezone']) : ''; $poster_avatar = user_get_avatar($poster_id, $postrow[$i]['user_level'], $postrow[$i]['user_avatar'], $postrow[$i]['user_avatar_type'], $postrow[$i]['user_allowavatar']); // Define the little post icon // UPI2DB - BEGIN if(!$user->data['upi2db_access']) { // UPI2DB - END if ($user->data['session_logged_in'] && ($postrow[$i]['post_time'] > $user->data['user_lastvisit']) && ($postrow[$i]['post_time'] > $topic_last_read) && !$user->data['is_bot']) { $mini_post_img = $images['icon_minipost_new']; $mini_post_alt = $lang['New_post']; } else { $mini_post_img = $images['icon_minipost']; $mini_post_alt = $lang['Post'];
function generate_user_info(&$row, $date_format = false, $is_moderator = false) { global $config, $lang, $images, $user; $date_format = $date_format == false ? $lang['JOINED_DATE_FORMAT'] : $date_format; $info_array = array('avatar', 'first_name', 'last_name', 'from', 'posts', 'joined', 'gender', 'flag', 'style', 'age', 'birthday', 'avatar', 'profile_url', 'profile_img', 'profile', 'pm_url', 'pm_img', 'pm', 'search_url', 'search_img', 'search', 'ip_url', 'ip_img', 'ip', 'email_url', 'email_img', 'email', 'www_url', 'www_img', 'www', 'online_status_url', 'online_status_class', 'online_status_img', 'online_status'); $user_sn_im_array = get_user_sn_im_array(); foreach ($user_sn_im_array as $k => $v) { $info_array[] = $k; $info_array[] = $k . '_img'; $info_array[] = $k . '_url'; } // Initialize everything... $user_info = array(); for ($i = 0; $i < sizeof($info_array); $i++) { $user_info[$info_array[$i]] = ''; } $user_info['from'] = !empty($row['user_from']) ? $row['user_from'] : ' '; $user_info['joined'] = create_date($date_format, $row['user_regdate'], $config['board_timezone']); $user_info['posts'] = $row['user_posts'] ? $row['user_posts'] : 0; $user_info['style'] = $row['style_name'] ? $row['style_name'] : ''; $user_info['avatar'] = user_get_avatar($row['user_id'], $row['user_level'], $row['user_avatar'], $row['user_avatar_type'], $row['user_allowavatar']); if (empty($user->data['user_id']) || $user->data['user_id'] == ANONYMOUS) { if (!empty($row['user_viewemail'])) { $user_info['email_img'] = '<img src="' . $images['icon_email'] . '" alt="' . $lang['Hidden_email'] . '" title="' . $lang['Hidden_email'] . '" />'; } else { $user_info['email_img'] = ' '; } $user_info['email'] = ' '; } elseif (!empty($row['user_allow_viewemail']) || $is_moderator || $user->data['user_level'] == ADMIN) { $user_info['email_url'] = $config['board_email_form'] ? append_sid(CMS_PAGE_PROFILE . '?mode=email&' . POST_USERS_URL . '=' . $row['user_id']) : 'mailto:' . $row['user_email']; $user_info['email_img'] = '<a href="' . $user_info['email_url'] . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" /></a>'; $user_info['email'] = '<a href="' . $user_info['email_url'] . '">' . $lang['Send_email'] . '</a>'; } else { $user_info['email_img'] = ' '; $user_info['email'] = ' '; } if (isset($row['ct_last_used_ip']) && $user->data['user_level'] == ADMIN) { $user_info['ip_url'] = 'http://www.nic.com/cgi-bin/whois.cgi?query=' . htmlspecialchars(urlencode($row['ct_last_used_ip'])); $user_info['ip_img'] = '<a href="' . $user_info['ip_url'] . '" target="_blank"><img src="' . $images['icon_ip2'] . '" alt="' . $lang['View_IP'] . ' (' . htmlspecialchars($row['ct_last_used_ip']) . ')" title="' . $lang['View_IP'] . ' (' . htmlspecialchars($row['ct_last_used_ip']) . ')" /></a>'; $user_info['ip'] = '<a href="' . $user_info['ip_url'] . '">' . $lang['View_IP'] . '</a>'; } $user_info['profile_url'] = append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $row['user_id']); $user_info['profile_img'] = '<a href="' . $user_info['profile_url'] . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>'; $user_info['profile'] = '<a href="' . $user_info['profile_url'] . '">' . $lang['Read_profile'] . '</a>'; $user_info['pm_url'] = append_sid(CMS_PAGE_PRIVMSG . '?mode=post&' . POST_USERS_URL . '=' . $row['user_id']); $user_info['pm_img'] = '<a href="' . $user_info['pm_url'] . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" /></a>'; $user_info['pm'] = '<a href="' . $user_info['pm_url'] . '">' . $lang['Send_private_message'] . '</a>'; $user_info['search_url'] = append_sid(CMS_PAGE_SEARCH . '?search_author=' . urlencode($username) . '&showresults=posts'); $user_info['search_img'] = '<a href="' . $search_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username) . '" title="' . sprintf($lang['Search_user_posts'], $username) . '" /></a>'; $user_info['search'] = '<a href="' . $search_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>'; $user_info['www_img'] = !empty($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_blank"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" /></a>' : ''; $user_info['www'] = !empty($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_blank">' . $lang['Visit_website'] . '</a>' : ''; $user_info['www_url'] = !empty($row['user_website']) ? $row['user_website'] : ''; $user_sn_im_array = get_user_sn_im_array(); $im_links_array = array(); foreach ($user_sn_im_array as $k => $v) { $im_links_array[$k] = $v['alt_name']; } $im_links_array['chat'] = 'id'; $all_ims = array(); foreach ($im_links_array as $im_k => $im_v) { $all_ims[$im_k] = array('plain' => '', 'img' => '', 'url' => ''); if (!empty($row['user_' . $im_v])) { $all_ims[$im_k] = array('plain' => build_im_link($im_k, $row, false, false, false, false, false), 'img' => build_im_link($im_k, $row, 'icon_tpl_vt', true, false, false, false), 'url' => build_im_link($im_k, $row, false, false, true, false, false)); } $user_info[$im_k . '_img'] = $all_ims[$im_k]['img']; $user_info[$im_k] = $all_ims[$im_k]['plain']; $user_info[$im_k . '_url'] = $all_ims[$im_k]['url']; } $user_info['icq_status_img'] = !empty($row['user_icq']) ? '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" /></a>' : ''; // ONLINE / OFFLINE - BEGIN $user_info['online_status_url'] = append_sid(CMS_PAGE_VIEWONLINE); // Start as offline... $user_info['online_status_img'] = '<img src="' . $images['icon_offline2'] . '" alt="' . $lang['Offline'] . '" title="' . $lang['Offline'] . '" />'; $user_info['online_status_lang'] = $lang['Offline']; $user_info['online_status_class'] = 'offline'; if ($row['user_session_time'] >= time() - $config['online_time']) { if (!empty($row['user_allow_viewonline'])) { $user_info['online_status_img'] = '<a href="' . $user_info['online_status_url'] . '"><img src="' . $images['icon_online2'] . '" alt="' . $lang['Online'] . '" title="' . $lang['Online'] . '" /></a>'; $user_info['online_status_lang'] = $lang['Online']; $user_info['online_status_class'] = 'online'; } elseif (isset($row['user_allow_viewonline']) && empty($row['user_allow_viewonline']) && ($user->data['user_level'] == ADMIN || $user->data['user_id'] == $user_id)) { $user_info['online_status_img'] = '<a href="' . $user_info['online_status_url'] . '"><img src="' . $images['icon_hidden2'] . '" alt="' . $lang['Hidden'] . '" title="' . $lang['Hidden'] . '" /></a>'; $user_info['online_status_lang'] = $lang['Hidden']; $user_info['online_status_class'] = 'hidden'; } } // ONLINE / OFFLINE - END // GENDER - BEGIN $user_info['gender'] = ''; if (isset($row['user_gender'])) { switch ($row['user_gender']) { case 1: $user_info['gender'] = '<img src="' . $images['icon_minigender_male'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Male'] . '" title="' . $lang['Gender'] . ': ' . $lang['Male'] . '" />'; break; case 2: $user_info['gender'] = '<img src="' . $images['icon_minigender_female'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Female'] . '" title="' . $lang['Gender'] . ': ' . $lang['Female'] . '" />'; break; default: $user_info['gender'] = ''; break; } } // GENDER - END if (isset($row['user_birthday_y'])) { $time_now = time(); $b_year = create_date('Y', $time_now, $config['board_timezone']); $user_info['age'] = '(' . (intval($b_year) - intval($row['user_birthday_y'])) . ')'; } /* $template->assign_vars(array( 'L_USER_PROFILE' => $lang['Profile'], 'L_PM' => $lang['Private_Message'], 'L_EMAIL' => $lang['Email'], 'L_POSTS' => $lang['Posts'], 'L_CONTACTS' => $lang['User_Contacts'], 'L_WEBSITE' => $lang['Website'], 'L_FROM' => $lang['Location'], 'L_ONLINE_STATUS' => $lang['Online_status'], 'FROM' => $user_info['from'], 'JOINED' => $user_info['joined'], 'POSTS' => $user_info['posts'], 'AVATAR_IMG' => $user_info['avatar'], 'AGE' => $user_info['age'], 'GENDER' => $user_info['gender'], 'STYLE' => $user_info['style'], 'PROFILE_URL' => $user_info['profile_url'], 'PROFILE_IMG' => $user_info['profile_img'], 'PROFILE' => $user_info['profile'], 'PM_URL' => $user_info['pm_url'], 'PM_IMG' => $user_info['pm_img'], 'PM' => $user_info['pm'], 'SEARCH_URL' => $user_info['search_url'], 'SEARCH_IMG' => $user_info['search_img'], 'SEARCH' => $user_info['search'], 'IP_URL' => $user_info['ip_url'], 'IP_IMG' => $user_info['ip_img'], 'IP' => $user_info['ip'], 'EMAIL_URL' => $user_info['email_url'], 'EMAIL_IMG' => $user_info['email_img'], 'EMAIL' => $user_info['email'], 'WWW_URL' => $user_info['www_url'], 'WWW_IMG' => $user_info['www_img'], 'WWW' => $user_info['www'], 'AIM_URL' => $user_info['aim_url'], 'AIM_IMG' => $user_info['aim_img'], 'AIM' => $user_info['aim'], 'ICQ_STATUS_IMG' => $user_info['icq_status_img'], 'ICQ_URL' => $user_info['icq_url'], 'ICQ_IMG' => $user_info['icq_img'], 'ICQ' => $user_info['icq'], 'MSN_URL' => $user_info['msn_url'], 'MSN_IMG' => $user_info['msn_img'], 'MSN' => $user_info['msn'], 'SKYPE_URL' => $user_info['skype_url'], 'SKYPE_IMG' => $user_info['skype_img'], 'SKYPE' => $user_info['skype'], 'YIM_URL' => $user_info['yahoo_url'], 'YIM_IMG' => $user_info['yahoo_img'], 'YIM' => $user_info['yahoo'], 'ONLINE_STATUS_URL' => $user_info['online_status_url'], 'ONLINE_STATUS_CLASS' => $user_info['online_status_class'], 'ONLINE_STATUS_IMG' => $user_info['online_status_img'], 'ONLINE_STATUS' => $user_info['online_status'], 'L_ONLINE_STATUS' => $user_info['online_status_lang'], ) ); */ return $user_info; }
$template->assign_block_vars('show_thanks_profile', array()); } // Mighty Gorgon - Thanks Received - END // Mighty Gorgon - HTTP AGENTS - BEGIN include IP_ROOT_PATH . 'includes/functions_mg_http.' . PHP_EXT; $user_os = get_user_os($profiledata['user_browser']); $user_browser = get_user_browser($profiledata['user_browser']); // Mighty Gorgon - HTTP AGENTS - END // Mighty Gorgon - Full Album Pack - BEGIN if (!empty($config['plugins']['album']['enabled'])) { include IP_ROOT_PATH . PLUGINS_PATH . $config['plugins']['album']['dir'] . 'common.' . PHP_EXT; include IP_ROOT_PATH . PLUGINS_PATH . $config['plugins']['album']['dir'] . 'includes/album_functions_profile.' . PHP_EXT; album_profile_last_pictures($profiledata); } // Mighty Gorgon - Full Album Pack - END $avatar_img = user_get_avatar($profiledata['user_id'], $profiledata['user_level'], $profiledata['user_avatar'], $profiledata['user_avatar_type'], $profiledata['user_allowavatar']); // Mighty Gorgon - Multiple Ranks - BEGIN $user_ranks = generate_ranks($profiledata, $ranks_array); // Mighty Gorgon - Multiple Ranks - END // ONLINE OFFLINE - BEGIN $user_online_status = 'offline'; if ($profiledata['user_session_time'] >= time() - $config['online_time']) { if ($profiledata['user_allow_viewonline']) { $user_online_status = 'online'; $online_status_img = '<a href="' . append_sid(CMS_PAGE_VIEWONLINE) . '"><img src="' . $images['icon_online'] . '" alt="' . htmlspecialchars(sprintf($lang['is_online'], $profiledata['username'])) . '" title="' . htmlspecialchars(sprintf($lang['is_online'], $profiledata['username'])) . '" /></a>'; } elseif ($user->data['user_level'] == ADMIN || $user->data['user_id'] == $profiledata['user_id']) { $user_online_status = 'hidden'; $online_status_img = '<a href="' . append_sid(CMS_PAGE_VIEWONLINE) . '"><img src="' . $images['icon_hidden'] . '" alt="' . htmlspecialchars(sprintf($lang['is_hidden'], $profiledata['username'])) . '" title="' . htmlspecialchars(sprintf($lang['is_hidden'], $profiledata['username'])) . '" /></a>'; } else { $user_online_status = 'offline'; $online_status_img = '<img src="' . $images['icon_offline'] . '" alt="' . htmlspecialchars(sprintf($lang['is_offline'], $profiledata['username'])) . '" title="' . htmlspecialchars(sprintf($lang['is_offline'], $profiledata['username'])) . '" />';
function cms_block_random_user() { global $db, $cache, $config, $template, $images, $user, $lang, $block_id, $cms_config_vars; // Mighty Gorgon - Multiple Ranks - BEGIN @(include_once IP_ROOT_PATH . 'includes/functions_users.' . PHP_EXT); $ranks_array = $cache->obtain_ranks(false); // Mighty Gorgon - Multiple Ranks - END $sql = "SELECT u.*\n\t\t\tFROM " . USERS_TABLE . " u\n\t\t\tWHERE (u.user_id <> " . ANONYMOUS . ")\n\t\t\tORDER BY RAND()\n\t\t\tLIMIT 1"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $user_id = $row['user_id']; $username = colorize_username($row['user_id'], $row['username'], $row['user_color'], $row['user_active']); $username_simple = $row['username']; $user_pics = $row['user_personal_pics_count']; $posts = $row['user_posts'] ? $row['user_posts'] : 0; $poster_avatar = user_get_avatar($row['user_id'], $row['user_level'], $row['user_avatar'], $row['user_avatar_type'], $row['user_allowavatar']); $poster_posts = $row['user_id'] != ANONYMOUS ? $lang['Posts'] . ': ' . $row['user_posts'] : ''; $poster_from = $row['user_from'] && $row['user_id'] != ANONYMOUS ? $lang['Location'] . ': ' . $row['user_from'] : ''; $poster_from_flag = $row['user_from_flag'] && $row['user_id'] != ANONYMOUS ? '<img src="images/flags/' . $row['user_from_flag'] . '" alt="' . $row['user_from_flag'] . '" title="' . $row['user_from'] . '" />' : ''; $poster_joined = $row['user_id'] != ANONYMOUS ? $lang['Joined'] . ': ' . create_date($lang['JOINED_DATE_FORMAT'], $row['user_regdate'], $config['board_timezone']) : ''; $poster_age = ''; $poster_birthday = ''; if ($row['user_birthday'] != 999999) { $this_year = create_date('Y', time(), $config['board_timezone']); $this_date = create_date('md', time(), $config['board_timezone']); $poster_birthday = realdate('d/m/Y', $row['user_birthday']); $poster_age = $this_year - realdate('Y', $row['user_birthday']); if ($this_date < $poster_birthday) { $poster_age--; } $poster_age = $lang['Age'] . ': ' . $poster_age . ' (' . $poster_birthday . ')<br />'; } // Mighty Gorgon - Multiple Ranks - BEGIN $user_ranks = generate_ranks($row, $ranks_array); if ($user_ranks['rank_01_html'] == '' && $user_ranks['rank_01_img_html'] == '' && $user_ranks['rank_02_html'] == '' && $user_ranks['rank_02_img_html'] == '' && $user_ranks['rank_03_html'] == '' && $user_ranks['rank_03_img_html'] == '' && $user_ranks['rank_04_html'] == '' && $user_ranks['rank_04_img_html'] == '' && $user_ranks['rank_05_html'] == '' && $user_ranks['rank_05_img_html'] == '') { $user_ranks['rank_01_html'] = ' '; } // Mighty Gorgon - Multiple Ranks - END $profile_url = append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id); $profile_img = '<a href="' . $profile_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>'; $profile = '<a href="' . $profile_url . '">' . $lang['Profile'] . '</a>'; $profile_link = '<a href="' . $profile_url . '">' . $lang['SEE_MORE_DETAILS'] . '</a>'; $pm_url = append_sid(CMS_PAGE_PRIVMSG . '?mode=post&' . POST_USERS_URL . '=' . $user_id); $pm_img = '<a href="' . $pm_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" /></a>'; $pm = '<a href="' . $pm_url . '">' . $lang['PM'] . '</a>'; // Start add - Gender MOD switch ($row['user_gender']) { case 1: $gender_image = '<img src="' . $images['icon_minigender_male'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Male'] . '" title="' . $lang['Gender'] . ': ' . $lang['Male'] . '" />'; break; case 2: $gender_image = '<img src="' . $images['icon_minigender_female'] . '" alt="' . $lang['Gender'] . ': ' . $lang['Female'] . '" title="' . $lang['Gender'] . ': ' . $lang['Female'] . '" />'; break; default: $gender_image = ''; } // End add - Gender MOD if (!empty($row['user_allow_viewemail']) || $user->data['user_level'] == ADMIN) { $email_uri = $config['board_email_form'] ? append_sid(CMS_PAGE_PROFILE . '?mode=email&' . POST_USERS_URL . '=' . $user_id) : 'mailto:' . $row['user_email']; $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" /></a>'; $email = '<a href="' . $email_uri . '">' . $lang['Email'] . '</a>'; } else { $email_img = ''; $email = ''; } $www_img = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_blank"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" /></a>' : ''; $www = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_blank">' . $lang['Website'] . '</a>' : ''; $user_sn_im_array = get_user_sn_im_array(); $im_links_array = array(); foreach ($user_sn_im_array as $k => $v) { $im_links_array[$k] = $v['alt_name']; } $im_links_array['chat'] = 'id'; $all_ims = array(); foreach ($im_links_array as $im_k => $im_v) { $all_ims[$im_k] = array('plain' => '', 'img' => '', 'url' => ''); if (!empty($row['user_' . $im_v])) { $all_ims[$im_k] = array('plain' => build_im_link($im_k, $row, false, false, false, false, false), 'img' => build_im_link($im_k, $row, 'icon_tpl_vt', true, false, false, false), 'url' => build_im_link($im_k, $row, false, false, true, false, false)); } } $aim_img = $all_ims['aim']['img']; $aim = $all_ims['aim']['plain']; $aim_url = $all_ims['aim']['url']; $icq_status_img = !empty($row['user_icq']) ? '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" /></a>' : ''; $icq_img = $all_ims['icq']['img']; $icq = $all_ims['icq']['plain']; $icq_url = $all_ims['icq']['url']; $msn_img = $all_ims['msn']['img']; $msn = $all_ims['msn']['plain']; $msn_url = $all_ims['msn']['url']; $skype_img = $all_ims['skype']['img']; $skype = $all_ims['skype']['plain']; $skype_url = $all_ims['skype']['url']; $yahoo_img = $all_ims['yahoo']['img']; $yahoo = $all_ims['yahoo']['plain']; $yahoo_url = $all_ims['yahoo']['url']; if (!empty($config['plugins']['album']['enabled']) && $row['user_personal_pics_count'] > 0) { $album_img = $row['user_personal_pics_count'] ? '<a href="album.' . PHP_EXT . '?user_id=' . $row['user_id'] . '"><img src="' . $images['icon_album'] . '" alt="' . $lang['Show_Personal_Gallery'] . '" title="' . $lang['Show_Personal_Gallery'] . '" /></a>' : ''; $album = $row['user_personal_pics_count'] ? '<a href="album.' . PHP_EXT . '?user_id=' . $row['user_id'] . '">' . $lang['Show_Personal_Gallery'] . '</a>' : ''; } else { $album_img = ''; $album = ''; } // ONLINE / OFFLINE - BEGIN if ($user->data['user_level'] == ADMIN || $user->data['user_id'] == $user_id || $row['user_allow_viewonline']) { if ($row['user_session_time'] >= time() - $config['online_time']) { $online_status_img = '<a href="' . append_sid(CMS_PAGE_VIEWONLINE) . '"><img src="' . $images['icon_online2'] . '" alt="' . $lang['Online'] . '" title="' . $lang['Online'] . '" /></a>'; } else { $online_status_img = '<img src="' . $images['icon_offline2'] . '" alt="' . $lang['Offline'] . '" title="' . $lang['Offline'] . '" />'; } } else { $online_status_img = '<a href="' . append_sid(CMS_PAGE_VIEWONLINE) . '"><img src="' . $images['icon_hidden2'] . '" alt="' . $lang['Hidden'] . '" title="' . $lang['Hidden'] . '" /></a>'; } // ONLINE / OFFLINE - END $template->assign_block_vars('random_user', array('L_POSTS' => $lang['Posts'], 'USERNAME' => $username, 'POSTS' => $posts, 'U_VIEWPOSTER' => append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id), 'U_VIEWPOSTS' => append_sid(CMS_PAGE_SEARCH . '?search_author=' . urlencode(ip_utf8_decode($username_simple)) . '&showresults=posts'), 'POSTER_AGE' => $poster_age, 'POSTER_BIRTHDAY' => $poster_birthday, 'USER_RANK_01' => $user_ranks['rank_01_html'], 'USER_RANK_01_IMG' => $user_ranks['rank_01_img_html'], 'USER_RANK_02' => $user_ranks['rank_02_html'], 'USER_RANK_02_IMG' => $user_ranks['rank_02_img_html'], 'USER_RANK_03' => $user_ranks['rank_03_html'], 'USER_RANK_03_IMG' => $user_ranks['rank_03_img_html'], 'USER_RANK_04' => $user_ranks['rank_04_html'], 'USER_RANK_04_IMG' => $user_ranks['rank_04_img_html'], 'USER_RANK_05' => $user_ranks['rank_05_html'], 'USER_RANK_05_IMG' => $user_ranks['rank_05_img_html'], 'POSTER_GENDER' => $gender_image, 'POSTER_JOINED' => $poster_joined, 'POSTER_POSTS' => $poster_posts, 'POSTER_FROM' => $poster_from, 'POSTER_FROM_FLAG' => $poster_from_flag, 'POSTER_AVATAR' => $poster_avatar, 'PROFILE_IMG' => $profile_img, 'PROFILE' => $profile, 'PROFILE_LINK' => $profile_link, 'PM_IMG' => $pm_img, 'PM' => $pm, 'EMAIL_IMG' => !$user->data['session_logged_in'] ? '' : $email_img, 'EMAIL' => $email, 'WWW_IMG' => $www_img, 'WWW' => $www, 'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_IMG' => $icq_img, 'ICQ' => $icq, 'AIM_IMG' => $aim_img, 'AIM' => $aim, 'MSN_IMG' => $msn_img, 'MSN' => $msn, 'YIM_IMG' => $yahoo_img, 'YIM' => $yahoo, 'SKYPE_IMG' => $skype_img, 'SKYPE' => $skype, 'POSTER_ONLINE_STATUS_IMG' => $online_status_img)); } $db->sql_freeresult($result); }
$result = $db->sql_query($sql); $total = $db->sql_numrows($result); $db->sql_freeresult($result); $sql = "SELECT p.*, u.username, u.user_active, u.user_color, u.user_level, u.user_avatar_type, u.user_allowavatar, u.user_avatar FROM " . PROFILE_VIEW_TABLE . " p, " . USERS_TABLE . " u WHERE p.viewer_id = u.user_id AND p.user_id = " . $user_id . " ORDER BY p.view_stamp DESC LIMIT " . $start . ", " . $config['posts_per_page']; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $viewer = $row['viewer_id']; $viewer_avatar = user_get_avatar($row['viewer_id'], $row['user_level'], $row['user_avatar'], $row['user_avatar_type'], $row['user_allowavatar']); $template->assign_block_vars('row', array( 'AVATAR' => $viewer_avatar, 'VIEW_BY' => colorize_username($viewer, $row['username'], $row['user_color'], $row['user_active']), 'NUMBER' => $row['counter'], 'STAMP' => create_date_ip($user->data['user_dateformat'], $row['view_stamp'], $user->data['user_timezone']) ) ); } $template->assign_vars(array( 'PAGINATION' => generate_pagination('profile_view_user.' . PHP_EXT . '?' . POST_USERS_URL . '=' . $user_id, $total, $config['posts_per_page'], $start), 'PROFILE' => '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id) . '" class="nav-current">' . $profile['username'] . '</a>', 'L_VIEW_TITLE' => $meta_content['page_title'], 'L_VIEWER' => $lang['Username'], 'L_NUMBER' => $lang['Views'],
/** * Returns html string representing the beginning block of a timeline entry * @return string */ public function html_start() { $t_avatar = user_get_avatar($this->user_id, 32); if (!empty($t_avatar)) { $t_class = 'entry'; $t_src = 'src="' . $t_avatar[0] . '" '; } else { $t_class = 'entry-no-avatar'; $t_src = ''; } $t_html = '<div class="%s"><img class="avatar" %s/><div class="timestamp">%s</div>'; return sprintf($t_html, $t_class, $t_src, $this->format_timestamp($this->timestamp)); }
function print_avatar($p_user_id, $p_size = 80) { if (OFF == config_get('show_avatar')) { return; } if (!user_exists($p_user_id)) { return; } if (access_has_project_level(config_get('show_avatar_threshold'), null, $p_user_id)) { $t_avatar = user_get_avatar($p_user_id, $p_size); if (false !== $t_avatar) { $t_avatar_url = htmlspecialchars($t_avatar[0]); $t_width = $t_avatar[1]; $t_height = $t_avatar[2]; echo '<a rel="nofollow" href="http://site.gravatar.com"><img class="avatar" src="' . $t_avatar_url . '" alt="User avatar" width="' . $t_width . '" height="' . $t_height . '" /></a>'; } } }
function print_option_avatar_col($user_id) { echo '<td class="group_row_bg" style="width: 25px">'; $avatar = user_get_avatar($user_id); echo '<img class="avatar" src="' . $avatar[0] . '" />'; echo '</td>'; }