Exemplo n.º 1
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_id = SJB_UserManager::getCurrentUserSID();
         $errors = array();
         $id = SJB_Request::getInt('id', 0, 'GET');
         $action = SJB_Request::getVar('action', '', 'GET');
         if ($id > 0) {
             // read message
             if (SJB_PrivateMessage::isMyMessage($id)) {
                 if ($action == 'delete') {
                     SJB_PrivateMessage::delete(array($id));
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
                 }
                 $message = SJB_PrivateMessage::readMessage($id);
                 SJB_Authorization::updateCurrentUserSession();
                 $current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
                 $current_user_info['logged_in'] = true;
                 $current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
                 SJB_System::setCurrentUserInfo($current_user_info);
                 $tp->assign('message', $message);
                 $tp->assign('include', 'message_detail.tpl');
             } else {
                 $errors['NOT_EXISTS_MESSAGE'] = 1;
             }
         }
         $tp->assign('errors', $errors);
         $tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
         $tp->display('main.tpl');
     } else {
         $tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
         $tp->display('../users/login.tpl');
     }
 }
Exemplo n.º 2
0
 public static function getCurrentUserInfo()
 {
     if (SJB_Admin::admin_authed()) {
         return SJB_Authorization::getCurrentUserInfo();
     }
     return null;
 }
Exemplo n.º 3
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $activated = SJB_Request::getVar('account_activated', '') == 'yes';
     if (SJB_Request::getVar('returnToShoppingCart', false)) {
         SJB_Session::setValue('fromAnonymousShoppingCart', 1);
     }
     if (!$activated) {
         if (!isset($_REQUEST['username'], $_REQUEST['activation_key'])) {
             $errors['PARAMETERS_MISSED'] = 1;
         } elseif (!($userInfo = SJB_UserManager::getUserInfoByUserName($_REQUEST['username']))) {
             $errors['USER_NOT_FOUND'] = 1;
         } elseif ($userInfo['activation_key'] != $_REQUEST['activation_key']) {
             $errors['INVALID_ACTIVATION_KEY'] = true;
         } elseif ($userInfo['approval'] == 'Rejected') {
             SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/users/activate_account/?account_activated=no&approval_status=Rejected');
         } else {
             if (SJB_UserManager::activateUserByUserName($_REQUEST['username'])) {
                 SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
                 if (!SJB_Authorization::isUserLoggedIn()) {
                     SJB_Authorization::login($_REQUEST['username'], false, false, $errors, true, true);
                     if (!SJB_SocialPlugin::getProfileSocialID($userInfo['sid'])) {
                         SJB_Notifications::sendUserWelcomeLetter($userInfo['sid']);
                     }
                     $requireApprove = SJB_UserGroupManager::isApproveByAdmin($userInfo['user_group_sid']);
                     if ($requireApprove && !empty($userInfo['approval'])) {
                         $approvalStatus = $userInfo['approval'];
                     } else {
                         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
                         $pageId = !empty($userGroupInfo['after_registration_redirect_to']) ? $userGroupInfo['after_registration_redirect_to'] : '';
                         $redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
                         SJB_HelperFunctions::redirect($redirectUrl . 'account_activated=yes');
                     }
                 }
                 $activated = 1;
             } else {
                 $errors['CANNOT_ACTIVATE'] = TRUE;
             }
         }
     }
     $tp->assign('activated', $activated);
     $tp->assign('errors', $errors);
     $tp->assign('approvalStatus', !empty($approvalStatus) ? $approvalStatus : SJB_Request::getVar('approval_status', ''));
     $tp->assign('isLoggedIn', SJB_Authorization::isUserLoggedIn());
     $tp->display('activate_account.tpl');
 }
 public function execute()
 {
     $current_user_info = array('logged_in' => false);
     if (SJB_UserManager::isUserLoggedIn()) {
         SJB_Authorization::updateCurrentUserSession();
         $current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
         $current_user_info['logged_in'] = true;
         $current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
     } else {
         // social plugin
         $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
         SJB_System::setCurrentUserGroupsInfo($userGroups);
         SJB_Event::dispatch('Login_Plugin');
     }
     SJB_System::setCurrentUserInfo($current_user_info);
 }
Exemplo n.º 5
0
 public function execute()
 {
     if (!SJB_Authorization::isUserLoggedIn() && class_exists('SJB_SocialPlugin') && ($socPlugins = SJB_SocialPlugin::getAvailablePlugins())) {
         SJB_SocialPlugin::preparePluginsThatAreAvailableForRegistration($socPlugins);
         if (empty($socPlugins)) {
             return null;
         }
         $socNetworks = SJB_SocialPlugin::getSocialNetworks($socPlugins);
         $tp = SJB_System::getTemplateProcessor();
         $tp->assign('aSocPlugins', $socNetworks);
         $tp->display('login_buttons.tpl');
     } else {
         if (SJB_Authorization::isUserLoggedIn()) {
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-account/');
         }
     }
 }
Exemplo n.º 6
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_menu_template = 'user_menu.tpl';
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_info = SJB_Authorization::getCurrentUserInfo();
         if (!empty($user_info)) {
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
             if (!empty($user_group_info['user_menu_template']) && $tp->templateExists($user_group_info['user_menu_template'])) {
                 $user_menu_template = $user_group_info['user_menu_template'];
             }
             $tp->assign("user_group_info", $user_group_info);
             $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
         }
     }
     $tp->assign("account_activated", SJB_Request::getVar('account_activated', ''));
     $tp->display($user_menu_template);
 }
Exemplo n.º 7
0
 public function execute()
 {
     if (SJB_Authorization::isUserLoggedIn() && class_exists('SJB_SocialPlugin') && !SJB_SocialPlugin::getProfileObject() && ($socPlugins = SJB_SocialPlugin::getAvailablePlugins())) {
         $tp = SJB_System::getTemplateProcessor();
         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID(SJB_UserManager::getCurrentUser()->user_group_sid);
         /**
          * delete from plugins array plugins that are not allowed
          * for this userGroup registration
          */
         SJB_SocialPlugin::preparePluginsThatAreAvailableForRegistration($socPlugins, $userGroupInfo['id']);
         if (empty($socPlugins)) {
             return null;
         }
         $socialNetworks = SJB_SocialPlugin::getSocialNetworks($socPlugins);
         $tp->assign('label', 'link');
         $tp->assign('social_plugins', $socialNetworks);
         $tp->display('social_plugins.tpl');
     }
 }
Exemplo n.º 8
0
 /**
  * @static
  * @param SJB_User $user
  * @return bool
  */
 public static function saveUser(SJB_User $user)
 {
     $newUserInDB = !$user->isSavedInDB();
     if ($newUserInDB) {
         $user->createActivationKey();
         $user->createVerificationKey();
     }
     SJB_UserDBManager::saveUser($user);
     SJB_Cache::getInstance()->clean('matchingAnyTag', array(SJB_Cache::TAG_USERS));
     if ($newUserInDB) {
         SJB_Event::dispatch('onAfterUserCreated', $user);
         if (!$user->isSubuser()) {
             //add default user notifications
             $userNotifications = new SJB_UserNotificationsManager($user);
             $userNotifications->addDefaultUserNotifications();
         }
     }
     if (SJB_Authorization::isUserLoggedIn()) {
         SJB_Authorization::updateCurrentUserSession();
     }
     return true;
 }
Exemplo n.º 9
0
 public function execute()
 {
     $this->tp = SJB_System::getTemplateProcessor();
     if (!SJB_Authorization::isUserLoggedIn() && class_exists('SJB_SocialPlugin') && '/registration-social/' != SJB_Navigator::getUri() && ($socPlugins = SJB_SocialPlugin::getAvailablePlugins())) {
         $this->showErrorsIfExist();
         $userGroupID = SJB_Request::getVar('user_group_id', null);
         SJB_SocialPlugin::preparePluginsThatAreAvailableForRegistration($socPlugins, $userGroupID);
         if (empty($socPlugins)) {
             return null;
         }
         if ($userGroupID) {
             $this->tp->assign('user_group_id', $userGroupID);
         }
         $socNetworks = SJB_SocialPlugin::getSocialNetworks($socPlugins);
         $this->tp->assign('label', SJB_Request::getVar('label', null));
         $this->tp->assign('social_plugins', $socNetworks);
         $this->tp->assign('shoppingCart', SJB_Request::getVar('shoppingCart', null));
         $this->tp->display('social_plugins.tpl');
     } else {
         $this->showErrorsIfExist();
     }
 }
Exemplo n.º 10
0
 public function execute()
 {
     $page_id = SJB_Request::getVar('pageid', null);
     if ($page_id) {
         $tp = SJB_System::getTemplateProcessor();
         $i18n = SJB_I18N::getInstance();
         $lang = SJB_Request::getVar('lang', $i18n->getCurrentLanguage());
         $staticContent = SJB_StaticContent::getStaticContentByIDAndLang($page_id, $lang);
         if (empty($staticContent)) {
             $def_lang = SJB_System::getSettingByName('i18n_default_language');
             $staticContent = SJB_StaticContent::getStaticContentByIDAndLang($page_id, $def_lang);
         }
         if (!empty($staticContent)) {
             if ($page_id == '404') {
                 $isLoggedIn = SJB_Authorization::isUserLoggedIn();
                 if ($isLoggedIn) {
                     $listingTypesInfo = SJB_ListingTypeManager::getAllListingTypesInfo();
                     $currentUserInfo = SJB_Authorization::getCurrentUserInfo();
                     $userGroupinfo = SJB_UserGroupManager::getUserGroupInfoBySID($currentUserInfo['user_group_sid']);
                     $acl = SJB_Acl::getInstance();
                     $tp->assign('acl', $acl);
                     $tp->assign('listingTypesInfo', $listingTypesInfo);
                     $tp->assign('userGroupInfo', $userGroupinfo);
                 }
                 $staticContent['content'] = htmlspecialchars_decode($staticContent['content']);
                 $tp->assign('isLoggedIn', $isLoggedIn);
             }
             if (empty($staticContent['content'])) {
                 // Null создаёт ошибку в smarty
                 $staticContent['content'] = '';
             }
             $tp->assign('staticContent', $staticContent['content']);
             $tp->display('static_content.tpl');
         }
     }
 }
Exemplo n.º 11
0
 public static function login()
 {
     if (self::$oSocialPlugin) {
         if (!self::$oProfile) {
             return null;
         }
         $errors = array();
         if ($userSID = self::ifUserIsRegistered(self::getNetwork())) {
             $user = SJB_UserManager::getObjectBySID($userSID);
             $GLOBALS[self::SOCIAL_LOGIN_ERROR] = array();
             if ($user && SJB_Authorization::login($user->getUserName(), false, false, $errors, '', true)) {
                 if (!is_null(SJB_Session::getValue('fromAnonymousShoppingCart'))) {
                     SJB_Session::unsetValue('fromAnonymousShoppingCart');
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/shopping-cart/?');
                 } else {
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-account/');
                 }
             } elseif ($user && !empty($errors)) {
                 self::cleanCurrrentSessionData(self::getNetwork());
                 $GLOBALS[self::SOCIAL_LOGIN_ERROR] = $errors;
             }
             return false;
         }
     }
     return null;
 }
