/** * Reload this DleUsers from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved DleUsers object.'); } $this->DeleteCache(); // Reload the Object $objReloaded = DleUsers::Load($this->intUserId); // Update $this's local variables to match $this->strEmail = $objReloaded->strEmail; $this->strPassword = $objReloaded->strPassword; $this->strName = $objReloaded->strName; $this->intNewsNum = $objReloaded->intNewsNum; $this->intCommNum = $objReloaded->intCommNum; $this->intUserGroup = $objReloaded->intUserGroup; $this->strLastdate = $objReloaded->strLastdate; $this->strRegDate = $objReloaded->strRegDate; $this->strBanned = $objReloaded->strBanned; $this->blnAllowMail = $objReloaded->blnAllowMail; $this->strInfo = $objReloaded->strInfo; $this->strSignature = $objReloaded->strSignature; $this->strFoto = $objReloaded->strFoto; $this->strFullname = $objReloaded->strFullname; $this->strLand = $objReloaded->strLand; $this->strIcq = $objReloaded->strIcq; $this->strFavorites = $objReloaded->strFavorites; $this->intPmAll = $objReloaded->intPmAll; $this->intPmUnread = $objReloaded->intPmUnread; $this->strTimeLimit = $objReloaded->strTimeLimit; $this->strXfields = $objReloaded->strXfields; $this->strAllowedIp = $objReloaded->strAllowedIp; $this->strHash = $objReloaded->strHash; $this->strLoggedIp = $objReloaded->strLoggedIp; $this->blnRestricted = $objReloaded->blnRestricted; $this->intRestrictedDays = $objReloaded->intRestrictedDays; $this->strRestrictedDate = $objReloaded->strRestrictedDate; }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': /** * Gets the value for intId (Read-Only PK) * @return integer */ return $this->intId; case 'PostId': /** * Gets the value for intPostId (Not Null) * @return integer */ return $this->intPostId; case 'UserId': /** * Gets the value for intUserId (Not Null) * @return integer */ return $this->intUserId; case 'Date': /** * Gets the value for dttDate (Not Null) * @return QDateTime */ return $this->dttDate; case 'Autor': /** * Gets the value for strAutor (Not Null) * @return string */ return $this->strAutor; case 'Email': /** * Gets the value for strEmail (Not Null) * @return string */ return $this->strEmail; case 'Text': /** * Gets the value for strText (Not Null) * @return string */ return $this->strText; case 'Ip': /** * Gets the value for strIp (Not Null) * @return string */ return $this->strIp; case 'IsRegister': /** * Gets the value for blnIsRegister (Not Null) * @return boolean */ return $this->blnIsRegister; case 'Approve': /** * Gets the value for blnApprove (Not Null) * @return boolean */ return $this->blnApprove; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Post': /** * Gets the value for the DlePost object referenced by intPostId (Not Null) * @return DlePost */ try { if (!$this->objPost && !is_null($this->intPostId)) { $this->objPost = DlePost::Load($this->intPostId); } return $this->objPost; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'User': /** * Gets the value for the DleUsers object referenced by intUserId (Not Null) * @return DleUsers */ try { if (!$this->objUser && !is_null($this->intUserId)) { $this->objUser = DleUsers::Load($this->intUserId); } return $this->objUser; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * @param DlePoll $objDlePoll The DB ORM object to process */ protected function process_object($objDlePoll) { $objWpPollsq = WpPollsq::QuerySingle(QQ::Equal(QQN::WpPollsq()->PollqQuestion, $objDlePoll->Frage), QQ::Clause(QQ::LimitInfo(1))); if (!$objWpPollsq) { $objWpPollsq = new WpPollsq(); $objWpPollsq->PollqQuestion = $objDlePoll->Frage; $objWpPollsq->PollqTimestamp = $objDlePoll->News->Date->Timestamp; $objWpPollsq->PollqTotalvotes = $objDlePoll->Votes; $objWpPollsq->PollqActive = 1; $objWpPollsq->PollqExpiry = ''; $objWpPollsq->PollqMultiple = intval($objDlePoll->Multiple); $objWpPollsq->PollqTotalvoters = $objDlePoll->Votes; $objWpPollsq->Save(); $this->intPollQuestionCount++; } if ($objDlePoll->Answer && strlen($objDlePoll->Answer) && $objDlePoll->Body && strlen($objDlePoll->Body)) { $intA2VArray = array(); $strAnswerVoteArray = explode("|", $objDlePoll->Answer); if ($strAnswerVoteArray) { foreach ($strAnswerVoteArray as $strAnswerVote) { $intA2V = explode(":", $strAnswerVote); if (2 == count($intA2V)) { $intA2VArray[$intA2V[0]] = $intA2V[1]; } } } $strAnswerArray = explode("<br />", $objDlePoll->Body); $intAnswerCounter = 0; if ($strAnswerArray) { foreach ($strAnswerArray as $strAnswer) { $objWpPollsa = WpPollsa::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPollsa()->PollaQid, $objWpPollsq->PollqId), QQ::Equal(QQN::WpPollsa()->PollaAnswers, $strAnswer)), QQ::Clause(QQ::OrderBy(QQN::WpPollsa()->PollaAid), QQ::LimitInfo(1))); if (!$objWpPollsa) { $objWpPollsa = new WpPollsa(); $objWpPollsa->PollaQid = $objWpPollsq->PollqId; $objWpPollsa->PollaAnswers = $strAnswer; $intVotes = 0; if (isset($intA2VArray[$intAnswerCounter])) { $intVotes = $intA2VArray[$intAnswerCounter]; } $objWpPollsa->PollaVotes = $intVotes; $objWpPollsa->Save(); $this->intPollAnswerCount++; } } } } $objDlePollLogArray = DlePollLog::LoadArrayByNewsId($objDlePoll->NewsId); if ($objDlePollLogArray) { foreach ($objDlePollLogArray as $objDlePollLog) { $strPollipUser = ''; $intPollipUserid = 0; $strPollipIp = ''; if (false === strpos($objDlePollLog->Member, '.')) { // The userId saved in the field Member $objDleUsers = DleUsers::Load($objDlePollLog->Member); if ($objDleUsers) { $objWpUsers = $objDleUsers->LoadWpUsers(); if ($objWpUsers) { $strPollipUser = $objWpUsers->UserLogin; $intPollipUserid = $objWpUsers->Id; } } } else { // The IP address is saved in the field Member $strPollipIp = $objDlePollLog->Member; } $objWpPollsip = WpPollsip::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPollsip()->PollipQid, $objWpPollsq->PollqId), QQ::Equal(QQN::WpPollsip()->PollipIp, $strPollipIp), QQ::Equal(QQN::WpPollsip()->PollipUser, $strPollipUser), QQ::Equal(QQN::WpPollsip()->PollipUserid, $intPollipUserid)), QQ::Clause(QQ::OrderBy(QQN::WpPollsip()->PollipId), QQ::LimitInfo(1))); if (!$objWpPollsip) { $objWpPollsip = new WpPollsip(); $objWpPollsip->PollipQid = $objWpPollsq->PollqId; $objWpPollsip->PollipAid = ''; $objWpPollsip->PollipIp = $strPollipIp; $objWpPollsip->PollipUser = $strPollipUser; $objWpPollsip->PollipUserid = $intPollipUserid; $objWpPollsip->PollipHost = ''; $objWpPollsip->PollipTimestamp = '0'; $objWpPollsip->Save(); $this->intPollIpCount++; } } } // Insert the poll into the corresponding WP post $objDlePost = $objDlePoll->News; $objWpPosts = $objDlePost->LoadWpPosts(); $strText = $objWpPosts->PostContent; if (false === strpos($strText, "[poll id=")) { $objWpPosts->PostContent = sprintf('[poll id="%s"] %s', $objWpPollsq->PollqId, $strText); $objWpPosts->Save(); } $this->intPollCount++; }