Changeset 11320 for trunk


Ignore:
Timestamp:
2006-03-09T14:50:45+13:00 (18 years ago)
Author:
mdewsnip
Message:

Now deals with "<" and ">" characters correctly in the submitted text strings.

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/gtiaction.cpp

    r11210 r11320  
    439439      submission_text += &cgi_argument_name_cstr[strlen(source_chunk_key_start_cstr)];
    440440      submission_text += "\">\n";
    441       submission_text += to_utf8(args[cgi_argument->first]) + "\n";
     441      submission_text += to_utf8(xml_safe(args[cgi_argument->first])) + "\n";
    442442      submission_text += "</SourceFileText>\n";
    443443    }
     
    447447      submission_text += &cgi_argument_name_cstr[strlen(target_chunk_key_start_cstr)];
    448448      submission_text += "\">\n";
    449       submission_text += to_utf8(args[cgi_argument->first]) + "\n";
     449      submission_text += to_utf8(xml_safe(args[cgi_argument->first])) + "\n";
    450450      submission_text += "</TargetFileText>\n";
    451451    }
     
    485485
    486486  return text_string_escaped;
     487}
     488
     489
     490
     491text_t gtiaction::xml_safe(const text_t &text_string)
     492{
     493  text_t text_string_safe;
     494  text_t::const_iterator here = text_string.begin();
     495  text_t::const_iterator end = text_string.end();
     496  while (here != end) {
     497    if (*here == '<') text_string_safe += "&lt;";
     498    else if (*here == '>') text_string_safe += "&gt;";
     499    else text_string_safe.push_back(*here);
     500    ++here;
     501  }
     502
     503  return text_string_safe;
    487504}
    488505
  • trunk/gsdl/src/recpt/gtiaction.h

    r10148 r11320  
    105105  text_t escape_all(text_t source_string, char character_to_escape);
    106106
     107  text_t xml_safe(const text_t &text_string);
     108
    107109  void process_gti_submissions(displayclass& disp, cgiargsclass& args, ostream& logout, bool force_submission);
    108110
Note: See TracChangeset for help on using the changeset viewer.