/** * @param int $applicationId * @return bool */ public static function hasCurrentUserAccessToApp($applicationId) { $userId = MMUsers::getCurrentUserId(); $authorizedUsers = self::fetchAllowedUsersByApplication($applicationId); return in_array($userId, $authorizedUsers); }
/** * @param eZContentObjectTreeNode $node * @return string */ public function getNodeUrl( &$node = null ) { $merckIni = ExternalLinkHandlerBase::iniMerck(); $user = MMUsers::getCurrentUserObject(); if ( !$user ) { self::redirectToErrorPage(); } $restUrl = $merckIni->variable( 'DriOnlineSettings', 'BaseLoginUrl' ); $vectorShared = mcrypt_create_iv( self::iv_size() ); $params = array( 'username' => $user->attribute( 'uuid' ), 'speciality' => $user->attribute( 'main_speciality' ), 'referrer' => $merckIni->variable( 'DriOnlineSettings', 'Referrer' ), 'action' => $merckIni->variable( 'DriOnlineSettings', 'Action' ), 'request_time' => time() ); $encodeArray = json_encode( $params ); $encodeArray = self::pad( $encodeArray ); $userEncrypt = $this->encrypt( $encodeArray, $vectorShared ); $urlParams = array( 'v' => base64_encode( $vectorShared ), 'val' => base64_encode( $userEncrypt ) ); return array( 'url' => $restUrl, 'params' => $urlParams ); }
/** * Form submission handler for sending sms * @return array */ public function sm() { $subject = ezpI18n::tr( 'application/contactus', 'MAIL SUBJECT' ); $message = $this->prepareMessageText(); if (SolrSafeOperatorHelper::featureIsActive('ContactForm') && SolrSafeOperatorHelper::feature('ContactForm', 'AnonymousPrivacyPolicyCheckbox') && MMUsers::getCurrentUserObject() == null) { if (!isset($_POST['Privacy_policy'])) { return array( 'error' => 1, ); } } if ($this->shouldAppendCountryOfRegistration()) { $prefix = !empty($_POST['countryOfResidence']) ? '[' . $_POST['countryOfResidence'] . ']' : ''; $subject = "{$prefix} " . $subject; } //Send mail $emailTool = new MailTool( $subject, $this->fromEmail, $this->toEmail, $message, self::CONTACTUS_LOG_NAME ); $emailTool->sendMail(); return array( 'redirect_url' => $this->redirectUrl ); }
/** * @param $token * @return bool */ public static function isUserTokenValid($token) { //get secret seed and add date (20140703) $secretSeed = self::getFormSecretSeed(); //get user id (anonymous or current logged user) $userId = MMUsers::getCurrentUserId() != -1 ? MMUsers::getCurrentUserId() : MMUsers::getAnonymousUserId(); //cluster identifier $clusterIdentifier = ClusterTool::clusterIdentifier(); if(sha1($secretSeed . date('Ymd') . $userId . $clusterIdentifier) == $token) { return true; } //yesterday date else if(sha1($secretSeed . date('Ymd', time() - 60 * 60 * 24) . $userId . $clusterIdentifier) == $token) { return true; } else { return false; } }
public static function getUserData() { $user = MMUsers::getCurrentUserObject(); return array( 'UID' => MMeLearningList::getCountryPrefixForElearning() . $user->attribute( 'uuid' ), 'CID' => CertificatesWebservice::getProperCountryId( $user ), ); }
/** * @return MMUsers */ public function user() { if( is_null($this->_user) ) { $this->_user = MMUsers::getCurrentUserObject(); } return $this->_user; }
public function getNodeUrl( &$node = null ) { $user = MMUsers::getCurrentUserObject(); if ( !$user ) { self::redirectToErrorPage(); } $url = $this->application()->applicationLocalized()->attribute( 'external_url' ); $url = $this->buildUrl($url, $user); return $url; }
public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized ) { parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized ); $this->user = MMUsers::getCurrentUserObject(); $ini = eZINI::instance( 'merck.ini' ); $this->applicationId = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ApplicationId' ); $this->clientId = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ClientId' ); $this->clientSecret = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ClientSecret' ); $this->tokenRequestUrl = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'TokenRequestUrl' ); $this->tokenFileName = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'TokenFileName' ); $this->serviceUrl = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ServiceUrl' ); $this->smsRecipients = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'SmsRecipients' ); }
/** * @return bool */ public function canRead(array $params) { $isPublic = $params['isPublic']; $isFull = $params['isFull']; $restrictionLevel = $this->applicationLocalized->restrictionLevel(); if( $restrictionLevel == ApplicationObject::RESTRICTION_LEVEL_LIMITED) { $id = MMUsers::getCurrentUserId(); $authorizedUsers = MMLimitedApplicationsAllowedUsers::fetchAllowedUsersByApplication($this->applicationLocalized->application_id); if(empty($authorizedUsers) || !in_array($id, $authorizedUsers)){ return false; } else { return true; } } $allowsPublicView = $this->getApplicationCustomParamater('allowsPublicView'); if( $isPublic && $allowsPublicView && MMUserHeader::tokenExists( isset( $_GET['t'] ) ? $_GET['t'] : false ) != null) { return true; } elseif( $isPublic ) { return false; } if( !BlockDefault::user() || // or if ToU not validated ( (bool)BlockDefault::user() && !BlockDefault::user()->toUValidated() && BlockDefault::iniMerck()->hasVariable( 'LoginSettings', 'ToUCheck' ) && BlockDefault::iniMerck()->variable( 'LoginSettings', 'ToUCheck') != 'disabled' ) ) { return !$isFull; } return null; }
/** * @param eZContentObjectTreeNode $node * @return string */ public function getNodeUrl(&$node = null) { $url = $this->application()->applicationLocalized()->attribute( 'external_url' ); $user = MMUsers::getCurrentUserObject(); if ( !$user ) { self::redirectToErrorPage(); } $uuid = $user->attribute( 'uuid' ); $queryData = array( 'id' => $uuid, ); $url = $url . '?' . http_build_query($queryData); return $url; }
/** * @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); } } }
/** * @param eZContentObjectTreeNode $node * @return string */ public function getNodeUrl( &$node = null ) { $baseUrl = $this->application()->applicationLocalized()->external_url; $user = MMUsers::getCurrentUserObject(); if ( !$user ) { self::redirectToErrorPage(); return false; } $userId = $user->getCurrentUserId(); $params = array( 'uumpid' => $userId, ); $queryString = http_build_query($params); $url = $baseUrl.'?'.$queryString; return $url; }
/** * Form submission handler for creating session at remote location */ public function cs() { $http = BlockDefault::http(); $oldPassword = $http->hasPostVariable( 'OldPassword' ) ? utf8_decode( stripslashes( $http->postVariable( 'OldPassword' ) ) ) : ''; $user = MMUsers::getCurrentUserObject(); if ( !$user instanceof MMUsers ) { //TODO: return when user is not instanceof MMUsers } $data = array( 'Username' => $user->attribute( 'uuid' ), 'Password' => $oldPassword, ); $postData = http_build_query( $data ); $curlHandler = curl_init( $this->createSessionURL ); curl_setopt( $curlHandler, CURLOPT_POST, count( $data ) ); curl_setopt( $curlHandler, CURLOPT_POSTFIELDS, $postData ); curl_setopt( $curlHandler, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt( $curlHandler, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $curlHandler, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $curlHandler, CURLOPT_HEADER, TRUE ); curl_setopt( $curlHandler, CURLOPT_FOLLOWLOCATION, TRUE ); $response = curl_exec( $curlHandler ); if ( curl_errno( $curlHandler ) ) { eZLog::write( 'Curl error: ' . curl_error( $curlHandler ), 'changepassword.log' ); } else { eZLog::write( 'Curl ended without any errors', 'changepassword.log' ); } eZLog::write( 'Curl status: ' . print_r( curl_getinfo( $curlHandler ), true ), 'changepassword.log' ); eZLog::write( "\nUsername: {$data['Username']}\nPassword: ****\nURL: {$this->createSessionURL}\nQuery: {$postData}\nResponse: {$response}\n", 'changepassword.log' ); curl_close( $curlHandler ); }
/** * @param eZContentObjectTreeNode $node * @return array */ public function getNodeUrl( &$node = null ) { $merckIni = ExternalLinkHandlerBase::iniMerck(); $action = $merckIni->variable( 'AlexandriaSettings' , 'Action' ); $referer = $merckIni->variable( 'AlexandriaSettings' , 'Referer' ); $uuid = MMUsers::getCurrentUserObject()->uuid; $baseUrl = $merckIni->variable( 'AlexandriaSettings' , 'BaseLoginUrl' ); $url = $this->application()->applicationLocalized()->external_url; $requestTime = time(); if ( !$uuid ) { self::redirectToErrorPage(); } $vectorShared = mcrypt_create_iv( Crypter::iv_size() ); $params = array( 'username' => $uuid, 'referer' => $referer, 'action' => $action, 'request_time' => $requestTime, 'URL' => $url ); $encodeArray = json_encode( $params ); $encodeArray = Crypter::pad( $encodeArray ); $userEncrypt = Crypter::encrypt( $encodeArray, $vectorShared ); $urlParams = array( 'v' => base64_encode( $vectorShared ), 'val' => base64_encode( $userEncrypt ) ); return array( 'url' => $baseUrl, 'params' => $urlParams ); }
/** * @param bool $forAnonmyous * @param null $processedUserCustomerType * @return int[] */ public static function fetchAuthorizedApplicationIds( $forAnonmyous = false, $processedUserCustomerType = null ) { if( !$forAnonmyous && !is_null(self::$_authorizedApplications) ) return self::$_authorizedApplications; $db = MMDB::instance(); $customerType = null; $mainSpeciality = null; $whereString = sprintf( " cluster_identifier='%s' AND environment & %d", $db->escapeString(ClusterTool::clusterIdentifier()), ContextTool::instance()->environment() ); $user = $forAnonmyous ? false : MMUsers::getCurrentUserObject(); if( $user ) { /* @var $user MMUsers */ $user = MMUsers::getCurrentUserObject(); $customerType = $user->attribute('customer_type'); $mainSpeciality = $user->attribute('main_speciality'); if( $user->hasAttribute('prefered_language')) { $language = $user->attribute('prefered_language'); $whereString.= sprintf( " AND ( language = '%s' OR language IS NULL OR language = '0' )", $db->escapeString($language) ); } if( $user->hasAttribute('country')) { $country = $user->attribute('country'); $whereString.= sprintf( " AND ( country = '%s' OR country IS NULL OR country = '0' )", $db->escapeString($country) ); } } if (!$customerType && $processedUserCustomerType) { $customerType = $processedUserCustomerType; } $whereString .= is_null($customerType) ? ' AND customer_type IS NULL ' : sprintf( " AND ( customer_type IS NULL OR customer_type = '0' OR customer_type='%s') ", $db->escapeString($customerType) ); $whereString .= is_null($mainSpeciality) ? ' AND main_speciality IS NULL ' : sprintf( " AND ( main_speciality IS NULL OR main_speciality = '0' OR main_speciality='%s') ", $db->escapeString($mainSpeciality) ); $sql = "SELECT * FROM mm_country_application_library WHERE ".$whereString." ORDER BY country DESC, language DESC, customer_type DESC, main_speciality DESC"; $lastProfile = null; $excludedApps = array(); $applicationIds = array(); foreach( $db->arrayQuery($sql) as $row ) { $profile = serialize( array($row['customer_type'], $row['main_speciality']) ); if( !is_null($lastProfile) && $profile != $lastProfile ) break; $lastProfile = $profile; if( $user && $user->hasAttribute('state') && !is_null($user->attribute('state')) && $row['state'] === $user->attribute('state') ) { $excludedApps[] = (int)$row['application_id']; continue; } $applicationIds[] = (int) $row['application_id']; } if( !empty($excludedApps) ) { foreach ( $applicationIds as $k => $appId ) { if( in_array($appId, $excludedApps ) ) unset( $applicationIds[$k] ); } $applicationIds = array_values($applicationIds); } if(SolrSafeOperatorHelper::featureIsActive('LearningNeedsAssessment')) { $applicationIds[] = ApplicationObject::fetchByIdentifier('learning-needs-assessment')->attribute('id'); } $applicationIds = array_unique( $applicationIds ); if( !$forAnonmyous ) self::$_authorizedApplications = $applicationIds; return $applicationIds; }
/** * @param int $quizId * @param int $applicationId * @return array */ static function getQuizData( $quizId, $applicationId, $isLocalQuiz = true ) { $quizData = self::fetchOneBy( array( 'quiz_id' => $quizId, 'application_id' => $applicationId ) ); if( !$quizData ) { // We don't have the quiz meta for the requested quiz, we try to create it (happens only once) $object =& eZContentObject::fetch( $quizId ); if( !$object ) return null; /* @type $dm eZContentObjectAttribute[] */ $dm = $object->DataMap(); $mc = $dm['media_content']->content(); if( isset( $mc['relation_list'][0]['node_id'] ) ) { $quiz =& eZContentObjectTreeNode::fetch( $mc['relation_list'][0]['node_id'] ); /* @type $quizDM eZContentObjectAttribute[] */ $quizDM = $quiz->DataMap(); self::add( $quizId, ClusterTool::clusterIdentifier(), $applicationId, (int)$quizDM['points']->content(), (int)$quizDM['correct_reply']->content() ); $quizData = self::fetchOneBy( array( 'quiz_id' => $quizId, 'application_id' => $applicationId ) ); } else { return null; } } $currentMMUser = MMUsers::getCurrentUserObject(); $currentUserResponse = false; $nbCorrect = (int)$quizData->attribute( 'nb_correct' ); $nbWrong = (int)$quizData->attribute( 'nb_wrong' ); if ( $currentMMUser ) { $responseFetchParams = array( 'quiz_id' => $quizId, 'uuid' => $currentMMUser->attribute( 'uuid' ), 'application_id' => $applicationId ); if (!$isLocalQuiz) { $responseFetchParams['cluster_identifier'] = null; } $currentUserResponse = QuizReply::fetchOneBy( $responseFetchParams ); } if( $currentUserResponse ) { $currentUserResponded = true; $answerWasCorrect = (bool)$currentUserResponse->attribute( 'is_correct' ); } else { $currentUserResponded = false; $answerWasCorrect = false; } $speRepliesResult = array( 'total' => 0, 'correct' => 0, 'wrong' => 0 ); $userSpecialtyTranslations = FacetFilteringTool::getTaxoTranslationWithIDs( 'user_specialty' ); if ( $currentMMUser ) { $userSpecialtyId = $userSpecialtyTranslations[$currentMMUser->attribute( 'user_speciality' )]['id']; $speReplies = QuizReply::fetchBySpecialtyInScoring( $currentMMUser->attribute( 'uuid' ), $quizId, $applicationId, $userSpecialtyId ); if( $speReplies ) { $speRepliesResult['total'] = count( $speReplies ); foreach( $speReplies as $reply ) { if( $reply['is_correct'] == 1 ) $speRepliesResult['correct']++; else $speRepliesResult['wrong']++; } } } $response = array( 'points' => (int)$quizData->attribute( 'points' ), 'correct_answer' => (int)$quizData->attribute( 'correct_answer' ), 'global_answers' => array( 'total' => ( $nbCorrect + $nbWrong ), 'correct' => $nbCorrect, 'wrong' => $nbWrong ), 'specialty_answers' => $speRepliesResult, 'current_user_responded' => $currentUserResponded, 'answer_was_correct' => $answerWasCorrect ); if( $currentUserResponded ) { /* @type $quizArticleDM eZContentObjectAttribute[] */ $quizArticleDM = eZContentObject::fetch( $quizId )->DataMap(); $mediaContent = $quizArticleDM["media_content"]->content(); $quizDM = eZContentObjectTreeNode::fetch( $mediaContent['relation_list'][0]['node_id'] )->DataMap(); $outputHandler = new eZXHTMLXMLOutput( $quizDM['commented_answer']->DataText, false ); $commentedAnswer = $outputHandler->outputText(); $response['commented_answer'] = $commentedAnswer; } return $response; }
<?php if ( MMUsers::getCurrentUserObject() ) { header( 'Content-Type: application/json' ); if ( isset( $_POST['remove_cookie'] ) ) { CookieTool::destroyCookie( 'displayToUPPPopin' ); CookieTool::destroyCookie( 'displayToUPPPopin', '/', null ); CookieTool::destroyCookie( 'displayToUPPPage' ); CookieTool::destroyCookie( 'displayToUPPPage', '/', null ); echo json_encode( array( 'result' => 0 ) ); eZExecution::cleanExit(); } $service = ESBFactory::getUserService(); $userProfile = $service->form(); $touPage = MMStaticPage::fetchPageByInternalId( 'terms-of-use' ); $privacyPolicyPageInternalId = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'shortPrivacyPolicyPageInternalId' ); $privacyPolicyPageInternalId = ( $privacyPolicyPageInternalId === false || is_null( $privacyPolicyPageInternalId ) || trim( $privacyPolicyPageInternalId ) == "" ) ? 'privacy-policy' : $privacyPolicyPageInternalId; $ppPage = MMStaticPage::fetchPageByInternalId( $privacyPolicyPageInternalId ); $currentToUConsentVersion = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentToUConsentVersion' ); $currentPPConsentVersion = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentPPConsentVersion' ); $hasCheckbox = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'hasCheckbox' ); $precheckedCheckbox = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'precheckedCheckbox' ); $adaptConsentText = in_array( ClusterTool::clusterIdentifier(), array( 'cluster_uk' ) ) ? true : false;
/** * @param string $content * @return array */ static function add( $content ) { $currentMMUser = MMUsers::getCurrentUserObject(); if( !$currentMMUser ) return false; $prcuh = self::fetchObject( self::definition(), null, array( 'md5_uuid' => md5( $currentMMUser->attribute( 'uuid' ) ) ) ); if( !$prcuh ) { $prcuh = new self(); $prcuh->setAttribute( 'md5_uuid', md5( $currentMMUser->attribute( 'uuid' ) ) ); } if( $prcuh && $content != 'undefined' ) { $prcuh->setAttribute( 'content', $content ); } $prcuh->store(); return array( 'token' => $prcuh->attribute( 'md5_uuid' ) ); }
/** * Accept NCCN Guidelines * @return array */ public function ang() { $user = MMUsers::getCurrentUserObject(); $date = $user->setNCCNGuidelinesApprovalExpiration(); MMUsers::setCookieUserPreferences(); return array( 'errorCode' => 0, 'date' => $date, ); }
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();
eZExecution::cleanExit(); } if ($position < 0) { echo "Position must be > 1"; eZExecution::cleanExit(); } $application = ApplicationLocalized::getLocalizedApplicationByIdentifier($applicationIdentifier); if ($application == null || $application instanceof ApplicationLocalized === false) { header('Location: /error_40x'); eZExecution::cleanExit(); } $user = MMUsers::getCurrentUserObject(); if ($user === false) { $siteIni = eZINI::instance( 'site.ini' ); $loginUrl = preg_replace('#^https?//[^/]+#', '', $siteIni->variable('SiteSettings', 'LoginPage')); $redirectUrl = $loginUrl . '?context='. urlencode("/service/app/{$applicationIdentifier}/{$function}/{$position}"); header('Location: ' . $redirectUrl); eZExecution::cleanExit(); } //we need to shift position by 1 $position--; $appList = $user->getApplicationList(); $appId = $application->application_id;
public static function getAndStoreGPNotebookHS() { if(!self::featureIsActive("GPNotebook")) return null; $key = self::feature("GPNotebook", "key"); $iv = self::feature("GPNotebook", "iv"); $data = array(); $service = ESBFactory::getUserService(); $user = $service->form(); if ( $user && $user['data']['errorCode'] == 0 && !is_null($user['data']['profile']['userId']) ) { $data = array( "uump_id" => $user['data']['profile']['userId'], "salutations" => $user['data']['profile']['salutation'], "first_name" => $user['data']['profile']['firstName'], "last_name" => $user['data']['profile']['lastName'], "work_address_1" => $user['data']['profile']['addressLine1'], "work_address_2" => $user['data']['profile']['addressLine2'], "work_address_postcode" => $user['data']['profile']['postalCode'], "email_address" => $user['data']['profile']['emailAddress'], "job_title" => $user['data']['profile']['customerType'], "speciality" => $user['data']['profile']['userSpecialty'], "country" => $user['data']['profile']['countryOfRegistration'], "professional_registration_number" => $user['data']['profile']['licenseNumber'] ); } $gpNotebookHS = self::encodeGPNotebook( json_encode($data), $key, $iv ); if(MMUsers::getCurrentUserObject()) { MMUsers::getCurrentUserObject()->setGPNotebookHS($gpNotebookHS); MMUsers::getCurrentUserObject()->setCookieUserPreferences(); } return $gpNotebookHS; }
<?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) {
/** * @return bool */ protected function addToApplicationList() { if ( isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ) { $user = MMUsers::getCurrentUserObject(); if ( !$user ) { return false; } $applicationList = $user->getApplicationList(); if ( !is_array($applicationList) ) { $applicationList = array(); } $applicationList[] = $_REQUEST['id']; AppBarControl::instance()->store($applicationList); return true; } return false; }
/** * @param bool $forceExternal * @return string */ public function applicationUrl( $forceExternal = false ) { $skipPage = (bool) $this->getCustomParameter( 'SkipExitPage' ) && ( is_object( MMUsers::getCurrentUserObject() ) ); // Direct redirect without exit page if( $this->getCustomParameter( 'DirectLinkOpen' ) == 1 ) { return $this->attribute( 'external_url' ); } $baseUrl = eZINI::instance()->variable( 'SiteAccessSettings', 'BaseUrl' ); $urlAlias = $this->attribute( 'url' ); if( !$urlAlias ) $urlAlias = $this->applicationObject()->attribute( 'url' ); // external if ( $forceExternal || ( $this->applicationObject->applicationType()->attribute('internal_type') == ApplicationObject::APPLICATION_TYPE_EXTERNAL ) ) { // Production //if(SolrSafeOperatorHelper::clusterIni("SocialSharing", "EntryExit", "merck.ini") == "enabled") if(SolrSafeOperatorHelper::featureIsActive("SocialSharing") && SolrSafeOperatorHelper::feature("SocialSharing", "EntryExit") && !$skipPage) return $baseUrl. $this->attribute( 'url' ); else return $baseUrl.'external/' . $this->attribute( 'url' ); /* Dev * return $baseUrl.'esibuild/main_view/app_content/' . $this->attribute( 'url' ); */ } return $baseUrl . $urlAlias; }
/** * @return array */ public static function applicationList() { # Hotfix #23450 note-8 if ( !isset($_COOKIE['remember_me']) ) { $cookieExpiration = time() + eZINI::instance('merck.ini')->variable('TIBCOCookieSettings', 'TIBCOCookieExpiration'); $uuid = MMUsers::getCurrentUserId(); setcookie('remember_me', MMUserLogin::encryptText(json_encode($uuid)), $cookieExpiration, '/', CookieTool::getCookieDomain()); } $out = array('applicationList' => array()); $host = 'http://' . self::host(); if ( isset($_POST['application']) ) { $applicationIdList = array((int) $_POST['application']); } else { $applicationIdList = AppBarControl::instance()->applicationIds(); } foreach ( $applicationIdList as $applicationId ) { if ( !is_numeric($applicationId) ) { continue; } $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByApplication($applicationId); $application = ($applicationLocalized) ? $applicationLocalized->applicationObject() : null; if ( $applicationLocalized ) { $application = $applicationLocalized->applicationObject(); } if ( isset($application) ) { $applicationType = $application->applicationType(); $icons = array( 'icon' => array( 'path' => '', 'md5' => '', 'file' => 'ico.png', ), 'icon_hd' => array( 'path' => '', 'md5' => '', 'file' => 'ico_notext_hd.png', ), 'icon_active' => array( 'path' => '', 'md5' => '', 'file' => 'ico_notext_active.png', ), 'icon_active_hd' => array( 'path' => '', 'md5' => '', 'file' => 'ico_notext_active_hd.png' ), ); foreach($icons as $key => $iconData) { $path = sprintf('apps/%s/%s', $application->attribute('identifier'), $iconData['file']); $fullPath = StaticData::clusterFilePath(ClusterTool::clusterIdentifier(), $path); if ($fullPath) { $icons[$key]['path'] = StaticData::externalUrl(ClusterTool::clusterIdentifier(), $path); $icons[$key]['md5'] = md5_file($fullPath); } } $path = '/' . $applicationLocalized->attribute('url'); $url = $host . $path; if ( $application->isPureExternal() ) { $url = $applicationLocalized->attribute("external_url"); } $outApplicationListArray = array( 'id' => $applicationId, 'identifier' => $application->attribute('identifier'), 'name' => $applicationLocalized->attribute('name'), 'headline' => $applicationLocalized->attribute('headline'), 'type' => $applicationType->attribute('internal_type'), 'url' => $url, 'path' => $path, 'javascript' => self::getJavascript($application->attribute('identifier'), 'application')); foreach($icons as $key => $icon) { $outApplicationListArray[$key] = array( '100' => array('path' => $icon['path'], $icon['md5']), ); } $out['applicationList'][] = $outApplicationListArray; } } return $out; }
/** * @param int $applicationId * @param int $season * @param bool $asObject * @return array|QuizPlayerScoring */ public static function fetchUserInSeason( $applicationId, $season, $asObject = true, $isLocalQuiz = true ) { $currentMMUser = MMUsers::getCurrentUserObject(); if( $currentMMUser ) { $params = array( 'uuid' => $currentMMUser->attribute( 'uuid' ), 'cluster_identifier' => ($isLocalQuiz) ? ClusterTool::clusterIdentifier() : '', 'application_id' => $applicationId, 'season' => $season, ); return self::fetchOneBy( $params, $asObject ); } return null; }
/** * @param eZContentObjectTreeNode $node * @return string */ public function getNodeUrl( &$node = null ) { $merckIni = ExternalLinkHandlerBase::iniMerck(); $user = MMUsers::getCurrentUserObject(); if ( !$user ) { self::redirectToErrorPage(); } $esbParams = $merckIni->variable( 'EsbSettings', 'AvailableParams' ); if ( !in_array( 'Validation_status', $esbParams ) ) { $esbParams[] = 'Validation_status'; } // esb part of url generating $parameters = array( 'Data' => array( 'Username' => $user->attribute( 'uuid' ), 'Params' => $esbParams ), 'cr' => $user->attribute( 'country' ) ); $esbResponse = WSHelper::call( 'read', $parameters ); if ( !isset( $esbResponse['Data']['Params']['Email_address'] ) ) { self::redirectToErrorPage(); } $validStatuses = array( 'VP', '30' ); $isProperStatus = isset( $esbResponse['Data']['Params']['Validation_status'] ) && in_array( $esbResponse['Data']['Params']['Validation_status'], $validStatuses ); // test if proper ESB response - mainly status = Success if ( !$isProperStatus ) { self::redirectToErrorPage(); } $soapUser = $esbResponse['Data']['Params']['Email_address']; $soapPassword = $merckIni->variable( 'MdConsultSettings', 'SoapPassword' ); $applicationId = $merckIni->variable( 'MdConsultSettings', 'ApplicationId' ); $apiKey = $merckIni->variable( 'MdConsultSettings', 'ApiKey' ); $headerNamespace = $merckIni->variable( 'MdConsultSettings', 'HeaderNamespace' ); //$soapUrl = $merckIni->variable( 'MdConsultSettings', 'SoapUrl' ); // @dirty fix => we use a local version of the WSDL because of some type declaration duplicates $soapUrl = __DIR__.'/externallinkhandlerbrmdconsult.xml'; $headerbody = array( 'UsernameToken' => array( 'Username' => $apiKey, 'Password' => $soapPassword ) ); // soap part of url generating $soap = new SoapClient( $soapUrl ); $header = new SOAPHeader( $headerNamespace, 'Security', $headerbody, false ); $soap->__setSoapHeaders( $header ); $params = array( array( 'SiteID' => 'MSDBRZL', 'UserName' => $soapUser, 'ApplicationId' => $applicationId ) ); $user = ''; $password = ''; try { $result = $soap->__soapCall( 'GetThirdPartyCredencials', $params ); if ( isset( $result->GetThirdPartyCredencialsResult ) && isset( $result->GetThirdPartyCredencialsResult->LOVValue ) ) { $credentials = $result->GetThirdPartyCredencialsResult->LOVValue; if ( isset( $credentials->lovIDField ) ) { $user = $credentials->lovIDField; } else { self::redirectToErrorPage(); } if ( isset( $credentials->valueField ) ) { $password = $credentials->valueField; } else { self::redirectToErrorPage(); } } else { self::redirectToErrorPage(); } } catch ( SoapFault $f ) { self::redirectToErrorPage(); } $url = $merckIni->variable( 'MdConsultSettings', 'MdUrl' ); $searches = array( '<$md_user>', '<$md_password>' ); $replacements = array( $user, $password ); $url = str_replace( $searches, $replacements, $url ); return $url; }
/** * @return string */ protected function startCourseOverWsdl() { $courseId = ( isset( $_POST['courseid'] ) && filter_var($_POST['courseid'], FILTER_VALIDATE_REGEXP, SecurityTool::$ELEARNING_COURSEID_REGEXP) ) ? $_POST['courseid'] : null; $soapUrl = SolrSafeOperatorHelper::feature('OnlineVortrageSettings', 'WsdlUrl'); $credentialLogin = SolrSafeOperatorHelper::feature('OnlineVortrageSettings', 'WsdlLogin'); $credentialPassword = SolrSafeOperatorHelper::feature('OnlineVortrageSettings', 'WsdlPassword'); $useLocale = SolrSafeOperatorHelper::feature('OnlineVortrageSettings', 'UseLocale'); $locale = SolrSafeOperatorHelper::feature('OnlineVortrageSettings', 'Locale'); $credentials = array( 'login' => $credentialLogin, 'password' => $credentialPassword, ); $params = array( array( 'username' => MMUsers::getCurrentUserId(), 'courseID' => $courseId, ) ); if ( $useLocale ) { $params[0]['locale'] = $locale; } try { $soap = new SoapClientAuth( $soapUrl, $credentials ); $result = $soap->__soapCall( 'UnivadisEncrypt', $params ); if ( isset($result) && isset($result->return) ) { $url = $result->return; if ( strpos($url, 'http') !== 0 || strpos($url, 'https') !== 0) { $url = 'http://' . $url; } if ( !ContextTool::instance()->isMobile() ) { $url = urlencode( urlencode( $url ) ); $url = '/external/deeplink?deeplink=' . $url . '&exit_strategy=0'; } return $url; } } catch ( SoapFault $f ) { } return false; }
public static function setCookie() { $country = self::country(); CookieTool::setCookie( self::COOKIE_KEY, self::countTotalFromUserSelection( MMUsers::getCurrentUserId(), $country ) ); }