/**
  * Function migrate profiles custom fields;
  * 
  * @return : (string) operation result;
  */
 function getMigration()
 {
     // set new status;
     $this->setResultStatus('Profiles custom fields transfer now');
     mysql_query('SET NAMES utf8', $this->rOldDb);
     //-- get old table structure --//
     $sQuery = "DESCRIBE `Profiles`";
     $rResult = mysql_query($sQuery, $this->rOldDb);
     while ($aRow = mysql_fetch_assoc($rResult)) {
         $this->aOldProfileTable[$aRow['Field']] = array('Type' => $aRow['Type'], 'Null' => $aRow['Null'], 'Key' => $aRow['Key'], 'Default' => $aRow['Default'], 'Extra' => $aRow['Extra']);
     }
     //--
     //-- get new table structure --//
     $sQuery = "DESCRIBE `Profiles`";
     $aRow = $this->oMigrationModule->_oDb->getAll($sQuery);
     foreach ($aRow as $iKey => $aItems) {
         $this->aNewProfileTable[$aItems['Field']] = array('Type' => $aItems['Type'], 'Null' => $aItems['Null'], 'Key' => $aItems['Key'], 'Default' => $aItems['Default'], 'Extra' => $aItems['Extra']);
     }
     //--
     //-- compare the recived array --//
     foreach ($this->aOldProfileTable as $sKey => $aItems) {
         if (array_key_exists($sKey, $this->aNewProfileTable) || in_array($sKey, $this->aFiltered)) {
             unset($this->aOldProfileTable[$sKey]);
         }
     }
     //--
     //-- alter new table --//
     foreach ($this->aOldProfileTable as $sKey => $aItems) {
         // define dafault value;
         $sDefault = $aItems['Default'] ? "DEFAULT '{$aItems['Default']}'" : '';
         $sNull = $aItems['Null'] == 'NO' ? 'NOT NULL' : '';
         $sQuery = "\r\n               \t\tALTER TABLE `Profiles` ADD `{$sKey}` {$aItems['Type']} {$sNull} {$sDefault}\r\n               ";
         // add new field
         $this->oMigrationModule->_oDb->query($sQuery);
         // transfer  into sys_profile_fields
         $this->_transferProfileFields($sKey);
         // transfer  into sys_pre_values
         $this->_transferPreValues($sKey);
         $this->iTransffered++;
     }
     //--
     //-- transfer all data --//
     $this->_transformData();
     //--
     //-- Recompile all needed cache files --//
     bx_import('BxDolInstallerUtils');
     $oInstallerUtils = new BxDolInstallerUtils();
     $oInstallerUtils->updateProfileFieldsHtml();
     $oCacher = new BxDolPFMCacher();
     $oCacher->createCache();
     $this->compilePreValues();
     //--
     // set as finished;
     $this->setResultStatus('All profiles custom fields were transferred (' . $this->iTransffered . ' items)');
     return MIGRATION_SUCCESSFUL;
 }
function createNewItem()
{
    $oFields = new MlClonetwoPSFM(1);
    $iNewID = $oFields->createNewField();
    bx_import('BxDolInstallerUtils');
    $oInstallerUtils = new BxDolInstallerUtils();
    $oInstallerUtils->updateProfileFieldsHtml();
    header('Content-Type:text/javascript');
    echo '{id:' . $iNewID . '}';
}
 public function __construct()
 {
     if (isset($GLOBALS['bxDolClasses'][get_class($this)])) {
         trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
     }
     parent::__construct();
 }
function getUserMusicLink()
{
    global $sModulesUrl;
    if (BxDolInstallerUtils::isModuleInstalled("sounds")) {
        return $sModulesUrl . "mp3/soundslink.php?id=#user#";
    }
    return "";
}
function getUserMusicLink()
{
    global $sRootURL;
    if (BxDolInstallerUtils::isModuleInstalled("sounds")) {
        $oDolPermalinks = new BxDolPermalinks();
        return $sRootURL . $oDolPermalinks->permalink("modules?r=sounds/") . "browse/owner/#nick#";
    }
    return "";
}
 public function __construct()
 {
     if (isset($GLOBALS['bxDolClasses'][get_class($this)])) {
         trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
     }
     parent::__construct();
     $this->bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER;
     $this->sAuthorizedAccessClass = 'BxDolStudioOAuthPlugin';
 }
