Skip to content

Commit

Permalink
Adds handling for tabs and newlines internal to responses (converts t…
Browse files Browse the repository at this point in the history
…o {tab} {newline} on export, then converts back on import.)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1198 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Sep 19, 2004
1 parent eccb720 commit 9853b7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions admin/vvexport.php
Expand Up @@ -69,7 +69,7 @@
</tr>
<input type='hidden' name='action' value='export'>
</form>
<tr><td colspan='2' align='center'>[<a href='$scriptname?sid=4'>"._B_ADMIN_BT."</a>]</td></tr>
<tr><td colspan='2' align='center'>[<a href='$scriptname?sid=$sid'>"._B_ADMIN_BT."</a>]</td></tr>
</table>";
}
elseif (isset($sid) && $sid)
Expand Down Expand Up @@ -114,7 +114,10 @@
{
foreach ($fieldnames as $field)
{
echo $row[$field].$s;
$value=str_replace("\n", "{newline}", $row[$field]);
$value=str_replace("\r", "", $value);
$value=str_replace("\t", "{tab}", $value);
echo $value.$s;
}
echo "\n";
}
Expand Down
6 changes: 3 additions & 3 deletions admin/vvimport.php
Expand Up @@ -103,7 +103,7 @@
$handle = fopen($the_full_file_path, "r");
while (!feof($handle))
{
$buffer = fgets($handle, 10240); //To allow for very long lines (up to 10k)
$buffer = fgets($handle, 20480); //To allow for very long lines (up to 10k)
$bigarray[] = $buffer;
}
fclose($handle);
Expand Down Expand Up @@ -150,7 +150,7 @@
if (trim($row) != "")
{
$fieldvalues=explode("\t", mysql_escape_string(str_replace("\n", "", $row)), $fieldcount+1);
if (isset($donotimport))
if (isset($donotimport)) //remove any fields which no longer exist
{
foreach ($donotimport as $not)
{
Expand All @@ -174,7 +174,7 @@
echo "<font color='green'>"._SUCCESS."</font>
File upload completed.<br /><br />
<i>Note: Do NOT refresh this page</i><br /><br />";
echo "[<a href='$scriptname?sid=4'>"._B_ADMIN_BT."</a>]";
echo "[<a href='browse.php?sid=$sid'>"._BROWSERESPONSES."</a>]";
echo "</td></tr></table>";
}
?>

0 comments on commit 9853b7b

Please sign in to comment.