当前位置: 首页>>代码示例>>PHP>>正文


PHP http_status函数代码示例

本文整理汇总了PHP中http_status函数的典型用法代码示例。如果您正苦于以下问题:PHP http_status函数的具体用法?PHP http_status怎么用?PHP http_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了http_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_ajax

 /**
  * Step up
  *
  * @param Doku_Event $event
  */
 public function handle_ajax(Doku_Event $event)
 {
     if ($event->data != 'plugin_move_progress') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     global $INPUT;
     global $USERINFO;
     if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
         http_status(403);
         exit;
     }
     $return = array('error' => '', 'complete' => false, 'progress' => 0);
     /** @var helper_plugin_move_plan $plan */
     $plan = plugin_load('helper', 'move_plan');
     if (!$plan->isCommited()) {
         // There is no plan. Something went wrong
         $return['complete'] = true;
     } else {
         $todo = $plan->nextStep($INPUT->bool('skip'));
         $return['progress'] = $plan->getProgress();
         $return['error'] = $plan->getLastError();
         if ($todo === 0) {
             $return['complete'] = true;
         }
     }
     $json = new JSON();
     header('Content-Type: application/json');
     echo $json->encode($return);
 }
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:36,代码来源:progress.php

示例2: action_menu_rubriques_dist

/**
 * Action d'affichage en ajax du navigateur de rubrique du bandeau
 *
 * @uses gen_liste_rubriques()
 * @uses menu_rubriques()
 *
 * @return string
 *     Code HTML présentant la liste des rubriques
 **/