Exemplo n.º 12
0
 public static function getCurrentUserInfo()
 {
     $currentUser = SJB_Session::getValue('current_user');
     if (!empty($currentUser)) {
         return $currentUser;
     }
     if (isset($_COOKIE['session_key'])) {
         $user_sid = SJB_UserManager::getUserSIDBySessionKey($_COOKIE['session_key']);
         if (!empty($user_sid)) {
             $userInfo = SJB_UserManager::getUserInfoBySID($user_sid);
             if (!empty($userInfo['parent_sid'])) {
                 $subuserInfo = $userInfo;
                 $userInfo = SJB_UserManager::getUserInfoBySID($userInfo['parent_sid']);
                 $userInfo['subuser'] = $subuserInfo;
             }
             SJB_Session::setValue('current_user', $userInfo);
             SJB_Authorization::setKeepCookieForUser($_COOKIE['session_key']);
             return $userInfo;
         }
     }
     return null;
 }
Exemplo n.º 13
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_info = SJB_Authorization::getCurrentUserInfo();
     if (!empty($user_info['subuser'])) {
         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/sub-accounts/edit/?user_id=' . $user_info['subuser']['sid']);
     }
     if (!empty($user_info)) {
         $user_info = array_merge($user_info, $_REQUEST);
         $username = $user_info['username'];
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
         $delete_profile = SJB_Request::getVar('command', '', 'post') == 'unregister-user';
         $errors = array();
         if ($delete_profile && SJB_Acl::getInstance()->isAllowed('delete_user_profile')) {
             try {
                 $user = SJB_UserManager::getObjectBySID($user_info['sid']);
                 SJB_UserManager::deleteUserById($user_info['sid']);
                 SJB_AdminNotifications::sendAdminDeletingUserProfile($user, SJB_Request::getVar('reason', '', 'post'));
                 SJB_Authorization::logout();
                 $user_info = array();
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-profile/?profile_deleted=true');
             } catch (Exception $e) {
                 $errors[] = $e->getMessage();
             }
         }
         $user = new SJB_User($user_info, $user_info['user_group_sid']);
         $user->setSID($user_info['sid']);
         $user->deleteProperty("active");
         $user->deleteProperty("featured");
         $user->makePropertyNotRequired("password");
         $user->getProperty('email')->type->disableEmailConfirmation();
         $edit_profile_form = new SJB_Form($user);
         $edit_profile_form->registerTags($tp);
         $edit_profile_form->makeDisabled("username");
         $form_submitted = SJB_Request::getVar('action', false) == 'save_info';
         if ($form_submitted && $edit_profile_form->isDataValid($errors)) {
             $password_value = $user->getPropertyValue('password');
             if (empty($password_value['original'])) {
                 $user->deleteProperty('password');
             }
             SJB_UserManager::saveUser($user);
             SJB_Authorization::updateCurrentUserSession();
             // >>> SJB-1197
             // needs to check session for ajax-uploaded files, and set it to user profile
             $tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
             $formToken = SJB_Request::getVar('form_token');
             if (!empty($formToken)) {
                 $tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
                 if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
                     // prepare user profile fields array
                     $userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
                     $userProfileFields = array();
                     foreach ($userProfileFieldsInfo as $field) {
                         $userProfileFields[$field['id']] = $field;
                     }
                     // look for temporary values
                     foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
                         // check field ID for valid ID in user profile fields
                         if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
                             continue;
                         }
                         $fieldType = $userProfileFields[$fieldId]['type'];
                         $profilePropertyId = $fieldId . '_' . $user->getSID();
                         switch (strtolower($fieldType)) {
                             case 'video':
                             case 'file':
                                 // change temporary file ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             case 'logo':
                                 // change temporary file ID and thumb ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             default:
                                 break;
                         }
                         $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
                     }
                     // and save user with new fields data
                     SJB_UserManager::saveUser($user);
                     SJB_Authorization::updateCurrentUserSession();
                     // clean temporary storage
                     $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
                     // CLEAR TEMPORARY SESSION STORAGE
                     SJB_Session::setValue('tmp_uploads_storage', $tmpUploadsStorage);
                 }
             }
             // <<< SJB-1197
             $tp->assign("form_is_submitted", true);
         } else {
             $tp->assign("errors", $errors);
         }
         $form_fields = $edit_profile_form->getFormFieldsInfo();
         $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
         $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($form_fields)));
         $tp->assign("show_mailing_flag", $user_group_info['show_mailing_flag']);
         $tp->assign("form_fields", $form_fields);
         $tp->assign('userTree', true);
         $tp->display('edit_profile.tpl');
     } elseif (empty($user_info) && SJB_Request::getVar('profile_deleted', '') == true) {
         $user = new SJB_User(array());
         $edit_profile_form = new SJB_Form($user);
         $edit_profile_form->registerTags($tp);
         $edit_profile_form->makeDisabled("username");
         $form_fields = $edit_profile_form->getFormFieldsInfo();
         $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
         $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($form_fields)));
         $tp->assign("form_fields", $form_fields);
         $tp->assign('action', 'delete_profile');
         $tp->assign('tree_link_users', 'users');
         $tp->assign('userTree', true);
         $tp->display('edit_profile.tpl');
     } else {
         $tp->assign("ERROR", "NOT_LOGIN");
         $tp->display("../miscellaneous/error.tpl");
         return;
     }
 }
