https://www.icyphoenix.com/viewtopic.php?f=2&t=9639
-----------------------------------
MWE_001
Fri 26 Aug, 2016 06:38

Another Minor Activity Mod SQL Error Just Found
-----------------------------------
Submitting a rating for a game and it has rewards turned on for rating. Meaning in the ACP I turned it on to give points for game ratings. When submitting I get this:

Failed to add rewards

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= + 5 WHERE user_id = 2' at line 2

UPDATE ip_users SET = + 5 WHERE user_id = 2

Line : 37
File : rewards_api.php

Offending code

[code linenumbers=false]
// give rewards to the user
function add_reward($user_id,$amount)
{
	global $userdata, $db;
	$dbfield = get_db_reward();
	if ( $userdata['user_id'] == $user_id )
	{
		$userdata[$dbfield] += $amount;
	}
	$sql = "UPDATE " . USERS_TABLE . "
		SET $dbfield = $dbfield + $amount
		WHERE user_id = $user_id";
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Failed to add rewards", "", __LINE__, __FILE__, $sql);
	}
}
[/code]




BUT ...... I went back to activity.php and looked at the game I tried to give a rate to and it failed in sql error, it was in fact rated.

If I got to ACP/ Activity/Games/Extra Settings and turn off the Give Points To Users For Submitting Game Ratings? submit and then go clear cache, I go back to activity.php and try to rate a game and
it gives me this: Thank you for submitting a rating. 

And upon further review, the game is rated.


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

Separate Error and hopefully the last one I find.

When clicking search for a game, I get this:

