Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 24th December 2005, 00:33
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
Default PHP-Nuke and other installers

I'm developing a PHP-nuke installer in the "Tools" section. I think most installers would be very similar.
If I have a client that owns more than one web, I need a way to "know" in which site he wants to install php-nuke. From what variable can I get this info?
Also I need the user and pass to write in the database. How can I get this values? What scripts should I read?
Thanks
Reply With Quote
Sponsored Links
  #2  
Old 24th December 2005, 04:54
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
Default

What I really need right now is to save the username of the user who executes the tool in $username. How can I accomplish this?
Reply With Quote
  #3  
Old 24th December 2005, 12:10
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,037
Thanks: 841
Thanked 5,659 Times in 4,466 Posts
Default

Quote:
Originally Posted by danf.1979
I'm developing a PHP-nuke installer in the "Tools" section. I think most installers would be very similar.
If I have a client that owns more than one web, I need a way to "know" in which site he wants to install php-nuke. From what variable can I get this info?
I dont that it will work this way, because if you know the username you cannot know in which website phpnuke should be installed. Every user can have an unlimited number of websites in ISPConfig.

You will have to let the user select in which website phpnuke shall be installed. Have a look at the backup tool, this tool shows a list of all sites the user is allowd to backup and the list to delect the phpnuke destination may be similar. Dont forget that you have also an admin and resellers and they might have to install packages for their clients too, but how to get the available sites for a user / admin / reseller this is all handled in the code for the site backups and you can copy it from there.

Quote:
Also I need the user and pass to write in the database. How can I get this values? What scripts should I read?
No, dont write your own database functions. ISPCOnfig uses an database wrapper, if you use native mysql functions your extension might be incompatible to future ISPConfig releases. The database wrapper is in the class /home/admispconfig/ispconfig/lib/classes/ispconfig_mysql.lib.php (or similar name in this directory, dont have the sources here currently).

The database wrapper is already initialized if you have included the two main includes as shown in the other tools. You can call the query function e.g. by: $go_api->db->query("Here comes your SQL");

I recommend having a look at the other tools, they show you how to use the db wrapper for querys and inserts.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.

Last edited by till; 24th December 2005 at 12:13.
Reply With Quote
  #4  
Old 24th December 2005, 12:12
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,037
Thanks: 841
Thanked 5,659 Times in 4,466 Posts
Default

Quote:
Originally Posted by danf.1979
What I really need right now is to save the username of the user who executes the tool in $username. How can I accomplish this?
You can get the username from the $go_info array. Just insert print_r($go_info); in your code and you get a list of all variables available in the session.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 24th December 2005, 19:23
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
Default

OK, I love you. I'm making progress, and getting more used to the api.
Reply With Quote
  #6  
Old 25th December 2005, 01:31
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
Default

I'm having problems creating the folders with the right permissions. The owner and group is admispconfig, I need it to be user:web[id].
This doesnt seem to work:
Code:
exec("chown $username:web1 $php_nuke_path");
Dont know why. From a console it works OK, but from the php script dont. Does this have something to do with a php feature? (i.e. security?)
How can I get to create the folder with the right permissions? I dont seem able to find the piece of code that generates de /var/www/web[ID] folder when creating a new customer. I think this code could help me. Not sure though.
I'm creating the phpnuke install folder with:
Code:
exec("mkdir $php_nuke_path");
Is this aproach the correct one?
Maybe thereis another way with the ispconfig api. Dont know for sure. I'm just starting to get used to the api.
Reply With Quote
  #7  
Old 25th December 2005, 02:02
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
Default

Ok, progress, but still no gold.
I'm using now:
Code:
chown($php_nuke_path, $username);
But, i get this:
Code:
Warning: chown() [function.chown]: Operation not permitted in /home/admispconfig/ispconfig/web/tools/tools/test/install.php on line 66
Command was:
Code:
chown user:web1 /var/www/web1/web/bbb
Change "user" with my real user (it exists).
When I created the web directory "bbb" with mkdir, the owner and group was admispconfig. I dont seem capable o changing that, at least no from a php script.
May be I could do so with a Python script.

Last edited by danf.1979; 25th December 2005 at 02:06.
Reply With Quote
  #8  
Old 25th December 2005, 02:42
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
Default

Ok, I had posted something in here, but I'll just wait for help on the last matter because I' learned already about the "->" thingy.

Last edited by danf.1979; 25th December 2005 at 10:16.
Reply With Quote
  #9  
Old 25th December 2005, 14:42
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts
Default

Quote:
Originally Posted by danf.1979
How can I get to create the folder with the right permissions? I dont seem able to find the piece of code that generates de /var/www/web[ID] folder when creating a new customer. I think this code could help me. Not sure though.
This code is in /root/ispconfig/scripts/lib/config.lib.php. This script is run as root so you shouldn't have permission problems if you put your code in there.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #10  
Old 25th December 2005, 23:17
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
 
Default

Ok, so i put my function in /root/ispconfig/scripts/lib/config.lib.php, inside class isp_web right? but then how do I call the function from my tool?
Thank you.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:17.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.