Fixed a very fool error, added markdown escaper

This commit is contained in:
giuliof 2017-11-23 22:59:22 +01:00
parent d69033521a
commit deb91de5e1
1 changed files with 11 additions and 5 deletions

View File

@ -142,7 +142,7 @@ if (isset ($row->callback_query)) {
die();
}
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as DateTime,Text,Author,ID FROM ".MYSQL_TABLE."
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as DateTimeFormat,Text,Author,ID FROM ".MYSQL_TABLE."
ORDER BY DateTime ASC LIMIT 1 OFFSET $offset") or error("Can't make the query, SQL error ".$sql->error);
//while($row = $query->fetch_assoc()) {
@ -160,7 +160,7 @@ if (isset ($row->callback_query)) {
$container = array(
array(
array(
"text" => $row['DateTime'],
"text" => $row['DateTimeFormat'],
"callback_data" => "null"
)));
@ -470,6 +470,12 @@ if (isset ($row->callback_query)) {
$currentTab = $mc->get($chatID.MC_DATE_MSG);
$msg = $mc->get($chatID.MC_FORWARD_MSG);
// BEGIN TextEscaper
$text = $msg->message->text;
$text = str_replace(array("_","*"), array("\_","\*"), $text);
// END TextEscaper
// add to database (mysql)
$sql = new mysqli('localhost', MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
// Build up mysql query
@ -484,7 +490,7 @@ if (isset ($row->callback_query)) {
$value .= $callback_data.":00:00'";
$value .= ",";
if (isset($msg->message->text))
$value .= "'".$sql->escape_string($msg->message->text)."'";
$value .= "'".$sql->escape_string($text)."'";
else
$value .= "''";
$value .= ",";
@ -575,7 +581,7 @@ elseif (isset($row->message)) {
die();
}
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as ChatID, MessageID,DateTime,Text,Author,ID FROM ".MYSQL_TABLE."
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as DateTimeFormat,ChatID, MessageID,Text,Author,ID FROM ".MYSQL_TABLE."
ORDER BY DateTime ASC LIMIT 1") or error("Can't make the query, SQL error ".$sql->error);
//while($row = $query->fetch_assoc()) {
@ -588,7 +594,7 @@ elseif (isset($row->message)) {
$container = array(
array(
array(
"text" => $row['DateTime'],
"text" => $row['DateTimeFormat'],
"callback_data" => "null"
)));