function userSave( $option, $uid ) { global $_CB_framework, $_CB_database, $_POST, $_PLUGINS; // simple spoof check security cbSpoofCheck( 'userEdit' ); // check rights to access: if ( $uid == null ) { echo _UE_USER_PROFILE_NOT; return; } $msg = cbCheckIfUserCanPerformUserTask( $uid, 'allowModeratorsUserEdit' ); if ( $msg ) { echo $msg; return; } $_PLUGINS->loadPluginGroup('user'); // Get current user state: $userComplete = new moscomprofilerUser( $_CB_database ); if ( ! $userComplete->load( (int) $uid ) ) { echo _UE_USER_PROFILE_NOT; return; } // Update lastupdatedate of profile by user: if ( $_CB_framework->myId() == $uid ) { $userComplete->lastupdatedate = $_CB_framework->dateDbOfNow(); } // Store new user state: $saveResult = $userComplete->saveSafely( $_POST, $_CB_framework->getUi(), 'edit' ); if ( ! $saveResult ) { $regErrorMSG = $userComplete->getError(); echo "<script type=\"text/javascript\">alert('" . str_replace( '\\\\n', '\\n', addslashes( strip_tags( str_replace( '<br />', '\n', $regErrorMSG ) ) ) ) . "'); </script>\n"; // userEdit( $option, $uid, _UE_UPDATE, $userComplete->getError() ); HTML_comprofiler::userEdit( $userComplete, $option, _UE_UPDATE, $regErrorMSG ); return; } cbRedirectToProfile( $uid, _USER_DETAILS_SAVE ); }
function userSave($option, $uid) { global $_CB_framework, $_POST, $_PLUGINS; // simple spoof check security cbSpoofCheck('userEdit'); // check rights to access: if ($uid == null) { $msg = CBTxt::Th('UE_USER_PROFILE_NOT', 'Your profile could not be updated.'); } else { $msg = cbCheckIfUserCanPerformUserTask($uid, 'allowModeratorsUserEdit'); } $_PLUGINS->loadPluginGroup('user'); $_PLUGINS->trigger('onBeforeUserProfileSaveRequest', array($uid, &$msg, 1)); if ($msg) { $_CB_framework->enqueueMessage($msg, 'error'); return; } // Get current user state: $userComplete = new UserTable(); if (!$userComplete->load((int) $uid)) { $_CB_framework->enqueueMessage(CBTxt::Th('UE_USER_PROFILE_NOT', 'Your profile could not be updated.'), 'error'); return; } // Update lastupdatedate of profile by user: if ($_CB_framework->myId() == $uid) { $userComplete->lastupdatedate = $_CB_framework->dateDbOfNow(); } // Store new user state: $saveResult = $userComplete->saveSafely($_POST, $_CB_framework->getUi(), 'edit'); if (!$saveResult) { $regErrorMSG = $userComplete->getError(); $_PLUGINS->trigger('onAfterUserProfileSaveFailed', array(&$userComplete, &$regErrorMSG, 1)); HTML_comprofiler::userEdit($userComplete, $option, CBTxt::T('UE_UPDATE', 'Update'), $regErrorMSG); return; } $_PLUGINS->trigger('onAfterUserProfileSaved', array(&$userComplete, 1)); cbRedirectToProfile($uid, CBTxt::Th('USER_DETAILS_SAVE', 'Your settings have been saved.')); }