1 頁 (共 1 頁)

[問題]CashMod2.2.1安裝後的三個問題(已解決)

發表於 : 2004-04-29 18:14
bruno
問題外掛:Cash Mod 2.2.1
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php ... t=cash+mod
使用版本:phpBB 2.0.8
網站位置:建構中\r
狀況描述:

目前還剩3個問題,找不到答案,所以再次發文請各位先進幫忙看看

1、在後台管理,虛擬貨幣管理選項裡選擇"兌換"會出現以下的錯誤訊息\r
Parse error: parse error, unexpected '@', expecting ')' in c:\appserv\www\phpbb\admin\cash_exchange.php on line 133

2、在討論版個人簡介的金錢顯示下方[修改XXXX貨幣]按下後出現以下的錯誤訊息\r
Parse error: parse error, unexpected '@', expecting ')' in c:\appserv\www\phpbb\cash.php on line 96
3、圖中,紅色框框內的字如何消去\r

勞煩各位先進幫忙,謝謝

圖檔

cash.php:

代碼: 選擇全部

<?php
/***************************************************************************
 *                               cash.php
 *                            -------------------
 *   begin                : Wednesday, Jul 16, 2003
 *   copyright            : (C) 2003 Xore
 *   email                : mods@xore.ca
 *
 *   $Id: cash.php,v 2.0.1.1 2003/09/26 01:20:53 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));
}

//$cash_table = array();
//$indices = array();
//get_cash_table($cash_table,$indices);

$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';
		$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
		if ( (!$profiledata) || ($profiledata['user_id'] == $userdata['user_id']) )
		{
			if ( ($ref == 'viewtopic') && isset($HTTP_GET_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_GET_VARS[POST_POST_URL]) . '#' . $HTTP_GET_VARS[POST_POST_URL]);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$target = $profiledata['user_id'];

		//
		// 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="' . $HTTP_GET_VARS[POST_POST_URL] . '" />';
		}

		$template->assign_vars(array(
			'S_DONATE_ACTION' => append_sid("cash.$phpEx?mode=donated"),
			'S_HIDDEN_FIELDS' => $hidden,
			'L_DONATE' => $lang['Donate'],
			'L_FROM' => $lang['Exchange_from'], 
         'L_TO' => $lang['Exchange_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":\r
		$ref = isset($HTTP_POST_VARS['ref'])?$HTTP_POST_VARS['ref']:'index';
		$profiledata = get_userdata($HTTP_POST_VARS[POST_USERS_URL]);
		if ( !$profiledata )
		{
			if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$target = new cash_user($profiledata['user_id'],$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());
				cash_create_log(CASH_LOG_DONATE,$action,$HTTP_POST_VARS['message']);
								
				if ( isset($HTTP_POST_VARS['message']) && ($HTTP_POST_VARS['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']);
					$HTTP_POST_VARS['message'] = $preamble . $HTTP_POST_VARS['message'];

					cash_pm($profiledata,$privmsg_subject,$HTTP_POST_VARS['message']);
				}
			}
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.'.$phpEx.'?mode=viewprofile&'.POST_USERS_URL.'='.$HTTP_POST_VARS[POST_USERS_URL]));
				exit;
			}
			else if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		break;
//
//========================================[ Modedit Code ]===========================
//
	case "modedit":
		$ref = isset($HTTP_GET_VARS['ref'])?$HTTP_GET_VARS['ref']:'index';
		$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
		if ( !$profiledata )
		{
			if ( ($ref == 'viewtopic') && isset($HTTP_GET_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_GET_VARS[POST_POST_URL]) . '#' . $HTTP_GET_VARS[POST_POST_URL]);
				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.'='.$HTTP_POST_VARS[POST_USERS_URL]));
				exit;
			}
			else if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$target = $profiledata['user_id'];
		//
		// 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="' . $HTTP_GET_VARS[POST_POST_URL] . '" />';
		}

		$template->assign_vars(array(
			'S_MODEDIT_ACTION' => append_sid("cash.$phpEx?mode=modedited"),
			'S_HIDDEN_FIELDS' => $hidden,
			'L_DONATE' => $lang['Donate'],
			'L_FROM' => $lang['Exchange_from'], 
         'L_TO' => $lang['Exchange_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']),
\r
			'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';
		$profiledata = get_userdata($HTTP_POST_VARS[POST_USERS_URL]);
		if ( !$profiledata )
		{
			if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				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.'='.$HTTP_POST_VARS[POST_USERS_URL]));
				exit;
			}
			else if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				exit;
			}
			else
			{
				redirect(append_sid("index.$phpEx"));
				exit;
			}
		}
		$target = new cash_user($profiledata['user_id'],$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] )
			{
				$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,$HTTP_POST_VARS['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 ( isset($HTTP_POST_VARS['message']) && ($HTTP_POST_VARS['message'] != '') && $userdata['user_allow_pm'] )
				{
					$privmsg_subject = sprintf($lang['Has_moderated'],$userdata['username'],implode(", ",$editlist));

					$preamble = $privmsg_subject . ":
[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]));
					}

					$HTTP_POST_VARS['message'] = $preamble . "[/list]
" . $HTTP_POST_VARS['message'];

					cash_pm($profiledata,$privmsg_subject,$HTTP_POST_VARS['message']);
				}
			}
			if ( $ref == 'viewprofile' )
			{
				redirect(append_sid('profile.'.$phpEx.'?mode=viewprofile&'.POST_USERS_URL.'='.$HTTP_POST_VARS[POST_USERS_URL]));
				exit;
			}
			else if ( ($ref == 'viewtopic') && isset($HTTP_POST_VARS[POST_POST_URL]) )
			{
				redirect(append_sid('viewtopic.'.$phpEx.'?'.POST_POST_URL.'='.$HTTP_POST_VARS[POST_POST_URL]) . '#' . $HTTP_POST_VARS[POST_POST_URL]);
				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); 

      $sql = "SELECT * FROM " . CASH_EXCHANGE_TABLE; 
      if ( !($result = $db->sql_query($sql)) ) 
      { 
         message_die(GENERAL_ERROR, "Could not obtain exchange information", '', __LINE__, __FILE__, $sql); 
      } 
      if ( !($row = $db->sql_fetchrow($result)) ) 
      { 
         message_die(GENERAL_MESSAGE, $lang['Exchange_lack_of_currencies']); 
      } 
      $exchange_data = array(); 
      do 
      { 
         $exchange_data[$row['ex_cash_id1']][$row['ex_cash_id2']] = 1; 
      } 
      while ( $row = $db->sql_fetchrow($result) ); 

      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 ( ($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) ) 
         { 
            if ( $convert_amount < 0 ) 
            { 
               qs($from_id,$to_id); 
               $convert_amount = -$convert_amount; 
            } 
            $c_cur_from = $cash->currency($from_id); 
            $c_cur_to = $cash->currency($to_id); 

            $exchanger = new cash_user($userdata['user_id'],$userdata); 
            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)) 
             ); 
\n         if ( (($i * $numrows) / $cash->currency_count(CURRENCY_ENABLED | CURRENCY_EXCHANGEABLE)) >= $bresenham ) 
         { 
            $bresenham++; 
            $template->assign_block_vars("rowrow",array()); 
         } 
         $headercash = $c_cur->display($userdata[$c_cur->db()]); 
         $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; 
   } 
?>
cash_exchange.php:

代碼: 選擇全部

<?php
/***************************************************************************
 *                             cash_exchange.php
 *                            -------------------
 *   begin                : Sunday, Jul 13, 2003
 *   copyright            : (C) 2003 Xore
 *   email                : mods@xore.ca
 *
 *   $Id: cash_exchange.php,v 2.1.0.0 2003/09/18 23:01:30 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', 1);
define('IN_CASHMOD', 1);

//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

if ( $board_config['cash_adminnavbar'] )
{
	$navbar = 1;
	include('./admin_cash.'.$phpEx);
}

if ( $cash->currency_count() < 2 )
{
	message_die(GENERAL_MESSAGE, $lang['Exchange_insufficient_currencies']);
}

$exchange_update = false;
if ( isset($HTTP_POST_VARS['currency_val']) && is_array($HTTP_POST_VARS['currency_val']) )
{
	$exchange_update = true;
}

$exchange = array();
while ( $c_cur = &$cash->currency_next($cm_i) )
{
	$exval = $c_cur->exchange();
	if ( $exchange_update &&
		 isset($HTTP_POST_VARS['currency_val'][$c_cur->id()]) &&
		 is_numeric($HTTP_POST_VARS['currency_val'][$c_cur->id()]) &&
		 (intval($HTTP_POST_VARS['currency_val'][$c_cur->id()]) > 0) )
	{
		$newvalue = $c_cur->attribute_pack('cash_exchange',cash_floatval($HTTP_POST_VARS['currency_val'][$c_cur->id()]));
		$sql = "UPDATE " . CASH_TABLE . "
				SET cash_exchange = $newvalue
				WHERE cash_id = " . $c_cur->id();
		if ( !($db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, "Could not update exchange information", "", __LINE__, __FILE__, $sql);
		}
		$exval = $newvalue / $c_cur->factor();
	}
	$exchange[] = array('id' => $c_cur->id(), 'name' => $c_cur->name(), 'exchange' => $exval);
}

for ( $i1 = 0; $i1 < count($exchange); $i1++ )
{
	$i = $exchange[$i1]['id'];
	$varname = 'exchange_' . $i;
	if ( isset($HTTP_POST_VARS[$varname]) && is_array($HTTP_POST_VARS[$varname]) )
	{
		for ( $i2 = 0; $i2 < count($exchange); $i2++ )
		{
			$j = $exchange[$i2]['id'];
			if ( isset($HTTP_POST_VARS[$varname][$j]) && ($i != $j) )
			{
				$sql = "";
				if ( $HTTP_POST_VARS[$varname][$j] == $lang['Disabled'] )
				{
					$sql = "INSERT INTO " . CASH_EXCHANGE_TABLE . "
							(ex_cash_id1, ex_cash_id2, ex_cash_enabled)
							VALUES (" . $i . "," . $j . ", 1)";
				}
				else
				{
					$sql = "DELETE FROM " . CASH_EXCHANGE_TABLE . "
							WHERE ex_cash_id1 = " .  $i . " AND ex_cash_id2 = " . $j;
				}
				if ( !($db->sql_query($sql)) )
				{
					message_die(CRITICAL_ERROR, "Could not update exchange information", "", __LINE__, __FILE__, $sql);
				}
			}
		}
	}
}

$sql = "SELECT *
		FROM " . CASH_EXCHANGE_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
	message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
else
{
	while ( $row = $db->sql_fetchrow($result) )
	{
		$exchange_table[$row['ex_cash_id1']][$row['ex_cash_id2']] = 1;
	}
}

//
// Start page proper
//
$template->set_filenames(array(
	"body" => "admin/cash_exchange.tpl")
);

$template->assign_vars(array(
	'S_EXCHANGE_ACTION' => append_sid("cash_exchange.$phpEx"),
	'L_EXCHANGE_TITLE' => $lang['Cash_exchange'], 
	'L_EXCHANGE_EXPLAIN' => $lang['Cash_exchange_explain'],
	'L_SUBMIT' => $lang['Submit'],
	'L_RESET' => $lang['Reset'],
	'L_EXCHANGE' => $lang['Exchange'],
	'L_TO' => $lang['Exchange_to'], 
  'L_FROM' => $lang['Exchange_from'],

	'CORNER_CLASS' => $theme['td_class1'],
	'SIDE_CLASS' => 'row3',

	'NUM_COLUMNS' => count($exchange))
);

for ($i = 0; $i < count($exchange); $i++ )
{
	$template->assign_block_vars("cashrow",array(	"ROW_CLASS" => (( !(($i - 1) % 3) ) ? $theme['td_class2'] : $theme['td_class1']),
													"CURRENCY_ID" => $exchange[$i]['id'],
													"CURRENCY_NAME" => $exchange[$i]['name'],
													"CURRENCY_EXCHANGE" => $exchange[$i]['exchange']
												)
								);
}

for ($i = 0; $i < count($exchange); $i++ )
{
	$template->assign_block_vars("siderow",array(	"ROW_CLASS" => (( !(($i - 1) % 3) ) ? $theme['td_class2'] : $theme['td_class1']),
													"CURRENCY_NAME" => $exchange[$i]['name']
												)
								);
	if ( !$i )
	{
		$template->assign_block_vars("siderow.switch_first",array());
	}

	for ( $j = 0; $j < count($exchange); $j++ )
	{
		$node = ($i != $j);
		$row_class = ((( !(($j - 1) % 3) ) || ( !(($i - 1) % 3) )) ? $theme['td_class2'] : $theme['td_class1']);

		$text = (($exchange_table[$exchange[$i]['id']][$exchange[$j]['id']])? ('1 : ' . ($exchange[$j]['exchange'] / $exchange[$i]['exchange'])):$lang['Disabled']);
		$button = '<input type="submit" style="width:75" name="exchange_' . $exchange[$i]['id'] . '[' . $exchange[$j]['id'] . ']" value="' . $text . '" class="liteoption" />';
		
		$template->assign_block_vars("siderow.entry",array(	"ROW_CLASS" => $row_class,
															"CURRENCY_EX" => (($node)?$button:"x")
															)
									);
	}
}

$template->pparse("body");

include('./page_footer_admin.'.$phpEx);

?>

發表於 : 2004-04-30 13:55
哇沙米
看你的 cash.php 第95行

代碼: 選擇全部

這94-96行
         'L_FROM' => $lang['Exchange_from'], 
           'L_TO' => $lang['Exchange_to'], 
          'L_CONVERT' => $lang['Convert'],
要把第95行對齊, 使用Tab鍵, 不要使用空白鍵\r
成為這樣\r

代碼: 選擇全部

   'L_FROM' => $lang['Exchange_from'], 
   'L_TO' => $lang['Exchange_to'], 
   'L_CONVERT' => $lang['Convert'],
同樣的 cash_exchange.php 第133行也是一樣\r

代碼: 選擇全部

這132-133行
     'L_TO' => $lang['Exchange_to'], 
      'L_FROM' => $lang['Exchange_from'],
對齊成下面這樣\r

代碼: 選擇全部

 'L_TO' => $lang['Exchange_to'], 
 'L_FROM' => $lang['Exchange_from'],
我想這樣應該就正常了@@
我的是這樣子沒有問題說...如果不是這樣還請其他人指點囉!
第一次回別人問題的文章....(抖

P.S 你用UltraEdit編輯...就會發現其實多了很多空白鍵喔@@

發表於 : 2004-04-30 23:48
bruno
哇沙米大哥謝謝你幫忙^^

現在只剩第三個問題

發表於 : 2004-05-02 22:29
哇沙米
之前沒注意看你有問第三個問題.....
如果是這個問題的話\r
我想你應該之前有裝過其他的虛擬貨幣吧?
\r
如果只是不想顯示在那裡的話....麻煩把 viewtopic_body.tpl 貼出來!

發表於 : 2004-05-03 02:02
bruno
哇沙米 寫:之前沒注意看你有問第三個問題.....
如果是這個問題的話\r
我想你應該之前有裝過其他的虛擬貨幣吧?

如果只是不想顯示在那裡的話....麻煩把 viewtopic_body.tpl 貼出來!
我之前沒有安裝過其他的虛擬貨幣\r

viewtopic_body.tpl

代碼: 選擇全部

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />
	  <span class="gensmall"><b>{PAGINATION}</b><br />
	    </span></td>
  </tr>
</table>

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>   <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">   <a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
  </tr>
</table>

<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
	<tr align="right">
		<td class="catHead" colspan="2" height="28"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}" class="nav">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}" class="nav">{L_VIEW_NEXT_TOPIC}</a>  </span></td>
	</tr>
	{POLL_DISPLAY} 
	<tr>
		<th class="thLeft" width="150" height="26" nowrap="nowrap">{L_AUTHOR}</th>
		<th class="thRight" nowrap="nowrap">{L_MESSAGE}</th>
	</tr>
	<!-- BEGIN postrow -->
	<tr> 
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span style="filter: glow(color={postrow.GLOWING_COLOR},strength=3); height:10px; color:white; padding:1px; font-size : 11px"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}<br />{postrow.CASH}</span><br 
/>{postrow.POSTER_MONEY}<br /></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen"> </span>   {L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
				<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
			</tr>
			<tr> 
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
		<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
			<tr> 
				<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!-- 

	if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
		document.write(' {postrow.ICQ_IMG}');
	else
		document.write('</td><td> </td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
				
				//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
			</tr>
		</table></td>
	</tr>
	<tr> 
		<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END postrow -->
	<tr align="center"> 
		<td class="catBottom" colspan="2" height="28"><table cellspacing="0" cellpadding="0" border="0">
			<tr><form method="post" action="{S_POST_DAYS_ACTION}">
				<td align="center"><span class="gensmall">{L_DISPLAY_POSTS}: {S_SELECT_POST_DAYS} {S_SELECT_POST_ORDER} <input type="submit" value="{L_GO}" class="liteoption" name="submit" /></span></td>
			</form></tr>
		</table></td>
	</tr>
</table>

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  <tr> 
	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>   <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">   <a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
	  </td>
  </tr>
  <tr>
	<td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
  </tr>
</table>

<table width="100%" cellspacing="2" border="0" align="center"> 
  <tr> 
   <td width="40%" valign="top" nowrap="nowrap" align="left"> 
     <span class="gensmall">{S_WATCH_TOPIC}</span><br /> <br />{S_TOPIC_ADMIN} 
   </td> 
  </tr> 
</table> 

<table width="100%" cellspacing="2" border="0" align="center"> 
  <tr> 
   <td valign="top" align="left"> 
     <form name="quick_reply" action="{U_QUICK_REPLY}" method="post"><!-- Quick_Reply_MOD --> 
      <!-- BEGIN quick_reply_anonymous --> 
      <span class="gensmall"><b>{L_USERNAME}</b></span><br /> 
      <span class="genmed"><input type="text" class="post" tabindex="1" name="username" size="25" maxlength="25" value="" /></span><br /> 
      <!-- END quick_reply_anonymous --> 
      <textarea name="message" rows="7" cols="35" wrap="virtual" style="width:500px" class="post" onclick="{if(document.quick_reply.message.value=='{L_QUICK_REPLY_TOPIC}') document.quick_reply.message.value=''}">{L_QUICK_REPLY_TOPIC}</textarea><br /> 
      {U_HIDDEN_FORM_FIELDS} 
      <input type="image" src="{QUICK_REPLY_IMG}" border="0" alt="{L_QUICK_REPLY_TOPIC}" onClick="if(document.quick_reply.message.value == '{L_QUICK_REPLY_TOPIC}' || document.quick_reply.message.value == ''){ alert('{L_EMPTY_MESSAGE}'); return false;}else{ return true;}" /> 
     </form> 
   </td> 
   <td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td> 
  </tr> 
</table>
麻煩您幫我檢查看看了,謝謝^^

發表於 : 2004-05-03 08:00
哇沙米
看到第 28-29 行
原本的程式碼是這樣\r

代碼: 選擇全部

      <td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span style="filter: glow(color={postrow.GLOWING_COLOR},strength=3); height:10px; color:white; padding:1px; font-size : 11px"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}<br />{postrow.CASH}</span><br 
/>{postrow.POSTER_MONEY}<br /></td>
將第 29 行的 {postrow.POSTER_MONEY}<br /> 刪除\r
變成這樣\r

代碼: 選擇全部

<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span style="filter: glow(color={postrow.GLOWING_COLOR},strength=3); height:10px; color:white; padding:1px; font-size : 11px"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}<br />{postrow.CASH}</span><br /></td>
我想這樣子你不想顯示的東西就不會出來了

發表於 : 2004-05-03 11:27
bruno
很謝謝你的幫忙,照你所說的去修改,問題已經解決了 :mrgreen:

發表於 : 2004-05-19 19:18
◎滅◎
問題外掛:Cash Mod 2.2.1
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php ... t=cash+mod
使用版本:phpBB 2.0.8
網站位置:http://hkmatrix2.com/forum/
狀況描述 : 為何你的cash mod可以修改!!我的沒有這功能 但也是2.2.1!!?