function action_menu_rubriques_dist()
{
    // si pas acces a ecrire, pas acces au menu
    // on renvoi un 401 qui fait echouer la requete ajax silencieusement
    if (!autoriser('ecrire')) {
        $retour = "<ul class='cols_1'><li class='toutsite'><a href='" . generer_url_ecrire('accueil') . "'>" . _T('public:lien_connecter') . "</a></li></ul>";
        include_spip('inc/actions');
        ajax_retour($retour);
        exit;
    }
    if ($date = intval(_request('date'))) {
        header("Last-Modified: " . gmdate("D, d M Y H:i:s", $date) . " GMT");
    }
    $r = gen_liste_rubriques();
    if (!$r and isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/')) {
        include_spip('inc/headers');
        header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
        http_status(304);
        exit;
    } else {
        include_spip('inc/actions');
        $ret = menu_rubriques();
        ajax_retour($ret);
    }
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:34,代码来源:menu_rubriques.php

示例3: action_telecharger_dump_dist

/**
 * Telecharger un dump quand on est webmestre
 * 
 * @param string $arg
 */
function action_telecharger_dump_dist($arg = null)
{
    if (!$arg) {
        $securiser_action = charger_fonction('securiser_action', 'inc');
        $arg = $securiser_action();
    }
    $file = dump_repertoire() . basename($arg, '.sqlite') . '.sqlite';
    if (file_exists($file) and autoriser('webmestre')) {
        $f = basename($file);
        // ce content-type est necessaire pour eviter des corruptions de zip dans ie6
        header('Content-Type: application/octet-stream');
        header("Content-Disposition: attachment; filename=\"{$f}\";");
        header("Content-Transfer-Encoding: binary");
        // fix for IE catching or PHP bug issue
        header("Pragma: public");
        header("Expires: 0");
        // set expiration time
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        if ($cl = filesize($file)) {
            header("Content-Length: " . $cl);
        }
        readfile($file);
    } else {
        http_status(404);
        include_spip('inc/minipres');
        echo minipres(_T('erreur') . ' 404', _T('info_acces_interdit'));
    }
    // et on finit comme ca d'un coup
    exit;
}
开发者ID:genma,项目名称:spip_ynh,代码行数:35,代码来源:telecharger_dump.php

示例4: info

 /**
  * Create the detail info for a single plugin
  *
  * @param Doku_Event $event
  * @param            $param
  */
 public function info(Doku_Event &$event, $param)
 {
     global $USERINFO;
     global $INPUT;
     if ($event->data != 'plugin_extension') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     if (empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
         http_status(403);
         echo 'Forbidden';
         exit;
     }
     header('Content-Type: text/html; charset=utf-8');
     $ext = $INPUT->str('ext');
     if (!$ext) {
         echo 'no extension given';
         return;
     }
     /** @var helper_plugin_extension_extension $extension */
     $extension = plugin_load('helper', 'extension_extension');
     $extension->setExtension($ext);
     /** @var helper_plugin_extension_list $list */
     $list = plugin_load('helper', 'extension_list');
     echo $list->make_info($extension);
 }
开发者ID:rsnitsch,项目名称:dokuwiki,代码行数:33,代码来源:action.php

示例5: minipres

function minipres($titre='', $corps="", $onload='')
{
	if (!defined('_AJAX')) define('_AJAX', false);
	if (!$titre) {
		if (!_AJAX)
			http_status(403);
		if (!$titre = _request('action')
		AND !$titre = _request('exec')
		AND !$titre = _request('page'))
			$titre = '?';

		$titre = htmlspecialchars($titre);

		$titre = ($titre == 'install')
		  ?  _T('avis_espace_interdit')
		  : $titre . '&nbsp;: '. _T('info_acces_interdit');
		$corps = generer_form_ecrire('accueil', '','',_T('public:accueil_site'));
		spip_log($GLOBALS['visiteur_session']['nom'] . " $titre " . $_SERVER['REQUEST_URI']);
	}

	if (!_AJAX)
		return install_debut_html($titre, $onload)
		. $corps
		. install_fin_html();
	else {
		include_spip('inc/headers');
		include_spip('inc/actions');
		$url = self('&',true);
		foreach ($_POST as $v => $c)
			$url = parametre_url($url, $v, $c, '&');
		echo ajax_retour("<div>".$titre . redirige_formulaire($url)."</div>",false);
	}
}
开发者ID:rhertzog,项目名称:lcs,代码行数:33,代码来源:minipres.php

示例6: redirige_par_entete

function redirige_par_entete($url, $equiv='', $status = 302) {
	if (!in_array($status,array(301,302)))
		$status = 302;
	
	$url = trim(strtr($url, "\n\r", "  "));
	# en theorie on devrait faire ca tout le temps, mais quand la chaine
	# commence par ? c'est imperatif, sinon l'url finale n'est pas la bonne
	if ($url[0]=='?')
		$url = url_de_base().(_DIR_RESTREINT?'':_DIR_RESTREINT_ABS).$url;
	if ($url[0]=='#')
		$url = self('&').$url;

	if ($x = _request('transformer_xml'))
		$url = parametre_url($url, 'transformer_xml', $x, '&');

	if (defined('_AJAX') AND _AJAX)
		$url = parametre_url($url, 'var_ajax_redir', 1, '&');
		
	// ne pas laisser passer n'importe quoi dans l'url
	$url = str_replace(array('<','"'),array('&lt;','&quot;'),$url);
	// interdire les url inline avec des pseudo-protocoles :
	if (
		(preg_match(",data:,i",$url) AND preg_match("/base64\s*,/i",$url))
		OR preg_match(",(javascript|mailto):,i",$url)
		)
		$url ="./";

	// Il n'y a que sous Apache que setcookie puis redirection fonctionne

	if (!$equiv OR (strncmp("Apache", $_SERVER['SERVER_SOFTWARE'],6)==0) OR defined('_SERVER_APACHE')) {
		@header("Location: " . $url);
		$equiv="";
	} else {
		@header("Refresh: 0; url=" . $url);
		$equiv = "<meta http-equiv='Refresh' content='0; url=$url'>";
	}
	include_spip('inc/lang');
	if ($status!=302)
		http_status($status);
	echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">',"\n",
	  html_lang_attributes(),'
<head>',
	  $equiv,'
<title>HTTP '.$status.'</title>
</head>
<body>
<h1>HTTP '.$status.'</h1>
<a href="',
	  quote_amp($url),
	  '">',
	  _T('navigateur_pas_redirige'),
	  '</a></body></html>';

	spip_log("redirige $status: $url");

	exit;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:57,代码来源:headers.php

示例7: presta_stripe_call_autoresponse_dist

/**
 * Gerer les webhooks Stripe
 *
 * @param array $config
 * @param null|array $response
 * @return array
 */
function presta_stripe_call_autoresponse_dist($config)
{
    include_spip('inc/bank');
    $mode = $config['presta'];
    if (isset($config['mode_test']) and $config['mode_test']) {
        $mode .= "_test";
    }
    // charger l'API Stripe avec la cle
    stripe_init_api($config);
    // Retrieve the request's body and parse it as JSON
    $input = @file_get_contents("php://input");
    $event_json = json_decode($input);
    $event_id = $event_json->id;
    $event = false;
    $erreur = $erreur_code = '';
    $res = false;
    try {
        // $event_id = 'evt_194CExB63f1NFl4k4qNLVNiS'; // debug
        // Verify the event by fetching it from Stripe
        $event = \Stripe\Event::retrieve($event_id);
    } catch (Exception $e) {
        if ($body = $e->getJsonBody()) {
            $err = $body['error'];
            list($erreur_code, $erreur) = stripe_error_code($err);
        } else {
            $erreur = $e->getMessage();
            $erreur_code = 'error';
        }
    }
    $inactif = "";
    if (!$config['actif']) {
        $inactif = "(inactif) ";
    }
    if ($erreur or $erreur_code) {
        spip_log('call_autoresponse ' . $inactif . ': ' . "{$erreur_code} - {$erreur}", $mode . 'auto' . _LOG_ERREUR);
    } else {
        if ($event) {
            $type = $event->type;
            $type = preg_replace(',\\W,', '_', $type);
            if (function_exists($f = "stripe_webhook_{$type}") or function_exists($f = $f . '_dist')) {
                spip_log("call_autoresponse : event {$type} => {$f}()", $mode . 'auto' . _LOG_DEBUG);
                $res = $f($config, $event);
            } else {
                spip_log("call_autoresponse : event {$type} - {$f} not existing", $mode . 'auto' . _LOG_DEBUG);
            }
        }
    }
    include_spip('inc/headers');
    http_status(200);
    // No Content
    header("Connection: close");
    if ($res) {
        return $res;
    }
    exit;
}
开发者ID:nursit,项目名称:bank,代码行数:63,代码来源:autoresponse.php

示例8: exec_menu_rubriques_dist

function exec_menu_rubriques_dist() {
	global $spip_ecran;
        
	header("Cache-Control: no-cache, must-revalidate");

	if ($date = intval(_request('date')))
		header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT");

	$r = gen_liste_rubriques(); 
	if (!$r
	AND isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
	AND !strstr($_SERVER['SERVER_SOFTWARE'],'IIS/')) {
		include_spip('inc/headers');
		header('Content-Type: text/html; charset='. $GLOBALS['meta']['charset']);
		http_status(304);
		} else {

		$largeur_t = ($spip_ecran == "large") ? 900 : 650;

		$arr_low = extraire_article(0, $GLOBALS['db_art_cache']);

		$total_lignes = $i = sizeof($arr_low);
		$ret = '';

		if ($i > 0) {
			$nb_col = min(8,ceil($total_lignes / 30));
			if ($nb_col <= 1) $nb_col =  ceil($total_lignes / 10);
			$max_lignes = ceil($total_lignes / $nb_col);
			$largeur = min(200, ceil($largeur_t / $nb_col)); 
			$count_lignes = 0;
			$style = " style='z-index: 0; vertical-align: top;'";
			$image = " petit-secteur";
			foreach( $arr_low as $id_rubrique => $titre_rubrique) {
				if ($count_lignes == $max_lignes) {
					$count_lignes = 0;

					$ret .= "</div></td>\n<td$style><div class='bandeau_rubriques'>";
				}
				$count_lignes ++;
				if (autoriser('voir','rubrique',$id_rubrique)){
				  $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i, $largeur, $image);
				  $i--;
				}
			}

			$ret = "<table><tr>\n<td$style><div class='bandeau_rubriques'>"
			  . $ret
			  . "\n</div></td></tr></table>\n";
		}

		include_spip('inc/actions');
		ajax_retour("<div>&nbsp;</div>" . $ret);
	}
}
开发者ID:rhertzog,项目名称:lcs,代码行数:54,代码来源:menu_rubriques.php

示例9: redirige_par_entete

function redirige_par_entete($url, $equiv = '', $status = 302)
{
    if (!in_array($status, array(301, 302))) {
        $status = 302;
    }
    $url = trim(strtr($url, "\n\r", "  "));
    # en theorie on devrait faire ca tout le temps, mais quand la chaine
    # commence par ? c'est imperatif, sinon l'url finale n'est pas la bonne
    if ($url[0] == '?') {
        $url = url_de_base() . $url;
    }
    if ($url[0] == '#') {
        $url = self('&') . $url;
    }
    # si profondeur non nulle et url relative, il faut la passer en absolue
    if ($GLOBALS['profondeur_url'] > (_DIR_RESTREINT ? 1 : 2) and !preg_match(",^(\\w+:)?//,", $url)) {
        include_spip("inc/filtres_mini");
        $url = url_absolue($url);
    }
    if ($x = _request('transformer_xml')) {
        $url = parametre_url($url, 'transformer_xml', $x, '&');
    }
    if (defined('_AJAX') and _AJAX) {
        $url = parametre_url($url, 'var_ajax_redir', 1, '&');
    }
    // ne pas laisser passer n'importe quoi dans l'url
    $url = str_replace(array('<', '"'), array('&lt;', '&quot;'), $url);
    // interdire les url inline avec des pseudo-protocoles :
    if (preg_match(",data:,i", $url) and preg_match("/base64\\s*,/i", $url) or preg_match(",(javascript|mailto):,i", $url)) {
        $url = "./";
    }
    // Il n'y a que sous Apache que setcookie puis redirection fonctionne
    include_spip('inc/cookie');
    if (!$equiv and !spip_cookie_envoye() or (strncmp("Apache", $_SERVER['SERVER_SOFTWARE'], 6) == 0 or defined('_SERVER_APACHE'))) {
        @header("Location: " . $url);
        $equiv = "";
    } else {
        @header("Refresh: 0; url=" . $url);
        $equiv = "<meta http-equiv='Refresh' content='0; url={$url}'>";
    }
    include_spip('inc/lang');
    if ($status != 302) {
        http_status($status);
    }
    echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">', "\n", html_lang_attributes(), '
<head>', $equiv, '
<title>HTTP ' . $status . '</title>
</head>
<body>
<h1>HTTP ' . $status . '</h1>
<a href="', quote_amp($url), '">', _T('navigateur_pas_redirige'), '</a></body></html>';
    spip_log("redirige {$status}: {$url}");
    exit;
}
开发者ID:genma,项目名称:spip_ynh,代码行数:54,代码来源:headers.php

示例10: ob_etag

function ob_etag($s)
{
    global $_SERVER;
    $etag = md5($s);
    if (strstr($_SERVER['HTTP_IF_NONE_MATCH'], $etag)) {
        http_status(304, "Not Modified");
        return '';
    } else {
        header("ETag: \"{$etag}\"");
        return $s;
    }
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:12,代码来源:etag.php

示例11: system_down

function system_down()
{
    http_status(503, 'Service Unavailable');
    echo <<<EOT
<html>
<head><title>System Unavailable</title></head>
<body>
Apologies but this site is unavailable at the moment. Please try again later.
</body>
</html>
EOT;
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:12,代码来源:system_unavailable.php

示例12: redirige_par_entete

/**
 * Envoyer le navigateur sur une nouvelle adresse
 *
 * Le tout en évitant les attaques par la redirection (souvent indique par un `$_GET`)
 *
 * @example
 *     ```
 *     $redirect = parametre_url(urldecode(_request('redirect')),'id_article=' . $id_article);
 *     include_spip('inc/headers');
 *     redirige_par_entete($redirect);
 *     ```
 *
 * @param string $url URL de redirection
 * @param string $equiv ?
 * @param int $status Code de redirection (301 ou 302)
 **/
function redirige_par_entete($url, $equiv = '', $status = 302)
{
    if (!in_array($status, array(301, 302))) {
        $status = 302;
    }
    $url = trim(strtr($url, "\n\r", "  "));
    # si l'url de redirection est relative, on la passe en absolue
    if (!preg_match(",^(\\w+:)?//,", $url)) {
        include_spip("inc/filtres_mini");
        $url = url_absolue($url);
    }
    if ($x = _request('transformer_xml')) {
        $url = parametre_url($url, 'transformer_xml', $x, '&');
    }
    if (defined('_AJAX') and _AJAX) {
        $url = parametre_url($url, 'var_ajax_redir', 1, '&');
    }
    // ne pas laisser passer n'importe quoi dans l'url
    $url = str_replace(array('<', '"'), array('&lt;', '&quot;'), $url);
    // interdire les url inline avec des pseudo-protocoles :
    if (preg_match(",data:,i", $url) and preg_match("/base64\\s*,/i", $url) or preg_match(",(javascript|mailto):,i", $url)) {
        $url = "./";
    }
    // Il n'y a que sous Apache que setcookie puis redirection fonctionne
    include_spip('inc/cookie');
    if (!$equiv and !spip_cookie_envoye() or (strncmp("Apache", $_SERVER['SERVER_SOFTWARE'], 6) == 0 or defined('_SERVER_APACHE'))) {
        @header("Location: " . $url);
        $equiv = "";
    } else {
        @header("Refresh: 0; url=" . $url);
        if (isset($GLOBALS['meta']['charset'])) {
            @header("Content-Type: text/html; charset=" . $GLOBALS['meta']['charset']);
        }
        $equiv = "<meta http-equiv='Refresh' content='0; url={$url}'>";
    }
    include_spip('inc/lang');
    if ($status != 302) {
        http_status($status);
    }
    echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">', "\n", html_lang_attributes(), '
<head>', $equiv, '
<title>HTTP ' . $status . '</title>
' . (isset($GLOBALS['meta']['charset']) ? '<meta http-equiv="Content-Type" content="text/html;charset=' . $GLOBALS['meta']['charset'] . '">' : '') . '
</head>
<body>
<h1>HTTP ' . $status . '</h1>
<a href="', quote_amp($url), '">', _T('navigateur_pas_redirige'), '</a></body></html>';
    spip_log("redirige {$status}: {$url}");
    exit;
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:66,代码来源:headers.php

示例13: call

 function call($methodname, $args)
 {
     try {
         $result = $this->remote->call($methodname, $args);
         return $result;
     } catch (RemoteAccessDeniedException $e) {
         if (!isset($_SERVER['REMOTE_USER'])) {
             http_status(401);
             return new IXR_Error(-32603, "server error. not authorized to call method {$methodname}");
         } else {
             http_status(403);
             return new IXR_Error(-32604, "server error. forbidden to call the method {$methodname}");
         }
     } catch (RemoteException $e) {
         return new IXR_Error($e->getCode(), $e->getMessage());
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:17,代码来源:xmlrpc.php

示例14: info

 /**
  * Create the detail info for a single plugin
  *
  * @param Doku_Event $event
  * @param            $param
  */
 public function info(Doku_Event &$event, $param)
 {
     global $USERINFO;
     global $INPUT;
     if ($event->data != 'plugin_extension') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     if (empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
         http_status(403);
         echo 'Forbidden';
         exit;
     }
     $ext = $INPUT->str('ext');
     if (!$ext) {
         http_status(400);
         echo 'no extension given';
         return;
     }
     /** @var helper_plugin_extension_extension $extension */
     $extension = plugin_load('helper', 'extension_extension');
     $extension->setExtension($ext);
     $act = $INPUT->str('act');
     switch ($act) {
         case 'enable':
         case 'disable':
             $json = new JSON();
             $extension->{$act}();
             //enables/disables
             $reverse = $act == 'disable' ? 'enable' : 'disable';
             $return = array('state' => $act . 'd', 'reverse' => $reverse, 'label' => $extension->getLang('btn_' . $reverse));
             header('Content-Type: application/json');
             echo $json->encode($return);
             break;
         case 'info':
         default:
             /** @var helper_plugin_extension_list $list */
             $list = plugin_load('helper', 'extension_list');
             header('Content-Type: text/html; charset=utf-8');
             echo $list->make_info($extension);
     }
 }
开发者ID:wernerflamme,项目名称:dokuwiki,代码行数:49,代码来源:action.php

示例15: handle_ajax

 /**
  * Pass Ajax call to a type
  *
  * @param Doku_Event $event event object by reference
  * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
  *                           handler was registered]
  */
 public function handle_ajax(Doku_Event $event, $param)
 {
     if ($event->data != 'plugin_struct') {
         return;
     }
     $event->preventDefault();
     $event->stopPropagation();
     global $conf;
     header('Content-Type: application/json');
     try {
         $result = $this->executeTypeAjax();
     } catch (StructException $e) {
         $result = array('error' => $e->getMessage() . ' ' . basename($e->getFile()) . ':' . $e->getLine());
         if ($conf['allowdebug']) {
             $result['stacktrace'] = $e->getTraceAsString();
         }
         http_status(500);
     }
     $json = new JSON();
     echo $json->encode($result);
 }
开发者ID:cosmocode,项目名称:dokuwiki-plugin-struct,代码行数:28,代码来源:ajax.php


注:本文中的http_status函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。