Endless Paradigm

Full Version: [MyBB] MyPlaza v0.5 (beta version)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
plugin gives stil an error..

PHP Code:
Parse error: parse error, unexpected '=', expecting ')' in /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php on line 364


the line 364 is:

PHP Code:
function bank_update_values($cur_amount = null, &$user = null)

i got that error on version 0.1, so please, redownload and reupload everything to your root.

@Zinga, i edited the file myplaza.php (admin dir) and i edited 4 functions inside of that file.
I added a comment:
// ****************************
// ADDED !!  ********************
// ****************************
above each line that i EDITED/ADDED.

Spoiler for edititem:

PHP Code:
if($mybb->input['action'] == "edititem")
{
	if(!($iid = intval($mybb->input['iid'])))
		cperror($lang->invalid_item);
	
	$query = $db->simple_select(TABLE_PREFIX.'plaza_items', '*', "iid = $iid");
	if(!($item = $db->fetch_array($query)))
		cperror($lang->invalid_item);
	
	
	$itemdetails = array(
		$lang->edit_item_params => array(
			$lang->item_name => array(
				'name' => 'name',
				'value' => $item['name'],
				'type' => 'text'
			),
			/*'idname' => array(
				'name' => 'idname',
				'value' => '',
				'type' => 'text'
			),*/
			$lang->item_category => array(
				'name' => 'cid',
				'value' => $item['cid'],
				'type' => 'category'
			),
			$lang->item_icon => array(
				'name' => 'icon',
				'value' => $item['icon'],
				'type' => 'text'
			),
			$lang->item_format => array(
				'name' => 'format',
				'value' => $item['format'],
				'type' => 'text'
			),
			$lang->item_description => array(
				'name' => 'description',
				'value' => $item['description'],
				'type' => 'textarea'
			),
			// ****************************
			// ADDED !!  ********************
			// ****************************
			$lang->item_download => array(
				'name' => 'download',
				'value' => $item['download'],
				'type' => 'textarea'
			),
			// ****************************
			// ADDED !!  ********************
			// ****************************
			$lang->item_password => array(
				'name' => 'password',
				'value' => $item['password'],
				'type' => 'textarea'
			),
			$lang->item_showonstats => array(
				'name' => 'showonstats',
				'value' => $item['showonstats'],
				'type' => 'yesno'
			),
			$lang->item_disporder => array(
				'name' => 'disporder',
				'value' => $item['disporder'],
				'type' => 'text'
			),
			$lang->item_visible => array(
				'name' => 'visible',
				'value' => $item['visible'],
				'type' => 'yesno'
			),
			/*'includefile' => array(
				'name' => 'includefile',
				'value' => '',
				'type' => 'text'
			),*/
			$lang->item_htmlextra => array(
				'name' => 'htmlextra',
				'value' => $item['htmlextra'],
				'type' => 'textarea'
			),
		),
		
		$lang->edit_item_coststock => array(
			$lang->item_cost => array(
				'name' => 'cost',
				'value' => $item['cost'],
				'type' => 'text'
			),
			$lang->item_infstock => array(
				'name' => 'infstock',
				'value' => $item['infstock'],
				'type' => 'yesno'
			),
			$lang->item_stock => array(
				'name' => 'stock',
				'value' => calcStock($item['stockoffset'], $item['restockamount'], $item['restocktime']),
				'type' => 'text'
			),
			$lang->item_restockamount => array(
				'name' => 'restockamount',
				'value' => $item['restockamount'],
				'type' => 'text'
			),
			$lang->item_restocktime => array(
				'name' => 'restocktime',
				'value' => $item['restocktime'],
				'type' => 'text'
			),
			$lang->item_buylimitamount => array(
				'name' => 'buylimitamount',
				'value' => $item['buylimitamount'],
				'type' => 'text'
			),
			$lang->item_buylimittime => array(
				'name' => 'buylimittime',
				'value' => $item['buylimittime'],
				'type' => 'text'
			),
		),
	);
$plugins->run_hooks("myplaza_admin_edit_item_start");
	
	myplaza_cpheader_inputexpander_js();
	startform("myplaza.php", "", "do_edititem");
	makehiddencode('iid', $iid);
	
	/*eval('
		$item_eval_name = "'.$item['name'].'";
		$item_eval_desc = "'.$item['description'].'";
	');*/
	
	starttable();
	tableheader($lang->edit_item, "", 2);
	
	makehiddencode('referrer', REFERRER);
	print_form($itemdetails);
	
	endtable();
	
	endform($lang->submit_changes, $lang->reset_button);
	$plugins->run_hooks("myplaza_admin_edit_item_code_foot");
	cpfooter();
	exit;
}

Spoiler for do_edititem:

