Пример #1
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'chat')) {
         require_code('chat');
         $rows = $GLOBALS['SITE_DB']->query('SELECT ip_address,the_message,user_id AS member_id,date_and_time AS timestamp,room_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages WHERE system_message=0 AND date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             if (!check_chatroom_access($row['room_id'], true)) {
                 continue;
             }
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $message = get_translated_text($row['the_message']);
             if (strpos($message, '[private') !== false) {
                 continue;
             }
             $message = strip_comcode($message);
             if ($message == '') {
                 continue;
             }
             $drops[] = rain_get_special_icons($row['ip_address'], $timestamp, NULL, $message) + array('TYPE' => 'chat', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title($message), 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $message, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'room_' . strval($row['room_id']));
         }
     }
     return $drops;
 }
Пример #2
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'polls')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT b.option1,b.option2,b.option3,b.option4,b.option5,b.option6,b.option7,b.option8,b.option9,b.option10,b.votes1,b.votes2,b.votes3,b.votes4,b.votes5,b.votes6,b.votes7,b.votes8,b.votes9,b.votes10,b.question,b.id,b.submitter AS member_id,a.date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll a LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll b ON a.date_and_time>b.date_and_time WHERE NOT EXISTS(SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll x WHERE x.id<>a.id AND x.id<>b.id AND x.date_and_time BETWEEN b.date_and_time AND a.date_and_time) AND b.date_and_time IS NOT NULL AND b.date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             require_lang('polls');
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $best = NULL;
             $best_num = -1;
             for ($i = 1; $i <= 10; $i++) {
                 if ($row['votes' . strval($i)] > $best_num) {
                     $best = $row['option' . strval($i)];
                     $best_num = $row['votes' . strval($i)];
                 }
             }
             if ($best_num == -1) {
                 continue;
             }
             $ticker_text = do_lang('VOTES_ARE_IN', strip_comcode(get_translated_text($row['question'])), strip_comcode(get_translated_text($best)));
             $drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'polls', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['question'])), 'IMAGE' => find_theme_image('bigicons/polls'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'poll_' . strval($row['id']));
         }
     }
     return $drops;
 }
Пример #3
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_stats')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT s_primary,s_member_id AS member_id,s_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'searches_logged WHERE s_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'search', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title($row['s_primary']), 'IMAGE' => find_theme_image('bigicons/search'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'search', 'type' => 'misc', 'content' => $row['s_primary']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'search_' . $row['s_primary']);
         }
     }
     return $drops;
 }
Пример #4
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_security')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT id,reason,ip,the_user AS member_id,date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'hackattack WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             require_lang('security');
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $drops[] = rain_get_special_icons($row['ip'], $timestamp) + array('TYPE' => 'security', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(do_lang('HACKER_DETECTED', do_lang($row['reason']))), 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'admin_security', 'type' => 'view', 'id' => $row['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => true, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'hack_type_' . $row['reason']);
         }
     }
     return $drops;
 }
Пример #5
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_ocf_join') && get_forum_type() == 'ocf') {
         $rows = $GLOBALS['FORUM_DB']->query('SELECT i_email_address,i_inviter AS member_id,i_time AS timestamp FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_invites WHERE i_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $invited_member = $GLOBALS['FORUM_DB']->query_value_null_ok('f_members', 'id', array('m_email_address' => $row['i_email_address']));
             $drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'recommend', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => is_null($invited_member) ? '' : strval($invited_member), 'TITLE' => do_lang('RECOMMEND_SITE'), 'IMAGE' => is_guest($member_id) ? find_theme_image('recommend') : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => is_null($invited_member) ? '' : 'member_' . strval($invited_member), 'GROUP_ID' => NULL);
         }
     }
     return $drops;
 }
Пример #6
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'calendar')) {
         require_code('calendar');
         $rows = calendar_matches(get_member(), true, $from, $to);
         // NOTE: We also show (automatically) any RSS items the user has overlayed onto the calendar
         foreach ($rows as $row) {
             $timestamp = $row[2];
             $member_id = $row[1]['e_submitter'];
             $drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'calendar', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row[1]['e_title'])), 'IMAGE' => $row[1]['t_logo'], 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'calendar', 'type' => 'event', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'event_' . strval($row[1]['id']));
         }
     }
     return $drops;
 }
Пример #7
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'news')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT title,n.id,nc_img,submitter AS member_id,date_and_time AS timestamp,news_category FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news n LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_categories c ON c.id=n.news_category WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             if (!has_category_access(get_member(), 'news', $row['news_category'])) {
                 continue;
             }
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $image = find_theme_image($row['nc_img']);
             $ticker_text = strip_comcode(get_translated_text($row['title']));
             $drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'news', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['title'])), 'IMAGE' => $image, 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'news_' . strval($row['id']));
         }
     }
     return $drops;
 }
