Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1.         # Если продукт успешно найден:
  2.         if($number == 1){
  3.            
  4.             # Обновляем покупателя товара:
  5.             $sql = "
  6.                 UPDATE
  7.                     `digital_shop_product`
  8.                 SET
  9.                     `buyer` = ".csqlEscape($data['source']['from']['id'], $_cdb).",
  10.                     `buy_date` = ".csqlEscape(time(), $_cdb)."
  11.                 WHERE
  12.                     `digital_shop_product_id` = ".csqlEscape($product_id, $_cdb)."
  13.             ";
  14.             csqlQuery($sql, $_cdb);
  15.            
  16.             # Формируем список кнопок:
  17.             $button[] = array('text' => $settings['button_back'], 'callback_data' => 'product_in_category_'.$product_rows[0][5]);
  18.             $button = array_chunk($button, 1);
  19.            
  20.             # Если товар является файлом:
  21.             if($product_rows[0][6] == 2){
  22.                
  23.                 # Отправляем товар пользователю:
  24.                 tgApi(
  25.                     'sendDocument',
  26.                     array(
  27.                         'chat_id' => $data['source']['message']['chat']['id'],
  28.                         'document' => $product_rows[0][3],
  29.                         'caption' => $product_rows[0][4]
  30.                     )
  31.                 );
  32.                
  33.             }
  34.             # Если товар является текстом:
  35.             else{
  36.                
  37.                 # Выводим информацию по товару:
  38.                 tgApi(
  39.                     'editMessageText',
  40.                     array(
  41.                         'chat_id' => $data['source']['message']['chat']['id'],
  42.                         'message_id' => $data['source']['message']['message_id'],
  43.                         'text' => tplReplace(
  44.                             array(
  45.                                 'product_name' => $product_rows[0][4],
  46.                                 'content' => $product_rows[0][3]
  47.                             ), unSafeString($settings['product_content'])
  48.                         ),
  49.                         'parse_mode' => 'Markdown',
  50.                         'reply_markup' => json_encode(
  51.                             array(
  52.                                 'inline_keyboard' => $button
  53.                             )
  54.                         )
  55.                     )
  56.                 ); 
  57.                
  58.             }
  59.            
  60.         }
  61.         # Если продукт не найден:
  62.         else {
  63.             return $_lang['data_not_found'];
  64.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement