/** * @param string $remoteId * @param array $remoteList * @param string $clusterIdentifier */ private function addView( $remoteId, $remoteList, $clusterIdentifier ) { $db = MMDB::instance(); array_push($remoteList, $remoteId); CookieTool::setCookie(self::FEEDBACK_COOKIE_NAME, $remoteList, CookieTool::getDefaultCookieExpiration()); $query = sprintf( "INSERT INTO mm_readcount_remote SET remote_id = '%s', cluster_identifier = '%s', date = '%s', count = 1, to_reindex = 1 ON DUPLICATE KEY UPDATE count = count + 1, date = '".date('Y-m-d H:i:s')."', to_reindex = 1", $remoteId, $db->escapeString($clusterIdentifier), date('Y-m-d H:i:s')); $db->query($query); }
/** * Logs in the user if applied username and password is * valid. The userID is returned if successful, false if not. * * @param array $params * @return bool */ public static function loginUser($params = null) { $uncryptedTicket = array(); if($params) { $uncryptedTicket["uuid"] = $params["Username"]; $uncryptedTicket["customerType"] = $params["Customer_type"]; $uncryptedTicket["userSpeciality"] = $params["User_specialty"]; $uncryptedTicket["state"] = $params["Province"]; $uncryptedTicket["country"] = $params["Country_of_registration"]; $uncryptedTicket['toUValidated'] = isset( $params['toUValidated'] ) ? $params['toUValidated'] : true; $uncryptedTicket['autologin'] = isset( $params['autologin'] ) ? $params['autologin'] : false; } else { $http = eZHTTPTool::instance(); $hashedTicket = $http->getVariable( 't' ); if ( empty( $hashedTicket ) ) { return false; } $uncryptedTicket = self::uncryptTicket ( $hashedTicket ); } if ( !self::validateTicket($uncryptedTicket) ) { return false; } $mmUser = self::createOrUpdateMMUser($uncryptedTicket); if( isset($uncryptedTicket['toUValidated']) ) { $mmUser->toUValidated( $uncryptedTicket['toUValidated'] ); } if( isset($uncryptedTicket['autologin']) ) { $mmUser->isAutologin( $uncryptedTicket['autologin'] ); } MMUsers::setCurrentUserObject($mmUser); AppBarControl::instance()->store(); MMSelections::setCookie(); MMUsers::setCookieUserPreferences(); $catchUpSpe = $mmUser->getPreference( 'catchUpSpe' ); if ( !empty( $catchUpSpe ) ) { setcookie ('catchUpSpe', '1', CookieTool::getDefaultCookieExpiration(), '/', CookieTool::getCookieDomain() ); } return true; }