Пример #8
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'points')) {
         require_lang('points');
         $rows = $GLOBALS['SITE_DB']->query('SELECT reason,amount,user_id AS member_id,date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chargelog WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'point_charges', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('MEMBER_CHARGED_POINTS', integer_format($row['amount']), get_translated_text($row['reason'])), 'IMAGE' => $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => true, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => false, 'GROUP_ID' => false);
         }
         $rows = $GLOBALS['SITE_DB']->query('SELECT reason,amount,gift_from AS member_id,gift_to,date_and_time AS timestamp,anonymous FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'gifts WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $drops[] = rain_get_special_icons(NULL, $timestamp) + array('TYPE' => 'point_gifts', 'FROM_MEMBER_ID' => $row['anonymous'] == 1 ? NULL : strval($member_id), 'TO_MEMBER_ID' => strval($row['gift_to']), 'TITLE' => do_lang('MEMBER_GIVEN_POINTS', integer_format($row['amount']), get_translated_text($row['reason'])), 'IMAGE' => $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($row['gift_to']), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $row['gift_to']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => $row['anonymous'] == 1 ? NULL : 'member_' . strval($member_id), 'TO_ID' => 'member_' . strval($row['gift_to']), 'GROUP_ID' => NULL);
         }
     }
     return $drops;
 }
Пример #9
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_stats')) {
         require_lang('stats');
         $rows = $GLOBALS['SITE_DB']->query('SELECT browser,referer,the_page,ip,the_user AS member_id,date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'stats WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $page_link = str_replace(':', ': ', page_path_to_pagelink($row['the_page']));
             if ($row['the_page'] == '/access_denied') {
                 $page_link = do_lang('ACCESS_DENIED_SCREEN');
             }
             if ($row['the_page'] == '/closed') {
                 $page_link = do_lang('CLOSED_SITE_SCREEN');
             }
             if ($row['the_page'] == '/flood') {
                 $page_link = do_lang('FLOOD_CONTROL_SCREEN');
             }
             $title = rain_truncate_for_title(do_lang('HIT', $page_link));
             // Show referer domain or Google search keyword
             $referer = @parse_url($row['referer']);
             $base_url = @parse_url(get_base_url());
             if ($referer !== false) {
                 if (!array_key_exists('host', $referer)) {
                     $referer['host'] = do_lang('UNKNOWN');
                 }
                 if ($referer['host'] != $base_url['host']) {
                     $matches = array();
                     if (preg_match('#(&|\\?)q=([^&]*)#', $row['referer'], $matches) != 0) {
                         $title = rain_truncate_for_title(do_lang('HIT', $page_link, $matches[2], $referer['host']));
                     } else {
                         $title = rain_truncate_for_title(do_lang('HIT', $page_link, $referer['host']));
                     }
                 }
             }
             $drops[] = rain_get_special_icons($row['ip'], $timestamp, $row['browser']) + array('TYPE' => 'stats', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => $title, 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'admin_lookup', 'id' => $row['ip']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'page_' . $page_link);
         }
     }
     return $drops;
 }
Пример #10
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     $rows = $GLOBALS['SITE_DB']->query('SELECT ip,the_type,the_user AS member_id,date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'adminlogs WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
     if (has_actual_page_access(get_member(), 'admin_actionlog')) {
         require_all_lang();
         foreach ($rows as $row) {
             // Events considered elsewhere anyway
             if ($row['the_type'] == 'ADD_NEWS') {
                 continue;
             }
             if ($row['the_type'] == 'CHOOSE_POLL') {
                 continue;
             }
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $drops[] = rain_get_special_icons($row['ip'], $timestamp) + array('TYPE' => 'actionlog', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang($row['the_type']), 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => NULL);
         }
     }
     return $drops;
 }
Пример #11
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_ecommerce')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT amount,item,t_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'transactions WHERE t_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             require_code('ecommerce');
             list($product, ) = find_product_row($row['item']);
             if (!is_null($product)) {
                 $title = $product[4];
             } else {
                 require_lang('ecommerce');
                 $title = do_lang('SALE_MADE');
             }
             $timestamp = $row['timestamp'];
             $ticker_text = do_lang('KA_CHING', ecommerce_get_currency_symbol(), $row['amount']);
             $drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'ecommerce', 'FROM_MEMBER_ID' => NULL, 'TO_MEMBER_ID' => NULL, 'TITLE' => $title, 'IMAGE' => find_theme_image('bigicons/ecommerce'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => NULL, 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => NULL, 'TO_ID' => NULL, 'GROUP_ID' => 'product_' . $row['item']);
         }
     }
     return $drops;
 }
Пример #12
0
/**
 * AJAX script for returning realtime-rain data.
 */
