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
5bc3aece
Unverified
Commit
5bc3aece
authored
Apr 22, 2018
by
Avtandil Kikabidze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat the file
parent
a9679668
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
79 deletions
+79
-79
DB.php
src/DB.php
+79
-79
No files found.
src/DB.php
View file @
5bc3aece
...
...
@@ -144,7 +144,7 @@ class DB
];
foreach
(
$tables
as
$table
)
{
$table_name
=
'TB_'
.
strtoupper
(
$table
);
if
(
!
defined
(
$table_name
))
{
if
(
!
defined
(
$table_name
))
{
define
(
$table_name
,
self
::
$table_prefix
.
$table
);
}
}
...
...
@@ -181,7 +181,7 @@ class DB
*/
public
static
function
selectTelegramUpdate
(
$limit
=
null
,
$id
=
null
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -228,7 +228,7 @@ class DB
*/
public
static
function
selectMessages
(
$limit
=
null
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -281,7 +281,7 @@ class DB
*/
public
static
function
entitiesArrayToJson
(
$entities
,
$default
=
null
)
{
if
(
!
is_array
(
$entities
))
{
if
(
!
is_array
(
$entities
))
{
return
$default
;
}
...
...
@@ -322,7 +322,7 @@ class DB
throw
new
TelegramException
(
'message_id, inline_query_id, chosen_inline_result_id, callback_query_id, edited_message_id are all null'
);
}
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -360,7 +360,7 @@ class DB
*/
public
static
function
insertUser
(
User
$user
,
$date
=
null
,
Chat
$chat
=
null
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -428,7 +428,7 @@ class DB
*/
public
static
function
insertChat
(
Chat
$chat
,
$date
=
null
,
$migrate_to_chat_id
=
null
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -485,7 +485,7 @@ class DB
*/
public
static
function
insertRequest
(
Update
$update
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -506,7 +506,7 @@ class DB
$message_id
);
}
}
elseif
(
$update_type
===
'edited_message'
)
{
}
else
if
(
$update_type
===
'edited_message'
)
{
$edited_message
=
$update
->
getEditedMessage
();
if
(
self
::
insertEditedMessageRequest
(
$edited_message
))
{
...
...
@@ -523,7 +523,7 @@ class DB
$edited_message_local_id
);
}
}
elseif
(
$update_type
===
'channel_post'
)
{
}
else
if
(
$update_type
===
'channel_post'
)
{
$channel_post
=
$update
->
getChannelPost
();
if
(
self
::
insertMessageRequest
(
$channel_post
))
{
...
...
@@ -536,7 +536,7 @@ class DB
$message_id
);
}
}
elseif
(
$update_type
===
'edited_channel_post'
)
{
}
else
if
(
$update_type
===
'edited_channel_post'
)
{
$edited_channel_post
=
$update
->
getEditedChannelPost
();
if
(
self
::
insertEditedMessageRequest
(
$edited_channel_post
))
{
...
...
@@ -553,7 +553,7 @@ class DB
$edited_channel_post_local_id
);
}
}
elseif
(
$update_type
===
'inline_query'
)
{
}
else
if
(
$update_type
===
'inline_query'
)
{
$inline_query
=
$update
->
getInlineQuery
();
if
(
self
::
insertInlineQueryRequest
(
$inline_query
))
{
...
...
@@ -566,7 +566,7 @@ class DB
$inline_query_id
);
}
}
elseif
(
$update_type
===
'chosen_inline_result'
)
{
}
else
if
(
$update_type
===
'chosen_inline_result'
)
{
$chosen_inline_result
=
$update
->
getChosenInlineResult
();
if
(
self
::
insertChosenInlineResultRequest
(
$chosen_inline_result
))
{
...
...
@@ -580,7 +580,7 @@ class DB
$chosen_inline_result_local_id
);
}
}
elseif
(
$update_type
===
'callback_query'
)
{
}
else
if
(
$update_type
===
'callback_query'
)
{
$callback_query
=
$update
->
getCallbackQuery
();
if
(
self
::
insertCallbackQueryRequest
(
$callback_query
))
{
...
...
@@ -610,7 +610,7 @@ class DB
*/
public
static
function
insertInlineQueryRequest
(
InlineQuery
$inline_query
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -654,7 +654,7 @@ class DB
*/
public
static
function
insertChosenInlineResultRequest
(
ChosenInlineResult
$chosen_inline_result
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -698,7 +698,7 @@ class DB
*/
public
static
function
insertCallbackQueryRequest
(
CallbackQuery
$callback_query
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -767,7 +767,7 @@ class DB
*/
public
static
function
insertMessageRequest
(
Message
$message
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -804,7 +804,7 @@ class DB
$new_chat_members
=
$message
->
getNewChatMembers
();
$left_chat_member
=
$message
->
getLeftChatMember
();
if
(
!
empty
(
$new_chat_members
))
{
if
(
!
empty
(
$new_chat_members
))
{
foreach
(
$new_chat_members
as
$new_chat_member
)
{
if
(
$new_chat_member
instanceof
User
)
{
// Insert the new chat user
...
...
@@ -813,7 +813,7 @@ class DB
}
}
$new_chat_members_ids
=
implode
(
','
,
$new_chat_members_ids
);
}
elseif
(
$left_chat_member
instanceof
User
)
{
}
else
if
(
$left_chat_member
instanceof
User
)
{
// Insert the left chat user
self
::
insertUser
(
$left_chat_member
,
$date
,
$chat
);
$left_chat_member_id
=
$left_chat_member
->
getId
();
...
...
@@ -915,7 +915,7 @@ class DB
*/
public
static
function
insertEditedMessageRequest
(
Message
$edited_message
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -968,7 +968,7 @@ class DB
*/
public
static
function
selectChats
(
$select_chats_params
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -984,7 +984,7 @@ class DB
'text'
=>
null
,
],
$select_chats_params
);
if
(
!
$select
[
'groups'
]
&&
!
$select
[
'users'
]
&&
!
$select
[
'supergroups'
]
&&
!
$select
[
'channels'
])
{
if
(
!
$select
[
'groups'
]
&&
!
$select
[
'users'
]
&&
!
$select
[
'supergroups'
]
&&
!
$select
[
'channels'
])
{
return
false
;
}
...
...
@@ -1011,7 +1011,7 @@ class DB
$where
=
[];
$tokens
=
[];
if
(
!
$select
[
'groups'
]
||
!
$select
[
'users'
]
||
!
$select
[
'supergroups'
]
||
!
$select
[
'channels'
])
{
if
(
!
$select
[
'groups'
]
||
!
$select
[
'users'
]
||
!
$select
[
'supergroups'
]
||
!
$select
[
'channels'
])
{
$chat_or_user
=
[];
$select
[
'groups'
]
&&
$chat_or_user
[]
=
TB_CHAT
.
'.`type` = "group"'
;
...
...
@@ -1056,7 +1056,7 @@ class DB
}
}
if
(
!
empty
(
$where
))
{
if
(
!
empty
(
$where
))
{
$query
.=
' WHERE '
.
implode
(
' AND '
,
$where
);
}
...
...
@@ -1082,7 +1082,7 @@ class DB
*/
public
static
function
getTelegramRequestCount
(
$chat_id
=
null
,
$inline_message_id
=
null
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -1122,7 +1122,7 @@ class DB
*/
public
static
function
insertTelegramRequest
(
$method
,
$data
)
{
if
(
!
self
::
isDbConnected
())
{
if
(
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
@@ -1159,7 +1159,7 @@ class DB
*/
public
static
function
update
(
$table
,
array
$fields_values
,
array
$where_fields_values
)
{
if
(
empty
(
$fields_values
)
||
!
self
::
isDbConnected
())
{
if
(
empty
(
$fields_values
)
||
!
self
::
isDbConnected
())
{
return
false
;
}
...
...
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