PHP Code:
if($mybb->input['action'] == "do_edititem")
{
	if(!($iid = intval($mybb->input['iid'])))
		cperror($lang->invalid_item);
	
	$query = $db->simple_select(TABLE_PREFIX.'plaza_items', '*', "iid = $iid");
	if(!($item = $db->fetch_array($query)))
		cperror($lang->invalid_item);
	
	if(!($name = $mybb->input['name']))
		cperror($lang->no_name_supplied);
	
	$cid = intval($mybb->input['cid']);
	if(!($db->fetch_array($db->simple_select(TABLE_PREFIX.'plaza_cat', 'cid', "cid = $cid"))))
		$cid = 0;
	
	if($mybb->input['visible'] != 'no')
		$visible = 'yes';
	else
		$visible = 'no';
	
	// calculate stock
	$restockamount = intval($mybb->input['restockamount']);
	$restocktime = intval($mybb->input['restocktime']);
	$stockoffset = calcStockOffset(intval($mybb->input['stock']), $restockamount, $restocktime);
	
	$infstock = (($mybb->input['infstock'] == 'no') ? 'no' : 'yes');
	$showonstats = (($mybb->input['showonstats'] == 'no') ? 'no' : 'yes');
	$update_array = array(
		'name' => $db->escape_string($name),
		'cid' => $cid,
		'icon' => $db->escape_string($mybb->input['icon']),
		'format' => $db->escape_string($mybb->input['format']),
		'description' => $db->escape_string($mybb->input['description']),
		// ****************************
		// ADDED !!  ********************
		// ****************************
		'download' => $db->escape_string($mybb->input['download']),
		// ****************************
		// ADDED !!  ********************
		// ****************************
		'password' => $db->escape_string($mybb->input['password']),
		'showonstats' => $showonstats,
		'visible' => $visible,
		'htmlextra' => $db->escape_string($mybb->input['htmlextra']),
		'cost' => floatval($mybb->input['cost']),
		'infstock' => $infstock,
		'stockoffset' => $stockoffset,
		'restockamount' => $restockamount,
		'restocktime' => $restocktime,
		'buylimitamount' => intval($mybb->input['buylimitamount']),
		'buylimittime' => intval($mybb->input['buylimittime'])
	);
	
	if($d = intval($mybb->input['disporder']))
		$update_array['disporder'] = $d;
	
	$plugins->run_hooks("myplaza_admin_edit_item");
	$db->update_query(TABLE_PREFIX.'plaza_items', $update_array, "iid = $iid");
	
	if($mybb->input['referrer'])
		cpredirect($mybb->input['referrer'], $lang->category_added);
	else
		cpredirect('myplaza.php?'.SID.'&action=categories', $lang->item_updated);
}

Spoiler for do_additem:

PHP Code:
if($mybb->input['action'] == 'additem' && $mybb->input['module'])
{
	// ATTN: Module Developers - please check the $mybb->input['module'] before
	//       placing your own code!
	$itemdetails = array(
		$lang->edit_item_params => array(
			$lang->item_name => array(
				'name' => 'name',
				'value' => '',
				'type' => 'text'
			),
			/*'idname' => array(
				'name' => 'idname',
				'value' => '',
				'type' => 'text'
			),*/
			$lang->item_category => array(
				'name' => 'cid',
				'value' => 0,
				'type' => 'category'
			),
			$lang->item_icon => array(
				'name' => 'icon',
				'value' => 'item.png',
				'type' => 'text'
			),
			$lang->item_format => array(
				'name' => 'format',
				'value' => '<span style=\'\'>{name}</span>',
				'type' => 'text'
			),
			$lang->item_description => array(
				'name' => 'description',
				'value' => '',
				'type' => 'textarea'
			),
			// ****************************
			// ADDED !!  ********************
			// ****************************
			$lang->item_download => array(
				'name' => 'download',
				'value' => '',
				'type' => 'textarea'
			),
			// ****************************
			// ADDED !!  ********************
			// ****************************
			$lang->item_password => array(
				'name' => 'password',
				'value' => '',
				'type' => 'textarea'
			),
			$lang->item_showonstats => array(
				'name' => 'showonstats',
				'value' => 'yes',
				'type' => 'yesno'
			),
			$lang->item_disporder => array(
				'name' => 'disporder',
				'value' => 1,
				'type' => 'text'
			),
			$lang->item_visible => array(
				'name' => 'visible',
				'value' => 'yes',
				'type' => 'yesno'
			),
			/*'includefile' => array(
				'name' => 'includefile',
				'value' => '',
				'type' => 'text'
			),*/
			$lang->item_htmlextra => array(
				'name' => 'htmlextra',
				'value' => '',
				'type' => 'textarea'
			),
		),
		
		$lang->edit_item_coststock => array(
			$lang->item_cost => array(
				'name' => 'cost',
				'value' => 0,
				'type' => 'text'
			),
			$lang->item_infstock => array(
				'name' => 'infstock',
				'value' => 'yes',
				'type' => 'yesno'
			),
			$lang->item_stock => array(
				'name' => 'stock',
				'value' => 0,
				'type' => 'text'
			),
			$lang->item_restockamount => array(
				'name' => 'restockamount',
				'value' => 0,
				'type' => 'text'
			),
			$lang->item_restocktime => array(
				'name' => 'restocktime',
				'value' => 0,
				'type' => 'text'
			),
			$lang->item_buylimitamount => array(
				'name' => 'buylimitamount',
				'value' => 0,
				'type' => 'text'
			),
			$lang->item_buylimittime => array(
				'name' => 'buylimittime',
				'value' => 0,
				'type' => 'text'
			),
		),
	);
	
	$plugins->run_hooks("myplaza_admin_add_item");
	// yes, this is only accessible through modules
	if(isset($tableheader))
	{
		myplaza_cpheader_inputexpander_js();
		startform("myplaza.php", "", "do_additem");
		makehiddencode('module', $mybb->input['module']);
		starttable();
		tableheader($tableheader, '', 2);
		
		makehiddencode('referrer', REFERRER);
		print_form($itemdetails);
		
		endtable();
		endform($lang->submit_changes, $lang->reset_button);
	}
}

Spoiler for additem:

PHP Code:
if($mybb->input['action'] == 'do_additem' && $mybb->input['module'])
{
	// we'll do some escaping/handling, but otherwise
	// let modules handle everything
	if(isset($mybb->input['cid'])) $cid = intval($mybb->input['cid']);
	if($mybb->input['visible'] != 'no')
		$visible = 'yes';
	else
		$visible = 'no';
	// ****************************
	// ADDED !!  ******************** NOT NECESSARY I THINK
	// ****************************
	$download = intval($mybb->input['download']);
	// ****************************
	// ADDED !!  ******************** NOT NECESSARY I THINK
	// ****************************
	$password =intval($mybb->input['password']);
	$restockamount = intval($mybb->input['restockamount']);
	$restocktime = intval($mybb->input['restocktime']);
	$stockoffset = calcStockOffset(intval($mybb->input['stock']), $restockamount, $restocktime);
	
	$infstock = (($mybb->input['infstock'] == 'no') ? 'no' : 'yes');
	$showonstats = (($mybb->input['showonstats'] == 'no') ? 'no' : 'yes');
	
	$plugins->run_hooks("myplaza_admin_do_add_item");
}

that's what i edited in that file.

now, in inventory.php i edited this query: (line 770)
Spoiler:

PHP Code:
// get item info
$query = $db->simple_select(TABLE_PREFIX.'plaza_items i INNER JOIN '.TABLE_PREFIX.'plaza_inventory_items v ON i.iid=v.iid', 'i.iid,i.name,i.format,i.description,i.disporder,i.icon,i.cost,v.image,v.sellable', 'v.iid IN ('.implode(',',array_keys($useritems)).')', array('order_by' => 'i.disporder', 'order_dir' => 'ASC', 'limit_start' => ($page-1)*$perpage, 'limit' => $perpage));


to:

