function __wps__show_gallery() { global $wpdb, $current_user; $html = ''; $html .= "<div class='__wps__wrapper'>"; $term = ""; if (isset($_GET['term'])) { $term .= strtolower($_GET['term']); } $html .= "<div style='padding:0px'>"; $html .= '<input type="text" id="gallery_member" autocomplete="off" name="gallery_member" class="gallery_member_box" value="'.$term.'" style="margin-right:10px" />'; $html .= '<input id="gallery_go_button" type="submit" class="__wps__button" value="'.__("Search", WPS_TEXT_DOMAIN).'" />'; $html .= "</div>"; $sql = "SELECT g.*, u.display_name FROM ".$wpdb->base_prefix."symposium_gallery g INNER JOIN ".$wpdb->base_prefix."users u ON u.ID = g.owner WHERE g.name LIKE '%".$term."%' OR u.display_name LIKE '%".$term."%' ORDER BY gid DESC LIMIT 0,50"; $albums = $wpdb->get_results($sql); $album_count = 0; $total_count = 0; if ($albums) { $page_length = (get_option(WPS_OPTIONS_PREFIX."_gallery_page_length") != '') ? get_option(WPS_OPTIONS_PREFIX."_gallery_page_length") : 10; $html .= "<div id='symposium_gallery_albums'>"; foreach ($albums AS $album) { $total_count++; // check for privacy if ( ($album->owner == $current_user->ID) || (strtolower($album->sharing) == 'public') || (is_user_logged_in() && strtolower($album->sharing) == 'everyone') || (strtolower($album->sharing) == 'friends only' && __wps__friend_of($album->owner, $current_user->ID)) || __wps__get_current_userlevel() == 5) { $sql = "SELECT COUNT(iid) FROM ".$wpdb->base_prefix."symposium_gallery_items WHERE gid = %d"; $photo_count = $wpdb->get_var($wpdb->prepare($sql, $album->gid)); if ($photo_count > 0) { $sql = "SELECT * FROM ".$wpdb->base_prefix."symposium_gallery_items WHERE gid = %d ORDER BY photo_order DESC"; $photos = $wpdb->get_results($wpdb->prepare($sql, $album->gid)); // Check that at least one actually exists $tmpDir = get_option(WPS_OPTIONS_PREFIX.'_img_path'); $img_exists = false; if ($photos && get_option(WPS_OPTIONS_PREFIX.'_img_db') != "on") { foreach ($photos as $photo) { $img_src = '/members/'.$album->owner.'/media/'.$album->gid.'/'.$photo->name; if (file_exists($tmpDir.$img_src)) { $img_exists = true; break; } } } else { $img_exists = true; } if ($img_exists) { $html .= "<div id='__wps__album_content' style='padding-bottom:30px;'>"; $html .= "<div id='wps_gallery_album_name_".$album->gid."' class='topic-post-header'>".stripslashes($album->name)."</div>"; $html .= "<p>".__wps__profile_link($album->owner)."</p>"; if ($photos) { $album_count++; $cnt = 0; $thumbnail_size = (get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") != '') ? get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") : 75; $html .= '<div id="wps_comment_plus" style="width:98%;height:'.($thumbnail_size+10).'px;overflow:hidden; ">'; $preview_count = (get_option(WPS_OPTIONS_PREFIX."_gallery_preview") != '') ? get_option(WPS_OPTIONS_PREFIX."_gallery_preview") : 5; foreach ($photos as $photo) { $cnt++; if (get_option(WPS_OPTIONS_PREFIX.'_img_db') == "on") { $img_src = WP_CONTENT_URL."/plugins/wp-symposium/get_album_item.php?iid=".$photo->iid."&size=photo"; $thumb_src = WP_CONTENT_URL."/plugins/wp-symposium/get_album_item.php?iid=".$photo->iid."&size=thumbnail"; } else { $tmp_src = '/members/'.$album->owner.'/media/'.$album->gid.'/thumb_'.$photo->name; if (file_exists($tmpDir.$tmp_src)) { if (get_option(WPS_OPTIONS_PREFIX."_gallery_show_resized") == 'on') { $img_src = get_option(WPS_OPTIONS_PREFIX.'_img_url').'/members/'.$album->owner.'/media/'.$album->gid.'/show_'.$photo->name; } else { $img_src = get_option(WPS_OPTIONS_PREFIX.'_img_url').'/members/'.$album->owner.'/media/'.$album->gid.'/'.$photo->name; } $thumb_src = get_option(WPS_OPTIONS_PREFIX.'_img_url').'/members/'.$album->owner.'/media/'.$album->gid.'/thumb_'.$photo->name; } else { $img_src = __wps__siteURL().get_option(WPS_OPTIONS_PREFIX.'_images').'/broken_file_link.png'; $thumb_src = __wps__siteURL().get_option(WPS_OPTIONS_PREFIX.'_images').'/broken_file_link.png'; } } $html .= '<div class="__wps__photo_outer">'; $html .= '<div class="__wps__photo_inner">'; $html .= '<div class="__wps__photo_cover">'; $html .= '<a class="__wps__photo_cover_action wps_gallery_album" data-owner="'.$album->owner.'" data-iid="'.$photo->iid.'" data-name="'.stripslashes($photo->title).'" href="'.$img_src.'" rev="'.$cnt.'" rel="symposium_gallery_photos_'.$album->gid.'" title="'.stripslashes($album->name).'">'; $thumbnail_size = (get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") != '') ? get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") : 75; $html .= '<img class="__wps__photo_image" style="width:'.$thumbnail_size.'px; height:'.$thumbnail_size.'px;" src="'.$thumb_src.'" />'; $html .= '</a>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; if (count($photos) > $preview_count && $cnt == $preview_count) { $html .= '<div id="wps_gallery_comment_more" style="cursor:pointer">'.__('more...', WPS_TEXT_DOMAIN).'<div style="clear:both"></div></div>'; } } $html .= '</div>'; } else { $html .= __("No photos yet.", WPS_TEXT_DOMAIN); } $html .= '</div>'; } } if ($album_count == $page_length) { break; } } } $html .= "<div style='clear:both;text-align:center; margin-top:20px; width:100%'><a href='javascript:void(0)' id='showmore_gallery'>".__("more...", WPS_TEXT_DOMAIN)."</a></div>"; $html .= '</div>'; } // Stores start value for more $html .= '<div id="symposium_gallery_start" style="display:none">'.$total_count.'</div>'; $html .= '<div id="symposium_gallery_page_length" style="display:none">'.$page_length.'</div>'; $html .= '</div>'; return $html; }
function __wps__do_Forumexperts_Widget($cat_id,$cat_id_exclude,$timescale,$postcount,$groups) { global $wpdb,$current_user; $html = ''; $user_info = get_user_by('login', 'nobody'); $nobody_id = $user_info->ID; if (!$nobody_id) $nobody_id = 0; // Content of widget $sql = "SELECT topic_owner, display_name, count(*) AS cnt FROM (SELECT topic_owner FROM ".$wpdb->prefix."symposium_topics t WHERE t.topic_owner != ".$nobody_id." AND t.topic_answer = 'on' AND t.topic_date >= ( CURDATE() - INTERVAL ".$timescale." DAY ) "; if ($cat_id != '' && $cat_id > 0) { $sql .= "AND topic_category IN (".$cat_id.") "; } if ($cat_id_exclude != '' && $cat_id_exclude > 0) { $sql .= "AND topic_category NOT IN (".$cat_id_exclude.") "; } if ($groups != 'on') { $sql .= "AND topic_group = 0 "; } $sql .= "ORDER BY topic_owner) AS tmp "; $sql .= "LEFT JOIN ".$wpdb->base_prefix."users u ON topic_owner = u.ID "; $sql .= "GROUP BY topic_owner, display_name "; $sql .= "ORDER BY cnt DESC"; $posts = $wpdb->get_results($sql); $count = 1; if ($posts) { $html .= "<div id='__wps__latest_forum'>"; foreach ($posts as $post) { $html .= '<div style="clear:both;">'; $html .= '<div style="float:left;">'; $html .= __wps__profile_link($post->topic_owner); $html .= '</div>'; $html .= '<div style="float:right;">'; $html .= $post->cnt.'<br />'; $html .= '</div>'; $html .= '</div>'; if ($count++ == $postcount) { break; } } $html .= "</div>"; } echo $html; }
function __wps__members($attr) { global $wpdb, $current_user; wp_get_current_user(); $plugin = WPS_PLUGIN_URL; $dbpage = $plugin.'/symposium_members_db.php'; $roles = isset($attr['roles']) ? $attr['roles'] : ''; if ($roles) { if (strpos($roles, ' ') !== FALSE) $roles = str_replace(' ', '', $roles); if (strpos($roles, '_') !== FALSE) $roles = str_replace('_', '', $roles); } $html = '<div class="__wps__wrapper">'; if (!is_user_logged_in() && get_option(WPS_OPTIONS_PREFIX.'dir_hide_public') ) { echo __wps__show_login_link(__("You need to be <a href='%s'>logged in</a> to view the directory.", WPS_TEXT_DOMAIN)); } else { // If 'term' is passed as a parameter, it will influence the results $me = $current_user->ID; $page = 1; // Now check against shortcode parameter (overrides global roles) if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles(); if ($roles) { $dir_levels = $roles; } else { // Get included global levels $dir_levels = strtolower(get_option(WPS_OPTIONS_PREFIX.'_dir_level')); if (strpos($dir_levels, ' ') !== FALSE) $dir_levels = str_replace(' ', '', $dir_levels); if (strpos($dir_levels, '_') !== FALSE) $dir_levels = str_replace('_', '', $dir_levels); } $html .= '<div id="__wps__directory_roles" style="display:none">'.$dir_levels.'</div>'; // Stores start value for more $start = get_option(WPS_OPTIONS_PREFIX.'_dir_page_length')+1; $html .= '<div id="symposium_directory_start" style="display:none">'.$start.'</div>'; $html .= '<div id="symposium_directory_page_length" style="display:none">'.get_option(WPS_OPTIONS_PREFIX.'_dir_page_length').'</div>'; $term = ""; if (isset($_POST['member'])) { $term .= strtolower($_POST['member']); } if (isset($_GET['term'])) { $term .= strtolower($_GET['term']); } $html .= "<div class='members_row' style='padding:0px'>"; $html .= '<div style="float:right; padding:0px;padding-top:2px;">'; $html .= '<input id="members_go_button" type="submit" class="__wps__button" value="'.__("Search", WPS_TEXT_DOMAIN).'" />'; if (is_user_logged_in()) { $html .= '<div style="clear:both;"><input type="checkbox" id="symposium_member_friends" /> '.__('Only friends', WPS_TEXT_DOMAIN).'</div>'; } $html .= '</div>'; $html .= '<input type="text" id="symposium_member" autocomplete="off" name="symposium_member" class="members_search_box" value="'.$term.'" />'; if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite') && function_exists('__wps__profile_plus')) { $html .= '<div style="clear:both">'; $html .= '<a href="javascript:void(0);" id="symposium_show_advanced" /> '.__('Advanced search', WPS_TEXT_DOMAIN).'</a>'; $html .= '</div>'; } $html .= "</div>"; if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite') && function_exists('__wps__profile_plus')) { // Loop through extended fields and offer as a search options (if there are any) $extensions = $wpdb->get_results("SELECT * FROM ".$wpdb->base_prefix."symposium_extended WHERE search = 'on' ORDER BY extended_order, extended_name"); if ($extensions) { $html .= "<div id='symposium_advanced_search' style='width:90%;padding:0px;display:none;'>"; $html .= "<table style='border:0'>"; foreach ($extensions as $extension) { $html .= '<tr>'; if ($extension->extended_type == 'Checkbox') { $html .= '<td id="__wps__ext_label_'.$extension->eid.'" style="border:0">'; $html .= stripslashes($extension->extended_name); $html .= '</td><td id="__wps__ext_value_'.$extension->eid.'" style="border:0">'; $html .= '<input rel="checkbox" id="'.$extension->eid.'" class="symposium_extended_search" type="checkbox" name="extended_value[]" />'; $html .= '</td>'; } if ($extension->extended_type == 'List') { $html .= '<td id="__wps__ext_label_'.$extension->eid.'" style="border:0">'; $html .= stripslashes($extension->extended_name).':'; $html .= '</td><td id="__wps__ext_value_'.$extension->eid.'" style="border:0">'; $html .= '<select rel="list" id="'.$extension->eid.'" class="symposium_extended_search" name="extended_value[]">'; $items = explode(',', $extension->extended_default); $html .= '<option value="'.__('Any', WPS_TEXT_DOMAIN).'">'.__('Any', WPS_TEXT_DOMAIN).'</option>'; foreach ($items as $item) { $html .= '<option value="'.$item.'">'.$item.'</option>'; } $html .= '</select>'; $html .= '</td>'; } $html .= '</tr>'; } $html .= "</table>"; $html .= "</div>"; } } // Sort by option $order = get_option(WPS_OPTIONS_PREFIX.'_dir_atoz_order'); if ($order == 'surname') { $orderby = 'surname'; } if ($order == 'display_name') { $orderby = 'u.display_name'; } if ($order == 'distance') { $orderby = 'distance, u.display_name'; } if ($order == 'last_activity') { $orderby = 'cast(m4.meta_value as datetime) DESC'; } $html .= '<br /><div id="symposium_members_orderby_div">'; $html .= __('Sort by:', WPS_TEXT_DOMAIN).' '; $html .= '<select id="symposium_members_orderby">'; $html .= '<option value="last_activity"'; if ($order == 'last_activity') $html .= ' SELECTED'; $html .= '>'.__('Last activity', WPS_TEXT_DOMAIN).'</option>'; $html .= '<option value="display_name"'; if ($order == 'display_name') $html .= ' SELECTED'; $html .= '>'.__('Display name', WPS_TEXT_DOMAIN).'</option>'; $html .= '<option value="surname"'; if ($order == 'surname') $html .= ' SELECTED'; $html .= '>'.__('Surname (if entered in display name)', WPS_TEXT_DOMAIN).'</option>'; if (get_option(WPS_OPTIONS_PREFIX.'_use_distance') && function_exists('__wps__profile_plus') && !get_option(WPS_OPTIONS_PREFIX.'_hide_location')) { $html .= '<option value="distance"'; if ($order == 'distance') $html .= ' SELECTED'; $html .= '>'.__('Distance', WPS_TEXT_DOMAIN).'</option>'; } $html .= '</select>'; $html .= '</div>'; // A to Z $html .= '<div id="symposium_members_atoz">'; for ($i = 65; $i <= 90; $i++) { if (chr($i) != strtoupper($term)) { // Get directory URL worked out $member_url = __wps__get_url('members'); $q = __wps__string_query($member_url); $html .= '<a href="'.$member_url.$q.'term='.chr($i).'">'.chr($i).'</a> '; } else { $html .= '<strong>'.chr($i).'</strong> '; } } $html .= '</div>'; $html .= '<div id="__wps__members">'; $search_limit = 1000; $sql_ext = strlen($term) != 1 ? "OR (lower(u.display_name) LIKE '% %".$term."%')" : ""; $lat = __wps__get_meta($current_user->ID, 'plus_lat'); if (get_option(WPS_OPTIONS_PREFIX.'_use_distance') && $lat != 0 && is_user_logged_in() && function_exists('__wps__profile_plus')) { $long = __wps__get_meta($current_user->ID, 'plus_long'); $measure = ($value = get_option(WPS_OPTIONS_PREFIX."_plus_lat_long")) ? $value : ''; $show_alt = ($value = get_option(WPS_OPTIONS_PREFIX."_plus_show_alt")) ? $value : ''; $sql = "SELECT u.ID as uid, u.display_name, cast(m4.meta_value as datetime) as last_activity, CASE WHEN u.display_name LIKE '% %' THEN right(u.display_name, length(u.display_name)-locate(' ', u.display_name)) ELSE u.display_name END AS surname, CASE m7.meta_value WHEN '0' THEN 99999 ELSE FLOOR(((ACOS(SIN(".$lat." * PI() / 180) * SIN(m7.meta_value * PI() / 180) + COS(".$lat." * PI() / 180) * COS(m7.meta_value * PI() / 180) * COS((".$long." - m8.meta_value) * PI() / 180)) * 180 / PI()) * 60 * 1.1515)) END AS distance FROM ".$wpdb->base_prefix."users u LEFT JOIN ".$wpdb->base_prefix."usermeta m4 ON m4.user_id = u.ID LEFT JOIN ".$wpdb->base_prefix."usermeta m7 ON m7.user_id = u.ID LEFT JOIN ".$wpdb->base_prefix."usermeta m8 ON m8.user_id = u.ID WHERE m4.meta_key = 'symposium_last_activity' AND m7.meta_key = 'symposium_plus_lat' AND m8.meta_key = 'symposium_plus_long' AND (u.display_name IS NOT NULL) AND ( (lower(u.display_name) LIKE '".$term."%') ".$sql_ext." ) ORDER BY ".$orderby." LIMIT 0,".$search_limit; $members = $wpdb->get_results($sql); } else { $members = $wpdb->get_results(" SELECT u.ID as uid, u.display_name, cast(m4.meta_value as datetime) as last_activity, 99999 as distance, CASE WHEN u.display_name LIKE '% %' THEN right(u.display_name, length(u.display_name)-locate(' ', u.display_name)) ELSE u.display_name END AS surname FROM ".$wpdb->base_prefix."users u LEFT JOIN ".$wpdb->base_prefix."usermeta m4 ON u.ID = m4.user_id WHERE m4.meta_key = 'symposium_last_activity' AND (u.display_name IS NOT NULL) AND ( (lower(u.display_name) LIKE '".$term."%') ".$sql_ext." ) ORDER BY ".$orderby." LIMIT 0,".$search_limit); } if (WPS_DEBUG) { $html .= $wpdb->last_query; $html .= '<p>Returned '.count($members).' records.</p>'; } else { $html .= '<div style="display:none">'.$wpdb->last_query.'</div>'; } if ($members) { if (WPS_DEBUG) $html .= '<p>Processing $members.</p>'; $inactive = get_option(WPS_OPTIONS_PREFIX.'_online'); $offline = get_option(WPS_OPTIONS_PREFIX.'_offline'); $profile = __wps__get_url('profile'); $mailpage = __wps__get_url('mail'); $q = __wps__string_query($mailpage); $count = 0; $user_info = get_user_by('login', 'nobody'); $nobody_id = $user_info ? $user_info->ID : 0; foreach ($members as $member) { if (WPS_DEBUG) $html .= 'Member: '.$member->display_name.'<br />'; $user_info = get_userdata($member->uid); // Check to see if this member is in the included list of roles if (WPS_DEBUG) $html .= 'Checking capabilities... '; $user = get_userdata( $member->uid ); $capabilities = $user->{$wpdb->base_prefix.'capabilities'}; $include = false; if ($capabilities) { foreach ( $capabilities as $role => $name ) { if ($role) { if (WPS_DEBUG) $html .= $role.'<br />'; $role = strtolower($role); $role = str_replace(' ', '', $role); $role = str_replace('_', '', $role); if (WPS_DEBUG) $html .= 'Checking role '.$role.' against '.$dir_levels.'<br />'; if (strpos($dir_levels, $role) !== FALSE) $include = true; } else { if (WPS_DEBUG) $html .= 'no role<br />'; } } } else { if (WPS_DEBUG) $html .= 'no capabilities.<br />'; // No capabilities, so let's assume they should be included $include = true; } if ($include && ($member->uid != $nobody_id)) { if (WPS_DEBUG) $html .= 'Include!<br />'; $city = __wps__get_meta($member->uid, 'extended_city'); $country = __wps__get_meta($member->uid, 'extended_country'); $share = __wps__get_meta($member->uid, 'share'); $wall_share = __wps__get_meta($member->uid, 'wall_share'); $count++; if ($count > get_option(WPS_OPTIONS_PREFIX.'_dir_page_length')) break; $time_now = time(); $last_active_minutes = strtotime($member->last_activity); $last_active_minutes = floor(($time_now-$last_active_minutes)/60); $html .= "<div class='members_row"; $is_friend = __wps__friend_of($member->uid, $current_user->ID); if ($is_friend || $member->uid == $me) { $html .= " row_odd corners"; } else { $html .= " row corners"; } $html .= "'>"; $html .= "<div class='members_info'>"; $html .= "<div class='members_avatar'>"; $html .= get_avatar($member->uid, 64); $html .= "</div>"; $html .= "<div style='padding-left: 75px;'>"; if ( ($member->uid == $me) || (is_user_logged_in() && strtolower($share) == 'everyone') || (strtolower($share) == 'public') || (strtolower($share) == 'friends only' && $is_friend) ) { $html .= "<div class='members_location'>"; if ($city != '') { $html .= $city; } if ($country != '') { if ($city != '') { $html .= ', '.$country; } else { $html .= $country; } } $html .= "</div>"; } if (function_exists('__wps__mail') && !get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { // Show Send Mail button if (get_option(WPS_OPTIONS_PREFIX.'_show_dir_buttons') && $member->uid != $current_user->ID) { if ($is_friend) { // A friend $html .= "<div class='mail_icon' style='display:none;float:right; margin-right:5px;'>"; $html .= '<img style="cursor:pointer" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/orange-tick.gif" onclick="document.location = \''.$mailpage.$q.'view=compose&to='.$member->uid.'\';">'; $html .= "</div>"; } } } $html .= __wps__profile_link($member->uid); if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { $html .= ', '; } else { $html .= '<br />'; } $html .= __('last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($member->last_activity).". "; if ($last_active_minutes >= $offline) { //$html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/loggedout.gif">'; } else { if ($last_active_minutes >= $inactive) { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/inactive.gif">'; } else { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/online.gif">'; } } // Distance if (function_exists('__wps__profile_plus') && is_user_logged_in() && $member->distance < 99999 && $member->uid != $current_user->ID) { // if privacy settings permit if ( (strtolower($share) == 'everyone') || (strtolower($share) == 'public') || (strtolower($share) == 'friends only' && __wps__friend_of($member->uid, $current_user->ID)) ) { if ($measure != 'on') { $distance = intval(($member->distance/5)*8); $miles = __('km', WPS_TEXT_DOMAIN); } else { $distance = $member->distance; $miles = __('miles', WPS_TEXT_DOMAIN); } $html .= '<br />'.__('Distance', WPS_TEXT_DOMAIN).': '.$distance.' '.$miles; if ($show_alt == 'on') { if ($measure != 'on') { $html .= ' ('.intval(($distance/8)*5).' '.__('miles', WPS_TEXT_DOMAIN).')'; } else { $html .= ' ('.intval(($distance/5)*8).' '.__('km', WPS_TEXT_DOMAIN).')'; } } } } if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { // Show label if entered if ($label = __wps__get_meta($member->uid, 'profile_label')) $html .= '<div class="__wps__members_info_label">'.$label.'</div>'; // if privacy settings permit if ( (strtolower($wall_share) == 'everyone') || (strtolower($wall_share) == 'public') || (strtolower($wall_share) == 'friends only' && __wps__friend_of($member->uid, $current_user->ID)) ) { // Show comment $sql = "SELECT cid, comment, type FROM ".$wpdb->base_prefix."symposium_comments WHERE author_uid = %d AND comment_parent = 0 AND type = 'post' ORDER BY cid DESC LIMIT 0,1"; $comment = $wpdb->get_row($wpdb->prepare($sql, $member->uid)); if ($comment) { $html .= '<div style="max-height:250px">'.__wps__buffer(__wps__make_url(stripslashes($comment->comment))).'</div>'; } // Show latest non-status activity if applicable if (function_exists('__wps__forum')) { $sql = "SELECT cid, comment FROM ".$wpdb->base_prefix."symposium_comments WHERE author_uid = %d AND comment_parent = 0 AND type = 'forum' ORDER BY cid DESC LIMIT 0,1"; $forum = $wpdb->get_row($wpdb->prepare($sql, $member->uid)); if ($forum && (!$comment || $forum->cid != $comment->cid)) { $html .= '<div>'.__wps__buffer(__wps__make_url(stripslashes($forum->comment))).'</div>'; } } } } // Show add as a friend if (is_user_logged_in() && get_option(WPS_OPTIONS_PREFIX.'_show_dir_buttons') && $member->uid != $current_user->ID) { if (__wps__pending_friendship($member->uid)) { // Pending $html .= sprintf(__('%s request sent.', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')); } else { if (!$is_friend) { // Not a friend $html .= '<div id="addasfriend_done1_'.$member->uid.'">'; $html .= '<input class="add_as_friend_message addfriend_text" title="'.$member->uid.'" id="addtext_'.$member->uid.'" type="text" onclick="this.value=\'\'" value="'.sprintf(__('Add as a %s...', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')).'">'; $html .= '<input type="submit" title="'.$member->uid.'" class="addasfriend __wps__button" value="'.__('Add', WPS_TEXT_DOMAIN).'" /> '; $html .= '</div>'; $html .= '<div id="addasfriend_done2_'.$member->uid.'" class="hidden">'.sprintf(__('%s Request Sent', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')).'</div>'; } } } // Filter for individual member reults $html = apply_filters ( '__wps__directory_member_filter', $html, $member->uid); $html .= "</div>"; $html .= "</div>"; // members_info $html .= "</div>"; // members_row } // if ($include) } // foreach ($members as $member) $html .= "<div id='showmore_directory_div' style='text-align:center; width:100%'><a href='javascript:void(0)' id='showmore_directory'>".__("more...", WPS_TEXT_DOMAIN)."</a></div>"; } else { $html .= '<br />'.__('No members found', WPS_TEXT_DOMAIN)."...."; } // if ($members) } $html .= '</div>'; // __wps__members $html .= '</div>'; // __wps__wrapper // Filter for header $html = apply_filters ( 'symposium_member_header_filter', $html ); // Send HTML return $html; }
if ($mail) { foreach ($mail as $item) { $mail_cnt++; if ($item->mail_read != "on") { $row_array['mail_read'] = "mail_item_unread"; } else { $row_array['mail_read'] = "mail_item_read"; } $row_array['mail_mid'] = $item->mail_mid; $row_array['mail_sent'] = __wps__time_ago($item->mail_sent); if ($tray == "in") { $row_array['mail_from'] = stripslashes(__wps__profile_link($item->mail_from)); } else { $row_array['mail_from'] = stripslashes(__wps__profile_link($item->mail_to)); } if ($item->mail_read != 'on') { $row_array['mail_from'] = '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/new.gif" /> '.$row_array['mail_from']; } $row_array['mail_subject'] = __wps__bbcode_remove(stripslashes($item->mail_subject)); @$row_array['mail_subject'] = preg_replace( "/(>|^)([^<]+)(?=<|$)/iesx", "'\\1' . str_replace('" . $term . "', '<span class=\"__wps__search_highlight\">" . $term . "</span>', '\\2')", $row_array['mail_subject'] ); $row_array['mail_subject'] = stripslashes($row_array['mail_subject']); $message = strip_tags(stripslashes($item->mail_message)); if ( strlen($message) > 75 ) { $message = substr($message, 0, 75)."..."; } @$message = preg_replace(
function symposium_forum_latestposts_showThreadChildren($count, $cat_id, $parent, $level, $use_answers) { global $wpdb, $current_user; $thispage = __wps__get_url('forum'); if ($thispage[strlen($thispage)-1] != '/') { $thispage .= '/'; } $q = __wps__string_query($thispage); $symposium_last_login = __wps__get_meta($current_user->ID, 'symposium_last_login'); $html = ""; $preview = 30; if ($count != '') { $postcount = $count; } else { $postcount = get_option(WPS_OPTIONS_PREFIX.'_symposium_forumlatestposts_count'); } if ($level == 0) { $avatar_size = 30; $margin_top = 10; $desc = "DESC"; } else { $avatar_size = 20; $margin_top = 6; $desc = "DESC"; } // All topics started $cat_sql = ($cat_id) ? " AND t.topic_category = ".$cat_id : ''; $posts = $wpdb->get_results(" SELECT t.tid, t.topic_subject, t.stub, p.stub as parent_stub, t.topic_owner, t.topic_post, t.topic_category, t.topic_started, u.display_name, t.topic_parent, t.topic_answer, t.topic_date, t.topic_approved FROM ".$wpdb->prefix.'symposium_topics'." t INNER JOIN ".$wpdb->base_prefix.'users'." u ON t.topic_owner = u.ID LEFT JOIN ".$wpdb->prefix.'symposium_topics'." p ON t.topic_parent = p.tid WHERE t.topic_parent = ".$parent." AND t.topic_group = 0".$cat_sql." ORDER BY t.tid ".$desc." LIMIT 0,".$postcount); if ($posts) { foreach ($posts as $post) { if ( ($post->topic_approved == 'on') || ($post->topic_approved != 'on' && ($post->topic_owner == $current_user->ID || current_user_can('level_10'))) ) { $padding_left = ($level == 0) ? 40 : 30; $html .= "<div class='__wps__latest_forum_row' style='padding-left: ".$padding_left."px; margin-left: ".($level*40)."px; margin-top:".$margin_top."px;'>"; $html .= "<div class='__wps__latest_forum_row_avatar'>"; $html .= get_avatar($post->topic_owner, $avatar_size); $html .= "</div>"; $html .= "<div style='float:left'>"; if ($post->topic_parent > 0) { $text = strip_tags(stripslashes($post->topic_post)); if ( strlen($text) > $preview ) { $text = substr($text, 0, $preview)."..."; } $reply_text = $level == 1 ? 'replied' : 'commented'; $html .= __wps__profile_link($post->topic_owner)." ".__($reply_text, WPS_TEXT_DOMAIN)." "; if (get_option(WPS_OPTIONS_PREFIX.'_permalink_structure')) { $perma_cat = __wps__get_forum_category_part_url($post->topic_category); $html .= "<a title='".$text."' href='".$thispage.$perma_cat.$post->parent_stub."'>"; } else { $html .= "<a title='".$text."' href='".$thispage.$q."cid=".$post->topic_category."&show=".$post->topic_parent."'>"; } $html .= $text."</a> ".__wps__time_ago($post->topic_started); if ($use_answers == 'on' && $post->topic_answer == 'on') { $html .= ' <img style="width:12px;height:12px" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/tick.png" alt="'.__('Answer Accepted', WPS_TEXT_DOMAIN).'" />'; } $html .= "<br>"; } else { $text = stripslashes($post->topic_subject); if ( strlen($text) > $preview ) { $text = substr($text, 0, $preview)."..."; } $html .= __wps__profile_link($post->topic_owner)." ".__('started', WPS_TEXT_DOMAIN); if (get_option(WPS_OPTIONS_PREFIX.'_permalink_structure')) { $perma_cat = __wps__get_forum_category_part_url($post->topic_category); $html .= " <a title='".$text."' href='".$thispage.$perma_cat.$post->stub."'>".$text."</a> "; } else { $html .= " <a title='".$text."' href='".$thispage.$q."cid=".$post->topic_category."&show=".$post->tid."'>".$text."</a> "; } $html .= __wps__time_ago($post->topic_started).".<br>"; } $html .= "</div>"; if ($post->topic_date > $symposium_last_login && $post->topic_owner != $current_user->ID) { $html .= "<div style='float:left;'>"; $html .= " <img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/new.gif' alt='New!' />"; $html .= "</div>"; } if ($post->topic_approved != 'on') { $html .= " <em>[".__("pending approval", WPS_TEXT_DOMAIN)."]</em>"; } $html .= "</div>"; } $html .= symposium_forum_latestposts_showThreadChildren($count, $cat_id, $post->tid, $level+1, $use_answers); } } return $html; }
function get_profile_url($just_url=false) { return __wps__profile_link($this->id, $just_url); }
foreach ($albums AS $album) { $total_count++; // check for privacy if ( ($album->owner == $current_user->ID) || (strtolower($album->sharing) == 'public') || (is_user_logged_in() && strtolower($album->sharing) == 'everyone') || (strtolower($album->sharing) == 'public') || (strtolower($album->sharing) == 'friends only' && __wps__friend_of($album->owner, $current_user->ID)) || __wps__get_current_userlevel() == 5) { $sql = "SELECT COUNT(iid) FROM ".$wpdb->base_prefix."symposium_gallery_items WHERE gid = %d"; $photo_count = $wpdb->get_var($wpdb->prepare($sql, $album->gid)); if ($photo_count > 0) { $html .= "<div id='__wps__album_content' style='margin-bottom:30px'>"; $html .= "<div id='wps_gallery_album_name_".$album->gid."' class='topic-post-header'>".stripslashes($album->name)."</div>"; $html .= "<p>".__wps__profile_link($album->owner)."</p>"; $sql = "SELECT * FROM ".$wpdb->base_prefix."symposium_gallery_items WHERE gid = %d ORDER BY photo_order"; $photos = $wpdb->get_results($wpdb->prepare($sql, $album->gid)); if ($photos) { global $blog_id; $blog_path = ($blog_id > 1) ? '/'.$blog_id : ''; $album_count++; $cnt = 0; $thumbnail_size = (get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") != '') ? get_option(WPS_OPTIONS_PREFIX."_gallery_thumbnail_size") : 75; $html .= '<div id="wps_comment_plus" style="width:98%;height:'.($thumbnail_size+10).'px;overflow:hidden; ">';
function __wps__profile_friends($uid, $limit_from) { global $wpdb, $current_user; wp_get_current_user(); $limit_count = 10; $privacy = __wps__get_meta($uid, 'share'); $is_friend = __wps__friend_of($uid, $current_user->ID); $html = ""; if ( ($uid == $current_user->ID) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) { $mailpage = __wps__get_url('mail'); if ($mailpage[strlen($mailpage)-1] != '/') { $mailpage .= '/'; } $q = __wps__string_query($mailpage); // Friend Requests if ($uid == $current_user->ID) { $sql = "SELECT u1.display_name, u1.ID, f.friend_timestamp, f.friend_message, f.friend_from FROM ".$wpdb->base_prefix."symposium_friends f LEFT JOIN ".$wpdb->base_prefix."users u1 ON f.friend_from = u1.ID WHERE f.friend_to = %d AND f.friend_accepted != 'on' ORDER BY f.friend_timestamp DESC"; $requests = $wpdb->get_results($wpdb->prepare($sql, $current_user->ID)); if ($requests) { $html .= '<h2>'.sprintf(__('%s Requests', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')).'...</h2>'; foreach ($requests as $request) { $html .= "<div id='request_".$request->friend_from."' style='clear:right; margin-top:8px; overflow: auto; margin-bottom: 15px; width:95%;'>"; $html .= "<div style='float: left; width:64px; margin-right: 15px'>"; $html .= get_avatar($request->ID, 64); $html .= "</div>"; $html .= "<div class='__wps__friend_request_info'>"; $html .= __wps__profile_link($request->ID)."<br />"; $html .= __wps__time_ago($request->friend_timestamp)."<br />"; $html .= "<em>".stripslashes($request->friend_message)."</em>"; $html .= "</div>"; $html .= "<div style='clear: both; float:right;'>"; $html .= '<input type="submit" title="'.$request->friend_from.'" id="rejectfriendrequest" class="__wps__button" style="'.__wps__get_extension_button_style().'" value="'.__('Reject', WPS_TEXT_DOMAIN).'" /> '; $html .= "</div>"; $html .= "<div style='float:right;'>"; $html .= '<input type="submit" title="'.$request->friend_from.'" id="acceptfriendrequest" class="__wps__button" style="'.__wps__get_extension_button_style().'" value="'.__('Accept', WPS_TEXT_DOMAIN).'" /> '; $html .= "</div>"; $html .= "</div>"; } $html .= '<hr />'; } } // Friends $sql = "SELECT f.*, cast(m.meta_value as datetime) as last_activity FROM ".$wpdb->base_prefix."symposium_friends f LEFT JOIN ".$wpdb->base_prefix."usermeta m ON m.user_id = f.friend_to WHERE f.friend_to > 0 AND f.friend_from = %d AND m.meta_key = 'symposium_last_activity' AND f.friend_accepted = 'on' ORDER BY cast(m.meta_value as datetime) DESC LIMIT %d, %d"; $friends = $wpdb->get_results($wpdb->prepare($sql, $uid, $limit_from, $limit_count)); if ($friends) { if ($current_user->ID == $uid || __wps__get_current_userlevel() == 5) { $html .= '<input type="submit" id="removeAllFriends" name="Submit" class="__wps__button" style="'.__wps__get_extension_button_style().'; width:200px;" value="'.__('Remove all friends', WPS_TEXT_DOMAIN).'" />'; } $count = 0; $inactive = get_option(WPS_OPTIONS_PREFIX.'_online'); $offline = get_option(WPS_OPTIONS_PREFIX.'_offline'); foreach ($friends as $friend) { $count++; $time_now = time(); $last_active_minutes = strtotime($friend->last_activity); $last_active_minutes = floor(($time_now-$last_active_minutes)/60); $html .= "<div id='friend_".$friend->friend_to."' class='friend_div row_odd corners' style='clear:right; margin-top:8px; overflow: auto; margin-bottom: 15px; padding:6px; width:95%;'>"; $html .= "<div style='width:64px; margin-right: 15px'>"; $html .= get_avatar($friend->friend_to, 64); $html .= "</div>"; // Send Mail and remove as friend $html .= "<div style='width:50px; height: 16px; float:right;'>"; if ($friend->friend_accepted == 'on') { if ($uid == $current_user->ID) { $html .= "<div style='display:none;' class='friend_icons'>"; $html .= "<div style='float:right;margin-left:5px;margin-right:5px;'>"; $html .= '<img style="cursor:pointer" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/delete.png" title="'.$friend->friend_to.'" class="frienddelete">'; $html .= '</form>'; $html .= "</div>"; if (function_exists('__wps__mail')) { $html .= "<div style='float:right;'>"; $html .= '<img style="cursor:pointer" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/orange-tick.gif" onclick="document.location = \''.$mailpage.$q.'view=compose&to='.$friend->friend_to.'\';">'; $html .= "</div>"; } $html .= "</div>"; } } $html .= '</div>'; $html .= "<div style='padding-left:74px;'>"; $html .= __wps__profile_link($friend->friend_to); $html .= "<br />"; if ($last_active_minutes >= $offline) { $html .= __('Logged out', WPS_TEXT_DOMAIN).'. '.__('Last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($friend->last_activity)."."; } else { if ($last_active_minutes >= $inactive) { $html .= __('Offline', WPS_TEXT_DOMAIN).'. '.__('Last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($friend->last_activity)."."; } else { $html .= __('Last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($friend->last_activity)."."; } } if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { $html .= '<br />'; // Show comment $sql = "SELECT cid, comment FROM ".$wpdb->base_prefix."symposium_comments WHERE author_uid = %d AND subject_uid = %d AND comment_parent = 0 AND type = 'post' ORDER BY cid DESC LIMIT 0,1"; $comment = $wpdb->get_row($wpdb->prepare($sql, $friend->friend_to, $friend->friend_to)); if ($comment) { $html .= '<div>'.__wps__buffer(__wps__make_url(stripslashes($comment->comment))).'</div>'; } // Show latest non-status activity if applicable if (function_exists('__wps__forum')) { $sql = "SELECT cid, comment FROM ".$wpdb->base_prefix."symposium_comments WHERE author_uid = %d AND subject_uid = %d AND comment_parent = 0 AND type = 'forum' ORDER BY cid DESC LIMIT 0,1"; $forum = $wpdb->get_row($wpdb->prepare($sql, $friend->friend_to, $friend->friend_to)); if ($comment && $forum && $forum->cid != $comment->cid) { $html .= '<div>'.__wps__buffer(__wps__make_url(stripslashes($forum->comment))).'</div>'; } } } $html .= "</div>"; if ($friend->friend_accepted != 'on') { $html .= "<div style='float:left;'>"; $html .= "<strong>".sprintf(__("%s request sent.", WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend'))."</strong>"; $html .= "</div>"; } $html .= "</div>"; } if ($count == $limit_count) { $html .= "<a href='javascript:void(0)' id='friends' class='showmore_wall' title='".($limit_from+$limit_count)."'>".__("more...", WPS_TEXT_DOMAIN)."</a>"; } } else { $html .= __("Nothing to show, sorry.", WPS_TEXT_DOMAIN); } } else { if (strtolower($privacy) == 'friends only') { $html .= sprintf(__("Personal information only for %s.", WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friends')); } if (strtolower($privacy) == 'nobody') { $html .= __("Personal information is private.", WPS_TEXT_DOMAIN); } } return $html; }
function get_inbox($count=10, $start=0, $avatar_size=40, $term="", $order=true, $message_len=75, $unread_only=false, $sent_items=false) { global $wpdb; $mail_count = 1; $return_arr = array(); $results_order = $order ? "DESC" : ""; $unread = $unread_only ? " AND m.mail_read = ''" : ""; if (!$sent_items) { $sql = "SELECT m.mail_mid, m.mail_from, m.mail_to, m.mail_read, m.mail_sent, m.mail_subject, m.mail_message, u.display_name FROM ".$wpdb->base_prefix."symposium_mail m INNER JOIN ".$wpdb->base_prefix."users u ON m.mail_from = u.ID WHERE m.mail_in_deleted != 'on' AND m.mail_to = %d ORDER BY m.mail_mid ".$results_order." LIMIT ".$start.",1000"; // Maximum 1,000 to reduce load on database } else { $sql = "SELECT m.mail_mid, m.mail_from, m.mail_to, m.mail_read, m.mail_sent, m.mail_subject, m.mail_message, u.display_name FROM ".$wpdb->base_prefix."symposium_mail m INNER JOIN ".$wpdb->base_prefix."users u ON m.mail_to = u.ID WHERE m.mail_sent_deleted != 'on' AND m.mail_from = %d ORDER BY m.mail_mid ".$results_order." LIMIT ".$start.",1000"; // Maximum 1,000 to reduce load on database } $messages = $wpdb->get_results($wpdb->prepare($sql, $this->id)); foreach ($messages AS $item) { $continue = false; if ($term != '') { if (strpos(strtolower($item->mail_subject), strtolower($term)) !== FALSE) $continue = true; if (strpos(strtolower($item->mail_message), strtolower($term)) !== FALSE) $continue = true; if (strpos(strtolower($item->display_name), strtolower($term)) !== FALSE) $continue = true; } else { $continue = true; } if ($continue) { $row_array['mail_id'] = $item->mail_mid; $row_array['mail_from'] = $item->mail_from; $row_array['mail_to'] = $item->mail_to; $row_array['mail_read'] = $item->mail_read; $row_array['mail_sent'] = $item->mail_sent; $row_array['mail_subject'] = __wps__bbcode_remove(stripslashes($item->mail_subject)); $row_array['mail_subject'] = preg_replace( "/(>|^)([^<]+)(?=<|$)/iesx", "'\\1' . str_replace('" . $term . "', '<span class=\"__wps__search_highlight\">" . $term . "</span>', '\\2')", $row_array['mail_subject'] ); $row_array['mail_subject'] = stripslashes($row_array['mail_subject']); $message = strip_tags(stripslashes($item->mail_message)); if ( strlen($message) > $message_len ) { $message = substr($message, 0, $message_len)."..."; } $message = preg_replace( "/(>|^)([^<]+)(?=<|$)/iesx", "'\\1' . str_replace('" . $term . "', '<span class=\"__wps__search_highlight\">" . $term . "</span>', '\\2')", $message ); $row_array['mail_message'] = $message; $row_array['display_name'] = $item->display_name; if (!$sent_items) { $row_array['display_name_link'] = stripslashes(__wps__profile_link($item->mail_from)); $row_array['avatar'] = get_avatar($item->mail_from, $avatar_size); } else { $row_array['display_name_link'] = stripslashes(__wps__profile_link($item->mail_to)); $row_array['avatar'] = get_avatar($item->mail_to, $avatar_size); } array_push($return_arr,$row_array); if ($mail_count++ == $count) break; } } return $return_arr; }
function __wps__mail_messages_menu() { global $wpdb; if (isset($_GET['mail_mid_del'])) { if (__wps__safe_param($_GET['mail_mid_del'])) { // Update $wpdb->query( $wpdb->prepare( "DELETE FROM ".$wpdb->base_prefix."symposium_mail WHERE mail_mid = %d", $_GET['mail_mid_del'] ) ); } else { echo "BAD PARAMETER PASSED: ".$_GET['mail_mid_del']; } } echo '<div class="wrap">'; echo '<div id="icon-themes" class="icon32"><br /></div>'; echo '<h2>'.sprintf(__('%s Management', WPS_TEXT_DOMAIN), WPS_WL).'</h2><br />'; __wps__show_manage_tabs_header('messages'); $all = $wpdb->get_var("SELECT count(*) FROM ".$wpdb->base_prefix."symposium_mail"); // Paging info $showpage = 0; $pagesize = 20; $numpages = floor($all / $pagesize); if ($all % $pagesize > 0) { $numpages++; } if (isset($_GET['showpage']) && $_GET['showpage']) { $showpage = $_GET['showpage']-1; } else { $showpage = 0; } if ($showpage >= $numpages) { $showpage = $numpages-1; } $start = ($showpage * $pagesize); if ($start < 0) { $start = 0; } // Query $sql = "SELECT m.* FROM ".$wpdb->base_prefix."symposium_mail m "; $sql .= "ORDER BY m.mail_mid DESC "; $sql .= "LIMIT ".$start.", ".$pagesize; $messages = $wpdb->get_results($sql); // Pagination (top) echo __wps__pagination($numpages, $showpage, "admin.php?page=__wps__mail_messages_menu&showpage="); echo '<br /><table class="widefat">'; echo '<thead>'; echo '<tr>'; echo '<th>ID</td>'; echo '<th>'.__('From', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('To', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Subject', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Sent', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Action', WPS_TEXT_DOMAIN).'</th>'; echo '</tr>'; echo '</thead>'; echo '<tfoot>'; echo '<tr>'; echo '<th>ID</th>'; echo '<th>'.__('From', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('To', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Subject', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Sent', WPS_TEXT_DOMAIN).'</th>'; echo '<th>'.__('Action', WPS_TEXT_DOMAIN).'</th>'; echo '</tr>'; echo '</tfoot>'; echo '<tbody>'; echo '<style>.mail_rollover:hover { background-color: #ccc; } </style>'; if ($messages) { foreach ($messages as $message) { echo '<tr class="mail_rollover">'; echo '<td valign="top" style="width: 30px">'.$message->mail_mid.'</td>'; echo '<td valign="top" style="width: 100px">'.__wps__profile_link($message->mail_from).'</td>'; echo '<td valign="top" style="width: 100px">'.__wps__profile_link($message->mail_to).'</td>'; echo '<td valign="top" style="width: 200px; text-align:center;">'; $preview = stripslashes($message->mail_subject); $preview_length = 150; if ( strlen($preview) > $preview_length ) { $preview = substr($preview, 0, $preview_length)."..."; } echo '<div style="float: left;">'; echo '<a class="show_full_message" id="'.$message->mail_mid.'" style="cursor:pointer;margin-left:6px;">'; echo $preview; echo '</a></div>'; echo '</td>'; echo '<td valign="top" style="width: 150px">'.$message->mail_sent.'</td>'; echo '<td valign="top" style="width: 50px">'; $showpage = (isset($_GET['showpage'])) ? $_GET['showpage'] : 0; echo "<span class='trash delete'><a href='admin.php?page=__wps__mail_messages_menu&action=message_del&showpage=".$showpage."&mail_mid_del=".$message->mail_mid."'>".__('Trash', WPS_TEXT_DOMAIN)."</a></span>"; echo '</td>'; echo '</tr>'; } } else { echo '<tr><td colspan="6"> </td></tr>'; } echo '</tbody>'; echo '</table>'; // Pagination (bottom) echo __wps__pagination($numpages, $showpage, "admin.php?page=__wps__mail_messages_menu&showpage="); __wps__show_manage_tabs_header_end(); echo '</div>'; // End of wrap div }
function showThreadChildren($parent, $level, $gid, $symposium_last_login) { global $wpdb, $current_user; // Work out link to this page, dealing with permalinks or not if ($gid == 0) { $thispage = __wps__get_url('forum'); if ($thispage[strlen($thispage)-1] != '/') { $thispage .= '/'; } if (strpos($thispage, "?") === FALSE) { $q = "?"; } else { // No Permalink $q = "&"; } } else { $thispage = __wps__get_url('group'); if ($thispage[strlen($thispage)-1] != '/') { $thispage .= '/'; } if (strpos($thispage, "?") === FALSE) { $q = "?"; } else { // No Permalink $q = "&"; } $q .= "gid=".$gid."&"; } $html = ""; $preview = 50 - (10*$level); if ($preview < 10) { $preview = 10; } $postcount = 20; // Tries to retrieve last 7 days, but this will be a maximum number of posts or replies if ($level == 0) { $avatar_size = 30; $margin_top = 10; $desc = "DESC"; } else { $avatar_size = 20; $margin_top = 3; $desc = "DESC"; } $include = strtotime("now") - (86400 * 280); // 4 weeks $include = date("Y-m-d H:i:s", $include); // All topics started $sql = " SELECT t.tid, t.topic_subject, t.topic_owner, t.topic_post, t.topic_category, t.topic_date, u.display_name, t.topic_parent, t.topic_answer, t.topic_started, p.topic_category as parent_category FROM ".$wpdb->prefix.'symposium_topics'." t INNER JOIN ".$wpdb->base_prefix.'users'." u ON t.topic_owner = u.ID LEFT JOIN ".$wpdb->prefix."symposium_topics p ON t.topic_parent = p.tid WHERE t.topic_approved = 'on' AND t.topic_parent = %d AND t.topic_group = %d AND t.topic_date > %s AND (t.topic_parent = 0 || p.topic_parent = 0) ORDER BY t.tid ".$desc." LIMIT 0,%d"; $posts = $wpdb->get_results($wpdb->prepare($sql, $parent, $gid, $include, $postcount)); // Get list of roles for this user global $current_user; $user_roles = $current_user->roles; $user_role = strtolower(array_shift($user_roles)); if ($user_role == '') $user_role = 'NONE'; if ($posts) { foreach ($posts as $post) { $sql = "SELECT level FROM ".$wpdb->prefix."symposium_cats WHERE cid = %d"; $cat_level = $wpdb->get_var($wpdb->prepare($sql, $post->topic_category)); $cat_roles = unserialize($cat_level); if ($gid > 0 || strpos(strtolower($cat_roles), 'everyone,') !== FALSE || strpos(strtolower($cat_roles), $user_role.',') !== FALSE) { $html .= "<div class='__wps__forum_activity_row' style='padding-left: ".($level*40)."px; margin-top:".$margin_top."px;min-height:".$avatar_size."px;'>"; $html .= "<div class='__wps__forum_activity_row_avatar' style='padding-left: ".($level*40)."px;'>"; $html .= get_avatar($post->topic_owner, $avatar_size); $html .= "</div>"; $move_over = ($level == 0) ? 40 : 30; $html .= "<div class='__wps__forum_activity_row_text' style='margin-left: ".$move_over."px;'>"; if ($post->topic_parent > 0) { $text = strip_tags(stripslashes($post->topic_post)); if ( strlen($text) > $preview ) { $text = substr($text, 0, $preview)."..."; } $html .= __wps__profile_link($post->topic_owner)." ".__('replied', WPS_TEXT_DOMAIN)." "; if (get_option(WPS_OPTIONS_PREFIX.'_permalink_structure') && $group_id == 0) { $stub = $wpdb->get_var($wpdb->prepare("SELECT stub FROM ".$wpdb->prefix."symposium_topics WHERE tid = %d", $post->topic_parent)); $perma_cat = __wps__get_forum_category_part_url($post->parent_category); $url = $thispage.$perma_cat.$stub; $html .= "<a href='".$url."'>".$text."</a> "; } else { $html .= "<a href='".$thispage.$q."cid=".$post->topic_category."&show=".$post->topic_parent."'>".$text."</a> "; } $html .= __wps__time_ago($post->topic_date); if (get_option(WPS_OPTIONS_PREFIX.'_use_answers') == 'on' && $post->topic_answer == 'on') { $html .= ' <img style="width:12px; height:12px" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/tick.png" alt="'.__('Answer Accepted', WPS_TEXT_DOMAIN).'" />'; } $html .= "<br>"; } else { $text = stripslashes($post->topic_subject); if ( strlen($text) > $preview ) { $text = substr($text, 0, $preview)."..."; } $html .= __wps__profile_link($post->topic_owner)." ".__('started', WPS_TEXT_DOMAIN)." "; if (get_option(WPS_OPTIONS_PREFIX.'_permalink_structure') && $group_id == 0) { $stub = $wpdb->get_var($wpdb->prepare("SELECT stub FROM ".$wpdb->prefix."symposium_topics WHERE tid = %d", $post->tid)); $perma_cat = __wps__get_forum_category_part_url($post->topic_category); $url = $thispage.$perma_cat.$stub; $html .= "<a href='".$url."'>".$text."</a> "; } else { $html .= "<a href='".$thispage.$q."cid=".$post->topic_category."&show=".$post->tid."'>".$text."</a> "; } $html .= __wps__time_ago($post->topic_started).".<br>"; } $html .= "</div>"; if ($post->topic_date > $symposium_last_login && $post->topic_owner != $current_user->ID && is_user_logged_in() && get_option(WPS_OPTIONS_PREFIX.'_forum_stars')) { $html .= "<img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/new.gif' alt='New!' /> "; } $html .= "</div>"; $html .= showThreadChildren($post->tid, $level+1, $gid, $symposium_last_login); } } } return $html; }
$html .= "</div>"; } if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { // Show Send Mail button if (function_exists('__wps__mail') && get_option(WPS_OPTIONS_PREFIX.'_show_dir_buttons') && $member->uid != $current_user->ID) { if ($is_friend) { // A friend $html .= "<div class='mail_icon' style='display:none;float:right; margin-right:5px;'>"; $html .= '<img style="cursor:pointer" src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/orange-tick.gif" onclick="document.location = \''.$mailpage.$q.'view=compose&to='.$member->uid.'\';">'; $html .= "</div>"; } } } $html .= __wps__profile_link($member->uid); if ($member->last_activity != '') { if (!get_option(WPS_OPTIONS_PREFIX.'_wps_lite')) { $html .= ', '; } else { $html .= '<br />'; } $html .= __('last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($member->last_activity).". "; if ($last_active_minutes >= $offline) { //$html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/loggedout.gif">'; } else { if ($last_active_minutes >= $inactive) { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/inactive.gif">'; } else { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/online.gif">';
$html .= $member['city']; } if (isset($country) && $country != '') { if ($city != '') { $html .= ', '.$member['country']; } else { $html .= $member['country']; } } $html .= "</div>"; } $html .= "<div class='members_avatar'>"; $html .= get_avatar($member['ID'], 64); $html .= "</div>"; $html .= __wps__profile_link($member['ID']).', '.__('last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($member['last_activity']).". "; if ($last_active_minutes >= $offline) { //$html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/loggedout.gif">'; } else { if ($last_active_minutes >= $inactive) { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/inactive.gif">'; } else { $html .= '<img src="'.get_option(WPS_OPTIONS_PREFIX.'_images').'/online.gif">'; } } if ($member['admin'] == "on") { $html .= "<br />[".__("group admin", WPS_TEXT_DOMAIN)."]"; } // Requesting group membership... if ($member['valid'] != "on") {
function __wps__events_main() { global $wpdb, $current_user; $html = '<div class="__wps__wrapper">'; // Content $include = get_option(WPS_OPTIONS_PREFIX."_events_global_list"); // get events $html .= '<div id="__wps__events_list" style="width:95%">'; if (get_option(WPS_OPTIONS_PREFIX."_events_hide_expired")) { $hide = "(event_start >= now() OR event_start = '0000-00-00 00:00:00') AND"; } else { $hide = ''; } if ($include) { $sql = "SELECT e.*, u.ID, u.display_name FROM ".$wpdb->base_prefix."symposium_events e LEFT JOIN ".$wpdb->base_prefix."users u ON event_owner = ID WHERE ".$hide." event_owner IN (".$include.") AND event_live = %s ORDER BY event_start"; } else { $sql = "SELECT e.*, u.ID, u.display_name FROM ".$wpdb->base_prefix."symposium_events e LEFT JOIN ".$wpdb->base_prefix."users u ON event_owner = ID WHERE ".$hide." event_live = %s ORDER BY event_start"; } if (get_option(WPS_OPTIONS_PREFIX."_events_sort_order")) $sql .= " DESC"; $events = $wpdb->get_results($wpdb->prepare($sql, 'on')); if (WPS_DEBUG) $html .= $wpdb->last_query; if ($events) { if (get_option(WPS_OPTIONS_PREFIX.'_events_calendar') == "calendar") { // Calendar view $html .= '<div id="__wps__events_calendar"></div>'; } else { // List view foreach ($events as $event) { $html .= '<div class="__wps__event_list_item row">'; if ($event->event_google_map == 'on') { $html .= "<div id='event_google_profile_map' style='float:right; margin-left:5px; width:128px; height:128px'>"; $html .= '<a target="_blank" href="http://maps.google.co.uk/maps?f=q&source=embed&hl=en&geocode=&q='.$event->event_location.'&ie=UTF8&hq=&hnear='.$event->event_location.'&output=embed&z=5" alt="Click on map to enlarge" title="Click on map to enlarge">'; $html .= '<img src="http://maps.google.com/maps/api/staticmap?center='.$event->event_location.'&zoom=5&size=128x128&maptype=roadmap&markers=color:blue|label: |'.$event->event_location.'&sensor=false" />'; $html .= "</a></div>"; } if ( ($event->event_owner == $current_user->ID) || (__wps__get_current_userlevel() == 5) ) { $html .= "<div class='__wps__event_list_item_icons'>"; if ($event->event_live != 'on') { $html .= '<div style="font-style:italic;float:right;">'.__('Edit to publish', WPS_TEXT_DOMAIN).'</div>'; } $html .= "<a href='javascript:void(0)' class='symposium_delete_event floatright link_cursor' style='display:none;margin-right: 5px' id='".$event->eid."'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/delete.png' /></a>"; $html .= "<a href='javascript:void(0)' class='__wps__edit_event floatright link_cursor' style='display:none;margin-right: 5px' id='".$event->eid."'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/edit.png' /></a>"; $html .= "</div>"; } $html .= '<div class="__wps__event_list_owner">'.__("Added by", WPS_TEXT_DOMAIN)." ".__wps__profile_link($event->ID).'</div>'; $html .= '<div class="__wps__event_list_name">'.stripslashes($event->event_name).'</div>'; $html .= '<div class="__wps__event_list_location">'.stripslashes($event->event_location).'</div>'; if ($event->event_enable_places && $event->event_show_max) { $sql = "SELECT SUM(tickets) FROM ".$wpdb->base_prefix."symposium_events_bookings WHERE event_id = %d"; $taken = $wpdb->get_var($wpdb->prepare($sql, $event->eid)); $html .= '<div class="__wps__event_list_places">'; if ($event->event_max_places-$taken > 0) { $html .= __('Tickets left:', WPS_TEXT_DOMAIN).' '.($event->event_max_places-$taken); } else { $html .= __('Event full', WPS_TEXT_DOMAIN); } $html .= '</div>'; } if (isset($event->event_cost) && $event->event_cost !== null) { $html .= '<div class="symposium_event_cost">'.__('Cost per ticket:', WPS_TEXT_DOMAIN).' '.$event->event_cost.'</div>'; } $html .= '<div class="__wps__event_list_description">'; $html .= stripslashes($event->event_description); $html .= '</div>'; $html .= '<div class="__wps__event_list_dates">'; if ($event->event_start != '0000-00-00 00:00:00') { $html .= date_i18n("D, d M Y", __wps__convert_datetime($event->event_start)); } if ($event->event_start != $event->event_end) { if ($event->event_end != '0000-00-00 00:00:00') { $html .= ' → '; $html .= date_i18n("D, d M Y", __wps__convert_datetime($event->event_end)); } } $html .= '</div>'; $html .= '<div class="__wps__event_list_times">'; if ($event->event_start_hours != 99) { $html .= __('Start: ', WPS_TEXT_DOMAIN).$event->event_start_hours.":".sprintf('%1$02d', $event->event_start_minutes); } if ($event->event_end_hours != 99) { $html .= ' '.__('End: ', WPS_TEXT_DOMAIN).$event->event_end_hours.":".sprintf('%1$02d', $event->event_end_minutes); } $html .= '</div>'; $html .= '<div>'; if ($event->event_more) { $more = str_replace(chr(10), '<br />', stripslashes($event->event_more)); $html .= '<div id="symposium_more_'.$event->eid.'" title="'.stripslashes($event->event_name).'" class="__wps__dialog_content"><div style="text-align:left">'.$more.'</div></div>'; $html .= '<input type="submit" id="symposium_event_more" rel="symposium_more_'.$event->eid.'" class="symposium-dialog __wps__button" value="'.__("More info", WPS_TEXT_DOMAIN).'" />'; } if (is_user_logged_in() && $event->event_enable_places) { // check to see if already booked $sql = "select b.tickets, b.confirmed, b.bid, b.payment_processed, e.event_cost FROM ".$wpdb->base_prefix."symposium_events_bookings b LEFT JOIN ".$wpdb->base_prefix."symposium_events e ON b.event_id = e.eid WHERE event_id = %d AND uid = %d"; $ret = $wpdb->get_row($wpdb->prepare($sql, $event->eid, $current_user->ID)); if (!$ret || !$ret->tickets) { if ($event->event_max_places-$taken > 0) $html .= '<input type="submit" id="symposium_book_event" data-eid="'.$event->eid.'" data-max="'.$event->event_tickets_per_booking.'" class="__wps__button symposium_book_event_button" value="'.__("Book", WPS_TEXT_DOMAIN).'" />'; } else { $html .= '<input type="submit" id="symposium_cancel_event" data-eid="'.$event->eid.'" class="__wps__button symposium_cancel_event_button" value="'.__("Cancel", WPS_TEXT_DOMAIN).'" />'; } if ($ret && !$ret->confirmed && !$ret->payment_processed && $ret->tickets && $ret->event_cost) $html .= '<input type="submit" id="symposium_pay_event" data-bid="'.$ret->bid.'" style="margin-left:5px" class="__wps__button" value="'.__("Payment", WPS_TEXT_DOMAIN).'" />'; if ($ret && $ret->tickets ) { if ($ret->confirmed) { $html .= '<br />'.sprintf(_n('Confirmed by the event organiser for %d ticket.','Confirmed by the event organiser for %d tickets.', $ret->tickets, WPS_TEXT_DOMAIN), $ret->tickets); } else { $html .= '<br />'.sprintf(_n('Awaiting confirmation from the organiser for %d ticket.','Awaiting confirmation from the organiser for %d tickets.', $ret->tickets, WPS_TEXT_DOMAIN), $ret->tickets); } } } $html .= '</div>'; $html .= '</div>'; } } } else { $html .= __('No events yet.', WPS_TEXT_DOMAIN); } $html .= '</div>'; $html .= '</div>'; // This filter allows others to filter content $html = apply_filters ( '__wps__events_shortcode_filter', $html); // Send HTML return $html; }
if (is_user_logged_in()) { $cid = $_POST['cid']; $type = $_POST['type']; $sql = "SELECT l.*, u.display_name FROM ".$wpdb->base_prefix."symposium_likes l LEFT JOIN ".$wpdb->base_prefix."users u ON u.ID = l.uid WHERE cid=%d AND type=%s ORDER BY u.display_name"; $getlikes = $wpdb->get_results($wpdb->prepare($sql, $cid, $type)); if ($getlikes) { $likes_array = array(); foreach ($getlikes as $alike) { $link = __wps__profile_link($alike->uid); $add = array ( 'display_name' => $link, 'avatar' => get_avatar($alike->uid, 20) ); array_push($likes_array, $add); } echo json_encode($likes_array); } else { echo 'None'; } } else {