#1  
Old 28th December 2009, 20:21
oilyflutesalad oilyflutesalad is offline
Member
 
Join Date: Dec 2009
Posts: 48
Thanks: 2
Thanked 11 Times in 9 Posts
Send a message via MSN to oilyflutesalad
Default [DOMAINID] Prefix

I wanted to include the ID of the parent domain in FTP accounts, so after a bit of firebug magic and a quick look through relevant files, I've modified the source to add the keyword DOMAINID.

Example Usage:
Code:
c[CLIENTID]d[DOMAINID]_
Will result in something like "c3d12_default" if an FTP account with name "default" was added. Without the domain ID prefix, a client would get a duplicate error if they tried to create a "default" FTP account for each domain, even though it would make sense to be able to create them. Now they can have default accounts for every domain in their account.

Open tools.inc.php for editing. I'm using Ubuntu Server 9.10. The path to your ISPConfig directory may be different on your distro.
Code:
vi /var/www/ispconfig/sites/tools.inc.php
Go down to the replacePrefix function. Add ,'DOMAINID' to the $keywordlist array, then add a new case under the two existing ones:
Code:
[...]
        // Array containing keys to search
        $keywordlist=array('CLIENTNAME','CLIENTID','DOMAINID');
[...]
                                case 'CLIENTID':
                                        $name=str_replace('['.$keyword.']', getClientID($dataRecord),$name);
                                break;
                                case 'DOMAINID':
                                        $name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'],$name);
                                break;
[...]
And that's it! Save the file and you're done. To change your prefixes, go into ISPConfig then on the System tab, click "Interface Config" in the system menu.
Reply With Quote
The Following 3 Users Say Thank You to oilyflutesalad For This Useful Post:
BorderAmigos (17th February 2010), falko (29th December 2009), moglia (16th January 2010)
Sponsored Links
  #2  
Old 16th January 2010, 13:57
moglia moglia is offline
Member
 
Join Date: Apr 2009
Posts: 92
Thanks: 7
Thanked 15 Times in 11 Posts
Exclamation I will try test and implement.

Thanks 4 contrib.
Reply With Quote
  #3  
Old 22nd February 2010, 22:38
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

FEATURE REQUEST !!! Can this be included in the next release of ISPConfig 3. It's useful and it would be nice not to have to re-do the edit after updating. Thanks.
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #4  
Old 23rd February 2010, 09:13
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,340
Thanks: 810
Thanked 5,172 Times in 4,055 Posts
Default

If you like to request a feature, plaese post it as feature request in the bugtracker and vote for it there.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 18th April 2010, 12:47
xxfog xxfog is offline
Junior Member
 
Join Date: Jan 2010
Posts: 28
Thanks: 5
Thanked 1 Time in 1 Post
Default

Hi oily..

did you already set this into bugtracker.ispconfig.org?

I would like to vote for it ther!

If so, please send the direkt link in this post.
If not - will you? ;-)
__________________
greetz Steffan

Need help? Try out irc://irc.quakenet.org/ISPConfig
Reply With Quote
  #6  
Old 18th April 2010, 13:22
moglia moglia is offline
Member
 
Join Date: Apr 2009
Posts: 92
Thanks: 7
Thanked 15 Times in 11 Posts
Exclamation Complement

[DOMAINNAME] is interessant too.

Prefix and Sufix implementation to create ftp account for example.

USERNAME_[DOMAINNAME] or USERNAME@[DOMAINNAME]

Examples:
user@domain.com
user_domain.com
Reply With Quote
  #7  
Old 17th May 2010, 02:05
radim_h radim_h is offline
Senior Member
 
Join Date: Jan 2007
Location: Prague, Czech
Posts: 416
Thanks: 33
Thanked 23 Times in 18 Posts
Send a message via ICQ to radim_h
Default

Quote:
Originally Posted by moglia View Post
[DOMAINNAME] is interessant too.

Prefix and Sufix implementation to create ftp account for example.

