function getPluginID() { if ($this->plugin_id) { return $this->plugin_id; } require_once PATH_MODULES . "voip/voip.inc.php"; $v = new voip(); $didtable = $v->get_did_e164($this->data['did']); $this->plugin_id = $didtable['voip_did_plugin_id']; return $this->plugin_id; }
function delete_cart($VAR, $cart, $checkDID = false) { if (!isset($cart['product_attr'])) { return; } $db =& DB(); $attr = unserialize($cart['product_attr']); if (!empty($attr['station'])) { $did = $attr['station']; if ($checkDID) { // check if user owns did && is in did pool (if so we can assume it was a topup and return) $didrs = $db->Execute(sqlSelect($db, "voip_did", "id,did", "did = ::{$did}:: AND account_id=" . SESS_ACCOUNT)); if ($didrs && $didrs->RecordCount() > 0) { return; } } // get E164 so we can determine the country code and did npa/nxx/station and find the did and plugin include_once PATH_MODULES . 'voip/voip.inc.php'; $v = new voip(); $did_arr = $v->get_did_e164($did); if (!$did_arr) { return; } $plugin_id = $did_arr['voip_did_plugin_id']; // Get the plugin detials $rs =& $db->Execute(sqlSelect($db, "voip_did_plugin", "plugin,avail_countries", "id = {$plugin_id}")); if ($rs && $rs->RecordCount() > 0) { $plugin = $rs->fields['plugin']; } else { return; } // load the plugin and call release(); $file = PATH_PLUGINS . 'voip_did/' . $plugin . '.php'; if (is_file($file)) { include_once $file; eval('$plg = new plgn_voip_did_' . $plugin . ';'); if (is_object($plg)) { if (is_callable(array($plg, 'release'))) { $plg->id = $did_arr['voip_did_plugin_id']; $plg->did = $did; $plg->did_id = $did_arr['id']; $plg->release(); } } } } }