Now, the entry->concept and alias->alias fields are trimmed
in edit, import, export, backup and restore. To solve bug 985 (http://moodle.org/bugs/bug.php?op=show&bugid=985)
This commit is contained in:
@@ -157,7 +157,7 @@
|
||||
|
||||
fwrite ($bf,full_tag("ID",6,false,$glo_ent->id));
|
||||
fwrite ($bf,full_tag("USERID",6,false,$glo_ent->userid));
|
||||
fwrite ($bf,full_tag("CONCEPT",6,false,$glo_ent->concept));
|
||||
fwrite ($bf,full_tag("CONCEPT",6,false,trim($glo_ent->concept)));
|
||||
fwrite ($bf,full_tag("DEFINITION",6,false,$glo_ent->definition));
|
||||
fwrite ($bf,full_tag("FORMAT",6,false,$glo_ent->format));
|
||||
fwrite ($bf,full_tag("ATTACHMENT",6,false,$glo_ent->attachment));
|
||||
@@ -257,7 +257,7 @@
|
||||
foreach ($aliases as $alias) {
|
||||
$status =fwrite ($bf,start_tag("ALIAS",7,true));
|
||||
|
||||
fwrite ($bf,full_tag("ALIAS_TEXT",8,false,$alias->alias));
|
||||
fwrite ($bf,full_tag("ALIAS_TEXT",8,false,trim($alias->alias)));
|
||||
|
||||
$status =fwrite ($bf,end_tag("ALIAS",7,true));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ if ( $confirm ) {
|
||||
$newentry->course = $glossary->course;
|
||||
$newentry->glossaryid = $glossary->id;
|
||||
|
||||
$newentry->concept = $form->concept;
|
||||
$newentry->concept = trim($form->concept);
|
||||
$newentry->definition = $form->text;
|
||||
$newentry->format = $form->format;
|
||||
$newentry->usedynalink = $form->usedynalink;
|
||||
@@ -169,6 +169,7 @@ echo "Creating!!!!!";
|
||||
if ( isset($form->aliases) ) {
|
||||
if ( $aliases = explode("\n",$form->aliases) ) {
|
||||
foreach ($aliases as $alias) {
|
||||
$alias = trim($alias);
|
||||
if ($alias) {
|
||||
unset($newalias);
|
||||
$newalias->entryid = $e;
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
$xmlentry = $xmlentries[$i];
|
||||
|
||||
unset($newentry);
|
||||
$newentry->concept = addslashes(utf8_decode($xmlentry['#']['CONCEPT'][0]['#']));
|
||||
$newentry->concept = addslashes(trim(utf8_decode($xmlentry['#']['CONCEPT'][0]['#'])));
|
||||
$newentry->definition = addslashes(utf8_decode($xmlentry['#']['DEFINITION'][0]['#']));
|
||||
|
||||
$permissiongranted = 1;
|
||||
@@ -208,7 +208,7 @@
|
||||
unset($newalias);
|
||||
|
||||
$newalias->entryid = $newentry->id;
|
||||
$newalias->alias = addslashes(utf8_decode($xmlalias['#']['NAME'][0]['#']));
|
||||
$newalias->alias = addslashes(trim(utf8_decode($xmlalias['#']['NAME'][0]['#'])));
|
||||
$newalias->id = insert_record("glossary_alias",$newalias);
|
||||
}
|
||||
|
||||
|
||||
@@ -1576,7 +1576,7 @@ global $CFG;
|
||||
}
|
||||
if ( $entry->approved and $permissiongranted ) {
|
||||
$status = fwrite($h,glossary_start_tag("ENTRY",3,true));
|
||||
fwrite($h,glossary_full_tag("CONCEPT",4,false,$entry->concept));
|
||||
fwrite($h,glossary_full_tag("CONCEPT",4,false,trim($entry->concept)));
|
||||
fwrite($h,glossary_full_tag("DEFINITION",4,false,$entry->definition));
|
||||
fwrite($h,glossary_full_tag("FORMAT",4,false,$entry->format));
|
||||
fwrite($h,glossary_full_tag("USEDYNALINK",4,false,$entry->usedynalink));
|
||||
@@ -1588,7 +1588,7 @@ global $CFG;
|
||||
$status = fwrite ($h,glossary_start_tag("ALIASES",4,true));
|
||||
foreach ($aliases as $alias) {
|
||||
$status = fwrite ($h,glossary_start_tag("ALIAS",5,true));
|
||||
fwrite($h,glossary_full_tag("NAME",6,false,$alias->alias));
|
||||
fwrite($h,glossary_full_tag("NAME",6,false,trim($alias->alias)));
|
||||
$status = fwrite($h,glossary_end_tag("ALIAS",5,true));
|
||||
}
|
||||
$status = fwrite($h,glossary_end_tag("ALIASES",4,true));
|
||||
@@ -1656,7 +1656,7 @@ require_once "../../lib/xmlize.php";
|
||||
$line = '';
|
||||
if ($h) {
|
||||
while ( !feof($h) ) {
|
||||
$char = fread($h,1024);
|
||||
$char = fread($h,1024);
|
||||
$line .= $char;
|
||||
}
|
||||
fclose($h);
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
//Now, build the GLOSSARY_ENTRIES record structure
|
||||
$entry->glossaryid = $new_glossary_id;
|
||||
$entry->userid = backup_todb($ent_info['#']['USERID']['0']['#']);
|
||||
$entry->concept = backup_todb($ent_info['#']['CONCEPT']['0']['#']);
|
||||
$entry->concept = backup_todb(trim($ent_info['#']['CONCEPT']['0']['#']));
|
||||
$entry->definition = backup_todb($ent_info['#']['DEFINITION']['0']['#']);
|
||||
$entry->format = backup_todb($ent_info['#']['FORMAT']['0']['#']);
|
||||
$entry->attachment = backup_todb($ent_info['#']['ATTACHMENT']['0']['#']);
|
||||
@@ -311,7 +311,7 @@
|
||||
|
||||
//Now, build the GLOSSARY_ALIAS record structure
|
||||
$alias->entryid = $new_entry_id;
|
||||
$alias->alias = backup_todb($alias_info['#']['ALIAS_TEXT']['0']['#']);
|
||||
$alias->alias = backup_todb(trim($alias_info['#']['ALIAS_TEXT']['0']['#']));
|
||||
|
||||
//The structure is equal to the db, so insert the glossary_comments
|
||||
$newid = insert_record ("glossary_alias",$alias);
|
||||
|
||||
Reference in New Issue
Block a user