USERNAME_[DOMAINNAME] or USERNAME@[DOMAINNAME]

Examples:
user@domain.com
user_domain.com
yes [DOMAINNAME] will be great
Reply With Quote
  #8  
Old 19th October 2010, 15:45
ppnl.com ppnl.com is offline
Junior Member
 
Join Date: Oct 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To adapt ispconfig and use DOMAINNAME, DOMAINID, DOMAINNAMESHORT as prefix for database in order to allow moving databases between clients!

My prefix for database name and database user is:
[DOMAINNAMESHORT][DOMAINID]_

Here DOMAINNAMESHORT will be the first 5 characters of the domain name, and the DOMAINID will be added to make it unique, however not a full list of databases with ONLY numbers!

e.g. for domain.com the database prefix will be domai12_

And because it's based on DOMAIN it allows to move to another client.

INSTRUCTIONS (on own risk)

To support DOMAINID, DOMAINNAME and DOMAINNAMESHORT as prefix modfiy the file /usr/local/ispconfig/interface/web/sites/tools.inc.php and modify replacePrefix and add also a new function getDomainName :

Code:
function replacePrefix($name, $dataRecord) {
  // No input -> no possible output -> go out!
  if ($name=="") return "";
  
  // Array containing keys to search
  $keywordlist=array('CLIENTNAME','CLIENTID','DOMAINID','DOMAINNAME','DOMAINNAMESHORT');
  
  // Try to match the key within the string
  foreach ($keywordlist as $keyword) {
    if (substr_count($name, '['.$keyword.']') > 0) {
      switch ($keyword) {
        case 'CLIENTNAME':
          $name=str_replace('['.$keyword.']', getClientName($dataRecord),$name);
        break;
        case 'CLIENTID':
          $name=str_replace('['.$keyword.']', getClientID($dataRecord),$name);
        break;
        case 'DOMAINID':
          $name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'],$name);
        break;
        case 'DOMAINNAME':
          $name=str_replace('['.$keyword.']', getDomainName($dataRecord['parent_domain_id']),$name);
        break;
        case 'DOMAINNAMESHORT':
          $name=str_replace('['.$keyword.']', substr(getDomainName($dataRecord['parent_domain_id']),0,5),$name);
        break;
      }
    }
  }
  return $name;
}

function getDomainName($domain_id) {
  global $app;
  $tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = " . $domain_id);

  return $tmp['domain'];
}

To show the dropdown with domains in the database edit form, modify web/sites/templates/database_edit.htm and add between client_group_id and type around line 39:
(copied from ftp_user_edit.htm)

Code:
<div class="ctrlHolder">
    <label for="parent_domain_id">{tmpl_var name='parent_domain_id_txt'}</label>
    <select name="parent_domain_id" id="parent_domain_id" class="selectInput">
                                       {tmpl_var name='parent_domain_id'}
    </select>
  </div>
To define the domain dropdown in the form modify /usr/local/ispconfig/interface/web/sites/form/database.tform.php and add between server_id and type around line 72:
(copied from ftp_user.tform.php)
Code:
'parent_domain_id' => array (
                        'datatype'      => 'INTEGER',
                        'formtype'      => 'SELECT',
                        'default'       => '',
                        'datasource'    => array (      'type'  => 'SQL', 'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",'keyfield'=> 'domain_id','valuefield'=> 'domain'
                                                 ),
                        'value'         => ''
),
Add to the table web_database the field parent_domain_id after server_id with INT unsigned default 0.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to receve email aberrio Server Operation 16 8th July 2009 10:26
slow download through webserver problem snewp Technical 14 9th May 2008 05:25
Outlook does not Authenticates aberrio Server Operation 30 1st November 2007 19:21
No ftp login for ispconfig-webuser agri Installation/Configuration 12 19th March 2007 10:06
How to change Prefix for database name ??? IKShadow Installation/Configuration 2 1st December 2006 13:11


All times are GMT +2. The time now is 19:25.


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