function realtime_rain_script()
{
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    @ini_set('ocproducts.xss_detect', '0');
    header('Content-Type: text/xml');
    echo '<?xml version="1.0" encoding="' . get_charset() . '"?' . '>';
    echo '<request><result>';
    require_code('realtime_rain');
    require_lang('realtime_rain');
    $time_now = time();
    $from = get_param_integer('from', $time_now - 10);
    $to = get_param_integer('to', $time_now);
    if (get_param_integer('keep_realtime_test', 0) == 1) {
        $types = array('post', 'news', 'recommend', 'polls', 'ecommerce', 'actionlog', 'security', 'chat', 'stats', 'join', 'calendar', 'search', 'point_charges', 'banners', 'point_gifts');
        shuffle($types);
        $events = array();
        $cnt = count($types);
        for ($i = 0; $i < max($cnt, 5); $i++) {
            $timestamp = mt_rand($from, $to);
            $type = array_pop($types);
            $event = rain_get_special_icons(get_ip_address(), $timestamp) + array('TYPE' => $type, 'FROM_MEMBER_ID' => NULL, 'TO_MEMBER_ID' => NULL, 'TITLE' => 'Test', 'IMAGE' => rain_get_country_image(get_ip_address()), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => $type == 'ecommerce' || $type == 'join', 'IS_NEGATIVE' => $type == 'security' || $type == 'point_charges', 'FROM_ID' => NULL, 'TO_ID' => NULL, 'GROUP_ID' => 'example_' . strval(mt_rand(0, 4)));
            $event['SPECIAL_ICON'] = 'email-icon';
            $event['MULTIPLICITY'] = '10';
            $events[] = $event;
        }
    } else {
        $events = get_realtime_events($from, $to);
    }
    shuffle($events);
    $out = new ocp_tempcode();
    foreach ($events as $event) {
        $out->attach(do_template('REALTIME_RAIN_BUBBLE', $event));
    }
    $out->evaluate_echo();
    echo '</result></request>';
}
Пример #13
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_banners')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT b.name,img_url,c_ip_address,c_member_id AS member_id,c_date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banner_clicks c LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banners b ON b.name=c.c_banner_id WHERE c_date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         require_lang('banners');
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $image = is_guest($member_id) ? rain_get_country_image($row['c_ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id);
             require_code('images');
             if (is_image($row['img_url'])) {
                 $image = $row['img_url'];
             }
             if (url_is_local($image)) {
                 $image = get_custom_base_url() . '/' . $image;
             }
             $drops[] = rain_get_special_icons($row['c_ip_address'], $timestamp) + array('TYPE' => 'banners', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('BANNER_CLICKED'), 'IMAGE' => $image, 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'banner_' . $row['name']);
         }
     }
     return $drops;
 }
Пример #14
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (get_forum_type() == 'ocf') {
         // Member's joining (f_members table)
         if (has_actual_page_access(get_member(), 'members')) {
             $rows = $GLOBALS['FORUM_DB']->query('SELECT m_ip_address,id AS member_id,m_join_time AS timestamp FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
             foreach ($rows as $row) {
                 $timestamp = $row['timestamp'];
                 $member_id = $row['member_id'];
                 if (is_guest($member_id)) {
                     continue;
                 }
                 $drops[] = rain_get_special_icons($row['m_ip_address'], $timestamp) + array('TYPE' => 'join', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('JOINED') . ': ' . $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'IMAGE' => $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true), 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => NULL);
             }
         }
         // Forum posts (f_posts table)
         if (has_actual_page_access(get_member(), 'topicview') && addon_installed('ocf_forum')) {
             $rows = $GLOBALS['FORUM_DB']->query('SELECT p_intended_solely_for,id,p_poster AS member_id,p_time AS timestamp,p_cache_forum_id,p_post,p_title,p_ip_address FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
             foreach ($rows as $row) {
                 if (is_null($row['p_cache_forum_id'])) {
                     continue;
                 }
                 if (!is_null($row['p_intended_solely_for'])) {
                     continue;
                 }
                 if (!has_category_access(get_member(), 'forums', strval($row['p_cache_forum_id']))) {
                     continue;
                 }
                 $timestamp = $row['timestamp'];
                 $member_id = $row['member_id'];
                 $ticker_text = strip_comcode(get_translated_text($row['p_post'], $GLOBALS['FORUM_DB']));
                 $drops[] = rain_get_special_icons($row['p_ip_address'], $timestamp, NULL, $ticker_text) + array('TYPE' => 'post', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => $row['p_title'] == '' ? rain_truncate_for_title(strip_comcode(get_translated_text($row['p_post'], $GLOBALS['FORUM_DB']))) : $row['p_title'], 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['p_ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => $GLOBALS['FORUM_DRIVER']->post_url($row['id'], $row['p_cache_forum_id']), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'post_' . strval($row['id']));
             }
         }
     }
     return $drops;
 }