Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
b6e13be0
Commit
b6e13be0
authored
Jun 19, 2017
by
Armando Lüscher
Committed by
GitHub
Jun 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #520 from no-nevis/patch-1
Fix #518 - Properly saving Chat IDs
parents
80e7e5d5
63a31eaf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
38 deletions
+40
-38
CHANGELOG.md
CHANGELOG.md
+2
-0
DB.php
src/DB.php
+38
-38
No files found.
CHANGELOG.md
View file @
b6e13be0
...
...
@@ -12,6 +12,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Removed
-
[
:exclamation:
][
unreleased-bc-up-download-directory
]
Upload and download directories are not set any more by default and must be set manually.
### Fixed
-
ID fields are now typed with
`PARAM_STR`
PDO data type, to allow huge numbers.
-
Message type data type for PDO corrected.
### Security
## [0.44.1] - 2017-04-25
...
...
src/DB.php
View file @
b6e13be0
...
...
@@ -201,7 +201,7 @@ class DB
$sth
->
bindParam
(
':limit'
,
$limit
,
PDO
::
PARAM_INT
);
if
(
$id
!==
null
)
{
$sth
->
bindParam
(
':id'
,
$id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':id'
,
$id
,
PDO
::
PARAM_
STR
);
}
$sth
->
execute
();
...
...
@@ -327,13 +327,13 @@ class DB
(:id, :chat_id, :message_id, :inline_query_id, :chosen_inline_result_id, :callback_query_id, :edited_message_id)
'
);
$sth
->
bindParam
(
':id'
,
$id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':inline_query_id'
,
$inline_query_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chosen_inline_result_id'
,
$chosen_inline_result_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':callback_query_id'
,
$callback_query_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':edited_message_id'
,
$edited_message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':id'
,
$id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':inline_query_id'
,
$inline_query_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':chosen_inline_result_id'
,
$chosen_inline_result_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':callback_query_id'
,
$callback_query_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':edited_message_id'
,
$edited_message_id
,
PDO
::
PARAM_
STR
);
return
$sth
->
execute
();
}
catch
(
PDOException
$e
)
{
...
...
@@ -375,7 +375,7 @@ class DB
`updated_at` = VALUES(`updated_at`)
'
);
$sth
->
bindParam
(
':id'
,
$user_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':id'
,
$user_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':username'
,
$username
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':first_name'
,
$first_name
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':last_name'
,
$last_name
,
PDO
::
PARAM_STR
,
255
);
...
...
@@ -398,8 +398,8 @@ class DB
(:user_id, :chat_id)
'
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$status
=
$sth
->
execute
();
}
catch
(
PDOException
$e
)
{
...
...
@@ -449,14 +449,14 @@ class DB
if
(
$migrate_to_chat_id
)
{
$chat_type
=
'supergroup'
;
$sth
->
bindParam
(
':id'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':oldid'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':id'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':oldid'
,
$chat_id
,
PDO
::
PARAM_
STR
);
}
else
{
$sth
->
bindParam
(
':id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':oldid'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':oldid'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
STR
);
}
$sth
->
bindParam
(
':type'
,
$chat_type
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':type'
,
$chat_type
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':title'
,
$chat_title
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':username'
,
$chat_username
,
PDO
::
PARAM_STR
,
255
);
$sth
->
bindParam
(
':all_members_are_administrators'
,
$chat_all_members_are_administrators
,
PDO
::
PARAM_INT
);
...
...
@@ -616,8 +616,8 @@ class DB
$query
=
$inline_query
->
getQuery
();
$offset
=
$inline_query
->
getOffset
();
$sth
->
bindParam
(
':inline_query_id'
,
$inline_query_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':inline_query_id'
,
$inline_query_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':location'
,
$location
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':query'
,
$query
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':param_offset'
,
$offset
,
PDO
::
PARAM_STR
);
...
...
@@ -665,7 +665,7 @@ class DB
$query
=
$chosen_inline_result
->
getQuery
();
$sth
->
bindParam
(
':result_id'
,
$result_id
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':location'
,
$location
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':inline_message_id'
,
$inline_message_id
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':query'
,
$query
,
PDO
::
PARAM_STR
);
...
...
@@ -733,10 +733,10 @@ class DB
$inline_message_id
=
$callback_query
->
getInlineMessageId
();
$data
=
$callback_query
->
getData
();
$sth
->
bindParam
(
':callback_query_id'
,
$callback_query_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':callback_query_id'
,
$callback_query_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':user_id'
,
$user_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':inline_message_id'
,
$inline_message_id
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':data'
,
$data
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':created_at'
,
$date
,
PDO
::
PARAM_STR
);
...
...
@@ -868,13 +868,13 @@ class DB
$migrate_to_chat_id
=
$message
->
getMigrateToChatId
();
$pinned_message
=
$message
->
getPinnedMessage
();
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$from_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':user_id'
,
$from_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':date'
,
$date
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':forward_from'
,
$forward_from
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':forward_from_chat'
,
$forward_from_chat
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':forward_from_message_id'
,
$forward_from_message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':forward_from'
,
$forward_from
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':forward_from_chat'
,
$forward_from_chat
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':forward_from_message_id'
,
$forward_from_message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':forward_date'
,
$forward_date
,
PDO
::
PARAM_STR
);
$reply_to_chat_id
=
null
;
...
...
@@ -882,8 +882,8 @@ class DB
$reply_to_chat_id
=
$chat_id
;
}
$sth
->
bindParam
(
':reply_to_chat'
,
$reply_to_chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':reply_to_message'
,
$reply_to_message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':reply_to_chat'
,
$reply_to_chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':reply_to_message'
,
$reply_to_message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':text'
,
$text
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':entities'
,
$entities
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':audio'
,
$audio
,
PDO
::
PARAM_STR
);
...
...
@@ -896,16 +896,16 @@ class DB
$sth
->
bindParam
(
':contact'
,
$contact
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':location'
,
$location
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':venue'
,
$venue
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':new_chat_member'
,
$new_chat_member
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':left_chat_member'
,
$left_chat_member
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':new_chat_member'
,
$new_chat_member
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':left_chat_member'
,
$left_chat_member
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':new_chat_title'
,
$new_chat_title
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':new_chat_photo'
,
$new_chat_photo
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':delete_chat_photo'
,
$delete_chat_photo
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':group_chat_created'
,
$group_chat_created
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':supergroup_chat_created'
,
$supergroup_chat_created
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':channel_chat_created'
,
$channel_chat_created
,
PDO
::
PARAM_INT
);
$sth
->
bindParam
(
':migrate_from_chat_id'
,
$migrate_from_chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':migrate_to_chat_id'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':migrate_from_chat_id'
,
$migrate_from_chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':migrate_to_chat_id'
,
$migrate_to_chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':pinned_message'
,
$pinned_message
,
PDO
::
PARAM_STR
);
return
$sth
->
execute
();
...
...
@@ -964,9 +964,9 @@ class DB
$text
=
$edited_message
->
getText
();
$caption
=
$edited_message
->
getCaption
();
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':user_id'
,
$from_id
,
PDO
::
PARAM_
INT
);
$sth
->
bindParam
(
':chat_id'
,
$chat_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':message_id'
,
$message_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':user_id'
,
$from_id
,
PDO
::
PARAM_
STR
);
$sth
->
bindParam
(
':edit_date'
,
$edit_date
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':text'
,
$text
,
PDO
::
PARAM_STR
);
$sth
->
bindParam
(
':entities'
,
$entities
,
PDO
::
PARAM_STR
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment