コード例 #1
0
    /**
     * @return String
     */
    public function calculate()
    {
        //check if canRead
        if($this->canRead())
        {
            //get current user id
            $userId = MMUsers::getCurrentUserId();

            //check if current user is logged
            if(!MMUsers::isAnonymous($userId))
            {
                //not json encode return
                $this->outputAsJson = false;

                //set XML header
                header('Content-Type: text/xml; charset=utf-8');

                //construct request
                $request = 'http://www.shef.ac.uk/FRAX/result.aspx?';
                foreach ($_REQUEST as $key => $value)
                {
                    if( in_array($key, self::$whiteList))
                        $request .= $key . '=' . $value . '&';
                }

                //add ID value
                $request .= 'ID=8376972874';

                $curl = curl_init();
                //set URL
                curl_setopt($curl, CURLOPT_URL, $request);
                //not display page content
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                //allow cookie session
                curl_setopt($curl, CURLOPT_COOKIESESSION, true);

                //exec and return curl request
                return curl_exec($curl);
            }
        }
    }
コード例 #2
0
<?php

/* @type $Params string[] */

$nodeID = $Params['nodeID'];
$node   = eZContentObjectTreeNode::fetch($nodeID);

header('Pragma: no-cache');
header('cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//TODO add context to login
if(MMUsers::isAnonymous(MMUsers::getCurrentUserId()))
{
    $host = eZSys::serverURL();
    $siteIni = eZINI::instance( 'site.ini' );
    $loginUrl = preg_replace('#^https?//[^/]+#', '', $siteIni->variable('SiteSettings', 'LoginPage'));
    $context = $host . '/esibuild/download/' . $nodeID;
    header( 'Location: ' . $loginUrl . '?context='.urlencode($context) );
    eZExecution::cleanExit();
}

//test if application allow download
if(!SecurityTool::getFileApplicationCanRead($node))
{
    header('HTTP/1.1 403 Forbidden');
    echo "<h1>Forbidden access</h1>\n";
    eZExecution::cleanExit();
}

if($node)
{
コード例 #3
0
            break;
        case 'fre-CA':
            $value = 'fr_CA'; 
            break;
        case 'eng-CA':
            $value = 'en_CA';
            break;
    }
    
    if( $value )
        setcookie( substr($value, -2) . '_Login', $value, 0, '/', CookieTool::getCookieDomain() );
    
}

$userId = MMUsers::getCurrentUserId();
if ( !MMUsers::isAnonymous($userId) )
{
    if ( SolrSafeOperatorHelper::featureIsActive( 'ToUPPPopin' ) )
    {
        if (
            ( !ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'useDedicatedPage' ) )
            ||
            ( ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature('ToUPPPopin','showOnMobile') && SolrSafeOperatorHelper::feature('ToUPPPopin','useDedicatedPageMobile') )
        )
        {
            $serviceLogin = ESBFactory::getLoginService( ServiceLoginBase::ESB_METHOD_AUTOLOGIN, $_REQUEST );
            if ( $serviceLogin->checkTouPPPopin( ESBFactory::getUserService()->form() ) )
            {
                CookieTool::destroyCookie( 'displayToUPPPopin' );
                CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
                $serviceLogin->login();
コード例 #4
0
 /**
  * @return bool
  */
 protected static function isLogged()
 {
     $userID = SessionTool::getSession( MMUsers::SESSION_USER_KEY );
     return is_string($userID) && !MMUsers::isAnonymous($userID);
 }