/**
  * @brief openid로그인
  **/
 function procMemberOpenIDLogin($validator = "procMemberOpenIDValidate")
 {
     $oModuleModel =& getModel('module');
     $config = $oModuleModel->getModuleConfig('member');
     if ($config->enable_openid != 'Y') {
         $this->stop('msg_invalid_request');
     }
     ob_start();
     require './modules/member/openid_lib/class.openid.php';
     require_once './modules/member/openid_lib/libcurlemu.inc.php';
     $user_id = Context::get('user_id');
     if (!$user_id) {
         $user_id = Context::get('openid');
     }
     $referer_url = Context::get('referer_url');
     if (!$referer_url) {
         $referer_url = $_SERVER['HTTP_REFERER'];
     }
     if (!$referer_url) {
         $referer_url = htmlspecialchars_decode(getRequestUri(RELEASE_SSL));
     }
     $openid = new SimpleOpenID();
     $openid->SetIdentity($user_id);
     $openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]);
     $openid->SetRequiredFields(array('email'));
     $openid->SetOptionalFields(array('dob'));
     if (!$openid->GetOpenIDServer()) {
         $error = $openid->GetError();
         $this->setError(-1);
         $this->setMessage($error['description']);
         if (Context::getRequestMethod() == 'POST') {
             header("location:" . $referer_url);
         }
     } else {
         $goto = urlencode($referer_url);
         $ApprovedURL = Context::getRequestUri(RELEASE_SSL) . "?module=member&act=" . $validator . "&goto=" . $goto;
         $openid->SetApprovedURL($ApprovedURL);
         $url = $openid->GetRedirectURL();
         $this->add('redirect_url', $url);
         if (Context::getRequestMethod() == 'POST') {
             header("location:" . $url);
         }
     }
     ob_clean();
 }
Beispiel #2
0
function getBaseUrl($baseUrl = null)
{
    if ($baseUrl === null) {
        $filename = isset($_SERVER['SCRIPT_FILENAME']) ? basename($_SERVER['SCRIPT_FILENAME']) : '';
        if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) === $filename) {
            $baseUrl = $_SERVER['SCRIPT_NAME'];
        } elseif (isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) === $filename) {
            $baseUrl = $_SERVER['PHP_SELF'];
        } elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $filename) {
            $baseUrl = $_SERVER['ORIG_SCRIPT_NAME'];
            // 1and1 shared hosting compatibility
        } else {
            // Backtrack up the script_filename to find the portion matching
            // php_self
            $path = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
            $file = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';
            $segs = explode('/', trim($file, '/'));
            $segs = array_reverse($segs);
            $index = 0;
            $last = count($segs);
            $baseUrl = '';
            do {
                $seg = $segs[$index];
                $baseUrl = '/' . $seg . $baseUrl;
                ++$index;
            } while ($last > $index && false !== ($pos = strpos($path, $baseUrl)) && 0 != $pos);
        }
        // Does the baseUrl have anything in common with the request_uri?
        $requestUri = getRequestUri();
        if (0 === strpos($requestUri, $baseUrl)) {
            // full $baseUrl matches
            return $baseUrl;
        }
        if (0 === strpos($requestUri, dirname($baseUrl))) {
            // directory portion of $baseUrl matches
            $baseUrl = rtrim(dirname($baseUrl), '/');
            return $baseUrl;
        }
        $truncatedRequestUri = $requestUri;
        if (($pos = strpos($requestUri, '?')) !== false) {
            $truncatedRequestUri = substr($requestUri, 0, $pos);
        }
        $basename = basename($baseUrl);
        if (empty($basename) || !strpos($truncatedRequestUri, $basename)) {
            // no match whatsoever; set it blank
            return '';
        }
        // If using mod_rewrite or ISAPI_Rewrite strip the script filename
        // out of baseUrl. $pos !== 0 makes sure it is not matching a value
        // from PATH_INFO or QUERY_STRING
        if (strlen($requestUri) >= strlen($baseUrl) && (false !== ($pos = strpos($requestUri, $baseUrl)) && $pos !== 0)) {
            $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
        }
    }
    return rtrim($baseUrl, '/');
}
function assembleUrl($domain)
{
    $scheme = isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS'] ? 'https' : 'http';
    $port = isset($_SERVER['SERVER_PORT']) && 80 == $_SERVER['SERVER_PORT'] ? '' : $_SERVER['SERVER_PORT'];
    return $scheme . '://' . $domain . getRequestUri() . getRequestQueryString();
}
Beispiel #4
0
function returnWidgetCode()
{
    $original = get_option("original_l");
    $request_uri = getRequestUri();
    $thisL = getLangFromUrl($request_uri);
    $url = isset($thisL) && $thisL != '' ? substr($request_uri, 3) : $request_uri;
    $full = get_option("is_fullname") == 'on';
    $current = isset($thisL) && $thisL != '' ? $thisL : $original;
    $list = "<ul>";
    $destEx = explode(",", get_option("destination_l"));
    array_unshift($destEx, $original);
    foreach ($destEx as $d) {
        if ($d != $current) {
            $list .= '<li class="' . $d . '"><a wg-notranslate href="' . ($d != $original ? replaceUrl($url, $d) : replaceUrl($url, '')) . '">' . ($full ? getLangNameFromCode($d, false) : strtoupper($d)) . '</a></li>';
        }
    }
    $list .= "</ul>";
    $moreclass = get_option("with_flags") == 'on' ? 'wg-flags ' : '';
    $moreclass .= get_option("is_dropdown") == 'on' ? 'wg-drop ' : 'wg-list ';
    $button = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css"><!--Weglot 0.34--><aside id="weglot_switcher" wg-notranslate class="' . $moreclass . 'country-selector closed" onclick="openClose(this);" ><div class="current ' . $current . '"><a href="javascript:void(0);">' . ($full ? getLangNameFromCode($current, false) : strtoupper($current)) . '</a></div>' . $list . '</aside>';
    return $button;
}
Beispiel #5
0
/**
 * Returns the the full current URL. NOTE! NO FILTERING/SANITIZING!
 * @return String: full URL
 */
function getFullUrl($withgets = true) {
  $path = getRequestUri($withgets);
  return fullHost() . $path;
}