Ejemplo n.º 1
0
function csv_escape_string($p_str)
{
    if (strpos($p_str, csv_get_separator()) !== false) {
        $p_str = '"' . str_replace('"', '""', $p_str) . '"';
    }
    return $p_str;
}
Ejemplo n.º 2
0
/**
 * escape a string before writing it to csv file.
 * @param type $todo TODO
 * @return  TODO
 * @access public
 */
function csv_escape_string($p_str)
{
    $t_escaped = str_split('"' . csv_get_separator() . csv_get_newline());
    $t_must_escape = false;
    while (($t_char = current($t_escaped)) !== false && !$t_must_escape) {
        $t_must_escape = strpos($p_str, $t_char) !== false;
        next($t_escaped);
    }
    if ($t_must_escape) {
        $p_str = '"' . str_replace('"', '""', $p_str) . '"';
    }
    return $p_str;
}
Ejemplo n.º 3
0
require_api( 'file_api.php' );
require_api( 'filter_api.php' );
require_api( 'helper_api.php' );
require_api( 'print_api.php' );

auth_ensure_user_authenticated();

helper_begin_long_process();

$t_page_number = 1;
$t_per_page = -1;
$t_bug_count = null;
$t_page_count = null;

$t_nl = csv_get_newline();
$t_sep = csv_get_separator();

# Get bug rows according to the current filter
$t_rows = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
if ( $t_rows === false ) {
	print_header_redirect( 'view_all_set.php?type=0' );
}

$t_filename = csv_get_default_filename();

# Send headers to browser to activate mime loading

# Make sure that IE can download the attachments under https.
header( 'Pragma: public' );

header( 'Content-Type: text/plain; name=' . urlencode( file_clean_name( $t_filename ) ) );