function get_album_by_aid($aid) { $params['aid'] = $aid; $url = "http://oapi.56.com/album/info.json"; $url = $url . '?' . signRequest($params); $s = file_get_contents($url); $result = json_decode($s, true); $video = $result[videolist][data]; if (empty($video)) { return false; } $result['videoname'] = array(); $result['videolink'] = array(); $result['videoimg'] = array(); $result['videotime'] = array(); foreach ($video as $vk => $vv) { //http://player.56.com/cpm_MTA4NzEzNDUz.swf $result['videoname'][$vk] = diconv($vv['video_title'], "utf-8"); $result['videolink'][$vk] = 'http://player.56.com/w_' . $vv['video_id']; $result['videolink'][$vk] .= base64_decode("LnN3Zi8xMDMxX3NtYXJ0Y29tZS5zd2Y="); $result['videoimg'][$vk] = $vv['video_cover']; $result['videotime'][$vk] = $vv['add_time']; } unset($result[videolist][data]); return $result; }
function eshop_submit_webtopay_post($espost) { // The user will briefly see a message on the screen that reads: // "Please wait, your order is being processed..." and then immediately // is redirected to webtopay. global $eshopoptions, $blog_id; $webtopay = $eshopoptions['webtopay']; $echortn = '<div id="process"> <p><strong>' . __('Please wait, your order is being processed…', 'eshop') . '</strong></p> <p>' . __('If you are not automatically redirected to webtopay, please use the <em>Proceed to webtopay</em> button.', 'eshop') . '</p> <form method="post" id="eshopgateway" class="eshop" action="' . $this->webtopay_url . '"> <p>'; $replace = array("'", "'", "\"", """, "&", "&"); $webtopay = $eshopoptions['webtopay']; $theamount = str_replace(',', '', $espost['amount']); if (isset($espost['tax'])) { $theamount += str_replace(',', '', $espost['tax']); } if (isset($_SESSION['shipping' . $blog_id]['tax'])) { $theamount += $_SESSION['shipping' . $blog_id]['tax']; } $Cost = $theamount - $espost['shipping_1']; $ExtraCost = $espost['shipping_1']; // - Callback cannot be with GET vars - //$callbackURL = strtr($espost['notify_url'], array('&' => '&')); $espost['notify_url'] = strtr($espost['notify_url'], array('&' => '&')); //list($callbackURL, $getCallback) = explode('?', $callbackURL); //some location may be inaccurate, change them here: $changeloc = array('GB' => 'UK'); $eshoploc = $eshopoptions['location']; if (isset($changeloc[$eshopoptions['location']])) { $eshoploc = $changeloc[$eshopoptions['location']]; } # ************************************************* # -- How we create sign param -- $signFields = array('projectid' => $webtopay['projectid'], 'orderid' => $espost['RefNr'], 'lang' => $webtopay['lang'], 'amount' => ($Cost + $ExtraCost) * 100, 'currency' => $eshopoptions['currency'], 'accepturl' => get_permalink($eshopoptions['cart_success']), 'cancelurl' => get_permalink($eshopoptions['cart_cancel']), 'callbackurl' => $espost['notify_url'], 'payment' => '', 'country' => $eshoploc, 'p_firstname' => $espost['first_name'], 'p_lastname' => $espost['last_name'], 'p_email' => $espost['email'], 'p_street' => trim($espost['address1'] . ' ' . $espost['address2']), 'p_city' => $espost['city'], 'p_state' => $espost['state'], 'p_zip' => $espost['zip'], 'p_countrycode' => $espost['country'], 'test' => $eshopoptions['status'] == 'live' ? 0 : 1, 'version' => '1.3'); $asigned = signRequest($signFields, $webtopay['signature']); $sign = $asigned['sign']; # ************************************************* $echortn .= ' <input type="hidden" name="projectid" value="' . $webtopay['projectid'] . '" /> <input type="hidden" name="orderid" value="' . $espost['RefNr'] . '" /> <input type="hidden" name="lang" value="' . $webtopay['lang'] . '" /> <input type="hidden" name="amount" value="' . ($Cost + $ExtraCost) * 100 . '" /> <input type="hidden" name="currency" value="' . $eshopoptions['currency'] . '" /> <input type="hidden" name="accepturl" value="' . get_permalink($eshopoptions['cart_success']) . '" /> <input type="hidden" name="cancelurl" value="' . get_permalink($eshopoptions['cart_cancel']) . '" /> <input type="hidden" name="callbackurl" value="' . $espost['notify_url'] . '" /> <input type="hidden" name="country" value="' . $eshoploc . '"> <input type="hidden" name="paytext" value="' . __('Payment for goods and services (of no. [order_nr]) ([site_name])', 'eshop') . '" /> <input type="hidden" name="p_firstname" value="' . $espost['first_name'] . '"> <input type="hidden" name="p_lastname" value="' . $espost['last_name'] . '"> <input type="hidden" name="p_email" value="' . $espost['email'] . '"> <input type="hidden" name="p_street" value="' . trim($espost['address1'] . ' ' . $espost['address2']) . '"> <input type="hidden" name="p_city" value="' . $espost['city'] . '"> <input type="hidden" name="p_state" value="' . $espost['state'] . '"> <input type="hidden" name="p_zip" value="' . $espost['zip'] . '"> <input type="hidden" name="p_countrycode" value="' . $espost['country'] . '"> <input type="hidden" name="test" value="' . ($eshopoptions['status'] == 'live' ? 0 : 1) . '" /> <input type="hidden" name="version" value="1.3" /> <input type="hidden" name="sign" value="' . $sign . '"> <input type="hidden" name="RefNr" value="' . $espost['RefNr'] . '" />'; $echortn .= ' <input class="button" type="submit" id="ppsubmit" name="ppsubmit" value="' . __('Proceed to webtopay »', 'eshop') . '" /></p> </form> </div>'; return $echortn; }
function signContentIds($contentIds) { return signRequest(array("contentIds" => $contentIds)); }
} else { if ($method == "DELETE") { handlePreflightedRequest(); // only needed in a CORS environment deleteObject(); } else { if ($method == 'POST') { handlePreflightedRequest(); // Assumes the successEndpoint has a parameter of "success" associated with it, // to allow the server to differentiate between a successEndpoint request // and other POST requests (all requests are sent to the same endpoint in this example). // This condition is not needed if you don't require a callback on upload success. if (isset($_REQUEST["success"])) { verifyFileInS3(shouldIncludeThumbnail()); } else { signRequest(); } } } } // This will retrieve the "intended" request method. Normally, this is the // actual method of the request. Sometimes, though, the intended request method // must be hidden in the parameters of the request. For example, when attempting to // send a DELETE request in a cross-origin environment in IE9 or older, it is not // possible to send a DELETE request. So, we send a POST with the intended method, // DELETE, in a "_method" parameter. function getRequestMethod() { global $HTTP_RAW_POST_DATA; // This should only evaluate to true if the Content-Type is undefined // or unrecognized, such as when XDomainRequest has been used to