Remoting : Adding a site (ISPConfig + TheHostingTool Integration)

Discussion in 'Developers' Forum' started by jmontoya, Jun 14, 2010.

  1. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    It works well, but I move the datarecord and id before the plugin is loaded SVN:1919

    Did you have a web access to the svn? Only for see/check the code?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The change you made to move the code that raises the event into the if($app->remoting_lib->formDef["db_history"] == 'yes') { part is not correct in my opinion as the event raising does not depend on the fact is history is enabled or not. Events have to be raised independantly of the history setting of the form. It should be moved outside of the if statement again. Othewise the plugins will not work correctly for forms weher dbhistory is not enabled.

    The other changes moving the

    $this->id = $insert_id;
    $this->dataRecord = $params;

    lines are ok.

    No. I use a GUI based svn client.
     
  3. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    I just change the order of:

    $this->id = $insert_id;
    $this->dataRecord = $params;

    i dont know which line are you talking about:

    The change you made to move the code that raises the event into the if($app->remoting_lib->formDef["db_history"] == 'yes') { part is not correct in my opinion as the event raising does not depend on the fact is history is enabled or not. Events have to be raised independantly of the history setting of the form. It should be moved outside of the if statement again. Othewise the plugins will not work correctly for forms weher dbhistory is not enabled.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, youre right. I've just seen that these were just formatting changes.
     
    Last edited: Aug 3, 2010
  5. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    I sent the plugin here SVN commit 1922
     
  6. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Looks ok. I'am not sure if we should use separate functions for *_active and *_inactive, instead we might use a *_status or *_set_status function with active or inactive as parameter? What do you think?
     
  8. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    yes I'm ok with the *_set_status('active') and *_set_status('inactive')
    I will send this to the SVN.
     
  9. holykim

    holykim Member

    Hi Till

    Which file needs to be updated to resolve this issue?

    I have updated remoting.inc.php which I got from svn today but sites_web_domain_add function seems not working properly. Do I need to update another files?

    Another issue is when I remotely updated a client using client_update function in remoting.inc.php, this updated username and password for both client and Admin. (Administrator's username and password are replaced with a client's username and password)

    I found that the below line1 changed to line2.

    line1 (3.0.2.2):
    $affected_rows = $this->updateQuery('../client/form/client.tform.php', $reseller_id, $client_id, $params);

    line2 (svn):
    $affected_rows = $this->updateQuery('../client/form/client.tform.php', $client_id, $reseller_id, $params);

    Just swapped client_id and reseller_id. Why? I had no errors with the above line1.


    Thanks in advance.

    Harry
     
    Last edited: Aug 14, 2010
  10. ispcomm

    ispcomm Member

    I wonder if there's any update on this integration ?

    Any help needed in coding?

    ispcomm
     
  11. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

  12. ispcomm

    ispcomm Member

    I'm cloning the mercurial rep right now. Will post my findings.

    ispcomm
     
  13. ispcomm

    ispcomm Member

    hi,

    there are problems with the installation process (tht 1.2.2 works fine on the same server).

    Redirection from "/" to "/install/index.php" actually redirects to /var/www/bnpanel/install/index.php (as you guess... no go).


    This is actually a bug in THT (altough 1.2.2 installs after I did the following tweak to install/index.php):
    Code:
    //if($prepend . $compare[1] !== $_SERVER["PHP_SELF"]) {
    //      die("You can only run the install from the <em>".__FILE__."</em> file.");
    //}
    
    Adding a
    Code:
    echo "Installing from $_SERVER[PHP_SELF]";
    leads to this result:
    Installing from /bnpanel/install/index.php

    install.php stops at

    echo $style->get("header.tpl");

    So I guess I have path problems :(
     
    Last edited: Aug 23, 2010
  14. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    Hello Thanks for reporting!

    I will fix that one. I changed some of the process while loading css and javascript, I did not test it yet with a fresh installation.


     
  15. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    Well I fix that problem it should work now ...
     
  16. ispcomm

    ispcomm Member

    thank you for the quick fix. Installation went trough correctly.

    There's a residual bug after install: The default setting for the "url" values is retained after installation (defaults to bnpanel.com). A login right after installation causes images and css to be loaded from bnpanel.com.

    Logout-relogin fixes that.

    I'll do some tests with a test ispconfig server and will report back.

    I can concentrate on fixing the customer info (vat/company name) after that, as tht/bnpanel will need that handling for being usefull in Europe (toghether with the european mode of taxation).

    Ouch: I see now you're based in France. I guess you'll need that too.

    ispcomm
     
  17. holykim

    holykim Member

    Now this works. Thanks jmontoya.

    My current ISPConfig is 3.0.2.2.

    I replaced /usr/local/ispconfig/interface/classes/remoting.inc.php with the new remoting.inc.php from SVN. I found two functions need to be modified as below.

    1. I temporary removed chekPerm from the function 'server_get' as my current ISPConfig is unable to enable this for remote user.
    Code:
        public function server_get($session_id, $server_id, $section ='') {
            global $app;        
            /*if(!$this->checkPerm($session_id, 'server_get')) {
                $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                return false;
            }*/
            if (!empty($session_id) && !empty($server_id)) {    
                $app->uses('remoting_lib , getconf');        
                $section_config =  $app->getconf->get_server_config($server_id,$section);        
                return $section_config;
            } else {
                return false;
            }
        }
    
    2. Changed 'client_update' function (maybe somebody made mistake.)
    From
    public function client_update($session_id, $client_id, $reseller_id, $params)
    To
    public function client_update($session_id, $reseller_id, $client_id, $params)


    This is a sample code for adding a new site with remote framework.
    Code:
    <?php
    
    $username = 'username';
    $password = 'password';
    
    
    $soap_location = 'http://localhost:8080/ispconfig3/interface/web/remote/index.php';
    $soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';
    
    $client = new SoapClient(null, array('location' => $soap_location,
                                         'uri'      => $soap_uri));
    
    $session_id = $client->login($username,$password);
    
    //$server_params['server_id'] = $this->getServerId(); 
    $server_params['server_id'] = '1'; 
    $server_params['section'] = 'web'; 
     
    $server_info = $client->server_get($session_id, $server_params['server_id'], $server_params['section']);
    
    $domain_name = 'xxxxx.com';
    
    $client_id = '26'; //your client id
    $client_group_id = $client_id + 1;
    $system_group = 'client'.$client_id;
    $client_name = '10001'; //your client_name
    
    $ftp_user = $client_name."_ftp";
    $ftp_password = "ftp password";
    $db_name = "c".$client_id."db"; // $client_id plus db
    $db_user = "c".$client_id."user"; // $client_id plus user
    $db_password = "db password";
    
    //Web Domain Add
    try {
        
    	$params = array(        'server_id' => '1',
    				'ip_address' => '192.168.1.1',
    				'domain' => $domain_name,
    				'type' => 'vhost',
    				'vhost_type' => 'name',						
    				'sys_userid' => '1',
    				'sys_groupid' => '1',
    				'system_user' => 'web1',
    				'system_group' => $system_group,
    				'client_group_id' => $client_group_id,
    				'parent_domain_id' => '',
    				'hd_quota' => '-1',
    				'traffic_quota' => '-1',
    				'cgi' => 'n',
    				'ssi' => 'n',
    				'suexec' => 'n',
    				'errordocs' => '1',
    				'subdomain' => 'none',
    				'ssl' => 'n',
    				'php' => 'fast-cgi',
    				'active' => 'y',
    				'allow_override' => 'All',
    				'errordocs' => '1',
    				'document_root' => $server_info['website_path'],
    				'php_open_basedir' => $server_info['php_open_basedir']);
    
    	$website_id = $client->sites_web_domain_add($session_id, $client_id, $params);
    	
    }
    catch (SoapFault $e) {
    	die('Error: '.$e->getMessage());
    }
    
    We don't know the website_id so just enter 'web1' for 'system_user' as below and this will be overwritten by ISPconfig.
    'system_user' => 'web1'

    Hope this may help...

    Harry
     
    Last edited: Aug 24, 2010
  18. ispcomm

    ispcomm Member

    Log table missing the IP field

    Browsing packages I get:
    Code:
    ERROR
    Database error number: 1054
    Database error message: Unknown column 'ip' in 'field list'
    
    Query: INSERT INTO `logs` (uid, loguser, logtime, ip, message) VALUES ( '1', 'admin', '1282631969', '::ffff:192.168.3.131', 'server::loadServer server_id #1')
    File: /var/www/bnpanel/includes/class_main.php
    Line: 722
    Class: main
    Method: addLog
    Adding a varchar field to the log table fixes this (install related issue).

    I don't get the packages of bnpanel and how they're related to resources in ispconfig? How do I limit resources used by a package?

    Order page bug:
    there's bug (?) on the order page. The "order" button does not work (tested in safari and firefox).

    The orderstepme functions is called and disables the button, but the ajax is never called afterwards (I have no log lines in the web server).

    ispcomm

    PS: Perhaps I'm too quick reporting. stop me if you feel I'm hammering.
     
    Last edited: Aug 24, 2010
  19. jwarnier

    jwarnier ISPConfig Developer ISPConfig Developer

    Certainly not, feel free too, but be aware we might choose not to fix the bugs you find...

    It is great to have some external testing.
    And we are based in Belgium, while Julio is actually working from France.
     
  20. jmontoya

    jmontoya ISPConfig Developer ISPConfig Developer

    Hello there!
    Here are my comments:

    1. You should check this file /interface/web/admin/form/remote_user.tform.php
    There you will find the permissions that remote users can do.
    Check in ISPConfig trunck SVN

    2. As far as I know I dont use the client_update in BNPanel. But it should work with this:

    PHP:
    case 'client_update':
    $soap_result     $soap_client->client_update($this->session_id$params['client_id'], $params['reseller_id'], $params);
    As you can see this is the order: client_id, primary_id.
    I did not test it yet with BNPanel but it should work.

    In trunk and in stable ISPConfig SVN the client_update function is like that:
    public function client_update($session_id, $client_id, $reseller_id, $params)

    the website_id and system_user and system_group are rewritten by ISPConfig, I'm working with the SVN trunk version so you should check the differences between your current installation and those from trunk.

     

Share This Page