- Added new fields to serverIP list and form.
- Added a new IP validator to the tform library which validates IPv4 and IPv6 addresses.
| | |
| | | } |
| | | } |
| | | break; |
| | | case 'ISIP': |
| | | //* Check if its a IPv4 or IPv6 address |
| | | if(function_exists('filter_var')) { |
| | | if(!filter_var($field_value,FILTER_VALIDATE_IP)) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | | } else { |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } else { |
| | | //* Check content with regex, if we use php < 5.2 |
| | | $ip_ok = 0; |
| | | if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){ |
| | | $ip_ok = 1; |
| | | } |
| | | if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ |
| | | $ip_ok = 1; |
| | | } |
| | | if($ip_ok == 0) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | | } else { |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 'CUSTOM': |
| | | // Calls a custom class to validate this record |
| | | if($validator['class'] != '' and $validator['function'] != '') { |
| | |
| | | ), |
| | | 'value' => '' |
| | | ), |
| | | 'client_id' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '', |
| | | 'datasource' => array ( 'type' => 'SQL', |
| | | 'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name', |
| | | 'keyfield'=> 'client_id', |
| | | 'valuefield'=> 'contact_name' |
| | | ), |
| | | 'value' => array(0 => ' ') |
| | | ), |
| | | 'ip_type' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'SELECT', |
| | | 'default' => '', |
| | | 'value' => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6') |
| | | ), |
| | | 'ip_address' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISIPV4', |
| | | 'validators' => array ( 0 => array ( 'type' => 'ISIP', |
| | | 'errmsg'=> 'ip_error_wrong'), |
| | | 1 => array ( 'type' => 'UNIQUE', |
| | | 'errmsg'=> 'ip_error_unique'), |
| | |
| | | 'default' => 'y', |
| | | 'value' => array(0 => 'n',1 => 'y') |
| | | ), |
| | | 'virtualhost_port' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => '', |
| | | 'value' => '', |
| | | 'separator' => '', |
| | | 'width' => '15', |
| | | 'maxlength' => '15', |
| | | 'rows' => '', |
| | | 'cols' => '' |
| | | ), |
| | | ################################## |
| | | # ENDE Datenbankfelder |
| | | ################################## |
| | |
| | | <?php |
| | | $wb["server_id_txt"] = 'Server'; |
| | | $wb["client_id_txt"] = 'Client'; |
| | | $wb["ip_type_txt"] = 'Type'; |
| | | $wb["ip_address_txt"] = 'IP Address'; |
| | | $wb["virtualhost_txt"] = 'HTTP NameVirtualHost'; |
| | | $wb["virtualhost_port_txt"] = 'HTTP Ports'; |
| | | $wb["ip_error_wrong"] = 'The IP address is invalid'; |
| | | $wb["ip_error_unique"] = 'The IP address must be unique'; |
| | | ?> |
| | |
| | | <?php |
| | | $wb["list_head_txt"] = 'IP Addresses'; |
| | | $wb["server_id_txt"] = 'Server'; |
| | | $wb["client_id_txt"] = 'Client'; |
| | | $wb["ip_address_txt"] = 'IP Address'; |
| | | $wb["add_new_record_txt"] = 'Add new IP Address'; |
| | | $wb["virtualhost_txt"] = 'HTTP Vhost'; |
| | | $wb["virtualhost_port_txt"] = 'HTTP Ports'; |
| | | $wb["ip_type_txt"] = 'Type'; |
| | | ?> |
| | |
| | | <?php |
| | | <?php |
| | | /* |
| | | Datatypes: |
| | | - INTEGER |
| | |
| | | 'width' => '', |
| | | 'value' => ''); |
| | | |
| | | $liste['item'][] = array( 'field' => 'client_id', |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'SELECT', |
| | | 'op' => 'like', |
| | | 'prefix' => '%', |
| | | 'suffix' => '%', |
| | | 'datasource' => array ( 'type' => 'SQL', |
| | | 'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name', |
| | | 'keyfield'=> 'client_id', |
| | | 'valuefield'=> 'contact_name' |
| | | ), |
| | | 'width' => '', |
| | | 'value' => ''); |
| | | |
| | | $liste['item'][] = array( 'field' => 'ip_type', |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'SELECT', |
| | | 'op' => '=', |
| | | 'prefix' => '', |
| | | 'suffix' => '', |
| | | 'width' => '', |
| | | 'value' => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6')); |
| | | |
| | | $liste['item'][] = array( 'field' => 'ip_address', |
| | | 'datatype' => 'VARCHAR', |
| | | 'op' => '=', |
| | |
| | | 'suffix' => '', |
| | | 'width' => ''); |
| | | |
| | | $liste["item"][] = array( 'field' => "virtualhost", |
| | | 'datatype' => "VARCHAR", |
| | | 'formtype' => "SELECT", |
| | | 'op' => "=", |
| | | 'prefix' => "", |
| | | 'suffix' => "", |
| | | 'width' => "", |
| | | 'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>")); |
| | | |
| | | |
| | | $liste['item'][] = array( 'field' => 'virtualhost_port', |
| | | 'datatype' => 'VARCHAR', |
| | | 'op' => '=', |
| | | 'prefix' => '', |
| | | 'suffix' => '', |
| | | 'width' => ''); |
| | | |
| | | ?> |
| | |
| | | <p><tmpl_var name="list_desc_txt"></p> |
| | | |
| | | <div class="panel panel_server_ip"> |
| | | |
| | | |
| | | <div class="pnl_formsarea"> |
| | | <fieldset class="inlineLabels"> |
| | | <fieldset class="inlineLabels"><legend>IP Address</legend> |
| | | <div class="ctrlHolder"> |
| | | <label for="server_id">{tmpl_var name='server_id_txt'}</label> |
| | | <select name="server_id" id="server_id" class="selectInput"> |
| | |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="client_id">{tmpl_var name='client_id_txt'}</label> |
| | | <select name="client_id" id="client_id" class="selectInput"> |
| | | {tmpl_var name='client_id'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="ip_type">{tmpl_var name='ip_type_txt'}</label> |
| | | <select name="ip_type" id="ip_type" class="selectInput"> |
| | | {tmpl_var name='ip_type'} |
| | | </select> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="ip_address">{tmpl_var name='ip_address_txt'}</label> |
| | | <input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="15" type="text" class="textInput formLengthIPv4" /> |
| | | <input name="ip_address" id="ip_address" value="{tmpl_var name='ip_address'}" size="15" maxlength="255" type="text" class="textInput" /> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <p class="label">{tmpl_var name='virtualhost_txt'}</p> |
| | |
| | | {tmpl_var name='virtualhost'} |
| | | </div> |
| | | </div> |
| | | <div class="ctrlHolder"> |
| | | <label for="virtualhost_port">{tmpl_var name='virtualhost_port_txt'}</label> |
| | | <input name="virtualhost_port" id="virtualhost_port" value="{tmpl_var name='virtualhost_port'}" size="15" maxlength="15" type="text" class="textInput" /> |
| | | </div> |
| | | </fieldset> |
| | | |
| | | <input type="hidden" name="id" value="{tmpl_var name='id'}"> |
| | |
| | | <h2><tmpl_var name="list_head_txt"></h2> |
| | | <p><tmpl_var name="list_desc_txt"></p> |
| | | |
| | | <div class="panel panel_list_server_ip"> |
| | | |
| | |
| | | <thead> |
| | | <tr> |
| | | <th class="tbl_col_server_id" scope="col"><tmpl_var name="server_id_txt"></th> |
| | | <th class="tbl_col_client_id" scope="col"><tmpl_var name="client_id_txt"></th> |
| | | <th class="tbl_col_ip_type" scope="col"><tmpl_var name="ip_type_txt"></th> |
| | | <th class="tbl_col_ip_address" scope="col"><tmpl_var name="ip_address_txt"></th> |
| | | <th class="tbl_col_virtualhost" scope="col"><tmpl_var name="virtualhost_txt"></th> |
| | | <th class="tbl_col_virtualhost_port" scope="col"><tmpl_var name="virtualhost_port_txt"></th> |
| | | <th class="tbl_col_buttons" scope="col"> </th> |
| | | </tr> |
| | | <tr> |
| | | <td class="tbl_col_server_id"><select name="search_server_id" onChange="submitForm('pageForm','admin/server_ip_list.php');">{tmpl_var name='search_server_id'}</select></td> |
| | | <td class="tbl_col_ip_address"><input type="text" name="search_ip_address" value="{tmpl_var name='search_ip_address'}" onblur="submitForm('pageForm','admin/server_ip_list.php');" /></td> |
| | | <td class="tbl_col_client_id"><select name="search_client_id" onChange="submitForm('pageForm','admin/server_ip_list.php');">{tmpl_var name='search_client_id'}</select></td> |
| | | <td class="tbl_col_ip_type"><select name="search_ip_type" onChange="submitForm('pageForm','admin/server_ip_list.php');">{tmpl_var name='search_ip_type'}</select></td> |
| | | <td class="tbl_col_ip_address"><input type="text" name="search_ip_address" value="{tmpl_var name='search_ip_address'}" /></td> |
| | | <td class="tbl_col_virtualhost"><select name="search_virtualhost" onChange="submitForm('pageForm','admin/server_ip_list.php');">{tmpl_var name='search_virtualhost'}</select></td> |
| | | <td class="tbl_col_virtualhost_port"><input type="text" name="search_virtualhost_port" value="{tmpl_var name='search_virtualhost_port'}" /></td> |
| | | <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','admin/server_ip_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td> |
| | | </tr> |
| | | </thead> |
| | |
| | | <tmpl_loop name="records"> |
| | | <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> |
| | | <td class="tbl_col_server_id"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td> |
| | | <td class="tbl_col_client_id"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="client_id"}</a></td> |
| | | <td class="tbl_col_ip_type"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="ip_type"}</a></td> |
| | | <td class="tbl_col_ip_address"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="ip_address"}</a></td> |
| | | <td class="tbl_col_virtualhost"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="virtualhost"}</a></td> |
| | | <td class="tbl_col_virtualhost_port"><a href="#" onClick="loadContent('admin/server_ip_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="virtualhost_port"}</a></td> |
| | | <td class="tbl_col_buttons"> |
| | | <div class="buttons icons16"> |
| | | <a class="icons16 icoDelete" href="javascript: del_record('admin/server_ip_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> |
| | |
| | | </tbody> |
| | | <tfoot> |
| | | <tr> |
| | | <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td> |
| | | <td class="tbl_footer tbl_paging" colspan="7"><tmpl_var name="paging"></td> |
| | | </tr> |
| | | </tfoot> |
| | | </table> |