Skip to content

Commit 86f5d57

Browse files
committed
Bug Fix
Corrected a bug in the upload script that removed too many <template> tags when the template included <learn> tags
1 parent 52c9184 commit 86f5d57

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

admin/upload.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ function parseAIML($fn,$aimlContent, $from_zip = false)
177177
$pattern = str_replace("'", ' ', $pattern);
178178
$that = $category->that;
179179
$template = $category->template->asXML();
180-
$template = str_replace('<template>', '', $template);
181-
$template = str_replace('</template>', '', $template);
182-
$aiml_add = str_replace("\r\n", '', $fullCategory);
183-
# Strip CRLF from category (windows)
184-
$aiml_add = str_replace("\n", '', $aiml_add);
185-
# Strip LF from category (mac/*nix)
180+
$template = ltrim($template,'<template>');
181+
$template = ltrim($template,"\r\n ");
182+
$template = rtrim($template,'</template>');
183+
$template = rtrim($template,"\r\n");
184+
# Strip CRLF and LF from category (Windows/mac/*nix)
185+
$aiml_add = str_replace(array("\r\n", "\n"), '', $fullCategory);
186186
$sql_add = str_replace('[aiml_add]', mysql_real_escape_string($aiml_add), $sql_template);
187187
$sql_add = str_replace('[pattern]', $pattern, $sql_add);
188188
$sql_add = str_replace('[that]', $that, $sql_add);

0 commit comments

Comments
 (0)