View Single Post
Old 26th December 2005, 11:43
danf.1979 danf.1979 is offline
Senior Member
Join Date: Dec 2005
Location: Chile
Posts: 247
Thanks: 4
Thanked 3 Times in 2 Posts
Send a message via MSN to danf.1979

Uhm, I was looking at write.conf. I think it's structure does what I want. I found a code that teached me I had to put my function inside the class isp_web() and then make a new instance of the class in tools/test2/install.php and then call my function as a method of that class (am I right?).

Now my make_install_phpnuke() function is inside class isp_web()
class isp_web

var $FILE = "/root/ispconfig/scripts/lib/config.lib.php";
var $directory_mode = "0755";
var $web_doctype_id = 1013;
var $user_doctype_id = 1014;
var $domain_doctype_id = 1015;
var $dns_doctype_id = 1016;
var $a_record_doctype_id = 1018;
var $cname_record_doctype_id = 1019;
var $mx_record_doctype_id = 1020;
var $dienste_doctype_id = 1023;
var $monitor_doctype_id = 1024;
var $firewall_doctype_id = 1025;
var $slave_doctype_id = 1028;
var $datenbank_doctype_id = 1029;
var $spf_record_doctype_id = 1031;
var $vhost_conf;
var $ftp_conf;
var $apache_user;

function make_install_phpnuke($web_id, $username, $path_to_create) {
	$web_id = intval($web_id);	
	print_r(" $web_id ");
	exec("mkdir $path_to_create");
	system("cp -R /var/www/installers/php-nuke/html/* $path_to_create");
	print_r("chown -R $username:web$web_id $path_to_create");
	system("chown -R $username:web$web_id $path_to_create");

	// chown($path_to_create, $username);
	// chgrp ($path_to_create, $web_id);


function isp_web() {
  global $mod;
My install.php has (only important code to my problem is seen)
foreach($webs as $web_id => $val) {

	$query = "SELECT * from isp_nodes, sys_user where isp_nodes.doc_id = '$web_id' and isp_nodes.doctype_id = 1013 and sys_user.doc_id = isp_nodes.userid";
        $get_web = $go_api->db->queryOneRecord($query);
	$username = $get_web["username"];
	print_r(" $username ");

	$path_to_create = $httpd_root ."/web".$web_id."/web/".$install_path;
	print_r(" $path_to_create ");

	// NEW, call instance an method of the class (my function)
        $isp_web = new isp_web;
	$isp_web->make_install_phpnuke($web_id, $username, $path_to_create);
        // END NEW

//	if ($val==1) make_install_phpnuke($web_id, $username, $path_to_create);        

But I execute a test a I get this:
Fatal error: Call to a member function find_includes() on a non-object in /root/ispconfig/scripts/lib/config.lib.php on line 1772
This is line 1772 (last one):
function apache_user(){
  global $mod;
  $httpd_conf = $mod->system->server_conf["dist_httpd_conf"];
  $includes = $mod->file->find_includes($httpd_conf);
Why? How do I fix this? I think this is the solution, but dont know why this error occurs...
Thanks, and sorry for the several post, but I make progress from post to post, so new problems arise, and some get fixed.

Last edited by danf.1979; 26th December 2005 at 12:01.
Reply With Quote