[2.0.18] Cash Mod

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
1036
66%
Very Good
239
15%
Good
121
8%
Fair
36
2%
Poor
126
8%
 
Total votes: 1558

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Sun Nov 16, 2003 11:24 pm

popnoart wrote: Hello!
First, thanks for your work in this great mod!!!
Thank you very much!!!

This is a wish for futures versions...
Could be posible to add more user types in settings so they can add cash, same as if they were moderators?
For example add the posiblity of users from one group to add cash.
I have installed "Super Moderators Expanded Mod" and it would be usefull if other kind/group of users could add cash too.

PD: sorry for my poor english, I'm from Spain.


The way i designed it, it actually should be fairly easy to add any other user levels (super moderators, super/junior admins, etc). Most of the changes to be made are all in cash_groups.php
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Mon Nov 17, 2003 12:07 am

Updating Moogie's Mod
Narc0sis wrote: hey i wanted to ask you something. im updating from the cash mod 2.0.2 to 2.2.0. i also have moogies level/battle mod installed. to get moogies mod to work with the cash mod 2.0.2 you had the instructions for functions_post.php that read

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
   $cash_message = ""; 
   if ( !$board_config['cash_disable'] ) 
   { 
      $cash_message = cash_update($mode,$forum_id,$post_id,$post_message,$current_time); 
   } 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
//--------------------------------------------------------------------------------------------------------------------- 
//ADD POINTS & EXPERIENCE, check experience & gain level if necessary 
//create levelup message to be displayed after posting 

