source: branches/comu-utf8/html/upgrade/index.php @ 15099

Revision 15099, 1.6 KB checked in by Yammy, 17 years ago (diff)

UTF-8変換済みファイルインポート
1.3.4ベース

Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8require_once("../require.php");
9
10//ページ管理クラス
11class LC_Page {
12    //コンストラクタ
13    function LC_Page() {
14        //メインテンプレートの指定
15        $this->tpl_mainpage = 'upgrade/index.tpl';
16    }
17}
18
19$objPage = new LC_Page();
20$objView = new SC_SiteView();
21
22$con = ftp_connect("localhost");
23$res = ftp_login($con, "osuser", "password");
24if($con != false && $res != false) {
25    //ファイルのダウンロード
26    if($_POST['filename'] != "") {
27       
28        $download_file = DATA_PATH . "module/upload/" . $_POST['filename'];
29       
30        if(ftp_get($con, $download_file, $_POST['filename'], FTP_BINARY)) {
31            ftp_quit($con);
32            //ファイル所有者変更
33            echo "ファイルのダウンロードに成功しました。";
34            sfPrintR(exec("tar zxvf " . $download_file . " ./", $arrRes));
35        } else {
36            echo 'ファイルのダウンロードに失敗しました。';
37        }
38    }
39   
40    //ディレクトリ内の全てのファイルを取得
41    $arrRet = ftp_nlist($con, ".");
42    $i = 0;
43    //必要なファイル情報を取得
44    foreach($arrRet as $val) {
45        if(!ereg("^\.|^\..", $val)) {
46            $arrFile[$i]['filename'] = $val;
47            $arrFile[$i]['date'] = date("Y年m月d日", ftp_mdtm($con, $val));
48            $arrFile[$i]['filesize'] = number_format(ftp_size($con, $val))."Byte";
49            $i++;
50        }
51    }
52    $objPage->arrFile = $arrFile;
53}
54
55$objView->assignobj($objPage);      //変数をテンプレートにアサインする
56$objView->display(SITE_FRAME);      //テンプレートの出力
57
58//-------------------------------------------------------------------------------------------------------
59
60
61
62?>
Note: See TracBrowser for help on using the repository browser.