PHP Code:
// get item info
$query = $db->simple_select(TABLE_PREFIX.'plaza_items i INNER JOIN '.TABLE_PREFIX.'plaza_inventory_items v ON i.iid=v.iid', 'i.iid,i.name,i.format,i.description,
// ****************************
// ADDED !!  ********************
// ****************************
i.download,
// ****************************
// ADDED !!  ********************
// ****************************
i.password,i.disporder,i.icon,i.cost,v.image,v.sellable', 'v.iid IN ('.implode(',',array_keys($useritems)).')', array('order_by' => 'i.disporder', 'order_dir' => 'ASC', 'limit_start' => ($page-1)*$perpage, 'limit' => $perpage));

and in inventory_do_add_item() i edited this:
Spoiler:

PHP Code:
$item_array = array(
		'name' => $db->escape_string($name),
		'cid' => $cid,
		'icon' => $db->escape_string($mybb->input['icon']),
		'format' => $db->escape_string($mybb->input['format']),
		'description' => $db->escape_string($mybb->input['description']),
		'showonstats' => $showonstats,
		'visible' => $visible,
		'cost' => floatval($mybb->input['cost']),
		'infstock' => $infstock,
		'stockoffset' => $stockoffset,
		'restockamount' => $restockamount,
		'restocktime' => $restocktime,
		'buylimitamount' => intval($mybb->input['buylimitamount']),
		'buylimittime' => intval($mybb->input['buylimittime']),
		'disporder' => intval($mybb->input['disporder']),
		
		'includefile' => 'inventory',
		'idname' => 'inventory_item',
		'htmlextra' => ''
		//'htmlextra' => $db->escape_string('{$lang->qty}: <input type="text" name="qty" value="1" />')
	);


to:

PHP Code:
	$item_array = array(
		'name' => $db->escape_string($name),
		'cid' => $cid,
		'icon' => $db->escape_string($mybb->input['icon']),
		'format' => $db->escape_string($mybb->input['format']),
		'description' => $db->escape_string($mybb->input['description']),
		// ****************************
		// ADDED !!  ********************
		// ****************************
		'download' => $db->escape_string($mybb->input['download']),
		// ****************************
		// ADDED !!  ********************
		// ****************************
		'password' => $db->escape_string($mybb->input['password']),
		'showonstats' => $showonstats,
		'visible' => $visible,
		'cost' => floatval($mybb->input['cost']),
		'infstock' => $infstock,
		'stockoffset' => $stockoffset,
		'restockamount' => $restockamount,
		'restocktime' => $restocktime,
		'buylimitamount' => intval($mybb->input['buylimitamount']),
		'buylimittime' => intval($mybb->input['buylimittime']),
		'disporder' => intval($mybb->input['disporder']),
		
		'includefile' => 'inventory',
		'idname' => 'inventory_item',
		'htmlextra' => ''
		//'htmlextra' => $db->escape_string('{$lang->qty}: <input type="text" name="qty" value="1" />')
	);

EDIT !! WORKING !! (i tested it again and i think what it got to work is this:
	
// ****************************
	
// ADDED !!  ******************** NOT NECESSARY I THINK
	
// ****************************
	
$download = intval($mybb»input['download']);
	
// ****************************
	
// ADDED !!  ******************** NOT NECESSARY I THINK
	
// ****************************
	
$password =intval($mybb»input['password']);
dared Wrote:plugin gives stil an error..

PHP Code:
Parse error: parse error, unexpected '=', expecting ')' in /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php on line 364


the line 364 is:

PHP Code:
function bank_update_values($cur_amount = null, &$user = null)

I still don't get why PHP would do that...  try replacing "&$user = null" with "&$user".

@Pirata Nervo - what issue are you having then?  You need a module to hook into the correct place for the add-item part to work.
Woah, this is weird!
thanks buddy its activated...  where is settings lan file? i can't found it. and some errors again
on plugin activation screen it gives this..

PHP Code:
Warning: myplaza_activate_plugin(): Unable to access /var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/class_myplaza_am in /var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/myplaza_functions.php on line 461

Warning: myplaza_activate_plugin(/var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/class_myplaza_am): failed to open stream: No such file or directory in /var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/myplaza_functions.php on line 461

Warning: myplaza_activate_plugin(): Failed opening '/var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/class_myplaza_am' for inclusion (include_path='.:/usr/share/pear') in /var/www/vhosts/forumsuzca.com/httpdocs/inc/myplaza/myplaza_functions.php on line 461


and on boardname.com/plaza.php screen:

PHP Code:
Warning: Missing argument 2 for bank_update_values() in /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php:364) in /var/www/vhosts/forumsuzca.com/httpdocs/inc/functions.php on line 78

gives that error?

DARED ! download the latest version !!! you downloaded the first one, get the latest one, that's why you are getting so many errors, that one was fixed on the last version, at least i told zinga to fix..

@Zinga, oh my post wasn't edited when i edited it :s, well, i got it to work, everything is fine. I also changed the returned message and i changed the inventory_item template (or soemthign like that) to display the rar pass and the download links in your inventory, can i redistribute my modification to rockhead? (he is from my forum and he owns a forum too)
oh i see :$ sorry about it :D i downloaded it from community.. i will try from here than.. thanks again..

but its still gives some errors on plaza.php page..

PHP Code:
Warning: Missing argument 2 for bank_update_values() in /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php:364) in /var/www/vhosts/forumsuzca.com/httpdocs/inc/functions.php on line 78

well, did you do what zigna said?
ZiNgA BuRgA Wrote:I still don't get why PHP would do that...  try replacing "&$user = null" with "&$user".

plugin was not activated, yes i did this and than it works now... but it gives this error on domainname.com/plaza.php

Code:
Warning: Missing argument 2 for bank_update_values() in /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/forumsuzca.com/httpdocs/inc/plugins/myplaza/bank.php:364) in /var/www/vhosts/forumsuzca.com/httpdocs/inc/functions.php on line 78 

Try replacing the problematic line with this:

PHP Code:
function bank_update_values($cur_amount, &$user = null)


Dunno if that helps.  What version of PHP are you running?

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
Reference URL's