Example #1
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     $url = array_key_exists('param', $map) ? $map['param'] : 'http://ocportal.com/backend.php?type=rss&mode=news&filter=16,17,18,19,20';
     // http://channel9.msdn.com/Feeds/RSS/
     require_code('rss');
     $rss = new rss($url);
     if (!is_null($rss->error)) {
         return paragraph($rss->error, 'gfgrtyhyyfhd');
     }
     global $NEWS_CATS;
     $NEWS_CATS = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
     $NEWS_CATS = list_to_map('id', $NEWS_CATS);
     $_postdetailss = array();
     // Now for the actual stream contents
     $max = array_key_exists('max_entries', $map) ? intval($map['max_entries']) : 10;
     $content = new ocp_tempcode();
     foreach ($rss->gleamed_items as $i => $item) {
         if ($i >= $max) {
             break;
         }
         if (array_key_exists('full_url', $item)) {
             $full_url = $item['full_url'];
         } elseif (array_key_exists('guid', $item)) {
             $full_url = $item['guid'];
         } elseif (array_key_exists('comment_url', $item)) {
             $full_url = $item['comment_url'];
         } else {
             $full_url = '';
         }
         $_title = $item['title'];
         $date = array_key_exists('clean_add_date', $item) ? get_timezoned_date($item['clean_add_date']) : array_key_exists('add_date', $item) ? $item['add_date'] : '';
         $_postdetailss[] = array('DATE' => $date, 'FULL_URL' => $full_url, 'NEWS_TITLE' => $_title);
     }
     return do_template('BLOCK_BOTTOM_NEWS', array('_GUID' => '0fc123199c4d4b7af5a26706271b1f4f', 'POSTS' => $_postdetailss));
 }
Example #2
0
 /**
  * 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)
 {
     $title = do_lang_tempcode('MODULE_TRANS_NAME_warnings');
     $order = 80;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     require_lang('ocf');
     require_css('ocf');
     $warnings = new ocp_tempcode();
     $rows = $GLOBALS['FORUM_DB']->query_select('f_warnings', array('*'), array('w_member_id' => $member_id_of, 'w_is_warning' => 1));
     foreach ($rows as $row) {
         $warning_by = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($row['w_by']);
         $date = get_timezoned_date($row['w_time']);
         if ($row['w_explanation'] == '') {
             $row['w_explanation'] = '?';
         } else {
             $row['w_explanation'] = str_replace(chr(10), ' ', $row['w_explanation']);
         }
         $row['w_explanation_orig'] = $row['w_explanation'];
         if (strlen($row['w_explanation']) > 30) {
             $row['w_explanation'] = substr($row['w_explanation'], 0, 27) . '...';
         }
         $explanation = hyperlink(build_url(array('page' => 'warnings', 'type' => '_ed', 'id' => $row['id'], 'redirect' => get_self_url(true)), get_module_zone('warnings')), $row['w_explanation'], false, true, $row['w_explanation_orig']);
         $warnings->attach(paragraph(do_lang_tempcode('MEMBER_WARNING', $explanation, $warning_by, array(make_string_tempcode(escape_html($date)))), 'treyerhy34y'));
     }
     $content = do_template('OCF_MEMBER_PROFILE_WARNINGS', array('MEMBER_ID' => strval($member_id_of), 'WARNINGS' => $warnings));
     return array($title, $content, $order);
 }
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     if (get_forum_type() != 'ocf') {
         return new ocp_tempcode();
     }
     if (is_guest()) {
         return new ocp_tempcode();
     }
     require_css('side_blocks');
     ocf_require_all_forum_stuff();
     require_code('ocf_notifications');
     // Only show what's new in week. Some forums may want to tweak this, but forums themselves only mark unread topics for a week.
     $rows = ocf_get_pp_rows();
     //		if (count($rows)==0) return new ocp_tempcode();
     require_lang('ocf');
     $out = new ocp_tempcode();
     foreach ($rows as $topic) {
         $topic_url = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'findpost'), get_module_zone('topicview'));
         $topic_url->attach('#post_' . strval($topic['id']));
         $title = $topic['t_cache_first_title'];
         $date = get_timezoned_date($topic['t_cache_last_time'], true);
         $username = $topic['t_cache_last_username'];
         $member_link = $GLOBALS['OCF_DRIVER']->member_profile_url($topic['t_cache_last_member_id'], false, true);
         $num_posts = $topic['t_cache_num_posts'];
         $out->attach(do_template('TOPIC_LIST', array('_GUID' => '55ae21a9f8d67ba6237c118a18b9657b', 'USER_LINK' => $member_link, 'TOPIC_LINK' => $topic_url, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic['t_cache_last_time']), 'USERNAME' => $username, 'NUM_POSTS' => integer_format($num_posts))));
     }
     $send_url = build_url(array('page' => 'topics', 'type' => 'new_pt', 'redirect' => SELF_REDIRECT), get_module_zone('topics'));
     if (!ocf_may_make_personal_topic()) {
         $send_url = new ocp_tempcode();
     }
     $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => get_member()), get_module_zone('members'), NULL, true, false, false, 'tab__pts');
     return do_template('BLOCK_SIDE_OCF_PERSONAL_TOPICS', array('_GUID' => '9376cd47884a78f3d1914c176b67ee28', 'SEND_URL' => $send_url, 'VIEW_URL' => $view_url, 'CONTENT' => $out, 'FORUM_NAME' => do_lang_tempcode('PERSONAL_TOPICS')));
 }
Example #4
0
 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
     $title = get_translated_tempcode($row['title']);
     $title_plain = get_translated_text($row['title']);
     $news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
     if (!array_key_exists(0, $news_cat_rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $news_cat_row = $news_cat_rows[0];
     $category = get_translated_text($news_cat_row['nc_title']);
     $img = find_theme_image($news_cat_row['nc_img']);
     if ($row['news_image'] != '') {
         $img = $row['news_image'];
         if (url_is_local($img)) {
             $img = get_base_url() . '/' . $img;
         }
     }
     $news = get_translated_tempcode($row['news']);
     if ($news->is_empty()) {
         $news = get_translated_tempcode($row['news_article']);
         $truncate = true;
     } else {
         $truncate = false;
     }
     $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
     $author = $row['author'];
     require_css('news');
     $seo_bits = seo_meta_get_for('news', strval($row['id']));
     $map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
         $map['COMMENT_COUNT'] = '1';
     }
     return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
 }
Example #5
0
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('date', array('h'), array()), '', '');
     } else {
         return array('', '', get_timezoned_date(time(), true, true), '');
     }
 }
Example #6
0
/**
 * Show a quiz box.
 *
 * @param  array			The database row
 * @param  string			The zone to show in
 * @return tempcode		The rendered quiz link
 */
function show_quiz_html($row, $zone = '_SEARCH')
{
    $date = get_timezoned_date($row['q_add_date']);
    $url = build_url(array('page' => 'quiz', 'type' => 'do', 'id' => $row['id']), $zone);
    $name = get_translated_text($row['q_name']);
    $start_text = get_translated_tempcode($row['q_start_text']);
    $timeout = is_null($row['q_timeout']) ? '' : display_time_period($row['q_timeout'] * 60);
    $redo_time = is_null($row['q_redo_time']) || $row['q_redo_time'] == 0 ? '' : display_time_period($row['q_redo_time'] * 60 * 60);
    return do_template('QUIZ_LINK', array('_TYPE' => $row['q_type'], 'POINTS' => strval($row['q_points_for_passing']), 'TIMEOUT' => $timeout, 'REDO_TIME' => $redo_time, 'TYPE' => do_lang_tempcode($row['q_type']), 'DATE' => $date, 'URL' => $url, 'NAME' => $name, 'START_TEXT' => $start_text));
}
Example #7
0
 /**
  * The UI to delete trackbacks.
  *
  * @return tempcode		The UI
  */
 function choose()
 {
     $title = get_page_title('MANAGE_TRACKBACKS');
     $trackback_rows = $GLOBALS['SITE_DB']->query_select('trackbacks', array('*'), NULL, 'ORDER BY id DESC', 1000);
     $trackbacks = '';
     foreach ($trackback_rows as $value) {
         $trackbacks .= static_evaluate_tempcode(do_template('TRACKBACK', array('ID' => strval($value['id']), 'TIME_RAW' => strval($value['trackback_time']), 'TIME' => get_timezoned_date($value['trackback_time']), 'URL' => $value['trackback_url'], 'TITLE' => $value['trackback_title'], 'EXCERPT' => $value['trackback_excerpt'], 'NAME' => $value['trackback_name'])));
     }
     return do_template('TRACKBACK_DELETE_SCREEN', array('_GUID' => '51f7e4c1976bcaf120758d2c86771289', 'TITLE' => $title, 'TRACKBACKS' => $trackbacks, 'LOTS' => count($trackback_rows) == 1000));
 }
Example #8
0
 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     // Find review, if there is one
     $individual_review_ratings = array();
     $review_rating = post_param('review_rating', '');
     if ($review_rating != '') {
         $individual_review_ratings[''] = array('REVIEW_TITLE' => '', 'REVIEW_RATING' => $review_rating);
     }
     $poster_name = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
     $post = comcode_to_tempcode(post_param('post'));
     // OCF renderings of poster
     static $hooks = NULL;
     if (is_null($hooks)) {
         $hooks = find_all_hooks('modules', 'topicview');
     }
     static $hook_objects = NULL;
     if (is_null($hook_objects)) {
         $hook_objects = array();
         foreach (array_keys($hooks) as $hook) {
             require_code('hooks/modules/topicview/' . filter_naughty_harsh($hook));
             $object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
             if (is_null($object)) {
                 continue;
             }
             $hook_objects[$hook] = $object;
         }
     }
     if (!is_guest()) {
         require_code('ocf_members2');
         $poster_details = ocf_show_member_box(get_member(), false, $hooks, $hook_objects, false);
     } else {
         $custom_fields = new ocp_tempcode();
         $poster_details = new ocp_tempcode();
     }
     if (addon_installed('ocf_forum')) {
         if (!is_guest()) {
             $poster = do_template('OCF_POSTER_MEMBER', array('ONLINE' => true, 'ID' => strval(get_member()), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member(), false, true), 'POSTER_USERNAME' => $poster_name));
         } else {
             $poster = do_template('OCF_POSTER_GUEST', array('IP_LINK' => '', 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $poster_name));
         }
     } else {
         $poster = make_string_tempcode(escape_html($poster_name));
         // Should never happen actually, as applies discounts hook from even running
     }
     $highlight = false;
     $datetime_raw = time();
     $datetime = get_timezoned_date(time());
     $poster_url = $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member());
     $title = post_param('title', '');
     $tpl = do_template('POST', array('INDIVIDUAL_REVIEW_RATINGS' => $individual_review_ratings, 'HIGHLIGHT' => $highlight, 'TITLE' => $title, 'TIME_RAW' => strval($datetime_raw), 'TIME' => $datetime, 'POSTER_URL' => $poster_url, 'POSTER_NAME' => $poster_name, 'POST' => $post, 'POSTER_ID' => strval(get_member()), 'POSTER' => $poster, 'POSTER_DETAILS' => $poster_details, 'ID' => '', 'CHILDREN' => '', 'RATING' => '', 'EMPHASIS' => '', 'BUTTONS' => '', 'TOPIC_ID' => '', 'UNVALIDATED' => '', 'IS_SPACER_POST' => false, 'NUM_TO_SHOW_LIMIT' => '0'));
     return array($tpl, NULL);
 }
Example #9
0
 /**
  * Standard modular run function.
  *
  * @param  MEMBER		The ID of the member we are getting link hooks for
  * @return array		List of tuples for results. Each tuple is: type,title,url
  */
 function run($member_id)
 {
     if (!has_actual_page_access(get_member(), 'cms_booking')) {
         return array();
     }
     require_lang('booking');
     require_code('booking');
     require_code('booking2');
     $zone = get_module_zone('cms_booking');
     $request = get_member_booking_request($member_id);
     $links = array();
     foreach ($request as $i => $r) {
         $from = get_timezoned_date(mktime(0, 0, 0, $r['start_month'], $r['start_day'], $r['start_year']), false);
         $to = get_timezoned_date(mktime(0, 0, 0, $r['end_month'], $r['end_day'], $r['end_year']), false);
         $links[] = array('content', do_lang_tempcode('BOOKING_EDIT', $from, $to, get_translated_tempcode($GLOBALS['SITE_DB']->query_value('bookable', 'title', array('id' => $r['bookable_id'])))), build_url(array('page' => 'cms_booking', 'type' => '_eb', 'id' => strval($member_id) . '_' . strval($i)), $zone));
     }
     return $links;
 }
Example #10
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     $last_cron = get_value('last_cron');
     if (is_null($last_cron) || intval($last_cron) < time() - 60 * 60 * 24) {
         $status = 0;
         $info = NULL;
         $url = brand_base_url() . '/docs' . strval(ocp_version()) . '/pg/tut_configuration';
     } else {
         $status = 1;
         $date = get_timezoned_date(intval($last_cron), true, true, false, true);
         $mails_sent = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'logged_mail_messages WHERE m_queued=0 AND m_date_and_time>' . strval(time() - 60 * 60 * 24));
         $mails_queued = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'logged_mail_messages WHERE m_queued=1');
         $info = do_lang_tempcode('LAST_RAN_AT', escape_html($date), escape_html(integer_format($mails_sent)), escape_html(integer_format($mails_queued)));
         $url = '';
     }
     $_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('INFO' => $info, 'URL' => '', 'STATUS' => $_status, 'TASK' => urlise_lang(do_lang('NAG_SETUP_CRON'), $url)));
     return array(array($tpl, $status == 0 ? -1 : 0, 1, NULL));
 }
