Example #1
0
             $ftp->tempHandle = null;
             if (mb_strlen($ui->post['cleanedconfig'], 'UTF-8') < 16385) {
                 $ftp->writeContentToTemp(stripslashes($ui->post['cleanedconfig']));
             } else {
                 $post_lines = explode('<br />', nl2br(stripslashes($ui->post['cleanedconfig'])));
                 $post_lines[] = "\r\n";
                 $post_lines[] = "\r\n";
                 $post_lines[] = "\r\n";
                 foreach ($post_lines as $line) {
                     $ftp->writeContentToTemp($line == "\r\n" ? $line : $line . "\r\n");
                 }
             }
         }
     }
     $uploaded = false;
     if ($ftp->uploadFileFromTemp($ftp->removeSlashes($pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/'), $config, false)) {
         $uploaded = true;
     }
     if ($uploaded == false and $ftp->uploadFileFromTemp($ftp->removeSlashes($homeDir . '/' . $pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/'), $config, false)) {
         $uploaded = true;
     }
     if ($uploaded) {
         $template_file = 'Success: ' . $config;
         $loguseraction = '%cfg% ' . $configname;
         $insertlog->execute();
     } else {
         $template_file = 'Error writing config: ' . $config;
     }
 } else {
     if (isset($lines)) {
         $linearray = array();
Example #2
0
        $ftppass = $row['dftppass'];
        $username = $row['newlayout'] == 'Y' ? $row['cname'] . '-' . $row['id'] : $row['cname'];
        if ($row['protected'] == 'N' and $row['servertemplate'] > 1) {
            $shorten .= '-' . $row['servertemplate'];
            $pserver = 'server/';
        } else {
            if ($row['protected'] == 'Y') {
                $username .= '-p';
                $ftppass = $row['decryptedftppass'];
                $pserver = '';
            } else {
                $pserver = 'server/';
            }
        }
        $ftpConnect = new EasyWiFTP($row['ftp_ip'], $row['ftpport'], $username, $ftppass);
        $downloadChrooted = $ftpConnect->removeSlashes($pserver . $row['serverip'] . '_' . $row['port'] . '/' . $shorten . '/' . $row['binarydir'] . '/screenlog.0');
        if ($ftpConnect->ftpConnection) {
            if (!$ftpConnect->downloadToTemp($downloadChrooted, 32768, false, $ui->isinteger('lastLog', 'get'))) {
                $array['error'] = 'Cannot download screenlog from ' . $downloadChrooted;
            } else {
                $array['lastLog'] = $ftpConnect->getLastFileSize();
                $array['log'] = nl2br($ftpConnect->getTempFileContent());
            }
        } else {
            $array['error'] = 'Cannot connect to FTP Server ' . $row2['ip'] . ':' . $row2['ftpport'];
        }
    }
}
if ($query->rowCount() < 1) {
    $array['error'] = 'Error: No rootID';
}
Example #3
0
             $username .= '-p';
             $ftppass = $row['decryptedftppass'];
             $pserver = '';
         } else {
             $pserver = 'server/';
         }
     }
 }
 if (isset($rootID)) {
     $query = $sql->prepare("SELECT `ip`,`ftpport` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
     $query->execute(array($rootID, $resellerLockupID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $ftpport = $row['ftpport'];
         $ip = $row['ip'];
         $ftpConnect = new EasyWiFTP($ip, $ftpport, $username, $ftppass);
         $downloadChrooted = $ftpConnect->removeSlashes($pserver . $serverip . '_' . $port . '/' . $shorten . '/' . $binarydir . '/screenlog.0');
         if ($ftpConnect->ftpConnection) {
             if (!$ftpConnect->downloadToTemp($downloadChrooted, 32768)) {
                 $error = 'Cannot download screenlog from ' . $downloadChrooted;
             }
         } else {
             $error = 'Cannot connect to FTP Server ' . $ip . ':' . $ftpport;
         }
     }
     if (isset($ip)) {
         $log = isset($error) ? $error : nl2br($ftpConnect->getTempFileContent());
         $ftpConnect->tempHandle = null;
         $ftpConnect = null;
     } else {
         $log = 'Error: wrong rootID';
     }