function isModuleAvailable($sModuleName, $sUserId = "", $sAction = "")
{
    $bResult = BxDolInstallerUtils::isModuleInstalled($sModuleName);
    if ($bResult && !empty($sUserId) && !empty($sAction)) {
        $aResult = checkAction($sUserId, $sAction);
        $bResult = $aResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
    }
    return $bResult;
}
 function BxDolInstaller($aConfig)
 {
     parent::BxDolInstallerUtils();
     $this->_aConfig = $aConfig;
     $this->_sBasePath = BX_DIRECTORY_PATH_MODULES;
     $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_aActions = array('check_script_version' => array('title' => _t('_adm_txt_modules_check_script_version')), 'check_dependencies' => array('title' => _t('_adm_txt_modules_check_dependencies')), 'show_introduction' => array('title' => _t('_adm_txt_modules_show_introduction')), 'check_permissions' => array('title' => _t('_adm_txt_modules_check_permissions')), 'change_permissions' => array('title' => _t('_adm_txt_modules_change_permissions')), 'execute_sql' => array('title' => _t('_adm_txt_modules_execute_sql')), 'update_languages' => array('title' => _t('_adm_txt_modules_update_languages')), 'recompile_global_paramaters' => array('title' => _t('_adm_txt_modules_recompile_global_paramaters')), 'recompile_main_menu' => array('title' => _t('_adm_txt_modules_recompile_main_menu')), 'recompile_member_menu' => array('title' => _t('_adm_txt_modules_recompile_member_menu')), 'recompile_site_stats' => array('title' => _t('_adm_txt_modules_recompile_site_stats')), 'recompile_page_builder' => array('title' => _t('_adm_txt_modules_recompile_page_builder')), 'recompile_profile_fields' => array('title' => _t('_adm_txt_modules_recompile_profile_fields')), 'recompile_comments' => array('title' => _t('_adm_txt_modules_recompile_comments')), 'recompile_member_actions' => array('title' => _t('_adm_txt_modules_recompile_member_actions')), 'recompile_tags' => array('title' => _t('_adm_txt_modules_recompile_tags')), 'recompile_votes' => array('title' => _t('_adm_txt_modules_recompile_votes')), 'recompile_categories' => array('title' => _t('_adm_txt_modules_recompile_categories')), 'recompile_search' => array('title' => _t('_adm_txt_modules_recompile_search')), 'recompile_injections' => array('title' => _t('_adm_txt_modules_recompile_injections')), 'recompile_permalinks' => array('title' => _t('_adm_txt_modules_recompile_permalinks')), 'recompile_alerts' => array('title' => _t('_adm_txt_modules_recompile_alerts')), 'clear_db_cache' => array('title' => _t('_adm_txt_modules_clear_db_cache')), 'show_conclusion' => array('title' => _t('_adm_txt_modules_show_conclusion')));
     $this->_aNonHashable = array('install', 'updates');
 }
 public function processing()
 {
     set_time_limit(36000);
     ignore_user_abort();
     if (BxDolStorage::pruneDeletions()) {
         // if any files were deleted
         BxDolInstallerUtils::checkModulesPendingUninstall();
     }
     // try to uninstall modules pending for uninstall
 }
 function __construct($aConfig)
 {
     parent::__construct();
     $this->oDb = bx_instance('BxDolStudioInstallerQuery');
     $this->_aConfig = $aConfig;
     $this->_sBasePath = BX_DIRECTORY_PATH_MODULES;
     $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir'];
     $this->_bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER;
     $this->_aActions = array('perform_install' => array('title' => '', 'success' => _t('_adm_msg_modules_success_install'), 'failed' => ''), 'perform_uninstall' => array('title' => '', 'success' => _t('_adm_msg_modules_success_uninstall'), 'failed' => ''), 'perform_enable' => array('title' => '', 'success' => _t('_adm_msg_modules_success_enable'), 'failed' => ''), 'perform_disable' => array('title' => '', 'success' => _t('_adm_msg_modules_success_disable'), 'failed' => ''), 'check_script_version' => array('title' => _t('_adm_txt_modules_check_script_version')), 'check_dependencies' => array('title' => _t('_adm_txt_modules_check_dependencies')), 'show_introduction' => array('title' => _t('_adm_txt_modules_show_introduction')), 'move_sources' => array('title' => _t('_adm_txt_modules_move_sources')), 'execute_sql' => array('title' => _t('_adm_txt_modules_execute_sql')), 'install_language' => array('title' => _t('_adm_txt_modules_install_language')), 'update_languages' => array('title' => _t('_adm_txt_modules_update_languages')), 'update_relations' => array('title' => _t('_adm_txt_modules_update_relations')), 'process_connections' => array('title' => _t('_adm_txt_modules_process_connections')), 'process_deleted_profiles' => array('title' => _t('_adm_txt_modules_process_deleted_profiles')), 'process_menu_triggers' => array('title' => _t('_adm_txt_modules_process_menu_triggers')), 'process_page_triggers' => array('title' => _t('_adm_txt_modules_process_page_triggers')), 'process_storages' => array('title' => _t('_adm_txt_modules_process_storages')), 'register_transcoders' => array('title' => _t('_adm_txt_modules_register_transcoders')), 'unregister_transcoders' => array('title' => _t('_adm_txt_modules_unregister_transcoders')), 'clear_db_cache' => array('title' => _t('_adm_txt_modules_clear_db_cache')), 'show_conclusion' => array('title' => _t('_adm_txt_modules_show_conclusion')));
     $this->_aNonHashableFiles = array('install', 'updates');
 }
 function uninstall($aParams, $bDisable = false)
 {
     // check if module is already waiting while files are deleting
     bx_import('BxDolInstallerUtils');
     if (BxDolInstallerUtils::isModulePendingUninstall($this->_aConfig['home_uri'])) {
         return array('message' => _t('_adm_err_modules_pending_uninstall_already'), 'result' => false);
     }
     // queue for deletion storage files
     $bSetModulePendingUninstall = false;
     foreach ($this->_aStorages as $s) {
         if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject()) {
             $bSetModulePendingUninstall = true;
         }
     }
     // delete comments and queue for deletion comments attachments
     bx_import('BxDolCmts');
     $iFiles = 0;
     BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
     if ($iFiles) {
         $bSetModulePendingUninstall = true;
     }
     // if some files were added to the queue, set module as pending uninstall
     if ($bSetModulePendingUninstall) {
         BxDolInstallerUtils::setModulePendingUninstall($this->_aConfig['home_uri']);
         return array('message' => _t('_adm_err_modules_pending_uninstall'), 'result' => false);
     }
     // delete associated connections
     if ($this->_aConnections) {
         bx_import('BxDolConnection');
         foreach ($this->_aConnections as $sObjectConnections => $a) {
             $o = BxDolConnection::getObjectInstance($sObjectConnections);
             if (!$o) {
                 continue;
             }
             $sFuncSuffix = 'DeleteInitiatorAndContent';
             if (isset($a['conn']) && 'initiator' == $a['conn']) {
                 $sFuncSuffix = 'DeleteInitiator';
             } elseif (isset($a['conn']) && 'content' == $a['conn']) {
                 $sFuncSuffix = 'DeleteContent';
             }
             if (isset($a['type']) && 'profiles' == $a['type']) {
                 $sFunc = 'onModuleProfile' . $sFuncSuffix;
                 $o->{$sFunc}($this->_aConfig['name']);
             } else {
                 $sFunc = 'onModule' . $sFuncSuffix;
                 $o->{$sFunc}($a['table'], $a['field_id']);
             }
         }
     }
     return parent::uninstall($aParams, $bDisable);
 }
