~hexmode/+junk/main

« back to all changes in this revision

Viewing changes to install-files/apps/phpmyadmin2.10.1/libraries/transformations/application_octetstream__download.inc.php

  • Committer: Mark A. Hershberger
  • Date: 2008-01-05 19:38:56 UTC
  • Revision ID: hershberger@spawn-xp-20080105193856-6rnzgwa4nehue3qj
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* $Id: application_octetstream__download.inc.php 9617 2006-10-26 14:58:40Z nijel $ */
 
3
// vim: expandtab sw=4 ts=4 sts=4:
 
4
 
 
5
function PMA_transformation_application_octetstream__download(&$buffer, $options = array(), $meta = '') {
 
6
    global $row, $fields_meta;
 
7
 
 
8
    if (isset($options[0]) && !empty($options[0])) {
 
9
        $cn = $options[0]; // filename
 
10
    } else {
 
11
        if (isset($options[1]) && !empty($options[1])) {
 
12
            foreach($fields_meta as $key => $val) {
 
13
                if ($val->name == $options[1]) {
 
14
                    $pos = $key;
 
15
                    break;
 
16
                }
 
17
            }
 
18
            if (isset($pos)) {
 
19
                $cn = $row[$pos];
 
20
            }
 
21
        } 
 
22
        if (empty($cn)) {
 
23
            $cn = 'binary_file.dat';
 
24
        }
 
25
    }
 
26
 
 
27
    return
 
28
      sprintf(
 
29
        '<a href="transformation_wrapper.php%s&amp;ct=application/octet-stream&amp;cn=%s" title="%s">%s</a>',
 
30
 
 
31
        $options['wrapper_link'],
 
32
        urlencode($cn),
 
33
        htmlspecialchars($cn),
 
34
        htmlspecialchars($cn)
 
35
      );
 
36
}
 
37
 
 
38
?>