function pluginmanager_display($plugin_category) { global $core_config; $content = "\n\t\t<div class=table-responsive>\n\t\t<table class=playsms-table-list id='pluginmanager_view'>\n\t\t\t<thead><tr>\n\t\t\t\t<th width=15%>" . _('Name') . "</th>\n\t\t\t\t<th width=25%>" . _('Description') . "</th>\n\t\t\t\t<th width=10%>" . _('Version') . "</th>\n\t\t\t\t<th width=20%>" . _('Author') . "</th>\n\t\t\t\t<th width=20%>" . _('Date') . "</th>\n\t\t\t\t<th width=10%>" . _('Status') . "</th>\n\t\t\t</tr></thead>\n\t\t\t<tbody>"; $subdir_tab = pluginmanager_list($plugin_category); for ($l = 0; $l < sizeof($subdir_tab); $l++) { unset($plugin_info); $xml_file = $core_config['apps_path']['plug'] . "/" . $plugin_category . "/" . $subdir_tab[$l]['name'] . "/docs/info.xml"; if ($fc = file_get_contents($xml_file)) { $plugin_info = core_xml_to_array($fc); $plugin_info['status'] = $subdir_tab[$l]['status']; } if ($plugin_info['name']) { $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $plugin_info['name'] . "</td>\n\t\t\t\t\t<td>" . $plugin_info['description'] . "</td>\n\t\t\t\t\t<td>" . $plugin_info['release'] . "</td>\n\t\t\t\t\t<td>" . $plugin_info['author'] . "</td>\n\t\t\t\t\t<td>" . $plugin_info['date'] . "</td>\n\t\t\t\t\t<td>" . $plugin_info['status'] . "</td>\n\t\t\t\t</tr>"; } } $content .= "</tbody></table></div>"; return $content; }
/** * Display gateways on UI * * @global array $core_config * @return string */ function _gateway_display() { global $core_config, $icon_config, $plugin_config; $subdir_tab = gateway_list(); for ($l = 0; $l < sizeof($subdir_tab); $l++) { unset($gateway_info); $c_gateway = strtolower($subdir_tab[$l]['name']); $xml_file = $core_config['apps_path']['plug'] . '/gateway/' . $c_gateway . '/docs/info.xml'; if ($fc = file_get_contents($xml_file)) { $gateway_info = core_xml_to_array($fc); $gateway_info['status'] = $subdir_tab[$l]['status']; } if ($gateway_info['name']) { $c_link_edit = "index.php?app=main&inc=gateway_" . $c_gateway . "&op=manage"; $c_link_add = ''; if (!($c_gateway == 'dev' || $c_gateway == 'blocked')) { $c_link_add = "index.php?app=main&inc=core_gateway&op=add_smsc&gateway=" . $c_gateway; } $gw_list[$gateway_info['name']] = array('link_edit' => $c_link_edit, 'link_add' => $c_link_add, 'name' => $gateway_info['name'], 'description' => $gateway_info['description'], 'release' => $gateway_info['release'], 'status' => $gateway_info['status']); } } ksort($gw_list); $content = "\n\t\t<div class=table-responsive>\n\t\t<table class=playsms-table-list id='gateway_view'>\n\t\t\t<thead><tr>\n\t\t\t\t<th width=40%>" . _('Name') . "</th>\n\t\t\t\t<th width=50%>" . _('Description') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>\n\t\t\t</tr></thead>\n\t\t\t<tbody>"; foreach ($gw_list as $gw) { $c_link_edit = ''; if ($gw['link_edit']) { $c_link_edit = "<a href='" . _u($gw['link_edit']) . "'>" . $icon_config['edit'] . "</a>"; } $c_link_add = ''; if ($gw['link_add']) { $c_link_add = "<a href='" . _u($gw['link_add']) . "'>" . $icon_config['add'] . "</span></a>"; } $content .= "\n\t\t\t<tr>\n\t\t\t\t<td>" . $gw['name'] . "</td>\n\t\t\t\t<td>" . $gw['description'] . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t" . $c_link_edit . "\n\t\t\t\t\t" . $c_link_add . "\n\t\t\t\t</td>\n\t\t\t</tr>"; } $content .= "</tbody></table></div>"; return $content; }
function infobip_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0) { global $plugin_config; $ok = false; _log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "infobip_hook_sendsms"); // override plugin gateway configuration by smsc configuration $plugin_config = gateway_apply_smsc_config($smsc, $plugin_config); $sms_sender = stripslashes($sms_sender); if ($plugin_config['infobip']['module_sender']) { $sms_sender = $plugin_config['infobip']['module_sender']; } $sms_from = $sms_sender; $smsType = "&SMSText"; if ($sms_footer) { $sms_msg = $sms_msg . $sms_footer; } switch ($sms_type) { case "flash": $sms_type = 1; break; case "text": default: $sms_type = 0; } if ($unicode) { if (function_exists('mb_convert_encoding')) { $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto"); } $sms_msg = core_str2hex($sms_msg); $unicode = 8; $smsType = "&binary"; } // fixme anton - if sms_from is not set in gateway_number and global number, we cannot pass it to infobip $set_sms_from = $sms_from == $sms_sender ? '' : urlencode($sms_from); // query_string = "sendmsg?api_id=".$plugin_config['infobip']['api_id']."&user="******"&password="******"&to=".urlencode($sms_to)."&msg_type=$sms_type&text=".urlencode($sms_msg)."&unicode=".$unicode.$set_sms_from; $query_string = "sendsms/plain?user="******"&password="******"&GSM=" . urlencode($sms_to) . $smsType . "=" . urlencode($sms_msg) . "&sender=" . $sms_from; $query_string .= "&IsFlash=" . $sms_type . "&DataCoding=" . $unicode; $url = $plugin_config['infobip']['send_url'] . "/" . $query_string; $dlr_nopush = $plugin_config['infobip']['dlr_nopush']; if ($dlr_nopush == '0') { $additional_param = "&nopush=0"; } elseif ($dlr_nopush == '1') { $additional_param = "&nopush=1"; } if ($additional_param = $plugin_config['infobip']['additional_param']) { $additional_param .= "&" . $additional_param; } $url .= $additional_param; $url = str_replace("&&", "&", $url); logger_print("url:" . $url, 3, "infobip outgoing"); $xml = file_get_contents($url); $response = core_xml_to_array($xml); if ($response) { if ($response['result']['status'] == 0) { if ($apimsgid = trim($response['result']['messageid'])) { infobip_setsmsapimsgid($smslog_id, $apimsgid); list($c_sms_credit, $c_sms_status) = infobip_getsmsstatus($smslog_id); // pending $p_status = 0; if ($c_sms_status) { $p_status = $c_sms_status; } } else { // sent $p_status = 1; } logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " p_status:" . $p_status . " response:" . $response['result']['status'], 2, "infobip outgoing"); } elseif ($response['result']['status'] == -2) { logger_print("smslog_id:" . $smslog_id . " response:" . $response['result']['status'] . " NOT_ENOUGH_CREDIT", 2, "infobip outgoing"); } else { // even when the response is not what we expected we still print it out for debug purposes $fd = str_replace("\n", " ", $fd); $fd = str_replace("\r", " ", $fd); logger_print("smslog_id:" . $smslog_id . " response:" . $response['result']['status'] . " UNKNOWN_CODE", 2, "infobip outgoing"); } $ok = true; } else { logger_print("no response smslog_id:" . $smslog_id, 3, "infobip outgoing"); } if (!$ok) { $p_status = 2; } dlr($smslog_id, $uid, $p_status); return $ok; }
<?php $DAEMON_PROCESS = TRUE; chdir('../../../../'); include 'init.php'; include _APPS_PATH_LIBS_ . '/function.php'; $fn = 'plugin/core/country/tools/countries.xml'; $fd = fopen($fn, 'r'); $xml = fread($fd, filesize($fn)); fclose($fd); $countries = core_xml_to_array($xml); $country = array(); foreach ($countries['country'] as $item) { $c = array_values($item); $country[] = array('code' => $c[0]['code'], 'phoneCode' => $c[0]['phoneCode'], 'name' => addslashes($c[0]['name'])); } $csv = '"code","phoneCode","name"' . PHP_EOL; foreach ($country as $item) { $csv .= '"' . $item['code'] . '","' . $item['phoneCode'] . '","' . stripslashes($item['name']) . '"' . PHP_EOL; } $fn = 'plugin/core/country/tools/countries.csv'; $fd = fopen($fn, 'w+'); fputs($fd, $csv); fclose($fd); $db_query = 'TRUNCATE ' . _DB_PREF_ . '_tblCountry'; $db_result = dba_query($db_query); $sql = $db_query . ';' . PHP_EOL; foreach ($country as $item) { $db_query = "INSERT INTO " . _DB_PREF_ . "_tblCountry (country_code, country_name, country_prefix) VALUES ('" . $item['code'] . "','" . $item['name'] . "','" . $item['phoneCode'] . "')"; $db_result = dba_query($db_query); $sql .= $db_query . ';' . PHP_EOL;