PHP-Nuke and other installers

Discussion in 'Developers' Forum' started by danf.1979, Dec 23, 2005.

  1. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

  2. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    heh, :D
    Great. Thanks.
     
  3. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Does anyone have documentation or a tutorial on how to search for a given line in a file and replace it with other thing? I dont want to write an entire file to just change 3 variables...
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    If you want to perform the translations in PHP, i would open the file with fopen, read it line by line and make the replacements.

    If you want to do it in a shell script or within an exec function from PHP, you can try "sed". Run "man sed" for the options on the shell. Sorry, i have no tutorial for sed, maybe you can find one with google :)
     
  5. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Hi till, did you miss me? I did.
    Well, good news... I'm almost done. BUT, I have a problem :D :
    When instalation is over a message is shown to the user:
    Code:
    # Final message
    $message = "You have now installed your wiki, but things are not over! Go with your internet browser to <a target='blank' href='$final_url'>HERE</a> and follow directions. ";
    $go_api->msg($go_api->lng($message),$go_api->lng("Instalation Status"));
    
    The problem is that the URL is something like:
    https://www.mundohosting.cl:81/tools/tools/installers/www.domain.cl/installed_dir
    and should be:
    http://www.domain.cl/installed_dir
    $final_url is http://www.domain.cl/installed_dir so I dont know what is happening... :confused:
     
  6. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Argh, my mistake. I had to put http://$final_url, simple as that.
     
  7. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    oh, but... uhm I have another question.
    How can I test if the password that the user puts in the form is the correct password for a given mysql db?
     
  8. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    You can try to do a select on the mysql user / database table like this:

    $sql = "SELECT `User` FROM `mysql`.`user` WHERE `User` = '$myuser' AND `Password` = password('$mypassword')";

    If the query returns the username, username and password are valid.
     
  9. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Hi again.
    I have been coding a lot lately, and I'm rewriting all the installers into one big administrative interface. I'm doing Ok, but now I have a big problem.
    I ask the user for the admin username and password, for example, and then I want to write those values to the *user* database, in some any table (it depends on the cms). I cannot find anything that would let me change to the user database in the mysql class.
    My idea was something like this, but I doesnt work ofcourse:
    Code:
    $go_api->db->query("use $db_database");
    $go_api->db->query("UPDATE pn_users SET pn_uname='test_user' WHERE pn_uid='2'");
    
    And I was looking to the "query" method, and it doesnt let me change to another database...
    Any help?
    thanks again.
     
  10. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    This worked from the command line:
    Code:
    mysql -h localhost -u webX_u1 -pmypass webX_db1 --execute="UPDATE pn_users SET pn_uname = 'test' WHERE pn_uid = '2'"
    
     
  11. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    You can have a look at the code in /root/ispconfig/scripts/lib/config.lib.php where new MySQL databases are created. Something like this should work:

    PHP:
    $link mysql_connect($db_server$db_user$db_password)
        or die(
    "Could not connect");
    mysql_select_db("<db_name>")
        or die(
    "Could not select database");

    $result mysql_query("UPDATE pn_users SET pn_uname = 'test' WHERE pn_uid = '2'");
     
  12. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer


    You dont have to change the database at all. ISPConfig is logged in with a mySQL user who can access all databases. Simply prepend the database name before the table name with a dot. Example:

    Code:
    $go_api->db->query("UPDATE ".$database.".pn_users SET pn_uname='test_user' WHERE pn_uid='2'");
     
  13. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Ok, I think its time to an update on my work.
    I'm doing Ok. I have developed a program called CMS Manager. It runs from its own menu in the tools section, though I would like to move it to the "ISP Manager" section.
    Till now I have installers for:
    <b>Portals:</b>
    Etomite: http://www.etomite.org/
    Joomla!: http://www.joomla.org/
    PHP-Nuke: http://www.phpnuke.org/
    PostNuke: http://www.postnuke.org/
    WebsiteBaker: http://www.websitebaker.org/2/home/

    WebsiteBaker and Etomite are great, just very simple for anyone to use with little effort.

    <b>Forums</b>
    phpBB
    -------------------------------

    I'm working on MediaWiki now.

    I rewrote all my previous installers into this big cms manager (its not that big though), but from here you can now install all this programs with only some clicks and providing some required info. I dont need any more the default installers that came with the cms's tar.gz. All is done from ispconfig.

    Here you have some screenshots from the Main Window (Spanish). I will rewrite it though with a different template.
    [​IMG]
    Step1, were you choose the website were to install the cms
    [​IMG]
    Step2, were you enter basic info like the database name, password and directory were to install
    [​IMG]

    Note that every window has explanations (in spanish till now), but its very easy to go through this steps and install any software.

    Some of my problems:
    - When I show the user the cms_done.htm template maybe the install process has not even started yet. So the client could press the final url link that I provide and get a 404. It's a matter of time anyway. The cms does get installed.
    - Till now the user has to *remember* how his database is called. I would like to do a dropdown menu for him to choose.

    Ideas:
    - I want to integrate this a lot more with ispconfig. Maybe 1 CMS per MySQL its OK? I think so. Maybe 2, I dont know.
     
    Last edited: Jan 18, 2006
  14. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    This looks really great! :)

    I think there is no real solution for this problem. the best way might be to provide some info text that it may take some minutes until the CMS is installed and the link to the CMS is valid.

    This might be better, i guess many users wont remeber what they have done 10 seconds before ;)

    Better onyl one CMS per MySQL, otherwise you will get sooner or later conflicting table names. Maybe we should add limit the number of installable CMS in the Reseller limits an website settings?
     
  15. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    We could add a 1 or 0 for the capabilities to install cms in the isp_isp_web_template. And from there on, 1 cms per MySQL. Maybe we should have an option too to override the 1-1 limitation too, for example if I wanted to install more than one cms (or any other ispconfig admin) for my own site (1 forum, 1 portal, 1 chat for example).
    I'm going to start coding some uninstalling methods now. Do I just warn the user and erase all stuff?
     
  16. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    Uhm, I think it would be unjustified to limit the reseller to only #X cms to offer. Just limit all users to 1-1 and thats all, what do you think?
    I was thinking alsa about the user passwords... You said about having clear passwords to be unsecure, and I agree with that, but anyway, you have the root password in clear text. Then why dont we store the users password encoded with base_64? And in that case, clients can forget about remembering passwords.
    They choose the database in the dropbox, and thats all. What about that?
     
    Last edited: Jan 20, 2006
  17. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    I'm not quite sure, but I can imagine that sooner or later someone will request that feature. I'm not sure though if it's enough to say "this reseller is allowed to install CMS' in his web sites, and that one isn't" instead of specifiying a number...


    Where do we have the root password in clear text?
     
  18. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    It will be better if the limit can be entered as a number of cms per website.

    The password of the root user is not used in ISPConfig at all. Maybe you mean another password that is identical with the root password in your installation.

    No, for security reasons we shall not store passwords in the database.
     
  19. danf.1979

    danf.1979 ISPConfig Developer ISPConfig Developer

    field server_db_passwort has the root password for the mysql root user. I see it in clear text.
     
  20. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Hmm, Ive not programmed anything waht puts the cleartext password in the DB. I will check where it is used and how we can remove it.
     

Share This Page