[quote=“Tom Elliott, post: 14110, member: 7271”]Another minor issue that I’ve so far noticed is:
Reports, all of the pages will not work and it appears it’s because it has to communicate with the database. This communication is lost because the mysql_query statements within this pages look to be sending to a variable $conn that doesn’t exist for those pages. Also, as it needs to communicate with the database, the base configuration files are not existing either. My best suggestion would be to make a configuration file that stores the references needed within a file called something like base.inc.php that includes the base required files of commons/init.php commons/init.database.php. For the $conn variable, suggest an include statement of the base.inc.php so that the $conn system can be accessed even though it’s not directly defined in the file. So, basically, all main files should have an include BASEPATH . ‘commons/base.inc.php’; statement in them. This would also work for all other file that request this same information.
Found out that Pending MACs.php file the reference to class HostManager works if called like this:
$hostMan = new HostManager(); Rather than
$hostMan = $FOGCore->getClass(‘HostManager’);
Fixed and working on my side.
My base.inc.php file is:
<?php
/* This file just stores the heading information for including *
- In the FOG System. This should minimize code lines. *
- */
if (!defined(‘BASEBATH’))
require_once(‘system.php’);
require_once(BASEPATH . ‘/commons/config.php’);
require_once(BASEPATH . ‘/commons/init.php’);
require_once(BASEPATH . ‘/commons/init.database.php’);
$conn = @mysql_connect( DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD);
?>
and is located in commons.
Then added the line to the files needed. Though I guess in the management/index.php all you should need is the reference :
In the reports *.php files.
include BASEPATH . ‘/commons/base.inc.php’;[/quote]
I was/am able to remove the need of the $conn variable declaration in base.inc.php and reference the global variable for database connections within the reports directory as:
$this->conn
So a simple sed script is really useful to fix this. Also with this, the $hostMan function in Pending MACS.php can now be referenced as: $this->FOGCore->getClass(‘HostManager’);
In the {fogwebdir}/management/*.php files, place near the top:
include ‘…/commons/base.inc.php’;
In the {fogwebdir}/commons/base.inc.php file just have:
base.inc.php
<?php
/* This file just stores the heading information for including *
- In the FOG System. This should minimize code lines. *
-
*/
if (!defined(‘BASEBATH’))
require_once(‘system.php’);
require_once(BASEPATH . ‘/commons/config.php’);
require_once(BASEPATH . ‘/commons/init.php’);
require_once(BASEPATH . ‘/commons/init.database.php’);
?>
Hopefully somebody see’s this all.
Thanks,