Exemple #12
0
 public function actionResetHash($sType)
 {
     $oDb = bx_instance('BxDolStudioInstallerQuery');
     $sResult = '';
     switch ($sType) {
         case 'system':
             $oHasher = bx_instance('BxDolInstallerHasher');
             $oDb->deleteModuleTrackFiles(BX_SYSTEM_MODULE_ID);
             $sResult = _t('_bx_dev_hash_' . ($oHasher->hashSystemFiles() ? 'msg' : 'err') . '_reset_hash_system');
             break;
         case 'modules':
             bx_import('BxDolInstallerUtils');
             bx_import('BxDolModuleQuery');
             $aModules = BxDolModuleQuery::getInstance()->getModules();
             $aTmplVarsModules = array();
             foreach ($aModules as $aModule) {
                 if ($aModule['name'] == 'system') {
                     continue;
                 }
                 $aConfig = BxDolInstallerUtils::getModuleConfig($aModule);
                 $sPathInstaller = BX_DIRECTORY_PATH_MODULES . $aModule['path'] . 'install/installer.php';
                 if (empty($aConfig) || !file_exists($sPathInstaller)) {
                     continue;
                 }
                 require_once $sPathInstaller;
                 $sClassName = $aConfig['class_prefix'] . 'Installer';
                 $oInstaller = new $sClassName($aConfig);
                 $oDb->deleteModuleTrackFiles($aModule['id']);
                 $aFiles = array();
                 $oInstaller->hashFiles(BX_DIRECTORY_PATH_ROOT . 'modules/' . $aModule['path'], $aFiles);
                 foreach ($aFiles as $aFile) {
                     $oDb->insertModuleTrack($aModule['id'], $aFile);
                 }
                 $aTmplVarsModules[] = array('module' => $aModule['title'], 'files' => count($aFiles));
             }
             $sResult = $this->_oTemplate->parseHtmlByName('hash_modules.html', array('bx_repeat:modules' => $aTmplVarsModules));
             break;
     }
     echo $sResult;
     exit;
 }
 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - some profile's information;
  *          @see : $this -> aFacebookProfileFields;
  *
  * @param  : $sAlternativeName (string) - profiles alternative nickname;
  */
 function _createProfile($aProfileInfo, $sAlternativeName = '')
 {
     $mixed = $this->_createProfileRaw($aProfileInfo, $sAlternativeName);
     //print_r($mixed); exit;
     if (is_string($mixed)) {
         $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox($mixed));
         exit;
     } elseif (is_array($mixed) && isset($mixed['join_page_redirect'])) {
         $this->_getJoinPage($mixed['profile_fields'], $mixed['profile_info_fb']['id']);
         exit;
     } elseif (is_array($mixed) && isset($mixed['profile_id'])) {
         $bAvatarRedirect = false;
         //check redirect page
         switch ($this->_oConfig->sRedirectPage) {
             case 'join':
                 //handled above
                 //$sRedirectUrl = BX_DOL_URL_ROOT;
                 //break;
                 exit;
             case 'pedit':
                 $sRedirectUrl = BX_DOL_URL_ROOT . 'pedit.php?ID=' . (int) $mixed['profile_id'];
                 break;
             case 'avatar':
                 $bAvatarRedirect = true;
                 break;
             case 'index':
                 $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php';
                 break;
             case 'member':
                 $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php';
                 break;
             default:
                 $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php';
                 break;
         }
         $iProfileId = $mixed['profile_id'];
         $sMemberAvatar = !empty($mixed['profile_info_fb']['picture']) ? $mixed['profile_info_fb']['picture'] : '';
         //redirect to avatar page
         if ($bAvatarRedirect) {
             if (BxDolInstallerUtils::isModuleInstalled('avatar')) {
                 // check profile's logo;
                 if ($sMemberAvatar) {
                     BxDolService::call('avatar', 'set_image_for_cropping', array($iProfileId, $sMemberAvatar));
                 }
                 if (BxDolService::call('avatar', 'join', array($iProfileId, '_Join complete'))) {
                     exit;
                 }
             } else {
                 header('location:' . $this->_oConfig->sDefaultRedirectUrl);
                 exit;
             }
         } else {
             //assign avatar
             if ($sMemberAvatar) {
                 $this->_assignAvatar($sMemberAvatar);
             }
             //redirect to other page
             header('location:' . $sRedirectUrl);
             exit;
         }
     } else {
         $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox(_t('_Error Occured')));
         exit;
     }
 }