Example #11
0
 /**
  * Handle hooks supported bot commands. Note multiple bots may support the same commands, and all respond. It is recommended all bots support the command 'help'.
  *
  * @param  AUTO_LINK		The ID of the chat room
  * @param  string			The command used. This is just the chat message, so you can encode and recognise your own parameter scheme if you like.
  * @return ?string		Bot reply (NULL: bot does not handle the command)
  */
 function handle_commands($room_id, $command)
 {
     switch ($command) {
         case 'help':
             $out = do_lang('CHAT_HELP_BOTMSG');
             return do_lang('CHAT_WEBSITE_HELPER_BOT', $out);
         case 'users_online':
             // On the site
             $count = 0;
             $members = get_online_members(true, NULL, $count);
             if (is_null($members)) {
                 return do_lang('TOO_MANY_USERS_ONLINE');
             }
             $guests = 0;
             $site_members = '';
             foreach ($members as $member) {
                 if (is_guest($member['the_user']) || is_null($member['cache_username'])) {
                     $guests++;
                 } else {
                     if ($site_members != '') {
                         $site_members .= ', ';
                     }
                     $site_members .= '{{' . $member['cache_username'] . '}}';
                 }
             }
             // In this room
             $room_members = get_chatters_in_room($room_id);
             $_room_members = '';
             foreach ($room_members as $room_member) {
                 if ($_room_members != '') {
                     $_room_members .= ', ';
                 }
                 $_room_members .= '{{' . $room_member . '}}';
             }
             // Show our complete result
             $out = do_lang('CHAT_USERSONLINE_BOTMSG', $site_members, $_room_members);
             return do_lang('CHAT_WEBSITE_HELPER_BOT', $out);
         case 'time':
             $out = do_lang('CHAT_TIME_BOTMSG', get_timezoned_date(time(), true, true, true, true));
             return do_lang('CHAT_WEBSITE_HELPER_BOT', $out);
     }
     return NULL;
 }
 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (!defined('MAXIMUM_DIGEST_LENGTH')) {
         define('MAXIMUM_DIGEST_LENGTH', 1024 * 100);
         // 100KB
     }
     require_code('notifications');
     foreach (array(A_DAILY_EMAIL_DIGEST => 60 * 60 * 24, A_WEEKLY_EMAIL_DIGEST => 60 * 60 * 24 * 7, A_MONTHLY_EMAIL_DIGEST => 60 * 60 * 24 * 31) as $frequency => $timespan) {
         $start = 0;
         do {
             // Find where not tint-in-tin
             $members = $GLOBALS['SITE_DB']->query('SELECT DISTINCT d_to_member_id FROM ' . get_table_prefix() . 'digestives_consumed c JOIN ' . get_table_prefix() . 'digestives_tin t ON c.c_member_id=t.d_to_member_id AND c.c_frequency=' . strval($frequency) . ' WHERE c_time<' . strval(time() - $timespan) . ' AND c_frequency=' . strval($frequency), 100, $start);
             foreach ($members as $member) {
                 require_lang('notifications');
                 $to_member_id = $member['d_to_member_id'];
                 $to_name = $GLOBALS['FORUM_DRIVER']->get_username($to_member_id);
                 $to_email = $GLOBALS['FORUM_DRIVER']->get_member_email_address($to_member_id);
                 $messages = $GLOBALS['SITE_DB']->query_select('digestives_tin', array('d_subject', 'd_message', 'd_date_and_time'), array('d_to_member_id' => $to_member_id, 'd_frequency' => $frequency), 'ORDER BY d_date_and_time');
                 $GLOBALS['SITE_DB']->query_delete('digestives_tin', array('d_to_member_id' => $to_member_id, 'd_frequency' => $frequency));
                 $_message = '';
                 foreach ($messages as $message) {
                     if ($_message != '') {
                         $_message .= chr(10);
                     }
                     if (strlen($_message) + strlen($message['d_message']) < MAXIMUM_DIGEST_LENGTH) {
                         $_message .= do_lang('DIGEST_EMAIL_INDIVIDUAL_MESSAGE_WRAP', comcode_escape($message['d_subject']), $message['d_message'], array(comcode_escape(get_site_name()), get_timezoned_date($message['d_date_and_time'])));
                     } else {
                         $_message .= do_lang('DIGEST_ITEM_OMITTED', comcode_escape($message['d_subject']), get_timezoned_date($message['d_date_and_time']), array(comcode_escape(get_site_name())));
                     }
                 }
                 if ($_message != '') {
                     $wrapped_subject = do_lang('DIGEST_EMAIL_SUBJECT_' . strval($frequency), comcode_escape(get_site_name()));
                     $wrapped_message = do_lang('DIGEST_EMAIL_MESSAGE_WRAP', $_message, comcode_escape(get_site_name()));
                     require_code('mail');
                     mail_wrap($wrapped_subject, $wrapped_message, array($to_email), $to_name, get_option('staff_address'), get_site_name(), 3, NULL, true, A_FROM_SYSTEM_UNPRIVILEGED, false);
                     $GLOBALS['SITE_DB']->query_update('digestives_consumed', array('c_time' => time()), array('c_member_id' => $to_member_id, 'c_frequency' => $frequency), '', 1);
                 }
             }
             $start += 100;
         } while (count($members) == 100);
     }
 }
Example #13
0
/**
 * Output the ocWorld messages script.
 */
function ocworld_messages_script()
{
    require_lang('ocworld');
    require_lang('chat');
    $member_id = get_member();
    $rows = $GLOBALS['SITE_DB']->query_select('w_members', array('location_realm', 'location_x', 'location_y'), array('id' => $member_id), '', 1);
    if (!array_key_exists(0, $rows)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    list($realm, $x, $y) = array($rows[0]['location_realm'], $rows[0]['location_x'], $rows[0]['location_y']);
    $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'w_messages WHERE location_x=' . strval((int) $x) . ' AND location_y=' . strval((int) $y) . ' AND location_realm=' . strval((int) $realm) . ' AND (destination=' . strval((int) $member_id) . ' OR destination IS NULL OR originator_id=' . strval((int) $member_id) . ') ORDER BY m_datetime DESC');
    $messages = new ocp_tempcode();
    foreach ($rows as $myrow) {
        $message_sender = $GLOBALS['FORUM_DRIVER']->get_username($myrow['originator_id']);
        if (is_null($message_sender)) {
            $message_sender = do_lang('UNKNOWN');
        }
        $messages->attach(do_template('W_MESSAGE_' . (is_null($myrow['destination']) ? 'ALL' : 'TO'), array('MESSAGESENDER' => $message_sender, 'MESSAGE' => comcode_to_tempcode($myrow['m_message'], $myrow['originator_id']), 'DATETIME' => get_timezoned_date($myrow['m_datetime']))));
    }
    $css = do_template('CSS_NEED', array('_GUID' => '0c2b42583214051a3841d4654537b16f', 'CODE' => 'ocworld'));
    $tpl = do_template('W_MESSAGES', array('_GUID' => '05b40c794578d3221e2775895ecf8dbb', 'MESSAGES' => $messages, 'CSS' => $css));
    $tpl->evaluate_echo();
}
Example #14
0
 /**
  * The UI to view a past newsletter.
  *
  * @return tempcode		The UI
  */
 function view()
 {
     $id = get_param_integer('id');
     $rows = $GLOBALS['SITE_DB']->query_select('newsletter_archive', array('*'), array('id' => $id));
     $time = get_timezoned_date($rows[0]['date_and_time']);
     $subject = $rows[0]['subject'];
     $message = $rows[0]['newsletter'];
     $language = $rows[0]['language'];
     $level = $rows[0]['importance_level'];
     /*require_code('lang2');
     		$language=lookup_language_full_name($rows[0]['language']);*/
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_NEWSLETTER')), array('_SELF:_SELF:archive', do_lang_tempcode('NEWSLETTER_ARCHIVE'))));
     breadcrumb_set_self($subject);
     require_code('templates_view_space');
     return view_space(get_page_title('NEWSLETTER'), array('DATE_TIME' => $time, 'LANGUAGE' => $language, 'SUBSCRIPTION_LEVEL' => integer_format($level), 'SUBJECT' => $subject, 'MESSAGE' => comcode_to_tempcode($message)));
 }
