<?php
if ( !defined( 'SMARTY_DIR' ) ) {
	include_once( 'init.php' );
}

$returnto = 'payment.php';

include ( 'sessioninc.php' );

$t->assign( 'data',$osDB->getAll( 'SELECT * from ! WHERE enabled = ?', array( PAYMENT_MODULE_TABLE, 'Y' ) ) );
/*
$privileges = array(
	'chat',
	'forum',
	'blog',
	'includeinsearch',
	'message',
	'message_keep_cnt',
	'message_keep_days',
	'uploadpicture',
	'uploadpicturecnt',
	'allowim',
	'allowalbum',
	'seepictureprofile',
	'favouritelist',
	'sendwinks',
	'extsearch',
	'event_mgt',
	'activedays',
	'saveprofiles',
	'saveprofilescnt',
	'allow_mysettings',
	'allow_php121',
	'allow_videos',
	'videoscnt',
	'price',
	'currency'
);
*/
$privileges = array_keys(get_lang_values('privileges'));
$privileges[]='price';
$privileges[]='currency';

$j = 0;

$temp =& $osDB->getAll( 'select id, roleid, name from ! where enabled = ? and id <> ? order by price', array( MEMBERSHIP_TABLE, 'Y', 3 ) );

$m_row = array();

$m_name = array();

foreach( $temp as $index => $rowtmp ) {

	$temp2 =& $osDB->getAll( 'select * from ! where id = ?', array( MEMBERSHIP_TABLE, $rowtmp['id'] ) );

	$m_name[$rowtmp['roleid']] = $rowtmp['name'];

	foreach( $temp2 as $index2 => $row ) {

		foreach( $privileges as $item ) {

			$m_row[$item][$j] = $row[$item];
		}

		$j++;
	}
	unset($temp2);
}

unset($temp);

$t->assign('lang', $lang);

$t->assign( 'm_row' , $m_row );

$t->assign( 'memberships' , $m_name );

$t->assign('privileges',$privileges);

unset($privileges, $m_row, $m_name);

$t->assign('rendered_page', $t->fetch('payment.tpl') );

$t->display( 'index.tpl' );

exit;

?>
