Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
public_html
/
wp-content
/
plugins
/
woocommersa
/
includes
/
Services
/
Filename :
BaleService.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\Services; if (!defined('ABSPATH')) exit; class BaleService { private $token; private $safir_token; public function __construct() { $settings = get_option('woocommersa_settings', []); $this->token = $settings['bale_bot_token'] ?? ''; $this->safir_token = $settings['bale_safir_token'] ?? ''; } /** * Send message via standard Bot API */ public function send_via_bot($chat_id, $message, $buttons = []) { if (empty($this->token) || empty($chat_id)) return false; $url = "https://tapi.bale.ai/bot{$this->token}/sendMessage"; $data = [ 'chat_id' => $chat_id, 'text' => $message, 'parse_mode' => 'HTML' ]; if (!empty($buttons)) { $data['reply_markup'] = json_encode(['inline_keyboard' => $buttons]); } $response = wp_remote_post($url, [ 'body' => $data, 'timeout' => 15 ]); if (is_wp_error($response)) { \WooCommersa\Core\Logger::error("خطا در ارسال پیام بله (بات): " . $response->get_error_message(), 'Bale'); return false; } return true; } /** * Send message via Safir Service (Direct to Phone Number) */ public function send_via_safir($phone, $message) { if (empty($this->safir_token) || empty($phone)) return false; // Clean phone number (must start with 98) $phone = preg_replace('/^0/', '98', $phone); if (strpos($phone, '98') !== 0) $phone = '98' . $phone; $url = "https://safir.bale.ai/api/v3/send_message"; $data = [ 'phone_number' => $phone, 'message_data' => [ 'text' => $message ] ]; $response = wp_remote_post($url, [ 'headers' => [ 'Content-Type' => 'application/json', 'X-Access-Key' => $this->safir_token ], 'body' => json_encode($data), 'timeout' => 15 ]); if (is_wp_error($response)) { \WooCommersa\Core\Logger::error("خطا در ارسال پیام بله (سفیر): " . $response->get_error_message(), 'Bale'); return false; } $code = wp_remote_retrieve_response_code($response); return ($code >= 200 && $code < 300); } /** * Test connection to Bale Bot */ public function test_bot() { if (empty($this->token)) return false; $url = "https://tapi.bale.ai/bot{$this->token}/getMe"; $response = wp_remote_get($url); if (is_wp_error($response)) return false; $body = json_decode(wp_remote_retrieve_body($response), true); return isset($body['ok']) && $body['ok'] === true; } }