Example #15
0
 /**
  * The UI to show a video.
  *
  * @param  ?string		Alternate category name to use (NULL: use standard one). This is useful if you are overriding this code to show images in virtual galleries.
  * @param  ?tempcode		Breadcrumbs (NULL: derive in this function).
  * @return tempcode		The UI
  */
 function show_video($category_name = NULL, $tree = NULL)
 {
     $id = get_param_integer('id');
     if (get_param_integer('ajax', 0) == 1) {
         header('Content-type: text/xml');
     }
     list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order();
     if (addon_installed('awards')) {
         require_code('awards');
         $awards = find_awards_for('video', strval($id));
     } else {
         $awards = array();
     }
     // Pic up some info
     $rows = $GLOBALS['SITE_DB']->query_select('videos', array('*'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         return warn_screen(get_page_title('ERROR_OCCURRED'), do_lang_tempcode('MISSING_RESOURCE'));
     }
     $myrow = $rows[0];
     $url = $myrow['url'];
     if (url_is_local($url)) {
         $url = get_custom_base_url() . '/' . $url;
     }
     $cat = $myrow['cat'];
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=galleries&filter=' . urlencode($cat);
     if (get_value('no_individual_gallery_view') === '1' && $GLOBALS['SITE_DB']->query_value('galleries', 'flow_mode_interface', array('name' => $cat)) == '1') {
         require_code('site2');
         assign_refresh(build_url(array('page' => '_SELF', 'type' => 'misc', 'id' => $cat, 'probe_id' => $id, 'probe_type' => 'video'), '_SELF'), 0.0);
     }
     $true_category_name = get_translated_text($GLOBALS['SITE_DB']->query_value('galleries', 'fullname', array('name' => $cat)));
     if (is_null($category_name)) {
         $category_name = $true_category_name;
     }
     if (get_param_integer('slideshow', 0) == 1) {
         $title = get_page_title('VIEW_SLIDESHOW', true, array(escape_html($category_name)));
         global $EXTRA_HEAD;
         $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
         // XHTMLXHTML
     } else {
         $title = get_page_title(get_translated_text($myrow['title']) == '' ? 'VIEW_VIDEO' : '_VIEW_VIDEO', true, array(escape_html(get_translated_text($myrow['title']))), NULL, $awards);
     }
     $root = get_param('root', 'root');
     seo_meta_load_for('video', strval($id));
     $thumb_url = $myrow['thumb_url'];
     if (url_is_local($thumb_url)) {
         $thumb_url = get_custom_base_url() . '/' . $thumb_url;
     }
     if (!has_category_access(get_member(), 'galleries', $cat)) {
         access_denied('CATEGORY_ACCESS');
     }
     // Views
     if (get_db_type() != 'xml') {
         $myrow['video_views']++;
         $GLOBALS['SITE_DB']->query_update('videos', array('video_views' => $myrow['video_views']), array('id' => $id), '', 1, NULL, false, true);
     }
     list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('videos', strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'video', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['title']) == '' ? do_lang('VIEW_VIDEO_IN', $true_category_name) : get_translated_text($myrow['title']), get_value('comment_forum__videos'));
     // Validation
     if ($myrow['validated'] == 0) {
         if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
             access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
         }
         $warning_details = do_template('WARNING_TABLE', array('_GUID' => 'b32faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
     } else {
         $warning_details = new ocp_tempcode();
     }
     // Comments
     $comments = get_translated_tempcode($myrow['comments']);
     if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', $cat))) {
         $edit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ev', 'id' => $id), get_module_zone('cms_galleries'));
     } else {
         $edit_url = new ocp_tempcode();
     }
     $add_date = get_timezoned_date($myrow['add_date']);
     $edit_date = is_null($myrow['edit_date']) ? '' : get_timezoned_date($myrow['edit_date']);
     // Video HTML
     $video = show_gallery_media($url, $thumb_url, $myrow['video_width'], $myrow['video_height'], $myrow['video_length']);
     $extension = get_file_extension($url);
     require_code('mime_types');
     $mime_type = get_mime_type($extension);
     list($n, $x, $nav) = $this->build_set_navigation(db_string_equal_to('cat', $cat), '', $category_name, $id, $root, 'video', get_param_integer('slideshow', 0), get_param_integer('wide_high', 0), get_param_integer('start', 0), get_param_integer('max', get_default_gallery_max()), $cat, $sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos, get_param('select', '*'), get_param('video_select', '*'));
     $member_id = get_member_id_from_gallery_name($cat, NULL, true);
     if (get_forum_type() == 'ocf') {
         require_code('ocf_members');
         require_code('ocf_members2');
     }
     $member_details = is_null($member_id) || get_forum_type() != 'ocf' ? new ocp_tempcode() : ocf_show_member_box($member_id);
     $video_details = show_video_details($myrow);
     if (is_null($tree)) {
         $tree = gallery_breadcrumbs($cat, $root, false, get_module_zone('galleries'));
     }
     breadcrumb_add_segment($tree, do_lang_tempcode('VIEW_VIDEO'));
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Video', 'title' => get_translated_text($myrow['title']), 'identifier' => '_SEARCH:galleries:video:' . strval($id), 'description' => get_translated_text($myrow['comments']), 'image' => $thumb_url, 'video' => $url, 'video:height' => strval($myrow['video_height']), 'video:width' => strval($myrow['video_width']), 'video:type' => $mime_type);
     return do_template('GALLERY_ENTRY_SCREEN', array('_GUID' => '91e231906ed899513ec2db8a2974dddf', 'MEDIA_TYPE' => 'video', 'E_TITLE' => get_translated_text($myrow['title']), 'CAT' => $cat, 'SLIDESHOW' => get_param_integer('slideshow', 0) == 1, 'TRUE_GALLERY_TITLE' => $true_category_name, 'GALLERY_TITLE' => $category_name, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'ID' => strval($id), 'TAGS' => get_loaded_tags('videos'), 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'URL' => $url, 'VIDEO_DETAILS' => $video_details, 'MEMBER_DETAILS' => $member_details, 'X' => integer_format($x), 'N' => integer_format($n), 'VIEWS' => integer_format($myrow['video_views']), 'ADD_DATE_RAW' => strval($myrow['add_date']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'NAV' => $nav, 'COMMENTS' => $comments, 'VIDEO' => $video, 'WARNING_DETAILS' => $warning_details));
 }
Example #16
0
 /**
  * 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)
 {
     $title = do_lang_tempcode('PROFILE');
     $order = 10;
     $photo_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_url');
     if ($photo_url != '' && addon_installed('ocf_member_photos') && has_specific_permission($member_id_viewing, 'view_member_photos')) {
         require_code('images');
         $photo_thumb_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_thumb_url');
         $photo_thumb_url = ensure_thumbnail($photo_url, $photo_thumb_url, strpos($photo_url, 'uploads/photos') !== false ? 'photos' : 'ocf_photos', 'f_members', $member_id_of, 'm_photo_thumb_url');
         if (url_is_local($photo_url)) {
             $photo_url = get_complex_base_url($photo_url) . '/' . $photo_url;
         }
         if (url_is_local($photo_thumb_url)) {
             $photo_thumb_url = get_complex_base_url($photo_thumb_url) . '/' . $photo_thumb_url;
         }
     } else {
         $photo_url = '';
         $photo_thumb_url = '';
     }
     $avatar_url = $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id_of);
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
     // Things staff can do with this user
     $modules = array();
     if (has_specific_permission($member_id_viewing, 'warn_members') && has_actual_page_access($member_id_viewing, 'warnings') && addon_installed('ocf_warnings')) {
         $redir_url = get_self_url(true);
         $modules[] = array('usage', do_lang_tempcode('WARN_MEMBER'), build_url(array('page' => 'warnings', 'type' => 'ad', 'id' => $member_id_of, 'redirect' => $redir_url), get_module_zone('warnings')));
         $modules[] = array('usage', do_lang_tempcode('PUNITIVE_HISTORY'), build_url(array('page' => 'warnings', 'type' => 'history', 'id' => $member_id_of), get_module_zone('warnings')));
     }
     if (has_specific_permission($member_id_viewing, 'view_content_history') && has_actual_page_access($member_id_viewing, 'admin_ocf_history')) {
         $modules[] = !addon_installed('ocf_forum') ? NULL : array('usage', do_lang_tempcode('POST_HISTORY'), build_url(array('page' => 'admin_ocf_history', 'member_id' => $member_id_of), 'adminzone'));
     }
     if (has_actual_page_access($member_id_viewing, 'admin_lookup')) {
         require_lang('submitban');
         $modules[] = array('usage', do_lang_tempcode('INVESTIGATE_USER'), build_url(array('page' => 'admin_lookup', 'param' => $member_id_of), 'adminzone'));
     }
     if (has_actual_page_access($member_id_viewing, 'admin_security')) {
         require_lang('security');
         $modules[] = array('usage', do_lang_tempcode('SECURITY_LOGGING'), build_url(array('page' => 'admin_security', 'member_id' => $member_id_of), 'adminzone'));
     }
     if (addon_installed('actionlog')) {
         if (has_actual_page_access($member_id_viewing, 'admin_actionlog')) {
             require_lang('submitban');
             $modules[] = array('usage', do_lang_tempcode('VIEW_ACTION_LOGS'), build_url(array('page' => 'admin_actionlog', 'type' => 'list', 'id' => $member_id_of), 'adminzone'));
         }
     }
     if (has_actual_page_access($member_id_viewing, 'search') && addon_installed('ocf_forum') && addon_installed('search')) {
         $modules[] = array('content', do_lang_tempcode('SEARCH_POSTS'), build_url(array('page' => 'search', 'type' => 'results', 'id' => 'ocf_posts', 'author' => $username, 'sort' => 'add_date', 'direction' => 'DESC', 'content' => ''), get_module_zone('search')), 'search');
     }
     if (has_actual_page_access($member_id_viewing, 'search') && addon_installed('search')) {
         $modules[] = array('content', do_lang_tempcode('SEARCH'), build_url(array('page' => 'search', 'type' => 'misc', 'author' => $username), get_module_zone('search')), 'search');
     }
     if (addon_installed('authors')) {
         $author = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT author FROM ' . get_table_prefix() . 'authors WHERE (forum_handle=' . strval($member_id_viewing) . ') OR (forum_handle IS NULL AND ' . db_string_equal_to('author', $username) . ')');
         if (has_actual_page_access($member_id_viewing, 'authors') && !is_null($author)) {
             $modules[] = array('content', do_lang_tempcode('AUTHOR'), build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $author), get_module_zone('authors')), 'me');
         }
     }
     require_code('ocf_members2');
     if (!is_guest() && ocf_may_whisper($member_id_of) && has_actual_page_access($member_id_viewing, 'topics') && ocf_may_make_personal_topic() && $member_id_viewing != $member_id_of) {
         $modules[] = !addon_installed('ocf_forum') ? NULL : array('contact', do_lang_tempcode('ADD_PERSONAL_TOPIC'), build_url(array('page' => 'topics', 'type' => 'new_pt', 'id' => $member_id_of), get_module_zone('topics')), 'reply');
     }
     $extra_sections = array();
     $info_details = array();
     $hooks = find_all_hooks('modules', 'members');
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/modules/members/' . filter_naughty_harsh($hook));
         $object = object_factory('Hook_members_' . filter_naughty_harsh($hook), true);
         if (is_null($object)) {
             continue;
         }
         if (method_exists($object, 'run')) {
             $hook_result = $object->run($member_id_of);
             $modules = array_merge($modules, $hook_result);
         }
         if (method_exists($object, 'get_info_details')) {
             $hook_result = $object->get_info_details($member_id_of);
             $info_details = array_merge($info_details, $hook_result);
         }
         if (method_exists($object, 'get_sections')) {
             $hook_result = $object->get_sections($member_id_of);
             $extra_sections = array_merge($extra_sections, $hook_result);
         }
     }
     if (addon_installed('ocf_contactmember')) {
         if (($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_allow_emails') == 1 || get_option('allow_email_disable') == '0') && $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_email_address') != '' && !is_guest($member_id_of) && has_actual_page_access($member_id_viewing, 'contactmember') && $member_id_viewing != $member_id_of) {
             $redirect = get_self_url(true);
             $modules[] = array('contact', do_lang_tempcode('_EMAIL_MEMBER'), build_url(array('page' => 'contactmember', 'redirect' => $redirect, 'id' => $member_id_of), get_module_zone('contactmember')), 'reply');
         }
     }
     require_lang('menus');
     $sections = array('contact' => do_lang_tempcode('CONTACT'), 'profile' => do_lang_tempcode('EDIT_PROFILE'), 'views' => do_lang_tempcode('ACCOUNT'), 'usage' => do_lang_tempcode('USAGE'), 'content' => do_lang_tempcode('CONTENT'));
     $actions = array();
     global $M_SORT_KEY;
     $M_SORT_KEY = mixed();
     $M_SORT_KEY = 1;
     @uasort($modules, 'multi_sort');
     /* @ is to stop PHP bug warning about altered array contents when Tempcode copies are evaluated internally */
     foreach ($sections as $section_code => $section_title) {
         $links = new ocp_tempcode();
         foreach ($modules as $module) {
             if (count($module) == 3) {
                 list($_section_code, $lang, $url) = $module;
                 $rel = NULL;
             } else {
                 list($_section_code, $lang, $url, $rel) = $module;
             }
             if ($section_code == $_section_code) {
                 $links->attach(do_template('OCF_MEMBER_ACTION', array('_GUID' => '67b2a640a368c6f53f1b1fa10f922fd0', 'ID' => strval($member_id_of), 'URL' => $url, 'LANG' => $lang, 'REL' => $rel)));
             }
         }
         $actions[$section_code] = $links;
     }
     // Custom fields
     $_custom_fields = ocf_get_all_custom_fields_match_member($member_id_of, $member_id_viewing != $member_id_of && !has_specific_permission($member_id_viewing, 'view_any_profile_field') ? 1 : NULL, $member_id_viewing == $member_id_of && !has_specific_permission($member_id_viewing, 'view_any_profile_field') ? 1 : NULL);
     $custom_fields = array();
     require_code('encryption');
     $value = mixed();
     foreach ($_custom_fields as $name => $_value) {
         $value = $_value['RAW'];
         $rendered_value = $_value['RENDERED'];
         $encrypted_value = '';
         if (is_data_encrypted($value)) {
             $encrypted_value = remove_magic_encryption_marker($value);
         } elseif (is_integer($value)) {
             $value = strval($value);
         } elseif (is_float($value)) {
             $value = float_to_raw_string($value);
         }
         if (!is_object($value) && $value != '' || is_object($value) && !$value->is_empty()) {
             $custom_fields[] = array('NAME' => $name, 'RAW_VALUE' => $value, 'VALUE' => $rendered_value, 'ENCRYPTED_VALUE' => $encrypted_value);
             if ($name == do_lang('KEYWORDS')) {
                 $GLOBALS['SEO_KEYWORDS'] = is_object($value) ? $value->evaluate() : $value;
             }
             if ($name == do_lang('DESCRIPTION')) {
                 $GLOBALS['SEO_DESCRIPTION'] = is_object($value) ? $value->evaluate() : $value;
             }
         }
     }
     // Birthday
     $dob = '';
     if ($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_reveal_age') == 1) {
         $day = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_day');
         $month = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_month');
         $year = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_dob_year');
         if (!is_null($day)) {
             if (@strftime('%Y', @mktime(0, 0, 0, 1, 1, 1963)) != '1963') {
                 $dob = strval($year) . '-' . str_pad(strval($month), 2, '0', STR_PAD_LEFT) . '-' . str_pad(strval($day), 2, '0', STR_PAD_LEFT);
             } else {
                 $dob = get_timezoned_date(mktime(12, 0, 0, $month, $day, $year), false, true, true);
             }
         }
     }
     // Find forum with most posts
     $forums = $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0');
     $best_yet_forum = 0;
     // Initialise to integer type
     $best_yet_forum = NULL;
     $most_active_forum = NULL;
     $_best_yet_forum = $GLOBALS['FORUM_DB']->query_select('f_posts', array('COUNT(*) as cnt', 'p_cache_forum_id'), array('p_poster' => $member_id_of), 'GROUP BY p_cache_forum_id');
     $_best_yet_forum = collapse_2d_complexity('p_cache_forum_id', 'cnt', $_best_yet_forum);
     foreach ($forums as $forum) {
         if (array_key_exists($forum['id'], $_best_yet_forum) && (is_null($best_yet_forum) || $_best_yet_forum[$forum['id']] > $best_yet_forum)) {
             $most_active_forum = has_category_access($member_id_viewing, 'forums', strval($forum['id'])) ? protect_from_escaping(escape_html($forum['f_name'])) : do_lang_tempcode('PROTECTED_FORUM');
             $best_yet_forum = $_best_yet_forum[$forum['id']];
         }
     }
     $post_count = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_cache_num_posts');
     $best_post_fraction = $post_count == 0 ? do_lang_tempcode('NA_EM') : make_string_tempcode(integer_format(100 * $best_yet_forum / $post_count));
     $most_active_forum = is_null($best_yet_forum) ? new ocp_tempcode() : do_lang_tempcode('_MOST_ACTIVE_FORUM', $most_active_forum, make_string_tempcode(integer_format($best_yet_forum)), array($best_post_fraction));
     $time_for_them_raw = tz_time(time(), get_users_timezone($member_id_of));
     $time_for_them = get_timezoned_time(time(), true, $member_id_of);
     $banned = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_is_perm_banned') == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
     $last_submit_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_last_submit_time');
     $submit_days_ago = intval(floor(floatval(time() - $last_submit_time) / 60.0 / 60.0 / 24.0));
     require_code('ocf_groups');
     $primary_group_id = ocf_get_member_primary_group($member_id_of);
     $primary_group = ocf_get_group_link($primary_group_id);
     $signature = get_translated_tempcode($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $last_visit_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_last_visit_time');
     if (member_is_online($member_id_of)) {
         $online_now = do_lang_tempcode('YES');
         $_online_now = true;
     } else {
         $_online_now = false;
         $minutes_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0));
         $hours_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0));
         $days_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0 / 24.0));
         $months_ago = intval(floor(floatval(time() - $last_visit_time) / 60.0 / 60.0 / 24.0 / 31.0));
         if ($minutes_ago < 180) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_MINUTES', integer_format($minutes_ago));
         } elseif ($hours_ago < 72) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_HOURS', integer_format($hours_ago));
         } elseif ($days_ago < 93) {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_DAYS', integer_format($days_ago));
         } else {
             $online_now = do_lang_tempcode('_ONLINE_NOW_NO_MONTHS', integer_format($months_ago));
         }
     }
     $join_time = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_join_time');
     $days_joined = intval(round((time() - $join_time) / 60 / 60 / 24));
     $total_posts = $GLOBALS['FORUM_DB']->query_value('f_posts', 'COUNT(*)');
     $join_date = $join_time == 0 ? '' : get_timezoned_date($join_time, false);
     $count_posts = do_lang_tempcode('_COUNT_POSTS', integer_format($post_count), float_format(floatval($post_count) / floatval($days_joined == 0 ? 1 : $days_joined)), array(float_format(floatval(100 * $post_count) / floatval($total_posts == 0 ? 1 : $total_posts))));
     $a = $avatar_url == '' ? 0 : ocf_get_member_best_group_property($member_id_of, 'max_avatar_width');
     $b = $photo_thumb_url == '' ? 0 : intval(get_option('thumb_width'));
     $right_margin = max($a, $b) == 0 ? 'auto' : strval(max($a, $b) + 6) . 'px';
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MEMBERS'))));
     if (has_specific_permission($member_id_viewing, 'see_ip')) {
         $ip_address = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_ip_address');
     } else {
         $ip_address = '';
     }
     $secondary_groups = ocf_get_members_groups($member_id_of, true);
     unset($secondary_groups[$primary_group_id]);
     if (count($secondary_groups) > 0) {
         $_secondary_groups = array();
         $all_groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true, false, false, array_keys($secondary_groups), $member_id_of);
         foreach (array_keys($secondary_groups) as $key) {
             $_secondary_groups[$key] = $all_groups[$key];
         }
         $secondary_groups = $_secondary_groups;
     }
     if (addon_installed('points')) {
         require_code('points');
         $count_points = integer_format(total_points($member_id_of));
     } else {
         $count_points = '';
     }
     $user_agent = NULL;
     $operating_system = NULL;
     if (has_specific_permission($member_id_viewing, 'show_user_browsing') && addon_installed('stats')) {
         $last_stats = $GLOBALS['SITE_DB']->query_select('stats', array('browser', 'operating_system'), array('the_user' => $member_id_of), 'ORDER BY date_and_time DESC', 1);
         if (array_key_exists(0, $last_stats)) {
             $user_agent = $last_stats[0]['browser'];
             $operating_system = $last_stats[0]['operating_system'];
         }
     }
     /*if ((get_option('allow_member_integration')!='off') && (get_option('allow_member_integration')!='hidden'))
     		{
     			$remote=$GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of,'m_password_compat_scheme')=='remote';
     		} else */
     $remote = NULL;
     $_on_probation = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_on_probation_until');
     if (is_null($_on_probation) || $_on_probation <= time()) {
         $on_probation = NULL;
     } else {
         $on_probation = strval($_on_probation);
     }
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $join_time), 'creator' => $username, 'publisher' => '', 'modified' => '', 'type' => 'Member', 'title' => '', 'identifier' => '_SEARCH:members:view:' . strval($member_id_of), 'description' => '', 'image' => $avatar_url == '' && has_specific_permission($member_id_viewing, 'view_member_photos') ? $photo_url : $avatar_url);
     // Look up member's clubs
     $clubs = array();
     if (addon_installed('ocf_clubs')) {
         $club_ids = $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id_of, true);
         $club_rows = list_to_map('id', $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), array('g_is_private_club' => 1), '', 200));
         if (count($club_rows) == 200) {
             $club_rows = NULL;
         }
         foreach ($club_ids as $club_id) {
             if (is_null($club_rows)) {
                 $club_rows = list_to_map('id', $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), array('g_is_private_club' => 1, 'id' => $club_id), '', 200));
                 if (!array_key_exists($club_id, $club_rows)) {
                     continue;
                 }
                 $club_row = $club_rows[$club_id];
                 $club_rows = NULL;
             } else {
                 if (!array_key_exists($club_id, $club_rows)) {
                     continue;
                 }
                 $club_row = $club_rows[$club_id];
             }
             $club_name = get_translated_text($club_row['g_name'], $GLOBALS['FORUM_DB']);
             $club_forum = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=f.f_description', 'f.id', array('text_original' => do_lang('FORUM_FOR_CLUB', $club_name)));
             $clubs[] = array('CLUB_NAME' => $club_name, 'CLUB_ID' => strval($club_row['id']), 'CLUB_FORUM' => is_null($club_forum) ? '' : strval($club_forum));
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_ABOUT', array('_GUID' => 'fodfjdsfjsdljfdls', 'CLUBS' => $clubs, 'REMOTE' => $remote, 'RIGHT_MARGIN' => $right_margin, 'AVATAR_WIDTH' => strval($a) . 'px', 'PHOTO_WIDTH' => strval($b) . 'px', 'MOST_ACTIVE_FORUM' => $most_active_forum, 'TIME_FOR_THEM' => $time_for_them, 'TIME_FOR_THEM_RAW' => strval($time_for_them_raw), 'SUBMIT_DAYS_AGO' => integer_format($submit_days_ago), 'SUBMIT_TIME_RAW' => strval($last_submit_time), 'LAST_VISIT_TIME_RAW' => strval($last_visit_time), 'ONLINE_NOW' => $online_now, '_ONLINE_NOW' => $_online_now, 'BANNED' => $banned, 'USER_AGENT' => $user_agent, 'OPERATING_SYSTEM' => $operating_system, 'DOB' => $dob, 'IP_ADDRESS' => $ip_address, 'COUNT_POSTS' => $count_posts, 'COUNT_POINTS' => $count_points, 'PRIMARY_GROUP' => $primary_group, 'PRIMARY_GROUP_ID' => strval($primary_group_id), 'PHOTO_URL' => $photo_url, 'PHOTO_THUMB_URL' => $photo_thumb_url, 'EMAIL_ADDRESS' => $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_email_address'), 'AVATAR_URL' => $avatar_url, 'SIGNATURE' => $signature, 'JOIN_DATE' => $join_date, 'JOIN_DATE_RAW' => strval($join_time), 'CUSTOM_FIELDS' => $custom_fields, 'ACTIONS_contact' => $actions['contact'], 'ACTIONS_profile' => $actions['profile'], 'ACTIONS_views' => $actions['views'], 'ACTIONS_usage' => $actions['usage'], 'ACTIONS_content' => $actions['content'], 'USERNAME' => $username, 'MEMBER_ID' => strval($member_id_of), 'SECONDARY_GROUPS' => $secondary_groups, 'VIEW_PROFILES' => $member_id_viewing == $member_id_of || has_specific_permission($member_id_viewing, 'view_profiles'), 'ON_PROBATION' => $on_probation, 'EXTRA_INFO_DETAILS' => $info_details, 'EXTRA_SECTIONS' => $extra_sections));
     return array($title, $content, $order);
 }