Exemplo n.º 14
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $registration_form_template = 'registration_form.tpl';
     if (SJB_Authorization::isUserLoggedIn()) {
         $tp->display('already_logged_in.tpl');
         return;
     }
     $tp->assign('terms_of_use_check', SJB_System::getSettingByName('terms_of_use_check'));
     $user_group_id = SJB_Request::getVar('user_group_id', null);
     if (!is_null($user_group_id)) {
         $user_group_sid = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
         if (empty($user_group_sid)) {
             $errors['NO_SUCH_USER_GROUP_IN_THE_SYSTEM'] = 1;
         }
     }
     $this->setSessionValueForRedirectAfterRegister();
     if (!is_null($user_group_id) && empty($errors)) {
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
         $user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
         if (SJB_Request::isAjax() || 'true' == SJB_Request::getVar('isajaxrequest')) {
             $field = SJB_Request::getVar('type');
             if ('email' == $field) {
                 $user->getProperty($field)->type->disableEmailConfirmation();
             }
             echo $user->getProperty($field)->isValid();
             exit;
         }
         $user->deleteProperty('active');
         $user->deleteProperty('featured');
         $form_submitted = SJB_Request::getVar('action', false) == 'register';
         if (class_exists('MobilePlugin') && MobilePlugin::isMobileThemeOn()) {
             $user->prepareRegistrationFields();
         }
         $registration_form = SJB_ObjectMother::createForm($user);
         $registration_form->registerTags($tp);
         if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) && $form_submitted) {
             $email = $user->getPropertyValue('email');
             if (is_array($email)) {
                 $email = $email['original'];
             }
             $user->setPropertyValue('username', $email);
         }
         if ($form_submitted && $registration_form->isDataValid($errors)) {
             $user->deleteProperty('captcha');
             $defaultProduct = SJB_UserGroupManager::getDefaultProduct($user_group_sid);
             SJB_UserManager::saveUser($user);
             SJB_Statistics::addStatistics('addUser', $user->getUserGroupSID(), $user->getSID());
             $availableProductIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($user_group_sid);
             if ($defaultProduct && in_array($defaultProduct, $availableProductIDs)) {
                 $contract = new SJB_Contract(array('product_sid' => $defaultProduct));
                 $contract->setUserSID($user->getSID());
                 $contract->saveInDB();
             }
             // >>> SJB-1197
             // needs to check session for ajax-uploaded files, and set it to user profile
             $formToken = SJB_Request::getVar('form_token');
             $tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
             if (!empty($formToken)) {
                 $tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
                 if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
                     // prepare user profile fields array
                     $userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
                     $userProfileFields = array();
                     foreach ($userProfileFieldsInfo as $field) {
                         $userProfileFields[$field['id']] = $field;
                     }
                     // look for temporary values
                     foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
                         // check field ID for valid ID in user profile fields
                         if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
                             continue;
                         }
                         $fieldType = $userProfileFields[$fieldId]['type'];
                         $profilePropertyId = $fieldId . '_' . $user->getSID();
                         switch (strtolower($fieldType)) {
                             case 'video':
                             case 'file':
                                 // change temporary file ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             case 'logo':
                                 // change temporary file ID and thumb ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             default:
                                 break;
                         }
                         $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
                     }
                     // save user with new values
                     SJB_UserManager::saveUser($user);
                     // clean temporary storage
                     $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
                     // CLEAR TEMPORARY SESSION STORAGE
                     SJB_Session::setValue('tmp_uploads_storage', $tmpUploadsStorage);
                 }
             }
             // <<< SJB-1197
             // notifying administrator
             SJB_AdminNotifications::sendAdminUserRegistrationLetter($user);
             // Activation
             $isSendActivationEmail = SJB_UserGroupManager::isSendActivationEmail($user_group_sid);
             $isApproveByAdmin = SJB_UserGroupManager::isApproveByAdmin($user_group_sid);
             if ($isApproveByAdmin) {
                 SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
             }
             if ($isSendActivationEmail) {
                 $fromAnonymousShoppingCart = SJB_Session::getValue('fromAnonymousShoppingCart');
                 SJB_Session::unsetValue('fromAnonymousShoppingCart');
                 $isSent = SJB_Notifications::sendUserActivationLetter($user->getSID(), $fromAnonymousShoppingCart ? true : false);
                 if ($isSent) {
                     $registration_form_template = 'registration_confirm.tpl';
                 } else {
                     SJB_FlashMessages::getInstance()->addWarning('ERROR_SEND_ACTIVATION_EMAIL');
                     $registration_form_template = 'registration_failed_to_send_activation_email.tpl';
                 }
             } else {
                 if (!$isSendActivationEmail && $isApproveByAdmin) {
                     SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
                     $registration_form_template = 'registration_pending.tpl';
                 } else {
                     SJB_UserManager::activateUserByUserName($user->getUserName());
                     if (!SJB_SocialPlugin::getProfileSocialID($user->getSID())) {
                         SJB_Notifications::sendUserWelcomeLetter($user->getSID());
                     }
                     SJB_Authorization::login($user->getUserName(), $_REQUEST['password']['original'], false, $errors);
                     $proceedToPosting = SJB_Session::getValue('proceed_to_posting');
                     if ($proceedToPosting) {
                         $redirectUrl = SJB_HelperFunctions::getSiteUrl() . '/add-listing/?listing_type_id=' . SJB_Session::getValue('listing_type_id') . '&proceed_to_posting=' . $proceedToPosting . '&productSID=' . SJB_Session::getValue('productSID');
                     } else {
                         $pageId = !empty($user_group_info['after_registration_redirect_to']) ? $user_group_info['after_registration_redirect_to'] : '';
                         $redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
                     }
                     SJB_HelperFunctions::redirect($redirectUrl);
                 }
             }
         } else {
             if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid)) {
                 $user->deleteProperty('username');
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             $registration_form->registerTags($tp);
             $registration_form_template = 'registration_form.tpl';
             if (isset($_REQUEST['reg_form_template'])) {
                 $registration_form_template = $_REQUEST['reg_form_template'];
             } elseif (!empty($user_group_info['reg_form_template'])) {
                 $registration_form_template = $user_group_info['reg_form_template'];
             }
             $form_fields = $registration_form->getFormFieldsInfo();
             // define default template with ajax checking
             $registration_form->setDefaultTemplateByFieldName('email', 'email_ajaxchecking.tpl');
             $registration_form->setDefaultTemplateByFieldName('username', 'unique_string.tpl');
             // use specific template for user profile video
             $registration_form->setDefaultTemplateByFieldName('video', 'video_profile.tpl');
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
             $tp->assign('user_group_info', $user_group_info);
             $tp->assign('errors', $errors);
             $tp->assign('form_fields', $form_fields);
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign('METADATA', array('form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields)));
         }
     } else {
         $registration_form_template = 'registration_choose_user_group.tpl';
         $user_groups_info = SJB_UserGroupManager::getAllUserGroupsInfo();
         $tp->assign('user_groups_info', $user_groups_info);
     }
     $tp->assign('userTree', true);
     $tp->assign('errors', $errors);
     $tp->display($registration_form_template);
 }
