|
@@ -98,145 +98,151 @@ function exec_ogp_module()
|
|
|
echo "<h2>" . ftp_admin . "</h2>";
|
|
echo "<h2>" . ftp_admin . "</h2>";
|
|
|
|
|
|
|
|
$servers = $db->getRemoteServers();
|
|
$servers = $db->getRemoteServers();
|
|
|
-
|
|
|
|
|
- echo "<tr><td colspan='3' >
|
|
|
|
|
- <form method=POST >
|
|
|
|
|
- <table class='center' style='width:100%' ><tr>
|
|
|
|
|
- <td>". remote_server ." <select style='width:250px' name='remote_server_id' >";
|
|
|
|
|
-
|
|
|
|
|
- foreach ( $servers as $server_row )
|
|
|
|
|
- {
|
|
|
|
|
- echo "<option value='" . $server_row['remote_server_id'] . "' >" . $server_row['remote_server_name'] . " (" . $server_row['agent_ip'] . ":" . $server_row['agent_port'] . ")</option>";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- echo "</select>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>". login ."<input type=text name='ftp_login' /></td>
|
|
|
|
|
- <td>". password ."<input type=text name='ftp_password' /></td>
|
|
|
|
|
- <td>". full_path ."<input type=text name='full_path' /></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td colspan=4 ><input style='width:100%;' type=submit name='add_ftp_user' value='". add_ftp_account ."' /></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </table>
|
|
|
|
|
- </form>
|
|
|
|
|
- </td></tr>";
|
|
|
|
|
-?>
|
|
|
|
|
-<table id="servermonitor" class="tablesorter">
|
|
|
|
|
- <thead>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <th class="header" ></th><th><?php print_lang('remote_server'); ?></th><th><?php print_lang('login'); ?></th><th><?php print_lang('server_name'); ?></th><th><?php print_lang('full_path'); ?></th>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </thead>
|
|
|
|
|
- <tbody>
|
|
|
|
|
-<?php
|
|
|
|
|
- foreach ( $servers as $server_row )
|
|
|
|
|
- {
|
|
|
|
|
- $remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
|
|
|
|
|
|
|
|
|
|
- $host_stat = $remote->status_chk();
|
|
|
|
|
|
|
+ if ($servers !== false) {
|
|
|
|
|
|
|
|
- $status = ( $host_stat === 0 or $host_stat === -1 ) ? "<span class='failure'>". offline ."</span>" : "<span class='success'>". online ."</span>";
|
|
|
|
|
-
|
|
|
|
|
- if( $host_stat === 1)
|
|
|
|
|
- {
|
|
|
|
|
- $ftp_accounts_list = $remote->ftp_mgr("list");
|
|
|
|
|
- $ftp_accounts = explode("\n", $ftp_accounts_list);
|
|
|
|
|
- foreach($ftp_accounts as $ftp_account)
|
|
|
|
|
- {
|
|
|
|
|
- if( !empty($ftp_account))
|
|
|
|
|
- {
|
|
|
|
|
- list($ftp_login, $ftp_path) = explode("\t", $ftp_account);
|
|
|
|
|
- $ftp_login = trim($ftp_login);
|
|
|
|
|
- $home_info = $db->getHomeByFtpLogin($server_row['remote_server_id'], $ftp_login);
|
|
|
|
|
- $expandme = ( ( isset($_POST['ftp_login']) and $ftp_login == strip_real_escape_string($_POST['ftp_login']) ) AND ( isset($_POST['remote_server_id']) and $home_info['remote_server_id'] == $_POST['remote_server_id'] ) ) ? "expandme" : "";
|
|
|
|
|
- $home_name = isset( $home_info['home_name'] ) ? $home_info['home_name'] : $ftp_path;
|
|
|
|
|
- echo "<tr class='maintr $expandme'><td class='collapsible' ></td><td>".$server_row['remote_server_name']." (".$server_row['agent_ip'].")</td><td><b class='failure' >$ftp_login</td><td>" . htmlentities($home_name) . "</td><td>$ftp_path</td></tr>
|
|
|
|
|
- <tr class='expand-child' ><td colspan='4' >
|
|
|
|
|
- <form method=POST >
|
|
|
|
|
- <table>";
|
|
|
|
|
-
|
|
|
|
|
- $account_details = $remote->ftp_mgr("show",$ftp_login);
|
|
|
|
|
|
|
+ echo "<tr><td colspan='3' >
|
|
|
|
|
+ <form method=POST >
|
|
|
|
|
+ <table class='center' style='width:100%' ><tr>
|
|
|
|
|
+ <td>". remote_server ." <select style='width:250px' name='remote_server_id' >";
|
|
|
|
|
+
|
|
|
|
|
+ foreach ( $servers as $server_row )
|
|
|
|
|
+ {
|
|
|
|
|
+ echo "<option value='" . $server_row['remote_server_id'] . "' >" . $server_row['remote_server_name'] . " (" . $server_row['agent_ip'] . ":" . $server_row['agent_port'] . ")</option>";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ echo "</select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td>". login ."<input type=text name='ftp_login' /></td>
|
|
|
|
|
+ <td>". password ."<input type=text name='ftp_password' /></td>
|
|
|
|
|
+ <td>". full_path ."<input type=text name='full_path' /></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <td colspan=4 ><input style='width:100%;' type=submit name='add_ftp_user' value='". add_ftp_account ."' /></td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </td></tr>";
|
|
|
|
|
+ ?>
|
|
|
|
|
+ <table id="servermonitor" class="tablesorter">
|
|
|
|
|
+ <thead>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <th class="header" ></th><th><?php print_lang('remote_server'); ?></th><th><?php print_lang('login'); ?></th><th><?php print_lang('server_name'); ?></th><th><?php print_lang('full_path'); ?></th>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </thead>
|
|
|
|
|
+ <tbody>
|
|
|
|
|
+ <?php
|
|
|
|
|
+ foreach ( $servers as $server_row )
|
|
|
|
|
+ {
|
|
|
|
|
+ $remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
|
|
|
|
|
+
|
|
|
|
|
+ $host_stat = $remote->status_chk();
|
|
|
|
|
+
|
|
|
|
|
+ $status = ( $host_stat === 0 or $host_stat === -1 ) ? "<span class='failure'>". offline ."</span>" : "<span class='success'>". online ."</span>";
|
|
|
|
|
|
|
|
- $ftp_account_detail_list = explode("\n",$account_details);
|
|
|
|
|
-
|
|
|
|
|
- foreach($ftp_account_detail_list as $detail_line)
|
|
|
|
|
|
|
+ if( $host_stat === 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ $ftp_accounts_list = $remote->ftp_mgr("list");
|
|
|
|
|
+ $ftp_accounts = explode("\n", $ftp_accounts_list);
|
|
|
|
|
+ foreach($ftp_accounts as $ftp_account)
|
|
|
|
|
+ {
|
|
|
|
|
+ if( !empty($ftp_account))
|
|
|
{
|
|
{
|
|
|
- if( !empty($detail_line))
|
|
|
|
|
|
|
+ list($ftp_login, $ftp_path) = explode("\t", $ftp_account);
|
|
|
|
|
+ $ftp_login = trim($ftp_login);
|
|
|
|
|
+ $home_info = $db->getHomeByFtpLogin($server_row['remote_server_id'], $ftp_login);
|
|
|
|
|
+ $expandme = ( ( isset($_POST['ftp_login']) and $ftp_login == strip_real_escape_string($_POST['ftp_login']) ) AND ( isset($_POST['remote_server_id']) and $home_info['remote_server_id'] == $_POST['remote_server_id'] ) ) ? "expandme" : "";
|
|
|
|
|
+ $home_name = isset( $home_info['home_name'] ) ? $home_info['home_name'] : $ftp_path;
|
|
|
|
|
+ echo "<tr class='maintr $expandme'><td class='collapsible' ></td><td>".$server_row['remote_server_name']." (".$server_row['agent_ip'].")</td><td><b class='failure' >$ftp_login</td><td>" . htmlentities($home_name) . "</td><td>$ftp_path</td></tr>
|
|
|
|
|
+ <tr class='expand-child' ><td colspan='4' >
|
|
|
|
|
+ <form method=POST >
|
|
|
|
|
+ <table>";
|
|
|
|
|
+
|
|
|
|
|
+ $account_details = $remote->ftp_mgr("show",$ftp_login);
|
|
|
|
|
+
|
|
|
|
|
+ $ftp_account_detail_list = explode("\n",$account_details);
|
|
|
|
|
+
|
|
|
|
|
+ foreach($ftp_account_detail_list as $detail_line)
|
|
|
{
|
|
{
|
|
|
- list($key,$value) = explode(" : ",$detail_line);
|
|
|
|
|
- $key = trim($key);
|
|
|
|
|
- $value = trim($value);
|
|
|
|
|
- $blacklist = array("Login", "Password", "UID", "GID", "ftp_user_id", "username",
|
|
|
|
|
- "username_prefix", "password", "sys_userid", "sys_groupid",
|
|
|
|
|
- "sys_perm_user", "sys_perm_group", "sys_perm_other",
|
|
|
|
|
- "server_id", "parent_domain_id", "uid", "gid" );
|
|
|
|
|
- if( in_array($key, $blacklist) )
|
|
|
|
|
- continue;
|
|
|
|
|
- if($value[strlen($value)-1] == ')')
|
|
|
|
|
|
|
+ if( !empty($detail_line))
|
|
|
{
|
|
{
|
|
|
- $value_parts = explode(" ", $value);
|
|
|
|
|
- if(is_numeric($value_parts[0]))
|
|
|
|
|
|
|
+ list($key,$value) = explode(" : ",$detail_line);
|
|
|
|
|
+ $key = trim($key);
|
|
|
|
|
+ $value = trim($value);
|
|
|
|
|
+ $blacklist = array("Login", "Password", "UID", "GID", "ftp_user_id", "username",
|
|
|
|
|
+ "username_prefix", "password", "sys_userid", "sys_groupid",
|
|
|
|
|
+ "sys_perm_user", "sys_perm_group", "sys_perm_other",
|
|
|
|
|
+ "server_id", "parent_domain_id", "uid", "gid" );
|
|
|
|
|
+ if( in_array($key, $blacklist) )
|
|
|
|
|
+ continue;
|
|
|
|
|
+ if(substr($value, -1) == ')')
|
|
|
{
|
|
{
|
|
|
- if(count($value_parts) > 1)
|
|
|
|
|
|
|
+ $value_parts = explode(" ", $value);
|
|
|
|
|
+ if(is_numeric($value_parts[0]))
|
|
|
{
|
|
{
|
|
|
- $value = array_shift($value_parts);
|
|
|
|
|
- $advert = implode(" ", $value_parts);
|
|
|
|
|
|
|
+ if(count($value_parts) > 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ $value = array_shift($value_parts);
|
|
|
|
|
+ $advert = implode(" ", $value_parts);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $first_pos = array_shift($value_parts);
|
|
|
|
|
- $parts = preg_split('/:|-/', $first_pos);
|
|
|
|
|
- if(count($parts) == 2 and array_walk($parts, 'is_numeric'))
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- $value = $first_pos;
|
|
|
|
|
- $advert = implode(" ", $value_parts);
|
|
|
|
|
|
|
+ $first_pos = array_shift($value_parts);
|
|
|
|
|
+ $parts = preg_split('/:|-/', $first_pos);
|
|
|
|
|
+ if(count(array_filter($parts, 'is_numeric') === 2))
|
|
|
|
|
+ {
|
|
|
|
|
+ $value = $first_pos;
|
|
|
|
|
+ $advert = implode(" ", $value_parts);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count($ftp_account_detail_list) == 4 and $key == "Directory" ) )
|
|
|
|
|
+ echo "</table>\n</td><td>\n<table>\n";
|
|
|
|
|
+ if ($key == "Directory" )
|
|
|
|
|
+ $value = str_replace( "/./", "", $value );
|
|
|
|
|
+ if($key == "Username")
|
|
|
|
|
+ $readOnly = true;
|
|
|
|
|
+ echo "<tr><td>$key</td><td>
|
|
|
|
|
+ <input type=text name='$key' value='$value' ";
|
|
|
|
|
+
|
|
|
|
|
+ if(isset($readOnly) && ($readOnly)){
|
|
|
|
|
+ echo "readonly ";
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isset($advert))
|
|
|
|
|
+ echo "/>".
|
|
|
|
|
+ "</td><td>$advert</td></tr>\n";
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "/>".
|
|
|
|
|
+ "</td></tr>\n";
|
|
|
|
|
+ unset($readOnly, $key, $value, $advert);
|
|
|
}
|
|
}
|
|
|
- if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count($ftp_account_detail_list) == 4 and $key == "Directory" ) )
|
|
|
|
|
- echo "</table>\n</td><td>\n<table>\n";
|
|
|
|
|
- if ($key == "Directory" )
|
|
|
|
|
- $value = str_replace( "/./", "", $value );
|
|
|
|
|
- if($key == "Username")
|
|
|
|
|
- $readOnly = true;
|
|
|
|
|
- echo "<tr><td>$key</td><td>
|
|
|
|
|
- <input type=text name='$key' value='$value' ";
|
|
|
|
|
-
|
|
|
|
|
- if(isset($readOnly) && ($readOnly)){
|
|
|
|
|
- echo "readonly ";
|
|
|
|
|
- }
|
|
|
|
|
- if(isset($advert))
|
|
|
|
|
- echo "/>".
|
|
|
|
|
- "</td><td>$advert</td></tr>\n";
|
|
|
|
|
- else
|
|
|
|
|
- echo "/>".
|
|
|
|
|
- "</td></tr>\n";
|
|
|
|
|
- unset($readOnly, $key, $value, $advert);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ echo "<tr>
|
|
|
|
|
+ <td colspan='2' >
|
|
|
|
|
+ <center>
|
|
|
|
|
+ <input type=hidden name='remote_server_id' value='".$server_row['remote_server_id']."'/>
|
|
|
|
|
+ <input type=hidden name='ftp_login' value=\"" . str_replace('"', '"', $ftp_login) . "\"/>
|
|
|
|
|
+ <input type=submit name='edit_ftp_user' value='". change_account_details ."' />
|
|
|
|
|
+ </center>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <input type='image' name='del_ftp_user' onsubmit='submit-form();' src='modules/administration/images/remove.gif'>". remove_account ."</input>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ </tr>";
|
|
|
}
|
|
}
|
|
|
- echo "<tr>
|
|
|
|
|
- <td colspan='2' >
|
|
|
|
|
- <center>
|
|
|
|
|
- <input type=hidden name='remote_server_id' value='".$server_row['remote_server_id']."'/>
|
|
|
|
|
- <input type=hidden name='ftp_login' value=\"" . str_replace('"', '"', $ftp_login) . "\"/>
|
|
|
|
|
- <input type=submit name='edit_ftp_user' value='". change_account_details ."' />
|
|
|
|
|
- </center>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <input type='image' name='del_ftp_user' onsubmit='submit-form();' src='modules/administration/images/remove.gif'>". remove_account ."</input>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </table>
|
|
|
|
|
- </form>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>";
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ } // end: host_stat === 1
|
|
|
|
|
+
|
|
|
|
|
+ } // end: foreach $servers as $server_row
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ echo get_lang('no_remote_servers');
|
|
|
}
|
|
}
|
|
|
echo "</tbody>";
|
|
echo "</tbody>";
|
|
|
echo "</table>\n";
|
|
echo "</table>\n";
|