Example #17
0
 /**
  * Render posts.
  *
  * @param  integer		Maximum to load if non-threaded
  * @param  array			Tree structure of posts
  * @param  boolean		Whether the current user may reply to the topic (influences what buttons show)
  * @param  ?AUTO_LINK	Only show posts under here (NULL: show posts from root)
  * @param  array			Review ratings rows
  * @param  AUTO_LINK		ID of forum this topic in in
  * @return tempcode		Rendered tree structure
  */
 function _render_post_tree($num_to_show_limit, $tree, $may_reply, $highlight_by_user, $all_individual_review_ratings, $forum_id)
 {
     list($rendered, ) = $tree;
     $sequence = new ocp_tempcode();
     foreach ($rendered as $post) {
         if (get_forum_type() == 'ocf') {
             require_code('ocf_topicview');
             require_code('ocf_posts');
             $post += ocf_get_details_to_show_post($post);
         }
         // Misc details
         $datetime_raw = $post['date'];
         $datetime = get_timezoned_date($post['date']);
         $poster_url = is_guest($post['user']) ? new ocp_tempcode() : $GLOBALS['FORUM_DRIVER']->member_profile_url($post['user'], false, true);
         $poster_name = array_key_exists('username', $post) ? $post['username'] : $GLOBALS['FORUM_DRIVER']->get_username($post['user']);
         if (is_null($poster_name)) {
             $poster_name = do_lang('UNKNOWN');
         }
         $highlight = $highlight_by_user === $post['user'];
         // Find review, if there is one
         $individual_review_ratings = array();
         foreach ($all_individual_review_ratings as $potential_individual_review_rating) {
             if ($potential_individual_review_rating['r_post_id'] == $post['id']) {
                 $individual_review_ratings[$potential_individual_review_rating['r_rating_type']] = array('REVIEW_TITLE' => $potential_individual_review_rating['r_rating_type'], 'REVIEW_RATING' => float_to_raw_string($potential_individual_review_rating['r_rating']));
             }
         }
         // Edit URL
         $emphasis = new ocp_tempcode();
         $buttons = new ocp_tempcode();
         $last_edited = new ocp_tempcode();
         $last_edited_raw = '';
         $unvalidated = new ocp_tempcode();
         $poster = mixed();
         $poster_details = new ocp_tempcode();
         $is_spacer_post = false;
         if (get_forum_type() == 'ocf') {
             // Spacer post fiddling
             if (!is_null($this->first_post_id) && !is_null($this->topic_title) && !is_null($this->topic_description) && !is_null($this->topic_description_link)) {
                 $is_spacer_post = $post['id'] == $this->first_post_id && substr($post['message_comcode'], 0, strlen('[semihtml]' . do_lang('SPACER_POST_MATCHER'))) == '[semihtml]' . do_lang('SPACER_POST_MATCHER');
                 if ($is_spacer_post) {
                     $c_prefix = do_lang('COMMENT') . ': #';
                     if (substr($this->topic_description, 0, strlen($c_prefix)) == $c_prefix && $this->topic_description_link != '') {
                         list($linked_type, $linked_id) = explode('_', substr($this->topic_description, strlen($c_prefix)), 2);
                         $linked_url = $this->topic_description_link;
                         require_code('ocf_posts');
                         list($new_description, $new_post) = ocf_display_spacer_post($linked_type, $linked_id);
                         //if (!is_null($new_description)) $this->topic_description=$new_description;	Actually, it's a bit redundant
                         if (!is_null($new_post)) {
                             $post['message'] = $new_post;
                         }
                         $highlight = false;
                         $this->topic_title = do_lang('SPACER_TOPIC_TITLE_WRAP', $this->topic_title);
                         $post['title'] = do_lang('SPACER_TOPIC_TITLE_WRAP', $post['title']);
                         $this->topic_description = '';
                     }
                 }
             }
             // Misc meta details for post
             $emphasis = ocf_get_post_emphasis($post);
             $unvalidated = $post['validated'] == 0 ? do_lang_tempcode('UNVALIDATED') : new ocp_tempcode();
             if (array_key_exists('last_edit_time', $post)) {
                 $last_edited = do_template('OCF_TOPIC_POST_LAST_EDITED', array('LAST_EDIT_DATE_RAW' => is_null($post['last_edit_time']) ? '' : strval($post['last_edit_time']), 'LAST_EDIT_DATE' => $post['last_edit_time_string'], 'LAST_EDIT_PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($post['last_edit_by'], false, true), 'LAST_EDIT_USERNAME' => $post['last_edit_by_username']));
                 $last_edited_raw = is_null($post['last_edit_time']) ? '' : strval($post['last_edit_time']);
             }
             // Post buttons
             if (!$is_spacer_post) {
                 if (!is_null($this->topic_id)) {
                     if (is_null($this->topic_info)) {
                         $this->topic_info = ocf_read_in_topic($this->topic_id, 0, 0, false, false);
                     }
                     require_lang('ocf');
                     $buttons = ocf_render_post_buttons($this->topic_info, $post, $may_reply);
                 }
             }
             // OCF renderings of poster
             static $hooks = NULL;
             if (is_null($hooks)) {
                 $hooks = find_all_hooks('modules', 'topicview');
             }
             static $hook_objects = NULL;
             if (is_null($hook_objects)) {
                 $hook_objects = array();
                 foreach (array_keys($hooks) as $hook) {
                     require_code('hooks/modules/topicview/' . filter_naughty_harsh($hook));
                     $object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
                     if (is_null($object)) {
                         continue;
                     }
                     $hook_objects[$hook] = $object;
                 }
             }
             if (!$is_spacer_post) {
                 if (!is_guest($post['poster'])) {
                     require_code('ocf_members2');
                     $poster_details = ocf_show_member_box($post, false, $hooks, $hook_objects, false);
                 } else {
                     $custom_fields = new ocp_tempcode();
                     if (array_key_exists('ip_address', $post) && addon_installed('ocf_forum')) {
                         $custom_fields->attach(do_template('OCF_TOPIC_POST_CUSTOM_FIELD', array('NAME' => do_lang_tempcode('IP_ADDRESS'), 'VALUE' => $post['ip_address'])));
                         $poster_details = do_template('OCF_GUEST_DETAILS', array('CUSTOM_FIELDS' => $custom_fields));
                     } else {
                         $poster_details = new ocp_tempcode();
                     }
                 }
             }
             if (addon_installed('ocf_forum')) {
                 if (!is_guest($post['poster'])) {
                     $poster = do_template('OCF_POSTER_MEMBER', array('ONLINE' => member_is_online($post['poster']), 'ID' => strval($post['poster']), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($post['poster'], false, true), 'POSTER_USERNAME' => $post['poster_username']));
                 } else {
                     $ip_link = array_key_exists('ip_address', $post) && has_actual_page_access(get_member(), 'admin_lookup') ? build_url(array('page' => 'admin_lookup', 'param' => $post['ip_address']), get_module_zone('admin_lookup')) : new ocp_tempcode();
                     $poster = do_template('OCF_POSTER_GUEST', array('IP_LINK' => $ip_link, 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $post['poster_username']));
                 }
             } else {
                 $poster = make_string_tempcode(escape_html($post['poster_username']));
             }
         }
         // Child posts
         $children = mixed();
         // NULL
         $other_ids = array();
         if (array_key_exists('children', $post)) {
             foreach ($post['children'][1] as $u) {
                 $other_ids[] = strval($u['id']);
             }
             if ($this->is_threaded) {
                 $children = $this->_render_post_tree($num_to_show_limit, $post['children'], $may_reply, $highlight_by_user, $all_individual_review_ratings, $forum_id);
             }
         }
         if (get_forum_type() == 'ocf') {
             require_code('feedback');
             actualise_rating(true, 'post', strval($post['id']), get_self_url(), $post['title']);
             $rating = display_rating(get_self_url(), $post['title'], 'post', strval($post['id']), 'RATING_INLINE_DYNAMIC', $post['user']);
         } else {
             $rating = new ocp_tempcode();
         }
         if (array_key_exists('intended_solely_for', $post)) {
             decache('side_ocf_personal_topics', array(get_member()));
             decache('_new_pp', array(get_member()));
         }
         // Render
         $sequence->attach(static_evaluate_tempcode(do_template('POST', array('_GUID' => 'eb7df038959885414e32f58e9f0f9f39', 'INDIVIDUAL_REVIEW_RATINGS' => $individual_review_ratings, 'HIGHLIGHT' => $highlight, 'TITLE' => $post['title'], 'TIME_RAW' => strval($datetime_raw), 'TIME' => $datetime, 'POSTER_ID' => strval($post['user']), 'POSTER_URL' => $poster_url, 'POSTER_NAME' => $poster_name, 'POSTER' => $poster, 'POSTER_DETAILS' => $poster_details, 'ID' => strval($post['id']), 'POST' => $post['message'], 'POST_COMCODE' => isset($post['message_comcode']) ? $post['message_comcode'] : NULL, 'CHILDREN' => $children, 'OTHER_IDS' => count($other_ids) == 0 ? NULL : $other_ids, 'RATING' => $rating, 'EMPHASIS' => $emphasis, 'BUTTONS' => $buttons, 'LAST_EDITED_RAW' => $last_edited_raw, 'LAST_EDITED' => $last_edited, 'TOPIC_ID' => is_null($this->topic_id) ? '' : strval($this->topic_id), 'UNVALIDATED' => $unvalidated, 'IS_SPACER_POST' => $is_spacer_post, 'NUM_TO_SHOW_LIMIT' => strval($num_to_show_limit)))));
     }
     return $sequence;
 }
Example #18
0
 /**
  * View a single filled-in survey.
  *
  * @return tempcode	The result of execution.
  */
 function __survey_results()
 {
     $title = get_page_title('SURVEY_RESULTS');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/survey_results';
     require_code('templates_view_space');
     $id = get_param_integer('id');
     // entry ID
     $fields = new ocp_tempcode();
     $rows = $GLOBALS['SITE_DB']->query_select('quiz_entries', array('q_time', 'q_member'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $member_id = $rows[0]['q_member'];
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id);
     if (is_null($username)) {
         $username = do_lang('UNKNOWN');
     }
     $date = get_timezoned_date($rows[0]['q_time']);
     $question_rows = $GLOBALS['SITE_DB']->query_select('quiz_questions q LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'quiz_entry_answer a ON q.id=a.q_question', array('q.id', 'q_question_text', 'q_answer', 'q_quiz'), array('q_entry' => $id), 'ORDER BY q.id');
     foreach ($question_rows as $q) {
         $quiz_id = $q['q_quiz'];
         $answer = $q['q_answer'];
         if (is_numeric($answer)) {
             $answer_rows = $GLOBALS['SITE_DB']->query_select('quiz_question_answers', array('q_answer_text'), array('q_question' => $q['id'], 'id' => intval($answer)), 'ORDER BY id');
             if (array_key_exists(0, $answer_rows)) {
                 $answer = get_translated_text($answer_rows[0]['q_answer_text']);
             }
         }
         $fields->attach(view_space_field(get_translated_text($q['q_question_text']), $answer));
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF', do_lang_tempcode('MANAGE_QUIZZES')), array('_SELF:_SELF:_survey_results:id=' . strval($quiz_id), do_lang_tempcode('SURVEY_RESULTS'))));
     breadcrumb_set_self(do_lang_tempcode('RESULT'));
     $member_url = get_base_url();
     if (!is_guest($member_id)) {
         $member_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true);
         if (is_object($member_url)) {
             $member_url = $member_url->evaluate();
         }
     }
     return do_template('VIEW_SPACE_SCREEN', array('_GUID' => '02b4dd6d52feaf3844e631e56395c4da', 'TITLE' => $title, 'TEXT' => do_lang_tempcode('SURVEY_WAS_ENTERED_AS_FOLLOWS', escape_html($username), escape_html($member_url), escape_html($date)), 'FIELDS' => $fields));
 }
Example #19
0
/**
 * Show a post, isolated of the other posts in it's topic.
 *
 * @param  array		The post row.
 * @param  boolean	Whether to use the post title, as opposed to the post's topic's title.
 * @return tempcode  The isolated post.
 */
function ocf_show_isolated_post($row, $use_post_title = false)
{
    require_code('ocf_groups');
    require_css('ocf');
    // Poster title
    $primary_group = $GLOBALS['FORUM_DRIVER']->get_member_row_field($row['p_poster'], 'm_primary_group');
    if (!is_null($primary_group)) {
        if (addon_installed('ocf_member_titles')) {
            $poster_title = $GLOBALS['OCF_DRIVER']->get_member_row_field($row['p_poster'], 'm_title');
            if ($poster_title == '') {
                $poster_title = get_translated_text(ocf_get_group_property($primary_group, 'title'), $GLOBALS['FORUM_DB']);
            }
        } else {
            $poster_title = '';
        }
        $avatar = $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($row['p_poster']);
        $posters_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups($row['p_poster'], true);
    } else {
        $poster_title = '';
        $avatar = '';
        $posters_groups = array();
    }
    // Avatar
    if (is_guest($row['p_poster'])) {
        if ($row['p_poster_name_if_guest'] == do_lang('SYSTEM')) {
            $avatar = find_theme_image('ocf_default_avatars/default_set/ocp_fanatic', true);
        }
    }
    if ($avatar != '') {
        $post_avatar = do_template('OCF_TOPIC_POST_AVATAR', array('AVATAR' => $avatar));
    } else {
        $post_avatar = new ocp_tempcode();
    }
    // Rank images
    $rank_images = new ocp_tempcode();
    foreach ($posters_groups as $group) {
        $rank_image = ocf_get_group_property($group, 'rank_image');
        $group_leader = ocf_get_group_property($group, 'group_leader');
        $group_name = ocf_get_group_name($group);
        $rank_image_pri_only = ocf_get_group_property($group, 'rank_image_pri_only');
        if ($rank_image != '' && ($rank_image_pri_only == 0 || $group == $primary_group)) {
            $rank_images->attach(do_template('OCF_RANK_IMAGE', array('GROUP_NAME' => $group_name, 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($row['p_poster']), 'IMG' => $rank_image, 'IS_LEADER' => $group_leader == $row['p_poster'])));
        }
    }
    // Poster details
    if (!is_guest($row['p_poster']) && !is_null($primary_group)) {
        require_code('ocf_members2');
        $poster_details = ocf_show_member_box($row['p_poster'], false, NULL, NULL, false);
    } else {
        $custom_fields = new ocp_tempcode();
        $poster_details = new ocp_tempcode();
    }
    if (!is_guest($row['p_poster']) && !is_null($primary_group)) {
        $poster = do_template('OCF_POSTER_MEMBER', array('ONLINE' => member_is_online($row['p_poster']), 'ID' => strval($row['p_poster']), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($row['p_poster'], false, true), 'POSTER_USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($row['p_poster']), 'HIGHLIGHT_NAME' => NULL));
    } else {
        $poster = do_template('OCF_POSTER_GUEST', array('IP_LINK' => '', 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $row['p_poster_name_if_guest'] != '' ? $row['p_poster_name_if_guest'] : do_lang('GUEST')));
    }
    // Last edited
    if (!is_null($row['p_last_edit_time'])) {
        $last_edited = do_template('OCF_TOPIC_POST_LAST_EDITED', array('LAST_EDIT_DATE_RAW' => is_null($row['p_last_edit_time']) ? '' : strval($row['p_last_edit_time']), 'LAST_EDIT_DATE' => get_timezoned_date($row['p_last_edit_time']), 'LAST_EDIT_PROFILE_URL' => is_null($row['p_last_edit_by']) ? '' : $GLOBALS['FORUM_DRIVER']->member_profile_url($row['p_last_edit_by'], false, true), 'LAST_EDIT_USERNAME' => is_null($row['p_last_edit_by']) ? '' : $GLOBALS['FORUM_DRIVER']->get_username($row['p_last_edit_by'])));
    } else {
        $last_edited = new ocp_tempcode();
    }
    $last_edited_raw = is_null($row['p_last_edit_time']) ? '' : strval($row['p_last_edit_time']);
    // Misc stuff
    $poster_id = $row['p_poster'];
    $tree = ocf_forum_breadcrumbs($row['p_cache_forum_id']);
    $post_url = build_url(array('page' => 'topicview', 'type' => 'findpost', 'id' => $row['id']), get_module_zone('topicview'));
    $post_url->attach('#post_' . strval($row['id']));
    if (get_page_name() != 'search' && array_key_exists('text_parsed', $row) && !is_null($row['text_parsed']) && $row['text_parsed'] != '' && $row['p_post'] != 0) {
        $post = new ocp_tempcode();
        if (!$post->from_assembly($row['text_parsed'], true)) {
            $post = get_translated_tempcode($row['p_post'], $GLOBALS['FORUM_DB']);
        }
    } else {
        $post = get_translated_tempcode($row['p_post'], $GLOBALS['FORUM_DB']);
    }
    $post_date = get_timezoned_date($row['p_time']);
    $post_date_raw = $row['p_time'];
    if ($use_post_title) {
        $post_title = $row['p_title'];
    } else {
        $post_title = $GLOBALS['FORUM_DB']->query_value('f_topics', 't_cache_first_title', array('id' => $row['p_topic_id']));
        if ($row['p_title'] != $post_title) {
            $post_title .= ': ' . $row['p_title'];
        }
    }
    //if ($post_title=='') $post_title=do_lang_tempcode('ISOLATED_POST_TITLE',strval($row['id']));
    $emphasis = new ocp_tempcode();
    if ($row['p_is_emphasised'] == 1) {
        $emphasis = do_lang_tempcode('IMPORTANT');
    } elseif (!is_null($row['p_intended_solely_for'])) {
        $pp_to_username = $GLOBALS['FORUM_DRIVER']->get_username($row['p_intended_solely_for']);
        if (is_null($pp_to_username)) {
            $pp_to_username = do_lang('UNKNOWN');
        }
        $emphasis = do_lang('PP_TO', $pp_to_username);
    }
    require_code('feedback');
    actualise_rating(true, 'post', strval($row['id']), get_self_url(), $row['p_title']);
    $rating = display_rating(get_self_url(), $row['p_title'], 'post', strval($row['id']), 'RATING_INLINE_DYNAMIC', $row['p_poster']);
    // Render
    return do_template('OCF_ISOLATED_POST', array('_GUID' => '9456f4fe4b8fb1bf34f606fcb2bcc9d7', 'URL' => $post_url, 'ID' => strval($row['id']), 'TREE' => $tree, 'POST' => do_template('OCF_TOPIC_POST', array('ID' => strval($row['id']), 'TOPIC_FIRST_POST_ID' => '', 'TOPIC_FIRST_POSTER' => '', 'POST_ID' => strval($row['id']), 'URL' => $post_url, 'CLASS' => $row['p_is_emphasised'] == 1 ? 'ocf_post_emphasis' : (!is_null($row['p_intended_solely_for']) ? 'ocf_post_personal' : ''), 'EMPHASIS' => $emphasis, 'FIRST_UNREAD' => '', 'POSTER_TITLE' => $poster_title, 'POST_TITLE' => $post_title, 'POST_DATE_RAW' => strval($post_date_raw), 'POST_DATE' => $post_date, 'POST' => $post, 'TOPIC_ID' => is_null($row['p_topic_id']) ? '' : strval($row['p_topic_id']), 'LAST_EDITED_RAW' => $last_edited_raw, 'LAST_EDITED' => $last_edited, 'POSTER_ID' => strval($poster_id), 'POSTER' => $poster, 'POSTER_DETAILS' => $poster_details, 'POST_AVATAR' => $post_avatar, 'RANK_IMAGES' => $rank_images, 'BUTTONS' => '', 'SIGNATURE' => '', 'UNVALIDATED' => '', 'DESCRIPTION' => '', 'PREVIEWING' => true, 'RATING' => $rating))));
}
Example #20
0
/**
 * Convert an internal booking details structure to a 'printable' version of the same.
 *
 * @param  array		Booking details structure.
 * @return array		Printable booking details structure.
 */
function make_booking_request_printable($request)
{
    $out = array();
    foreach ($request as $_part) {
        $start = mktime(0, 0, 0, $_part['start_month'], $_part['start_day'], $_part['start_year']);
        $end = mktime(0, 0, 0, $_part['end_month'], $_part['end_day'], $_part['end_year']);
        $bookable_row = $GLOBALS['SITE_DB']->query_select('bookable', array('*'), array('id' => $_part['bookable_id']), '', 1);
        $part = array('BOOKABLE_TITLE' => get_translated_tempcode($bookable_row[0]['title']), 'PRICE' => float_format($bookable_row[0]['price']), 'CATEGORISATION' => get_translated_text($bookable_row[0]['categorisation']), 'DESCRIPTION' => get_translated_tempcode($bookable_row[0]['description']), 'QUANTITY' => integer_format($_part['quantity']), '_QUANTITY' => strval($_part['quantity']), 'START' => get_timezoned_date($start, false, true, false, true), 'END' => $start == $end ? '' : get_timezoned_date($end, false, true, false, true), '_START' => strval($start), '_END' => strval($end), 'NOTES' => $_part['notes'], 'SUPPLEMENTS' => array());
        foreach ($_part['supplements'] as $supplement_id => $supplement) {
            $supplement_row = $GLOBALS['SITE_DB']->query_select('bookable_supplement', array('*'), array('id' => $supplement_id), '', 1);
            $part['SUPPLEMENTS'][] = array('SUPPLEMENT_TITLE' => get_translated_tempcode($supplement_row[0]['title']), 'SUPPLEMENT_PRICE' => float_format($supplement_row[0]['price']), 'SUPPLEMENT_PRICE_IS_PER_PERIOD' => $supplement_row[0]['price_is_per_period'] == 1, 'SUPPLEMENT_QUANTITY' => integer_format($supplement['quantity']), '_SUPPLEMENT_QUANTITY' => strval($supplement['quantity']), 'SUPPLEMENT_NOTES' => $supplement['notes']);
        }
        $out[] = $part;
    }
    return $out;
}
Example #21
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (has_no_forum()) {
         return new ocp_tempcode();
     }
     require_css('news');
     // Read in variables
     $forum_name = array_key_exists('param', $map) ? $map['param'] : 'General chat';
     $limit = array_key_exists('limit', $map) ? intval($map['limit']) : 6;
     $hot = array_key_exists('hot', $map) ? intval($map['hot']) : 0;
     $date_key = array_key_exists('date_key', $map) ? $map['date_key'] : 'lasttime';
     if ($date_key != 'lasttime' && $date_key != 'firsttime') {
         $date_key = 'firsttime';
     }
     $username_key = array_key_exists('username_key', $map) ? $map['username_key'] : 'firstusername';
     if ($username_key != 'lastusername' && $username_key != 'firstusername') {
         $username_key = 'firstusername';
     }
     $memberid_key = $username_key == 'firstusername' ? 'firstmemberid' : 'lastmemberid';
     // Work out exactly what forums we're reading
     $forum_ids = array();
     if (get_forum_type() == 'ocf' && (strpos($forum_name, ',') !== false || strpos($forum_name, '*') !== false || preg_match('#\\d[-\\*\\+]#', $forum_name) != 0 || is_numeric($forum_name))) {
         require_code('ocfiltering');
         $forum_names = ocfilter_to_idlist_using_db($forum_name, 'id', 'f_forums', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
     } else {
         $forum_names = explode(',', $forum_name);
     }
     foreach ($forum_names as $forum_name) {
         if (!is_string($forum_name)) {
             $forum_name = strval($forum_name);
         }
         $forum_name = trim($forum_name);
         if ($forum_name == '<announce>') {
             $forum_id = NULL;
         } else {
             $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         }
         if (get_forum_type() == 'ocf' && array_key_exists('check', $map) && $map['check'] == '1') {
             if (!has_category_access(get_member(), 'forums', strval($forum_id))) {
                 continue;
             }
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
         }
     }
     // Block title
     $forum_name = array_key_exists('param', $map) ? $map['param'] : 'General chat';
     if (is_numeric($forum_name) && get_forum_type() == 'ocf') {
         $forum_name = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_name', array('id' => intval($forum_name)));
         if (is_null($forum_name)) {
             return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
         }
     }
     $_title = do_lang_tempcode('ACTIVE_TOPICS_IN', escape_html($forum_name));
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $_title = protect_from_escaping(escape_html($map['title']));
     }
     // Add topic link
     if (count($forum_names) == 1 && get_forum_type() == 'ocf' && !is_null($forum_id)) {
         $submit_url = build_url(array('page' => 'topics', 'type' => 'new_topic', 'id' => $forum_id), get_module_zone('topics'));
         $add_name = do_lang_tempcode('ADD_TOPIC');
     } else {
         $submit_url = new ocp_tempcode();
         $add_name = new ocp_tempcode();
     }
     // Show all topics
     if (get_forum_type() == 'ocf') {
         $forum_names_map = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
     } else {
         $forum_names_map = NULL;
     }
     if (!has_no_forum()) {
         $max_rows = 0;
         $topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', true, $date_key, $hot == 1);
         $out = new ocp_tempcode();
         if (!is_null($topics)) {
             global $M_SORT_KEY;
             $M_SORT_KEY = $date_key;
             usort($topics, 'multi_sort');
             $topics = array_reverse($topics, false);
             if (count($topics) < $limit && $hot == 1) {
                 $more_topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', true, $date_key);
                 if (is_null($more_topics)) {
                     $more_topics = array();
                 }
                 $topics = array_merge($topics, $more_topics);
             }
             $done = 0;
             $seen = array();
             foreach ($topics as $topic) {
                 if (array_key_exists($topic['id'], $seen)) {
                     continue;
                 }
                 $seen[$topic['id']] = 1;
                 $topic_url = $GLOBALS['FORUM_DRIVER']->topic_url($topic['id'], $forum_name);
                 $topic_url_unread = mixed();
                 if (get_forum_type() == 'ocf') {
                     $topic_url_unread = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'first_unread'), get_module_zone('topicview'), NULL, false, false, false, 'first_unread');
                 }
                 $title = escape_html($topic['title']);
                 $date = get_timezoned_date($topic[$date_key]);
                 $username = $topic[$username_key];
                 $member_id = array_key_exists($memberid_key, $topic) ? $topic[$memberid_key] : NULL;
                 if (!is_null($forum_names_map) && !array_key_exists($topic['forum_id'], $forum_names_map)) {
                     continue;
                 }
                 // Maybe Private Topic, slipped in via reference to a missing forum
                 $forum_name = is_null($forum_names_map) ? NULL : $forum_names_map[$topic['forum_id']];
                 $out->attach(do_template('BLOCK_MAIN_FORUM_TOPICS_TOPIC', array('_GUID' => 'ae4e351b3fa5422bf8ecdfb7e49076d1', 'POST' => $topic['firstpost'], 'FORUM_ID' => is_null($forum_names_map) ? NULL : strval($topic['forum_id']), 'FORUM_NAME' => $forum_name, 'TOPIC_LINK' => $topic_url, 'TOPIC_LINK_UNREAD' => $topic_url_unread, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic[$date_key]), 'USERNAME' => $username, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'NUM_POSTS' => integer_format($topic['num']))));
                 $done++;
                 if ($done == $limit) {
                     break;
                 }
             }
         }
         if ($out->is_empty()) {
             return do_template('BLOCK_NO_ENTRIES', array('_GUID' => 'c76ab018a0746c2875c6cf69c92a01fb', 'HIGH' => false, 'FORUM_NAME' => array_key_exists('param', $map) ? $map['param'] : 'General chat', 'TITLE' => $_title, 'MESSAGE' => do_lang_tempcode($hot == 1 ? 'NO_TOPICS_HOT' : 'NO_TOPICS'), 'ADD_NAME' => $add_name, 'SUBMIT_URL' => $submit_url));
         }
         return do_template('BLOCK_MAIN_FORUM_TOPICS', array('_GUID' => '368b80c49a335ad035b00510681d5008', 'TITLE' => $_title, 'CONTENT' => $out, 'FORUM_NAME' => array_key_exists('param', $map) ? $map['param'] : 'General chat', 'SUBMIT_URL' => $submit_url));
     } else {
         return new ocp_tempcode();
     }
 }
Example #22
0
 /**
  * Actulizer to build csv from the selected filters
  *
  * @param  boolean	Whether to avoid exit (useful for unit test).
  */
 function _order_export($inline = false)
 {
     require_code('shopping');
     $start_date = get_input_date('start_date', true);
     $end_date = get_input_date('end_date', true);
     $order_status = post_param('order_status');
     $filename = 'Orders_' . $order_status . '__' . get_timezoned_date($start_date, false, false, false, true) . '-' . get_timezoned_date($end_date, false, false, false, true) . '.csv';
     $orders = array();
     $data = array();
     $cond = "t1.add_date BETWEEN " . strval($start_date) . " AND " . strval($end_date);
     if ($order_status != 'all') {
         $cond .= " AND t1.order_status='" . db_escape_string($order_status) . "'";
     }
     $qry = "SELECT t1.*,(t2.included_tax*t2.p_quantity) as \t\n\t\t\t\t\t\t\t\ttax_amt,t3.address_name,t3.address_street,t3.address_city,t3.address_zip,\n\t\t\t\t\t\t\t\tt3.address_country,t3.receiver_email\n\t\t\t\t\t\t\t\tFROM " . get_table_prefix() . "shopping_order t1\n\t\t\t\t\t\t\t\tLEFT JOIN " . get_table_prefix() . "shopping_order_details t2 ON t1.id = t2.order_id\n\t\t\t\t\t\t\t\tLEFT JOIN " . get_table_prefix() . "shopping_order_addresses t3 ON t1.id = t3.order_id\n\t\t\t\t\t\t\t\tWHERE " . $cond;
     $row = $GLOBALS['SITE_DB']->query($qry);
     remove_duplicate_rows($row);
     foreach ($row as $order) {
         $orders[do_lang('ORDER_NUMBER')] = strval($order['id']);
         $orders[do_lang('ORDERED_DATE')] = get_timezoned_date($order['add_date'], true, false, true, true);
         $orders[do_lang('ORDER_PRICE')] = $order['tot_price'];
         $orders[do_lang('ORDER_STATUS')] = do_lang($order['order_status']);
         $orders[do_lang('ORDER_TAX_OPT_OUT')] = $order['tax_opted_out'] ? do_lang('YES') : do_lang('NO');
         $orders[do_lang('TOTAL_TAX_PAID')] = is_null($order['tax_amt']) ? float_format(0.0, 2) : float_format($order['tax_amt'], 2);
         $orders[do_lang('ORDERED_PRODUCTS')] = get_ordered_product_list_string($order['id']);
         $orders[do_lang('ORDERED_BY')] = $GLOBALS['FORUM_DRIVER']->get_username($order['c_member']);
         $address = array();
         $address['name'] = array_key_exists('address_name', $order) ? $order['address_name'] : NULL;
         $address['city'] = array_key_exists('address_city', $order) ? $order['address_city'] : NULL;
         $address['zip'] = array_key_exists('address_zip', $order) ? $order['address_zip'] : NULL;
         $address['country'] = array_key_exists('address_country', $order) ? $order['address_country'] : NULL;
         if (!is_null($address['name'])) {
             $full_address = implode(chr(10), $address);
         } else {
             $full_address = "";
         }
         $orders[do_lang('FULL_ADDRESS')] = $full_address;
         $data[] = $orders;
     }
     require_code('files2');
     make_csv($data, $filename, !$inline, !$inline);
 }
Example #23
0
 /**
  * Show undelivered invoices.
  *
  * @return tempcode	The interface.
  */
 function undelivered()
 {
     $title = get_page_title('UNDELIVERED_INVOICES');
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('INVOICES'))));
     $invoices = array();
     $rows = $GLOBALS['SITE_DB']->query_select('invoices', array('*'), array('i_state' => 'paid'));
     foreach ($rows as $row) {
         $invoice_title = do_lang('CUSTOM_PRODUCT_' . $row['i_type_code']);
         $time = get_timezoned_date($row['i_time']);
         $username = $GLOBALS['FORUM_DRIVER']->get_username($row['i_member_id']);
         $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($row['i_member_id'], false, true);
         $invoices[] = array('INVOICE_TITLE' => $invoice_title, 'PROFILE_URL' => $profile_url, 'USERNAME' => $username, 'ID' => strval($row['id']), 'STATE' => $row['i_state'], 'AMOUNT' => $row['i_amount'], 'TIME' => $time, 'NOTE' => $row['i_note'], 'TYPE_CODE' => $row['i_type_code']);
     }
     if (count($invoices) == 0) {
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     return do_template('ECOM_OUTSTANDING_INVOICES_SCREEN', array('_GUID' => '672e41d8cbe06f046a47762ff75c8337', 'TITLE' => $title, 'FROM' => 'undelivered', 'INVOICES' => $invoices));
 }