Exemplo n.º 15
0
 public function execute()
 {
     $logged_in = false;
     $tp = SJB_System::getTemplateProcessor();
     $shoppingCart = SJB_Request::getVar('shopping_cart', false);
     $proceedToPosting = SJB_Request::getVar('proceed_to_posting', false);
     $productSID = SJB_Request::getVar('productSID', false);
     $listingTypeID = SJB_Request::getVar('listing_type_id', false);
     $errors = array();
     if (SJB_Authorization::isUserLoggedIn() && !isset($_REQUEST['as_user'])) {
         $tp->display('already_logged_in.tpl');
     } else {
         $template = SJB_Request::getVar('template', 'login.tpl');
         $page_config = SJB_System::getPageConfig(SJB_System::getURI());
         if (SJB_Request::getVar('action', false) == 'login') {
             $username = SJB_Request::getVar('username');
             $password = SJB_Request::getVar('password');
             $keep_signed = SJB_Request::getVar('keep', false);
             $login_as_user = false;
             if (isset($_REQUEST['as_user'])) {
                 $login_as_user = true;
                 if (SJB_UserManager::getCurrentUserSID()) {
                     SJB_Authorization::logout();
                 }
             }
             // redirect user to the home page if it's login page or to the same page otherwise
             if (SJB_Request::getVar('return_url', false) != false) {
                 $redirect_url = base64_decode(SJB_Request::getVar('return_url'));
                 if (!empty($proceedToPosting)) {
                     $redirect_url .= '&proceed_to_posting=1&productSID=' . $productSID;
                 }
             } else {
                 if ($page_config->module == 'users' && $page_config->function == 'login') {
                     $redirect_url = SJB_System::getSystemSettings("SITE_URL") . "/my-account/";
                 } else {
                     $redirect_url = SJB_System::getSystemSettings("SITE_URL") . SJB_System::getURI();
                 }
             }
             if (SJB_UserManager::getCurrentUserSID()) {
                 $logged_in = true;
             } else {
                 SJB_UserManager::login($username, $password, $errors, false, $login_as_user);
                 if ($errors) {
                     if (is_null(SJB_Session::getValue('userLoginCounter'))) {
                         SJB_Session::setValue('userLoginCounter', 1);
                     } else {
                         SJB_Session::setValue('userLoginCounter', SJB_Session::getValue('userLoginCounter') + 1);
                     }
                 }
                 if (SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors) && empty($errors)) {
                     $logged_in = SJB_Authorization::login($username, $password, $keep_signed, $errors, $login_as_user);
                 }
             }
             if ($logged_in && !$shoppingCart) {
                 SJB_HelperFunctions::redirect($redirect_url);
             }
             $tp->assign('logged_in', $logged_in);
         }
         $return_url = SJB_Request::getVar('return_url', $page_config->function != 'login' && $page_config->function != 'search_form' ? base64_encode(SJB_Navigator::getURIThis()) : false);
         if (!filter_var(SJB_System::getSystemSettings("SITE_URL") . base64_decode($return_url), FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
             $return_url = '';
         }
         $tp->assign('shopping_cart', $shoppingCart);
         $tp->assign('proceedToPosting', $proceedToPosting);
         $tp->assign('productSID', $productSID);
         $tp->assign('listingTypeID', $listingTypeID);
         $tp->assign('return_url', $return_url);
         $tp->assign('ajaxRelocate', SJB_Request::getVar('ajaxRelocate', false));
         $tp->assign('errors', $errors);
         $tp->assign('adminEmail', SJB_System::getSettingByName('system_email'));
         $tp->display($template);
     }
 }
Exemplo n.º 16
0
<?php

require_once 'phpbb_bridge_plugin.php';
$userSession = PhpBBBridgePlugin::getUserSessionBySessionId(SJB_Session::getSessionId());
if (!empty($userSession)) {
    if (SJB_UserManager::isUserLoggedIn()) {
        if ($userSession['user_sid'] !== SJB_UserManager::getCurrentUserSID()) {
            if (!$userSession['user_sid']) {
                SJB_Authorization::logout();
            } else {
                SJB_Session::setValue('current_user', PhpBBBridgePlugin::sessionDecode($userSession['data']));
            }
        }
    } else {
        SJB_Session::setValue('current_user', PhpBBBridgePlugin::sessionDecode($userSession['data']));
    }
}
SJB_Event::handle('Login', array('PhpBBBridgePlugin', 'login'));
SJB_Event::handle('Logout', array('PhpBBBridgePlugin', 'logout'));
Exemplo n.º 17
0
 public function execute()
 {
     SJB_Authorization::logout();
     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL'));
 }