Exemple #14
0
function deleteItem($iItemID, $iAreaID)
{
    $oFields = new BxDolPFM($iAreaID);
    $oFields->deleteItem($iItemID);
    bx_import('BxDolInstallerUtils');
    $oInstallerUtils = new BxDolInstallerUtils();
    $oInstallerUtils->updateProfileFieldsHtml();
    $oCacher = new BxDolPFMCacher();
    $oCacher->createCache();
}
Exemple #15
0
$oSysTemplate->addJs('view_edit.js');
$_ni = 5;
$_page['name_index'] = $_ni;
$_page['css_name'] = array('profile_view.css', 'profile_view_tablet.css', 'profile_view_phone.css');
$p_arr = $oProfile->_aProfile;
$sUserInfo = $oFunctions->getUserInfo($p_arr['ID']);
if (!empty($sUserInfo)) {
    $sUserInfo = ': ' . htmlspecialchars_adv($sUserInfo);
}
$_page['header'] = process_line_output(getNickName($p_arr['ID'])) . $sUserInfo;
$oPPV = new BxTemplProfileView($oProfile, $site, $dir);
$_page_cont[$_ni]['page_main_code'] = $oPPV->getCode();
$_page_cont[$_ni]['custom_block'] = '';
$_page_cont[$_ni]['page_main_css'] = '';
// add profile customizer
if (BxDolInstallerUtils::isModuleInstalled("profile_customize")) {
    $_page_cont[$_ni]['custom_block'] = '<div id="profile_customize_page" style="display: none;">' . BxDolService::call('profile_customize', 'get_customize_block', array()) . '</div>';
    $_page_cont[$_ni]['page_main_css'] = '<style type="text/css">' . BxDolService::call('profile_customize', 'get_profile_style', array($profileID)) . '</style>';
}
// Submenu actions
$iId = $profileID;
$iMemberId = $memberID;
$sTxtProfileAccountPage = _t('_sys_am_profile_account_page');
$sTxtProfileMessage = _t('_sys_am_profile_message');
$sTxtFriendAdd = _t('_sys_am_profile_friend_add');
$sTxtFriendAccept = _t('_sys_am_profile_friend_accept');
$sTxtFriendCancel = _t('_sys_am_profile_friend_cancel');
$aVars = array('ID' => $iId, 'member_id' => $iMemberId, 'BaseUri' => BX_DOL_URL_ROOT, 'cpt_am_profile_account_page' => $sTxtProfileAccountPage);
if (isFriendRequest($iMemberId, $iId)) {
    $aVars['cpt_am_friend_add'] = '';
    $aVars['cpt_am_profile_message'] = $sTxtProfileMessage;
 /**
  * get redirect URL
  * 
  * @param $iProfileId integer - profile ID
  * @return string redirect URL
  */
 function _getRedirectUrl($iProfileId, $isExistingProfile = false)
 {
     if ($isExistingProfile) {
         return 'index' == $this->_oConfig->sRedirectPage ? BX_DOL_URL_ROOT : BX_DOL_URL_ROOT . 'member.php';
     }
     $sRedirectUrl = $this->_oConfig->sDefaultRedirectUrl;
     switch ($this->_oConfig->sRedirectPage) {
         case 'join':
         case 'pedit':
             $sRedirectUrl = BX_DOL_URL_ROOT . 'pedit.php?ID=' . (int) $iProfileId;
             break;
         case 'avatar':
             if (BxDolInstallerUtils::isModuleInstalled('avatar') && BxDolService::call('avatar', 'join', array($iProfileId, '_Join complete'))) {
                 exit;
             }
             break;
         case 'index':
             $sRedirectUrl = BX_DOL_URL_ROOT;
             break;
         case 'member':
         default:
             $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php';
             break;
     }
     return $sRedirectUrl;
 }
Exemple #17
0
<?php

bx_import('BxDolInstallerUtils');
$oInstallerUtils = new BxDolInstallerUtils();
$oInstallerUtils->updateSystemExceptions();
return true;
 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - some profile's information; 
  *          @see : $this -> aFacebookProfileFields;
  *          
  * @param  : $sAlternativeName (string) - profiles alternative nickname; 
  * @return : (integer) profile's id; 
  */
 function _createProfile($aProfileInfo, $sAlternativeName = '')
 {
     $sCountry = '';
     $sCity = '';
     $bAvatarRedirect = false;
     $sMemberAvatar = !empty($aProfileInfo['picture']) ? $aProfileInfo['picture'] : '';
     //-- join by invite only --//
     if (getParam('reg_by_inv_only') == 'on' && (!isset($_COOKIE['idFriend']) || getID($_COOKIE['idFriend']) == 0)) {
         $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox(_t('_registration by invitation only')));
         exit;
     }
     //--
     // process the date of birth;
     if (isset($aProfileInfo['birthday'])) {
         $aProfileInfo['birthday'] = isset($aProfileInfo['birthday']) ? date('Y-m-d', strtotime($aProfileInfo['birthday'])) : '';
     }
     // generate new password for profile;
     $sNewPassword = genRndPwd();
     $sPasswordSalt = genRndSalt();
     $aProfileInfo['password'] = encryptUserPwd($sNewPassword, $sPasswordSalt);
     //-- define user's country and city --//
     $aLocation = array();
     if (isset($aProfileInfo['location']['name'])) {
         $aLocation = $aProfileInfo['location']['name'];
     } else {
         if (isset($aProfileInfo['hometown']['name'])) {
             $aLocation = $aProfileInfo['hometown']['name'];
         }
     }
     if ($aLocation) {
         $aCountryInfo = explode(',', $aLocation);
         $sCountry = $this->_oDb->getCountryCode(trim($aCountryInfo[1]));
         $sCity = trim($aCountryInfo[0]);
         //set default country name, especially for American brothers
         if ($sCity && !$sCountry) {
             $sCountry = $this->_oConfig->sDefaultCountryCode;
         }
     }
     //--
     //try define the user's email
     $sEmail = !empty($aProfileInfo['email']) ? $aProfileInfo['email'] : $aProfileInfo['proxied_email'];
     //check email
     if ($this->_oDb->isEmailExisting($sEmail)) {
         $this->_oTemplate->getPage(_t('_bx_facebook'), MsgBox(_t('_bx_facebook_error_email')));
         exit;
     }
     //-- fill array with all needed values --//
     $aProfileFields = array('NickName' => $aProfileInfo['nick_name'] . $sAlternativeName, 'Email' => $sEmail, 'Sex' => isset($aProfileInfo['gender']) ? $aProfileInfo['gender'] : '', 'DateOfBirth' => $aProfileInfo['birthday'], 'Password' => $aProfileInfo['password'], 'FirstName' => isset($aProfileInfo['first_name']) ? $aProfileInfo['first_name'] : '', 'LastName' => isset($aProfileInfo['last_name']) ? $aProfileInfo['last_name'] : '', 'DescriptionMe' => isset($aProfileInfo['bio']) ? $aProfileInfo['bio'] : '', 'Interests' => isset($aProfileInfo['interests']) ? $aProfileInfo['interests'] : '', 'Religion' => isset($aProfileInfo['religion']) ? $aProfileInfo['religion'] : '', 'Country' => $sCountry, 'City' => $sCity);
     //--
     // check fields existence;
     foreach ($aProfileFields as $sKey => $mValue) {
         if (!$this->_oDb->isFieldExist($sKey)) {
             // (field not existence) remove from array;
             unset($aProfileFields[$sKey]);
         }
     }
     //-- add some system values --//
     $aProfileFields['Role'] = BX_DOL_ROLE_MEMBER;
     $aProfileFields['DateReg'] = date('Y-m-d H:i:s');
     // set current date;
     $aProfileFields['Salt'] = $sPasswordSalt;
     //--
     //check redirect page
     switch ($this->_oConfig->sRedirectPage) {
         case 'join':
             return $this->_getJoinPage($aProfileFields, $aProfileInfo['id']);
         case 'pedit':
             $sRedirectUrl = BX_DOL_URL_ROOT . 'pedit.php';
             break;
         case 'avatar':
             $bAvatarRedirect = true;
             break;
         case 'index':
             $sRedirectUrl = BX_DOL_URL_ROOT;
             break;
         case 'member':
         default:
             $sRedirectUrl = BX_DOL_URL_ROOT . 'member.php';
             break;
     }
     // create new profile;
     $iProfileId = $this->_oDb->createProfile($aProfileFields);
     $oProfileFields = new BxDolProfilesController();
     //remember FB uid for created member
     $this->_oDb->saveFbUid($iProfileId, $aProfileInfo['id']);
     // check profile status;
     if (getParam('autoApproval_ifNoConfEmail') == 'on') {
         if (getParam('autoApproval_ifJoin') == 'on') {
             $sProfileStatus = 'Active';
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendActivationMail($iProfileId);
             }
         } else {
             $sProfileStatus = 'Approval';
             if (!empty($aProfileInfo['email'])) {
                 $oProfileFields->sendApprovalMail($iProfileId);
             }
         }
     } else {
         if (!empty($aProfileInfo['email'])) {
             $oProfileFields->sendConfMail($iProfileId);
             $sProfileStatus = 'Unconfirmed';
         } else {
             if (getParam('autoApproval_ifJoin') == 'on') {
                 $sProfileStatus = 'Active';
             } else {
                 $sProfileStatus = 'Approval';
             }
         }
     }
     // update profile's status;
     $this->_oDb->updateProfileStatus($iProfileId, $sProfileStatus);
     $oProfileFields->createProfileCache($iProfileId);
     if (!empty($aProfileInfo['email'])) {
         //-- send email notification --//
         $oEmailTemplate = new BxDolEmailTemplates();
         $aTemplate = $oEmailTemplate->getTemplate('t_fb_connect_password_generated');
         $aNewProfileInfo = getProfileInfo($iProfileId);
         $aPlus = array('NickName' => $aNewProfileInfo['NickName'], 'NewPassword' => $sNewPassword);
         sendMail($aNewProfileInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
     }
     //--
     // create system event
     $oZ = new BxDolAlerts('profile', 'join', $iProfileId);
     $oZ->alert();
     //Auto-friend members if they are already friends on Facebook
     $this->_makeFriends($iProfileId);
     // set logged
     $aProfileInfo = getProfileInfo($iProfileId);
     $this->setLogged($iProfileId, $aProfileInfo['Password'], '', false);
     //redirect to avatar page
     if ($bAvatarRedirect) {
         if (BxDolInstallerUtils::isModuleInstalled('avatar')) {
             // check profile's logo;
             if ($sMemberAvatar) {
                 BxDolService::call('avatar', 'set_image_for_cropping', array($iProfileId, $sMemberAvatar));
             }
             if (BxDolService::call('avatar', 'join', array($iProfileId, '_Join complete'))) {
                 exit;
             }
         } else {
             header('location:' . $this->_oConfig->sDefaultRedirectUrl);
             exit;
         }
     } else {
         //assign avatar
         if ($sMemberAvatar) {
             $this->_assignAvatar($sMemberAvatar);
         }
         //redirect to other page
         header('location:' . $sRedirectUrl);
         exit;
     }
 }