/** * Добавляет юзера * * @param ModuleUser_EntityUser $oUser Объект пользователя * @return int|bool */ public function Add(ModuleUser_EntityUser $oUser) { $sql = "INSERT INTO " . Config::Get('db.table.user') . "\n (user_login,\n user_password,\n user_mail,\n user_date_register,\n user_ip_register,\n user_activate,\n user_activate_key\n )\n VALUES(?, ?, ?, ?, ?, ?, ?)\n "; if ($iId = $this->oDb->query($sql, $oUser->getLogin(), $oUser->getPassword(), $oUser->getMail(), $oUser->getDateRegister(), $oUser->getIpRegister(), $oUser->getActivate(), $oUser->getActivateKey())) { return $iId; } return false; }
/** * Добавляет юзера * * @param ModuleUser_EntityUser $oUser Объект пользователя * * @return int|bool */ public function Add(ModuleUser_EntityUser $oUser) { $sql = "INSERT INTO ?_user\n\t\t\t(user_login,\n\t\t\tuser_password,\n\t\t\tuser_mail,\n\t\t\tuser_date_register,\n\t\t\tuser_ip_register,\n\t\t\tuser_activate,\n\t\t\tuser_activate_key\n\t\t\t)\n\t\t\tVALUES(?, ?, ?, ?, ?, ?, ?)\n\t\t"; $nUserId = $this->oDb->query($sql, $oUser->getLogin(), $oUser->getPassword(), $oUser->getMail(), $oUser->getDateRegister(), $oUser->getIpRegister(), $oUser->getActivate(), $oUser->getActivationKey()); return $nUserId ? $nUserId : false; }
/** * @param string $sParam * @param mixed $xValue * @param ModuleUser_EntityUser $oUser * @param array $aParams * * @return bool */ public function CheckRuleActionParam($sParam, $xValue, $oUser, $aParams = array()) { if ($sParam == 'registration_time') { if (time() - strtotime($oUser->getDateRegister()) >= $xValue) { return TRUE; } else { return FALSE; } } if ($sParam == 'rating') { if ($oUser->getRating() >= $xValue) { return TRUE; } else { return FALSE; } } if ($sParam == 'skill') { if ($oUser->getSkill() >= $xValue) { return TRUE; } else { return FALSE; } } if ($sParam == 'count_comment') { if (E::ModuleComment()->GetCountCommentsByUserId($oUser->getId(), 'topic') >= $xValue) { return TRUE; } else { return FALSE; } } if ($sParam == 'count_topic') { if (E::ModuleTopic()->GetCountTopicsPersonalByUser($oUser->getId(), 1) >= $xValue) { return TRUE; } else { return FALSE; } } if ($sParam == 'rating_sum_topic') { if (is_array($xValue) && count($xValue) > 1) { $iRating = $xValue[0]; $iTime = $xValue[1]; } else { $iRating = $xValue; $iTime = 60 * 60 * 24 * 14; } if ($this->GetSumRatingTopic($oUser->getId(), date('Y-m-d H:i:s', time() - $iTime)) >= $iRating) { return TRUE; } else { return FALSE; } } if ($sParam == 'rating_sum_comment') { if (is_array($xValue) && count($xValue) > 1) { $iRating = $xValue[0]; $iTime = $xValue[1]; } else { $iRating = $xValue; $iTime = 60 * 60 * 24 * 7; } if ($this->GetSumRatingComment($oUser->getId(), date('Y-m-d H:i:s', time() - $iTime)) >= $iRating) { return TRUE; } else { return FALSE; } } return FALSE; }