Example #24
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_all_lang();
     require_css('adminzone');
     require_code('actionlog');
     $start = get_param_integer('sa_start', 0);
     $max = get_param_integer('sa_max', 10);
     $sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'the_type' => do_lang_tempcode('ACTION'));
     $test = explode(' ', get_param('sa_sort', 'date_and_time DESC'), 2);
     if (count($test) == 1) {
         $test[1] = 'DESC';
     }
     list($sortable, $sort_order) = $test;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sa_sort';
     require_code('templates_results_table');
     $fields_title = results_field_title(array(do_lang_tempcode('USERNAME'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTION'), do_lang_tempcode('PARAMETER_A'), do_lang_tempcode('PARAMETER_B')), $sortables, 'sa_sort', $sortable . ' ' . $sort_order);
     $max_rows = $max;
     //Don't want to encourage pagination (there's a better module they can go to) $GLOBALS['SITE_DB']->query_value('adminlogs','COUNT(*)');
     $rows = $GLOBALS['SITE_DB']->query_select('adminlogs', array('the_type', 'param_a', 'param_b', 'the_user', 'ip', 'date_and_time'), NULL, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
     $fields = new ocp_tempcode();
     foreach ($rows as $myrow) {
         $username = $GLOBALS['FORUM_DRIVER']->get_username($myrow['the_user']);
         if (is_null($username)) {
             $username = do_lang('UNKNOWN');
         }
         $date = get_timezoned_date($myrow['date_and_time']);
         if (!is_null($myrow['param_a'])) {
             $a = $myrow['param_a'];
         } else {
             $a = '';
         }
         if (!is_null($myrow['param_b'])) {
             $b = $myrow['param_b'];
         } else {
             $b = '';
         }
         require_code('templates_interfaces');
         $_a = tpl_crop_text_mouse_over($a, 8);
         $_b = tpl_crop_text_mouse_over($b, 15);
         $type_str = do_lang($myrow['the_type'], $_a, $_b, NULL, NULL, false);
         if (is_null($type_str)) {
             $type_str = $myrow['the_type'];
         }
         $test = actionlog_linkage($myrow['the_type'], $a, $b, $_a, $_b);
         if (!is_null($test)) {
             list($_a, $_b) = $test;
         }
         $ip = tpl_crop_text_mouse_over($myrow['ip'], 12);
         $fields->attach(results_entry(array(escape_html($username), escape_html($date), $type_str, $_a, $_b)));
     }
     return results_table(do_lang_tempcode('ACTIONS'), $start, 'sa_start', $max, 'sa_max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sa_sort', new ocp_tempcode(), NULL, NULL, 5);
 }
Example #25
0
 /**
  * The UI to view an IOTD.
  *
  * @return tempcode		The UI
  */
 function view()
 {
     $title = get_page_title('IOTD');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IOTD_ARCHIVE'))));
     $id = get_param_integer('id');
     $rows = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => $id), '', 1);
     if (!array_key_exists(0, $rows)) {
         return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE'));
     }
     $myrow = $rows[0];
     list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], is_null($myrow['date_and_time']) && $myrow['used'] == 0 ? 0 : 1, $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['i_title']), get_value('comment_forum__iotds'));
     $date_raw = strval($myrow['date_and_time']);
     $add_date_raw = strval($myrow['add_date']);
     $edit_date_raw = is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']);
     $date = get_timezoned_date($myrow['date_and_time']);
     $add_date = get_timezoned_date($myrow['add_date']);
     $edit_date = get_timezoned_date($myrow['edit_date']);
     // Views
     if (get_db_type() != 'xml') {
         $myrow['iotd_views']++;
         $GLOBALS['SITE_DB']->query_update('iotd', array('iotd_views' => $myrow['iotd_views']), array('id' => $id), '', 1, NULL, false, true);
     }
     if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], 'cms_iotds')) {
         $edit_url = build_url(array('page' => 'cms_iotds', 'type' => '_ed', 'id' => $id), get_module_zone('cms_iotds'));
     } else {
         $edit_url = new ocp_tempcode();
     }
     $url = $myrow['url'];
     if (url_is_local($url)) {
         $url = get_custom_base_url() . '/' . $url;
     }
     $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Poll', 'title' => get_translated_text($myrow['i_title']), 'identifier' => '_SEARCH:iotds:view:' . strval($id), 'description' => '', 'image' => $url);
     return do_template('IOTD_VIEW_SCREEN', array('_GUID' => 'f508d483459b88fab44cd8b9f4db780b', 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'I_TITLE' => get_translated_tempcode($myrow['i_title']), 'CAPTION' => get_translated_tempcode($myrow['caption']), 'DATE_RAW' => $date_raw, 'ADD_DATE_RAW' => $add_date_raw, 'EDIT_DATE_RAW' => $edit_date_raw, 'DATE' => $date, 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'VIEWS' => integer_format($myrow['iotd_views']), 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'URL' => $url));
 }