//get stats config 
   $c2sql = "select config_value from phpbb_config where config_name='statsconfig'"; 
   if ( !($c2result = $db->sql_query($c2sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error!'); } 
   $c2row = mysql_fetch_array($c2result); 
$stats_config = explode(',',$c2row['config_value']); 


      $cash_message = ""; 
      if ( !$board_config['cash_disable'] ) 
      { 
         $cash_message = cash_update($mode,$forum_id,$post_id,$post_message,$current_time); 

//experience amounts for posting 
         $gainexp = abs( ( $mode == 'newtopic' ) ? rand($stats_config[10],$stats_config[11]) : rand($stats_config[8],$stats_config[9]) ); 
         if( $userdata['session_logged_in'] ) 
         { 

//levelup check 
$poster_expmax = $stats_config[0]; 
$new_exp = $userdata['user_exp']+$gainexp; 
$new_lvl_exp = $new_exp - $poster_expmax; 

//get level gains for user's class 
   $classsql = "select statgains from phpbb_classes where class='$userdata[user_class]'"; 
   if ( !($classresult = $db->sql_query($classsql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error!'); } 
   $classrow = mysql_fetch_array($classresult); 
$stat_gains = explode(',',$classrow['statgains']); 

//level gains 
$hpgain = rand($stat_gains[0],$stat_gains[1]); $mpgain = rand($stat_gains[2],$stat_gains[3]); $attgain = rand($stat_gains[4],$stat_gains[5]); $defgain = rand($stat_gains[6],$stat_gains[7]); 

//if they've gained a level, update level, hp, mp, att, def & experience, if not, just update experience. 
$islevelup = ($new_exp >= $poster_expmax) ? 'yes' : 'no'; 
$levelup = ($new_exp >= $poster_expmax) ? ', user_statlevel = user_statlevel + 1, user_hpmax = user_hpmax + '.$hpgain.', user_mpmax = user_mpmax + '.$mpgain.', user_att = user_att + '.$attgain.', user_def = user_def + '.$defgain.', user_exp = '.$new_lvl_exp.' ' : ', user_exp = '.$new_exp. ' '; 
//create message to be displayed after posting! 
$levelupmessage = ($islevelup == 'yes') ? "<b>You've gone up a level!</b><BR>Hit Points increased by ".$hpgain.", Magic Points increased by ".$mpgain.".<BR>Attack increased by ".$attgain.", Defence increased by ".$defgain.".<P>" : ""; 

            $sql = "UPDATE " . USERS_TABLE . " SET" . 
                  substr($levelup,1) . 
                  "WHERE user_id = $userdata[user_id]"; 

            if( !$db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, 'Could not update user points, experience or statistics.', '', __LINE__, __FILE__, $sql); 
            } 
         } 
         $cash_message .= "<br /> " . $levelupmessage; 
      } 
//--------------------------------------------------------------------------------------------------------------------- 
which i did previously.

in upgrading the cash mod from 2.0.2 to 2.2.0, theres some directions that read for functions_post.php

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
# 
	$cash_message = "";
	if ( !$board_config['cash_disable'] )
	{
		$cash_message = cash_update($mode,$forum_id,$post_id,$post_message,$current_time);
	}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
	$cash_message = $GLOBALS['cm_posting']->update_post($mode, $post_data, $forum_id, $topic_id, $post_id, $topic_type, $bbcode_uid, $post_username, $post_message);
how would this one upgrade step translate for working with moogies battle mod? Id like to be able to upgrade to cash mod 2.2.0 and use moogies mod as well, just need help with that one step since i would need a different find and replace. thanks


Xore wrote: replace just this line instead:

Code: Select all

	$cash_message = cash_update($mode,$forum_id,$post_id,$post_message,$current_time);
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Mon Nov 17, 2003 1:15 am

UPDATE (2.2.0 and 2.2.1 only)

OPEN

Code: Select all

includes/functions_cash.php
FIND (around line 394)

Code: Select all

	global $db, $board_config, $userdata, $phpbb_root_path, $phpEx, $html_entities_match, $html_entities_replace;
REPLACE WITH

Code: Select all

	global $db, $board_config, $lang, $userdata, $phpbb_root_path, $phpEx, $html_entities_match, $html_entities_replace;
OPEN

Code: Select all

cash.php
REPLACE ENTIRE CONTENTS WITH

Code: Select all

<?php
/***************************************************************************
 *                               cash.php
 *                            -------------------
 *   begin                : Wednesday, Jul 16, 2003
 *   copyright            : (C) 2003 Xore
 *   email                : mods@xore.ca
 *
 *   $Id: cash.php,v 2.0.2.1 2003/11/16 17:21:10 Xore $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
define('IN_CASHMOD', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
//
// End session management
//

if ( !$userdata['session_logged_in'] )
{
	redirect(append_sid("login.$phpEx?redirect=cash.$phpEx", true));
}

$mode = isset($HTTP_POST_VARS['mode'])?$HTTP_POST_VARS['mode']:(isset($HTTP_GET_VARS['mode'])?$HTTP_GET_VARS['mode']:(""));

switch( $mode )
{
//
//========================================[ Donate Code ]===========================
//
	case "donate":
		$ref = isset($HTTP_GET_VARS['ref'])?$HTTP_GET_VARS['ref']:'index';
		$target = ( isset($HTTP_GET_VARS[POST_USERS_URL]) )?intval($HTTP_GET_VARS[POST_USERS_URL]):(( isset($HTTP_GET_VARS['u']) )?intval($HTTP_GET_VARS['u']):0);
		$post = ( isset($HTTP_GET_VARS[POST_POST_URL]) )?intval($HTTP_GET_VARS[POST_POST_URL]):(( isset($HTTP_GET_VARS['p']) )?intval($HTTP_GET_VARS['p']):0);
		if ( ($target == ANONYMOUS) || ($target == $userdata['user_id']) )
		{
			if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$profiledata = get_userdata($target);
		//
		// Load templates
		//
		$template->set_filenames(array(
			'body' => 'cash_donate.tpl')
		);

		//
		// Output page header
		//
		$page_title = $lang['Donate'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$hidden = '<input type="hidden" name="ref" value="' . $ref . '" />';
		$hidden .= '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $target . '" />';
		if ( $ref == 'viewtopic' )
		{
			$hidden .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post . '" />';
		}

		$template->assign_vars(array(
			'S_DONATE_ACTION' => append_sid("cash.$phpEx?mode=donated"),
			'S_HIDDEN_FIELDS' => $hidden,
			'L_DONATE' => $lang['Donate'],
			'L_FROM' => $lang['From'],
			'L_TO' => $lang['To'],
			'L_CONVERT' => $lang['Convert'],
			'L_SELECT_ONE' => $lang['Select_one'],

			'L_SUBMIT' => $lang['Submit'],
			'L_RESET' => $lang['Reset'],

			'L_AMOUNT' => $lang['Amount'],
			'L_DONATE_TO' => sprintf($lang['Donate_to'],$profiledata['username']),
			'L_MESSAGE' => $lang['Message'],

			'TARGET' => $profiledata['username'],
			'DONATER' => $userdata['username'])
			);

		while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED | CURRENCY_DONATE) )
		{
			$template->assign_block_vars('cashrow',array(	'CASH_NAME' => $c_cur->name(),
															'RECEIVER_AMOUNT' => $profiledata[$c_cur->db()],
															'DONATER_AMOUNT' => $userdata[$c_cur->db()],
															'S_DONATE_FIELD' => 'cash[' . $c_cur->id() . ']')
			);
		}

		$template->pparse('body');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

		break;
//
//========================================[ Donated Code ]===========================
//
	case "donated":
		$ref = isset($HTTP_POST_VARS['ref'])?$HTTP_POST_VARS['ref']:'index';
		$target = ( isset($HTTP_POST_VARS[POST_USERS_URL]) )?intval($HTTP_POST_VARS[POST_USERS_URL]):(( isset($HTTP_POST_VARS['u']) )?intval($HTTP_POST_VARS['u']):0);
		$post = ( isset($HTTP_POST_VARS[POST_POST_URL]) )?intval($HTTP_POST_VARS[POST_POST_URL]):(( isset($HTTP_POST_VARS['p']) )?intval($HTTP_POST_VARS['p']):0);
		if ( ($target == ANONYMOUS) || ($target == $userdata['user_id']) )
		{
			if ( ($ref == 'viewtopic') && ($post != 0) )
		   {
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$profiledata = get_userdata($target);
		$target = new cash_user($target,$profiledata);
		$donater = new cash_user($userdata['user_id'],$userdata);
		if ( ($target->id() != $donater->id()) && isset($HTTP_POST_VARS['cash']) && is_array($HTTP_POST_VARS['cash']) )
		{
			$donate_array = array();
			$donate = false;
			while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED | CURRENCY_DONATE) )
			{
				if ( isset($HTTP_POST_VARS['cash'][$c_cur->id()]) &&
					 is_numeric($HTTP_POST_VARS['cash'][$c_cur->id()]) )
				{
					$amount = cash_floatval($HTTP_POST_VARS['cash'][$c_cur->id()]);
					if ( $amount > 0 )
					{
						$amount = ( $donater->has($c_cur->id(),$amount) ) ? $amount : $donater->amount($c_cur->id());
						$donate_array[$c_cur->id()] = $amount;
						$message_clause[] = $c_cur->display($amount,true);
						$donate = true;
					}
				}
			}
			if ( $donate )
			{
				$donater->remove_by_id_array($donate_array);
				$target->give_by_id_array($donate_array);

				$action = array($donater->id(),
								$donater->name(),
								implode('</b>, <b>',$message_clause),
								$target->id(),
								$target->name());
				$message = ( isset($HTTP_POST_VARS['message']) )?str_replace("\'","''",$HTTP_POST_VARS['message']):'';
				cash_create_log(CASH_LOG_DONATE,$action,$message);
								
				if ( ($message != '') && $userdata['user_allow_pm'] )
				{
					$privmsg_subject = sprintf($lang['Donation_recieved'],$userdata['username']);

					$preamble = sprintf($lang['Has_donated'],$userdata['username'],implode('[/b], [b]',$message_clause),$userdata['username']);
					$message = str_replace("'","''",$preamble) . $message;

					cash_pm($profiledata,$privmsg_subject,$message);
				}
			}
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target->id()));
				exit;
			}
			else if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		break;
//
//========================================[ Modedit Code ]===========================
//
	case "modedit":
		$ref = isset($HTTP_GET_VARS['ref'])?$HTTP_GET_VARS['ref']:'index';
		$target = ( isset($HTTP_GET_VARS[POST_USERS_URL]) )?intval($HTTP_GET_VARS[POST_USERS_URL]):(( isset($HTTP_GET_VARS['u']) )?intval($HTTP_GET_VARS['u']):0);
		$post = ( isset($HTTP_GET_VARS[POST_POST_URL]) )?intval($HTTP_GET_VARS[POST_POST_URL]):(( isset($HTTP_GET_VARS['p']) )?intval($HTTP_GET_VARS['p']):0);
		if ( $target == ANONYMOUS )
		{
			if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		if ( ($userdata['user_level'] != ADMIN) && ($userdata['user_level'] != MOD))
		{
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target));
				exit;
			}
			else if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$profiledata = get_userdata($target);
		//
		// Load templates
		//
		$template->set_filenames(array(
			'body' => 'cash_modedit.tpl')
		);

		//
		// Output page header
		//
		$page_title = sprintf($lang['Mod_usercash'],$profiledata['username']);
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);


		$hidden = '<input type="hidden" name="ref" value="' . $ref . '" />';
		$hidden .= '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $target . '" />';
		if ( $ref == 'viewtopic' )
		{
			$hidden .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post . '" />';
		}

		$template->assign_vars(array(
			'S_MODEDIT_ACTION' => append_sid("cash.$phpEx?mode=modedited"),
			'S_HIDDEN_FIELDS' => $hidden,
			'L_DONATE' => $lang['Donate'],
			'L_FROM' => $lang['From'],
			'L_TO' => $lang['To'],
			'L_CONVERT' => $lang['Convert'],
			'L_SELECT_ONE' => $lang['Select_one'],

			'L_SUBMIT' => $lang['Submit'],
			'L_RESET' => $lang['Reset'],

			'L_AMOUNT' => $lang['Amount'],
			'L_DONATE_TO' => sprintf($lang['Donate_to'],$profiledata['username']),
			'L_MESSAGE' => $lang['Message'],

			'L_OMIT' => $lang['Omit'],
			'L_ADD' => $lang['Add'],
			'L_REMOVE' => $lang['Remove'],
			'L_SET' => $lang['Set'],

			'TITLE' => sprintf($lang['Mod_usercash'],$profiledata['username']),

			'TARGET' => $profiledata['username'],
			'DONATER' => $userdata['username'])
			 );

		$mask = false;
		if ( $userdata['user_level'] == MOD )
		{
			$mask = (CURRENCY_ENABLED | CURRENCY_MODEDIT);
		}
		while ( $c_cur = &$cash->currency_next($cm_i,$mask) )
		{
			$template->assign_block_vars('cashrow',array(	'CASH_NAME' => $c_cur->name(),
															'RECEIVER_AMOUNT' => $profiledata[$c_cur->db()],
															'DONATER_AMOUNT' => $userdata[$c_cur->db()],
															'S_TYPE_FIELD' => 'cashtype[' . $c_cur->id() . ']',
															'S_CHANGE_FIELD' => 'cashchange[' . $c_cur->id() . ']')
				);
		}

		$template->pparse('body');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

		break;
//
//========================================[ Modedited Code ]===========================
//
	case "modedited":
		$ref = isset($HTTP_POST_VARS['ref'])?$HTTP_POST_VARS['ref']:'index';
		$target = ( isset($HTTP_POST_VARS[POST_USERS_URL]) )?intval($HTTP_POST_VARS[POST_USERS_URL]):(( isset($HTTP_POST_VARS['u']) )?intval($HTTP_POST_VARS['u']):0);
		$post = ( isset($HTTP_POST_VARS[POST_POST_URL]) )?intval($HTTP_POST_VARS[POST_POST_URL]):(( isset($HTTP_POST_VARS['p']) )?intval($HTTP_POST_VARS['p']):0);
		if ( $target == 0 )
		{
			if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		if ( ($userdata['user_level'] != ADMIN) && ($userdata['user_level'] != MOD))
		{
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target));
				exit;
			}
			else if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$profiledata = get_userdata($target);
		$target = new cash_user($target,$profiledata);
		if ( isset($HTTP_POST_VARS['cashtype']) && is_array($HTTP_POST_VARS['cashtype']) && isset($HTTP_POST_VARS['cashchange']) && is_array($HTTP_POST_VARS['cashchange']) )
		{
			$mask = false;
			if ( $userdata['user_level'] == MOD )
			{
				$mask = (CURRENCY_ENABLED | CURRENCY_MODEDIT);
			}
			$moderate_array = array('1' => array(),'2' => array(),'3' => array());
			$moderate_clause = array('1' => array(),'2' => array(),'3' => array());
			$modedit = array('1'=>false,'2'=>false,'3'=>false);
			$editlist = array();
			while ( $c_cur = &$cash->currency_next($cm_i,$mask) )
			{
				if ( isset($HTTP_POST_VARS['cashtype'][$c_cur->id()]) &&
					 is_numeric($HTTP_POST_VARS['cashtype'][$c_cur->id()]) &&
					 ($HTTP_POST_VARS['cashtype'][$c_cur->id()] != 0) &&
					 isset($HTTP_POST_VARS['cashchange'][$c_cur->id()]) &&
					 is_numeric($HTTP_POST_VARS['cashchange'][$c_cur->id()]) )
				{
					$amount = cash_floatval($HTTP_POST_VARS['cashchange'][$c_cur->id()]);
					$allow_neg = $c_cur->mask(CURRENCY_ALLOWNEG);
					$type = intval($HTTP_POST_VARS['cashtype'][$c_cur->id()]);
					if ( (($type == 1) || ($type == 2)) && $amount < 0 )
					{
						$amount = -$amount;
						$type = 3 - $type;
					}
					switch ( $type )
					{
						case 1: // add
							$moderate_array[1][$c_cur->id()] = $amount;
							$modedit[1] = true;
							$moderate_clause[1][] = $c_cur->display($amount,true);
							$editlist[] = $c_cur->name(true);
							break;
						case 2: // remove
							if ( $allow_neg || $target->has($c_cur->id(),$amount) )
							{
								$moderate_array[2][$c_cur->id()] = $amount;
								$modedit[2] = true;
								$moderate_clause[2][] = $c_cur->display($amount,true);
								$editlist[] = $c_cur->name(true);
							}
							break;
						case 3: // set
							if ( ($amount >= 0) || $allow_neg )
							{
								$moderate_array[3][$c_cur->id()] = $amount;
								$modedit[3] = true;
								$moderate_clause[3][] = $c_cur->display($amount,true);
								$editlist[] = $c_cur->name(true);
							}
							break;
					}
				}
			}

			if ( $modedit[1] || $modedit[2] || $modedit[3] )
			{
				$message = ( isset($HTTP_POST_VARS['message']) )?str_replace("\'","''",$HTTP_POST_VARS['message']):'';
				$action = array($userdata['user_id'],
								$userdata['username'],
								$target->id(),
								$target->name(),
								implode('</b>, <b>',$moderate_clause[1]),
								implode('</b>, <b>',$moderate_clause[2]),
								implode('</b>, <b>',$moderate_clause[3]));
				cash_create_log(CASH_LOG_ADMIN_MODEDIT,$action,$message);
				if ( $modedit[1] )
				{
					$target->give_by_id_array($moderate_array[1]);
				}
				if ( $modedit[2] )
				{
					$target->remove_by_id_array($moderate_array[2]);
				}
				if ( $modedit[3] )
				{
					$target->set_by_id_array($moderate_array[3]);
				}

				if ( ($message != '') && $userdata['user_allow_pm'] )
				{
					$privmsg_subject = sprintf($lang['Has_moderated'],$userdata['username'],implode(", ",$editlist));

					$preamble = $privmsg_subject . ":\n[list]";
					if ( $modedit[1] )
					{
						$preamble .= sprintf($lang['Has_added'],implode('[/b], [b]',$moderate_clause[1]));
					}
					if ( $modedit[2] )
					{
						$preamble .= sprintf($lang['Has_removed'],implode('[/b], [b]',$moderate_clause[2]));
					}
					if ( $modedit[3] )
					{
						$preamble .= sprintf($lang['Has_set'],implode('[/b], [b]',$moderate_clause[3]));
					}

					$message = str_replace("'","''",$preamble) . "[/list]\n" . $message;

					cash_pm($profiledata,str_replace("'","''",$privmsg_subject),$message);
				}
			}
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $target->id()));
				exit;
			}
			else if ( ($ref == 'viewtopic') && ($post != 0) )
			{
				redirect(append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $post) . '#' . $post);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		break;

//
//========================================[ Exchange Code ]===========================
//
	case "exchange":
	default:
		//
		// Load templates
		//
		$template->set_filenames(array(
			'body' => 'cash_exchange.tpl')
		);

		//
		// Output page header
		//
		$page_title = $lang['Exchange'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		if ( $cash->currency_count(CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE) < 2 )
		{
			message_die(GENERAL_MESSAGE, $lang['Exchange_lack_of_currencies']);
		}
		$sql = "SELECT * FROM " . CASH_EXCHANGE_TABLE;
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not obtain exchange information", '', __LINE__, __FILE__, $sql);
		}
		$exchange_data = array();
		while ( $row = $db->sql_fetchrow($result) );
		{
			$exchange_data[$row['ex_cash_id1']][$row['ex_cash_id2']] = 1;
		}
		$exchanger = new cash_user($userdata['user_id'],$userdata);
		if ( isset($HTTP_POST_VARS['exchange']) &&
			 isset($HTTP_POST_VARS['from_id']) &&
			 is_numeric($HTTP_POST_VARS['from_id']) &&
			 isset($HTTP_POST_VARS['to_id']) &&
			 is_numeric($HTTP_POST_VARS['to_id']) &&
			 isset($HTTP_POST_VARS['convert_amount']) &&
			 is_numeric($HTTP_POST_VARS['convert_amount']) )
		{
			$from_id = intval($HTTP_POST_VARS['from_id']);
			$to_id = intval($HTTP_POST_VARS['to_id']);
			$convert_amount = cash_floatval($HTTP_POST_VARS['convert_amount']);
			if ( $convert_amount < 0 )
			{
				qs($from_id,$to_id);
				$convert_amount = -$convert_amount;
			}
			if ( ($to_id != $from_id) && $cash->currency_exists($to_id) && $cash->currency_exists($from_id) && isset($exchange_data[$from_id]) && is_array($exchange_data[$from_id]) && isset($exchange_data[$from_id][$to_id]) && $cash->currencies[$from_id]->mask(CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE) && $cash->currencies[$to_id]->mask(CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE) )
			{
				$c_cur_from = $cash->currency($from_id);
				$c_cur_to = $cash->currency($to_id);

				if ( $exchanger->has($c_cur_from->id(),$convert_amount) )
				{
					$converted_amount = (($convert_amount/$c_cur_from->data('cash_exchange'))*$c_cur_to->data('cash_exchange'));
					$exchanger->remove_by_id_array(array($c_cur_from->id() => $convert_amount));
					$exchanger->give_by_id_array(array($c_cur_to->id() => $converted_amount));
				}
			}
		}

		$template->assign_vars(array(
			'S_EXCHANGE_ACTION' => append_sid("cash.$phpEx?mode=exchange"),
			'S_HIDDEN_FIELDS' => '<input type="hidden" name="exchange" value="1" />',
			'L_EXCHANGE' => $lang['Exchange'],
			'L_FROM' => $lang['From'],
			'L_TO' => $lang['To'],
			'L_CONVERT' => $lang['Convert'],
			'L_SELECT_ONE' => $lang['Select_one'],

			'L_SUBMIT' => $lang['Submit'],
			'L_RESET' => $lang['Reset'])
			 );

		$max_columns_per_row = 3;
		$columnwidth = intval(floor(100/$max_columns_per_row));
		$bresenham = 0;
		$numrows = intval(ceil(count($indices)/$max_columns_per_row));
		$i = 0;
		while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE) )
		{
			$template->assign_block_vars("cashrow",array(
				'CASH_ID' => $c_cur->id(),
				'CASH_NAME' => $c_cur->name(true))
				 );
			if ( (($i * $numrows) / $cash->currency_count(CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE)) >= $bresenham )
			{
				$bresenham++;
				$template->assign_block_vars("rowrow",array());
			}
			$headercash = $c_cur->display($exchanger->amount($c_cur->id()));
			$template->assign_block_vars("rowrow.cashtable",array(	'CASH_ID' => $c_cur->id(),
																	'CASH_NAME' => $c_cur->name(),
																	'HEADER' => $lang['You_have'] . " " . $headercash,
																	'ONE_WORTH' => sprintf($lang['One_worth'],$c_cur->name()),
																	'NO_EXCHANGE' => sprintf($lang['Cannot_exchange'],$c_cur->name()))
										);
			$exchangecount = 0;
			if ( isset($exchange_data[$c_cur->id()]) && count($exchange_data[$c_cur->id()]) )
			{
				$template->assign_block_vars("rowrow.cashtable.switch_exon",array());
				while ( $c_cur_j = &$cash->currency_next($cm_j,CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE) )
				{
					if ( ($c_cur->id() != $c_cur_j->id()) && isset($exchange_data[$c_cur->id()]) && isset($exchange_data[$c_cur->id()][$c_cur_j->id()]) )
					{
						$ratio = floor(($c_cur_j->data('cash_exchange')/$c_cur->data('cash_exchange'))*1000)/1000;
						$template->assign_block_vars("rowrow.cashtable.switch_exon.exchangeitem",array(	'EXCHANGE' => $c_cur_j->display($ratio)));
					}
				}
			}
			else
			{
				$template->assign_block_vars("rowrow.cashtable.switch_exoff",array());
			}
			$i++;
		}

		$template->pparse('body');

		include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
		
		break;
	}
	

?>
Make sure to remove any extra spaces before the <? and after the ?>
Last edited by Xore on Sat Dec 13, 2003 2:56 am, edited 4 times in total.
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

User avatar
drumstix42
Registered User
Posts: 1100
Joined: Tue Sep 24, 2002 11:01 pm
Location: NJ
Contact:

Post by drumstix42 » Mon Nov 17, 2003 3:16 am

Nope Xore :( Still a blank Information box :?


Lol, sorry to have all these problems. :cry:
Need a phpBB update or mod installed? PM me for any questions and pricing!
HostMonster.com (Unlimited Space, Unlimited Transfer, Unlimited Domains, $6.95/month )

User avatar
drumstix42
Registered User
Posts: 1100
Joined: Tue Sep 24, 2002 11:01 pm
Location: NJ
Contact:

Post by drumstix42 » Mon Nov 17, 2003 3:21 am

*Edit*, nevermind about the Moogie fix. Works perfect ! :)

But yeah, my post above remains the same :?
Need a phpBB update or mod installed? PM me for any questions and pricing!
HostMonster.com (Unlimited Space, Unlimited Transfer, Unlimited Domains, $6.95/month )

swedevil
Registered User
Posts: 94
Joined: Wed Nov 05, 2003 7:10 am

Post by swedevil » Mon Nov 17, 2003 8:41 am

Xore wrote: As for spanish: i would like to get a spanish translation for Cash Mod, but i haven't found the proper place to ask. I'm currently trying to get my hands also on a german and swedish translation.


Do you have someone working on the German one for you or are you looking for someone? I have never translated one, and would need a couple instructions as to what to do, but I am fluent in German and may be able to do that one for you...




Request for next Update-
A couple of the members on my forums pointed out that once they reach their points limit, they can still go back and edit a post (adding words) and they get the points for the what they edited. Is there a way to make it so that once you reach you daily limit, you CAN NOT get anymore points unless given by an Admin??? maybe an extra option or something!!

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Mon Nov 17, 2003 8:55 am

swedevil wrote:
Xore wrote:
As for spanish: i would like to get a spanish translation for Cash Mod, but i haven't found the proper place to ask. I'm currently trying to get my hands also on a german and swedish translation.


Do you have someone working on the German one for you or are you looking for someone? I have never translated one, and would need a couple instructions as to what to do, but I am fluent in German and may be able to do that one for you...


If you want to submit a german translation, feel free. I'll accept the first (and/or best union of) translation(s) i get, and give credit to that person. So far, nobody's submitted a german translation to me. The document to be translated is located at http://www.xore.ca/lang_cash.txt

To translate, you'll see a bunch of $lang['key'] = 'sometext' variable assignments. just translate 'sometext' to german, leaving any %s you see alone. email the file to me (with your username and preferred email address for credit) at mods(at)xore(dot)ca ( (at) being @ and (dot) being .)
swedevil wrote: Request for next Update-
A couple of the members on my forums pointed out that once they reach their points limit, they can still go back and edit a post (adding words) and they get the points for the what they edited. Is there a way to make it so that once you reach you daily limit, you CAN NOT get anymore points unless given by an Admin??? maybe an extra option or something!!


There is no 'daily' limit. The "limit" is the maximum that can be earned on any single post. After that "limit" is reached for a post, no more can be earned.
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

User avatar
Q-Zar
Registered User
Posts: 779
Joined: Sun Nov 17, 2002 8:30 pm
Location: Brussels
Contact:

Post by Q-Zar » Mon Nov 17, 2003 9:15 am

There is a fix to stop users from gaining money by editing posts. Check the support if that's what you mean.

Xore : the new cash.php you posted, is that to stop the empty information box ?
Traductions : Cash Mod v2.2.2 (Getting Started) / Dice Mod v1.2.3 / Activity Mod Plus 1.0.8
Remember this. Please read the F.A.Q/Troubleshooting of a mod before asking questions.
Image

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Mon Nov 17, 2003 9:18 am

Q-Zar wrote: There is a fix to stop users from gaining money by editing posts. Check the support if that's what you mean.


actually, that should be fixed in this version.

Specifically, if a user edits a post, they will gain the difference between the current value of the post, and the old value of the post.

So, they may gain cash, or they may lose it. However, they can only gain up to 'max earnings' points per post.
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

User avatar
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post by Xore » Mon Nov 17, 2003 9:19 am

Q-Zar wrote: Xore : the new cash.php you posted, is that to stop the empty information box ?


it was an attempt. I don't get the empty information box. If you do, perhaps you could assist me in figuring out what's wrong
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod

The Dover Demon
Registered User
Posts: 144
Joined: Sun Oct 20, 2002 4:10 am
Contact:

Post by The Dover Demon » Mon Nov 17, 2003 10:52 am

Thanks for this great mod, it's really awesome except now I have two problems my users are unhappy with.

1. The bank mod no longer works.

2. The store/items mod no longer works.

How can I fix them?

Esuomynona
Registered User
Posts: 6
Joined: Wed Nov 05, 2003 12:33 pm

Post by Esuomynona » Mon Nov 17, 2003 11:10 am

Hi,

Great mod, now I've got past the few hiccups.

I have a few questions though.

I read on one of the earlier pages youw ere thinking about somethign to do with allowing a certain usergroup to have its own currency. I was wanderign if that is supported yet? And if so, what am I doing wrong in gettign it to work. If not, it doesnt matter.

The other query was about enabling the currency in certain forums.

I have the currency enabled in certain forums and not in others. However I noticed that when in the forums where the currency is enabled int he post you simply get:

Realm Beans (the name of the currency)

While in the forums where it's turned on you get:

3 Realm Beans (or whatever the amount is).

i was wondering if there was a way to work it so that you got the amount in all the forums, you just simply didnt earn any points when posting in certain forums?

swedevil
Registered User
Posts: 94
Joined: Wed Nov 05, 2003 7:10 am

Post by swedevil » Mon Nov 17, 2003 11:24 am

Xore wrote: If you want to submit a german translation, feel free. I'll accept the first (and/or best union of) translation(s) i get, and give credit to that person. So far, nobody's submitted a german translation to me. The document to be translated is located at http://www.xore.ca/lang_cash.txt

To translate, you'll see a bunch of $lang['key'] = 'sometext' variable assignments. just translate 'sometext' to german, leaving any %s you see alone. email the file to me (with your username and preferred email address for credit) at mods(at)xore(dot)ca ( (at) being @ and (dot) being .)


I will get to work on that then.. i have a couple college exams tomorrow but i will work on a translation afterwards...
Last edited by swedevil on Mon Nov 17, 2003 11:27 am, edited 1 time in total.

swedevil
Registered User
Posts: 94
Joined: Wed Nov 05, 2003 7:10 am

Post by swedevil » Mon Nov 17, 2003 11:26 am

Xore wrote:
swedevil wrote:swedevil wrote:
Request for next Update-
A couple of the members on my forums pointed out that once they reach their points limit, they can still go back and edit a post (adding words) and they get the points for the what they edited. Is there a way to make it so that once you reach you daily limit, you CAN NOT get anymore points unless given by an Admin??? maybe an extra option or something!!



There is no 'daily' limit. The "limit" is the maximum that can be earned on any single post. After that "limit" is reached for a post, no more can be earned.


That's what i'm asking is if you can set it so that they can't go back and edit a post to get the rest of the points...

Nevermind... don't worry about that...

User avatar
Q-Zar
Registered User
Posts: 779
Joined: Sun Nov 17, 2002 8:30 pm
Location: Brussels
Contact:

Post by Q-Zar » Mon Nov 17, 2003 12:55 pm

Swedevil, there is a fix which makes it impossible to earn money by editing posts.
Wouldn't that solve your problem ?
Traductions : Cash Mod v2.2.2 (Getting Started) / Dice Mod v1.2.3 / Activity Mod Plus 1.0.8
Remember this. Please read the F.A.Q/Troubleshooting of a mod before asking questions.
Image

Post Reply

Return to “[2.0.x] MOD Database Releases”

Who is online

Users browsing this forum: No registered users and 12 guests