Changeset 8630 for temp/trunk/html
- Timestamp:
- 2006/11/19 21:07:17 (20 years ago)
- Location:
- temp/trunk/html
- Files:
-
- 3 edited
-
require.php (modified) (1 diff)
-
test/uehara/file_view.php (modified) (1 diff)
-
test/uehara/tree.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/html/require.php
r7199 r8630 31 31 require_once($include_dir . "/../data/class/SC_Pdf.php"); 32 32 require_once($include_dir . "/../data/include/page_layout.inc"); 33 require_once($include_dir . "/../data/include/file_manager.inc"); 33 34 34 35 // ¥¢¥Ã¥×¥Ç¡¼¥È¤Ç¼èÆÀ¤·¤¿PHP¤òÆÉ¤ß½Ð¤¹ -
temp/trunk/html/test/uehara/file_view.php
r8625 r8630 11 11 // ¥Õ¥¡¥¤¥ëÆâÍÆÉ½¼¨ 12 12 print("<pre>\n"); 13 print( lfReadFile(USER_PATH.$_GET['file']));13 print(nl2br(lfReadFile(USER_PATH.$_GET['file']))); 14 14 print("</pre>\n"); 15 15 16 /*17 * ´Ø¿ô̾¡§lfReadFile()18 * °ú¿ô1 ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹19 * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ëÆÉ¹þ20 */21 function lfReadFile($filename) {22 $str = "";23 // ¥Ð¥¤¥Ê¥ê¥â¡¼¥É¤Ç¥ª¡¼¥×¥ó24 $fp = @fopen($filename, "rb" );25 //¥Õ¥¡¥¤¥ëÆâÍÆ¤òÁ´¤ÆÊÑ¿ô¤ËÆÉ¤ß¹þ¤à26 if($fp) {27 $str = @fread($fp, filesize($filename)+1);28 }29 @fclose($fp);30 // ²þ¹Ô¥³¡¼¥É¤ÎÁ°¤Ë<br />¤òÁÞÆþ31 $str = nl2br($str);32 return $str;33 }34 16 ?> -
temp/trunk/html/test/uehara/tree.php
r8628 r8630 48 48 $objPage->tpl_javascript = "alert('¢¨¡¡¥Ç¥£¥ì¥¯¥È¥ê¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£');"; 49 49 } else { 50 // ¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¤Ï¥À¥¦¥ó¥í¡¼¥É¤µ¤»¤ë 51 Header("Content-disposition: attachment; filename=".basename($_POST['select_file'])); 52 Header("Content-type: application/octet-stream; name=".basename($_POST['select_file'])); 53 Header("Cache-Control: "); 54 Header("Pragma: "); 55 echo (lfReadFile($_POST['select_file'])); 56 50 // ¥Õ¥¡¥¤¥ë¥À¥¦¥ó¥í¡¼¥É 51 lfDownloadFile($_POST['select_file']); 57 52 exit; 58 53 } … … 80 75 81 76 /* 82 * ´Ø¿ô̾¡§lfGetFileList()83 * ÀâÌÀ¡¡¡§»ØÄê¥Ñ¥¹ÇÛ²¼¤Î¥Ç¥£¥ì¥¯¥È¥ê¼èÆÀ84 * °ú¿ô1 ¡§¥Ä¥ê¡¼¤ò³ÊǼÇÛÎó85 * °ú¿ô2 ¡§¼èÆÀ¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¥Ñ¥¹86 */87 function lfGetFileList($dir) {88 $arrFileList = array();89 if (is_dir($dir)) {90 if ($dh = opendir($dir)) {91 $cnt = 0;92 while (($file = readdir($dh)) !== false) {93 // ./ ¤È ../¤ò½ü¤¯¥Õ¥¡¥¤¥ë¤Î¤ß¤ò¼èÆÀ94 if($file != "." && $file != "..") {95 // ¹ÔËö¤Î/¤ò¼è¤ê½ü¤¯96 $dir = ereg_replace("\/$", "", $dir);97 $path = $dir."/".$file;98 $arrFileList[$cnt]['file_name'] = $file;99 $arrFileList[$cnt]['file_path'] = $path;100 $arrFileList[$cnt]['file_size'] = getDirSize($path);101 $arrFileList[$cnt]['file_time'] = date("Y/m/d", filemtime($path));102 $cnt++;103 }104 }105 closedir($dh);106 }107 }108 109 return $arrFileList;110 }111 112 /*113 * ´Ø¿ô̾¡§getDirSize()114 * ÀâÌÀ¡¡¡§»ØÄꤷ¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Ð¥¤¥È¿ô¤ò¼èÆÀ115 * °ú¿ô1 ¡§¥Õ¥¡¥¤¥ë³ÊǼÇÛÎó116 */117 function getDirSize($dir) {118 if(file_exists($dir)) {119 // ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç²¼ÁØ¥Õ¥¡¥¤¥ë¤ÎÁíÎ̤ò¼èÆÀ120 if (is_dir($dir)) {121 $handle = opendir($dir);122 while ($file = readdir($handle)) {123 $path = $dir."/".$file;124 if ($file != '..' && $file != '.' && !is_dir($path)) {125 $bytes += filesize($path);126 } else if (is_dir($path) && $file != '..' && $file != '.') {127 $bytes += getDirSize($path);128 }129 }130 } else {131 // ¥Õ¥¡¥¤¥ë¤Î¾ì¹ç132 $bytes = filesize($dir);133 }134 } else {135 // ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï0byte¤òÊÖ¤¹136 $bytes = 0;137 }138 139 if($bytes == "") $bytes = 0;140 141 return $bytes;142 }143 144 /*145 77 * ´Ø¿ô̾¡§lfErrorCheck() 146 78 * ÀâÌÀ¡¡¡§¥¨¥é¡¼¥Á¥§¥Ã¥¯ … … 154 86 } 155 87 156 /*157 * ´Ø¿ô̾¡§lfReadFile()158 * °ú¿ô1 ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹159 * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ëÆÉ¹þ160 */161 function lfReadFile($filename) {162 $str = "";163 // ¥Ð¥¤¥Ê¥ê¥â¡¼¥É¤Ç¥ª¡¼¥×¥ó164 $fp = @fopen($filename, "rb" );165 //¥Õ¥¡¥¤¥ëÆâÍÆ¤òÁ´¤ÆÊÑ¿ô¤ËÆÉ¤ß¹þ¤à166 if($fp) {167 $str = @fread($fp, filesize($filename)+1);168 }169 @fclose($fp);170 return $str;171 }172 88 ?>
Note: See TracChangeset
for help on using the changeset viewer.
