function cc_whmcs_bridge_parse_url($redir) { cc_whmcs_bridge_home($home, $pid, false); $whmcs = cc_whmcs_bridge_url(); if (substr($whmcs, -1) != '/') { $whmcs .= '/'; } $f[] = '/' . preg_quote($whmcs, '/') . 'viewinvoice\\.php\\?id\\=([0-9]*?)&(.*?)$/'; if (get_option('cc_whmcs_bridge_permalinks')) { $r[] = '' . $home . 'viewinvoice/?id=$1' . $pid . ''; } else { $r[] = '' . $home . '?ccce=viewinvoice&id=$1' . $pid . ''; } $newRedir = preg_replace($f, $r, $redir); return $newRedir; }
function cc_whmcs_bridge_http($page = "index") { global $wpdb; $whmcs = cc_whmcs_bridge_url(); if (substr($whmcs, -1) != '/') { $whmcs .= '/'; } if (strpos($whmcs, 'https://') !== 0 && isset($_REQUEST['sec']) && $_REQUEST['sec'] == '1') { $whmcs = str_replace('http://', 'https://', $whmcs); } $vars = ""; if ($page == 'verifyimage') { $http = $whmcs . 'includes/' . $page . '.php'; } elseif (isset($_REQUEST['ccce']) && $_REQUEST['ccce'] == 'js') { $http = $whmcs . $_REQUEST['js']; return $http; } elseif (substr($page, -1) == '/') { $http = $whmcs . substr($page, 0, -1); } else { $http = $whmcs . $page . '.php'; } $and = ""; if (count($_GET) > 0) { foreach ($_GET as $n => $v) { if ($n != "page_id" && $n != "ccce" && $n != 'whmcspage') { if (is_array($v)) { foreach ($v as $n2 => $v2) { $vars .= $and . $n . '[' . $n2 . ']' . '=' . urlencode($v2); } } else { $vars .= $and . $n . '=' . urlencode($v); } $and = "&"; } } } if (isset($_GET['whmcspage'])) { $vars .= $and . 'page=' . $_GET['whmcspage']; $and = '&'; } $systpl = get_option('cc_whmcs_bridge_template') ? get_option('cc_whmcs_bridge_template') : 'five'; if (!function_exists('cc_whmcs_bridge_parser_with_permalinks') && !in_array($systpl, array('portal', 'five'))) { $systpl = 'five'; } $vars .= $and . 'systpl=' . $systpl; $and = "&"; if (function_exists('cc_whmcs_bridge_sso_http')) { cc_whmcs_bridge_sso_http($vars, $and); } if ($vars != '') { $http .= '?' . $vars; } return $http; }