/** * retrieve list of stored sessions * @param {array} data received data query parameters * @param {boolean} ring: if true exclude "-- Sin asignar --" session 1 * @return {array} session list in easyui json expected format, or error string */ function select($data, $ring = false) { $this->myLogger->enter(); //needed to properly handle multisort requests from datagrid $sort = getOrderString(http_request("sort", "s", ""), http_request("order", "s", ""), "Nombre ASC, Comentario ASC"); // search string $search = isset($_GET['where']) ? strval($_GET['where']) : ''; // evaluate offset and row count for query $page = http_request("page", "i", 1); $rows = http_request("rows", "i", 50); $limit = ""; if ($page != 0 && $rows != 0) { $offset = ($page - 1) * $rows; $limit = "" . $offset . "," . $rows; } // if hidden==0 hide console related sessions $ringstr = " AND 1"; if ($ring) { $ringstr = " AND (Sesiones.ID > 1)"; } $searchstr = " AND 1"; if ($search !== "") { $searchstr = "AND (Nombre LIKE '%{$search}%') AND ( ( Comentario LIKE '%{$search}%' ) OR ( Operador LIKE '%{$search}%') ) "; } $hiddenstr = " AND 1"; if ($data['Hidden'] == 0) { $hiddenstr = "AND (Nombre != 'Console')"; } $result = $this->__select("Sesiones.ID AS ID,Nombre,Comentario,Operador,Prueba,Jornada,Manga,Tanda,Login,Background,LiveStream,LiveStream2,LiveStream3", "Sesiones,Usuarios", "( Sesiones.Operador = Usuarios.ID ) {$hiddenstr} {$searchstr} {$ringstr}", $sort, $limit); $this->myLogger->leave(); return $result; }
public function retrieveExcelFile() { // phase 1 retrieve data from browser $this->myLogger->enter(); $this->saveStatus("Loading file..."); // extraemos los datos de registro $data = http_request("Data", "s", null); if (!$data) { return array("errorMsg" => "importExcel(dogs)::download(): No data to import has been received"); } if (!preg_match('/data:([^;]*);base64,(.*)/', $data, $matches)) { return array("operation" => "upload", "errorMsg" => "importExcel(dogs)::download() Invalid received data format"); } // mimetype for excel file is be stored at $matches[1]: and should be checked // $type=$matches[1]; // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', or whatever. Not really used $this->myLogger->leave(); $contents = base64_decode($matches[2]); // decodes received data // phase 2 store it into temporary file $tmpfile = tempnam_sfx(__DIR__ . "/../../../logs", "import", "xlsx"); $file = fopen($tmpfile, "wb"); fwrite($file, $contents); fclose($file); return array("operation" => "upload", "success" => true, "filename" => $tmpfile); }
/** * Returns a json easyui datagrid style list of countries */ function enumerate() { $data = array(); // to be used on country search $q = strtolower(http_request("q", "s", "")); // parse country list foreach (Country::$countryList as $key => $val) { if ($q === "") { // no search key, just add array_push($data, array('ID' => $key, "Country" => $val)); continue; } $k = strtolower($key); // search 2-letter country code if (strpos($k, $q) !== false) { array_push($data, array('ID' => $key, "Country" => $val)); continue; } $v = strtolower($val); // search for country name if ($v === $q) { array_push($data, array('ID' => $key, "Country" => $val)); } } $result = array('total' => count($data), 'rows' => $data); return $result; }
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $respheaders = substr($data, 0, $header_size); $body = substr($data, $header_size); curl_close($curl); return $body; } function http_proxy_query($url) {
function translate($string) { $url = "http://fanyi.youdao.com/openapi.do?keyfrom=bj22222&key=136547222&type=data&doctype=json&version=1.1&q="; $str = http_request($url . $string); echo $url . $string; // $str=mb_convert_encoding($str,'GB2312','UTF-8'); $pattern = '#translation\\":\\[\\"(.*)\\"\\]#'; return getPatternResult($pattern, $str); }
function main($url, $user, $secret_key, $param) { //加速乐开放API主函数 ksort($param); $token = make_signiture($secret_key, $param); $header = make_header($user, $token); $postdata = http_build_query($param); $ret_cont = http_request($url, $postdata, $header); return $ret_cont; }
function select() { // evaluate offset and row count for query $q = http_request("q", "s", ""); $c = http_request("Country", "s", ""); $prov = $q !== "" ? "Provincia LIKE '%{$q}%'" : "1"; $ctry = $c !== "" ? "AND Pais = '{$c}' " : ""; $result = $this->__select("*", "Provincias", "({$prov} {$ctry}) OR ( Codigo=0 )", "Provincia ASC", ""); return $result; }
function create_ticket($resource_url) { $service_url = $this->service_url . '/'; //### FIXME: the server should be callable without this $data = array('resource_url' => $resource_url); $response = http_request($service_url, 'POST', $data); if (is_null($response) || $response[0] != 201) { return NULL; } return $this->_parse_ticket($response[1]); }
function plugin_ajaxrss_output_url($url) { if (!is_url($url, TRUE)) { return ''; } $ret = http_request($url); if ($ret['rc'] != 200) { return ''; } return $ret['data']; }
function sendMediaMsg($fromUsername, $media_id, $type) { $access_token = 'OqRc1B_r2iNAVtKLDT7FzUzN-fAN9q3chs1so3bAhUllLakfdGV9U--OpkV_B2cr3ZmJaPJjTI6kZvHvbfO79WenoxhMXl1gOJJ8UAovaQw'; $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $access_token; $postData = '{ "touser":"******", "msgtype":"' . $type . '", "' . $type . '":{"media_id":"' . $media_id . '" } }'; $result = http_request($url, $postData); return $result; }
function get_userinfo($token) { //$created = substr_replace(get_date('Y-m-d\TH:i:sO', UTIME), ':', -2, 0); $created = str_replace('+0000', 'Z', gmdate('Y-m-d\\TH:i:sO', time())); $headers = array('X-JUGEMKEY-API-CREATED' => $created, 'X-JUGEMKEY-API-KEY' => $this->api_key, 'X-JUGEMKEY-API-TOKEN' => $token, 'X-JUGEMKEY-API-SIG' => hash_hmac('sha1', $this->api_key . $created . $token, $this->sec_key)); $data = http_request(self::JUGEMKEY_URL_USER, 'GET', $headers); $this->response['rc'] = $data['rc']; if ($data['rc'] != 200 && $data['rc'] != 401) { return $this->response; } $this->responce_xml_parser($data['data']); return $this->response; }
/** * token换取用户的openid * 需要从威信回调本action : https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea75c703e3c51ec3&redirect_uri=http%3A%2F%2F119.29.12.215%2FMobile%2FPublic%2Fbangding&response_type=code&scope=snsapi_base#wechat_redirect * redirect_uri 必须urlencode 处理。 */ private function getOpenid($jumpUrl = '') { //https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code $url = "https://api.weixin.qq.com/sns/oauth2/access_token"; $getData['appid'] = C('AppID'); $getData['secret'] = C('AppSecret'); $code = I("get.code"); if (!empty($code)) { $getData['code'] = $code; } else { $getData['code'] = $this->getToken($jumpUrl); } $getData['grant_type'] = "authorization_code"; $data = http_request($getData, $url, false); $retArray = json_decode($data, true); $openid = $retArray['openid']; return $openid; }
function auth($cert) { $api_sig = md5($this->sec_key . 'api_key' . $this->api_key . 'cert' . $cert); $url = HATENA_URL_XML . '?api_key=' . $this->api_key . '&cert=' . $cert . '&api_sig=' . $api_sig; $data = http_request($url); if ($data['rc'] != 200) { return array('has_error' => 'true', 'message' => $data['rc']); } $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $data['data'], $val, $index); xml_parser_free($xml_parser); foreach ($val as $x) { if ($x['type'] != 'complete') { continue; } $this->response[strtolower($x['tag'])] = $x['value']; } return $this->response; }
/** * 認証 * @param string $cert * @return boolean */ function auth($cert) { $query = array('api_key' => $this->api_key, 'api_sig' => $this->sig, 'cert' => $cert); $url = self::HATENA_URL_XML . http_build_query($query); $data = http_request($url); if ($data['rc'] != 200) { return array('has_error' => 'true', 'message' => $data['rc']); } $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $data['data'], $val, $index); xml_parser_free($xml_parser); foreach ($val as $x) { if ($x['type'] !== 'complete') { continue; } $this->response[strtolower($x['tag'])] = $x['value']; } return $this->response; }
function plugin_brokenlink_action() { global $vars, $_brokenlink_msg; $retval = array('msg' => $_brokenlink_msg['msg_title'], 'body' => ''); if (empty($vars['page'])) { $retval['body'] = $_brokenlink_msg['msg_param_error']; return $retval; } // ユーザ認証されていない $id = Auth::check_auth(); if (empty($id)) { $retval['body'] = $_brokenlink_msg['msg_not_access']; return $retval; } if (!exist_plugin('xbel')) { $retval['body'] = $_brokenlink_msg['msg_not_found_xbel']; return $retval; } $links = xbel::get_link_list($vars['page']); $data = ''; foreach ($links as $href => $aname) { $rc = http_request($href, 'HEAD'); switch ($rc['rc']) { case 200: // Ok // Ok case 301: // Moved Permanently // Moved Permanently case 401: // Unauthorized continue; default: $data .= '-[[' . $aname . '>' . $href . ']] (' . $rc['rc'] . ")\n"; } } if ($data == '') { $data = $_brokenlink_msg['msg_all_ok']; } $retval['body'] = RendererFactorty::factory($data); return $retval; }
public function postLogin($args) { $username = Input::get('username'); $password = Input::get('password'); $this->validate(Input::all(), ['username' => 'required']); try { $user = new User(); $user = $user->find(['username', '=', $username]); // dd($user); if (count($user) === 1) { if (Hash::check($password, $user->password)) { Session::put(Config::get('session.name'), $user); return is_ajax() ? http_request() : Redirect::to('/'); } } } catch (\Exception $e) { throw $e; } return Redirect::back(); }
function auth($vars) { if (!isset($vars['sig'])) { return array('has_error' => 'true', 'message' => 'Signature is not found.'); } if (!isset($vars['token'])) { return array('has_error' => 'true', 'message' => 'Token is not found.'); } if (isset($vars['userdata'])) { $this->response['userdata'] = Utility::decode($vars['userdata']); } $query = array(); static $keys = array('app_key', 'userhash', 'token', 't', 'v', 'userdata'); foreach ($keys as $key) { if (!isset($vars[$key])) { continue; } $query[$key] = $vars[$key]; } $api_sig = $this->make_hash($query); if ($api_sig !== $vars['sig']) { return array('has_error' => 'true', 'message' => 'Comparison error of signature.'); } // ログオンしてから 10分経過している場合には、タイムアウトとする $time_out = UTIME - self::LIVEDOOR_TIMEOUT; if ($vars['t'] < $time_out) { return array('has_error' => 'true', 'message' => 'The time-out was done.'); } if (LIVEDOOR_PERMS !== 'id') { return array('has_error' => 'false', 'message' => ''); } $post = array('app_key' => $this->app_key, 'format' => 'xml', 'token' => $vars['token'], 't' => UTIME, 'v' => self::LIVEDOOR_VERSION); $post['sig'] = $this->make_hash($post); $data = http_request(self::LIVEDOOR_URL_GETID, 'POST', '', $post); if ($data['rc'] != 200) { return array('has_error' => 'true', 'message' => $data['rc']); } $this->responce_xml_parser($data['data']); $has_error = $this->response['error'] == 0 ? 'false' : 'true'; return array('has_error' => $has_error, 'message' => $this->response['message']); }
/** * Send a HTTP request to a URI using HTTP extension. * * Does not support non-blocking. * * @param string $url The URL to handle. * @param str|array $args Optional. Override the defaults. * * @return array 'headers', 'body', 'cookies' and 'response' keys. */ protected function _doExecute($url, $args) { switch ($args[org_tubepress_impl_http_HttpClientChain::ARGS_METHOD]) { case org_tubepress_api_http_HttpClient::HTTP_METHOD_POST: $args[org_tubepress_impl_http_HttpClientChain::ARGS_METHOD] = HTTP_METH_POST; break; case org_tubepress_api_http_HttpClient::HTTP_METHOD_PUT: $args[org_tubepress_impl_http_HttpClientChain::ARGS_METHOD] = HTTP_METH_PUT; break; case org_tubepress_api_http_HttpClient::HTTP_METHOD_GET: default: $args[org_tubepress_impl_http_HttpClientChain::ARGS_METHOD] = HTTP_METH_GET; } $urlAsArray = parse_url($url); if ('http' != $urlAsArray['scheme'] && 'https' != $urlAsArray['scheme']) { $url = preg_replace('|^' . preg_quote($urlAsArray['scheme'], '|') . '|', 'http', $url); } $sslVerify = isset($args[org_tubepress_impl_http_HttpClientChain::ARGS_SSL_VERIFY]) && $args[org_tubepress_impl_http_HttpClientChain::ARGS_SSL_VERIFY]; $args[org_tubepress_impl_http_HttpClientChain::ARGS_TIMEOUT] = (int) ceil($args[org_tubepress_impl_http_HttpClientChain::ARGS_TIMEOUT]); $options = array('timeout' => $args[org_tubepress_impl_http_HttpClientChain::ARGS_TIMEOUT], 'connecttimeout' => $args[org_tubepress_impl_http_HttpClientChain::ARGS_TIMEOUT], 'redirect' => 5, 'useragent' => $args[org_tubepress_impl_http_HttpClientChain::ARGS_USER_AGENT], 'headers' => $args[org_tubepress_impl_http_HttpClientChain::ARGS_HEADERS], 'ssl' => array('verifypeer' => $sslVerify, 'verifyhost' => $sslVerify)); $strResponse = @http_request($args[org_tubepress_impl_http_HttpClientChain::ARGS_METHOD], $url, $args[org_tubepress_impl_http_HttpClientChain::ARGS_BODY], $options, $info); // Error may still be set, Response may return headers or partial document, and error // contains a reason the request was aborted, eg, timeout expired or max-redirects reached. if (false === $strResponse || !empty($info['error'])) { throw new Exception($info['response_code'] . ': ' . $info['error']); } $headersBody = self::_breakRawStringResponseIntoHeaderAndBody($strResponse); $theHeaders = $headersBody[org_tubepress_impl_http_HttpClientChain::ARGS_HEADERS]; $theBody = $headersBody[org_tubepress_impl_http_HttpClientChain::ARGS_BODY]; unset($headersBody); $theHeaders = self::_getProcessedHeaders($theHeaders); if (!empty($theBody) && isset($theHeaders['headers']['transfer-encoding']) && 'chunked' == $theHeaders['headers']['transfer-encoding']) { $theBody = @http_chunked_decode($theBody); } if (true === $args['decompress'] && true === org_tubepress_impl_http_clientimpl_Encoding::shouldDecode($theHeaders['headers'])) { $theBody = http_inflate($theBody); } return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theHeaders['response'], 'cookies' => $theHeaders['cookies']); }
function get_regkeys() { $rc = array(); $regkeys = CACHE_DIR . 'regkeys.txt'; $now = time(); if (file_exists($regkeys)) { $time_regkeys = filemtime($regkeys) + TYPEKEY_CACHE_TIME; } else { $time_regkeys = $now; } if ($now < $time_regkeys) { $idx = 0; $data = file($regkeys); } else { $data = http_request(TYPEKEY_REGKEYS); // if ($data['rc'] != 200) return $rc; if ($data['timeout'] && file_exists($regkeys)) { // タイムアウト時でキャッシュがあれば、再利用する。 $idx = 0; $data = file($regkeys); } else { $idx = 'data'; $fp = fopen($regkeys, 'w'); @flock($fp, LOCK_EX); rewind($fp); fputs($fp, $data[$idx]); @flock($fp, LOCK_UN); fclose($fp); } } foreach (explode(' ', $data[$idx]) as $x) { list($key, $val) = explode('=', $x); $rc[$key] = trim($val); } return $rc; }
function shareJuez() { $juez1 = http_request("Juez1", "i", 1); $juez2 = http_request("Juez2", "i", 1); $sql = "UPDATE Mangas SET Juez1={$juez1}, Juez2={$juez2} WHERE ( Jornada={$this->jornada} )"; $res = $this->query($sql); if (!$res) { return $this->error($this->conn->error); } $this->myLogger->leave(); return ""; }
/** * search all jornadas related to provided prueba that matches provided criteria * @param {integer} $allowClosed 1:allow listing closed jornadas; 0:don't * @param {integer} $hideUnassigned 1:exclude, 0:include '-- Sin asignar --' journeys * @return {array} requested data */ function searchByPrueba($allowClosed = 0, $hideUnassigned = 0) { $this->myLogger->enter(); // evaluate search terms $q = http_request("q", "s", ""); $cerrada = $allowClosed == 0 ? " AND ( Cerrada=0 )" : ""; $unassigned = $hideUnassigned == 1 ? " AND ( Nombre <> '-- Sin asignar --' )" : ""; $where = "( Prueba = {$this->prueba} ) {$cerrada} {$unassigned}"; if ($q !== "") { $where = "( Prueba = {$this->prueba} ) {$cerrada} {$unassigned} AND ( (Nombre LIKE '%{$q}%') OR (Numero LIKE '%{$q}%') ) "; } // retrieve result from parent __select() call $result = $this->__select("*", "Jornadas", $where, "Numero ASC", ""); // return composed array $this->myLogger->leave(); return $result; }
function http_req($url, $params = array()) { //init params $config = array('method' => 'GET', 'headers' => '', 'post' => array(), 'redirect_max' => 2, 'content_charset' => '', 'ua' => 'PHPScript', 'proxy_host' => '', 'no_proxy' => array('localhost', '127.0.0.0/8', '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', 'no-proxy.com'), 'use_proxy' => FALSE, 'proxy_port' => '', 'need_proxy_auth' => 'FALSE', 'proxy_auth_user' => '', 'proxy_auth_pass' => ''); //update foreach ($config as $key => $val) { if (isset($params[$key])) { $config[$key] = $params[$key]; } } //make local values extract($config); if ($proxy_host != '') { if (!preg_match('#^[a-z]+://#', $proxy_host)) { $proxy_host = 'http://' . $proxy_host; } $proxy_params = parse_url($proxy_host); $proxy_host = $proxy_params['host']; $use_proxy = TRUE; $proxy_port = isset($proxy_params['port']) ? $proxy_params['port'] : '8080'; $need_proxy_auth = isset($proxy_params['user']); $proxy_auth_user = isset($proxy_params['user']) ? $proxy_params['user'] : ''; $proxy_auth_pass = isset($proxy_params['pass']) ? $proxy_params['pass'] : ''; } // var_dump($method, $headers, $post, $redirect_max, $content_charset, $ua); // var_dump($proxy_host, $use_proxy, $proxy_port, $need_proxy_auth, $proxy_auth_user, $proxy_auth_pass); $rc = array(); $arr = parse_url($url); $via_proxy = $use_proxy ? !in_the_net($no_proxy, $arr['host']) : FALSE; // query $arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : ''; // port $arr['port'] = isset($arr['port']) ? $arr['port'] : 80; $url_base = $arr['scheme'] . '://' . $arr['host'] . ':' . $arr['port']; $url_path = isset($arr['path']) ? $arr['path'] : '/'; $url = ($via_proxy ? $url_base : '') . $url_path . $arr['query']; $query = $method . ' ' . $url . ' HTTP/1.0' . "\r\n"; $query .= 'Host: ' . $arr['host'] . "\r\n"; $query .= 'User-Agent: ' . $ua . "\r\n"; // Basic-auth for HTTP proxy server if ($need_proxy_auth && isset($proxy_auth_user) && isset($proxy_auth_pass)) { $query .= 'Proxy-Authorization: Basic ' . base64_encode($proxy_auth_user . ':' . $proxy_auth_pass) . "\r\n"; } // (Normal) Basic-auth for remote host if (isset($arr['user']) && isset($arr['pass'])) { $query .= 'Authorization: Basic ' . base64_encode($arr['user'] . ':' . $arr['pass']) . "\r\n"; } $query .= $headers; if (strtoupper($method) == 'POST') { // 'application/x-www-form-urlencoded', especially for TrackBack ping $POST = array(); foreach ($post as $name => $val) { $POST[] = $name . '=' . urlencode($val); } $data = join('&', $POST); if (preg_match('/^[a-zA-Z0-9_-]+$/', $content_charset)) { // Legacy but simple $query .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; } else { // With charset (NOTE: Some implementation may hate this) $query .= 'Content-Type: application/x-www-form-urlencoded' . '; charset=' . strtolower($content_charset) . "\r\n"; } $query .= 'Content-Length: ' . strlen($data) . "\r\n"; $query .= "\r\n"; $query .= $data; } else { $query .= "\r\n"; } $errno = 0; $errstr = ''; $fp = fsockopen($via_proxy ? $proxy_host : $arr['host'], $via_proxy ? $proxy_port : $arr['port'], $errno, $errstr, 30); if ($fp === FALSE) { return array('query' => $query, 'rc' => $errno, 'header' => '', 'data' => $errstr); } fputs($fp, $query); $response = ''; while (!feof($fp)) { $response .= fread($fp, 4096); } fclose($fp); $resp = explode("\r\n\r\n", $response, 2); $rccd = explode(' ', $resp[0], 3); // array('HTTP/1.1', '200', 'OK\r\n...') $rc = (int) $rccd[1]; switch ($rc) { case 301: // Moved Permanently // Moved Permanently case 302: // Moved Temporarily $matches = array(); if (preg_match('/^Location: (.+)$/m', $resp[0], $matches) && --$redirect_max > 0) { $url = trim($matches[1]); if (!preg_match('/^https?:\\//', $url)) { // Relative path to Absolute if ($url[0] != '/') { $url = substr($url_path, 0, strrpos($url_path, '/')) . '/' . $url; } $url = $url_base . $url; // Add sheme, host } // Redirect return http_request($url, $method, $headers, $post, $redirect_max); } } return array('query' => $query, 'rc' => $rc, 'header' => $resp[0], 'data' => $resp[1]); }
$this->SetFont($this->getFontName(), 'B', 11); // bold 11px $this->Cell($this->pos[13], 6, $puesto, 'LR', 0, $this->align[13], true); $this->Ln(); $rowcount++; } // Línea de cierre $this->Cell(array_sum($this->pos), 0, '', 'T'); $this->myLogger->leave(); } } // Consultamos la base de datos try { $idprueba = http_request("Prueba", "i", 0); $idjornada = http_request("Jornada", "i", 0); $idmanga = http_request("Manga", "i", 0); $mode = http_request("Mode", "i", 0); $mngobj = new Mangas("printResultadosByManga", $idjornada); $manga = $mngobj->selectByID($idmanga); $resobj = new Resultados("printResultadosByManga", $idprueba, $idmanga); $resultados = $resobj->getResultados($mode); // throw exception if pending dogs // Creamos generador de documento $pdf = new ResultadosByManga($idprueba, $idjornada, $manga, $resultados, $mode); $pdf->AliasNbPages(); $pdf->composeTable(); $pdf->Output("resultadosByManga.pdf", "D"); // "D" means open download dialog } catch (Exception $e) { die($e->getMessage()); }
/** * Check whether a URL is reachable * * @param string $url The address to check * @return boolean Whether the URL could be reached */ function does_url_exist($url) { $url_result = http_request($url, true); if (http_is_error($url_result)) { return false; } $status_code = $url_result['code']; return $status_code == 200; }
if (strstr($row['Categoria'], $item['Categoria']) === false) { continue; } $count++; } $this->Cell(15, 7, $count, 'LBR', 0, 'C', true); } else { $this->Cell(15, 7, "----", 'LBR', 0, 'C', true); } $this->Cell(50, 7, $row['Comentario'], 'LB', 0, 'C', true); $this->Cell(20, 7, $row['Horario'], 'LBR', 0, 'C', true); $rowcount++; $this->Ln(7); } $this->myLogger->leave(); return ""; } } // Consultamos la base de datos try { $prueba = http_request("Prueba", "i", 0); $jornada = http_request("Jornada", "i", 0); // Creamos generador de documento $pdf = new PrintTandas($prueba, $jornada); $pdf->AliasNbPages(); $pdf->composeTable(); $pdf->Output("ordenTandas.pdf", "D"); // "D" means open download dialog } catch (Exception $e) { die("Error accessing database: " . $e->getMessage()); }
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once __DIR__ . "/../tools.php"; require_once __DIR__ . "/../logging.php"; require_once __DIR__ . "/../auth/AuthManager.php"; require_once __DIR__ . "/classes/Inscripciones.php"; try { $result = null; $inscripciones = new Inscripciones("inscripcionFunctions", http_request("Prueba", "i", 0)); $am = new AuthManager("inscripcionesFunctions"); $operation = http_request("Operation", "s", null); $perro = http_request("Perro", "i", 0); $equipo = http_request("Equipo", "i", 0); $jornada = http_request("Jornada", "i", 0); $olddorsal = http_request("Dorsal", "i", 0); $newdorsal = http_request("NewDorsal", "i", 0); if ($operation === null) { throw new Exception("Call to inscripcionFunctions without 'Operation' requested"); } switch ($operation) { case "insert": $am->access(PERMS_OPERATOR); $result = $inscripciones->insert($perro); break; // nueva inscripcion // nueva inscripcion case "update": $am->access(PERMS_OPERATOR); $result = $inscripciones->update($perro); break; // editar inscripcion ya existente
/** * Send a HTTP request to a URI using HTTP extension. * * Does not support non-blocking. * * @access public * @since 2.7 * * @param string $url * @param str|array $args Optional. Override the defaults. * @return array 'headers', 'body', 'cookies' and 'response' keys. */ function request($url, $args = array()) { $defaults = array('method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null, 'cookies' => array()); $r = wp_parse_args($args, $defaults); if (isset($r['headers']['User-Agent'])) { $r['user-agent'] = $r['headers']['User-Agent']; unset($r['headers']['User-Agent']); } else { if (isset($r['headers']['user-agent'])) { $r['user-agent'] = $r['headers']['user-agent']; unset($r['headers']['user-agent']); } } // Construct Cookie: header if any cookies are set WP_Http::buildCookieHeader($r); switch ($r['method']) { case 'POST': $r['method'] = HTTP_METH_POST; break; case 'HEAD': $r['method'] = HTTP_METH_HEAD; break; case 'PUT': $r['method'] = HTTP_METH_PUT; break; case 'GET': default: $r['method'] = HTTP_METH_GET; } $arrURL = parse_url($url); if ('http' != $arrURL['scheme'] || 'https' != $arrURL['scheme']) { $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url); } $is_local = isset($args['local']) && $args['local']; $ssl_verify = isset($args['sslverify']) && $args['sslverify']; if ($is_local) { $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify); } elseif (!$is_local) { $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify); } $options = array('timeout' => $r['timeout'], 'connecttimeout' => $r['timeout'], 'redirect' => $r['redirection'], 'useragent' => $r['user-agent'], 'headers' => $r['headers'], 'ssl' => array('verifypeer' => $ssl_verify, 'verifyhost' => $ssl_verify)); // The HTTP extensions offers really easy proxy support. $proxy = new WP_HTTP_Proxy(); if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) { $options['proxyhost'] = $proxy->host(); $options['proxyport'] = $proxy->port(); $options['proxytype'] = HTTP_PROXY_HTTP; if ($proxy->use_authentication()) { $options['proxyauth'] = $proxy->authentication(); $options['proxyauthtype'] = HTTP_AUTH_BASIC; } } if (!WP_DEBUG) { //Emits warning level notices for max redirects and timeouts $strResponse = @http_request($r['method'], $url, $r['body'], $options, $info); } else { $strResponse = http_request($r['method'], $url, $r['body'], $options, $info); } //Emits warning level notices for max redirects and timeouts // Error may still be set, Response may return headers or partial document, and error // contains a reason the request was aborted, eg, timeout expired or max-redirects reached. if (false === $strResponse || !empty($info['error'])) { return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']); } if (!$r['blocking']) { return array('headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array()); } list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2); $theHeaders = WP_Http::processHeaders($theHeaders); if (!empty($theBody) && isset($theHeaders['headers']['transfer-encoding']) && 'chunked' == $theHeaders['headers']['transfer-encoding']) { if (!WP_DEBUG) { $theBody = @http_chunked_decode($theBody); } else { $theBody = http_chunked_decode($theBody); } } if (true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers'])) { $theBody = http_inflate($theBody); } $theResponse = array(); $theResponse['code'] = $info['response_code']; $theResponse['message'] = get_status_header_desc($info['response_code']); return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse, 'cookies' => $theHeaders['cookies']); }
/** * Perform handling of the given request. * * @param org_tubepress_api_http_HttpRequest $request The HTTP request. * * @return void */ protected function handleRequest(org_tubepress_api_http_HttpRequest $request) { $method = self::_getMethod($request); $url = $request->getUrl()->toString(); $body = $request->getEntity() === null ? null : $request->getEntity()->getContent(); $options = self::_buildOptionsArray($request); $rawResponse = @http_request($method, $url, $body, $options, $this->_info); if ($rawResponse === false || !empty($this->_info[self::$_info_error])) { throw new Exception($this->_info[self::$_info_responsecode] . ': ' . $this->_info[self::$_info_error]); } return $rawResponse; }
<?php header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); require_once __DIR__ . "/../server/tools.php"; require_once __DIR__ . "/../server/auth/Config.php"; require_once __DIR__ . "/../server/auth/AuthManager.php"; $config = Config::getInstance(); $am = new AuthManager("Videowall::parciales"); if (!$am->allowed(ENABLE_LIVESTREAM)) { include_once "unregistered.php"; return 0; } $combined = http_request("combined", "i", 0); ?> <!-- vwls_ordensalida.inc Copyright 2013-2016 by Juan Antonio Martinez ( juansgaviota at gmail dot com ) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
} // request prueba and jornada. invoke constructor $p = http_request("Prueba", "i", 0); $j = http_request("Jornada", "i", 0); $ot = new Tandas($file, $p, $j); // datos para listados, altas y bajas $id = http_request("ID", "i", 0); // tanda ID $d = http_request("Dorsal", "i", 0); $s = http_request("Sesion", "i", 0); // default is no session $a = http_request("Pendientes", "i", 0); // los siguiente campos se usan para drag and drop $f = http_request("From", "i", 0); $t = http_request("To", "i", 0); $w = http_request("Where", "i", 0); // 0:up 1:down if ($p <= 0 || $j <= 0) { throw new Exception("Call to tandasFunctions with Invalid Prueba:{$p} or Jornada:{$j} ID"); } switch ($operation) { case "insert": $am->access(PERMS_OPERATOR); $result = $ot->insert($ot->getHttpData()); break; case "update": $am->access(PERMS_ASSISTANT); $result = $ot->update($id, $ot->getHttpData()); break; case "delete": $am->access(PERMS_OPERATOR);