Example #26
0
 /**
  * The main user interface for moderating a chat room.
  *
  * @return tempcode	The UI.
  */
 function moderate_chat_room()
 {
     $title = get_page_title('CHAT_MOD_PANEL');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE'))));
     $room_id = get_param_integer('id');
     check_chatroom_access($room_id);
     $room_details = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1);
     if (!array_key_exists(0, $room_details)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $row = $room_details[0];
     $has_mod_access = has_specific_permission(get_member(), 'edit_lowrange_content', 'cms_chat', array('chat', $room_id)) || $row['room_owner'] == get_member() && has_specific_permission(get_member(), 'moderate_my_private_rooms');
     if (!$has_mod_access) {
         access_denied('SPECIFIC_PERMISSION', 'edit_lowrange_content');
     }
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 50);
     $sortables = array('date_and_time' => do_lang_tempcode('DATE_TIME'), 'user_id' => do_lang_tempcode('MEMBER'));
     $test = explode(' ', get_param('sort', 'date_and_time DESC'), 2);
     if (count($test) == 1) {
         $test[1] = 'DESC';
     }
     list($sortable, $sort_order) = $test;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $max_rows = $GLOBALS['SITE_DB']->query_value('chat_messages', 'COUNT(*)', array('room_id' => $room_id));
     $rows = $GLOBALS['SITE_DB']->query_select('chat_messages', array('*'), array('room_id' => $room_id), 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
     $fields = new ocp_tempcode();
     require_code('templates_results_table');
     $array = array(do_lang_tempcode('MEMBER'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('MESSAGE'));
     if (has_js()) {
         $array[] = do_lang_tempcode('DELETE');
     }
     $fields_title = results_field_title($array, $sortables, 'sort', $sortable . ' ' . $sort_order);
     foreach ($rows as $myrow) {
         $url = build_url(array('page' => '_SELF', 'type' => 'ed', 'room_id' => $room_id, 'id' => $myrow['id']), '_SELF');
         $username = $GLOBALS['FORUM_DRIVER']->get_username($myrow['user_id']);
         if (is_null($username)) {
             $username = '';
         }
         //do_lang('UNKNOWN');
         $message = get_translated_tempcode($myrow['the_message']);
         $link_time = hyperlink($url, escape_html(get_timezoned_date($myrow['date_and_time'])));
         $_row = array($GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($GLOBALS['FORUM_DRIVER']->get_member_from_username($username), false, $username), escape_html($link_time), $message);
         if (has_js()) {
             $deletion_tick = do_template('RESULTS_TABLE_TICK', array('ID' => strval($myrow['id'])));
             $_row[] = $deletion_tick;
         }
         $fields->attach(results_entry($_row));
     }
     if ($fields->is_empty()) {
         if ($start != 0) {
             $_GET['start'] = strval(max(0, $start - $max));
             return $this->moderate_chat_room();
         }
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $content = results_table(do_lang_tempcode('MESSAGES'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort');
     $mod_link = hyperlink(build_url(array('page' => '_SELF', 'type' => 'delete', 'stage' => 0, 'id' => $room_id), '_SELF'), do_lang_tempcode('DELETE_ALL_MESSAGES'));
     $view_link = hyperlink(build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room_id), get_module_zone('chat')), do_lang_tempcode('VIEW'));
     $logs_link = hyperlink(build_url(array('page' => 'chat', 'type' => 'download_logs', 'id' => $room_id), get_module_zone('chat')), do_lang_tempcode('CHAT_DOWNLOAD_LOGS'));
     $links = array($mod_link, $view_link, $logs_link);
     $delete_url = build_url(array('page' => '_SELF', 'type' => 'mass_delete', 'room_id' => $room_id, 'start' => $start, 'max' => $max), '_SELF');
     return do_template('CHAT_MODERATE_SCREEN', array('_GUID' => '940de7e8c9a0ac3c575892887c7ef3c0', 'URL' => $delete_url, 'TITLE' => $title, 'INTRODUCTION' => '', 'CONTENT' => $content, 'LINKS' => $links));
 }
Example #27
0
 /**
  * Show my invoices.
  *
  * @return tempcode	The interface.
  */
 function my()
 {
     $title = get_page_title('MY_INVOICES');
     $member_id = get_member();
     if (has_specific_permission(get_member(), 'assume_any_member')) {
         $member_id = get_param_integer('id', $member_id);
     }
     $invoices = array();
     $rows = $GLOBALS['SITE_DB']->query_select('invoices', array('*'), array('i_member_id' => $member_id));
     foreach ($rows as $row) {
         $product = $row['i_type_code'];
         $object = find_product($product);
         if (is_null($object)) {
             continue;
         }
         $products = $object->get_products(false, $product);
         $invoice_title = $products[$product][4];
         $time = get_timezoned_date($row['i_time'], true, false, false, true);
         $payable = $row['i_state'] == 'new';
         $deliverable = $row['i_state'] == 'paid';
         $state = do_lang('PAYMENT_STATE_' . $row['i_state']);
         if (perform_local_payment()) {
             $transaction_button = hyperlink(build_url(array('page' => '_SELF', 'type' => 'pay', 'id' => $row['id']), '_SELF'), do_lang_tempcode('MAKE_PAYMENT'));
         } else {
             $transaction_button = make_transaction_button(substr(get_class($object), 5), $invoice_title, strval($row['id']), floatval($row['i_amount']), get_option('currency'));
         }
         $invoices[] = array('TRANSACTION_BUTTON' => $transaction_button, 'INVOICE_TITLE' => $invoice_title, 'ID' => strval($row['id']), 'AMOUNT' => $row['i_amount'], 'TIME' => $time, 'STATE' => $state, 'DELIVERABLE' => $deliverable, 'PAYABLE' => $payable, 'NOTE' => $row['i_note'], 'TYPE_CODE' => $row['i_type_code']);
     }
     if (count($invoices) == 0) {
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     return do_template('ECOM_INVOICES_SCREEN', array('_GUID' => '144a893d93090c105eecc48fa58921a7', 'TITLE' => $title, 'CURRENCY' => get_option('currency'), 'INVOICES' => $invoices));
 }
Example #28
0
/**
 * Get the tempcode containing all the trackbacks received, and the trackback posting form for the specified resource.
 *
 * @param  ID_TEXT		The type (download, etc) that this trackback is for
 * @param  ID_TEXT		The ID of the type that this trackback is for
 * @param  boolean		Whether this resource allows trackback (if not, this function does nothing - but it's nice to move out this common logic into the shared function)
 * @param  ID_TEXT		The type of details being fetched (currently: blank or XML)
 * @return tempcode		Tempcode for complete trackback box
 */
function get_trackbacks($content_type, $content_id, $allow_trackback, $type = '')
{
    if ($type != '' && $type != 'xml') {
        $type = '';
    }
    if (get_option('is_on_trackbacks') == '1' && $allow_trackback) {
        require_lang('trackbacks');
        $trackbacks = $GLOBALS['SITE_DB']->query_select('trackbacks', array('*'), array('trackback_for_type' => $content_type, 'trackback_for_id' => $content_id), 'ORDER BY trackback_time DESC', 300);
        $content = new ocp_tempcode();
        $items = new ocp_tempcode();
        global $CURRENT_SCREEN_TITLE;
        if (is_null($CURRENT_SCREEN_TITLE)) {
            $CURRENT_SCREEN_TITLE = '';
        }
        foreach ($trackbacks as $value) {
            if ($type == '') {
                $trackback_rendered = do_template('TRACKBACK', array('_GUID' => '128e21cdbc38a3037d083f619bb311ae', 'ID' => strval($value['id']), 'TIME_RAW' => strval($value['trackback_time']), 'TIME' => get_timezoned_date($value['trackback_time']), 'URL' => $value['trackback_url'], 'TITLE' => $value['trackback_title'], 'EXCERPT' => $value['trackback_excerpt'], 'NAME' => $value['trackback_name']));
                $content->attach($trackback_rendered);
            } else {
                $trackback_rendered_xml = do_template('TRACKBACK_XML', array('_GUID' => 'a3fa8ab9f0e58bf2ad88b0980c186245', 'TITLE' => $value['trackback_title'], 'LINK' => $value['trackback_url'], 'EXCERPT' => $value['trackback_excerpt']));
                $items->attach($trackback_rendered_xml);
            }
        }
        if (count($trackbacks) < 1 && $type == 'xml') {
            $trackback_xml_error = do_template('TRACKBACK_XML_ERROR', array('_GUID' => '945e2fcb510816caf323ba3704209430', 'TRACKBACK_ERROR' => do_lang_tempcode('NO_TRACKBACKS')));
            $content->attach($trackback_xml_error);
        }
        if ($type == '') {
            $output = do_template('TRACKBACK_WRAPPER', array('_GUID' => '1bc2c42a54fdf4b0a10e8e1ea45f6e4f', 'TRACKBACKS' => $content, 'TRACKBACK_PAGE' => $content_type, 'TRACKBACK_ID' => $content_id, 'TRACKBACK_TITLE' => $CURRENT_SCREEN_TITLE));
        } else {
            $trackback_xml = do_template('TRACKBACK_XML_LISTING', array('_GUID' => '3bff402f15395f4648a2b5af33de8285', 'ITEMS' => $items, 'LINK_PAGE' => $content_type, 'LINK_ID' => $content_id));
            $content->attach($trackback_xml);
            $output = $content;
        }
    } else {
        $output = new ocp_tempcode();
    }
    return $output;
}
Example #29
0
/**
 * Show the point transactions a member has had.
 *
 * @param  ID_TEXT		The type of transactions we are looking for
 * @set    from to
 * @param  MEMBER			Who we are looking at transactions for
 * @param  MEMBER			Who we are looking at transactions using the account of
 * @return tempcode		The UI
 */
function points_get_transactions($type, $member_id_of, $member_id_viewing)
{
    $where = array('gift_' . $type => $member_id_of);
    if ($type == 'from') {
        $where['anonymous'] = 0;
    }
    $start = get_param_integer('gift_start_' . $type, 0);
    $max = get_param_integer('gift_max_' . $type, 10);
    $sortables = array('date_and_time' => do_lang_tempcode('DATE'), 'amount' => do_lang_tempcode('AMOUNT'));
    $test = explode(' ', get_param('gift_sort_' . $type, 'date_and_time DESC'));
    if (count($test) == 1) {
        $test[1] = 'DESC';
    }
    list($sortable, $sort_order) = $test;
    if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
        log_hack_attack_and_exit('ORDERBY_HACK');
    }
    global $NON_CANONICAL_PARAMS;
    $NON_CANONICAL_PARAMS[] = 'gift_sort_' . $type;
    $NON_CANONICAL_PARAMS[] = 'gift_start_' . $type;
    $max_rows = $GLOBALS['SITE_DB']->query_value('gifts', 'COUNT(*)', $where);
    $rows = $GLOBALS['SITE_DB']->query_select('gifts g LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=g.reason', array('*'), $where, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
    $out = new ocp_tempcode();
    $viewing_name = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
    if (is_null($viewing_name)) {
        $viewing_name = do_lang('UNKNOWN');
    }
    require_code('templates_results_table');
    $fields_title = results_field_title(array(do_lang_tempcode('DATE'), do_lang_tempcode('AMOUNT'), do_lang_tempcode('FROM'), do_lang_tempcode('TO'), do_lang_tempcode('REASON')), $sortables, 'gift_sort_' . $type, $sortable . ' ' . $sort_order);
    foreach ($rows as $myrow) {
        if ($myrow['anonymous'] == 1 && $type == 'from') {
            continue;
        }
        // Their name
        $fromname = is_guest($myrow['gift_from']) ? get_site_name() : $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_from']);
        $toname = $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_to']);
        if (is_null($fromname)) {
            $fromname = do_lang('UNKNOWN');
        }
        if ($myrow['anonymous'] == 1 && !is_guest($myrow['gift_from'])) {
            if (!has_specific_permission($member_id_viewing, 'trace_anonymous_gifts')) {
                $_fromname = do_lang_tempcode('ANON');
            } else {
                $_fromname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), do_lang_tempcode('ANON'), false, false, escape_html($fromname));
            }
        } else {
            $_fromname = is_guest($myrow['gift_from']) ? make_string_tempcode(escape_html($fromname)) : hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), escape_html($fromname), false, false, do_lang_tempcode('VIEW_POINTS'));
        }
        $_toname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_to']), get_module_zone('points')), escape_html($toname), false, false, do_lang_tempcode('VIEW_POINTS'));
        $date = get_timezoned_date($myrow['date_and_time']);
        $amount = $myrow['amount'];
        if (get_page_name() != 'search' && array_key_exists('text_parsed', $myrow) && !is_null($myrow['text_parsed']) && $myrow['text_parsed'] != '' && $myrow['reason'] != 0) {
            $reason = new ocp_tempcode();
            if (!$reason->from_assembly($myrow['text_parsed'], true)) {
                $reason = get_translated_tempcode($myrow['reason']);
            }
        } else {
            $reason = get_translated_tempcode($myrow['reason']);
        }
        $out->attach(results_entry(array(escape_html($date), escape_html(integer_format($amount)), $_fromname, $_toname, $reason)));
    }
    $out = results_table(do_lang_tempcode('_POINTS', escape_html($viewing_name)), $start, 'gift_start_' . $type, $max, 'gift_max_' . $type, $max_rows, $fields_title, $out, $sortables, $sortable, $sort_order, 'gift_sort_' . $type, NULL, NULL, NULL, 8, 'gfhfghtrhhjghgfhfgf', false, 'tab__points');
    if ($type == 'to') {
        $title = do_lang_tempcode('POINTS_TO');
    } else {
        $title = do_lang_tempcode('POINTS_FROM');
    }
    return do_template('POINTS_TRANSACTIONS_WRAP', array('_GUID' => 'f19e3eedeb0b8bf398251b24e8389723', 'CONTENT' => $out, 'TITLE' => $title));
}
Example #30
0
 /**
  * The main user interface for the file dump.
  *
  * @return tempcode	The UI.
  */
 function module_do_gui()
 {
     $title = get_page_title('FILE_DUMP');
     $place = filter_naughty(get_param('place', '/'));
     if (substr($place, -1, 1) != '/') {
         $place .= '/';
     }
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=filedump&filter=' . $place;
     // Show tree
     $dirs = explode('/', substr($place, 0, strlen($place) - 1));
     $i = 0;
     $pre = '';
     $file_tree = new ocp_tempcode();
     while (array_key_exists($i, $dirs)) {
         if ($i > 0) {
             $d = $dirs[$i];
         } else {
             $d = do_lang('FILE_DUMP');
         }
         if (array_key_exists($i + 1, $dirs)) {
             $tree_url = build_url(array('page' => '_SELF', 'place' => $pre . $dirs[$i] . '/'), '_SELF');
             if (!$file_tree->is_empty()) {
                 $file_tree->attach(do_template('BREADCRUMB', array('_GUID' => '7ee62e230d53344a7d9667dc59be21c6')));
             }
             $file_tree->attach(hyperlink($tree_url, $d));
         }
         $pre .= $dirs[$i] . '/';
         $i++;
     }
     if (!$file_tree->is_empty()) {
         breadcrumb_add_segment($file_tree, $d);
     } else {
         breadcrumb_set_self($i == 1 ? do_lang_tempcode('FILE_DUMP') : make_string_tempcode(escape_html($d)));
     }
     // Check directory exists
     $fullpath = get_custom_file_base() . '/uploads/filedump' . $place;
     if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place)) {
         if (has_specific_permission(get_member(), 'upload_filedump')) {
             @mkdir($fullpath, 0777) or warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY', escape_html($fullpath), escape_html(dirname($fullpath))));
             fix_permissions($fullpath, 0777);
             sync_file($fullpath);
         }
     }
     // Find all files in the incoming directory
     $handle = opendir(get_custom_file_base() . '/uploads/filedump' . $place);
     $i = 0;
     $filename = array();
     $description = array();
     $filesize = array();
     $filetime = array();
     $directory = array();
     $deletable = array();
     while (false !== ($file = readdir($handle))) {
         if (!should_ignore_file('uploads/filedump' . $place . $file, IGNORE_ACCESS_CONTROLLERS | IGNORE_HIDDEN_FILES)) {
             $directory[$i] = !is_file(get_custom_file_base() . '/uploads/filedump' . $place . $file);
             $filename[$i] = $directory[$i] ? $file . '/' : $file;
             if ($directory[$i]) {
                 $filesize[$i] = do_lang_tempcode('NA_EM');
             }
             $dbrows = $GLOBALS['SITE_DB']->query_select('filedump', array('description', 'the_member'), array('name' => $file, 'path' => $place));
             if (!array_key_exists(0, $dbrows)) {
                 $description[$i] = $directory[$i] ? do_lang_tempcode('NA_EM') : do_lang_tempcode('NONE_EM');
             } else {
                 $description[$i] = make_string_tempcode(escape_html(get_translated_text($dbrows[0]['description'])));
             }
             if ($description[$i]->is_empty()) {
                 $description[$i] = do_lang_tempcode('NONE_EM');
             }
             $deletable[$i] = array_key_exists(0, $dbrows) && $dbrows[0]['the_member'] == get_member() || has_specific_permission(get_member(), 'delete_anything_filedump');
             if ($directory[$i]) {
                 $size = get_directory_size(get_custom_file_base() . '/uploads/filedump' . $place . $file);
                 $timestamp = NULL;
             } else {
                 $size = filesize(get_custom_file_base() . '/uploads/filedump' . $place . $file);
                 $timestamp = filemtime(get_custom_file_base() . '/uploads/filedump' . $place . $file);
             }
             $filesize[$i] = clean_file_size($size);
             $filetime[$i] = is_null($timestamp) ? NULL : get_timezoned_date($timestamp);
             $i++;
         }
     }
     closedir($handle);
     if ($i != 0) {
         require_code('templates_table_table');
         $header_row = table_table_header_row(array(do_lang_tempcode('FILENAME'), do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('SIZE'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTIONS')));
         $rows = new ocp_tempcode();
         for ($a = 0; $a < $i; $a++) {
             if ($directory[$a]) {
                 $link = build_url(array('page' => '_SELF', 'place' => $place . $filename[$a]), '_SELF');
             } else {
                 $link = make_string_tempcode(get_custom_base_url() . '/uploads/filedump' . str_replace('%2F', '/', rawurlencode($place . $filename[$a])));
             }
             if (!$directory[$a]) {
                 if ($deletable[$a]) {
                     $delete_url = build_url(array('page' => '_SELF', 'type' => 'ed', 'file' => $filename[$a], 'place' => $place), '_SELF');
                     $actions = do_template('TABLE_TABLE_ACTION_DELETE_ENTRY', array('_GUID' => '9b91e485d80417b1664145f9bca5a2f5', 'NAME' => $filename[$a], 'URL' => $delete_url));
                 } else {
                     $actions = new ocp_tempcode();
                 }
             } else {
                 $delete_url = build_url(array('page' => '_SELF', 'type' => 'ec', 'file' => $filename[$a], 'place' => $place), '_SELF');
                 $actions = do_template('TABLE_TABLE_ACTION_DELETE_CATEGORY', array('_GUID' => '0fa7d4090c6195328191399a14799169', 'NAME' => $filename[$a], 'URL' => $delete_url));
             }
             $rows->attach(table_table_row(array(hyperlink($link, escape_html($filename[$a]), !$directory[$a]), escape_html($description[$a]), escape_html($filesize[$a]), is_null($filetime[$a]) ? do_lang_tempcode('NA') : make_string_tempcode(escape_html($filetime[$a])), $actions)));
         }
         $files = do_template('TABLE_TABLE', array('_GUID' => '1c0a91d47c5fc8a7c2b35c7d9b36132f', 'HEADER_ROW' => $header_row, 'ROWS' => $rows));
     } else {
         $files = new ocp_tempcode();
     }
     // Do a form so people can upload their own stuff
     if (has_specific_permission(get_member(), 'upload_filedump')) {
         $post_url = build_url(array('page' => '_SELF', 'type' => 'ad', 'uploading' => 1), '_SELF');
         $submit_name = do_lang_tempcode('FILEDUMP_UPLOAD');
         $max = floatval(get_max_file_size());
         $text = new ocp_tempcode();
         if ($max < 30.0) {
             $config_url = get_upload_limit_config_url();
             $text->attach(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max / 1024.0 / 1024.0)), escape_html(is_null($config_url) ? '' : $config_url)));
         }
         require_code('form_templates');
         $fields = form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('_DESCRIPTION_UPLOAD'), 'file', true);
         $fields->attach(form_input_line(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', '', false));
         $hidden = new ocp_tempcode();
         $hidden->attach(form_input_hidden('place', $place));
         handle_max_file_size($hidden);
         $upload_form = do_template('FORM', array('TABINDEX' => strval(get_form_field_tabindex()), 'SKIP_REQUIRED' => true, 'HIDDEN' => $hidden, 'TEXT' => $text, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
     } else {
         $upload_form = new ocp_tempcode();
     }
     // Do a form so people can make folders
     if (get_option('is_on_folder_create') == '1') {
         $post_url = build_url(array('page' => '_SELF', 'type' => 'ac'), '_SELF');
         require_code('form_templates');
         $fields = form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME'), 'name', '', true);
         $hidden = form_input_hidden('place', $place);
         $submit_name = do_lang_tempcode('FILEDUMP_CREATE_FOLDER');
         $create_folder_form = do_template('FORM', array('_GUID' => '043f9b595d3699b7d8cd7f2284cdaf98', 'TABINDEX' => strval(get_form_field_tabindex()), 'SKIP_REQUIRED' => true, 'SECONDARY_FORM' => true, 'HIDDEN' => $hidden, 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
     } else {
         $create_folder_form = new ocp_tempcode();
     }
     return do_template('FILE_DUMP_SCREEN', array('_GUID' => '3f49a8277a11f543eff6488622949c84', 'TITLE' => $title, 'PLACE' => $place, 'FILES' => $files, 'UPLOAD_FORM' => $upload_form, 'CREATE_FOLDER_FORM' => $create_folder_form));
 }