Τρίτη 29 Ιανουαρίου 2013

Joomla - Missing Menus in front-end and back-end

Is'n it obvious? It's a bug or a code written the wrong way. It's a Joomla after-all...

OK, Joomla is crap I know but, we and you, use it a lot and you may have come to this unfortunate, yet easy to solve, problem that all your menus in the frond-end and/or back-end are missing after you transferred the site to another server.

There are numerous forums and a few thousand chimps out there that will tell ya:
"Oh really? Then your site is screwed! So, just backup everything and either install a new Joomla and input everything from the beginning or try again and again... Or change permissions maybe? Wait, there is more...."

LOL, these guys never give up!!!

Now, we all know as engineers that there is always our way or the high way...and we like OUR way! ;-)

So, the whole "trick" is only inside two files. The only thing you need to do is to add an ampersand (&) in front of two variables and everything will work as they should be!
See below for the files and the lines where you need to add the ampersand in front of the variables.


Back-end
Directory: libraries/joomla/html/
File: html.php
Line: 87
Code: return call_user_func_array(array($className, $func), &$args);


Front-end
Directory: modules/mod_mainmenu/
File: helper.php
Line: 72
Code: function &getXML($type, $params, $decorator);

or

Directory: libraries/joomla/cache/handler/
File: callback.php
Line: 99
Code: $result = call_user_func_array($callback, $args);

The bug is this. The variables "$arg" and "$params" or "$args" are passed by value to the functions as parameters. But, they have to pass by reference. This happens because when a new class object is being registered in the Joomla code, which was previously created or accessed by reference, it returns a null if requested by value.
So, the solution is to write this: "&$arg", this: "&$params" and this: "&$args".


Enjoy Reversing and continue giving total solutions where others hit walls. Happy Hacking!

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου