/** * Standard modular render function for profile tab hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return array A triple: The tab title, the tab contents, the suggested tab order */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { enforce_personal_access($member_id_of, NULL, NULL, $member_id_viewing); require_lang('filedump'); $title = do_lang_tempcode('FILE_DUMP'); $order = 70; if ($leave_to_ajax_if_possible) { return array($title, NULL, $order); } $content = do_template('OCF_MEMBER_PROFILE_FILEDUMP', array('MEMBER_ID' => strval($member_id_of))); return array($title, $content, $order); }
/** * Interface to subscribe for reminders to an event. * * @return tempcode The UI */ function subscribe_event() { $title = get_page_title('SUBSCRIBE_EVENT'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CALENDAR')))); // Check access $id = get_param_integer('id'); check_specific_permission('view_calendar'); $rows = $GLOBALS['SITE_DB']->query_select('calendar_events', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $event = $rows[0]; if ($event['e_is_public'] == 0) { enforce_personal_access($event['e_submitter'], 'view_personal_events'); } if (!has_category_access(get_member(), 'calendar', strval($event['e_type']))) { access_denied('CATEGORY_ACCESS'); } require_code('form_templates'); $post_url = build_url(array('page' => '_SELF', 'type' => '_subscribe_event', 'id' => $id), '_SELF'); $fields = new ocp_tempcode(); $fields->attach(form_input_float(do_lang_tempcode('REMINDER_TIME'), do_lang_tempcode('DESCRIPTION_REMINDER_TIME'), 'hours_before', 1.0, true)); $submit_name = do_lang_tempcode('SUBSCRIBE_EVENT'); return do_template('FORM_SCREEN', array('_GUID' => '8f6a962617031264ee1af552701804ca', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'TITLE' => $title, 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name)); }
/** * The UI to choose a chat room. * * @return tempcode The UI */ function chat_lobby() { require_javascript('javascript_ajax_people_lists'); // Who are we viewing the lobby of? $member_id = get_param_integer('member_id', get_member()); if (!is_guest($member_id)) { enforce_personal_access($member_id); } // Starting an IM? The IM will popup by AJAX once the page loads, because it's in the system now $enter_im = get_param_integer('enter_im', NULL); if (!is_null($enter_im) && !is_guest()) { $test = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'chat_rooms WHERE is_im=1 AND allow_list LIKE \'' . db_encode_like('%' . strval($enter_im) . '%') . '\''); $found_one = false; foreach ($test as $t) { if (check_chatroom_access($t, true, $enter_im) && check_chatroom_access($t, true, get_member())) { $found_one = true; } } if (!$found_one) { require_code('chat2'); add_chatroom('', $GLOBALS['FORUM_DRIVER']->get_username(get_member()), get_member(), strval(get_member()) . ',' . strval($enter_im), '', '', '', user_lang(), 1); } } // And empty IM conversations $old_dead_ims = $GLOBALS['SITE_DB']->query('SELECT r.* FROM ' . get_table_prefix() . 'chat_rooms r JOIN ' . get_table_prefix() . 'chat_events e ON e.e_room_id=r.id AND ' . db_string_equal_to('e.e_type_code', 'JOIN_IM') . ' LEFT JOIN ' . get_table_prefix() . 'chat_messages m ON m.room_id=r.id WHERE r.is_im=1 AND e_date_and_time<' . strval(time() - CHAT_EVENT_PRUNE) . ' AND m.id IS NULL'); foreach ($old_dead_ims as $old) { require_code('chat2'); delete_chatroom($old['id']); } // Prune chat events $GLOBALS['SITE_DB']->query('DELETE FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_events WHERE e_date_and_time<' . strval(time() - CHAT_EVENT_PRUNE)); enter_chat_lobby(); // Generic stuff: Title, feed URL $title = get_page_title('CHAT_LOBBY'); $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=chat&filter='; // Rooms $rows = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('is_im' => 0), 'ORDER BY room_name DESC', 200); if (count($rows) == 200) { $rows = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('is_im' => 0, 'allow_list' => ''), 'ORDER BY room_name DESC', 200); } $fields = new ocp_tempcode(); foreach ($rows as $myrow) { // Check to see if we are on the room's allow list, if we aren't, don't display the room :D $showroom = check_chatroom_access($myrow, true, $member_id); if (!handle_chatroom_pruning($myrow) && $showroom) { $users = get_chatters_in_room($myrow['id']); $usernames = get_chatters_in_room_tpl($users); //$url=build_url(array('page'=>'_SELF','mode'=>$mode,'type'=>'room','id'=>$myrow['id']),'_SELF'); $url = build_url(array('page' => '_SELF', 'type' => 'room', 'id' => $myrow['id']), '_SELF'); $room_link = do_template('CHAT_ROOM_LINK', array('PRIVATE' => $myrow['allow_list'] != '' || $myrow['allow_list_groups'] != '', 'ID' => strval($myrow['id']), 'NAME' => $myrow['room_name'], 'USERNAMES' => $usernames, 'URL' => $url)); $fields->attach($room_link); } } // Extra links if (has_actual_page_access($member_id, 'cms_chat')) { $modlink = hyperlink(build_url(array('page' => 'cms_chat'), get_module_zone('cms_chat')), do_lang_tempcode('CHAT_MOD_PANEL')); } else { $modlink = new ocp_tempcode(); } if (!is_guest()) { $blocking_link = hyperlink(build_url(array('page' => '_SELF', 'type' => 'blocking_interface'), '_SELF'), do_lang_tempcode('MEMBER_BLOCKING')); } else { $blocking_link = new ocp_tempcode(); } if (has_specific_permission($member_id, 'create_private_room') && !is_guest()) { $private_room = hyperlink(build_url(array('page' => '_SELF', 'type' => 'private'), '_SELF'), do_lang_tempcode('CREATE_PRIVATE_ROOM')); } else { $private_room = new ocp_tempcode(); } // Buddy list and IM if ($member_id == get_member() && !is_guest()) { $post_url_add_buddy = build_url(array('page' => '_SELF', 'type' => 'buddy_add', 'redirect' => get_self_url(true)), '_SELF'); $post_url_remove_buddies = build_url(array('page' => '_SELF', 'type' => 'buddy_remove', 'redirect' => get_self_url(true)), '_SELF'); } else { $post_url_add_buddy = new ocp_tempcode(); $post_url_remove_buddies = new ocp_tempcode(); } $online_url = $GLOBALS['FORUM_DRIVER']->online_members_url(); $can_im = has_specific_permission(get_member(), 'start_im'); $buddies = array(); $buddy_rows = $GLOBALS['SITE_DB']->query_select('chat_buddies', array('*'), array('member_likes' => $member_id), 'ORDER BY date_and_time', 100); $buddy_active = get_chatters_in_room(NULL); global $SESSION_CACHE; $users_online_time_seconds = CHAT_ACTIVITY_PRUNE; foreach ($buddy_rows as $buddy) { if (array_key_exists($buddy['member_liked'], $buddy_active) && !member_blocked(get_member(), $buddy['member_liked'])) { $online_text = do_lang_tempcode('ACTIVE'); } else { $online_text = member_is_online($buddy['member_liked']) ? do_lang_tempcode('ONLINE') : do_lang_tempcode('OFFLINE'); } $username = array_key_exists($buddy['member_liked'], $buddy_active) ? $buddy_active[$buddy['member_liked']] : $GLOBALS['FORUM_DRIVER']->get_username($buddy['member_liked']); if (!is_null($username)) { $member_profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($buddy['member_liked'], true, true); $buddies[] = array('DATE_AND_TIME_RAW' => strval($buddy['date_and_time']), 'DATE_AND_TIME' => get_timezoned_date($buddy['date_and_time'], false), 'MEMBER_PROFILE_LINK' => $member_profile_url, 'MEMBER_ID' => strval($buddy['member_liked']), 'USERNAME' => $username, 'ONLINE_TEXT' => $online_text); } } $messages_php = find_script('messages'); $im_area_template = do_template('CHAT_LOBBY_IM_AREA', array('_GUID' => 'cd230527da03caa596135f74647b2ca7', 'MESSAGES_PHP' => $messages_php, 'ROOM_ID' => '__room_id__')); $make_buddy_url = build_url(array('page' => '_SELF', 'type' => 'buddy_add', 'member_id' => '__id__'), '_SELF'); $block_member_url = build_url(array('page' => '_SELF', 'type' => 'blocking_add', 'member_id' => '__id__'), '_SELF'); $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url(-100, true, true); if (is_object($profile_url)) { $profile_url = $profile_url->evaluate(); } $profile_url = str_replace('-100', '__id__', $profile_url); $im_participant_template = do_template('CHAT_LOBBY_IM_PARTICIPANT', array('_GUID' => '9a36efe3a449dabac6ef9866d1f6f48a', 'PROFILE_URL' => $profile_url, 'ID' => '__id__', 'ROOM_ID' => '__room_id__', 'USERNAME' => '__username__', 'ONLINE' => '__online__', 'AVATAR_URL' => '__avatar_url__', 'MAKE_BUDDY_URL' => $make_buddy_url, 'BLOCK_MEMBER_URL' => $block_member_url)); if (!is_guest()) { $seteffectslink = hyperlink(build_url(array('page' => '_SELF', 'type' => 'set_effects'), '_SELF'), do_lang_tempcode('CHAT_SET_EFFECTS'), true); } else { $seteffectslink = new ocp_tempcode(); } $message = new ocp_tempcode(); $message->attach(do_lang_tempcode('WELCOME_CHAT_LOBBY', $private_room->is_empty() ? new ocp_tempcode() : do_lang_tempcode('WELCOME_CHAT_LOBBY_PRIVATE_ROOMS'), $can_im ? do_lang_tempcode('WELCOME_CHAT_LOBBY_USE_IM') : new ocp_tempcode(), $can_im ? do_lang_tempcode(get_option('sitewide_im') == '1' ? 'WELCOME_CHAT_LOBBY_USE_IM2_SITEWIDE' : 'WELCOME_CHAT_LOBBY_USE_IM2_NO_SITEWIDE') : new ocp_tempcode())); if (has_actual_page_access(get_member(), 'admin_chat')) { $add_room_url = build_url(array('page' => 'admin_chat', 'type' => 'ad'), get_module_zone('admin_chat')); } else { $add_room_url = new ocp_tempcode(); } return do_template('CHAT_LOBBY_SCREEN', array('_GUID' => 'f82ddfd0dccbd25752dd05a1d87429e2', 'ADD_ROOM_URL' => $add_room_url, 'MESSAGE' => $message, 'CHAT_SOUND' => get_chat_sound_tpl(), 'IM_PARTICIPANT_TEMPLATE' => $im_participant_template, 'IM_AREA_TEMPLATE' => $im_area_template, 'BUDDIES' => $buddies, 'CAN_IM' => $can_im, 'ONLINE_URL' => $online_url, 'URL_ADD_BUDDY' => $post_url_add_buddy, 'URL_REMOVE_BUDDIES' => $post_url_remove_buddies, 'TITLE' => $title, 'ROOMS' => $fields, 'PRIVATE_ROOM' => $private_room, 'MOD_LINK' => $modlink, 'BLOCKING_LINK' => $blocking_link, 'SETEFFECTS_LINK' => $seteffectslink)); }
/** * View an overview of the members adverts on the system. * * @return tempcode The UI */ function adverts() { require_lang('classifieds'); require_code('catalogues'); require_code('ecommerce'); $member_id = get_param_integer('member_id', get_member()); $title = get_page_title($member_id == get_member() ? 'CLASSIFIED_ADVERTS' : '_CLASSIFIED_ADVERTS', true, array($GLOBALS['FORUM_DRIVER']->get_username($member_id))); if (is_guest()) { access_denied('NOT_AS_GUEST'); } enforce_personal_access($member_id); $start = get_param_integer('start', 0); $max = get_param_integer('max', 30); require_code('templates_results_browser'); $max_rows = $GLOBALS['SITE_DB']->query_value('catalogue_entries e JOIN ' . get_table_prefix() . 'classifieds_prices c ON c.c_catalogue_name=e.c_name', 'COUNT(*)', array('ce_submitter' => $member_id)); $rows = $GLOBALS['SITE_DB']->query_select('catalogue_entries e JOIN ' . get_table_prefix() . 'classifieds_prices c ON c.c_catalogue_name=e.c_name', array('e.*'), array('ce_submitter' => $member_id), 'GROUP BY e.id ORDER BY ce_add_date DESC'); if (count($rows) == 0) { inform_exit(do_lang_tempcode('NO_ENTRIES')); } $ads = array(); foreach ($rows as $row) { $root = get_param_integer('root', NULL); $data_map = get_catalogue_entry_map($row, NULL, 'CATEGORY', 'DEFAULT', $root, NULL, array(0)); $ad_title = $data_map['FIELD_0']; $purchase_url = build_url(array('page' => 'purchase', 'type' => 'misc', 'filter' => 'CLASSIFIEDS_ADVERT', 'id' => $row['id']), get_module_zone('purchase')); // We'll show all transactions against this ad $transaction_details = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'transactions WHERE purchase_id=' . strval($row['id']) . ' AND item LIKE \'' . db_encode_like('CLASSIFIEDS\\_ADVERT\\_%') . '\''); $_transaction_details = array(); foreach ($transaction_details as $t) { list($found, ) = find_product_row($t['item']); if (!is_null($found)) { $item_title = $found[4]; } else { $item_title = $t['item']; } $_transaction_details[] = array('T_ID' => strval($t['id']), 'PURCHASE_ID' => strval($t['purchase_id']), 'STATUS' => $t['status'], 'REASON' => $t['reason'], 'AMOUNT' => float_format($t['amount']), 'T_CURRENCY' => $t['t_currency'], 'LINKED' => $t['linked'], 'T_TIME' => strval($t['t_time']), 'ITEM' => $t['item'], 'ITEM_TITLE' => $item_title, 'PENDING_REASON' => $t['pending_reason'], 'T_MEMO' => $t['t_memo'], 'T_VIA' => $t['t_via']); } $url_map = array('page' => 'catalogues', 'type' => 'entry', 'id' => $row['id'], 'root' => $root); $url = build_url($url_map, '_SELF'); // No known expiry status: put on free, or let expire if ($row['ce_last_moved'] == $row['ce_add_date']) { require_code('classifieds'); initialise_classified_listing($row); } $ads[] = array('AD_TITLE' => $ad_title, 'TRANSACTION_DETAILS' => $_transaction_details, 'DATE' => get_timezoned_date($row['ce_add_date']), 'DATE_RAW' => strval($row['ce_add_date']), 'EXPIRES_DATE' => get_timezoned_date($row['ce_last_moved']), 'EXPIRES_DATE_RAW' => strval($row['ce_last_moved']), 'ACTIVE' => $row['ce_validated'] == 1, 'PURCHASE_URL' => $purchase_url, 'ID' => strval($row['id']), 'URL' => $url, 'NUM_VIEWS' => integer_format($row['ce_views'])); } $results_browser = results_browser(do_lang('_CLASSIFIED_ADVERTS'), NULL, $start, 'start', $max, 'max', $max_rows, NULL, NULL, true); return do_template('CLASSIFIED_ADVERTS_SCREEN', array('TITLE' => $title, 'RESULTS_BROWSER' => $results_browser, 'ADS' => $ads)); }