@@ -131,31 +131,31 @@ discard block |
||
131 | 131 | protected static function defineTable() |
132 | 132 | { |
133 | 133 | if (!defined('TB_TELEGRAM_UPDATE')) { |
134 | - define('TB_TELEGRAM_UPDATE', self::$table_prefix.'telegram_update'); |
|
134 | + define('TB_TELEGRAM_UPDATE', self::$table_prefix . 'telegram_update'); |
|
135 | 135 | } |
136 | 136 | if (!defined('TB_MESSAGE')) { |
137 | - define('TB_MESSAGE', self::$table_prefix.'message'); |
|
137 | + define('TB_MESSAGE', self::$table_prefix . 'message'); |
|
138 | 138 | } |
139 | 139 | if (!defined('TB_EDITED_MESSAGE')) { |
140 | - define('TB_EDITED_MESSAGE', self::$table_prefix.'edited_message'); |
|
140 | + define('TB_EDITED_MESSAGE', self::$table_prefix . 'edited_message'); |
|
141 | 141 | } |
142 | 142 | if (!defined('TB_INLINE_QUERY')) { |
143 | - define('TB_INLINE_QUERY', self::$table_prefix.'inline_query'); |
|
143 | + define('TB_INLINE_QUERY', self::$table_prefix . 'inline_query'); |
|
144 | 144 | } |
145 | 145 | if (!defined('TB_CHOSEN_INLINE_RESULT')) { |
146 | - define('TB_CHOSEN_INLINE_RESULT', self::$table_prefix.'chosen_inline_result'); |
|
146 | + define('TB_CHOSEN_INLINE_RESULT', self::$table_prefix . 'chosen_inline_result'); |
|
147 | 147 | } |
148 | 148 | if (!defined('TB_CALLBACK_QUERY')) { |
149 | - define('TB_CALLBACK_QUERY', self::$table_prefix.'callback_query'); |
|
149 | + define('TB_CALLBACK_QUERY', self::$table_prefix . 'callback_query'); |
|
150 | 150 | } |
151 | 151 | if (!defined('TB_USER')) { |
152 | - define('TB_USER', self::$table_prefix.'user'); |
|
152 | + define('TB_USER', self::$table_prefix . 'user'); |
|
153 | 153 | } |
154 | 154 | if (!defined('TB_CHAT')) { |
155 | - define('TB_CHAT', self::$table_prefix.'chat'); |
|
155 | + define('TB_CHAT', self::$table_prefix . 'chat'); |
|
156 | 156 | } |
157 | 157 | if (!defined('TB_USER_CHAT')) { |
158 | - define('TB_USER_CHAT', self::$table_prefix.'user_chat'); |
|
158 | + define('TB_USER_CHAT', self::$table_prefix . 'user_chat'); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * |
433 | 433 | * @return bool |
434 | 434 | */ |
435 | - public static function insertRequest(Update &$update) |
|
435 | + public static function insertRequest(Update & $update) |
|
436 | 436 | { |
437 | 437 | $update_id = $update->getUpdateId(); |
438 | 438 | if ($update->getUpdateType() == 'message') { |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @return bool If the insert was successful |
486 | 486 | * @throws TelegramException |
487 | 487 | */ |
488 | - public static function insertInlineQueryRequest(InlineQuery &$inline_query) |
|
488 | + public static function insertInlineQueryRequest(InlineQuery & $inline_query) |
|
489 | 489 | { |
490 | 490 | if (!self::isDbConnected()) { |
491 | 491 | return false; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @return bool If the insert was successful |
537 | 537 | * @throws TelegramException |
538 | 538 | */ |
539 | - public static function insertChosenInlineResultRequest(ChosenInlineResult &$chosen_inline_result) |
|
539 | + public static function insertChosenInlineResultRequest(ChosenInlineResult & $chosen_inline_result) |
|
540 | 540 | { |
541 | 541 | if (!self::isDbConnected()) { |
542 | 542 | return false; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @return bool If the insert was successful |
588 | 588 | * @throws TelegramException |
589 | 589 | */ |
590 | - public static function insertCallbackQueryRequest(CallbackQuery &$callback_query) |
|
590 | + public static function insertCallbackQueryRequest(CallbackQuery & $callback_query) |
|
591 | 591 | { |
592 | 592 | if (!self::isDbConnected()) { |
593 | 593 | return false; |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | * @return bool If the insert was successful |
658 | 658 | * @throws TelegramException |
659 | 659 | */ |
660 | - public static function insertMessageRequest(Message &$message) |
|
660 | + public static function insertMessageRequest(Message & $message) |
|
661 | 661 | { |
662 | 662 | if (!self::isDbConnected()) { |
663 | 663 | return false; |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | * @return bool If the insert was successful |
852 | 852 | * @throws TelegramException |
853 | 853 | */ |
854 | - public static function insertEditedMessageRequest(Message &$edited_message) |
|
854 | + public static function insertEditedMessageRequest(Message & $edited_message) |
|
855 | 855 | { |
856 | 856 | if (!self::isDbConnected()) { |
857 | 857 | return false; |
@@ -983,29 +983,29 @@ discard block |
||
983 | 983 | $where[] = '(' . $chat_or_user . ')'; |
984 | 984 | } |
985 | 985 | |
986 | - if (! is_null($date_from)) { |
|
986 | + if (!is_null($date_from)) { |
|
987 | 987 | $where[] = TB_CHAT . '.`updated_at` >= :date_from'; |
988 | 988 | $tokens[':date_from'] = $date_from; |
989 | 989 | } |
990 | 990 | |
991 | - if (! is_null($date_to)) { |
|
991 | + if (!is_null($date_to)) { |
|
992 | 992 | $where[] = TB_CHAT . '.`updated_at` <= :date_to'; |
993 | 993 | $tokens[':date_to'] = $date_to; |
994 | 994 | } |
995 | 995 | |
996 | - if (! is_null($chat_id)) { |
|
996 | + if (!is_null($chat_id)) { |
|
997 | 997 | $where[] = TB_CHAT . '.`id` = :chat_id'; |
998 | 998 | $tokens[':chat_id'] = $chat_id; |
999 | 999 | } |
1000 | 1000 | |
1001 | - if (! is_null($text)) { |
|
1001 | + if (!is_null($text)) { |
|
1002 | 1002 | if ($select_users) { |
1003 | - $where[] = '(LOWER('.TB_CHAT . '.`title`) LIKE :text OR LOWER(' . TB_USER . '.`first_name`) LIKE :text OR LOWER(' . TB_USER . '.`last_name`) LIKE :text OR LOWER(' . TB_USER . '.`username`) LIKE :text)'; |
|
1003 | + $where[] = '(LOWER(' . TB_CHAT . '.`title`) LIKE :text OR LOWER(' . TB_USER . '.`first_name`) LIKE :text OR LOWER(' . TB_USER . '.`last_name`) LIKE :text OR LOWER(' . TB_USER . '.`username`) LIKE :text)'; |
|
1004 | 1004 | } else { |
1005 | - $where[] = 'LOWER('.TB_CHAT . '.`title`) LIKE :text'; |
|
1005 | + $where[] = 'LOWER(' . TB_CHAT . '.`title`) LIKE :text'; |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $tokens[':text'] = '%'.strtolower($text).'%'; |
|
1008 | + $tokens[':text'] = '%' . strtolower($text) . '%'; |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | $a = 0; |
@@ -47,8 +47,8 @@ |
||
47 | 47 | //return random picture from the telegram->getUploadPath(); |
48 | 48 | |
49 | 49 | private function ShowRandomImage($dir) { |
50 | - $image_list = scandir($dir); |
|
51 | - return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
52 | - } |
|
50 | + $image_list = scandir($dir); |
|
51 | + return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)]; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | $keyboards = []; |
46 | 46 | |
47 | 47 | //0 |
48 | - $keyboard[] = ['7','8','9']; |
|
49 | - $keyboard[] = ['4','5','6']; |
|
50 | - $keyboard[] = ['1','2','3']; |
|
51 | - $keyboard[] = [' ','0',' ']; |
|
48 | + $keyboard[] = ['7', '8', '9']; |
|
49 | + $keyboard[] = ['4', '5', '6']; |
|
50 | + $keyboard[] = ['1', '2', '3']; |
|
51 | + $keyboard[] = [' ', '0', ' ']; |
|
52 | 52 | |
53 | 53 | $keyboards[] = $keyboard; |
54 | 54 | unset($keyboard); |
55 | 55 | |
56 | 56 | //1 |
57 | - $keyboard[] = ['7','8','9','+']; |
|
58 | - $keyboard[] = ['4','5','6','-']; |
|
59 | - $keyboard[] = ['1','2','3','*']; |
|
60 | - $keyboard[] = [' ','0',' ','/']; |
|
57 | + $keyboard[] = ['7', '8', '9', '+']; |
|
58 | + $keyboard[] = ['4', '5', '6', '-']; |
|
59 | + $keyboard[] = ['1', '2', '3', '*']; |
|
60 | + $keyboard[] = [' ', '0', ' ', '/']; |
|
61 | 61 | |
62 | 62 | $keyboards[] = $keyboard; |
63 | 63 | unset($keyboard); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | //3 |
74 | 74 | $keyboard[] = ['A']; |
75 | 75 | $keyboard[] = ['B']; |
76 | - $keyboard[] = ['C','D']; |
|
76 | + $keyboard[] = ['C', 'D']; |
|
77 | 77 | |
78 | 78 | $keyboards[] = $keyboard; |
79 | 79 | unset($keyboard); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $data['reply_markup'] = new ReplyKeyboardMarkup( |
97 | 97 | [ |
98 | - 'keyboard' => $keyboards[1] , |
|
98 | + 'keyboard' => $keyboards[1], |
|
99 | 99 | 'resize_keyboard' => true, |
100 | 100 | 'one_time_keyboard' => false, |
101 | 101 | 'selective' => false |
@@ -21,10 +21,10 @@ |
||
21 | 21 | |
22 | 22 | // Enter your MySQL database credentials |
23 | 23 | $mysql_credentials = [ |
24 | - 'host' => 'localhost', |
|
25 | - 'user' => 'dbuser', |
|
26 | - 'password' => 'dbpass', |
|
27 | - 'database' => 'dbname', |
|
24 | + 'host' => 'localhost', |
|
25 | + 'user' => 'dbuser', |
|
26 | + 'password' => 'dbpass', |
|
27 | + 'database' => 'dbname', |
|
28 | 28 | ]; |
29 | 29 | |
30 | 30 | try { |
@@ -47,16 +47,16 @@ |
||
47 | 47 | |
48 | 48 | public function getDuration() |
49 | 49 | { |
50 | - return $this->duration; |
|
50 | + return $this->duration; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function getMimeType() |
54 | 54 | { |
55 | - return $this->mime_type; |
|
55 | + return $this->mime_type; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function getFileSize() |
59 | 59 | { |
60 | - return $this->file_size; |
|
60 | + return $this->file_size; |
|
61 | 61 | } |
62 | 62 | } |