function __wps__add_gallery_menu_tabs($html,$title,$value,$uid1,$uid2,$privacy,$is_friend,$extended,$share) { if ($value == 'gallery') { global $current_user; if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) $html .= '<li id="menu_gallery" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; } return $html; }
function __wps__show_metadata($user) { global $wpdb; $uid = $user->ID; // get values $dob_day = __wps__get_meta($uid, 'dob_day'); $dob_month = __wps__get_meta($uid, 'dob_month'); $dob_year = __wps__get_meta($uid, 'dob_year'); $city = __wps__get_meta($uid, 'extended_city'); $country = __wps__get_meta($uid, 'extended_country'); $share = __wps__get_meta($uid, 'share'); $wall_share = __wps__get_meta($uid, 'wall_share'); if (function_exists('__wps__rss_main')) { $rss_share = __wps__get_meta($uid, 'rss_share'); } else { $rss_share = ''; } $trusted = __wps__get_meta($uid, 'trusted'); $notify_new_messages = __wps__get_meta($uid, 'notify_new_messages'); $notify_new_wall = __wps__get_meta($uid, 'notify_new_wall'); $forum_all = __wps__get_meta($uid, 'forum_all'); $signature = __wps__get_meta($uid, 'signature'); $html = '<h3>' . __("Profile Details", WPS_TEXT_DOMAIN) . '</h3>'; $html .= '<table class="form-table">'; // Share personal information $html .= '<tr><th><label for="share">'.__('Who do you want to share personal information with?', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><select id="share" name="share">'; $html .= "<option value='Nobody'"; if ($share == 'Nobody') { $html .= ' SELECTED '; } $html .= '>'.__('Nobody', WPS_TEXT_DOMAIN).'</option>'; $html .= "<option value='Friends only'"; if ($share == 'Friends only') { $html .= ' SELECTED '; } $html .= '>'.sprintf(__('%s Only', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friends')).'</option>'; $html .= "<option value='Everyone'"; if ($share == 'Everyone') { $html .= ' SELECTED '; } $html .= '>'.stripslashes(get_option(WPS_OPTIONS_PREFIX.'_alt_everyone')).'</option>'; $html .= "<option value='public'"; if ($share == 'public') { $html .= ' SELECTED '; } $html .= '>'.__('Public', WPS_TEXT_DOMAIN).'</option>'; $html .= '</select></td></tr>'; // Share Wall / Activity $html .= '<tr><th><label for="wall_share">'.__('Who do you want to share your activity with?', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><select id="wall_share" name="wall_share">'; $html .= "<option value='Nobody'"; if ($wall_share == 'Nobody') { $html .= ' SELECTED '; } $html .= '>'.__('Nobody', WPS_TEXT_DOMAIN).'</option>'; $html .= "<option value='Friends only'"; if ($wall_share == 'Friends only') { $html .= ' SELECTED '; } $html .= '>'.sprintf(__('%s Only', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friends')).'</option>'; $html .= "<option value='Everyone'"; if ($wall_share == 'Everyone') { $html .= ' SELECTED '; } $html .= '>'.stripslashes(get_option(WPS_OPTIONS_PREFIX.'_alt_everyone')).'</option>'; $html .= "<option value='public'"; if ($wall_share == 'public') { $html .= ' SELECTED '; } $html .= '>'.__('Public', WPS_TEXT_DOMAIN).'</option>'; $html .= '</select></td></tr>'; // Publish RSS feed? if (function_exists('__wps__rss_main')) { $html .= '<tr><th><label for="rss_share">'.__('RSS feed', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><select id="rss_share" name="rss_share">'; $html .= "<option value=''"; if ($rss_share == '') { $html .= ' SELECTED '; } $html .= '>'.__('No', WPS_TEXT_DOMAIN).'</option>'; $html .= "<option value='on'"; if ($rss_share == 'on') { $html .= ' SELECTED '; } $html .= '>'.__('Yes', WPS_TEXT_DOMAIN).'</option>'; $html .= '</select> '; $html .= '<span class="description">'.__('Publish your activity via RSS (only your initial posts)?', WPS_TEXT_DOMAIN).'</span>'; $html .= '</td></tr>'; } else { $html .= '<input type="hidden" id="rss_share" value="">'; } // Birthday if (get_option(WPS_OPTIONS_PREFIX.'_show_dob') == 'on') { $html .= '<tr><th><label for="dob">'.__('Your date of birth', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><select id="dob_day" name="dob_day">'; $html .= '<option value=0'; if ($dob_day == 0) { $html .= ' SELECTED '; } $html .= '>---</option>'; for ($i = 1; $i <= 31; $i++) { $html .= '<option value="'.$i.'"'; if ($dob_day == $i) { $html .= ' SELECTED '; } $html .= '>'.$i.'</option>'; } $html .= '</select> / '; $html .= '<select id="dob_month" name="dob_month">'; $html .= '<option value=0'; if ($dob_month == 0) { $html .= ' SELECTED '; } $html .= '>---</option>'; for ($i = 1; $i <= 12; $i++) { switch($i) { case 1:$monthname = __("January", WPS_TEXT_DOMAIN);break; case 2:$monthname = __("February", WPS_TEXT_DOMAIN);break; case 3:$monthname = __("March", WPS_TEXT_DOMAIN);break; case 4:$monthname = __("April", WPS_TEXT_DOMAIN);break; case 5:$monthname = __("May", WPS_TEXT_DOMAIN);break; case 6:$monthname = __("June", WPS_TEXT_DOMAIN);break; case 7:$monthname = __("July", WPS_TEXT_DOMAIN);break; case 8:$monthname = __("August", WPS_TEXT_DOMAIN);break; case 9:$monthname = __("September", WPS_TEXT_DOMAIN);break; case 10:$monthname = __("October", WPS_TEXT_DOMAIN);break; case 11:$monthname = __("November", WPS_TEXT_DOMAIN);break; case 12:$monthname = __("December", WPS_TEXT_DOMAIN);break; } $html .= '<option value="'.$i.'"'; if ($dob_month == $i) { $html .= ' SELECTED '; } $html .= '>'.$monthname.'</option>'; } $html .= '</select> / '; $html .= '<select id="dob_year" name="dob_year">'; $html .= '<option value=0'; if ($dob_year == 0) { $html .= ' SELECTED '; } $html .= '>---</option>'; for ($i = date("Y"); $i >= 1900; $i--) { $html .= '<option value="'.$i.'"'; if ($dob_year == $i) { $html .= ' SELECTED '; } $html .= '>'.$i.'</option>'; } $html .= '</td></select>'; } else { $html .= '<input type="hidden" id="dob_day" value="'.$dob_day.'">'; $html .= '<input type="hidden" id="dob_month" value="'.$dob_month.'">'; $html .= '<input type="hidden" id="dob_year" value="'.$dob_year.'">'; } // City $html .= '<tr><th><label for="extended_city">'.__('Which town/city are you in?', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="text" class="input-field" id="extended_city" name="extended_city" style="width:300px" value="'.trim($city, "'").'">'; $html .= '</td></tr>'; // Country $html .= '<tr><th><label for="extended_country">'.__('Which country are you in?', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="text" class="input-field" id="extended_country" name="extended_country" style="width:300px" value="'.trim($country, "'").'">'; $html .= '</td></tr>'; // Google map if ( ($city != '' || $country != '') && (get_option(WPS_OPTIONS_PREFIX.'_profile_google_map') > 0) ){ $html .= '<tr><th></th><td>'; $html .= '<a target="_blank" style="width:'.get_option(WPS_OPTIONS_PREFIX.'_profile_google_map').'px; height:'.get_option(WPS_OPTIONS_PREFIX.'_profile_google_map').'px;" href="http://maps.google.co.uk/maps?f=q&source=embed&hl=en&geocode=&q='.$city.',+'.$country.'&ie=UTF8&hq=&hnear='.$city.',+'.$country.'&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='.$city.',.+'.$country.'&zoom=5&size='.get_option(WPS_OPTIONS_PREFIX.'_profile_google_map').'x'.get_option(WPS_OPTIONS_PREFIX.'_profile_google_map').'&maptype=roadmap&markers=color:blue|label: |'.$city.',+'.$country.'&sensor=false" />'; $html .= '</a><br /><span class="description"> '.sprintf(__("The Google map that will be displayed on top of your %s profile page, resulting from your personal data above.", WPS_TEXT_DOMAIN), WPS_WL).'</span></td></tr>'; } // Extensions $extensions = $wpdb->get_results("SELECT * FROM ".$wpdb->base_prefix."symposium_extended ORDER BY extended_order, extended_name"); if ($extensions) { $sql = "SELECT * FROM ".$wpdb->base_prefix."usermeta WHERE user_id = %d AND meta_key like 'symposium_extended_%%'"; $fields = $wpdb->get_results($wpdb->prepare($sql, $uid)); foreach ($extensions as $extension) { // Don't display Extended Fields that are associated to WP usermeta data, they should be displayed somewhere else in the dashboard if ( $extension->wp_usermeta == '' ) { $value = $extension->extended_default; if ($extension->extended_type == "List") { $default_list = explode(',', $extension->extended_default); $value = $default_list[0]; } foreach ($fields as $field) { $slug = str_replace('symposium_extended_', '', $field->meta_key); if ($slug == $extension->extended_slug) { $value = $field->meta_value; break; } } // Draw the object according to type switch ($extension->extended_type) : case 'Text' : $html .= '<tr><th><label for="extended_'.$slug.'">'.stripslashes($extension->extended_name).'</label></th>'; $html .= '<td><input type="text" class="input-field" id="extended_'.$slug.'" name="extended_'.$slug.'" style="width:300px" value="'.$value.'"'; if ( $extension->readonly ) { $html .= ' disabled="disabled"'; } $html .= ' /></td></tr>'; break; case 'Textarea' : $html .= '<tr><th><label for="extended_'.$slug.'">'.stripslashes($extension->extended_name).'</label></th>'; $html .= '<td><textarea rows="5" cols="30" id="extended_'.$slug.'" name="extended_'.$slug.'"'; if ( $extension->readonly ) { $html .= ' disabled="disabled"'; } $html .= '>'.$value.'</textarea></td></tr>'; break; case 'List' : $html .= '<tr><th><label for="extended_'.$slug.'">'.stripslashes($extension->extended_name).'</label></th>'; $html .= '<td><select id="extended_'.$slug.'" name="extended_'.$slug.'"'; if ( $extension->readonly ) { $html .= ' disabled="disabled"'; } $html .= '>'; foreach ($default_list as $list_value) { $html .= '<option value="'.$list_value.'"'; if ( $value == $list_value) { $html .= ' SELECTED '; } $html .= '>'.$list_value.'</option>'; } $html .= '</select></td></tr>'; break; case 'Checkbox' : $html .= '<tr><th><label for="extended_'.$slug.'">'.stripslashes($extension->extended_name).'</label></th>'; $html .= '<td><input type="checkbox" id="extended_'.$slug.'" name="extended_'.$slug.'"'; if ( $extension->readonly ) { $html .= ' disabled="disabled"'; } if ( $value == 'on') { $html .= ' CHECKED '; } $html .= '/></td>'; $html .= '</tr>'; break; endswitch; } } } $html .= '</table>'; $html .= '<h3>' . __("Community Settings", WPS_TEXT_DOMAIN) . '</h3>'; $html .= '<table class="form-table">'; // Trusted member (for example, for support staff) if (__wps__get_current_userlevel() == 5) { $html .= '<tr><th><label for="trusted">'.__('Trusted Member?', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="checkbox" name="trusted" id="trusted"'; if ($trusted == 'on') { $html .= ' CHECKED '; } $html .= '/> '; $html .= '<span class="description">'.__('Is this member trusted?', WPS_TEXT_DOMAIN).'</span>'; $html .= '</td></tr>'; } else { $html .= '<tr><td><input type="hidden" name="trusted_hidden" id="trusted_hidden" value="'.$trusted.'" /><td></tr>'; } // profile_photo, avatar if ( get_option('show_avatars') ) { // AG - select your avatar here --> } // forum_digest // Email notifications for private messages $html .= '<tr><th><label for="notify_new_messages">'.__('Emails for private messages', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="checkbox" name="notify_new_messages" id="notify_new_messages"'; if ($notify_new_messages =='on') { $html .= ' CHECKED '; } $html .= '/> '; $html .= '<span class="description">'.__('Receive an email when you get new mail messages?', WPS_TEXT_DOMAIN).'</span>'; $html .= '</td></tr>'; // Email notifications for wall posts $html .= '<tr><th><label for="notify_new_wall">'.__('Emails for posts on the Wall', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="checkbox" name="notify_new_wall" id="notify_new_wall"'; if ($notify_new_wall == 'on') { $html .= ' CHECKED '; } $html .= '/> '; $html .= '<span class="description">'.__('Receive an email when a friend adds a post?', WPS_TEXT_DOMAIN).'</span>'; $html .= '</td></tr>'; if (function_exists('__wps__forum')) { // Email notifications for all forum activity (if allowed) if (get_option(WPS_OPTIONS_PREFIX.'_allow_subscribe_all') == "on") { $html .= '<tr><th><label for="forum_all">'.__('Emails for all new forum topics and replies', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="checkbox" name="forum_all" id="forum_all"'; if ($forum_all == 'on') { $html .= ' CHECKED '; } $html .= '/> '; $html .= '<span class="description">'.__('Receive an email for all new forum topics and replies?', WPS_TEXT_DOMAIN).'</span><br />'; $html .= '</td></tr>'; } else { $html .= '<input type="hidden" name="forum_all" value="" />'; } // Signature in the forum $html .= '<tr><th><label for="signature">'.__('Forum signature', WPS_TEXT_DOMAIN).'</label></th>'; $html .= '<td><input type="text" class="input-field" id="signature" name="signature" style="width:300px" value="'.stripslashes(trim($signature, "'")).'"><br />'; $html .= '<span class="description">'.__('If you want a signature to be appended automatically under your forum posts', WPS_TEXT_DOMAIN).'</span></td></tr>'; } // Facebook // AG - the return value needs to be dealt with... $html .= '</table>'; echo $html; }
// Get single mail message if ($_POST['action'] == 'getMailMessage') { if (is_user_logged_in()) { $mail_mid = $_POST['mid']; $tray = sanitize_text_field($_POST['tray']); if ($tray == "in") { $mail = $wpdb->get_row($wpdb->prepare("SELECT m.*, u.display_name FROM ".$wpdb->base_prefix."symposium_mail m LEFT JOIN ".$wpdb->base_prefix."users u ON m.mail_from = u.ID WHERE mail_mid = %d", $mail_mid)); } else { $mail = $wpdb->get_row($wpdb->prepare("SELECT m.*, u.display_name FROM ".$wpdb->base_prefix."symposium_mail m LEFT JOIN ".$wpdb->base_prefix."users u ON m.mail_to = u.ID WHERE mail_mid = %d", $mail_mid)); } // check that permission is okay if ( ($tray == "in" && $mail->mail_to == $current_user->ID) || ($tray != "in" && $mail->mail_from == $current_user->ID) || (__wps__get_current_userlevel() == 5) ) { // Swap codes from template $msg = stripslashes(str_replace('[]', '', get_option(WPS_OPTIONS_PREFIX.'_template_mail_message'))); // First the avatar if (strpos($msg, '[avatar') !== FALSE) { if ($tray == "in") { $uid = $mail->mail_from; } else { $uid = $mail->mail_to; } if (strpos($msg, '[avatar]')) { $msg = str_replace("[avatar]", get_avatar($uid, 44), $msg);
function __wps__scriptsAction() { $__wps__plugin_url = WPS_PLUGIN_URL; $__wps__plugin_path = str_replace("http://".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"], "", $__wps__plugin_url); global $wpdb, $current_user; wp_get_current_user(); // Set script timeout if (get_option(WPS_OPTIONS_PREFIX.'_wps_time_out') > 0) { set_time_limit(get_option(WPS_OPTIONS_PREFIX.'_wps_time_out')); } // Debug mode? define('WPS_DEBUG', get_option(WPS_OPTIONS_PREFIX.'_debug_mode')); // Using Panel? $use_panel = false; if ((get_option(WPS_OPTIONS_PREFIX.'__wps__add_notification_bar_activated') || get_option(WPS_OPTIONS_PREFIX.'__wps__add_notification_bar_network_activated')) && file_exists(dirname(__FILE__).'/panel.php')) $use_panel = true; // Set up variables for use throughout if (!is_admin()) { // Mail if ( !isset($_GET['view']) ) { $view = "in"; } else { $view = $_GET['view']; } // Current User Page (eg. a profile page) if (isset($_GET['uid'])) { $page_uid = $_GET['uid']*1; } else { $page_uid = 0; if (isset($_POST['uid'])) { $page_uid = $_POST['uid']*1; } else { // Try the permalink? if (get_option(WPS_OPTIONS_PREFIX.'_permalink_structure')) { // get URL $url = $_SERVER["REQUEST_URI"]; // if trailing slash, remove if if ( $url[strlen($url)-1] == '/' ) $url = substr($url, 0, strlen($url)-1); $last_slash = strrpos($url, '/'); if ($last_slash === FALSE) { $page_uid = $current_user->ID; } else { $u = substr($url, $last_slash+1, strlen($url)-$last_slash); $sql = "SELECT ID FROM ".$wpdb->base_prefix."users WHERE replace(display_name, ' ', '') = %s"; $id = $wpdb->get_row($wpdb->prepare($sql, str_replace(' ', '', $u))); if ($id) { $page_uid = $id->ID; } else { $page_uid = $current_user->ID; } } } else { // default then to current user $page_uid = $current_user->ID; } } } if ($page_uid == 0) { if (isset($_POST['from']) && $_POST['from'] == 'small_search') { $search = $_POST['member_small']; $get_uid = $wpdb->get_var("SELECT u.ID FROM ".$wpdb->base_prefix."users u WHERE (u.display_name LIKE '".$search."%') OR (u.display_name LIKE '% %".$search."%') ORDER BY u.display_name LIMIT 0,1"); if ($get_uid) { $page_uid = $get_uid; } } } define('WPS_CURRENT_USER_PAGE', $page_uid); // Forum if (isset($_GET['show'])) { $show_tid = $_GET['show']*1; } else { $show_tid = 0; if (isset($_POST['tid'])) { $show_tid = $_POST['tid']*1; } } $cat_id = ''; if (isset($_GET['cid'])) { $cat_id = $_GET['cid']; } if (isset($_POST['cid'])) { $cat_id = $_POST['cid']; } // Group page if (isset($_GET['gid'])) { $page_gid = $_GET['gid']*1; } else { $page_gid = 0; if (isset($_POST['gid'])) { $page_gid = $_POST['gid']*1; } } // If visiting a group page, check to see if forum is default view if (is_user_logged_in() && $page_gid > 0) { $forum = $wpdb->get_row($wpdb->prepare("SELECT group_forum, default_page FROM ".$wpdb->prefix."symposium_groups WHERE gid = %d", $page_gid)); if ($forum->default_page == 'forum' && $forum->group_forum == 'on') { $cat_id = 0; } } // Gallery $album_id = 0; if (isset($_GET['album_id'])) { $album_id = $_GET['album_id']; } if (isset($_POST['album_id'])) { $album_id = $_POST['album_id']; } // Get styles for JS if (get_option(WPS_OPTIONS_PREFIX.'_use_styles') == "on") { $bg_color_2 = get_option(WPS_OPTIONS_PREFIX.'_bg_color_2'); $row_border_size = get_option(WPS_OPTIONS_PREFIX.'_row_border_size'); $row_border_style = get_option(WPS_OPTIONS_PREFIX.'_row_border_style'); $text_color_2 = get_option(WPS_OPTIONS_PREFIX.'_text_color_2'); } else { $bg_color_2 = ''; $row_border_size = ''; $row_border_style = ''; $text_color_2 = ''; } // GET post? if (isset($_GET['post'])) { $GETpost = $_GET['post']; } else { $GETpost = ''; } // Display Name if (isset($current_user->display_name)) { $display_name = stripslashes($current_user->display_name); } else { $display_name = ''; } // Embedded content from external plugin? if (isset($_GET['embed'])) { $embed = 'on'; } else { $embed = ''; } // to parameter if (isset($_GET['to'])) { $to = $_GET['to']; } else { $to = ''; } // mail ID if (isset($_GET['mid'])) { $mid = $_GET['mid']; } else { $mid = ''; } // chat sound $chat_sound = __wps__get_meta($current_user->ID, 'chat_sound'); if (!$chat_sound) $chat_sound = 'Pop.mp3'; // Get forum upload valid extensions $permitted_ext = get_option(WPS_OPTIONS_PREFIX.'_image_ext').','.get_option(WPS_OPTIONS_PREFIX.'_video_ext').','.get_option(WPS_OPTIONS_PREFIX.'_doc_ext'); global $blog_id; if ($blog_id > 1) { $wps_content = get_option(WPS_OPTIONS_PREFIX.'_img_url')."/".$blog_id; } else { $wps_content = get_option(WPS_OPTIONS_PREFIX.'_img_url'); } // Load JS wp_enqueue_script('__wps__', $__wps__plugin_url.'/js/'.get_option(WPS_OPTIONS_PREFIX.'_wps_js_file'), array('jquery')); // Load JScharts? if (get_option(WPS_OPTIONS_PREFIX.'_jscharts')) { if (get_option(WPS_OPTIONS_PREFIX.'_wps_js_file') == 'wps.js') { wp_enqueue_script('wps_jscharts', $__wps__plugin_url.'/js/jscharts.js', array('jquery')); } else { wp_enqueue_script('wps_jscharts', $__wps__plugin_url.'/js/jscharts.min.js', array('jquery')); } } // Use WP editor? (not for use yet!!!!) update_option(WPS_OPTIONS_PREFIX.'_use_wp_editor', false); // Set JS variables wp_localize_script( '__wps__', '__wps__', array( // variables 'permalink' => get_permalink(), 'plugins' => WP_PLUGIN_URL, 'plugin_url' => WPS_PLUGIN_URL.'/', 'wps_content_dir' => WP_CONTENT_DIR.'/wps-content', 'plugin_path' => $__wps__plugin_path, 'images_url' => get_option(WPS_OPTIONS_PREFIX.'_images'), 'inactive' => get_option(WPS_OPTIONS_PREFIX.'_online'), 'forum_url' => __wps__get_url('forum'), 'mail_url' => __wps__get_url('mail'), 'profile_url' => __wps__get_url('profile'), 'groups_url' => __wps__get_url('groups'), 'group_url' => __wps__get_url('group'), 'gallery_url' => __wps__get_url('gallery'), 'page_gid' => $page_gid, 'offline' => get_option(WPS_OPTIONS_PREFIX.'_offline'), 'use_chat' => get_option(WPS_OPTIONS_PREFIX.'_use_chat'), 'chat_polling' => get_option(WPS_OPTIONS_PREFIX.'_chat_polling'), 'bar_polling' => get_option(WPS_OPTIONS_PREFIX.'_bar_polling'), 'view' => $view, 'profile_default' => get_option(WPS_OPTIONS_PREFIX.'_wps_profile_default'), 'show_tid' => $show_tid, 'cat_id' => $cat_id, 'album_id' => $album_id, 'current_user_id' => $current_user->ID, 'current_user_display_name' => $display_name, 'current_user_level' => __wps__get_current_userlevel($current_user->ID), 'current_user_page' => $page_uid, 'current_group' => $page_gid, 'post' => $GETpost, 'please_wait' => __('Please Wait...', WPS_TEXT_DOMAIN), 'saving' => __('Saving...', WPS_TEXT_DOMAIN), 'site_title' => get_bloginfo('name'), 'site_url' => get_bloginfo('url'), 'bg_color_2' => $bg_color_2, 'row_border_size' => $row_border_size, 'row_border_style' => $row_border_style, 'text_color_2' => $text_color_2, 'template_mail_tray' => get_option(WPS_OPTIONS_PREFIX.'_template_mail_tray'), 'embed' => $embed, 'to' => $to, 'is_admin' => 0, 'mail_id' => $mid, 'permitted_ext' => $permitted_ext, 'forum_ajax' => get_option(WPS_OPTIONS_PREFIX.'_forum_ajax'), 'wps_lite' => get_option(WPS_OPTIONS_PREFIX.'_wps_lite'), 'wps_use_poke' => get_option(WPS_OPTIONS_PREFIX.'_use_poke'), 'wps_forum_stars' => get_option(WPS_OPTIONS_PREFIX.'_forum_stars'), 'wps_forum_refresh' => get_option(WPS_OPTIONS_PREFIX.'_forum_refresh'), 'wps_wysiwyg' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg'), 'wps_wysiwyg_1' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_1'), 'wps_wysiwyg_2' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_2'), 'wps_wysiwyg_3' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_3'), 'wps_wysiwyg_4' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_4'), 'wps_wysiwyg_css' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_css'), 'wps_wysiwyg_skin' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_skin'), 'wps_wysiwyg_width' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_width'), 'wps_wysiwyg_height' => get_option(WPS_OPTIONS_PREFIX.'_use_wysiwyg_height'), 'wps_plus' => (defined('WPS_PLUS')) ? WPS_PLUS : '', 'wps_alerts_activated' => (get_option(WPS_OPTIONS_PREFIX.'__wps__news_main_activated') || get_option(WPS_OPTIONS_PREFIX.'__wps__news_main_network_activated')), 'wps_admin_page' => 'na', 'dir_page_length' => get_option(WPS_OPTIONS_PREFIX.'_dir_page_length'), 'dir_full_ver' => get_option(WPS_OPTIONS_PREFIX.'_dir_full_ver') ? true : false, 'use_elastic' => get_option(WPS_OPTIONS_PREFIX.'_elastic'), 'events_user_places' => get_option(WPS_OPTIONS_PREFIX.'_events_user_places'), 'events_use_wysiwyg' => get_option(WPS_OPTIONS_PREFIX.'_events_use_wysiwyg'), 'debug' => WPS_DEBUG, 'include_context' => get_option(WPS_OPTIONS_PREFIX.'_include_context'), 'use_wp_editor' => get_option(WPS_OPTIONS_PREFIX.'_use_wp_editor'), 'profile_menu_scrolls' => get_option(WPS_OPTIONS_PREFIX.'_profile_menu_scrolls'), 'profile_menu_delta' => get_option(WPS_OPTIONS_PREFIX.'_profile_menu_delta'), 'profile_menu_adjust' => get_option(WPS_OPTIONS_PREFIX.'_profile_menu_adjust'), 'panel_enabled' => $use_panel, 'chat_sound' => $chat_sound, 'wps_content' => $wps_content, // translations 'clear' => __( 'Clear', WPS_TEXT_DOMAIN ), 'update' => __( 'Update', WPS_TEXT_DOMAIN ), 'cancel' => __( 'Cancel', WPS_TEXT_DOMAIN ), 'pleasewait' => __( 'Please wait', WPS_TEXT_DOMAIN ), 'saving' => __( 'Saving', WPS_TEXT_DOMAIN ), 'more' => __( 'more...', WPS_TEXT_DOMAIN ), 'next' => __( 'Next', WPS_TEXT_DOMAIN ), 'areyousure' => __( 'Are you sure?', WPS_TEXT_DOMAIN ), 'browseforfile' => __( 'Browse for file', WPS_TEXT_DOMAIN ), 'attachimage' => __( 'Attach an image', WPS_TEXT_DOMAIN ), 'attachfile' => __( 'Attach file', WPS_TEXT_DOMAIN ), 'whatsup' => stripslashes(get_option(WPS_OPTIONS_PREFIX.'_status_label')), 'whatsup_done' => __( 'Post added to your activity.', WPS_TEXT_DOMAIN ), 'sendmail' => __( 'Send a private mail...', WPS_TEXT_DOMAIN ), 'privatemail' => __( 'Private Mail', WPS_TEXT_DOMAIN ), 'privatemailsent' => __( 'Private mail sent!', WPS_TEXT_DOMAIN ), 'addasafriend' => sprintf(__("Add as a %s...", WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')), 'friendpending' => sprintf(__("%s request sent", WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')), 'attention' => get_option(WPS_OPTIONS_PREFIX.'_poke_label'), 'follow' => __( 'Follow', WPS_TEXT_DOMAIN ), 'unfollow' => __( 'Unfollow', WPS_TEXT_DOMAIN ), 'sent' => __( 'Message sent!', WPS_TEXT_DOMAIN ), 'likes' => __( 'Likes', WPS_TEXT_DOMAIN ), 'dislikes' => __( 'Dislikes', WPS_TEXT_DOMAIN ), 'forumsearch' => __( 'Search on forum', WPS_TEXT_DOMAIN ), 'gallerysearch' => __( 'Search Gallery', WPS_TEXT_DOMAIN ), 'profile_info' => __( 'Member Profile', WPS_TEXT_DOMAIN ), 'plus_mail' => __( 'Mailbox', WPS_TEXT_DOMAIN ), 'plus_follow_who' => __( 'Who am I following?', WPS_TEXT_DOMAIN ), 'plus_friends' => get_option(WPS_OPTIONS_PREFIX.'_alt_friends'), 'request_sent' => sprintf(__("Your %s request has been sent.", WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friend')), 'add_a_comment' => __( 'Add a comment:', WPS_TEXT_DOMAIN ), 'add' => __( 'Add', WPS_TEXT_DOMAIN ), 'show_original' => __( 'Show original', WPS_TEXT_DOMAIN ), 'write_a_comment' => __( 'Write a comment...', WPS_TEXT_DOMAIN ), 'follow_box' => __( 'Hi', WPS_TEXT_DOMAIN ), 'events_enable_places' => __( 'Enable booking places:', WPS_TEXT_DOMAIN ), 'events_max_places' => __( 'Maximum places:', WPS_TEXT_DOMAIN ), 'events_show_max' => __( 'Maximum places:', WPS_TEXT_DOMAIN ), 'events_confirmation' => __( 'Bookings require confirmation:', WPS_TEXT_DOMAIN ), 'events_tickets_per_booking' => __( 'Max tickets per booking:', WPS_TEXT_DOMAIN ), 'events_tab_1' => __( 'Summary', WPS_TEXT_DOMAIN ), 'events_tab_2' => __( 'More Information', WPS_TEXT_DOMAIN ), 'events_tab_3' => __( 'Confirmation Email', WPS_TEXT_DOMAIN ), 'events_tab_4' => __( 'Attendees', WPS_TEXT_DOMAIN ), 'events_send_email' => __( 'Send confirmation email:', WPS_TEXT_DOMAIN ), 'events_replacements' => __( 'You can use the following:', WPS_TEXT_DOMAIN ), 'events_pay_link' => __( 'HTML for payment:', WPS_TEXT_DOMAIN ), 'events_cost' => __( 'Price per booking:', WPS_TEXT_DOMAIN ), 'events_howmany' => __( 'How many tickets do you want?', WPS_TEXT_DOMAIN ), 'events_labels' => __( 'Ref|User|Booked|Confirmation email sent|# Tickets|Payment Confirmed|Actions|Confirm attendee|Send Mail|Re-send confirmation email|Remove attendee|Confirm payment', WPS_TEXT_DOMAIN ), 'gallery_labels' => __( 'Rename|Photo renamed.|Drag thumbnails to re-order, and then|save|Delete this photo|Set as album cover', WPS_TEXT_DOMAIN ), 'sending' => __( 'Sending', WPS_TEXT_DOMAIN ), 'go' => __( 'Go', WPS_TEXT_DOMAIN ), 'bbcode_url' => __( 'Enter a website URL...', WPS_TEXT_DOMAIN ), 'bbcode_problem' => __( 'Please make sure all BB Codes have open and close tags!', WPS_TEXT_DOMAIN ), 'bbcode_label' => __( 'Enter text to show...', WPS_TEXT_DOMAIN ) )); } if (is_admin()) { // Load admin JS wp_enqueue_script('__wps__', $__wps__plugin_url.'/js/wps-admin.js', array('jquery')); // Set JS variables wp_localize_script( '__wps__', '__wps__', array( 'plugins' => WP_PLUGIN_URL, 'plugin_url' => WPS_PLUGIN_URL.'/', 'plugin_path' => $__wps__plugin_path, 'images_url' => get_option(WPS_OPTIONS_PREFIX.'_images'), 'inactive' => get_option(WPS_OPTIONS_PREFIX.'_online'), 'forum_url' => get_option(WPS_OPTIONS_PREFIX.'_forum_url'), 'mail_url' => get_option(WPS_OPTIONS_PREFIX.'_mail_url'), 'profile_url' => get_option(WPS_OPTIONS_PREFIX.'_profile_url'), 'groups_url' => get_option(WPS_OPTIONS_PREFIX.'_groups_url'), 'group_url' => get_option(WPS_OPTIONS_PREFIX.'_group_url'), 'gallery_url' => get_option(WPS_OPTIONS_PREFIX.'_gallery_url'), 'offline' => get_option(WPS_OPTIONS_PREFIX.'_offline'), 'use_chat' => get_option(WPS_OPTIONS_PREFIX.'_use_chat'), 'chat_polling' => get_option(WPS_OPTIONS_PREFIX.'_chat_polling'), 'bar_polling' => get_option(WPS_OPTIONS_PREFIX.'_bar_polling'), 'current_user_id' => $current_user->ID, 'is_admin' => 1, 'wps_admin_page' => 'symposium_debug' )); } }
function __wps__add_events_menu_tabs($html,$title,$value,$uid1,$uid2,$privacy,$is_friend,$extended,$share) { if ($value == 'events') { global $wpdb, $current_user; // Get included roles $dir_levels = strtolower(get_option(WPS_OPTIONS_PREFIX.'_events_profile_include')); if (strpos($dir_levels, ' ') !== FALSE) $dir_levels = str_replace(' ', '', $dir_levels); if (strpos($dir_levels, '_') !== FALSE) $dir_levels = str_replace('_', '', $dir_levels); if (WPS_DEBUG) $html .= 'Events, allowed roles = '.$dir_levels.'<br />'; // Check to see if this member is in the included list of roles $include = false; if (is_user_logged_in()) { $user = get_userdata( $uid1 ); $capabilities = $user->{$wpdb->prefix.'capabilities'}; if ($capabilities) { foreach ( $capabilities as $role => $name ) { if ($role) { $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; } } } } if ( ($include) && ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) ) { $html .= '<li id="menu_events" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; } } return $html; }
function get_activity($uid1='', $version='wall', $limit_from, $limit_count) { // version = stream_activity, friends_activity, all_activity // uid1 = the user's page (which we are looking at) // uid2 = the current user // $limit_from (starting post) // $limit_count (how many to show) // $post (individual activity post ID if applicable) global $wpdb,$current_user; if ($uid1 == '') $uid1 = $current_user->ID; $uid2 = $current_user->ID; // Get privacy level for this member's activity $privacy = $uid1 > 0 ? __wps__get_meta($uid1, 'wall_share') : 'public'; if (is_user_logged_in() || $privacy == 'public') { $is_friend = ($uid1 > 0) ? __wps__friend_of($uid1, $current_user->ID) : false; if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) { $post_cid = ''; // Add groups join if in use if (function_exists('__wps__groups')) { $groups = "LEFT JOIN ".$wpdb->prefix."symposium_groups g ON c.subject_uid = g.gid"; $group_field = ", g.content_private"; } else { $groups = ""; $group_field = ", 'on' as content_private"; } if ($version == "all_activity" || $version == "stream_activity") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE ( ".$post_cid." c.comment_parent = 0 ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $limit_from, $limit_count)); } if ($version == "friends_activity") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE ( ".$post_cid." ( ( (c.subject_uid = %d) OR (c.author_uid = %d) OR (c.subject_uid = %d) OR (c.author_uid = %d) OR ( c.author_uid IN (SELECT friend_to FROM ".$wpdb->base_prefix."symposium_friends WHERE friend_from = %d)) ) AND c.comment_parent = 0 OR ( %d IN (SELECT author_uid FROM ".$wpdb->base_prefix."symposium_comments WHERE comment_parent = c.cid ) AND ( c.author_uid IN (SELECT friend_to FROM ".$wpdb->base_prefix."symposium_friends WHERE friend_from = %d)) ) ) ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $uid1, $uid1, $uid2, $uid2, $uid1, $uid1, $uid1, $limit_from, $limit_count)); } if ($version == "wall") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE (".$post_cid." ( ( (c.subject_uid = %d OR c.author_uid = %d) AND c.comment_parent = 0 ) OR ( %d IN (SELECT author_uid FROM ".$wpdb->base_prefix."symposium_comments WHERE comment_parent = c.cid ) ) ) ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $uid1, $uid1, $uid1, $limit_from, $limit_count)); } return $comments; } else { return false; } } else { return false; } }
if ($share == 'nobody') { $html .= ' SELECTED'; } $html .= '>'.__('Nobody', WPS_TEXT_DOMAIN).'</option>'; $html .= "<option value='friends only'"; if ($share == 'friends only') { $html .= ' SELECTED'; } $html .= '>'.sprintf(__('%s Only', WPS_TEXT_DOMAIN), get_option(WPS_OPTIONS_PREFIX.'_alt_friends')).'</option>'; $html .= "<option value='everyone'"; if ($share == 'everyone') { $html .= ' SELECTED'; } $html .= '>'.stripslashes(get_option(WPS_OPTIONS_PREFIX.'_alt_everyone')).'</option>'; $html .= "<option value='public'"; if ($share == 'public') { $html .= ' SELECTED'; } $html .= '>'.__('Public', WPS_TEXT_DOMAIN).'</option>'; $html .= '</select>'; $html .= " <img id='__wps__album_sharing_save' style='display:none' src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/busy.gif' /><br />"; // Show maximum file upload size as set in PHP.INI to admin's if (__wps__get_current_userlevel($current_user->ID) == 5) { $html .= '<p>As set in PHP.INI, the upload_max_filesize is: '.ini_get('upload_max_filesize').'<br />(this message is only shown to site administrators)</p>'; } else { $html .= '<p>'.__('The maximum size of uploaded files is', WPS_TEXT_DOMAIN).' '.ini_get('upload_max_filesize').'.</p>'; } include_once('../server/file_upload_include.php'); $html .= show_upload_form( WP_CONTENT_DIR.'/wps-content/members/'.$current_user->ID.'/gallery_upload/', WP_CONTENT_URL.'/wps-content/members/'.$current_user->ID.'/gallery_upload/', 'gallery', __('Upload photo(s)', WPS_TEXT_DOMAIN), 0, 0, $album_id );
function __wps__add_lounge_menu_tabs($html,$title,$value,$uid1,$uid2,$privacy,$is_friend,$extended,$share) { if ($value == 'lounge') { global $current_user; // Do a check that user is logged in, if so create the HTML to add to the menu if (is_user_logged_in()) { if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) $html .= '<li id="menu_lounge" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</a></li>'; } } return $html; }
$new_topic_subject = $_POST['subject']; $new_topic_text = $_POST['text']; if (isset($_POST['category'])) { $new_topic_category = $_POST['category']; } else { $new_topic_category = 0; } $new_topic_subscribe = $_POST['subscribed']; $info_only = $_POST['info_only']; $group_id = $_POST['group_id']; if ($group_id > 0) { $new_topic_category = 0; } if (get_option(WPS_OPTIONS_PREFIX.'_striptags') == 'on') { $new_topic_subject = strip_tags($new_topic_subject); $new_topic_text = strip_tags($new_topic_text); } // Check for moderation if (get_option(WPS_OPTIONS_PREFIX.'_moderation') == "on" && __wps__get_current_userlevel() < 5) { $topic_approved = ""; } else { $topic_approved = "on"; } if ($new_topic_subject == '') { $new_topic_subject = __('No subject', WPS_TEXT_DOMAIN); } if ($new_topic_text == '') { $new_topic_text = __('No message', WPS_TEXT_DOMAIN); } // Get forum URL worked out $forum_url = __wps__get_url('forum'); if (strpos($forum_url, '?') !== FALSE) { $q = "&"; } else { $q = "?"; }
} $html .= '<div id="__wps__events_list" style="width:95%;">'; if (__wps__get_current_userlevel() == 5) { $sql = "SELECT * FROM ".$wpdb->base_prefix."symposium_events WHERE event_owner = %d && (event_live = 'on' || event_owner = %d) ORDER BY event_start"; } else { $sql = "SELECT * FROM ".$wpdb->base_prefix."symposium_events WHERE event_owner = %d ORDER BY event_start"; } $events = $wpdb->get_results($wpdb->prepare($sql, $uid2, $uid1)); if ($events) { foreach ($events as $event) { $html .= '<div class="__wps__event_list_item row">'; if ( ($event->event_owner == $uid1) || (__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_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">';
function __wps__mail() { global $wpdb, $current_user; wp_get_current_user(); $thispage = get_permalink(); if ($thispage[strlen($thispage)-1] != '/') { $thispage .= '/'; } $mail_url = get_option(WPS_OPTIONS_PREFIX.'_mail_url'); $mail_all = get_option(WPS_OPTIONS_PREFIX.'_mail_all'); if (isset($_GET['page_id']) && $_GET['page_id'] != '') { // No Permalink $thispage = $mail_url; $q = "&"; } else { $q = "?"; } $plugin_dir = WPS_PLUGIN_URL; $html = ''; if (is_user_logged_in()) { $inbox_active = 'active'; $sent_active = 'inactive'; $compose_active = 'inactive'; $template = ''; $template .= '<div id="mail_tabs">'; $template .= '<div id="symposium_compose_tab" class="mail_tab nav-tab-'.$compose_active.'"><a href="javascript:void(0)" class="nav-tab-'.$compose_active.'-link" style="text-decoration:none !important;">'.__('Compose', WPS_TEXT_DOMAIN).'</a></div>'; $template .= '<div id="symposium_inbox_tab" class="mail_tab nav-tab-'.$inbox_active.'"><a href="javascript:void(0)" class="nav-tab-'.$inbox_active.'-link" style="text-decoration:none !important;">'.__('In Box', WPS_TEXT_DOMAIN).' <span id="in_unread"></span></a></div>'; $template .= '<div id="symposium_sent_tab" class="mail_tab nav-tab-'.$sent_active.'"><a href="javascript:void(0)" class="nav-tab-'.$sent_active.'-link" style="text-decoration:none !important;">'.__('Sent Items', WPS_TEXT_DOMAIN).'</a></div>'; $template .= '</div>'; $template .= '<div id="mail-main-div">'; $template .= "<div id='mail_sent_message'></div>"; $template .= "[compose_form]"; $template .= "<div id='mailbox'>"; $template .= "<div id='__wps__search'>"; $template .= "<input id='search_inbox' type='text' style='width: 160px'>"; $template .= "<input id='search_inbox_go' class='__wps__button message_search' type='submit' style='margin-left:10px;' value='".__('Search', WPS_TEXT_DOMAIN)."'>"; $template .= "[unread]"; $template .= "</div>"; $template .= "<div>"; $template .= "<select id='__wps__mail_bulk_action'>"; $template .= "<option value=''>".__('Bulk action...', WPS_TEXT_DOMAIN).'</option>'; $template .= "<option value='delete'>".__('Delete checked items', WPS_TEXT_DOMAIN).'</option>'; $template .= "<option id='__wps__mark_all' value='readall'>".__('Mark all mail as read', WPS_TEXT_DOMAIN).'</option>'; $template .= "<option value='deleteall'>".__('Delete all mail!', WPS_TEXT_DOMAIN).'</option>'; $template .= "<option value='recoverall'>".__('Recover all deleted mail', WPS_TEXT_DOMAIN).'</option>'; $template .= "</select>"; $template .= "</div>"; $template .= "<div id='mailbox_list'></div>"; $template .= "<div id='messagebox'></div>"; $template .= "</div>"; $template .= '</div>'; $html .= '<div id="next_message_id" style="display:none">0</div>'; $html .= '<div class="__wps__wrapper">'.$template.'</div>'; // Compose Form if (WPS_CURRENT_USER_PAGE == $current_user->ID) { $compose = '<div id="compose_form" style="display:none">'; $compose .= '<div id="compose_mail_to">'; $compose .= '<div class="send_button" style="padding:4px;">'; $compose .= '<input type="submit" id="mail_cancel_button" class="__wps__button" value="'.__('Cancel', WPS_TEXT_DOMAIN).'" />'; $compose .= '<input type="submit" id="mail_send_button" class="__wps__button" value="'.__('Send', WPS_TEXT_DOMAIN).'" />'; $compose .= '</div>'; $compose .= '<select id="mail_recipient_list">'; $compose .= '<option class="__wps__mail_recipient_list_option" value='.$current_user->ID.'>'.$current_user->display_name.'</option>'; if ($mail_all == 'on' || __wps__get_current_userlevel() == 5) { $sql = "SELECT u.ID AS friend_to, u.display_name FROM ".$wpdb->base_prefix."users u ORDER BY u.display_name"; $friends = $wpdb->get_results($sql); } else { $sql = "SELECT f.friend_to, u.display_name FROM ".$wpdb->base_prefix."symposium_friends f INNER JOIN ".$wpdb->base_prefix."users u ON f.friend_to = u.ID WHERE f.friend_from = %d AND f.friend_accepted = 'on' ORDER BY u.display_name"; $friends = $wpdb->get_results($wpdb->prepare($sql, $current_user->ID)); } if ($friends) { foreach ($friends as $friend) { $compose .= '<option class="__wps__mail_recipient_list_option" value='.$friend->friend_to.'>'.$friend->display_name.'</option>'; } } $compose .= '</select>'; $compose .= '</div>'; $compose .= '<div class="new-topic-subject label">'.__('Subject', WPS_TEXT_DOMAIN).'</div>'; $compose .= "<input type='text' id='compose_subject' class='new-topic-subject-input' value='' />"; $compose .= '<div id="compose_mail_message">'; $compose .= '<div class="new-topic-subject label">'.__('Message', WPS_TEXT_DOMAIN).'</div>'; $compose .= '<textarea class="reply-topic-subject-text" id="compose_text"></textarea>'; $compose .= '</div>'; $compose .= '<input type="hidden" id="compose_previous" value="" />'; $compose .= "</div>"; } else { $compose = '<div id="compose_form" style="display:none">'; $compose .= __('New mail can only be sent by this member.', WPS_TEXT_DOMAIN).'<br /><br />'; $compose .= '<input id="mail_cancel_button" type="submit" class="__wps__button" value="'.__('Back to mail', WPS_TEXT_DOMAIN).'" />'; $compose .= "</div>"; } // Replace template codes $html = str_replace("[compose_form]", $compose, stripslashes($html)); $html = str_replace("[compose]", __("Compose", WPS_TEXT_DOMAIN), stripslashes($html)); $html = str_replace("[inbox]", __("Inbox", WPS_TEXT_DOMAIN), stripslashes($html)); $html = str_replace("[sent]", __("Sent", WPS_TEXT_DOMAIN), stripslashes($html)); $html = str_replace("[unread]", "<input type='checkbox' id='unread_only' /> ".__("Unread only", WPS_TEXT_DOMAIN), stripslashes($html)); } else { // Not logged in $html .= __('You have to login to access your mail.', WPS_TEXT_DOMAIN); } // Send HTML return $html; }
function __wps__show_profile_menu_tabs($uid1, $uid2) { global $wpdb, $current_user; $menu = ''; $share = __wps__get_meta($uid1, 'share'); $privacy = __wps__get_meta($uid1, 'wall_share'); $is_friend = __wps__friend_of($uid1, $current_user->ID); if ( $wpdb->get_results( $wpdb->prepare("SELECT meta_key FROM ".$wpdb->base_prefix."usermeta WHERE user_ID = %d AND meta_key LIKE '%symposium_extended_%' AND meta_value != ''", $uid1) ) > 0 ) { $extended = "on"; } else { $extended = ""; } if ($uid1 == $uid2) { $structure = get_option(WPS_OPTIONS_PREFIX."_profile_menu_structure"); } else { $structure = get_option(WPS_OPTIONS_PREFIX."_profile_menu_structure_other"); } $str_arr = explode(chr(10), $structure); if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) ) { // Filter for additional menu items $menu .= '<div style="float:right;text-align:right;">'.apply_filters ( '__wps__profile_menu_filter_tabs', $menu, $uid1, $uid2, $privacy, $is_friend, $extended, $share, '' ).'</div>'; $menu .= '<ul class="__wps__dropdown">'; // Note pending friends $pending_friends = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_friends f WHERE f.friend_to = %d AND f.friend_accepted != 'on'", $uid1)); if ( ($pending_friends > 0) && ($uid1 == $uid2) ) { $pending_friends = " (".$pending_friends.")"; } else { $pending_friends = ""; } // Build menu $started_top_level = false; foreach($str_arr as $item) { // Top level menu items if (strpos($item, '[') !== false) { $item = str_replace('[', '', $item); $item = str_replace(']', '', $item); if ($started_top_level) { $menu .= '</ul></li>'; } $started_top_level = true; $item = str_replace('%f', $pending_friends, $item); $menu .= '<li class="__wps__top_menu">'.$item; $menu .= '<ul class="__wps__sub_menu">'; } // Child item if (strpos($item, '=') !== false) { list($title,$value) = explode('=', $item); $value = str_replace(chr(13), '', $value); $i = ''; $menu = apply_filters ( '__wps__profile_menu_tabs_filter', $menu, $title, $value, $uid1, $uid2, $privacy, $is_friend, $extended, $share ); switch ($value) { case 'viewprofile' : if ( (is_user_logged_in() && strtolower($share) == 'everyone') || (strtolower($share) == 'public') || (strtolower($share) == 'friends only' && $is_friend) || ($uid1 == $uid2)) { $i = '<li id="menu_extended" class="__wps__profile_menu">'.$title.'</li>'; } break; case 'details' : if ($uid1 == $uid2) $i = '<li id="menu_settings" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; break; case 'settings': if ($uid1 == $uid2) $i = '<li id="menu_personal" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; break; case 'avatar' : if ( ($uid1 == $uid2) && (get_option(WPS_OPTIONS_PREFIX.'_profile_avatars') == "on") ) $i = '<li id="menu_avatar" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; break; case 'activitymy' : $i = '<li id="menu_wall" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; break; case 'activityfriends' : if (strtolower($share) == 'public' && !(is_user_logged_in())) { // don't show friends activity to public } else { $i = '<li id="menu_activity" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; } break; case 'activityall' : if (strtolower($share) == 'public' && !(is_user_logged_in())) { // don't show all activity to public } else { $i = '<li id="menu_all" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; } break; case 'myfriends' : if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($share) == 'everyone') || (strtolower($share) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) { if ($uid1 == $uid2) { $i = '<li id="menu_friends" class="__wps__profile_menu" href="javascript:void(0)">'.$title.' '.$pending_friends.'</li>'; } else { $i = '<li id="menu_friends" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; } } break; case 'mygroups' : if (function_exists('__wps__group')) $i = '<li id="menu_groups" class="__wps__profile_menu" href="javascript:void(0)">'.$title.'</li>'; break; default : $i = apply_filters ( '__wps__profile_menu_tabs', '', $title, $value, $uid1, $uid2, $privacy, $is_friend, $extended, $share ); break; } if ($i) $menu .= $i; } } if ($started_top_level) { $menu .= '</ul></li>'; } $menu .= '</ul>'; $menu .= '<div id="__wps__menu_tabs_wrapper"></div>'; $menu .= '<div style="clear:both;padding-bottom:20px;"></div>'; } else { $menu = ''; } return $menu; }
} if ($member['valid'] == "on" && $shown_members_title == false) { $html .= "<br /><p><strong>".__("Members", WPS_TEXT_DOMAIN)."</strong></p>"; } $time_now = time(); $last_active_minutes = strtotime($member['last_activity']); $last_active_minutes = floor(($time_now-$last_active_minutes)/60); $html .= "<div id='request_".$member['ID']."' class='wall_post_div members_row row_odd corners'>"; $html .= "<div class='members_info'>"; // Delete icons if ( (__wps__get_current_userlevel() == 5 || __wps__group_admin($uid1) == "yes") && ($member['admin'] != 'on') ) { $html .= " <a title='".$member['ID']."' href='javascript:void(0);' style='display:none; float:right;' class='delete_group_member delete delete_post_top'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/delete.png' style='width:16px;height:16px' /></a>"; } if ( ($member['ID'] == $me) || (is_user_logged_in() && strtolower($member['share']) == 'everyone') || (strtolower($member['share']) == 'public') || (strtolower($member['share']) == 'friends only' && __wps__friend_of($member['ID'], $current_user->ID)) ) { $html .= "<div class='members_location'>"; if (isset($city) && $city != '') { $html .= $member['city']; } if (isset($country) && $country != '') { if ($city != '') { $html .= ', '.$member['country']; } else { $html .= $member['country']; } }
function __wps__activity_stream($uid1='', $version='wall', $limit_from=0, $limit_count=10, $post='', $show_add_comment=true) { // Get button style from extension if available $button_style = __wps__get_extension_button_style(); // version = stream_activity, friends_activity, all_activity // uid1 = the user's page (which we are looking at) // uid2 = the current user // $limit_from (starting post) // $limit_count (how many to show) // $post (individual activity post ID if applicable) global $wpdb,$current_user; if ($uid1 == '') $uid1 = $current_user->ID; $uid2 = $current_user->ID; // Get privacy level for this member's activity $privacy = $uid1 > 0 ? __wps__get_meta($uid1, 'wall_share') : 'public'; $html = ""; $html = apply_filters( '__wps__activity_top', $html, $uid1, $uid2, $version ); if (is_user_logged_in() || $privacy == 'public') { $is_friend = ($uid1 > 0) ? __wps__friend_of($uid1, $current_user->ID) : false; if ( ($uid1 == $uid2) || (is_user_logged_in() && strtolower($privacy) == 'everyone') || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && $is_friend) || __wps__get_current_userlevel() == 5) { $profile_page = __wps__get_url('profile'); if ($profile_page[strlen($profile_page)-1] != '/') { $profile_page .= '/'; } $q = __wps__string_query($profile_page); $html .= "<div id='__wps__wall'>"; if ( ( ( ($version == 'stream_activity') && ($uid2 > 0) ) || ( ($limit_from == 0) && ($post == '') && ($uid1 != '') && ( ($uid1 == $uid2) || ($is_friend)) ) && (is_user_logged_in()) ) ) { // Post Comment Input if ($show_add_comment) { if ($uid1 == $uid2) { $whatsup = stripslashes(get_option(WPS_OPTIONS_PREFIX.'_status_label')); $whatsup = str_replace("'", "`", $whatsup); } else { $whatsup = __('Write a comment...', WPS_TEXT_DOMAIN); } $html .= "<div id='symposium_user_id' style='display:none'>".strtolower($current_user->ID)."</div>"; $html .= "<div id='symposium_user_login' style='display:none'>".strtolower($current_user->user_login)."</div>"; $html .= "<div id='symposium_user_email' style='display:none'>".strtolower($current_user->user_email)."</div>"; // Add status surrounding div $html .= '<div id="symposium_add_status">'; // The textarea $html .= '<textarea '; if (get_option(WPS_OPTIONS_PREFIX.'_elastic')) $html .= 'class="elastic" '; $html .= 'id="__wps__comment" onblur="this.value=(this.value==\'\') ? \''.$whatsup.'\' : this.value;" onfocus="this.value=(this.value==\''.$whatsup.'\') ? \'\' : this.value;">'; $html .= $whatsup; $html .= '</textarea>'; if (get_option(WPS_OPTIONS_PREFIX.'_show_buttons')) { $html .= '<input id="__wps__add_comment" type="submit" class="__wps__button" style="'.$button_style.'" value="'.__('Post', WPS_TEXT_DOMAIN).'" /><br />'; } else { $html .= '<br />'; } // Embed YouTube... if (get_option(WPS_OPTIONS_PREFIX."_activity_youtube")) { $html .= '<input type="submit" id="activity_youtube_embed_button" onclick="return false;" class="__wps__button" style="'.$button_style.'" value="'.__('YouTube', WPS_TEXT_DOMAIN).'">'; $html .= '<div id="activity_youtube_embed_id"></div>'; } // Attach an image... if (get_option(WPS_OPTIONS_PREFIX."_activity_images")) { include_once('server/file_upload_include.php'); $html .= show_upload_form( WP_CONTENT_DIR.'/wps-content/members/'.$current_user->ID.'/activity_upload/', WP_CONTENT_URL.'/wps-content/members/'.$current_user->ID.'/activity_upload/', 'activity', __('Add image', WPS_TEXT_DOMAIN), 0, 0, 0, $uid1, $button_style ); } $html .= '</div>'; // End surrounding div } } $html = apply_filters( '__wps__activity_below_whatsup', $html, $uid1, $uid2, $version ); if ($post != '') { $post_cid = 'c.cid = '.$post.' AND '; } else { $post_cid = ''; } // Add groups join if in use if (function_exists('__wps__groups')) { $groups = "LEFT JOIN ".$wpdb->prefix."symposium_groups g ON c.subject_uid = g.gid"; $group_field = ", g.content_private"; } else { $groups = ""; $group_field = ", 'on' as content_private"; } if (WPS_DEBUG) $html .= '$version='.$version.'<br />'; if ($version == "all_activity" || $version == "stream_activity") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE ( ".$post_cid." c.comment_parent = 0 ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $limit_from, $limit_count)); } if ($version == "friends_activity") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE ( ".$post_cid." ( ( (c.subject_uid = %d) OR (c.author_uid = %d) OR (c.subject_uid = %d) OR (c.author_uid = %d) OR ( c.author_uid IN (SELECT friend_to FROM ".$wpdb->base_prefix."symposium_friends WHERE friend_from = %d)) ) AND c.comment_parent = 0 OR ( %d IN (SELECT author_uid FROM ".$wpdb->base_prefix."symposium_comments WHERE comment_parent = c.cid ) AND ( c.author_uid IN (SELECT friend_to FROM ".$wpdb->base_prefix."symposium_friends WHERE friend_from = %d)) ) ) ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $uid1, $uid1, $uid2, $uid2, $uid1, $uid1, $uid1, $limit_from, $limit_count)); } if ($version == "wall") { $sql = "SELECT c.*, u.display_name, u2.display_name AS subject_name" . $group_field . " FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."users u2 ON c.subject_uid = u2.ID " . $groups . " WHERE (".$post_cid." ( ( (c.subject_uid = %d OR c.author_uid = %d) AND c.comment_parent = 0 ) OR ( %d IN (SELECT author_uid FROM ".$wpdb->base_prefix."symposium_comments WHERE comment_parent = c.cid ) ) ) ) AND c.type != 'photo' ORDER BY c.comment_timestamp DESC LIMIT %d,%d"; $comments = $wpdb->get_results($wpdb->prepare($sql, $uid1, $uid1, $uid1, $limit_from, $limit_count)); } if (WPS_DEBUG) $html .= $wpdb->last_query.'<br />'; // Build wall if ($comments) { $cnt = 0; foreach ($comments as $comment) { $continue = true; if (is_user_logged_in() && $version == "friends_activity" && $uid1 != $uid2 && $comment->author_uid == $uid1 && $comment->subject_uid == $uid1) { $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_comments c WHERE c.comment_parent = %d AND c.is_group != 'on' AND c.author_uid != %d"; if ($wpdb->get_var($wpdb->prepare($sql, $comment->cid, $uid1)) == 0) $continue = false; if (WPS_DEBUG) $html .= $wpdb->last_query.'<br />'; } if ($continue) { if (WPS_DEBUG) $html .= '<br>continue<br>'; $cnt++; $privacy = __wps__get_meta($comment->author_uid, 'wall_share'); if ( ($comment->subject_uid == $uid1) || ($comment->author_uid == $uid1) || (strtolower($privacy) == 'everyone' && $uid2 > 0) || (strtolower($privacy) == 'public') || (strtolower($privacy) == 'friends only' && (__wps__friend_of($comment->author_uid, $uid1) || (__wps__friend_of($comment->author_uid, $uid2) && $version == "stream_activity") ) ) ) { // If a group post and user is not the author we need to check privacy of group settings if ($comment->is_group == 'on' && $comment->author_uid != $uid2) { // If not private group, or a member, then display if ($comment->content_private != 'on' || __wps__member_of($comment->subject_uid) == 'yes') { $private_group = ''; } else { // Otherwise hide $private_group = 'on'; } } else { // Not a group post so not applicable $private_group = ''; } if ($private_group != 'on') { // Check to avoid poke's (as private) if ( ($comment->type != 'poke') || ($comment->type == 'poke' && ($comment->author_uid == $uid2 || $comment->subject_uid == $uid2 )) ) { $comment_div = "<div class='wall_post_div' id='post_".$comment->cid."'>"; // Avatar $comment_inner_div = "<div class='wall_post_avatar'>"; $comment_inner_div .= get_avatar($comment->author_uid, 64); $comment_inner_div .= "</div>"; $user_info = get_user_by('id', $comment->author_uid); if ($user_info && $user_info->user_login != 'nobody') { $comment_inner_div .= '<a href="'.$profile_page.$q.'uid='.$comment->author_uid.'">'.stripslashes($comment->display_name).'</a> '; if ($comment->author_uid != $comment->subject_uid && !$comment->is_group) { $comment_inner_div .= ' → '; $user_info = get_userdata($comment->subject_uid); if ($user_info->user_login != 'nobody') { $comment_inner_div .= '<a href="'.$profile_page.$q.'uid='.$comment->subject_uid.'">'.stripslashes($comment->subject_name).'</a> '; } else { $comment_inner_div .= stripslashes($comment->subject_name).' '; } } } else { $comment_inner_div .= stripslashes($comment->display_name).' '; if ($comment->author_uid != $comment->subject_uid && !$comment->is_group) { $comment_inner_div .= ' → '; $user_info = get_userdata($comment->subject_uid); if ($user_info->user_login != 'nobody') { $comment_inner_div .= '<a href="'.$profile_page.$q.'uid='.$comment->subject_uid.'">'.stripslashes($comment->subject_name).'</a> '; } else { $comment_inner_div .= stripslashes($comment->subject_name).' '; } } } $comment_inner_div .= __wps__time_ago($comment->comment_timestamp)."."; $comment_inner_div .= "<div class='__wps__activity_icons'>"; // Like/dislike icons if (get_option(WPS_OPTIONS_PREFIX.'_activity_likes') && is_user_logged_in() && $comment->author_uid != $uid2 ) { $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND uid = %d"; $already_liked = $wpdb->get_var($wpdb->prepare($sql, $comment->cid, $current_user->ID)); if (!$already_liked) { $comment_inner_div .= "<div class='wall_post_like delete_post_top'>"; $comment_inner_div .= "<img class='wall_add_like' title='".__('You like this.', WPS_TEXT_DOMAIN)."' data-action='like' rel='".$comment->cid."' style='width:20px;height:20px;' src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/good.png' />"; $comment_inner_div .= "<img class='wall_add_like' title='".__('You do not like this.', WPS_TEXT_DOMAIN)."' data-action='dislike' rel='".$comment->cid."' style='width:20px;height:20px' src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/bad.png' />"; $comment_inner_div .= "</div>"; } } // Delete and report $comment_inner_div .= "<div style='width:60px; float:right;height:16px;'>"; if (get_option(WPS_OPTIONS_PREFIX.'_allow_reports') == 'on') { $comment_inner_div .= " <a title='post_".$comment->cid."' href='javascript:void(0);' class='report_post report_post_top symposium_report'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/warning.png' style='width:16px;height:16px' /></a>"; } if (__wps__get_current_userlevel() == 5 || $comment->subject_uid == $uid2 || $comment->author_uid == $uid2) { $comment_inner_div .= " <a title='".$comment->cid."' rel='post' href='javascript:void(0);' class='delete_post delete_post_top'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/delete.png' style='width:16px;height:16px' /></a>"; } $comment_inner_div .= '</div>'; // Likes/Dislikes if (get_option(WPS_OPTIONS_PREFIX.'_activity_likes')) { $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like'"; $likes = $wpdb->get_var($wpdb->prepare($sql, $comment->cid)); $start_likes = $likes; $sql = "SELECT vid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like' AND uid=%d"; $youlike = $wpdb->get_var($wpdb->prepare($sql, $comment->cid, $uid2)); $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike'"; $dislikes = $wpdb->get_var($wpdb->prepare($sql, $comment->cid)); $sql = "SELECT vid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike' AND uid=%d"; $youdislike = $wpdb->get_var($wpdb->prepare($sql, $comment->cid, $uid2)); $comment_inner_div .= "<div id='__wps__likes_".$comment->cid."'>"; if ($likes) { $link = '<a id="symposium_show_likes" href="javascript:void(0)" rel="'.$comment->cid.'">'; $comment_inner_div .= "<img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/good.png' style='width:16px;height:16px' /> "; if ($youlike) { $comment_inner_div .= __('You', WPS_TEXT_DOMAIN); $likes--; if ($likes > 1) { $comment_inner_div .= ' '.sprintf(__('and %s%d others</a> like this.', WPS_TEXT_DOMAIN), $link, $likes); } if ($likes == 1) { $comment_inner_div .= ' '.sprintf(__('and %s1 other</a> person likes this.', WPS_TEXT_DOMAIN), $link); } if ($likes == 0) { $comment_inner_div .= ' '.__('like this.', WPS_TEXT_DOMAIN); } } else { if ($likes > 1) { $comment_inner_div .= sprintf(__('%s%d people</a> like this.', WPS_TEXT_DOMAIN), $link, $likes); } if ($likes == 1) { $sql = "SELECT uid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like'"; $uid = $wpdb->get_var($wpdb->prepare($sql, $comment->cid)); $comment_inner_div .= __wps__profile_link($uid).' '.__('likes this.', WPS_TEXT_DOMAIN); } } } if ($dislikes) { if ($start_likes) $comment_inner_div .= '<br />'; $link = '<a id="symposium_show_likes" href="javascript:void(0)" rel="'.$comment->cid.'">'; $comment_inner_div .= "<img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/bad.png' style='width:16px;height:16px' /> "; if ($youdislike) { $comment_inner_div .= __('You', WPS_TEXT_DOMAIN); $dislikes--; if ($dislikes > 1) { $comment_inner_div .= ' '.sprintf(__('and %s%d others</a> don\'t like this.', WPS_TEXT_DOMAIN), $link, $dislikes); } if ($dislikes == 1) { $comment_inner_div .= ' '.sprintf(__('and %s1 other</a> person don\'t like this.', WPS_TEXT_DOMAIN), $link); } if ($dislikes == 0) { $comment_inner_div .= ' '.__('don\'t like this.', WPS_TEXT_DOMAIN); } } else { if ($dislikes > 1) { $comment_inner_div .= sprintf(__('%s%d people</a> don\'t like this.', WPS_TEXT_DOMAIN), $link, $dislikes); } if ($dislikes == 1) { $sql = "SELECT uid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike'"; $uid = $wpdb->get_var($wpdb->prepare($sql, $comment->cid)); $comment_inner_div .= __wps__profile_link($uid).' '.__('doesn\'t like this.', WPS_TEXT_DOMAIN); } } } $comment_inner_div .= "</div>"; } $comment_inner_div .= "</div>"; // Always show reply fields or not? $show_class = (get_option(WPS_OPTIONS_PREFIX.'_profile_comments')) ? '' : 'symposium_wall_replies'; $show_field = (get_option(WPS_OPTIONS_PREFIX.'_profile_comments')) ? '' : 'display:none;'; // $text = the comment $text = $comment->comment; // Added to or comment on a gallery if ($comment->type == 'gallery' && strpos($text, '[]')) { $lib = explode('[]', $text); $text = '<div style="width:100%">'; // Add message $text .= $lib[0].'<br />'; $action = $lib[2]; $aid = $lib[1]; if ($action == 'comment') { $single_iid = $lib[3]; $comment_text = $lib[4]; } // Get album title $sql = "SELECT name FROM ".$wpdb->base_prefix."symposium_gallery WHERE gid = %d"; $album_title = $wpdb->get_var($wpdb->prepare($sql, $aid)); $text .= '<div id="wps_gallery_album_name_'.$aid.'" style="display:none">'.stripslashes($album_title).'</div>'; // Get images $sql = "SELECT * FROM ".$wpdb->base_prefix."symposium_gallery_items WHERE gid = %d ORDER BY photo_order"; $photos = $wpdb->get_results($wpdb->prepare($sql, $aid)); $cnt = 0; if ($photos) { foreach ($photos as $photo) { $cnt++; // DB or Filesystem? if (get_option(WPS_OPTIONS_PREFIX.'_img_db') == "on") { $thumb_src = WP_CONTENT_URL."/plugins/wp-symposium/get_album_item.php?iid=".$photo->iid."&size=photo"; } else { $thumb_src = get_option(WPS_OPTIONS_PREFIX.'_img_url').'/members/'.$photo->owner.'/media/'.$aid.'/thumb_'.$photo->name; } $image = $thumb_src; $iid = $photo->iid; $name = $photo->title; if (($action == 'added' && $cnt == 1) || ($action == 'comment' && $iid == $single_iid)) { $image = preg_replace('/thumb_/', 'show_', $image, 1); $title = ''; $text .= '<a class="__wps__photo_cover_action wps_gallery_album" data-name="'.stripslashes($title).'" data-iid="'.$iid.'" href="'.$image.'" rev="'.$cnt.'" rel="symposium_gallery_photos_'.$aid.'" title="'.$name.'">'; $text .= '<img class="profile_activity_gallery_first_image" src="'.$image.'" /><br />'; $text .= '</a>'; } if ($action == 'added') { if (sizeof($photos) > 2) { if ($cnt == 2) { $text .= '<div id="wps_comment_plus" style="height:55px;overflow:hidden;width:100%">'; } if ($cnt > 1 && $cnt <= sizeof($photos)) { $text .= '<a class="__wps__photo_cover_action wps_gallery_album" data-name="'.stripslashes($title).'" data-owner="'.$photo->owner.'" data-iid="'.$iid.'" href="'.$image.'" rev="'.$cnt.'" rel="symposium_gallery_photos_'.$aid.'" title="'.$name.'">'; $text .= '<img style="width:50px;height:50px;margin-right:5px;margin-bottom:5px;float:left;" src="'.$image.'" />'; $text .= '</a>'; } if ($cnt == sizeof($photos)) { $text .= '</div>'; } } } else { if ($iid != $single_iid) { if (!isset($title)) $title = ''; $text .= '<a class="__wps__photo_cover_action wps_gallery_album" data-name="'.stripslashes($title).'" data-iid="'.$iid.'" href="'.$image.'" rev="'.$cnt.'" rel="symposium_gallery_photos_'.$aid.'" title="'.$name.'">'; $text .= '<img style="display:none;" src="'.$image.'" />'; $text .= '</a>'; } } } if ($cnt > 7 && $action == 'added') { $text .= '<div id="wps_gallery_comment_more" style="clear:both;cursor:pointer">'; $text .= __('more...', WPS_TEXT_DOMAIN).'</div>'; } } if ($action == 'comment') { $text .= $comment_text; } $text .= '</div>'; } // Check for any associated uploaded images for activity $directory = WP_CONTENT_DIR."/wps-content/members/".$comment->subject_uid.'/activity/'; if (file_exists($directory)) { $handler = opendir($directory); while ($image = readdir($handler)) { $path_parts = pathinfo($image); if ($path_parts['filename'] == $comment->cid) { $directoryURL = WP_CONTENT_URL."/wps-content/members/".$comment->subject_uid.'/activity/'.$image; $text .= '<div style="margin-bottom:5px"></div>'; // sort out text for title bar of dialog box if (strlen($comment->comment) < 75) { $title_bar = $comment->comment; } else { $title_bar = substr($comment->comment, 0, 75).'...'; } // remove emoticons to avoid breaking image link to popup $remove = array("{{", "}}", ":)",";)",":-)",":(",":'(",":x",":X",":D",":|",":?",":z",":P"); foreach ($remove as $key => $value){ $title_bar = str_replace($value, "", $title_bar); } // rev = this image to default on (would be a count of all images included) // rel = the 'group' of images to be included $text .= "<a target='_blank' href='".$directoryURL."' rev='1' rel='symposium_activity_images_".$comment->cid."' data-owner='".$comment->subject_uid."' data-name='".$title_bar."' data-iid='".$comment->cid."' class='wps_gallery_album'>"; $text .= '<img class="profile_activity_image" src="'.$directoryURL.'" />'; $text .= '</a>'; } } } // Finally show comment...! $text = stripslashes($text); $comment_inner_div .= '<div class="next_comment '.$show_class.'" id="'.$comment->cid.'">'; if ($comment->is_group) { $url = __wps__get_url('group'); $q = __wps__string_query($url); $url .= $q.'gid='.$comment->subject_uid.'&post='.$comment->cid; $group_name = $wpdb->get_var($wpdb->prepare("SELECT name FROM ".$wpdb->base_prefix."symposium_groups WHERE gid = %d", $comment->subject_uid)); $comment_inner_div .= __("Group post in", WPS_TEXT_DOMAIN)." <a href='".$url."'>".stripslashes($group_name)."</a>: ".__wps__make_url($text); } else { $comment_inner_div .= __wps__make_url($text); } $comment_inner_div = apply_filters( '__wps__activity_row_item_filter', $comment_inner_div, $comment ); // Replies +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $sql = "SELECT c.*, u.display_name FROM ".$wpdb->base_prefix."symposium_comments c LEFT JOIN ".$wpdb->base_prefix."users u ON c.author_uid = u.ID LEFT JOIN ".$wpdb->base_prefix."symposium_comments p ON c.comment_parent = p.cid WHERE c.comment_parent = %d AND c.is_group != 'on' ORDER BY c.cid"; $replies = $wpdb->get_results($wpdb->prepare($sql, $comment->cid)); $count = 0; if ($replies) { if (count($replies) > 4) { $comment_inner_div .= "<div id='view_all_comments_div'>"; $comment_inner_div .= "<a title='".$comment->cid."' class='view_all_comments' href='javascript:void(0);'>".__(sprintf("View all %d comments", count($replies)), WPS_TEXT_DOMAIN)."</a>"; $comment_inner_div .= "</div>"; } foreach ($replies as $reply) { $count++; if ($count > count($replies)-4) { $reply_style = ""; } else { $reply_style = "display:none; "; } $comment_inner_div .= "<div id='".$reply->cid."' class='reply_div' style='".$reply_style."'>"; $comment_inner_div .= "<div class='__wps__wall_reply_div'>"; $comment_inner_div .= "<div class='wall_reply'>"; $comment_inner_div .= '<a href="'.$profile_page.$q.'uid='.$reply->author_uid.'">'.stripslashes($reply->display_name).'</a> '; $comment_inner_div .= __wps__time_ago($reply->comment_timestamp)."."; $comment_inner_div .= '<div style="width:50px; float:right;">'; if (get_option(WPS_OPTIONS_PREFIX.'_allow_reports') == 'on') { $comment_inner_div .= " <a title='post_".$reply->cid."' href='javascript:void(0);' style='padding:0px' class='report_post symposium_report reply_warning'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/warning.png' style='width:14px;height:14px' /></a>"; } // Like/dislike icons for reply if (get_option(WPS_OPTIONS_PREFIX.'_activity_likes') && is_user_logged_in() && $reply->author_uid != $uid2 ) { $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND uid = %d"; $already_liked = $wpdb->get_var($wpdb->prepare($sql, $reply->cid, $current_user->ID)); if (!$already_liked) { $comment_inner_div .= "<div class='wall_post_like delete_reply' style='margin:0;padding:0;'>"; $comment_inner_div .= "<img class='wall_add_like' title='".__('You like this.', WPS_TEXT_DOMAIN)."' data-action='like' rel='".$reply->cid."' style='padding:0;width:20px;height:20px;' src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/good.png' />"; $comment_inner_div .= "<img class='wall_add_like' title='".__('You do not like this.', WPS_TEXT_DOMAIN)."' data-action='dislike' rel='".$reply->cid."' style='padding:0;width:20px;height:20px' src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/bad.png' />"; $comment_inner_div .= "</div>"; } } if (__wps__get_current_userlevel($uid2) == 5 || $reply->subject_uid == $uid2 || $reply->author_uid == $uid2) { $comment_inner_div .= " <a title='".$reply->cid."' rel='reply' href='javascript:void(0);' style='padding:0px' class='delete_post delete_reply'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/delete.png' style='width:14px;height:14px' /></a>"; } $comment_inner_div .= '</div>'; $comment_inner_div .= "<br />"; // Likes/Dislikes for replies if (get_option(WPS_OPTIONS_PREFIX.'_activity_likes')) { $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like'"; $likes = $wpdb->get_var($wpdb->prepare($sql, $reply->cid)); $start_likes = $likes; $sql = "SELECT vid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like' AND uid=%d"; $youlike = $wpdb->get_var($wpdb->prepare($sql, $reply->cid, $uid2)); $sql = "SELECT COUNT(*) FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike'"; $dislikes = $wpdb->get_var($wpdb->prepare($sql, $reply->cid)); $sql = "SELECT vid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike' AND uid=%d"; $youdislike = $wpdb->get_var($wpdb->prepare($sql, $reply->cid, $uid2)); $comment_inner_div .= "<div id='__wps__likes_".$reply->cid."'>"; if ($likes) { $link = '<a id="symposium_show_likes" href="javascript:void(0)" rel="'.$reply->cid.'">'; $comment_inner_div .= "<img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/good.png' style='width:16px;height:16px' /> "; if ($youlike) { $comment_inner_div .= __('You', WPS_TEXT_DOMAIN); $likes--; if ($likes > 1) { $comment_inner_div .= ' '.sprintf(__('and %s%d others</a> like this.', WPS_TEXT_DOMAIN), $link, $likes); } if ($likes == 1) { $comment_inner_div .= ' '.sprintf(__('and %s1 other person</a> likes this.', WPS_TEXT_DOMAIN), $link); } if ($likes == 0) { $comment_inner_div .= ' '.__('like this.', WPS_TEXT_DOMAIN); } } else { if ($likes > 1) { $comment_inner_div .= sprintf(__('%s%d people</a> like this.', WPS_TEXT_DOMAIN), $link, $likes); } if ($likes == 1) { $sql = "SELECT uid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'like'"; $uid = $wpdb->get_var($wpdb->prepare($sql, $reply->cid)); $comment_inner_div .= __wps__profile_link($uid).' '.__('likes this.', WPS_TEXT_DOMAIN); } } } if ($dislikes) { if ($start_likes) $comment_inner_div .= '<br />'; $link = '<a id="symposium_show_likes" href="javascript:void(0)" rel="'.$reply->cid.'">'; $comment_inner_div .= "<img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/smilies/bad.png' style='width:16px;height:16px' /> "; if ($youdislike) { $comment_inner_div .= __('You', WPS_TEXT_DOMAIN); $dislikes--; if ($dislikes > 1) { $comment_inner_div .= ' '.sprintf(__('and %s%d others</a> don\'t like this.', WPS_TEXT_DOMAIN), $link, $dislikes); } if ($dislikes == 1) { $comment_inner_div .= ' '.sprintf(__('and %s1 other</a> person don\'t like this.', WPS_TEXT_DOMAIN), $link); } if ($dislikes == 0) { $comment_inner_div .= ' '.__('don\'t like this.', WPS_TEXT_DOMAIN); } } else { if ($dislikes > 1) { $comment_inner_div .= sprintf(__('%s%d people</a> don\'t like this.', WPS_TEXT_DOMAIN), $link, $dislikes); } if ($dislikes == 1) { $sql = "SELECT uid FROM ".$wpdb->base_prefix."symposium_likes WHERE cid = %d AND type = 'dislike'"; $uid = $wpdb->get_var($wpdb->prepare($sql, $reply->cid)); $comment_inner_div .= __wps__profile_link($uid).' '.__('doesn\'t like this.', WPS_TEXT_DOMAIN); } } } $comment_inner_div .= "</div>"; } $comment_inner_div .= __wps__make_url(stripslashes($reply->comment)); $comment_inner_div .= "</div>"; $comment_inner_div .= "</div>"; $comment_inner_div .= "<div class='wall_reply_avatar'>"; $comment_inner_div .= get_avatar($reply->author_uid, 40); $comment_inner_div .= "</div>"; $comment_inner_div .= "</div>"; } } else { $comment_inner_div .= "<div class='no_wall_replies'></div>"; } $comment_inner_div .= "<div style='clear:both;' id='__wps__comment_".$comment->cid."'></div>"; // Reply (comment) field if ( (is_user_logged_in()) && ( ($uid1 == $uid2) || ( strtolower($privacy) == 'everyone' || strtolower($privacy) == 'public' || (strtolower($privacy) == 'friends only' && $is_friend) || ($version = "stream_activity" && strtolower($privacy) == 'friends only' && __wps__friend_of($comment->author_uid, $current_user->ID)) ) ) ) { if ($comment->type != 'gallery' && $comment->type != 'friend') { $comment_inner_div .= '<div style="margin-top:5px;'.$show_field.'" id="__wps__reply_div_'.$comment->cid.'" >'; $comment_inner_div .= '<textarea title="'.$comment->cid.'" class="__wps__reply'; if (get_option(WPS_OPTIONS_PREFIX.'_elastic')) $comment_inner_div .= ' elastic'; $comment_inner_div .= '" id="__wps__reply_'.$comment->cid.'" onblur="this.value=(this.value==\'\') ? \''.__('Write a comment...', WPS_TEXT_DOMAIN).'\' : this.value;" onfocus="this.value=(this.value==\''.__('Write a comment...', WPS_TEXT_DOMAIN).'\') ? \'\' : this.value;">'.__('Write a comment...', WPS_TEXT_DOMAIN).'</textarea>'; if (get_option(WPS_OPTIONS_PREFIX.'_show_buttons')) { $comment_inner_div .= '<br /><input title="'.$comment->cid.'" type="submit" style="width:75px;'.$button_style.'" class="__wps__button symposium_add_reply" value="'.__('Add', WPS_TEXT_DOMAIN).'" />'; } $comment_inner_div .= '<input id="symposium_author_'.$comment->cid.'" type="hidden" value="'.$comment->subject_uid.'" />'; $comment_inner_div .= '</div>'; } } $comment_inner_div .= "</div>"; $comment_inner_div = apply_filters( '__wps__activity_item_inner_filter', $comment_inner_div ); $comment_div .= $comment_inner_div."</div>"; $comment_div = apply_filters( '__wps__activity_item_filter', $comment_div ); // Check if forcing UTF8 (to handle umlets, etc) if (get_option(WPS_OPTIONS_PREFIX.'_force_utf8') == 'on') $comment_div = utf8_decode($comment_div); $html .= $comment_div; } } } else { // Protected by privacy settings } } // Comment by member with no replies and looking at friends activity } $id = 'wall'; if ($version == "all_activity" || $version == "stream_activity") { $id='all'; } if ($version == "friends_activity") { $id='activity'; } if ($post == '' && $cnt > 0) { // Set next comment to show // old version was $next (regression testing) = $limit_from+$cnt+1; $next = $limit_from+$limit_count; if (is_user_logged_in()) $html .= "<a href='javascript:void(0)' id='".$id."' class='showmore_wall' title='".($next)."'>".__("more...", WPS_TEXT_DOMAIN)."</a>"; } else { if ($post == '') { $html .= "<br />".__("Nothing to show, sorry.", WPS_TEXT_DOMAIN); } } } else { $html .= "<br />".__("Nothing to show, sorry.", WPS_TEXT_DOMAIN); } $html .= "</div>"; } else { if ($version == "friends_activity") { $html .= '<p>'.__("Sorry, this member has chosen not to share their activity.", WPS_TEXT_DOMAIN); } if ($version == "wall") { $html .= '<p>'.__("Sorry, this member has chosen not to share their activity.", WPS_TEXT_DOMAIN); } } return $html; // return __wps__buffer($html); } else { return __wps__show_login_link(__("Please <a href='%s'>login</a> to view this member's profile.", WPS_TEXT_DOMAIN), false); } return $html; }
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; }
// Get mail message if ($action == "deactivate_debug") { global $wpdb; if (is_user_logged_in() && __wps__get_current_userlevel()==5) { update_option(WPS_OPTIONS_PREFIX.'_debug_mode', ''); } else { echo __('Only site administrators can de-activate debug mode.', WPS_TEXT_DOMAIN); } exit; } // Get mail message if ($action == "get_mail_message") { global $wpdb; if (is_user_logged_in() && __wps__get_current_userlevel()) { $sql = "SELECT m.*, u1.display_name as u1_display_name, u2.display_name as u2_display_name FROM ".$wpdb->base_prefix."symposium_mail m LEFT JOIN ".$wpdb->base_prefix."users u1 on m.mail_from = u1.ID LEFT JOIN ".$wpdb->base_prefix."users u2 on m.mail_to = u2.ID WHERE mail_mid = %d LIMIT 0,1"; $message = $wpdb->get_row($wpdb->prepare($sql, $_POST['mail_mid'])); $r = __('From', WPS_TEXT_DOMAIN).': '.$message->u1_display_name.'<br />'; $r .= __('To', WPS_TEXT_DOMAIN).': '.$message->u2_display_name; $r .= '<p style="font-style:italic">'.__('Sent', WPS_TEXT_DOMAIN).': '.$message->mail_sent.'</p>'; $r .= '<p style="font-weight:bold">'.__('Subject', WPS_TEXT_DOMAIN).': '.stripslashes($message->mail_subject).'</p>'; $r .= '<p>'.stripslashes($message->mail_message).'</p>'; echo $r; } else { echo 'ACCESS DENIED'; } exit;
function __wps__forum($atts) { global $wpdb, $current_user; $level = __wps__get_current_userlevel(); $html = ''; $topic_id = ''; extract( shortcode_atts( array( 'cat' => '' ), $atts, WPS_SHORTCODE_PREFIX.'-forum' ) ); $cat_id = $cat; // resolve stubs if using permalinks if ( get_option(WPS_OPTIONS_PREFIX.'_permalink_structure') && get_query_var('stub')) { $stubs = explode('/', get_query_var('stub')); $stub0 = $stubs[0]; $stub1 = $stubs[1]; if (WPS_DEBUG) echo $stub0.'/'.$stub1.'<br />'; if ($stub0 && get_option(WPS_OPTIONS_PREFIX.'_permalinks_cats')) { // Two parameters, so go to topic $cat_id = __wps__get_stub_id($stub0, 'forum-cat'); $topic_id = __wps__get_stub_id($stub1, 'forum-topic'); if (!$cat_id) $cat_id = ''; if (!$topic_id) $topic_id = ''; if (WPS_DEBUG) echo '(1):'.$cat_id.'/'.$topic_id.' ('.$stub0.'/'.$stub1.')<br />'; } else { // One parameter, so go to category if ($stub0) $stub1 = $stub0; $cat_id = __wps__get_stub_id($stub1, 'forum-cat'); if (WPS_DEBUG) echo '(2):'.$cat_id.' ('.$stub1.')<br />'; if (!$cat_id) { // Couldn't find category, so look for topic instead $cat_id = ''; $topic_id = __wps__get_stub_id($stub1, 'forum-topic'); if (WPS_DEBUG) echo '(3):'.$topic_id.' ('.$stub1.')<br />'; if (!$topic_id) $topic_id = ''; } } $html .= "<div id='symposium_perma_cat_id' style='display:none'>".$cat_id."</div>"; $html .= "<div id='symposium_perma_topic_id' style='display:none'>".$topic_id."</div>"; } // not using AJAX (or permalinks not found, for backward compatibility with old links) if ( ( $topic_id == '' && $cat_id == '') || ( !$cat_id != '' && get_option(WPS_OPTIONS_PREFIX.'_forum_ajax') && !get_option(WPS_OPTIONS_PREFIX.'_permalink_structure') ) ) { $cat_id = isset($_GET['cid']) ? $_GET['cid'] : 0; $topic_id = isset($_GET['show']) ? $_GET['show'] : 0; } // Wrapper $html .= "<div class='__wps__wrapper'>"; // Check to see if this member is in the included list of roles $user = get_userdata( $current_user->ID ); $can_view = false; $viewer = str_replace('_', '', str_replace(' ', '', strtolower(get_option(WPS_OPTIONS_PREFIX.'_viewer')))); if (is_user_logged_in()) { $capabilities = $user->{$wpdb->base_prefix.'capabilities'}; if ($capabilities) { foreach ( $capabilities as $role => $name ) { if ($role) { $role = strtolower($role); $role = str_replace(' ', '', $role); $role = str_replace('_', '', $role); if (WPS_DEBUG) $html .= 'Checking global forum (symposium_forum) role '.$role.' against '.$viewer.'<br />'; if (strpos($viewer, $role) !== FALSE) $can_view = true; } } } else { // No WordPress role stored } } $everyone = str_replace(' ', '', strtolower(__('everyone', WPS_TEXT_DOMAIN))); // Deal with some foreign translations of 'everyone' if ( $can_view || strpos($viewer, $everyone) !== FALSE ) { $html .= "<div id='__wps__forum_div'>"; if ( get_option(WPS_OPTIONS_PREFIX.'_permalink_structure') || !get_option(WPS_OPTIONS_PREFIX.'_forum_ajax') ) { if ($topic_id == 0) { $forum = __wps__getForum($cat_id); if (($x = strpos($forum, '[|]')) !== FALSE) $forum = substr($forum, $x+3); $html .= $forum; } else { $html .= __wps__getTopic($topic_id); } } $html .= "</div>"; } else { $html .= "<p>".__("Sorry, but you are not permitted to view the forum.", WPS_TEXT_DOMAIN)."</p>"; if (__wps__get_current_userlevel() == 5) $html .= sprintf(__('Permissions are set via the WordPress admin dashboard->%s->Options->Forum.', WPS_TEXT_DOMAIN), WPS_WL_SHORT); } $html .= "</div>"; // End Wrapper $html .= "<div style='clear: both'></div>"; // Send HTML return $html; }
function __wps__groups() { global $wpdb, $current_user; // View (and set tabs) if (!isset($_GET['view']) || $_GET['term'] != '') { $browse_active = 'active'; $create_active = 'inactive'; $view = "browse"; } if ( isset($_GET['view']) && $_GET['view'] == "create") { $browse_active = 'inactive'; $create_active = 'active'; $view = "create"; } $thispage = get_permalink(); if ($thispage[strlen($thispage)-1] != '/') { $thispage .= '/'; } $group_url = get_option(WPS_OPTIONS_PREFIX.'_group_url'); $group_all_create = get_option(WPS_OPTIONS_PREFIX.'_group_all_create'); if (isset($_GET['page_id']) && $_GET['page_id'] != '') { // No Permalink $thispage = $group_url; $q = "&"; } else { $q = "?"; } if (isset($_GET['term'])) { $term = $_GET['term']; } else { $term = ''; } $html = '<div class="__wps__wrapper">'; if ( (is_user_logged_in()) && ($group_all_create == "on" || __wps__get_current_userlevel() == 5) ) { $html .= "<input type='submit' id='show_create_group_button' class='__wps__button' value='".__("Create Group", WPS_TEXT_DOMAIN)."'>"; $html .= "<div id='create_group_form' style='display:none'>"; $html .= "<div>"; $html .= "<strong>".__("Name of Group", WPS_TEXT_DOMAIN)."</strong><br />"; $html .= "<input type='text' id='name_of_group' class='new-topic-subject-input' style='width: 98% !important;'>"; $html .= "</div>"; $html .= "<div>"; $html .= "<strong>".__("Description", WPS_TEXT_DOMAIN)."</strong><br />"; $html .= "<input type='text' id='description_of_group' style='width: 98% !important;'>"; $html .= "</div>"; $html .= "<div style='margin-top:10px'>"; $html .= "<input type='submit' id='create_group_button' class='__wps__button' value='".__("Create", WPS_TEXT_DOMAIN)."'>"; $html .= "<input type='submit' id='cancel_create_group_button' class='__wps__button' value='".__("Cancel", WPS_TEXT_DOMAIN)."'>"; $html .= "</div>"; $html .= "</div>"; } $html .= "<div id='groups_results'>"; if ( $term != '' ) { $me = $current_user->ID; $page = 1; $page_length = 25; $term = ""; if (isset($_POST['group'])) { $term .= $_POST['group']; } if (isset($_GET['term'])) { $term .= $_GET['term']; } $html .= "<div style='padding:0px;'>"; $html .= '<input type="text" id="group" name="group" autocomplete="off" class="groups_search_box" value="'.$term.'" style="margin-right:10px" />'; $html .= '<input type="hidden" id="group_id" name="group_id" />'; $html .= '<input id="groups_go_button" type="submit" class="__wps__button" value="'.__("Search", WPS_TEXT_DOMAIN).'" />'; $html .= "</div>"; $sql = "SELECT g.*, (SELECT COUNT(*) FROM ".$wpdb->prefix."symposium_group_members WHERE group_id = g.gid) AS member_count FROM ".$wpdb->prefix."symposium_groups g WHERE ( g.name LIKE '%".$term."%') OR ( g.description LIKE '%".$term."%' ) ORDER BY group_order, last_activity DESC LIMIT 0,25"; $groups = $wpdb->get_results($sql); if ($groups) { foreach ($groups as $group) { if (__wps__member_of($group->gid) == 'yes') { $html .= "<div class='groups_row row_odd corners'>"; } else { $html .= "<div class='groups_row row corners'>"; } $html .= "<div class='groups_avatar'>"; $html .= __wps__get_group_avatar($group->gid, 64); $html .= "</div>"; $html .= "<div class='group_name'>"; $name = stripslashes($group->name) != '' ? stripslashes($group->name) : __('[No name]', WPS_TEXT_DOMAIN); $html .= "<a class='row_link' href='".__wps__get_url('group')."?gid=".$group->gid."'>".$name."</a>"; $html .= "</div>"; $html .= "<div class='group_member_count'>"; $html .= __("Member Count:", WPS_TEXT_DOMAIN)." ".$group->member_count; if ($group->last_activity) { $html .= '<br /><em>'.__('last active', WPS_TEXT_DOMAIN).' '.__wps__time_ago($group->last_activity)."</em>"; } $html .= "</div>"; $html .= "<div class='group_description'>"; $html .= $group->description; $html .= "</div>"; $html .= "</div>"; } } } else { $html .= "<div style='padding:0px;'>"; $html .= '<input type="text" id="__wps__group" name="group" autocomplete="off" class="groups_search_box" value="'.$term.'" style="margin-right:10px" />'; $html .= '<input type="hidden" id="group_id" name="group_id" />'; $html .= '<input id="groups_go_button" type="submit" class="__wps__button" value="'.__("Search", WPS_TEXT_DOMAIN).'" />'; $html .= "</div>"; $html .= "<div id='__wps__groups'><img src='".get_option(WPS_OPTIONS_PREFIX.'_images')."/busy.gif' /></div>"; } $html .= "</div>"; // End of Groups Results if (isset($groups) && !$groups) $html .= "<div style='clear:both'>".__("No group found....", WPS_TEXT_DOMAIN)."</div>"; $html .= '</div>'; // End of Wrapper // Send HTML return $html; }
$row_array['avatar'] = get_avatar($item->owner, 40); $row_array['city'] = __('Page', WPS_TEXT_DOMAIN); $row_array['country'] = ''; $row_array['url'] = home_url().'/?p='.$item->url; $row_array['country'] = ''; $row_array['id'] = $item->ID; $row_array['value'] = $item->ID; $row_array['name'] = str_replace(' ', ' ', stripslashes(strip_tags($item->display_name))); $row_array['type'] = $item->type; $row_array['owner'] = $item->owner; $row_array['url'] = $item->url; array_push($return_arr,$row_array); } break; case 'gallery': if ( ($item->owner == $current_user->ID) || (strtolower($item->sharing) == 'public') || (is_user_logged_in() && strtolower($item->sharing) == 'everyone') || (strtolower($item->sharing) == 'public') || (strtolower($item->sharing) == 'friends only' && __wps__friend_of($item->owner, $current_user->ID)) || __wps__get_current_userlevel() == 5) { if (!$done_gallery) { $row_array['name'] = __('PHOTO ALBUMS', WPS_TEXT_DOMAIN); $row_array['type'] = 'sep'; array_push($return_arr,$row_array); $done_gallery = true; } $row_array['avatar'] = get_avatar($item->ID, 40); $row_array['city'] = __('Photo Album', WPS_TEXT_DOMAIN); $row_array['country'] = ''; $row_array['country'] = ''; $row_array['id'] = $item->ID; $row_array['value'] = $item->ID; $row_array['name'] = str_replace(' ', ' ', stripslashes(strip_tags($item->display_name))); $row_array['type'] = $item->type; $row_array['owner'] = $item->owner; $row_array['url'] = $item->url; array_push($return_arr,$row_array); } break; case 'group':