diff --git a/bin/uce_fastcgi.debug.linux.bin b/bin/uce_fastcgi.debug.linux.bin index 2d7c20b..8e2e73e 100755 Binary files a/bin/uce_fastcgi.debug.linux.bin and b/bin/uce_fastcgi.debug.linux.bin differ diff --git a/src/lib/compiler.h b/src/lib/compiler.h index 8b740f6..acdbb9b 100644 --- a/src/lib/compiler.h +++ b/src/lib/compiler.h @@ -7,6 +7,7 @@ string process_html_literal(Request* context, SharedUnit* su, string content) string HT_END = ")\");"; u8 mode = 0; + char quote_char; bool inside_quote = false; string code_buffer = ""; bool is_field = false; @@ -14,61 +15,72 @@ string process_html_literal(Request* context, SharedUnit* su, string content) for(u32 i = 0; i < content.length(); i++) { char c = content[i]; - if(mode == 1) + + switch(mode) { - if(c == '\"') - { - inside_quote = !inside_quote; - code_buffer.append(1, c); - } - else if(c == '?' && content[i+1] == '>') - { - mode = 0; - i += 1; - if(is_field) + case(0): + if(c == '<' && content[i+1] == '?') { - pc.append( - HT_END + - "echo(html_escape( " + - code_buffer + - " )); " + - HT_START - ); + code_buffer = ""; + if(content[i+2] == '=') + { + is_field = true; + i += 2; + } + else + { + is_field = false; + i += 1; + } + mode = 1; // code-parsing mode } else { - pc.append(HT_END + code_buffer + HT_START); + pc.append(1, c); } - } - else - { - code_buffer.append(1, c); - } - } - else if(!inside_quote && c == '<' && content[i+1] == '?') - { - code_buffer = ""; - if(content[i+2] == '=') - { - is_field = true; - i += 2; - } - else - { - is_field = false; - i += 1; - } - mode = 1; - } - /*else if(c == '\"') - { - inside_quote = !inside_quote; - pc.append(1, c); - }*/ - else - { - pc.append(1, c); + break; + case(1): + if(inside_quote) + { + if(quote_char == c && content[i-1] != '\\') + inside_quote = false; + code_buffer.append(1, c); + } + else + { + if(c == '\"' || c == '\'') + { + inside_quote = true; + quote_char = c; + code_buffer.append(1, c); + } + else if(c == '?' && content[i+1] == '>') + { + mode = 0; + i += 1; + if(is_field) + { + pc.append( + HT_END + + "echo(html_escape( " + + code_buffer + + " )); " + + HT_START + ); + } + else + { + pc.append(HT_END + code_buffer + HT_START); + } + } + else + { + code_buffer.append(1, c); + } + } + break; } + } return(HT_START + pc + HT_END); diff --git a/src/lib/mysql-connector.cpp b/src/lib/mysql-connector.cpp index bf91b1b..81b80e5 100644 --- a/src/lib/mysql-connector.cpp +++ b/src/lib/mysql-connector.cpp @@ -75,7 +75,11 @@ bool MySQL::query(string query) bool MySQL::query(string query, StringMap params) { - return(query(parse_query_parameters(query, params))); + auto res = mysql_query( + (MYSQL*)connection, + parse_query_parameters(query, params).c_str() + ); + return(true); } string MySQL::parse_query_parameters(string query, StringMap map)