Changeset 1014
- Timestamp:
- 03/01/09 15:37:49 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
common/external_libs/zipfile.php (added)
-
www/controllers/attachment.php (modified) (2 diffs)
-
www/index.php (modified) (1 diff)
-
www/utilities.php (modified) (1 diff)
-
www/views/listattach.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/controllers/attachment.php
r997 r1014 5 5 require_once(IA_ROOT_DIR."common/db/attachment.php"); 6 6 require_once(IA_ROOT_DIR.'www/controllers/zip_attachment.php'); 7 require_once(IA_ROOT_DIR."common/external_libs/zipfile.php"); 7 8 8 9 // Try to get the textblock model for a certain page. … … 361 362 } else { 362 363 // redirect to main page 363 header("Location: " . url_absolute(url_home())); 364 redirect(url_absolute(url_home())); 365 } 366 } 367 368 function controller_attachment_downloadZip($page_name, $arguments) { 369 if(http_referer_check()) { 370 $files = array(); 371 foreach($arguments as $value) { 372 if(is_numeric($value)) $files[] = request($value); 373 } 374 $zipfile = new zipfile(); 375 foreach($files as $filename) { 376 $attach = try_attachment_get($page_name, $filename); 377 $contents = ""; 378 foreach(file(attachment_get_filepath($attach)) as $line) $contents .= $line; 379 $zipfile->add_file($contents, $filename); 380 } 381 382 header("Content-type: application/octet-stream"); 383 header("Content-disposition: attachment; filename=$page_name.zip"); 384 echo $zipfile->file(); 385 } else { 386 // redirect to main page 387 redirect(url_absolute(url_home())); 364 388 } 365 389 } -
trunk/www/index.php
r987 r1014 212 212 } 213 213 } 214 else if ($action == 'download-zip') { 215 require_once(IA_ROOT_DIR.'www/controllers/attachment.php'); 216 controller_attachment_downloadZip($page, request_args()); 217 } 214 218 215 219 // reset password -
trunk/www/utilities.php
r997 r1014 7 7 { 8 8 return htmlentities($string, $quote_style, $charset); 9 } 10 11 // returns an array of all arguments in REQUEST 12 function request_args() { 13 $result = array(); 14 foreach($_REQUEST as $key => $value) { 15 $result[] = $key; 16 } 17 return $result; 9 18 } 10 19 -
trunk/www/views/listattach.php
r997 r1014 3 3 require_once(IA_ROOT_DIR . "www/format/table.php"); 4 4 require_once(IA_ROOT_DIR . "www/format/format.php"); 5 5 6 ?> 6 7 … … 48 49 } 49 50 51 function format_attach_zip($row) { 52 $attachurl = "<input type='checkbox' name='" . $row['id'] . "' value='" . $row['name'] . "'>"; 53 54 return $attachurl; 55 } 56 50 57 function format_ip($row) { 51 58 if ($row['remote_ip_info'] && identity_can('attach-view-ip', $row)) { … … 69 76 70 77 $column_infos = array( 78 array ( 79 'title' => '', 80 'key' => 'zip', 81 'rowform' => 'format_attach_zip' 82 ), 71 83 array( 72 84 'title' => 'Numar', … … 105 117 ); 106 118 ?> 107 119 <form method = 'get' action = '' target = '_blank'> 120 <input type = 'hidden' name = 'action' value = 'download-zip'> 108 121 <h1>Atasamente pentru pagina <?= format_link(url_textblock($view['page_name']), $view['page_name']) ?></h1> 109 122 <?php … … 122 135 123 136 <p><?= format_link(url_attachment_new($page_name), 'Ataseaza un alt fisier') ?></p> 124 137 <?php 138 if($view['total_entries']) { 139 ?> 140 <p><input type="submit" value="Descarca ZIP" class="button"/></p> 141 <?php } ?> 142 </form> 125 143 <?php include('footer.php'); ?>
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)