Exemplo n.º 18
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('terms_of_use_check', SJB_System::getSettingByName('terms_of_use_check'));
     $user_group_id = SJB_Request::getVar('user_group_id', null);
     $form_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'register';
     if (!is_null($user_group_id)) {
         $user_group_sid = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
         /**
          * check if registration is allowed for this UserGroup
          */
         if (!SJB_SocialPlugin::ifRegistrationIsAllowedByUserGroupSID($user_group_sid)) {
             return null;
         }
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
         $user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
         $user->deleteProperty('active');
         $user->deleteProperty('featured');
         $errors = array();
         // social plugin
         if ($form_submitted) {
             SJB_Event::dispatch('SocialPlugin_AddListingFieldsIntoRegistration', $user, true);
             SJB_Event::dispatch('MakeRegistrationFieldsNotRequired_SocialPlugin', $user, true);
         } else {
             SJB_Event::dispatch('PrepareRegistrationFields_SocialPlugin', $user, true);
             SJB_Event::dispatch('SocialPlugin_AddListingFieldsIntoRegistration', $user, true);
             SJB_Event::dispatch('FillRegistrationData_Plugin', $user, true);
         }
         $registration_form = SJB_ObjectMother::createForm($user);
         $registration_form->registerTags($tp);
         if ($form_submitted && $registration_form->isDataValid($errors)) {
             SJB_Event::dispatch('FillRegistrationData_Plugin', $user, true);
             SJB_Event::dispatch('AddReferencePluginDetails', $user, true);
             $user->deleteProperty('captcha');
             $user->deleteProperty('active');
             $user->deleteProperty('featured');
             SJB_UserManager::saveUser($user);
             SJB_Statistics::addStatistics('addUser', $user->getUserGroupSID(), $user->getSID(), false, 0, 0, false, 0, SJB_SocialPlugin::getNetwork());
             SJB_Statistics::addStatistics('addUser' . SJB_SocialPlugin::getNetwork(), $user->getUserGroupSID(), $user->getSID(), false, 0, 0, false, 0, SJB_SocialPlugin::getNetwork());
             // subscribe user on default product
             $defaultProduct = SJB_UserGroupManager::getDefaultProduct($user_group_sid);
             $availableProductIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($user_group_sid);
             if ($defaultProduct && in_array($defaultProduct, $availableProductIDs)) {
                 $contract = new SJB_Contract(array('product_sid' => $defaultProduct));
                 $contract->setUserSID($user->getSID());
                 $contract->saveInDB();
             }
             SJB_SocialPlugin::sendUserSocialRegistrationLetter($user);
             // notify administrator
             SJB_AdminNotifications::sendAdminUserRegistrationLetter($user);
             // Activation
             $isSendActivationEmail = SJB_UserGroupManager::isSendActivationEmail($user_group_sid);
             $isApproveByAdmin = SJB_UserGroupManager::isApproveByAdmin($user_group_sid);
             if ($isApproveByAdmin) {
                 SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
             }
             if ($isSendActivationEmail) {
                 $isSent = SJB_Notifications::sendUserActivationLetter($user->getSID());
                 if ($isSent) {
                     $tp->display('../users/registration_confirm.tpl');
                 } else {
                     $tp->display('../users/registration_failed_to_send_activation_email.tpl');
                 }
             } else {
                 if (!$isSendActivationEmail && $isApproveByAdmin) {
                     SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
                     $tp->display('../users/registration_pending.tpl');
                 } else {
                     SJB_UserManager::activateUserByUserName($user->getUserName());
                     $errors = array();
                     SJB_Authorization::login($user->getUserName(), $user->getPropertyValue('password'), false, $errors, false);
                     // save access token, profile info for synchronization
                     SJB_SocialPlugin::postRegistration();
                     $tp->assign('socialNetwork', SJB_SocialPlugin::getNetwork());
                     $pageId = !empty($user_group_info['after_registration_redirect_to']) ? $user_group_info['after_registration_redirect_to'] : '';
                     $redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
                     SJB_HelperFunctions::redirect($redirectUrl);
                 }
             }
         } else {
             // social plugin
             SJB_Event::dispatch('PrepareRegistrationFields_SocialPlugin', $user, true);
             if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid)) {
                 $user->deleteProperty('username');
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             if ($form_submitted) {
                 $registration_form->isDataValid($errors);
             }
             $registration_form->registerTags($tp);
             $registration_form_template = '../users/registration_form.tpl';
             if (isset($_REQUEST['reg_form_template'])) {
                 $registration_form_template = $_REQUEST['reg_form_template'];
             } elseif (!empty($user_group_info['reg_form_template'])) {
                 $registration_form_template = $user_group_info['reg_form_template'];
             }
             $form_fields = $registration_form->getFormFieldsInfo();
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
             $tp->assign('user_group_info', $user_group_info);
             $tp->assign('errors', $errors);
             $tp->assign('user_group_id', $user_group_id);
             $tp->assign('form_fields', $form_fields);
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign('METADATA', array('form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields)));
             $tp->assign('socialRegistration', true);
             $tp->assign('userTree', true);
             $tp->display($registration_form_template);
         }
     } else {
         $userGroupsSIDs = SJB_SocialPlugin::getResolvedUserGroupsByNetwork();
         $user_groups_info = array();
         foreach ($userGroupsSIDs as $groupSID) {
             array_push($user_groups_info, SJB_UserGroupManager::getUserGroupInfoBySID($groupSID));
         }
         /*
          * if there is only one group available for registration
          * redirect user directly on Registration Fields page
          */
         if (count($user_groups_info) === 1 && !empty($user_groups_info[0]['id'])) {
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/registration-social/?user_group_id=' . $user_groups_info[0]['id']);
         }
         $tp->assign('user_groups_info', $user_groups_info);
         $tp->display('registration_choose_user_group_social.tpl');
     }
 }
Exemplo n.º 19
0
function logout_sjb()
{
    $dir = getcwd();
    loadSJB();
    SJB_Authorization::logout();
    chdir($dir);
}
Exemplo n.º 20
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $userInfo = SJB_Authorization::getCurrentUserInfo();
     if (empty($userInfo)) {
         $tp->assign("ERROR", "NOT_LOGIN");
         $tp->display("../miscellaneous/error.tpl");
         return;
     }
     $template = SJB_Request::getVar('template', 'my_invoices.tpl');
     $searchTemplate = SJB_Request::getVar('search_template', 'invoice_search_form.tpl');
     /***************************************************************/
     $_REQUEST['action'] = 'search';
     $_REQUEST['user_sid']['equal'] = $userInfo['sid'];
     if (!isset($_REQUEST['date'])) {
         $i18n = SJB_ObjectMother::createI18N();
         $_REQUEST['date']['not_less'] = $i18n->getDate(date('Y-m-d', time() - 30 * 24 * 60 * 60));
         $_REQUEST['date']['not_more'] = $i18n->getDate(date('Y-m-d'));
     }
     $invoice = new SJB_Invoice(array());
     $invoice->addProperty(array('id' => 'username', 'type' => 'string', 'value' => '', 'is_system' => true));
     $aliases = new SJB_PropertyAliases();
     $aliases->addAlias(array('id' => 'username', 'real_id' => 'user_sid', 'transform_function' => 'SJB_UserDBManager::getUserSIDsLikeSearchString'));
     $searchFormBuilder = new SJB_SearchFormBuilder($invoice);
     $criteriaSaver = new SJB_InvoiceCriteriaSaver();
     if (isset($_REQUEST['restore'])) {
         $_REQUEST = array_merge($_REQUEST, $criteriaSaver->getCriteria());
     }
     $criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $invoice);
     $searchFormBuilder->setCriteria($criteria);
     $searchFormBuilder->registerTags($tp);
     $tp->display($searchTemplate);
     /********************** S O R T I N G *********************/
     $criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $invoice);
     $searcher = new SJB_InvoiceSearcher();
     $foundInvoices = array();
     $foundInvoicesInfo = array();
     if (SJB_Request::getVar('action', '') == 'search') {
         $foundInvoices = $searcher->getObjectsByCriteria($criteria, $aliases);
         $criteriaSaver->setSession($_REQUEST, $searcher->getFoundObjectSIDs());
     } elseif (isset($_REQUEST['restore'])) {
         $foundInvoices = $criteriaSaver->getObjectsFromSession();
     }
     foreach ($foundInvoices as $id => $invoice) {
         $invoice->addProperty(array('id' => 'sid', 'type' => 'string', 'value' => $invoice->getSID()));
         $subUserSid = $invoice->getPropertyValue('subuser_sid');
         if ($subUserSid) {
             $payer = SJB_UserManager::getUserNameByUserSID($subUserSid);
         } else {
             $userSid = $invoice->getPropertyValue('user_sid');
             $payer = SJB_UserManager::getUserNameByUserSID($userSid);
         }
         $invoice->addProperty(array('id' => 'payer', 'type' => 'string', 'value' => $payer));
         $foundInvoices[$id] = $invoice;
         $foundInvoicesInfo[$invoice->getSID()] = SJB_InvoiceManager::getInvoiceInfoBySID($invoice->getSID());
     }
     $sortingField = SJB_Request::getVar('sorting_field', 'sid');
     $sortingOrder = SJB_Request::getVar('sorting_order', 'DESC');
     if ($invoice->propertyIsSet($sortingField)) {
         $sortArray = array();
         $sortedFoundInvoicesInfo = array();
         foreach ($foundInvoices as $id => $invoice) {
             $sortArray[$id] = $invoice->getPropertyValue($sortingField);
         }
         if ($sortingOrder == 'ASC') {
             asort($sortArray);
         } elseif ($sortingOrder == 'DESC') {
             arsort($sortArray);
         }
         foreach ($sortArray as $id => $value) {
             $sortedFoundInvoicesInfo[$id] = $foundInvoicesInfo[$id];
         }
     } else {
         $sortedFoundInvoicesInfo = $foundInvoicesInfo;
     }
     $formCollection = new SJB_FormCollection($foundInvoices);
     $formCollection->registerTags($tp);
     $subUsers = SJB_UserManager::getSubUsers($userInfo['sid']);
     $isSubUserExists = !empty($subUsers) ? true : false;
     $tp->assign('isSubUserExists', $isSubUserExists);
     $tp->assign('sorting_field', $sortingField);
     $tp->assign('sorting_order', $sortingOrder);
     $tp->assign('found_invoices', $sortedFoundInvoicesInfo);
     $tp->display($template);
 }