[Icy Phoenix Debug] PHP Notice: in file /plugins/activity/activity_search.php on line 51: include(./includes/rewards_api.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /plugins/activity/activity_search.php on line 51: include(./includes/rewards_api.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /plugins/activity/activity_search.php on line 51: include(): Failed opening './includes/rewards_api.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/php55/lib/php')

There is a rewards_api.php in the plugins/activity/includes folder, but not in the IP root/includes folder.

This makes it work [code linenumbers=false]include( IP_ROOT_PATH . ACTIVITY_PLUGIN_PATH . 'includes/rewards_api.' . PHP_EXT);[/code] I know this path can't be correct, but it works.  :oops:

I tried this [code linenumbers=false]include( ACTIVITY_PLUGIN_PATH . 'includes/rewards_api.' . PHP_EXT);[/code], but it didnt work. The search page came up but no search options at all were available.


-----------------------------------
Informpro
Fri 26 Aug, 2016 10:39

Re: Another Minor Activity Mod SQL Error Just Found
-----------------------------------
First one: It's because the config field default_reward_dbfield is not set. It seems you misconfigured activity, and that you should tell it to use the cash mod (admittedly, it should have a sensible default configuration). [url=https://github.com/MightyGorgon/icy_phoenix_plugins/blob/541c97a4a946cdae00a02a67502cceda8eba4e27/activity/ip_root/plugins/activity/adm/admin_ina_in_un.php#L503]The field should not be empty by default.... I'm not sure right now if you change it via the ACP, I'll take a look this weekend. If you can't, you may manually edit the ip_config table by changing default_reward_dbfield and default_cash to the column you created via cash_mod.

-----

Second one: Thanks. It might just be that ACTIVITY_PLUGIN_PATH itself is missing the IP_ROOT_PATH!


-----------------------------------
MWE_001
Fri 26 Aug, 2016 18:39

Re: Another Minor Activity Mod SQL Error Just Found
-----------------------------------
When I setup activity, I 100% for sure make sure which points or cash I am using and choose accordingly.  

 [img]http://www.icyphoenix.com/files/images/11665/activity_config.jpg[/img] 

Over the years and I;m talking pretty much since Austin released AMOD + I been busting people out on that setting. I can very easily see how people could misconfigure it, but not this time I can assure you. And I'm glad to see we are on the same wave length as far as thinking goes  :mrviolet:  That is the very first thing I went and checked.


**EDIT**

Ok man I need to quit while I am ahead. 

I went back and tried it again today (rate a game) after taking that screen shot and instead of the sql error, I got this:

Notice: in file /activity_popup.php on line 77: include(./includes/rewards_api.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /activity_popup.php on line 77: include(./includes/rewards_api.php): failed to open stream: No such file or directory
[Icy Phoenix Debug] PHP Notice: in file /activity_popup.php on line 77: include(): Failed opening './includes/rewards_api.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/php55/lib/php')

Another broken link to rewards_api. I fixed the link and the rate and rewards works. So scrub the sql error I guess. FLuke of nature not sure why it happened. I can not recreate as per the way my ACP / plugins is configured.


-----------------------------------
Mighty Gorgon
Sun 28 Aug, 2016 12:21

Re: Another Minor Activity Mod SQL Error Just Found
-----------------------------------
Correct fix should be:
[codeblock]include_once(ACTIVITY_ROOT_PATH . 'includes/rewards_api.' . PHP_EXT);[/codeblock]


-----------------------------------
MWE_001
Sun 28 Aug, 2016 22:23

Re: Another Minor Activity Mod SQL Error Just Found
-----------------------------------
[quote user="Mighty Gorgon" post="60841"]Correct fix should be:
[codeblock]include_once(ACTIVITY_ROOT_PATH . 'includes/rewards_api.' . PHP_EXT);[/codeblock][/quote]

Thanks!

*EDIT*

This fix also needs done to line 67 of activity_favs.php as it leads to a php error as is.

If you click add game to favorites after this fix, it will go to a all white page instead of the php error. Nothing but all white page.

I fixed Activity issue #17 at Git [Activity] activity.php>"Games" section says "vote cast" #17

Fix is easy.

OPEN [b]activity.php[/b]
FIND
[codeblock]$rating_votes_cast = str_replace('%V%', $total_votes_given, $lang['game_rating_votes_one']);[/codeblock]
REPLACE WITH
[codeblock]$rating_votes_cast = str_replace('%V%', $lang['no_votes_cast'], $lang['game_rating_votes']);[/codeblock]

That will solve cast vote issue. Now it will say No votes cast.

Also, when clicking the copyright, I get a message that says hacking attempt which is open as a issue at Git as well.

I did this

OPEN [b]functions_amod_plusC.php[/b]
FIND
[codeblock]if (!defined('IN_ICYPHOENIX'))
{
	die('Hacking Attempt');
}[/codeblock]
REPLACE WITH
[codeblock](nothing, needs removed)[/codeblock]

[size=14][color=red]PLEASE anyone do not remove this code without speaking to Luca first! I am NOT sure how secure or unsecure that is. It makes the page work, but at what cost? As usual as I say, Luca has the final say, NOT me. Take care! [/color] [/size]


If you delete that code that hacking attempt will go away and the copyright page will work. BUT since Amod + site is long gone, all the images are missing which is ok I guess. It is better than getting a hacking attempt message.  :mrorange:

I got the arrow images fixed in the copyright page as well as link to the games download and I put up a quick sorry we are offline page for demo board. Personally, I think it would be better off to remove the demo board link all together. I think for my copy of activity, I will be removing the link to the demo board as phpbb-amod is gone forever and never is coming back. This would be much simpler than including a html or php page saying sorry or what ever. 

 [img]http://www.icyphoenix.com/files/images/11665/screenshot_14.jpg[/img] 

Here is one more and I swear I am done for the night as far as activity plugin goes. I would like to be able to add issues to Git and suggest fixes but not sure if I can or how git works?

But anyhow, 

If I go to ACP Activity/Games Edit games on the next page that opens, click Edit. Then you get this:

 [img]http://www.icyphoenix.com/files/images/11665/screenshot_12.jpg[/img] 

Notice missing images? To fix do the following.

OPEN [b]admin_activity.php[/b]
FIND LINE 384 
[codeblock]$game_image = '<img src="'. IP_ROOT_PATH .[/codeblock]
REPLACE WITH
[codeblock]$game_image = '<img src="'. ACTIVITY_ROOT_PATH .[/codeblock]

Save and close. Give s you this now

 [img]http://www.icyphoenix.com/files/images/11665/screenshot_13.jpg[/img] 

Enjoy!


-----------------------------------
MWE_001
Tue 30 Aug, 2016 18:12

Re: Another Minor Activity Mod SQL Error Just Found
-----------------------------------
This is part of the error,[color=red] include(./includes/rewards_api.php): failed to open stream: No such file or directory[/color],  that I reported above for a couple files. Turns out this is happening with many files and I have fixed many of them. I will grab a complete list of the files this fix needs done in when I get home here in an hour or two. So far it is up to like 6 or 7 files.


