2013-07-08, 12:59 AM
Hi,
Last night, I wrote a function that edits global.php in the mybb root. This was successful, but now today I noticed that I need to add some lines to inc/functions.php. So I wrote up the code to do so,
This should represent:
Though when run I run my core edit apply link I am getting an error, so I added the $debugr2 variable and added it to the error flash message I created. All I see in that variable with print_r($debugr2) is "1".
Here is the full edit function code:
http://pastie.org/private/6v7hr3jsdoaogfclhakq
I'm really not sure what's going on. Anyone have any clue? Thanks in advance.
Solved
I didn't realize there were multiple "?>"'s in the file.
Last night, I wrote a function that edits global.php in the mybb root. This was successful, but now today I noticed that I need to add some lines to inc/functions.php. So I wrote up the code to do so,
$result2 = $PL->edit_core("steam_mod", "inc/functions.php", array("search" => "?>", "before" => array("function url_get_contents($url) {","$ch = curl_init();","curl_setopt($ch, CURLOPT_URL, $url);","curl_setopt($ch, CURLOPT_RETURNTRANSFER, $url);","$out = curl_exec($ch);", "curl_close($ch);","return $out;","}")), true, $debugr2);
This should represent:
function url_get_contents($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, $url);
$out = curl_exec($ch);
curl_close($ch);
return $out;
}
Though when run I run my core edit apply link I am getting an error, so I added the $debugr2 variable and added it to the error flash message I created. All I see in that variable with print_r($debugr2) is "1".
Here is the full edit function code:
http://pastie.org/private/6v7hr3jsdoaogfclhakq
I'm really not sure what's going on. Anyone have any clue? Thanks in advance.
Solved
I didn't realize there were multiple "?>"'s in the file.