4 files modified
3 files added
| | |
| | | var $wordbook; |
| | | var $module; |
| | | var $primary_id; |
| | | var $diffrec = array(); |
| | | |
| | | /** |
| | | * Laden der Tabellendefinition |
| | |
| | | $validator_class = $validator['class']; |
| | | $validator_function = $validator['function']; |
| | | $app->uses($validator_class); |
| | | $this->errorMessage .= $app->$validator_class->$validator_function($validator); |
| | | $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator); |
| | | } else { |
| | | $this->errorMessage .= "Custom validator class or function is empty<br>\r\n"; |
| | | } |
| | |
| | | // Insert the server_id, if the record has a server_id |
| | | $server_id = ($record_old["server_id"] > 0)?$record_old["server_id"]:0; |
| | | |
| | | $this->diffrec = $diffrec; |
| | | |
| | | if(count($diffrec) > 0) { |
| | | |
| | | // We need the full records in ISPConfig, not only the diffs |
New file |
| | |
| | | <?php |
| | | |
| | | /* |
| | | Copyright (c) 2007, Till Brehm, Falko Timme, projektfarm Gmbh |
| | | All rights reserved. |
| | | |
| | | Redistribution and use in source and binary forms, with or without modification, |
| | | are permitted provided that the following conditions are met: |
| | | |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright notice, |
| | | this list of conditions and the following disclaimer in the documentation |
| | | and/or other materials provided with the distribution. |
| | | * Neither the name of ISPConfig nor the names of its contributors |
| | | may be used to endorse or promote products derived from this software without |
| | | specific prior written permission. |
| | | |
| | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| | | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| | | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| | | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| | | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| | | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| | | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| | | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| | | */ |
| | | |
| | | |
| | | class validate_client { |
| | | |
| | | /* |
| | | Validator function to check if a username is unique. |
| | | */ |
| | | function username_unique($field_name, $field_value, $validator) { |
| | | global $app; |
| | | |
| | | if($app->tform->action == 'NEW') { |
| | | $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'"); |
| | | if($num_rec["number"] > 0) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | return $app->tform->wordbook[$errmsg]."<br>\r\n"; |
| | | } else { |
| | | return $errmsg."<br>\r\n"; |
| | | } |
| | | } |
| | | } else { |
| | | $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$app->tform->primary_id); |
| | | if($num_rec["number"] > 0) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($app->tform->wordbook[$errmsg])) { |
| | | return $app->tform->wordbook[$errmsg]."<br>\r\n"; |
| | | } else { |
| | | return $errmsg."<br>\r\n"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | // Loading classes |
| | | $app->uses('tpl,tform,tform_actions'); |
| | | $app->load('tform_actions'); |
| | | |
| | | // let tform_actions handle the page |
| | | $app->tform_actions->onLoad(); |
| | | class page_action extends tform_actions { |
| | | |
| | | /* |
| | | This function is called automatically right after |
| | | the data was successful inserted in the database. |
| | | */ |
| | | function onAfterInsert() { |
| | | global $app; |
| | | // Create the group for the client |
| | | $sql = "INSERT INTO sys_group (name,description,client_id) VALUES ('".addslashes($this->dataRecord["username"])."','',".$this->id.")"; |
| | | $app->db->query($sql); |
| | | $groupid = $app->db->insertID(); |
| | | |
| | | $username = addslashes($this->dataRecord["username"]); |
| | | $password = addslashes($this->dataRecord["password"]); |
| | | $modules = 'mail'; |
| | | $startmodule = 'mail'; |
| | | $usertheme = addslashes($this->dataRecord["usertheme"]); |
| | | $type = 'user'; |
| | | $active = 1; |
| | | $language = addslashes($this->dataRecord["language"]); |
| | | |
| | | // Create the controlpaneluser for the client |
| | | $sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id) |
| | | VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groupid,$groupid,".$this->id.")"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | | |
| | | /* |
| | | This function is called automatically right after |
| | | the data was successful updated in the database. |
| | | */ |
| | | function onAfterUpdate() { |
| | | global $app; |
| | | |
| | | // username changed |
| | | if(isset($app->tform->diffrec['username'])) { |
| | | $username = addslashes($this->dataRecord["username"]); |
| | | $client_id = $this->id; |
| | | $sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | $sql = "UPDATE sys_group SET name = '$username' WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | | // password changed |
| | | if($this->dataRecord["password"] != '') { |
| | | $password = addslashes($this->dataRecord["password"]); |
| | | $sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id"; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | $page = new page_action; |
| | | $page->onLoad(); |
| | | |
| | | ?> |
| | |
| | | 'username' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', |
| | | 'errmsg'=> 'username_error_empty'), |
| | | 1 => array ( 'type' => 'CUSTOM', |
| | | 'class' => 'validate_client', |
| | | 'function' => 'username_unique', |
| | | 'errmsg'=> 'username_error_unique'), |
| | | ), |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => 'default', |
| | | 'value' => array('default' => 'default','grey' => 'grey'), |
| | | 'value' => array('default' => 'default'), |
| | | 'separator' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255', |
| | |
| | | <?php |
| | | $wb["username_txt"] = 'Username'; |
| | | $wb["password_txt"] = 'Password'; |
| | | $wb["language_txt"] = 'Language'; |
| | | $wb["usertheme_txt"] = 'Theme'; |
| | | $wb["btn_save_txt"] = 'Save'; |
| | | $wb["btn_cancel_txt"] = 'Cancel'; |
| | | $wb["limit_maildomain_txt"] = 'Max. number of email domains'; |
| | | $wb["limit_mailbox_txt"] = 'Max. number of mailboxes'; |
| | | $wb["limit_mailalias_txt"] = 'Max. number of email aliases and redirects'; |
| | |
| | | $wb["limit_mailfilter_txt"] = 'Max. number of email filters'; |
| | | $wb["limit_fetchmail_txt"] = 'Max. number of fetchmail accounts'; |
| | | $wb["limit_mailquota_txt"] = 'Mailbox quota'; |
| | | $wb["btn_save_txt"] = 'Save';
|
| | | $wb["btn_cancel_txt"] = 'Cancel';
|
| | | $wb["company_name_txt"] = 'Company name'; |
| | | $wb["contact_name_txt"] = 'Contact name'; |
| | | $wb["username_txt"] = 'Username';
|
| | | $wb["password_txt"] = 'Password';
|
| | | $wb["language_txt"] = 'Language';
|
| | | $wb["usertheme_txt"] = 'Theme';
|
| | | $wb["street_txt"] = 'Street'; |
| | | $wb["zip_txt"] = 'ZIP'; |
| | | $wb["city_txt"] = 'City'; |
New file |
| | |
| | | <table width="500" border="0" cellspacing="0" cellpadding="2"> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='company_name_txt'}:</td> |
| | | <td class="frmText11"><input name="company_name" type="text" class="text" value="{tmpl_var name='company_name'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='contact_name_txt'}:</td> |
| | | <td class="frmText11"><input name="contact_name" type="text" class="text" value="{tmpl_var name='contact_name'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='username_txt'}:</td> |
| | | <td class="frmText11"><input name="username" type="text" class="text" value="{tmpl_var name='username'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='password_txt'}:</td> |
| | | <td class="frmText11"><input name="password" type="password" class="text" value="{tmpl_var name='password'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='language_txt'}:</td> |
| | | <td class="frmText11"> |
| | | <select name="language" class="text"> |
| | | {tmpl_var name='language'} |
| | | </select> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='usertheme_txt'}:</td> |
| | | <td class="frmText11"> |
| | | <select name="usertheme" class="text"> |
| | | {tmpl_var name='usertheme'} |
| | | </select> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='street_txt'}:</td> |
| | | <td class="frmText11"><input name="street" type="text" class="text" value="{tmpl_var name='street'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='zip_txt'}:</td> |
| | | <td class="frmText11"><input name="zip" type="text" class="text" value="{tmpl_var name='zip'}" size="10" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='city_txt'}:</td> |
| | | <td class="frmText11"><input name="city" type="text" class="text" value="{tmpl_var name='city'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='state_txt'}:</td> |
| | | <td class="frmText11"><input name="state" type="text" class="text" value="{tmpl_var name='state'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='country_txt'}:</td> |
| | | <td class="frmText11"><input name="country" type="text" class="text" value="{tmpl_var name='country'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='telephone_txt'}:</td> |
| | | <td class="frmText11"><input name="telephone" type="text" class="text" value="{tmpl_var name='telephone'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='mobile_txt'}:</td> |
| | | <td class="frmText11"><input name="mobile" type="text" class="text" value="{tmpl_var name='mobile'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='fax_txt'}:</td> |
| | | <td class="frmText11"><input name="fax" type="text" class="text" value="{tmpl_var name='fax'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='email_txt'}:</td> |
| | | <td class="frmText11"><input name="email" type="text" class="text" value="{tmpl_var name='email'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='internet_txt'}:</td> |
| | | <td class="frmText11"><input name="internet" type="text" class="text" value="{tmpl_var name='internet'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='icq_txt'}:</td> |
| | | <td class="frmText11"><input name="icq" type="text" class="text" value="{tmpl_var name='icq'}" size="30" maxlength="255"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='notes_txt'}:</td> |
| | | <td class="frmText11"><textarea name='notes' cols='30' rows='10'>{tmpl_var name='notes'}</textarea></td> |
| | | </tr> <tr> |
| | | <td class="frmText11"> </td> |
| | | <td class="frmText11"> </td> |
| | | </tr> |
| | | <tr> |
| | | <td> </td> |
| | | <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/client_edit.php');"><div class="buttonEnding"></div> |
| | | <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('client/client_list.php');"><div class="buttonEnding"></div> |
| | | </td> |
| | | </tr>
|
| | | </table>
|
| | | <input type="hidden" name="id" value="{tmpl_var name='id'}"> |
New file |
| | |
| | | <table width="500" border="0" cellspacing="0" cellpadding="2"> |
| | | <tr> |
| | | <td class="frmText11" width="280">{tmpl_var name='limit_maildomain_txt'}:</td> |
| | | <td class="frmText11" width="220"><input name="limit_maildomain" type="text" class="text" value="{tmpl_var name='limit_maildomain'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailbox_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailbox" type="text" class="text" value="{tmpl_var name='limit_mailbox'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailalias_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailalias" type="text" class="text" value="{tmpl_var name='limit_mailalias'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailcatchall_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailcatchall" type="text" class="text" value="{tmpl_var name='limit_mailcatchall'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailrouting_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailrouting" type="text" class="text" value="{tmpl_var name='limit_mailrouting'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailfilter_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailfilter" type="text" class="text" value="{tmpl_var name='limit_mailfilter'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_fetchmail_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_fetchmail" type="text" class="text" value="{tmpl_var name='limit_fetchmail'}" size="10" maxlength="10"></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="frmText11">{tmpl_var name='limit_mailquota_txt'}:</td> |
| | | <td class="frmText11"><input name="limit_mailquota" type="text" class="text" value="{tmpl_var name='limit_mailquota'}" size="10" maxlength="10"> MB</td> |
| | | </tr> <tr> |
| | | <td class="frmText11"> </td> |
| | | <td class="frmText11"> </td> |
| | | </tr> |
| | | <tr> |
| | | <td> </td> |
| | | <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/client_edit.php');"><div class="buttonEnding"></div> |
| | | <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('client/client_list.php');"><div class="buttonEnding"></div> |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | <input type="hidden" name="id" value="{tmpl_var name='id'}"> |