Update 0.8.2 to 0.9.0

Replace all files
----------------------------------------------------------------------
Delete file:

includes/points/points_donate.php

bank.php
donate.php
donateconfirm.php
donateresult.php
donateshowresult.php
donors.php
amd/style/acp_donate_mod_settings.html
amd/style/acp_donors_config.html
images/paypal_donate.gif
includes/donate_functions_V3.php
includes/donate_paypal_functions.php
language/en/mods/donations.php
styles/your_style/templates/donate_body.html
styles/your_style/templates/donors_body.html 
styles/your_style/templates/topupconfirm_body.html

------------------------------------------------------------------------

Run sql:

DROP TABLE `phpbb_account_hist`;
DROP TABLE `phpbb_points`;


DELETE FROM phpbb_config WHERE config_name = 'lw_dm_enable_mod';
DELETE FROM phpbb_config WHERE config_name = 'dislay_x_donors';
DELETE FROM phpbb_config WHERE config_name = 'donate_start_time';
DELETE FROM phpbb_config WHERE config_name = 'donate_end_time';
DELETE FROM phpbb_config WHERE config_name = 'donate_cur_goal';
DELETE FROM phpbb_config WHERE config_name = 'donate_description';
DELETE FROM phpbb_config WHERE config_name = 'donate_to_points';
DELETE FROM phpbb_config WHERE config_name = 'paypal_p_acct';
DELETE FROM phpbb_config WHERE config_name = 'paypal_b_acct';
DELETE FROM phpbb_config WHERE config_name = 'paypal_currency_code';
DELETE FROM phpbb_config WHERE config_name = 'donate_to_posts';
DELETE FROM phpbb_config WHERE config_name = 'list_top_donors';
DELETE FROM phpbb_config WHERE config_name = 'donate_to_grp_one';
DELETE FROM phpbb_config WHERE config_name = 'to_grp_one_amount';
DELETE FROM phpbb_config WHERE config_name = 'donate_to_grp_two';
DELETE FROM phpbb_config WHERE config_name = 'to_grp_two_amount';
DELETE FROM phpbb_config WHERE config_name = 'donor_rank_id';
DELETE FROM phpbb_config WHERE config_name = 'lw_dm_explanation_postid';
DELETE FROM phpbb_config WHERE config_name = 'donate_currencies';
DELETE FROM phpbb_config WHERE config_name = 'usd_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'eur_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'gbp_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'cad_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'jpy_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'aud_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'paypal_support_currency';
DELETE FROM phpbb_config WHERE config_name = 'lw_dm_enable_paypal';
DELETE FROM phpbb_config WHERE config_name = 'czk_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'dkk_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'hkd_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'huf_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'nzd_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'nok_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'pln_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'sgd_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'sek_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'chf_to_primary';
DELETE FROM phpbb_config WHERE config_name = 'points_version';

