Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


opera mini code leaking


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Yours3!f   Members   -  Reputation: 1455

Posted 17 May 2012 - 02:13 AM

hi,
when i visit gamedev.net on my android phone on an opera browser i get a huge code leak after the member activity link.
hope you dont mind posting it:

ob_start();
include_once( "RContent/rcontent.php" );
$redis = new Redis();
$redis->connect( '127.0.0.1', 6379 );
$opts = Array( "mr" => 'master', "t1" => 'votes.likes.last24h', "t7" => 'votes.likes.last7d', "t30" => 'votes.likes.last30d', "top" => 'votes.likes.last7d' );
$default_opt = 'top';
$news_view = $opts[$default_opt];
$pg = 1;

if( $this->request['st'] )
{
  if( is_numeric( $this->request['st'] ) )
  {
	$pg = intval( $this->request['st'] ) + 1;
  }
}

$selvm = $default_opt;

if( $this->request['vm'] )
{
  $selvm = $this->request['vm'];

  if( $this->memberData['member_id'] > 0 )
  {
	IPSCookie::set( "vm" , $selvm , 1 );
  }
}
else
{
  $selvm = IPSCookie::get( "vm" );

  if( strlen( $selvm ) == 0 )
  {
	$selvm = $default_opt;
  }
}

if( array_key_exists( $selvm, $opts ) )
{
  $news_view = $opts[$selvm];
}
else
{
  $news_view = $opts[$default_opt];
}
// standard views: 'master', 'votes.likes.last30d', 'votes.likes.last7d', 'votes.likes.last24h'
$news = new NewsContent( $redis );

if( $selvm != 'top' )
  $news_items = $news->GetView( $news_view, $this->memberData['member_id'], $pg, 15 );
else
{
  $tmpkey = $this->lastmonthkey.'tmpbnews'.md5( time() );
  $pipe = $news->redis->multi();
  $pipe->zInter( $tmpkey, array( $news->lastmonthkey, $news->lastmonthkey.'.likes.last7d' ), array( 1, 1 ), "MIN" );
  $pipe->zRevRange( $tmpkey, 0, 1000, true );
  $pipe->delete( $tmpkey );
  $pipe->zInter( $tmpkey, array( $news->lastmonthkey, $news->lastmonthkey.'.likes.last7d' ), array( 1, 1 ), "MAX" );
  $pipe->zRevRange( $tmpkey, 0, 1000, true );
  $pipe->delete( $tmpkey );
  $results = $pipe->exec(); // Rank: Rank ((p - 1) / (t +  2 ) ^ 1.3 )
  $newsb = Array();
  $news_fin = Array();
					  
  $news_view = 'votes.likes.last7d';

  $news_items = $news->GetView( $news_view, $this->memberData['member_id'], 1, 1000 ); $means = array(); $domains = array();

  foreach( $news_items['records'] as $key => $item )
  {
	$domain = $item['field_74'];
	$mean[$domain]['sum'] += $results[1]['news:' . $item['post_key']];
	$mean[$domain]['count']++;
	$mean[$domain]['keys'][] = $item['post_key'];
	$domains['news:' . $item['post_key']] = $domain;
  }

  foreach( $mean as $key => $item )
  {
	$mean_value = $item['sum'] / $item['count'];
	foreach( $item['keys'] as $post_key )
	{
	  $results[1]['news:' . $post_key] /= $mean_value;
	  $results[1]['news:' . $post_key] *= 100;
	}
  }

  foreach( $results[1] as $key => $points )
  {
	$t = ( time() - intval( $results[4][$key] ) ) / 3600;
	$newsb[$key] = 1000 * ( pow( ( $points - 1 ), 1 ) / pow( ( $t + 2 ), 1.3 ) );
  }

  arsort( $newsb, SORT_NUMERIC );
  $domain_penalty = array();

  foreach( $newsb as $key => $points )
  {
	$domain_penalty[$domains[$key]] += 250;
	$newsb[$key] -= $domain_penalty[$domains[$key]];
  }

  arsort( $newsb, SORT_NUMERIC );

  foreach( $news_items['records'] as $key => $item )
  {
	$newsb['news:' . $item['post_key']] = $item;
  }

  $i = 0;
  $start = $pg * 15 - 15;
  foreach( $newsb as $key => $item )
  {
	if( $i >= $start && $i <= $start + 15 )
	  $news_fin[] = $item;
	$i++;
  }

  $news_items['records'] = $news_fin;
} ///

$totalItems $records = array();

if( count( $news_items ) > 0 )
{
  $records = $news_items['records'];
} //var_dump($records);

if( method_exists( $this->registry->getClass( 'output' )->getTemplate( 'ccs_global' ), "featured_news" ) )
{
  $content = $this->registry->getClass( 'output' )->getTemplate( 'ccs_global' )->featured_news( $selvm, $news_items['totalcount'], $records );
}

echo $content; //

$content = $this->registry->getClass( 'output' )->getTemplate( 'ccs_global' )->featured_news( $news_items2['totalcount'], $news_items2['records'] );

//echo $content;

$redis->close();
$IPBHTML . = ob_get_contents();
ob_end_clean();

EDIT: I edited the code so that it is better readable.

Edited by Yours3!f, 17 May 2012 - 05:32 AM.


Sponsor:

#2 Michael Tanczos   Senior Staff   -  Reputation: 5578

Posted 17 May 2012 - 09:41 AM

Hrmm.. Thanks for the post. I'll take a look at it to see what is going on tonight.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS