Exemple #1
0
 /**
  * Login to facebook and get the associated cloudrexx user.
  */
 public function login()
 {
     // fixing timestamp issue with twitter
     // it is necessary that the twitter server has the same time as our system
     date_default_timezone_set('UTC');
     $tmhOAuth = new \tmhOAuth(array('consumer_key' => $this->applicationData[0], 'consumer_secret' => $this->applicationData[1]));
     // set the timestamp
     $tmhOAuth->config['force_timestamp'] = true;
     $tmhOAuth->config['timestamp'] = time();
     if (isset($_GET['oauth_verifier'])) {
         $tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
         $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_GET['oauth_verifier'], 'x_auth_access_type' => 'read'));
         $access_token = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $tmhOAuth->config['user_token'] = $access_token['oauth_token'];
         $tmhOAuth->config['user_secret'] = $access_token['oauth_token_secret'];
         $tmhOAuth->request('GET', $tmhOAuth->url('1.1/account/verify_credentials'));
         $resp = json_decode($tmhOAuth->response['response']);
         unset($_SESSION['oauth']);
         $name = explode(' ', $resp->name);
         self::$userdata = array('first_name' => $name[0], 'last_name' => $name[1], 'email' => $resp->screen_name . '@twitter.com');
         $this->getContrexxUser($resp->id);
     } else {
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ""), array('oauth_callback' => \Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER)));
         $_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $url = 'https://api.twitter.com/oauth/authenticate?oauth_token=' . $_SESSION['oauth']['oauth_token'];
         \Cx\Core\Csrf\Controller\Csrf::header("Location: " . $url);
         exit;
     }
 }
Exemple #2
0
 /**
  * Login to facebook and get the associated cloudrexx user.
  */
 public function login()
 {
     $client = new \Google_Client();
     $client->setApplicationName('Contrexx Login');
     $client->setClientId($this->applicationData[0]);
     $client->setClientSecret($this->applicationData[1]);
     $client->setRedirectUri(\Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER));
     $client->setDeveloperKey($this->applicationData[2]);
     $client->setUseObjects(true);
     $client->setApprovalPrompt('auto');
     $client->setScopes(self::$scopes);
     self::$google = new \Google_Oauth2Service($client);
     self::$googleplus = new \Google_PlusService($client);
     if (isset($_GET['code'])) {
         try {
             $client->authenticate();
         } catch (\Google_AuthException $e) {
         }
     }
     if (!$client->getAccessToken()) {
         \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $client->createAuthUrl());
         exit;
     }
     self::$userdata = $this->getUserData();
     $this->getContrexxUser(self::$userdata['oauth_id']);
 }
 /**
  * Parse the sociallogin login buttons in the template given.
  *
  * @static
  * @param $objTpl template object to parse
  * @param string $prefix the prefix for the template blocks and variables
  */
 public static function parseSociallogin($objTpl, $prefix = 'login_')
 {
     $arrSettings = \User_Setting::getSettings();
     if (function_exists('curl_init') && $arrSettings['sociallogin']['status'] && !isset($_SESSION['user_id'])) {
         if (!empty($_GET['redirect'])) {
             $_SESSION['redirect'] = $_GET['redirect'];
         }
         $redirect = isset($_SESSION['redirect']) ? $_SESSION['redirect'] : null;
         $socialloginProviders = \Cx\Lib\SocialLogin::getProviders();
         foreach ($socialloginProviders as $provider => $providerData) {
             if (!$objTpl->blockExists($prefix . 'social_networks_' . $provider)) {
                 continue;
             }
             $objTpl->setVariable(strtoupper($prefix) . 'SOCIALLOGIN_' . strtoupper($provider), contrexx_raw2xhtml(\Cx\Lib\SocialLogin::getLoginUrl($provider, $redirect)));
             if ($providerData->isActive()) {
                 $objTpl->touchBlock($prefix . 'social_networks_' . $provider);
             } else {
                 $objTpl->hideBlock($prefix . 'social_networks_' . $provider);
             }
         }
     } else {
         if ($objTpl->blockExists($prefix . 'social_networks')) {
             $objTpl->hideBlock($prefix . 'social_networks');
         }
     }
 }
