本文整理汇总了C++中CUser::GetUserID方法的典型用法代码示例。如果您正苦于以下问题:C++ CUser::GetUserID方法的具体用法?C++ CUser::GetUserID怎么用?C++ CUser::GetUserID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetUserID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRecentApprovedArticles
bool CUserPageBuilder::CreateRecentApprovedArticles(CUser& PageOwner, CArticleList& RecentApprovals)
{
bool bSuccess = false;
int iUserID = 0;
// if we have a page owner and can get their ID then create the most recent
// article list for them
bSuccess = !PageOwner.IsEmpty() &&
PageOwner.GetUserID(&iUserID) &&
RecentApprovals.CreateRecentApprovedArticlesList(iUserID,100);
// return success or failure
return bSuccess;
}
示例2: CreateSubscribedToUsersRecentArticles
bool CUserPageBuilder::CreateSubscribedToUsersRecentArticles(CUser& PageOwner, int iSiteID, CArticleSubscriptionList& SubscribedUsersArticles)
{
bool bSuccess = false;
int iUserID = 0;
// if we have a page owner and can get their ID then create the most recent articles by users they have subscribed to.
bSuccess = !PageOwner.IsEmpty() &&
PageOwner.GetUserID(&iUserID) &&
SubscribedUsersArticles.GetRecentArticles(iUserID, iSiteID);
// return success or failure
return bSuccess;
}
示例3: lock
VOID CUserMgr::ChangePwd(UINT32 dwUserID, TCHAR* pszPasswd)
{
CSDMutexLock lock(m_oMutex);
CSessionID2UserMapItr itr;
for(itr = m_mapPlayerID2User.begin(); itr != m_mapPlayerID2User.end(); itr++)
{
CUser* poUser = itr->second;
if (poUser->GetUserID() == dwUserID)
{
poUser->ChangePwd(pszPasswd);
}
}
}
示例4: CreateRecentPosts
bool CUserPageBuilder::CreateRecentPosts(CUser& PageOwner, CUser* pViewer, CPostList& RecentPosts)
{
bool bSuccess = false;
int iUserID = 0;
// if we have a page owner and can get their ID then create the most recent
// post list for them
bSuccess = !PageOwner.IsEmpty() &&
PageOwner.GetUserID(&iUserID) &&
RecentPosts.CreateRecentPostsList(pViewer, iUserID,100);
// return created object or NULL for failure
return bSuccess;
}
示例5: AddClubLinksXml
bool CVotePageBuilder::AddClubLinksXml()
{
CLink Link(m_InputContext);
bool bShowPrivateClubLinks = false;
CUser* pUser = m_InputContext.GetCurrentUser();
if (pUser != NULL)
{
CClub club(m_InputContext);
bShowPrivateClubLinks = pUser->GetIsEditor()
|| club.IsUserInTeamMembersOfClub(pUser->GetUserID(), m_iObjectID);
}
Link.GetClubLinks(m_iObjectID, NULL, bShowPrivateClubLinks);
return m_pPage->AddInside("VOTING-PAGE", &Link);
}
示例6: lock
void CUserMgr::ReleaseUser(UINT32 dwUserID)
{
CSDMutexLock lock(m_oMutex);
CSessionID2UserMapItr itr;
for(itr = m_mapPlayerID2User.begin(); itr != m_mapPlayerID2User.end();)
{
CUser* poUser = itr->second;
if(poUser->GetUserID() == dwUserID)
{
m_oUserPool.Free(poUser);
m_mapPlayerID2User.erase(itr++);
}
else
{
itr++;
}
}
}
示例7: RemoveUserVote
/*********************************************************************************
bool CVotePageBuilder::RemoveUserVote()
Author: Mark Howitt
Created: 06/08/2004
Inputs: -
Outputs: -
Returns: true if ok, false if not.
Purpose: Removes a users vote from a given vote.
*********************************************************************************/
bool CVotePageBuilder::RemoveUserVote()
{
if (m_InputContext.GetAllowRemoveVote() != 1)
{
m_pPage->SetError("Votes cannot be removed for this site");
return false;
}
// Set the action flag
m_pPage->AddInside("VOTING-PAGE","<ACTION>removeuservote</ACTION>");
// Get the basic info
CUser* pUser = m_InputContext.GetCurrentUser();
if (pUser == NULL)
{
// We can't do anything if we're not logged in!
m_pPage->SetError("UserNotLoggedIn");
return false;
}
// Get the voteid from the url
int iVoteID = m_InputContext.GetParamInt("voteid");
int iUserID = m_InputContext.GetParamInt("userid");
// Check to see if the user is an editor or not
if ( ( pUser->GetUserID() != iUserID ) && !pUser->GetIsEditor() && !pUser->GetIsSuperuser() )
{
// We can't do anything if we're not an editor!
m_pPage->SetError("UserNotAuthorised");
return false;
}
// Now revome the vote for the user in the given vote.
if (!m_CurrentVote.RemoveUsersVote(iVoteID,iUserID))
{
m_pPage->SetError(m_CurrentVote.GetLastErrorMessage());
return false;
}
// Now insert the vote XML, and return the verdict!
return m_pPage->AddInside("VOTING-PAGE",&m_CurrentVote);
}
示例8: Vote
bool CPollContentRating::Vote()
{
// Create with VOTING-PAGE element as root
CTDVString sXML;
sXML << "<" << GetRootElement() << "></" << GetRootElement() << ">";
if(!CreateFromXMLText(sXML, 0, true))
{
TDVASSERT(false, "CPollContentRating::Vote() CreateFromXMLText failed");
return false;
}
// Get redirect URL
CTDVString sRedirectURL;
if(!m_InputContext.GetParamString("s_redirectto",sRedirectURL)
|| sRedirectURL.IsEmpty())
{
// Skin must set s_redirectto for content rating polls
TDVASSERT(false, "CPollContentRating::Vote() 's_redirectto' parameter not found.");
if(!AddErrorElement(GetRootElement(), ERRORCODE_BADPARAMS, "'s_redirectto' not set by skin"))
{
TDVASSERT(false, "CPollContentRating::Vote() AddErrorElement failed");
return false;
}
return true;
}
// Initialise the UserID
int nUserID = 0;
CTDVString sBBCUID;
// Get User
CUser *pUser = m_InputContext.GetCurrentUser();
// Check PollID
int nPollID = GetPollID();
if(nPollID < 1)
{
TDVASSERT(false, "CPollContentRating::Vote() Invalid Poll ID");
AddPollErrorCodeToURL(sRedirectURL, ERRORCODE_BADPOLLID, "Invalid PollID");
SetRedirectURL(sRedirectURL);
return false;
}
if (!m_bAllowAnonymousRating) //Normal way needs to be logged in to vote
{
if(!pUser) // Not logged in?
{
AddPollErrorCodeToURL(sRedirectURL, ERRORCODE_NEEDUSER, "User not logged in");
SetRedirectURL(sRedirectURL);
return true;
}
if(!pUser->GetUserID(&nUserID))
{
TDVASSERT(false, "CPollContentRating::Vote() pUser->GetUserID failed");
AddPollErrorCodeToURL(sRedirectURL, ERRORCODE_UNSPECIFIED, "CPollContentRating::Vote() pUser->GetUserID failed");
SetRedirectURL(sRedirectURL);
return false;
}
}
else //Anonymous rating
{
// Get the UID For the current user.
m_InputContext.GetBBCUIDFromCookie(sBBCUID);
if(pUser) // If logged in get the user id?
{
if(!pUser->GetUserID(&nUserID))
{
TDVASSERT(false, "CPollAnonymousContentRating::Vote() Anonymous Rating pUser->GetUserID failed");
AddPollErrorCodeToURL(sRedirectURL, ERRORCODE_UNSPECIFIED, "CPollContentRating::Vote() Anonymous Rating pUser->GetUserID failed");
SetRedirectURL(sRedirectURL);
return false;
}
}
}
// Don't allow page author to vote
CStoredProcedure SP;
m_InputContext.InitialiseStoredProcedureObject(&SP);
// Get article id
std::vector<int> vecArticleIDs;
if(!SP.PollGetItemIDs(vecArticleIDs, GetPollID(), (int)CPoll::ITEMTYPE_ARTICLE))
{
TDVASSERT(false, "CPollContentRating::Vote() SP.PollGetItemIDs failed");
AddPollErrorCodeToURL(sRedirectURL, ERRORCODE_UNSPECIFIED, "CPollContentRating::Vote() SP.PollGetItemIDs failed");
SetRedirectURL(sRedirectURL);
//.........这里部分代码省略.........
示例9: CreateUserInterface
bool CUserPageBuilder::CreateUserInterface(CUser* pViewer, CUser& Owner, CGuideEntry& Masthead, CPageUI &Interface)
{
// TODO: will need to take into account viewing users preferences at some
// point if they are allowed to switch off some buttons
bool bSuccess = Interface.Initialise(pViewer);
// I've guessed at what the URLs might look like => should the url
// parameters be filled in at this time as well?
if (bSuccess)
{
bool bDiscuss = true;
bool bEdit = false;
bool bViewerActive = false;
int iViewerID = 0;
int iOwnerID = 0;
int iForumID = 0;
// get the ID of the forum if we have been given a masthead article and
// it actually has a forum (which it should)
if (!Masthead.IsEmpty())
{
iForumID = Masthead.GetForumID();
}
if (iForumID == 0)
{
bDiscuss = false;
}
// check if we have a registered viewer and also if this happens to be their
// own home page and set the appropriate button flags
if (pViewer != NULL && pViewer->GetActive(&bViewerActive) && bViewerActive)
{
if (pViewer->GetUserID(&iViewerID) &&
!Owner.IsEmpty() &&
Owner.GetUserID(&iOwnerID) &&
iViewerID == iOwnerID &&
iViewerID != 0)
{
// also if this is their own home page they have
// an edit page button
bEdit = true;
}
}
// TODO: forum ID seems to not work???
CTDVString sDiscuss = "AddThread?forum=";
sDiscuss << iForumID << "&article=";
int ih2g2ID = 0;
CTDVString sEditLink = "";
// get masthead ID if there is one
if (!Owner.IsEmpty())
{
ih2g2ID = Owner.GetMasthead();
}
else if (!Masthead.IsEmpty())
{
ih2g2ID = Masthead.GetH2G2ID();
}
sEditLink << "/UserEdit" << ih2g2ID << "?Masthead=1";
sDiscuss << ih2g2ID;
// now set the apppropriate buttons in the UI object
// currently you only get the eidt page button if this is actually your homepage, i.e. you
// wont get it if you have editor status
bSuccess = Interface.SetDiscussVisibility(bDiscuss, sDiscuss) &&
Interface.SetEditPageVisibility(bEdit, sEditLink);
// TODO: may wish to fail in this case, but just log the error currently
TDVASSERT(bSuccess, "Couldn't set a visibility option in CUserPageBuilder::CreateUserInterface()");
}
// if something went wrong then delete object and return NULL
// return object or NULL for failure
return bSuccess;
}
示例10: AddClubsUserBelongsTo
bool CUserPageBuilder::AddClubsUserBelongsTo(CWholePage* pPage,int iUserID)
{
CStoredProcedure SP;
m_InputContext.InitialiseStoredProcedureObject(&SP);
if (!SP.GetAllClubsThatUserBelongsTo(iUserID))
{
TDVASSERT(false, "No stored procedure created");
return false;
}
CTDVString sXML, sClubName, sDateCreated;
int iClubID = 0;
sXML << "<USERMYCLUBS>";
sXML << "<CLUBSSUMMARY>";
while (!SP.IsEOF())
{
int iOwner = SP.GetIntField("Owner");
int iHidden = SP.GetIntField("Hidden");
SP.GetField("Name",sClubName);
SP.GetField("DateCreated",sDateCreated);
iClubID = SP.GetIntField("ClubID");
// if club is hidden, hide if the user is not allowed to see it
if(iHidden > 0)
{
bool bHide = true;
CUser* pViewingUser = m_InputContext.GetCurrentUser();
if (pViewingUser != NULL)
{
CClub Club(m_InputContext);
Club.InitialiseViaClubID(iClubID);
bHide = !Club.CanUserEditClub(pViewingUser->GetUserID(),iClubID) && !pViewingUser->HasSpecialEditPermissions(Club.GetArticleID());
}
if (bHide)
{
sClubName = "hidden";
}
}
CTDVDateTime dDateCreated = SP.GetDateField("DateCreated");
CTDVString sDate;
dDateCreated.GetAsXML(sDate);
sXML << "<CLUB ID='" << iClubID << "'>";
sXML << "<NAME>" << sClubName << "</NAME>";
sXML << "<MEMBERSHIPSTATUS>";
if (SP.GetIntField("Owner") == 1)
{
sXML << "Owner";
}
else
{
sXML << "Supporter";
}
sXML << "</MEMBERSHIPSTATUS>";
sXML << "<DATECREATED>" << sDate << "</DATECREATED>";
sXML << "<MEMBERSHIPCOUNT>" << SP.GetIntField("MembershipCount") << "</MEMBERSHIPCOUNT>";
sXML << "</CLUB>";
SP.MoveNext();
}
sXML << "</CLUBSSUMMARY>";
sXML << "</USERMYCLUBS>";
pPage->AddInside("H2G2",sXML);
return true;
}
示例11: Build
bool CModeratePostsBuilder::Build(CWholePage* pWholePage)
{
InitPage(pWholePage, "POST-MODERATION", true);
bool bSuccess = true;
// do an error page if not an editor or moderator.
CUser* pViewer = m_InputContext.GetCurrentUser();
if (pViewer == NULL || !(pViewer->GetIsEditor() || pViewer->GetIsModerator()) )
{
bSuccess = bSuccess && pWholePage->SetPageType("ERROR");
bSuccess = bSuccess && pWholePage->AddInside("H2G2", "<ERROR TYPE='NOT-EDITOR'>You cannot perform moderation unless you are logged in as an Editor or Moderator.</ERROR>");
return true;
}
//Process Actions.
if ( ! Process(pWholePage,pViewer) )
{
SetDNALastError("CModeratePostsBuilder::Build","Build","Unable to process");
pWholePage->AddInside("H2G2",GetLastErrorAsXMLString());
}
//Handle s_returnto.
if ( bSuccess && CheckAndUseRedirectIfGiven(pWholePage) )
return bSuccess;
//Handle 'Oldstyle' redirect - necessary to handle multiple submit buttons for the same form.
if ( m_InputContext.ParamExists("Done") )
{
CTDVString sRedirect = "Moderate?newstyle=1";
if ( m_InputContext.GetParamInt("fastmod") == 1 )
sRedirect += "&fastmod=1";
return pWholePage->Redirect(sRedirect);
}
//Produce XML for page.
// find out if we are processing referrals or not
bool bReferrals = m_InputContext.GetParamInt("Referrals") == 1;
bool bAlerts = m_InputContext.GetParamInt("Alerts") == 1;
bool bLockedItems = m_InputContext.GetParamInt("Locked") == 1; //Viewing users locked items only.
bool bHeldItems = m_InputContext.GetParamInt("Held") == 1;
int iShow = 10;
if ( m_InputContext.ParamExists("show") )
iShow = m_InputContext.GetParamInt("show");
bool bFastMod = m_InputContext.GetParamInt("fastmod") != 0;
int iModClassId = 0;
if ( m_InputContext.ParamExists("ModClassId") )
iModClassId = m_InputContext.GetParamInt("ModClassId");
//Filter on moderation items for a specific post.
int iPostId = 0;
if ( m_InputContext.ParamExists("PostFilterId") )
iPostId = m_InputContext.GetParamInt("PostFilterId");
//Add Moderation Classes
CModerationClasses modclasses(m_InputContext);
if ( modclasses.GetModerationClasses() )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&modclasses);
else if ( modclasses.ErrorReported() )
bSuccess && bSuccess && pWholePage->AddInside("H2G2",modclasses.GetLastErrorAsXMLString() );
//Add Moderation Failure - Reasons
CModReasons reasons(m_InputContext);
if ( reasons.GetModReasons(iModClassId) )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&reasons);
//Add Refereee List
CRefereeList referees(m_InputContext);
if ( referees.FetchTheList() )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&referees);
//Add Site List
//CTDVString sSiteXML;
//bSuccess = bSuccess && m_InputContext.GetSiteListAsXML(&sSiteXML, 2);
//bSuccess = bSuccess && pWholePage->AddInside("H2G2", sSiteXML);
CBasicSiteList sitelist(m_InputContext);
if ( !sitelist.PopulateList() )
pWholePage->AddInside("H2G2",sitelist.GetLastErrorAsXMLString());
else
bSuccess = bSuccess && pWholePage->AddInside("H2G2",sitelist.GetAsXML2());
//Add User Moderation Statuses
CUserStatuses modstatuses(m_InputContext);
if ( modstatuses.GetUserStatuses() )
pWholePage->AddInside("H2G2",&modstatuses);
else if ( modstatuses.ErrorReported() )
pWholePage->AddInside("H2G2",modstatuses.GetLastErrorAsXMLString());
//Add Distress Messages
CModerationDistressMessages distressmsgs(m_InputContext);
if ( distressmsgs.GetDistressMessages(iModClassId) )
pWholePage->AddInside("H2G2",&distressmsgs);
else
pWholePage->AddInside("H2G2",distressmsgs.GetLastErrorAsXMLString() );
CModeratePosts moderate(m_InputContext);
if ( !moderate.GetPosts( pViewer->GetUserID(), bAlerts, bReferrals, bLockedItems, bHeldItems, iModClassId, iPostId, iShow, bFastMod ) )
//.........这里部分代码省略.........
示例12: RemoveThreadFromForum
bool CReviewSubmissionForum::RemoveThreadFromForum(CUser& mViewer,int iReviewForumID,int iH2G2ID, int* iThreadID,int* iForumID,bool *pbSuccessful,bool bHasPermission /*false*/)
{
if (iReviewForumID <= 0 || iH2G2ID <= 0)
{
TDVASSERT(false,"Bad ReviewForum ID in CReviewSubmissionForum::RemoveThreadFromForum");
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","RMBADID","Bad arguments for this action");
}
//Initialise the article
CGuideEntry mGuideEntry(m_InputContext);
if (!mGuideEntry.Initialise(iH2G2ID,0, false,true,false,false,false))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","NOARTICLE","Failed to Get Article details");
}
//create a storedprocedure
CStoredProcedure mSP;
if (!m_InputContext.InitialiseStoredProcedureObject(&mSP))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","DBERROR","A database error has occured");
}
//check the article is in review
if (!mSP.FetchReviewForumMemberDetails(iH2G2ID))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","BADH2G2ID","The article is not in a review forum");
}
int iSubmitterID = mSP.GetIntField("SubmitterID");
int iPostID = mSP.GetIntField("PostID");
*iThreadID = mSP.GetIntField("ThreadID");
*iForumID = mSP.GetIntField("ForumID");
int iActualReviewForumID = mSP.GetIntField("ReviewForumID");
//make sure that we are in the right review forum for the article
if (iReviewForumID != iActualReviewForumID)
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","BADRFID","The article is in a different review forum");
}
//Permission has been verified by the caller so don't check
if (!bHasPermission)
{
//ok if you're an editor
if (!mViewer.GetIsEditor())
{
//ok if you are the author
if (!(mGuideEntry.GetEditorID() == mViewer.GetUserID()))
{
//ok if you are the submitter
if (!(mViewer.GetUserID() == iSubmitterID))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","BADUSER","You do not have permission to move the thread");
}
}
}
}
//initialise the review forum
CReviewForum mReviewForum(m_InputContext);
if (!mReviewForum.InitialiseViaReviewForumID(iReviewForumID))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","NOREVIEW","Invalid Review Forum ID");
}
//move the thread
mSP.MoveThread(*iThreadID,mGuideEntry.GetForumID());
if (!mSP.GetBoolField("Success"))
{
*pbSuccessful = false;
return GracefulError("SUBMIT-REVIEW-FORUM","NOMOVE","Failed to move thread to article");
}
if (!mSP.RemoveArticleFromPeerReview(iH2G2ID))
{
mSP.UndoThreadMove(*iThreadID,0);
//.........这里部分代码省略.........
示例13: Build
//.........这里部分代码省略.........
}
// add recent comments if they exist, this may add an empty
// COMMENTS-LIST tag if the user exists but has never posted
if (bSuccess && bGotRecentComments)
{
bSuccess = pWholePage->AddInside("RECENT-COMMENTS", &RecentComments);
}
if (bSuccess && bGotSubscribedToUsersRecentArticles)
{
bSuccess = pWholePage->AddInside("RECENT-SUBSCRIBEDARTICLES", &SubscribedUsersArticles);
}
CTDVString sSiteXML;
m_InputContext.GetSiteListAsXML(&sSiteXML);
bSuccess = bSuccess && pWholePage->AddInside("H2G2", sSiteXML);
if (bGotMasthead && (m_InputContext.IncludeWatchInfoInPersonalSpace() || (m_InputContext.GetParamInt("i_wi") == 1)))
{
CWatchList WatchList(m_InputContext);
bSuccess = bSuccess && WatchList.Initialise(iUserID);
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&WatchList);
int iSiteID = m_InputContext.GetSiteID();
bSuccess = bSuccess && WatchList.WatchingUsers(iUserID, iSiteID);
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&WatchList);
}
CWhosOnlineObject Online(m_InputContext);
bSuccess = bSuccess && Online.Initialise(NULL, 1, true);
bSuccess = bSuccess && pWholePage->AddInside("H2G2", &Online);
if (bGotMasthead && (m_InputContext.IncludeClubsInPersonalSpace() || (m_InputContext.GetParamInt("i_c") == 1)))
{
if (pViewer != NULL && pViewer->GetUserID() == iUserID)
{
CClub Club(m_InputContext);
Club.GetUserActionList(iUserID, 0, 20);
pWholePage->AddInside("H2G2", &Club);
}
// Now add all the clubs the user belongs to
CCurrentClubs Clubs(m_InputContext);
if (bSuccess && Clubs.CreateList(iUserID,true))
{
bSuccess = pWholePage->AddInside("H2G2",&Clubs);
}
}
if (bGotMasthead && bSuccess && (m_InputContext.IncludePrivateForumsInPersonalSpace() || (m_InputContext.GetParamInt("i_pf") == 1)))
{
pWholePage->AddInside("H2G2", "<PRIVATEFORUM/>");
CForum Forum(m_InputContext);
int iPrivateForum = 0;
if (bGotOwner)
{
Owner.GetPrivateForum(&iPrivateForum);
}
Forum.GetThreadList(pViewer, iPrivateForum, 10,0);
pWholePage->AddInside("PRIVATEFORUM", &Forum);
// Now check to see if the user has alerts set for their private forum
if (bGotOwner)
{
CEmailAlertList Alert(m_InputContext);
Alert.GetUserEMailAlertSubscriptionForForumAndThreads(iUserID,iPrivateForum);
pWholePage->AddInside("PRIVATEFORUM", &Alert);
示例14: Build
bool CEditRecentPostBuilder::Build(CWholePage* pPage)
{
bool bSuccess = InitPage(pPage, "EDIT-RECENT-POST",false);
CUser* pViewer = m_InputContext.GetCurrentUser();
if ( !pViewer )
{
SetDNALastError("EditRecentPostBuilder", "NotLoggedIn", "User not logged in.");
pPage->AddInside("H2G2", GetLastErrorAsXMLString());
return true;
}
// Check to see if the site is closed
bool bSiteClosed = false;
if (!m_InputContext.IsSiteClosed(m_InputContext.GetSiteID(),bSiteClosed))
{
SetDNALastError("CEditRecentPostBuilder::Build", "FailedGettingSiteDetails", "Failed to get site details.");
pPage->AddInside("H2G2", GetLastErrorAsXMLString());
return true;
}
if (bSiteClosed && !pViewer->GetIsEditor())
{
SetDNALastError("CEditRecentPostBuilder::Build", "SiteClosed", "Site is currently closed!!!");
pPage->AddInside("H2G2", GetLastErrorAsXMLString());
return true;
}
// Initialise edit form
//
int iPostID = m_InputContext.GetParamInt("PostID");
if (iPostID <= 0)
{
SetDNALastError("EditRecentPostBuilder", "INPUTPARAMS", "Please supply a valid PostID");
pPage->AddInside("H2G2", GetLastErrorAsXMLString());
return true;
}
// Get the Guide Entry details
//
int iH2G2ID = m_InputContext.GetParamInt("H2G2ID");
bool bIsGuideEntryOwner = false;
m_ForumPostEditForm.SetPostID( iPostID );
if ( !m_ForumPostEditForm.LoadPostDetails() )
{
pPage->AddInside("H2G2",m_ForumPostEditForm.GetLastErrorAsXMLString());
return true;
}
if (iH2G2ID > 0 && m_InputContext.DoesSiteAllowOwnerHiding(m_ForumPostEditForm.GetSiteID()))
{
int iOwnerID = 0;
int iGuideEntryForumID = 0;
//The Owner of the Guide Entry is trying to hide a post
CGuideEntry::GetGuideEntryOwner(m_InputContext, iH2G2ID, iOwnerID, iGuideEntryForumID);
bIsGuideEntryOwner = (pViewer->GetUserID() == iOwnerID && iGuideEntryForumID == m_ForumPostEditForm.GetForumID());
}
else
{
// Check user has permissions
if (!m_ForumPostEditForm.CheckUserCanEditRecentPost())
{
SetDNALastError("EditRecentPostBuilder", "CANTEDIT", "Unable to edit post - Invalid permissions/post no longer editable.");
pPage->AddInside("H2G2", GetLastErrorAsXMLString());
return true;
}
}
if (m_InputContext.ParamExists("Update"))
{
CTDVString sSubject, sText;
bSuccess = bSuccess && m_InputContext.GetParamString("Subject", sSubject);
bSuccess = bSuccess && m_InputContext.GetParamString("Text", sText);
// Check content
CForumPostEditForm::PostUpdateError errorType;
if (m_ForumPostEditForm.ValidatePostDetails(sSubject, sText, errorType))
{
// Does it require premoderation?
bool bForceModerateAndHide = false;
if (errorType == CForumPostEditForm::CONTAINSPROFANITIES)
{
bForceModerateAndHide = true;
}
bSuccess = bSuccess && m_ForumPostEditForm.ProcessForumPostUpdate(pViewer,sSubject, sText, NULL, true, bForceModerateAndHide,false);
if (bSuccess)
{
m_ForumPostEditForm.AddStatusMessage("<MESSAGE TYPE='UPDATE-OK'>Post updated successfully</MESSAGE>");
}
}
}
else if ( m_InputContext.ParamExists("Hide") )
{
//Hide the entire thread if user is author
if (m_ForumPostEditForm.GetUserId() == pViewer->GetUserID() || bIsGuideEntryOwner )
{
//.........这里部分代码省略.........
示例15: Build
bool CModerateMediaAssetsBuilder::Build( CWholePage* pWholePage)
{
InitPage(pWholePage, "MEDIAASSET-MODERATION", true);
bool bSuccess = true;
// do an error page if not an editor or moderator
// otherwise proceed with the process recommendation page
CUser* pViewer = m_InputContext.GetCurrentUser();
if (pViewer == NULL || !(pViewer->GetIsEditor() || pViewer->GetIsModerator()))
{
bSuccess = bSuccess && pWholePage->SetPageType("ERROR");
bSuccess = bSuccess && pWholePage->AddInside("H2G2", "<ERROR TYPE='NOT-EDITOR'>You cannot perform moderation unless you are logged in as an Editor or Moderator.</ERROR>");
return true;
}
//Process Actions.
if ( ! Process(pWholePage,pViewer) )
{
SetDNALastError("CModerateMediaAssetsBuilder::Build","Build","Unable to process");
pWholePage->AddInside("H2G2",GetLastErrorAsXMLString());
}
//Produce XML for page.
// find out if we are processing referrals or not
bool bReferrals = m_InputContext.GetParamInt("Referrals") == 1;
bool bAlerts = m_InputContext.GetParamInt("Alerts") == 1;
bool bLockedItems = m_InputContext.GetParamInt("Locked") == 1 && pViewer->GetIsSuperuser();
bool bHeldItems = m_InputContext.GetParamInt("Held") == 1;
int iShow = 10;
if ( m_InputContext.ParamExists("show") )
iShow = m_InputContext.GetParamInt("show");
//bool bFastMod = m_InputContext.GetParamInt("fastmod") != 0;
//Add Moderation Classes
CModerationClasses modclasses(m_InputContext);
if ( modclasses.GetModerationClasses() )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&modclasses);
else if ( modclasses.ErrorReported() )
bSuccess && bSuccess && pWholePage->AddInside("H2G2",modclasses.GetLastErrorAsXMLString() );
//Add Moderation Failure - Reasons
CModReasons reasons(m_InputContext);
if ( reasons.GetModReasons(0) )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&reasons);
//Add Refereee List
CRefereeList referees(m_InputContext);
if ( referees.FetchTheList() )
bSuccess = bSuccess && pWholePage->AddInside("H2G2",&referees);
//Add Site List
CTDVString sSiteXML;
bSuccess = bSuccess && m_InputContext.GetSiteListAsXML(&sSiteXML, 2);
bSuccess = bSuccess && pWholePage->AddInside("H2G2", sSiteXML);
CModerateMediaAssets moderate(m_InputContext);
if ( !moderate.GetAssets( pViewer->GetUserID(), bAlerts, bReferrals, bLockedItems, bHeldItems, iShow ) )
pWholePage->AddInside("H2G2",moderate.GetLastErrorAsXMLString() );
else
pWholePage->AddInside("H2G2",&moderate);
TDVASSERT(bSuccess, "CModerateMediaAssetsBuilder::Build() failed");
return bSuccess;
}