CREATE TABLE phpbb_points (
  `points_name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `points_enable` tinyint(1) NOT NULL,
  `points_transfer` tinyint(1) NOT NULL,
  `points_transfer_pm` tinyint(1) NOT NULL,
  `points_comments` tinyint(1) NOT NULL,
  `points_pertopic` tinyint(1) NOT NULL,
  `points_perpost` tinyint(1) NOT NULL,
  `points_peredit` tinyint(1) NOT NULL,
  `points_logs` tinyint(1) NOT NULL,
  `points_images_topic` tinyint(1) NOT NULL,
  `points_images_memberlist` tinyint(1) NOT NULL,
  `lottery_enable` tinyint(1) NOT NULL,
  `bank_enable` tinyint(1) NOT NULL,
  `points_robbery` tinyint(1) NOT NULL,
  `points_disablemsg` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `points_stats` tinyint(1) NOT NULL,
  `points_jaf_enable` tinyint(1) NOT NULL,
  `lottery_admin_pm` tinyint(1) NOT NULL
);

INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_chane_to_grab', '100');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_jaf_pos', 100);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_jaf_enable', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_jaf_sendpm', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_jaf_amountlose', 10);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('lottery_sendpmadmin', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bank_cost', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('user_id_admin_lottery', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('username_admin_lottery', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('count_robbery', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_lottery_stats', 1);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_version', '0.9.1');

INSERT INTO phpbb_points (`points_name`, `points_enable`, `points_transfer`, `points_transfer_pm`, `points_comments`, 
		`points_pertopic`, `points_perpost`, `points_peredit`, `points_logs`, `points_images_topic`, `points_images_memberlist`, `lottery_enable`, `bank_enable`, 
		`points_robbery`, `points_disablemsg`, `points_stats`, `points_jaf_enable`, `lottery_admin_pm`) VALUES('Points', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 'Points System Disabled', 1,
		1, 0);
		
INSERT INTO phpbb_acl_options (auth_option, is_global, is_local, founder_only) VALUES ('u_use_jaf', 1, 0, 0);



-------------------------------------------------------------------------------------

Open: common.php
Find:

require($phpbb_root_path . 'includes/points/functions_points.' . $phpEx);

Add after:

require($phpbb_root_path . 'includes/mods/functions_points.' . $phpEx);

----------------------------------------------------------------------------------------------
Open: download/file.php
Find:

$sql = "UPDATE " . USERS_TABLE . "
	SET points = (points - $cost)
	WHERE user_id = '{$user->data['user_id']}'";
$db->sql_query($sql); 

Replace with:

substract_points($user->data['user_id'], $cost);

--------------------------------------------------------------------------------------

Open: includes/mcp/mcp_warn.php
Find:

	$sql= 'UPDATE ' . USERS_TABLE . ' 
		SET points = points - ' . $points_warn . '
		WHERE user_id = ' . $user_row['user_id'];
	$db->sql_query($sql);
  
Replace with:

substract_points($user_row['user_id'], $points_warn);
---------------------------------------------------------------------------------------

Open index.php
Find and delete:

//-- mod : Advanced Points Mod 
// Assign index Donors list
$template->assign_vars(array(
	'LW_LAST_DONORS' => last_donors(), 
	'L_LW_LAST_DONORS' => generate_donation_title()	)
);
//-- fin mod : Advanced Points Mod 

---------------------------------------------------------------------------------------
In index.php find:

// Assign index specific vars
$template->assign_vars(array(

Add after:

  'TOTAL_BANKU'   => sprintf($user->lang['BUPOINTS_TOTAL'], $bankusers),
  'TOTAL_BANKP'   => sprintf($user->lang['BPOINTS_TOTAL'], $bankholdings),
  'TOTAL_POINTS'  => sprintf($user->lang['POINTS_TOTAL'], $totalpoints),
	'LOTTERY_TIME'  => sprintf($user->lang['LOTTERY_TIME'], $lottery_time),
	'S_DISPLAY_LOTTERY'         => ($config['display_lottery_stats']) ? true : false,
	'S_DISPLAY_POINTS_STATS'    => ($Points['points_stats']) ? true : false,
  
----------------------------------------------------------------------------------------
In index.php find:

// Assign index specific vars
$template->assign_vars(array(

Add before:

// Add points lang
$user->add_lang('mods/points');

// Generate the bank statistics
	      $sql = "SELECT sum(holding) as total_holding, count(user_id) as total_users
		FROM " . BANK_TABLE . "
		WHERE id > 0";
	      $result = $db->sql_query($sql); 
	      $b_row = $db->sql_fetchrow($result);

	      $bankholdings = ( $b_row['total_holding'] ) ? $b_row['total_holding'] : 0;
	      $bankusers = $b_row['total_users'];

//Generate the points statistics
		      $sql = "SELECT sum(points) as total_points
		FROM " . USERS_TABLE . "
		WHERE user_id > 0";
	      $result = $db->sql_query($sql); 
	      $b_row = $db->sql_fetchrow($result);

	      $totalpoints = ( $b_row['total_points'] ) ? $b_row['total_points'] : 0;	 
          $lottery_time = $user->format_date($config['lottery_last_draw_time'] + $config['lottery_draw_period'] , 'F j, Y, g:i A');		  
// Get points config
$sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
$result = $db->sql_query($sql);
$Points = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

------------------------------------------------------------------------------------
Open language/en/acp/common.php and find:

'LOG_MOD_POINTS'                    => '%1s has edit %2s points',

Add after:

	'LOG_MOD_POINTS_BANK'						=> 'Edited bank settings',
	'LOG_MOD_POINTS_SETTINGS'					=> 'Edited points settings',
	'LOG_MOD_POINTS_ROBBERY'					=> 'Edited points robbery settings',
	'LOG_MOD_POINTS_LOTTERY'					=> 'Edited points lottery settings',
	
------------------------------------------------------------------------------------
Open language/de/acp/common.php and find:

'LOG_MOD_POINTS'                    => '%1s has edit %2s points',

Add after:

	'LOG_MOD_POINTS_BANK'						=> 'Editiere Bank Einstellungen',
	'LOG_MOD_POINTS_SETTINGS'					=> 'Editiere Points Einstellungen',
	'LOG_MOD_POINTS_ROBBERY'					=> 'Editiere Points Diebstahl Einstellungen',
	'LOG_MOD_POINTS_LOTTERY'					=> 'Editiere Points Lotterie Einstellungen',	
  
-------------------------------------------------------------------------------------

Open includes/constants.php
Find:

// Additional constants
Delete after:
//--[Points Modification]--
define('PAYMENT_MANUAL', 0);
define('PAYMENT_RECURRING_W', 1);
define('PAYMENT_RECURRING_M', 2);
define('PAYMENT_RECURRING_Q', 3);
define('PAYMENT_RECURRING_H', 4);
define('PAYMENT_RECURRING_Y', 5);
//--[Points Modification]--

------------------------------------------------------------------------------------
Open includes/constants.php
Find and delete:

define('ACCT_HIST_TABLE', $table_prefix . 'account_hist');
define('USER_DONATIONS', 'user_donation');

------------------------------------------------------------------------------------
Open includes/functions.php
Find and delete:

  //-- mod : Advanced Points Mod 
	$user->add_lang('mods/donations');
	require_once($phpbb_root_path . 'includes/donate_functions_V3.' . $phpEx);
  //-- fin mod : Advanced Points Mod

Find and delete;

    //-- mod : Advanced Points Mod 
		'U_DONATE' 			=> append_sid("{$phpbb_root_path}lwdonate.$phpEx"),
		'L_DONATE_EXPLAIN' 	=> $user->lang['LW_DONATION_TO_HELP'],
		'L_DONATE' 			=> $user->lang['LW_DONATE'],
		'S_DISPLAY_DONATION_LIST' => intval($config['lw_dm_enable_mod']),
    //-- fin mod : Advanced Points Mod

---------------------------------------------------------------------------------------
    
    
Open: styles/prosilver/template/index_body.html 

#
#Find:
#

<!-- IF .points -->
	<h3>{L_MOST_RICH_USERS}</h3>
<p><!-- BEGIN points --><!-- IF not points.S_FIRST_ROW -->, <!-- ENDIF -->{points.USERNAME} ({points.POINT})<!-- END points --></p>
<!-- ENDIF -->
<h3>{L_LW_LAST_DONORS}</h3>
<p>{LW_LAST_DONORS}</p>

#
#Replease with:
#

<!-- IF .points -->
	<h3>{L_MOST_RICH_USERS}</h3>
<p><!-- BEGIN points --><!-- IF not points.S_FIRST_ROW -->, <!-- ENDIF -->{points.USERNAME} ({points.POINT})<!-- END points --></p>
<!-- ENDIF -->

#
#Find:
#

{TOTAL_USERS} &bull; {NEWEST_USER}

#
#in line after add:
#

<!-- IF S_DISPLAY_POINTS_STATS --> &bull; {TOTAL_POINTS} &bull; {TOTAL_BANKU} &bull; {TOTAL_BANKP}<!-- ENDIF --> <!-- IF S_DISPLAY_LOTTERY--> &bull; {LOTTERY_TIME} <!-- ENDIF -->


Open: styles/subsilver2/template/index_body.html
 
#
#Find:
#

{TOTAL_USERS} | {NEWEST_USER}

#
#in line after add:
#

<!-- IF S_DISPLAY_POINTS_STATS -->| {TOTAL_POINTS} | {TOTAL_BANKU} | {TOTAL_BANKP}<!-- ENDIF --> <!-- IF S_DISPLAY_LOTTERY--> | {LOTTERY_TIME} <!-- ENDIF -->


#
#DELETE in ACP the donatation module and add a new modul for robbery setting!
#

#
#CLEAR ALL CACHE!!!!
#    