本文整理汇总了PHP中HttpRequest::getPathUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::getPathUrl方法的具体用法?PHP HttpRequest::getPathUrl怎么用?PHP HttpRequest::getPathUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::getPathUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildURL
function buildURL($p = '')
{
$index = '';
if (defined("INDEX_FILE")) {
$index = INDEX_FILE;
} else {
$index = 'index.php';
}
$url = HttpRequest::getPathUrl();
$nb = strlen($url);
if ($nb == 0 || $url[$nb - 1] != "/") {
$index = '/' . $index . '/';
} else {
$index = $index . '/';
}
return "http://" . $_SERVER['HTTP_HOST'] . HttpRequest::getPathUrl() . $index . Util::getActionString($p);
}
示例2: redirection
/**
*
*/
static function redirection($pRedirection = "", $pSauvegarde = true)
{
$index = '';
if (defined("INDEX_FILE")) {
$index = INDEX_FILE;
} else {
$index = 'index.php';
}
$url = HttpRequest::getPathUrl();
$nb = strlen($url);
# save actual path
if ($pSauvegarde) {
$_SESSION['originUrl'] = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
# FIXME surement � am�liorer
if ($pRedirection != "" && substr($pRedirection, 0, 7) == "http://") {
header("Location: " . $pRedirection);
} else {
if ($nb == 0 || $url[$nb - 1] != "/") {
header("Location: http://" . $_SERVER['HTTP_HOST'] . $url . "/" . $index . "/" . $pRedirection);
} else {
header("Location: http://" . $_SERVER['HTTP_HOST'] . $url . $index . "/" . $pRedirection);
}
}
exit(0);
}
示例3: logout
/**
* The logout action has to be triggered through an HTTP GET Request. It allows the user
* to quit gracefully the system.
*
*/
public function logout()
{
// for openid sso
if (OPENID_SSO_MODE) {
setcookie('default_openid', false, 0, HttpRequest::getPathUrl());
}
Auth::logout();
DefaultFC::redirection('wall/index');
}
示例4: finish_auth
public function finish_auth()
{
$always_trust = false;
if (isset($_GET['pal_trust'])) {
$always_trust = true;
// we hide this parameter from the openid library
unset($_GET['pal_trust']);
$_SERVER['QUERY_STRING'] = str_replace('&pal_trust=true', '', $_SERVER['QUERY_STRING']);
}
$db = DbUtil::accessFactory();
$store = new WMySqlStore($db);
$store->createTables();
$consumer =& new Auth_OpenID_Consumer($store);
$url = HttpRequest::getPathUrl();
$nb = strlen($url);
$base_url = '';
if ($nb == 0 || $url[$nb - 1] != "/") {
$base_url = "http://" . $_SERVER['HTTP_HOST'] . $url . "/";
} else {
$base_url = "http://" . $_SERVER['HTTP_HOST'] . $url;
}
$return_url = $base_url . 'index.php/openid/finish_auth';
// Complete the authentication process using the server's
// response.
$response = $consumer->complete($return_url);
$success = false;
// Check the response status.
if ($response->status == Auth_OpenID_CANCEL) {
// This means the authentication was cancelled.
$msg = __('Verification cancelled.');
} else {
if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message.
$msg = __("OpenID authentication failed: ") . $response->message;
} else {
if ($response->status == Auth_OpenID_SUCCESS) {
$success = true;
// This means the authentication succeeded; extract the
// identity URL and Simple Registration data (if it was
// returned).
$openid = $response->getDisplayIdentifier();
Auth::loginByOpenid($openid);
if (!Auth::isAuth()) {
$success = false;
$msg = __('Account not found.');
}
}
}
}
if ($success) {
// for openid sso
if (OPENID_SSO_MODE) {
if ($always_trust) {
setcookie('default_openid', $openid, time() + 60 * 60 * 24 * 30 * 12, HttpRequest::getPathUrl());
}
}
// Authentication process succeeded.
// FIXME: log this connection
// Redirection in the portal.
DefaultFC::redirection('wall/index');
exit;
} else {
$_SESSION['isError'] = true;
$_SESSION['message'] = $msg;
DefaultFC::redirection('users/index');
exit;
}
}