Exemple #4
0
 /**
  * Parse the network settings page
  *
  * @param object the user object of the current logged in user
  */
 private function parseNetworks($objUser)
 {
     global $_ARRAYLANG;
     $availableProviders = \Cx\Lib\SocialLogin::getProviders();
     foreach ($availableProviders as $index => $provider) {
         if (!$provider->isActive()) {
             unset($availableProviders[$index]);
         }
     }
     $userNetworks = $objUser->getNetworks()->getNetworksAsArray();
     $this->_objTpl->setGlobalVariable(array('TXT_ACCESS_SOCIALLOGIN_PROVIDER' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_PROVIDER'], 'TXT_ACCESS_SOCIALLOGIN_STATE' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_STATE']));
     // get current url for redirect parameter
     $currentUrl = clone \Env::get('Resolver')->getUrl();
     if (!$this->_objTpl->blockExists('access_sociallogin_provider')) {
         return null;
     }
     // parse the connect buttons
     foreach ($availableProviders as $providerName => $providerSettings) {
         if (empty($userNetworks[$providerName])) {
             $state = $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_DISCONNECTED'];
             $class = 'disconnected';
             $uri = contrexx_raw2xhtml(\Cx\Lib\SocialLogin::getLoginUrl($providerName, base64_encode($currentUrl->__toString())));
             $uriAction = $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_CONNECT'];
         } else {
             $state = $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_CONNECTED'];
             $class = 'connected';
             $disconnectUrl = clone \Env::get('Resolver')->getUrl();
             $disconnectUrl->setParam('act', 'disconnect');
             $disconnectUrl->setParam('provider', $providerName);
             $uri = $disconnectUrl->__toString();
             $uriAction = $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_DISCONNECT'];
         }
         $this->_objTpl->setVariable(array('ACCESS_SOCIALLOGIN_PROVIDER_NAME_UPPER' => contrexx_raw2xhtml(ucfirst($providerName)), 'ACCESS_SOCIALLOGIN_PROVIDER_STATE' => $state, 'ACCESS_SOCIALLOGIN_PROVIDER_STATE_CLASS' => $class, 'ACCESS_SOCIALLOGIN_PROVIDER_NAME' => contrexx_raw2xhtml($providerName), 'ACCESS_SOCIALLOGIN_URL' => $uri, 'ACCESS_SOCIALLOGIN_URL_ACTION' => $uriAction));
         if ($class == 'disconnected') {
             $this->_objTpl->parse('access_sociallogin_provider_disconnected');
             $this->_objTpl->hideBlock('access_sociallogin_provider_connected');
         } else {
             $this->_objTpl->parse('access_sociallogin_provider_connected');
             $this->_objTpl->hideBlock('access_sociallogin_provider_disconnected');
         }
         $this->_objTpl->parse('access_sociallogin_provider');
     }
 }
 function _configGeneral()
 {
     global $_ARRAYLANG, $_CORELANG;
     $status = true;
     $arrSettings = \User_Setting::getSettings();
     $this->_objTpl->addBlockfile('ACCESS_CONFIG_TEMPLATE', 'module_access_config_general', 'module_access_config_general.html');
     $this->_objTpl->setVariable(array('TXT_ACCESS_PROFILE' => $_ARRAYLANG['TXT_ACCESS_PROFILE'], 'TXT_ACCESS_PROFILE_AVATAR_PIC' => $_ARRAYLANG['TXT_ACCESS_PROFILE_AVATAR_PIC'], 'TXT_ACCESS_PERMISSIONS' => $_ARRAYLANG['TXT_ACCESS_PERMISSIONS'], 'TXT_ACCESS_YES' => $_ARRAYLANG['TXT_ACCESS_YES'], 'TXT_ACCESS_NO' => $_ARRAYLANG['TXT_ACCESS_NO'], 'TXT_ACCESS_ALLOW_USERS_DELETE_ACCOUNT' => $_ARRAYLANG['TXT_ACCESS_ALLOW_USERS_DELETE_ACCOUNT'], 'TXT_ACCESS_ALLOW_USERS_SET_PROFILE_ACCESS' => $_ARRAYLANG['TXT_ACCESS_ALLOW_USERS_SET_PROFILE_ACCESS'], 'TXT_ACCESS_ALLOW_USERS_SET_EMAIL_ACCESS' => $_ARRAYLANG['TXT_ACCESS_ALLOW_USERS_SET_EMAIL_ACCESS'], 'TXT_ACCESS_FRONTEND_BLOCK_FUNCTIONS' => $_ARRAYLANG['TXT_ACCESS_FRONTEND_BLOCK_FUNCTIONS'], 'TXT_ACCESS_CURRENTLY_ONLINE' => $_ARRAYLANG['TXT_ACCESS_CURRENTLY_ONLINE'], 'TXT_ACCESS_LAST_ACTIVE' => $_ARRAYLANG['TXT_ACCESS_LAST_ACTIVE'], 'TXT_ACCESS_LATEST_REGISTERED_USERS' => $_ARRAYLANG['TXT_ACCESS_LATEST_REGISTERED_USERS'], 'TXT_ACCESS_BIRTHDAYS' => $_ARRAYLANG['TXT_ACCESS_BIRTHDAYS'], 'TXT_ACCESS_ACTIVATE_BLOCK_FUNCTION' => $_ARRAYLANG['TXT_ACCESS_ACTIVATE_BLOCK_FUNCTION'], 'TXT_ACCESS_SHOW_USERS_ONLY_WITH_PHOTO' => $_ARRAYLANG['TXT_ACCESS_SHOW_USERS_ONLY_WITH_PHOTO'], 'TXT_ACCESS_MAX_USER_COUNT' => $_ARRAYLANG['TXT_ACCESS_MAX_USER_COUNT'], 'TXT_ACCESS_SAVE' => $_ARRAYLANG['TXT_ACCESS_SAVE'], 'TXT_ACCESS_PROFILE_PIC' => $_CORELANG['TXT_ACCESS_PROFILE_PIC'], 'TXT_ACCESS_MAX_WIDTH' => $_ARRAYLANG['TXT_ACCESS_MAX_WIDTH'], 'TXT_ACCESS_MAX_HEIGHT' => $_ARRAYLANG['TXT_ACCESS_MAX_HEIGHT'], 'TXT_ACCESS_MAX_FILE_SIZE' => $_ARRAYLANG['TXT_ACCESS_MAX_FILE_SIZE'], 'TXT_ACCESS_THUMBNAIL_WIDTH' => $_ARRAYLANG['TXT_ACCESS_THUMBNAIL_WIDTH'], 'TXT_ACCESS_THUMBNAIL_HEIGHT' => $_ARRAYLANG['TXT_ACCESS_THUMBNAIL_HEIGHT'], 'TXT_ACCESS_MAX_THUMBNAIL_WIDTH' => $_ARRAYLANG['TXT_ACCESS_MAX_THUMBNAIL_WIDTH'], 'TXT_ACCESS_MAX_THUMBNAIL_HEIGHT' => $_ARRAYLANG['TXT_ACCESS_MAX_THUMBNAIL_HEIGHT'], 'TXT_ACCESS_PICTURES' => $_ARRAYLANG['TXT_ACCESS_PICTURES'], 'TXT_ACCESS_OTHER_PICTURES' => $_ARRAYLANG['TXT_ACCESS_OTHER_PICTURES'], 'TXT_ACCESS_MISCELLANEOUS' => $_ARRAYLANG['TXT_ACCESS_MISCELLANEOUS'], 'TXT_ACCESS_STANDARD' => $_ARRAYLANG['TXT_ACCESS_STANDARD'], 'TXT_ACCESS_EMAIL' => $_ARRAYLANG['TXT_ACCESS_EMAIL'], 'TXT_ACCESS_SESSION_ON_INTERVAL' => $_ARRAYLANG['TXT_ACCESS_SESSION_ON_INTERVAL'], 'TXT_ACCESS_SESSION_DESCRIPTION' => $_ARRAYLANG['TXT_ACCESS_SESSION_DESCRIPTION'], 'TXT_ACCESS_SESSION_TITLE' => $_ARRAYLANG['TXT_ACCESS_SESSION_TITLE'], 'TXT_ACCESS_USE_SELECTED_ACCESS_FOR_EVERYONE' => $_ARRAYLANG['TXT_ACCESS_USE_SELECTED_ACCESS_FOR_EVERYONE'], 'TXT_ACCESS_CROP_THUMBNAIL_TXT' => $_ARRAYLANG['TXT_ACCESS_CROP_THUMBNAIL_TXT'], 'TXT_ACCESS_SCALE_THUMBNAIL_TXT' => $_ARRAYLANG['TXT_ACCESS_SCALE_THUMBNAIL_TXT'], 'TXT_ACCESS_BACKGROUND_COLOR' => $_ARRAYLANG['TXT_ACCESS_BACKGROUND_COLOR'], 'TXT_ACCESS_THUMBNAIL_GENERATION' => $_ARRAYLANG['TXT_ACCESS_THUMBNAIL_GENERATION'], 'TXT_ACCESS_USE_USERNAMES' => $_ARRAYLANG['TXT_ACCESS_USE_USERNAMES'], 'TXT_ACCESS_USE_USERNAMES_TOOLTIP' => $_ARRAYLANG['TXT_ACCESS_USE_USERNAMES_TOOLTIP'], 'TXT_ACCESS_SOCIALLOGIN_INFORMATION_TITLE' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_INFORMATION_TITLE'], 'TXT_ACCESS_DESCRIPTION' => $_ARRAYLANG['TXT_ACCESS_DESCRIPTION'], 'TXT_ACCESS_SOCIALLOGIN_DESCRIPTION' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_DESCRIPTION'], 'TXT_ACCESS_SOCIALLOGIN' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN'], 'TXT_ACCESS_ENABLE_SOCIALLOGIN' => $_ARRAYLANG['TXT_ACCESS_ENABLE_SOCIALLOGIN'], 'TXT_ACCESS_SOCIALLOGIN_PROVIDERS' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_PROVIDERS'], 'TXT_ACCESS_SOCIALLOGIN_SHOW_SIGN_UP' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_SHOW_SIGN_UP'], 'TXT_ACCESS_SOCIALLOGIN_SHOW_SIGN_UP_TOOLTIP' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_SHOW_SIGN_UP_TOOLTIP'], 'TXT_ACCESS_GROUP_ASSOCIATION_TEXT' => $_ARRAYLANG['TXT_ACCESS_GROUP_ASSOCIATION_TEXT'], 'TXT_ACCESS_AVAILABLE_GROUPS' => $_ARRAYLANG['TXT_ACCESS_AVAILABLE_GROUPS'], 'TXT_ACCESS_CHECK_ALL' => $_ARRAYLANG['TXT_ACCESS_CHECK_ALL'], 'TXT_ACCESS_UNCHECK_ALL' => $_ARRAYLANG['TXT_ACCESS_UNCHECK_ALL'], 'TXT_ACCESS_ASSOCIATED_GROUPS' => $_ARRAYLANG['TXT_ACCESS_ASSOCIATED_GROUPS'], 'TXT_ACCESS_USER_ACCOUNT_ACTIVATION_METHOD_TEXT' => $_ARRAYLANG['TXT_ACCESS_USER_ACCOUNT_ACTIVATION_METHOD_TEXT'], 'TXT_ACCESS_SOCIALLOGIN_ACTIVATED_AUTOMATICALLY' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_ACTIVATED_AUTOMATICALLY'], 'TXT_ACCESS_SOCIALLOGIN_ACTIVATED_NOT_AUTOMATICALLY' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_ACTIVATED_NOT_AUTOMATICALLY'], 'TXT_ACCESS_SOCIALLOGIN_ACTIVATION_TIME' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_ACTIVATION_TIME'], 'TXT_ACCESS_SOCIALLOGIN_UNCOMPLETED_SIGN_UP' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_UNCOMPLETED_SIGN_UP'], 'TXT_ACCESS_USER_ACCOUNT_VERIFICATION' => $_ARRAYLANG['TXT_ACCESS_USER_ACCOUNT_VERIFICATION'], 'TXT_ACCESS_USER_ACCOUNT_VERIFICATION_TEXT' => $_ARRAYLANG['TXT_ACCESS_USER_ACCOUNT_VERIFICATION_TEXT']));
     $this->_objTpl->setGlobalVariable(array('TXT_ACCESS_SOCIALLOGIN_MANUAL' => sprintf($_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_MANUAL'], "http://www.cloudrexx.com/wiki/de/index.php?title=Social_Login")));
     if (isset($_POST['access_save_settings'])) {
         // only administrators are allowed to modify the config
         if (!\Permission::hasAllAccess()) {
             \Permission::noAccess();
         }
         $arrSettings['user_delete_account']['status'] = !empty($_POST['access_permissions_delete_account']) ? intval($_POST['access_permissions_delete_account']) : 0;
         $arrSettings['user_config_profile_access']['status'] = !empty($_POST['access_permissions_profile_access']) ? intval($_POST['access_permissions_profile_access']) : 0;
         $arrSettings['user_config_email_access']['status'] = !empty($_POST['access_permissions_email_access']) ? intval($_POST['access_permissions_email_access']) : 0;
         $arrSettings['sociallogin']['status'] = function_exists('curl_init') && !empty($_POST['access_sociallogin_activate']) ? intval($_POST['access_sociallogin_activate']) : 0;
         $arrSettings['use_usernames']['status'] = !empty($_POST['access_permissions_use_usernames']) ? intval($_POST['access_permissions_use_usernames']) : 0;
         $arrSettings['sociallogin_show_signup']['status'] = !empty($_POST['access_sociallogin_show_signup']) ? intval($_POST['access_sociallogin_show_signup']) : 0;
         $arrSettings['sociallogin_assign_to_groups']['value'] = isset($_POST['access_user_associated_groups']) ? implode(',', $_POST['access_user_associated_groups']) : '';
         $arrSettings['sociallogin_active_automatically']['status'] = !empty($_POST['sociallogin_active_automatically']) ? intval($_POST['sociallogin_active_automatically']) : 0;
         $arrSettings['sociallogin_activation_timeout']['value'] = !empty($_POST['sociallogin_activation_timeout']) ? intval($_POST['sociallogin_activation_timeout']) : 10;
         $arrSettings['default_profile_access']['value'] = isset($_POST['access_user_profile_access']) && in_array($_POST['access_user_profile_access'], array('everyone', 'members_only', 'nobody')) ? $_POST['access_user_profile_access'] : 'members_only';
         $arrSettings['default_email_access']['value'] = isset($_POST['access_user_email_access']) && in_array($_POST['access_user_email_access'], array('everyone', 'members_only', 'nobody')) ? $_POST['access_user_email_access'] : 'members_only';
         if (!empty($_POST['access_blocks_currently_online_users'])) {
             $arrSettings['block_currently_online_users']['status'] = 1;
             $arrSettings['block_currently_online_users']['value'] = !empty($_POST['access_blocks_currently_online_users_user_count']) ? intval($_POST['access_blocks_currently_online_users_user_count']) : 0;
             $arrSettings['block_currently_online_users_pic']['status'] = !empty($_POST['access_blocks_currently_online_users_only_with_photo']) && intval($_POST['access_blocks_currently_online_users_only_with_photo']);
         } else {
             $arrSettings['block_currently_online_users']['status'] = 0;
         }
         if (!empty($_POST['access_blocks_last_active_users'])) {
             $arrSettings['block_last_active_users']['status'] = 1;
             $arrSettings['block_last_active_users']['value'] = !empty($_POST['access_blocks_last_active_users_user_count']) ? intval($_POST['access_blocks_last_active_users_user_count']) : 0;
             $arrSettings['block_last_active_users_pic']['status'] = !empty($_POST['access_blocks_last_active_users_only_with_photo']) && intval($_POST['access_blocks_last_active_users_only_with_photo']);
         } else {
             $arrSettings['block_last_active_users']['status'] = 0;
         }
         if (!empty($_POST['access_blocks_latest_registered_users'])) {
             $arrSettings['block_latest_reg_users']['status'] = 1;
             $arrSettings['block_latest_reg_users']['value'] = !empty($_POST['access_blocks_latest_registered_users_user_count']) ? intval($_POST['access_blocks_latest_registered_users_user_count']) : 0;
             $arrSettings['block_latest_reg_users_pic']['status'] = !empty($_POST['access_blocks_latest_registered_users_only_with_photo']) && intval($_POST['access_blocks_latest_registered_users_only_with_photo']);
         } else {
             $arrSettings['block_latest_reg_users']['status'] = 0;
         }
         if (!empty($_POST['access_blocks_birthday_users'])) {
             $arrSettings['block_birthday_users']['status'] = 1;
             $arrSettings['block_birthday_users']['value'] = !empty($_POST['access_blocks_birthday_users_user_count']) ? intval($_POST['access_blocks_birthday_users_user_count']) : 0;
             $arrSettings['block_birthday_users_pic']['status'] = !empty($_POST['access_blocks_birthday_users_only_with_photo']) && intval($_POST['access_blocks_birthday_users_only_with_photo']);
         } else {
             $arrSettings['block_birthday_users']['status'] = 0;
         }
         if (!empty($_POST['accessMaxProfilePicWidth'])) {
             $arrSettings['max_profile_pic_width']['value'] = intval($_POST['accessMaxProfilePicWidth']);
         }
         if (!empty($_POST['accessMaxProfilePicHeight'])) {
             $arrSettings['max_profile_pic_height']['value'] = intval($_POST['accessMaxProfilePicHeight']);
         }
         if (!empty($_POST['accessProfileThumbnailPicWidth'])) {
             $arrSettings['profile_thumbnail_pic_width']['value'] = intval($_POST['accessProfileThumbnailPicWidth']);
         }
         if (!empty($_POST['accessProfileThumbnailPicHeight'])) {
             $arrSettings['profile_thumbnail_pic_height']['value'] = intval($_POST['accessProfileThumbnailPicHeight']);
         }
         if (!empty($_POST['accessMaxProfilePicSize'])) {
             // TODO
             //                if (\FWSystem::getBytesOfLiteralSizeFormat($_POST['accessMaxProfilePicSize']) != $arrSettings['max_profile_pic_size']['value']) {
             //                    // resize profile pics
             //                }
             $arrSettings['max_profile_pic_size']['value'] = \FWSystem::getBytesOfLiteralSizeFormat($_POST['accessMaxProfilePicSize']);
         }
         if (isset($_POST['accessProfileThumbnailMethod']) && $_POST['accessProfileThumbnailMethod'] == 'scale') {
             $arrSettings['profile_thumbnail_method']['value'] = 'scale';
             $color = !empty($_POST['accessProfileThumbnailScaleColor']) ? contrexx_input2raw($_POST['accessProfileThumbnailScaleColor']) : NULL;
             $arrSettings['profile_thumbnail_scale_color']['value'] = $this->validateHexRGBColor($color);
         } else {
             $arrSettings['profile_thumbnail_method']['value'] = 'crop';
         }
         if (!empty($_POST['accessMaxPicWidth'])) {
             $arrSettings['max_pic_width']['value'] = intval($_POST['accessMaxPicWidth']);
         }
         if (!empty($_POST['accessMaxPicHeight'])) {
             $arrSettings['max_pic_height']['value'] = intval($_POST['accessMaxPicHeight']);
         }
         if (!empty($_POST['accessMaxThumbnailPicWidth'])) {
             $arrSettings['max_thumbnail_pic_width']['value'] = intval($_POST['accessMaxThumbnailPicWidth']);
         }
         if (!empty($_POST['accessMaxThumbnailPicHeight'])) {
             $arrSettings['max_thumbnail_pic_height']['value'] = intval($_POST['accessMaxThumbnailPicHeight']);
         }
         // user_account_verification is a checkbox, if this is not set, its not checked. If it is set, it is checked
         // 0 = unchecked, false, 1 = checked, active, true
         $arrSettings['user_account_verification']['value'] = 0;
         if (isset($_POST['user_account_verification'])) {
             $arrSettings['user_account_verification']['value'] = 1;
         }
         if (!empty($_POST['accessMaxPicSize'])) {
             // TODO
             //                if (\FWSystem::getBytesOfLiteralSizeFormat($_POST['accessMaxPicSize']) != $arrSettings['max_pic_size']['value']) {
             //                    // resize pics
             //                }
             $arrSettings['max_pic_size']['value'] = \FWSystem::getBytesOfLiteralSizeFormat($_POST['accessMaxPicSize']);
         }
         $session_on_interval = intval($_POST['sessioninterval']);
         if (trim($session_on_interval) != null) {
             if ($session_on_interval >= 0 && $session_on_interval <= 300) {
                 $arrSettings['session_user_interval']['value'] = $session_on_interval;
             }
         }
         if (!empty($_POST["sociallogin_providers"])) {
             \Cx\Lib\SocialLogin::updateProviders($_POST["sociallogin_providers"]);
         }
         if ($status) {
             if (\User_Setting::setSettings($arrSettings)) {
                 self::$arrStatusMsg['ok'][] = $_ARRAYLANG['TXT_ACCESS_CONFIG_SUCCESSFULLY_SAVED'];
                 if (!empty($_POST['access_force_selected_profile_access'])) {
                     if (!\User::forceDefaultProfileAccess()) {
                         self::$arrStatusMsg['error'][] = $_ARRAYLANG['TXT_ACCESS_SET_DEFAULT_PROFILE_ACCESS_FAILED'];
                     }
                 }
                 if (!empty($_POST['access_force_selected_email_access'])) {
                     if (!\User::forceDefaultEmailAccess()) {
                         self::$arrStatusMsg['error'][] = $_ARRAYLANG['TXT_ACCESS_SET_DEFAULT_EMAIL_ACCESS_FAILED'];
                     }
                 }
             } else {
                 self::$arrStatusMsg['error'][] = $_ARRAYLANG['TXT_ACCESS_CONFIG_FAILED_SAVED'];
                 self::$arrStatusMsg['error'][] = $_ARRAYLANG['TXT_ACCESS_TRY_TO_REPEAT_OPERATION'];
             }
         }
     }
     $curlAvailable = true;
     try {
         $socialloginProviders = \Cx\Lib\SocialLogin::getProviders();
     } catch (\Exception $e) {
         if (!function_exists('curl_init')) {
             $this->_objTpl->setVariable('TXT_ACCESS_SOCIALLOGIN_WARNING', $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_NEED_CURL']);
             $this->_objTpl->parse('sociallogin_need_curl');
             $curlAvailable = false;
         }
     }
     if ($curlAvailable) {
         $this->_objTpl->touchBlock('access_sociallogin_settings');
     } else {
         $this->_objTpl->hideBlock('access_sociallogin_settings');
     }
     // if the current user is no admin, show a message
     $currentUserIsAdmin = \FWUser::getFWUserObject()->objUser->getAdminStatus();
     if (!$currentUserIsAdmin) {
         $this->_objTpl->setVariable('TXT_ACCESS_SOCIALLOGIN_PERMISSION_DENIED', $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_PERMISSION_DENIED']);
         $this->_objTpl->parse('access_sociallogin_permission_denied');
     }
     $socialloginProviderRow = 0;
     foreach ($socialloginProviders as $socialloginProviderName => $providerObject) {
         $settings = $providerObject->getApplicationData();
         $paramId = 0;
         if ($currentUserIsAdmin) {
             foreach (call_user_func(\Cx\Lib\SocialLogin::getClassByProvider($socialloginProviderName) . '::configParams') as $configParam) {
                 $this->_objTpl->setVariable(array('TXT_ACCESS_SOCIALLOGIN_PROVIDER_PARAM_TITLE' => $_ARRAYLANG[$configParam], 'ACCESS_SOCIALLOGIN_PROVIDER_PARAM_VALUE' => contrexx_raw2xhtml(!empty($settings[$paramId]) ? $settings[$paramId] : ''), 'ACCESS_SOCIALLOGIN_PROVIDER_TOGGLE' => $providerObject->isActive() ? '' : 'none', 'ACCESS_SOCIALLOGIN_PROVIDER_NAME' => contrexx_raw2xhtml($socialloginProviderName), 'ACCESS_SOCIALLOGIN_PROVIDER_NAME_UPPER' => contrexx_raw2xhtml(ucfirst($socialloginProviderName))));
                 $this->_objTpl->parse('access_sociallogin_provider_params');
                 $paramId++;
             }
         }
         $this->_objTpl->setVariable(array('ACCESS_SOCIALLOGIN_PROVIDER_ROW' => $socialloginProviderRow % 2 == 0 ? 1 : 2, 'ACCESS_SOCIALLOGIN_PROVIDER_NAME' => contrexx_raw2xhtml($socialloginProviderName), 'ACCESS_SOCIALLOGIN_PROVIDER_NAME_UPPER' => contrexx_raw2xhtml(ucfirst($socialloginProviderName)), 'TXT_ACCESS_SOCIALLOGIN_PROVIDER_ENABLED' => $_ARRAYLANG['TXT_ACCESS_SOCIALLOGIN_PROVIDER_ENABLED'], 'ACCESS_SOCIALLOGIN_PROVIDER_ENABLED_CHECKED' => $currentUserIsAdmin && $providerObject->isActive() ? 'checked="checked"' : '', 'ACCESS_SOCIALLOGIN_PROVIDER_DISABLED' => $currentUserIsAdmin ? '' : 'disabled="disabled"'));
         $this->_objTpl->parse('access_sociallogin_provider');
         $socialloginProviderRow++;
     }
     $this->_objTpl->setVariable(array('ACCESS_SOCIALLOGIN_TOGGLE' => $arrSettings['sociallogin']['status'] ? '' : 'none'));
     $arrAssignedGroups = explode(',', $arrSettings['sociallogin_assign_to_groups']['value']);
     $notAssignedGroups = '';
     $assignedGroups = '';
     $objFWUser = \FWUser::getFWUserObject();
     $objGroup = $objFWUser->objGroup->getGroups();
     while (!$objGroup->EOF) {
         $groupVar = in_array($objGroup->getId(), $arrAssignedGroups) ? 'assignedGroups' : 'notAssignedGroups';
         ${$groupVar} .= '<option value="' . $objGroup->getId() . '">' . contrexx_raw2xhtml($objGroup->getName()) . ' [' . $objGroup->getType() . ']</option>';
         $objGroup->next();
     }
     $this->_objTpl->setVariable(array('ACCESS_USER_NOT_ASSOCIATED_GROUPS' => $notAssignedGroups, 'ACCESS_USER_ASSOCIATED_GROUPS' => $assignedGroups));
     $this->parseAccountAttribute(null, 'profile_access', true, $arrSettings['default_profile_access']['value']);
     $this->parseAccountAttribute(null, 'email_access', true, $arrSettings['default_email_access']['value']);
     $this->_objTpl->setVariable(array('ACCESS_ALLOW_USERS_DELETE_ACCOUNT' => $arrSettings['user_delete_account']['status'] ? 'checked="checked"' : '', 'ACCESS_DONT_ALLOW_USERS_DELETE_ACCOUNT' => $arrSettings['user_delete_account']['status'] ? '' : 'checked="checked"', 'ACCESS_ALLOW_USERS_SET_PROFILE_ACCESS' => $arrSettings['user_config_profile_access']['status'] ? 'checked="checked"' : '', 'ACCESS_DONT_ALLOW_USERS_SET_PROFILE_ACCESS' => $arrSettings['user_config_profile_access']['status'] ? '' : 'checked="checked"', 'ACCESS_ALLOW_USERS_SET_EMAIL_ACCESS' => $arrSettings['user_config_email_access']['status'] ? 'checked="checked"' : '', 'ACCESS_DONT_ALLOW_USERS_SET_EMAIL_ACCESS' => $arrSettings['user_config_email_access']['status'] ? '' : 'checked="checked"', 'ACCESS_BLOCKS_CURRENTLY_ONLINE_USERS' => $arrSettings['block_currently_online_users']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_CURRENTLY_ONLINE_USERS_DISPLAY' => $arrSettings['block_currently_online_users']['status'] ? '' : 'none', 'ACCESS_BLOCKS_CURRENTLY_ONLINE_USERS_USER_COUNT' => $arrSettings['block_currently_online_users']['value'], 'ACCESS_BLOCKS_CURRENTLY_ONLINE_USERS_ONLY_WITH_PHOTO' => $arrSettings['block_currently_online_users_pic']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_LAST_ACTIVE_USERS' => $arrSettings['block_last_active_users']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_LAST_ACTIVE_USERS_DISPLAY' => $arrSettings['block_last_active_users']['status'] ? '' : 'none', 'ACCESS_BLOCKS_LAST_ACTIVE_USERS_USER_COUNT' => $arrSettings['block_last_active_users']['value'], 'ACCESS_BLOCKS_LAST_ACTIVE_USERS_ONLY_WITH_PHOTO' => $arrSettings['block_last_active_users_pic']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_LATEST_REGISTERED_USERS' => $arrSettings['block_latest_reg_users']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_LATEST_REGISTERED_USERS_DISPLAY' => $arrSettings['block_latest_reg_users']['status'] ? '' : 'none', 'ACCESS_BLOCKS_LATEST_REGISTERED_USERS_USER_COUNT' => $arrSettings['block_latest_reg_users']['value'], 'ACCESS_BLOCKS_LATEST_REGISTERED_USERS_ONLY_WITH_PHOTO' => $arrSettings['block_latest_reg_users_pic']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_BIRTHDAY_USERS' => $arrSettings['block_birthday_users']['status'] ? 'checked="checked"' : '', 'ACCESS_BLOCKS_BIRTHDAY_USERS_DISPLAY' => $arrSettings['block_birthday_users']['status'] ? '' : 'none', 'ACCESS_BLOCKS_BIRTHDAY_USERS_USER_COUNT' => $arrSettings['block_birthday_users']['value'], 'ACCESS_BLOCKS_BIRTHDAY_USERS_ONLY_WITH_PHOTO' => $arrSettings['block_birthday_users_pic']['status'] ? 'checked="checked"' : '', 'ACCESS_MAX_PROFILE_PIC_WIDTH' => $arrSettings['max_profile_pic_width']['value'], 'ACCESS_MAX_PROFILE_PIC_HEIGHT' => $arrSettings['max_profile_pic_height']['value'], 'ACCESS_PROFILE_THUMBNAIL_PIC_WIDTH' => $arrSettings['profile_thumbnail_pic_width']['value'], 'ACCESS_PROFILE_THUMBNAIL_PIC_HEIGHT' => $arrSettings['profile_thumbnail_pic_height']['value'], 'ACCESS_MAX_PROFILE_PIC_SIZE' => \FWSystem::getLiteralSizeFormat($arrSettings['max_profile_pic_size']['value']), 'ACCESS_MAX_PIC_WIDTH' => $arrSettings['max_pic_width']['value'], 'ACCESS_MAX_PIC_HEIGHT' => $arrSettings['max_pic_height']['value'], 'ACCESS_MAX_THUMBNAIL_PIC_WIDTH' => $arrSettings['max_thumbnail_pic_width']['value'], 'ACCESS_MAX_THUMBNAIL_PIC_HEIGHT' => $arrSettings['max_thumbnail_pic_height']['value'], 'ACCESS_SESSION_USER_INTERVAL' => $arrSettings['session_user_interval']['value'], 'ACCESS_MAX_PIC_SIZE' => \FWSystem::getLiteralSizeFormat($arrSettings['max_pic_size']['value']), 'ACCESS_PROFILE_THUMBNAIL_CROP' => $arrSettings['profile_thumbnail_method']['value'] == 'crop' ? 'selected="selected"' : '', 'ACCESS_PROFILE_THUMBNAIL_SCALE' => $arrSettings['profile_thumbnail_method']['value'] == 'scale' ? 'selected="selected"' : '', 'ACCESS_PROFILE_THUMBNAIL_SCALE_BOX' => $arrSettings['profile_thumbnail_method']['value'] == 'scale' ? 'inline' : 'none', 'ACCESS_PROFILE_THUMBNAIL_SCALE_COLOR' => $arrSettings['profile_thumbnail_scale_color']['value'], 'ACCESS_USE_USERNAMES' => $arrSettings['use_usernames']['status'] ? 'checked="checked"' : '', 'ACCESS_DONT_USE_USERNAMES' => $arrSettings['use_usernames']['status'] ? '' : 'checked="checked"', 'ACCESS_SOCIALLOGIN_ENABLED' => $arrSettings['sociallogin']['status'] ? 'checked="checked"' : '', 'ACCESS_SOCIALLOGIN_NOT_ENABLED' => $arrSettings['sociallogin']['status'] ? '' : 'checked="checked"', 'ACCESS_SOCIALLOGIN_SHOW_SIGNUP_ENABLED' => $arrSettings['sociallogin_show_signup']['status'] ? 'checked="checked"' : '', 'ACCESS_SOCIALLOGIN_SHOW_SIGNUP_NOT_ENABLED' => $arrSettings['sociallogin_show_signup']['status'] ? '' : 'checked="checked"', 'ACCESS_SOCIALLOGIN_ACTIVATED_AUTOMATICALLY_ENABLED' => $arrSettings['sociallogin_active_automatically']['status'] ? 'checked="checked"' : '', 'ACCESS_SOCIALLOGIN_ACTIVATED_AUTOMATICALLY_NOT_ENABLED' => $arrSettings['sociallogin_active_automatically']['status'] ? '' : 'checked="checked"', 'ACCESS_SOCIALLOGIN_ACTIVATION_TIMEOUT' => intval($arrSettings['sociallogin_activation_timeout']['value']), 'ACCESS_USSER_ACCOUNT_VERIFICATION_CHECKED' => $arrSettings['user_account_verification']['value'] == 1 ? 'checked' : ''));
     $this->_objTpl->parse('module_access_config_general');
 }
Exemple #6
0
 /**
  * Checks if the user has been successfully authenticated
  *
  * If a user has been successfully authenticated then he will be
  * redirected to the requested page, otherwise the login page will be displayed
  *
  * @access private
  * @global array
  * @see cmsSession::cmsSessionStatusUpdate(), contrexx_strip_tags, \Cx\Core\Html\Sigma::get()
  * @return string \Cx\Core\Html\Sigma::get()
  */
 function _login()
 {
     global $_CORELANG, $sessionObj;
     $objFWUser = \FWUser::getFWUserObject();
     if (isset($_REQUEST['redirect'])) {
         $redirect = contrexx_strip_tags($_REQUEST['redirect']);
     } elseif (isset($_SESSION['redirect'])) {
         $redirect = $_SESSION['redirect'];
     } else {
         $redirect = "";
     }
     \Cx\Lib\SocialLogin::parseSociallogin($this->_objTpl);
     $arrSettings = \User_Setting::getSettings();
     if (function_exists('curl_init') && $arrSettings['sociallogin']['status'] && !empty($_GET['provider'])) {
         $providerLogin = $this->loginWithProvider($_GET['provider']);
         if ($providerLogin) {
             return $providerLogin;
         }
     }
     if ($objFWUser->objUser->login()) {
         if (isset($_POST['login']) && $objFWUser->checkLogin() || isset($_GET['auth-token']) && isset($_GET['user-id'])) {
             $objFWUser->objUser->reset();
             $objFWUser->logoutAndDestroySession();
             $sessionObj = \cmsSession::getInstance();
         } elseif (isset($_POST['login'])) {
             $_GET['relogin'] = '******';
         }
     }
     if ((!isset($_GET['relogin']) || $_GET['relogin'] != 'true') && $objFWUser->objUser->login() || $objFWUser->checkAuth()) {
         $groupRedirect = ($objGroup = $objFWUser->objGroup->getGroup($objFWUser->objUser->getPrimaryGroupId())) && $objGroup->getHomepage() ? preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $objGroup->getHomepage()) : CONTREXX_SCRIPT_PATH;
         \LinkGenerator::parseTemplate($groupRedirect);
         if (isset($_SESSION['redirect'])) {
             unset($_SESSION['redirect']);
         }
         if (!empty($redirect)) {
             $redirect = \FWUser::getRedirectUrl(urlencode(base64_decode($redirect)));
         }
         \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . (empty($redirect) ? $groupRedirect : $redirect));
         exit;
     } else {
         if (isset($_POST['login'])) {
             $this->_statusMessage = $_CORELANG['TXT_PASSWORD_OR_USERNAME_IS_INCORRECT'];
         }
     }
     if (isset($_SESSION['auth']['loginLastAuthFailed'])) {
         $this->_objTpl->setVariable(array('TXT_CORE_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
         $this->_objTpl->parse('captcha');
     } else {
         $this->_objTpl->hideBlock('captcha');
     }
     // TODO: loading the language data of component Access at this
     //       point is a workaround as the integration of the Access
     //       component's functionality itself is hard-coded too and
     //       has not been implemented through the system component
     //       framework.
     $accessLang = \Env::get('init')->getComponentSpecificLanguageData('Access');
     $this->_objTpl->setVariable(array('TXT_ACCESS_SIGNUP_BY_FACEBOOK' => $accessLang['TXT_ACCESS_SIGNUP_BY_FACEBOOK'], 'TXT_ACCESS_SIGNUP_BY_GOOGLE' => $accessLang['TXT_ACCESS_SIGNUP_BY_GOOGLE'], 'TXT_ACCESS_SIGNUP_BY_TWITTER' => $accessLang['TXT_ACCESS_SIGNUP_BY_TWITTER'], 'TXT_CORE_SIGN_UP' => $_CORELANG['TXT_CORE_SIGN_UP'], 'TXT_LOGIN' => $_CORELANG['TXT_LOGIN'], 'TXT_USER_NAME' => $_CORELANG['TXT_USER_NAME'], 'TXT_EMAIL' => $_CORELANG['TXT_EMAIL'], 'TXT_PASSWORD' => $_CORELANG['TXT_PASSWORD'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'TXT_PASSWORD_LOST' => $_CORELANG['TXT_PASSWORD_LOST'], 'LOGIN_REDIRECT' => $redirect, 'LOGIN_STATUS_MESSAGE' => $this->_statusMessage));
     return $this->_objTpl->get();
 }
Exemple #7
0
 /**
  * Checks if the user has been successfully authenticated
  *
  * If a user has been successfully authenticated then he will be
  * redirected to the requested page, otherwise the login page will be displayed
  *
  * @access private
  * @global array
  * @see cmsSession::cmsSessionStatusUpdate(), contrexx_strip_tags, \Cx\Core\Html\Sigma::get()
  * @return string \Cx\Core\Html\Sigma::get()
  */
 function _login()
 {
     global $_CORELANG, $sessionObj;
     $objFWUser = \FWUser::getFWUserObject();
     if (isset($_REQUEST['redirect'])) {
         $redirect = contrexx_strip_tags($_REQUEST['redirect']);
     } elseif (isset($_SESSION['redirect'])) {
         $redirect = $_SESSION['redirect'];
     } else {
         $redirect = "";
     }
     \Cx\Lib\SocialLogin::parseSociallogin($this->_objTpl);
     $arrSettings = \User_Setting::getSettings();
     if (function_exists('curl_init') && $arrSettings['sociallogin']['status'] && !empty($_GET['provider'])) {
         $providerLogin = $this->loginWithProvider($_GET['provider']);
         if ($providerLogin) {
             return $providerLogin;
         }
     }
     if ($objFWUser->objUser->login()) {
         if (isset($_POST['login']) && $objFWUser->checkLogin() || isset($_GET['auth-token']) && isset($_GET['user-id'])) {
             $objFWUser->objUser->reset();
             $objFWUser->logoutAndDestroySession();
             $sessionObj = \cmsSession::getInstance();
         } else {
             $_GET['relogin'] = '******';
         }
     }
     if ((!isset($_GET['relogin']) || $_GET['relogin'] != 'true') && $objFWUser->objUser->login() || $objFWUser->checkAuth()) {
         $groupRedirect = ($objGroup = $objFWUser->objGroup->getGroup($objFWUser->objUser->getPrimaryGroupId())) && $objGroup->getHomepage() ? preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $objGroup->getHomepage()) : CONTREXX_SCRIPT_PATH;
         \LinkGenerator::parseTemplate($groupRedirect);
         if (isset($_SESSION['redirect'])) {
             unset($_SESSION['redirect']);
         }
         if (!empty($redirect)) {
             $redirect = \FWUser::getRedirectUrl(urlencode(base64_decode($redirect)));
         }
         \Cx\Core\Csrf\Controller\Csrf::header('Location: ' . (empty($redirect) ? $groupRedirect : $redirect));
         exit;
     } else {
         if (isset($_POST['login'])) {
             $this->_statusMessage = $_CORELANG['TXT_PASSWORD_OR_USERNAME_IS_INCORRECT'];
         }
     }
     if (isset($_SESSION['auth']['loginLastAuthFailed'])) {
         $this->_objTpl->setVariable(array('TXT_CORE_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
         $this->_objTpl->parse('captcha');
     } else {
         $this->_objTpl->hideBlock('captcha');
     }
     $this->_objTpl->setVariable(array('TXT_LOGIN' => $_CORELANG['TXT_LOGIN'], 'TXT_USER_NAME' => $_CORELANG['TXT_USER_NAME'], 'TXT_PASSWORD' => $_CORELANG['TXT_PASSWORD'], 'TXT_LOGIN_REMEMBER_ME' => $_CORELANG['TXT_CORE_REMEMBER_ME'], 'TXT_PASSWORD_LOST' => $_CORELANG['TXT_PASSWORD_LOST'], 'LOGIN_REDIRECT' => $redirect, 'LOGIN_STATUS_MESSAGE' => $this->_statusMessage));
     return $this->_objTpl->get();
 }
Exemple #8
0
 private function signUp()
 {
     global $_ARRAYLANG, $_CORELANG;
     if (!empty($_GET['u']) && !empty($_GET['k'])) {
         $this->_objTpl->hideBlock('access_signup_store_success');
         $this->_objTpl->hideBlock('access_signup_store_error');
         if ($this->confirmSignUp(intval($_GET['u']), contrexx_stripslashes($_GET['k']))) {
             $this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', $_ARRAYLANG['TXT_ACCESS_ACCOUNT_SUCCESSFULLY_ACTIVATED']);
             $this->_objTpl->parse('access_signup_confirm_success');
             $this->_objTpl->hideBlock('access_signup_confirm_error');
         } else {
             $this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['error']));
             $this->_objTpl->parse('access_signup_confirm_error');
             $this->_objTpl->hideBlock('access_signup_confirm_success');
         }
         $this->_objTpl->hideBlock('access_signup_form');
         \Cx\Lib\SocialLogin::hideLogin($this->_objTpl, 'access_');
         return;
     } else {
         $this->_objTpl->hideBlock('access_signup_confirm_success');
         $this->_objTpl->hideBlock('access_signup_confirm_error');
     }
     $arrSettings = \User_Setting::getSettings();
     $objUser = null;
     if (!empty($_SESSION['user_id'])) {
         $objUser = \FWUser::getFWUserObject()->objUser->getUser($_SESSION['user_id']);
         if ($objUser) {
             $objUser->releaseRestoreKey();
             $active = $arrSettings['sociallogin_active_automatically']['status'];
             $objUser->setActiveStatus($active);
             $this->_objTpl->hideBlock('access_logindata');
         }
     }
     if (!$objUser) {
         $objUser = new \User();
     }
     if (isset($_POST['access_signup'])) {
         $objUser->setUsername(isset($_POST['access_user_username']) ? trim(contrexx_stripslashes($_POST['access_user_username'])) : '');
         $objUser->setEmail(isset($_POST['access_user_email']) ? trim(contrexx_stripslashes($_POST['access_user_email'])) : '');
         $objUser->setFrontendLanguage(isset($_POST['access_user_frontend_language']) ? intval($_POST['access_user_frontend_language']) : 0);
         $assignedGroups = $objUser->getAssociatedGroupIds();
         if (empty($assignedGroups)) {
             $objUser->setGroups(explode(',', $arrSettings['assigne_to_groups']['value']));
         }
         $objUser->setSubscribedNewsletterListIDs(isset($_POST['access_user_newsletters']) && is_array($_POST['access_user_newsletters']) ? $_POST['access_user_newsletters'] : array());
         if ((!isset($_POST['access_profile_attribute']) || !is_array($_POST['access_profile_attribute']) || ($arrProfile = $_POST['access_profile_attribute']) && (!isset($_POST['access_profile_attribute_images']) || !is_array($_POST['access_profile_attribute_images']) || ($uploadImageError = $this->addUploadedImagesToProfile($objUser, $arrProfile, $_POST['access_profile_attribute_images'], $_POST['access_image_uploader_id'])) === true) && $objUser->setProfile($arrProfile)) && $objUser->setPassword(isset($_POST['access_user_password']) ? trim(contrexx_stripslashes($_POST['access_user_password'])) : '', isset($_POST['access_user_password_confirmed']) ? trim(contrexx_stripslashes($_POST['access_user_password_confirmed'])) : '') && (!$arrSettings['user_account_verification']['value'] || $objUser->checkMandatoryCompliance()) && $this->checkCaptcha() && $this->checkToS() && $objUser->signUp()) {
             if ($this->handleSignUp($objUser)) {
                 if (isset($_SESSION['user_id'])) {
                     unset($_SESSION['user_id']);
                 }
                 $this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['ok']));
                 $this->_objTpl->parse('access_signup_store_success');
                 $this->_objTpl->hideBlock('access_signup_store_error');
             } else {
                 $this->_objTpl->setVariable('ACCESS_SIGNUP_MESSAGE', implode('<br />', $this->arrStatusMsg['error']));
                 $this->_objTpl->parse('access_signup_store_error');
                 $this->_objTpl->hideBlock('access_signup_store_success');
             }
             $this->_objTpl->hideBlock('access_signup_form');
             \Cx\Lib\SocialLogin::hideLogin($this->_objTpl, 'access_');
             return;
         } else {
             if (is_array($uploadImageError)) {
                 $this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $uploadImageError);
             }
             $this->arrStatusMsg['error'] = array_merge($this->arrStatusMsg['error'], $objUser->getErrorMsg());
             $this->_objTpl->hideBlock('access_signup_store_success');
             $this->_objTpl->hideBlock('access_signup_store_error');
         }
     } else {
         $this->_objTpl->hideBlock('access_signup_store_success');
         $this->_objTpl->hideBlock('access_signup_store_error');
     }
     $this->parseAccountAttributes($objUser, true);
     while (!$objUser->objAttribute->EOF) {
         $objAttribute = $objUser->objAttribute->getById($objUser->objAttribute->getId());
         if (!$objAttribute->isProtected() || (\Permission::checkAccess($objAttribute->getAccessId(), 'dynamic', true) || $objAttribute->checkModifyPermission())) {
             $this->parseAttribute($objUser, $objAttribute->getId(), 0, true);
         }
         $objUser->objAttribute->next();
     }
     $this->parseNewsletterLists($objUser);
     $this->attachJavaScriptFunction('accessSetWebsite');
     $uploader = $this->getImageUploader();
     $this->_objTpl->setVariable(array('ACCESS_SIGNUP_BUTTON' => '<input type="submit" name="access_signup" value="' . $_ARRAYLANG['TXT_ACCESS_CREATE_ACCOUNT'] . '" />', 'ACCESS_JAVASCRIPT_FUNCTIONS' => $this->getJavaScriptCode(), 'ACCESS_IMAGE_UPLOADER_ID' => $uploader->getId(), 'ACCESS_IMAGE_UPLOADER_CODE' => $uploader->getXHtml(), 'ACCESS_SIGNUP_MESSAGE' => implode("<br />\n", $this->arrStatusMsg['error'])));
     if (!$arrSettings['use_usernames']['status']) {
         if ($this->_objTpl->blockExists('access_user_username')) {
             $this->_objTpl->hideBlock('access_user_username');
         }
     }
     // set captcha
     if ($this->_objTpl->blockExists('access_captcha')) {
         if ($arrSettings['user_captcha']['status']) {
             $this->_objTpl->setVariable(array('ACCESS_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode(), 'TXT_ACCESS_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA']));
             $this->_objTpl->parse('access_captcha');
         } else {
             $this->_objTpl->hideBlock('access_captcha');
         }
     }
     // set terms and conditions
     if ($this->_objTpl->blockExists('access_tos')) {
         if ($arrSettings['user_accept_tos_on_signup']['status']) {
             $uriTos = CONTREXX_SCRIPT_PATH . '?section=Agb';
             $this->_objTpl->setVariable(array('TXT_ACCESS_TOS' => $_ARRAYLANG['TXT_ACCESS_TOS'], 'ACCESS_TOS' => '<input type="checkbox" name="access_user_tos" id="access_user_tos"' . (!empty($_POST['access_user_tos']) ? ' checked="checked"' : '') . ' /><label for="access_user_tos">' . sprintf($_ARRAYLANG['TXT_ACCESS_ACCEPT_TOS'], $uriTos) . '</label>'));
             $this->_objTpl->parse('access_tos');
         } else {
             $this->_objTpl->hideBlock('access_tos');
         }
     }
     $this->_objTpl->parse('access_signup_form');
 }