コード例 #1
0
ファイル: ftp.php プロジェクト: atarubi/nuke-viet
 $ftp_user_name = nv_unhtmlspecialchars($array_config['ftp_user_name']);
 $ftp_user_pass = nv_unhtmlspecialchars($array_config['ftp_user_pass']);
 $ftp_path = nv_unhtmlspecialchars($array_config['ftp_path']);
 if (!defined('NV_FTP_CLASS')) {
     require NV_ROOTDIR . '/includes/class/ftp.class.php';
 }
 $ftp = new NVftp($ftp_server, $ftp_user_name, $ftp_user_pass, array('timeout' => 10), $ftp_port);
 if (!empty($ftp->error)) {
     $array_config['ftp_check_login'] = 3;
     $error = (string) $ftp->error;
 } elseif ($ftp->chdir($ftp_path) === false) {
     $array_config['ftp_check_login'] = 2;
     $error = $lang_global['ftp_error_path'];
 } else {
     $check_files = array(NV_CACHEDIR, NV_DATADIR, "images", "includes", "index.php", "js", "language", NV_LOGS_DIR, "mainfile.php", "modules", NV_SESSION_SAVE_PATH, "themes", NV_TEMP_DIR, NV_UPLOADS_DIR);
     $list_files = $ftp->listDetail($ftp_path, 'all');
     $a = 0;
     if (!empty($list_files)) {
         foreach ($list_files as $filename) {
             if (in_array($filename['name'], $check_files)) {
                 ++$a;
             }
         }
     }
     if ($a == sizeof($check_files)) {
         $array_config['ftp_check_login'] = 1;
     } else {
         $array_config['ftp_check_login'] = 2;
         $error = $lang_global['ftp_error_path'];
     }
 }