Exemplo n.º 21
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $parent_name = null;
     $user_sid = SJB_Request::getVar('user_sid', false);
     if (!is_null($user_sid)) {
         $user_info = SJB_UserManager::getUserInfoBySID($user_sid);
         $user_info = array_merge($user_info, $_REQUEST);
         $form_submitted = SJB_Request::getVar('action_name');
         $user = new SJB_User($user_info, $user_info['user_group_sid']);
         if (!empty($user_info['parent_sid'])) {
             $props = $user->getProperties();
             $allowedProperties = array('username', 'email', 'password');
             foreach ($props as $prop) {
                 if (!in_array($prop->getID(), $allowedProperties)) {
                     $user->deleteProperty($prop->getID());
                 }
             }
             $parent_name = SJB_UserManager::getUserNameByUserSID($user_info['parent_sid']);
         }
         $user->setSID($user_info['sid']);
         $user->getProperty('email')->type->disableEmailConfirmation();
         $user->deleteProperty("active");
         $user->makePropertyNotRequired("password");
         if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_info['user_group_sid'])) {
             if ($form_submitted) {
                 $email = $user->getPropertyValue('email');
                 if (is_array($email)) {
                     $email = $email['original'];
                 }
                 $user->setPropertyValue('username', $email);
             }
         }
         $user->addExtUserIDProperty($user_info['extUserID']);
         $edit_user_form = new SJB_Form($user);
         $errors = array();
         if ($form_submitted && $edit_user_form->isDataValid($errors)) {
             $password_value = $user->getPropertyValue('password');
             $properties = null;
             if (empty($password_value['original'])) {
                 $properties = $user->getProperties();
                 $user->deleteProperty('password');
             }
             SJB_UserManager::saveUser($user);
             // >>> SJB-1197
             // needs to check session for ajax-uploaded files, and set it to user profile
             $tmpUploadsStorage = SJB_Session::getValue('tmp_uploads_storage');
             $formToken = SJB_Request::getVar('form_token');
             if (!empty($formToken)) {
                 $tmpUploadedFields = SJB_Array::getPath($tmpUploadsStorage, $formToken);
                 if (!is_null($tmpUploadsStorage) && is_array($tmpUploadedFields)) {
                     // prepare user profile fields array
                     $userProfileFieldsInfo = SJB_UserProfileFieldManager::getAllFieldsInfo();
                     $userProfileFields = array();
                     foreach ($userProfileFieldsInfo as $field) {
                         $userProfileFields[$field['id']] = $field;
                     }
                     // look for temporary values
                     foreach ($tmpUploadedFields as $fieldId => $fieldInfo) {
                         // check field ID for valid ID in user profile fields
                         if (!array_key_exists($fieldId, $userProfileFields) || empty($fieldInfo)) {
                             continue;
                         }
                         $fieldType = $userProfileFields[$fieldId]['type'];
                         $profilePropertyId = $fieldId . '_' . $user->getSID();
                         switch (strtolower($fieldType)) {
                             case 'video':
                             case 'file':
                                 // change temporary file ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             case 'logo':
                                 // change temporary file ID and thumb ID
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId, $fieldInfo['file_id']);
                                 SJB_DB::query("UPDATE `uploaded_files` SET `id` = ?s WHERE `id` = ?s", $profilePropertyId . '_thumb', $fieldInfo['file_id'] . '_thumb');
                                 // set value of user property to new uploaded file
                                 $user->setPropertyValue($fieldId, $profilePropertyId);
                                 break;
                             default:
                                 break;
                         }
                         $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}/{$fieldId}");
                     }
                     // and save user with new fields data
                     SJB_UserManager::saveUser($user);
                     SJB_Authorization::updateCurrentUserSession();
                     // clean temporary storage
                     $tmpUploadsStorage = SJB_Array::unsetValueByPath($tmpUploadsStorage, "{$formToken}");
                     // CLEAR TEMPORARY SESSION STORAGE
                     SJB_Session::setValue('tmp_uploads_storage', $tmpUploadsStorage);
                 }
             }
             // <<< SJB-1197
             if (SJB_Request::isAjax()) {
                 echo "<p class=\"green\">User Saved</p>";
                 exit;
             }
             if ($form_submitted == 'save_info') {
                 $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-users/" . mb_strtolower($userGroupInfo['id'], 'utf8'));
             }
             if (!empty($properties)) {
                 $user->details->properties = $properties;
             }
         }
         if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_info['user_group_sid'])) {
             $user->deleteProperty("username");
         }
         $listingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
         $products = SJB_ProductsManager::getProductsInfoByUserGroupSID($user_info['user_group_sid']);
         $allowedListingTypes = array();
         foreach ($products as $product) {
             if (!empty($product['listing_type_sid']) && empty($allowedListingTypes[$product['listing_type_sid']])) {
                 foreach ($listingTypes as $listingType) {
                     if ($product['listing_type_sid'] == $listingType['sid']) {
                         $allowedListingTypes[$product['listing_type_sid']] = $listingType;
                     }
                 }
             }
         }
         $edit_user_form = SJB_ObjectMother::createForm($user);
         $edit_user_form->registerTags($tp);
         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
         if (SJB_UserManager::checkBan($errors, $user_info['ip'])) {
             $user_info['ip_is_banned'] = 1;
         }
         $tp->assign("form_fields", $edit_user_form->getFormFieldsInfo());
         $tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize());
         $tp->assign("errors", $errors);
         $tp->assign("listingTypes", $allowedListingTypes);
         $tp->assign("user_info", $user_info);
         $tp->assign("user_group_info", $userGroupInfo);
         $tp->assign('userTree', true);
         $tp->assign("parent_name", $parent_name);
         $tp->assign("restore", preg_match('/manage-(jobseekers)|(employers)|([a-z0-9\\_]-users)/', SJB_Request::getVar('HTTP_REFERER', '', 'SERVER')));
         SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
         $tp->display("edit_user.tpl");
     }
 }