当前位置: 首页>>代码示例>>PHP>>正文


PHP func_getIp函数代码示例

本文整理汇总了PHP中func_getIp函数的典型用法代码示例。如果您正苦于以下问题:PHP func_getIp函数的具体用法?PHP func_getIp怎么用?PHP func_getIp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了func_getIp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if (is_array($sValue)) {
         return $this->getMessage($this->Lang_Get('validate.captcha.not_valid', null, false), 'msg');
     }
     if ($this->allowEmpty && $this->isEmpty($sValue)) {
         return true;
     }
     $sSecret = Config::Get('module.validate.recaptcha.secret_key');
     $sUrl = "https://www.google.com/recaptcha/api/siteverify?secret={$sSecret}&response={$sValue}";
     if (Config::Get('module.validate.recaptcha.use_ip')) {
         $sUrl .= '&remoteip=' . func_getIp();
     }
     if ($sData = file_get_contents($sUrl)) {
         if ($aData = @json_decode($sData, true)) {
             if (isset($aData['success']) and $aData['success']) {
                 return true;
             }
         } else {
             $this->Logger_Warning('ReCaptcha: error json decode', array('url' => $sUrl));
         }
     } else {
         $aError = error_get_last();
         $this->Logger_Warning('ReCaptcha: ' . ($aError ? $aError['message'] : 'error server request'), array('url' => $sUrl));
     }
     return $this->getMessage($this->Lang_Get('validate.captcha.not_valid', null, false), 'msg');
 }
开发者ID:vgrish,项目名称:livestreet-framework,代码行数:34,代码来源:ValidatorCaptchaRecaptcha.entity.class.php

示例2: beforeSave

 protected function beforeSave()
 {
     if ($bResult = parent::beforeSave()) {
         if ($this->_isNew()) {
             $this->setDateCreate(date("Y-m-d H:i:s"));
             $this->setIp(func_getIp());
         }
     }
     return $bResult;
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:10,代码来源:Vote.entity.class.php

示例3: AddVote

 /**
  * Добавляет голосование
  *
  * @param ModuleVote_EntityVote $oVote	Объект голосования
  * @return bool
  */
 public function AddVote(ModuleVote_EntityVote $oVote)
 {
     if (!$oVote->getIp()) {
         $oVote->setIp(func_getIp());
     }
     if ($this->oMapper->AddVote($oVote)) {
         $this->Cache_Delete("vote_{$oVote->getTargetType()}_{$oVote->getTargetId()}_{$oVote->getVoterId()}");
         $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("vote_update_{$oVote->getTargetType()}_{$oVote->getVoterId()}"));
         return true;
     }
     return false;
 }
开发者ID:olegverstka,项目名称:kprf.dev,代码行数:18,代码来源:Vote.class.php

示例4: AddVote

 public function AddVote(ModuleVote_EntityVote $oVote)
 {
     if (!$oVote->getIp()) {
         $oVote->setIp(func_getIp());
     }
     if ($this->oMapper->AddVote($oVote)) {
         $this->Cache_Delete("vote_{$oVote->getTargetType()}_{$oVote->getTargetId()}_{$oVote->getVoterId()}");
         $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("vote_update_{$oVote->getTargetType()}_{$oVote->getVoterId()}"));
         if (in_array($oVote->getTargetType(), array('topic', 'comment', 'user'))) {
             $oAction = Engine::GetEntity("PluginFeedbacks_ModuleFeedbacks_EntityAction");
             $oAction->setUserIdFrom($oVote->getVoterId());
             $oAction->setId(null);
             $oAction->setAddDatetime(time());
             $oAction->setDestinationObjectId($oVote->getTargetId());
             if ($oVote->getTargetType() == 'topic') {
                 $oTopic = $this->Topic_GetTopicById($oVote->getTargetId());
                 $oAction->setUserIdTo($oTopic->getUserId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteTopic');
                 }
                 if ($oVote->getDirection() < 0) {
                     $oAction->setActionType('VoteDownTopic');
                 }
                 if ($oVote->getDirection() == 0) {
                     $oAction->setActionType('VoteAbstainTopic');
                 }
             }
             if ($oVote->getTargetType() == 'comment') {
                 $oComment = $this->Comment_GetCommentById($oVote->getTargetId());
                 $oAction->setUserIdTo($oComment->getUserId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteComment');
                 } else {
                     $oAction->setActionType('VoteDownComment');
                 }
             }
             if ($oVote->getTargetType() == 'user') {
                 $oAction->setUserIdTo($oVote->getTargetId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteUser');
                 } else {
                     $oAction->setActionType('VoteDownUser');
                 }
             }
             return true;
             $this->PluginFeedbacks_Feedbacks_SaveAction($oAction);
         }
         return true;
     }
     return false;
 }
开发者ID:lunavod,项目名称:bunker_stable,代码行数:51,代码来源:Vote.class.php

示例5: SendTalk

 /**
  * Формирует и отправляет личное сообщение
  *
  * @param string $sTitle
  * @param string $sText
  * @param int | ModuleUser_EntityUser $oUserFrom
  * @param array | int | ModuleUser_EntityUser $aUserTo
  * @param bool $bSendNotify
  */
 public function SendTalk($sTitle, $sText, $oUserFrom, $aUserTo, $bSendNotify = true, $bUseBlacklist = true)
 {
     $iUserIdFrom = $oUserFrom instanceof ModuleUser_EntityUser ? $oUserFrom->getId() : (int) $oUserFrom;
     if (!is_array($aUserTo)) {
         $aUserTo = array($aUserTo);
     }
     $aUserIdTo = array($iUserIdFrom);
     if ($bUseBlacklist) {
         $aUserInBlacklist = $this->GetBlacklistByTargetId($iUserIdFrom);
     }
     foreach ($aUserTo as $oUserTo) {
         $sUserIdTo = $oUserTo instanceof ModuleUser_EntityUser ? $oUserTo->getId() : (int) $oUserTo;
         if (!$bUseBlacklist || !in_array($sUserIdTo, $aUserInBlacklist)) {
             $aUserIdTo[] = $sUserIdTo;
         }
     }
     $aUserIdTo = array_unique($aUserIdTo);
     if (!empty($aUserIdTo)) {
         $oTalk = Engine::GetEntity('Talk');
         $oTalk->setUserId($iUserIdFrom);
         $oTalk->setTitle($sTitle);
         $oTalk->setText($sText);
         $oTalk->setDate(date("Y-m-d H:i:s"));
         $oTalk->setDateLast(date("Y-m-d H:i:s"));
         $oTalk->setUserIp(func_getIp());
         if ($oTalk = $this->AddTalk($oTalk)) {
             foreach ($aUserIdTo as $iUserId) {
                 $oTalkUser = Engine::GetEntity('Talk_TalkUser');
                 $oTalkUser->setTalkId($oTalk->getId());
                 $oTalkUser->setUserId($iUserId);
                 if ($iUserId == $iUserIdFrom) {
                     $oTalkUser->setDateLast(date("Y-m-d H:i:s"));
                 } else {
                     $oTalkUser->setDateLast(null);
                 }
                 $this->AddTalkUser($oTalkUser);
                 if ($bSendNotify) {
                     if ($iUserId != $iUserIdFrom) {
                         $oUserFrom = $this->User_GetUserById($iUserIdFrom);
                         $oUserToMail = $this->User_GetUserById($iUserId);
                         $this->Notify_SendTalkNew($oUserToMail, $oUserFrom, $oTalk);
                     }
                 }
             }
             return $oTalk;
         }
     }
     return false;
 }
开发者ID:lifecom,项目名称:Huddlebuddle,代码行数:58,代码来源:Talk.class.php

示例6: AddWall

 /**
  * Добавление записи на стену
  *
  * @param ModuleWall_EntityWall $oWall
  *
  * @return bool | ModuleWall_EntityWall
  */
 public function AddWall($oWall)
 {
     if (!$oWall->getDateAdd()) {
         $oWall->setDateAdd(date("Y-m-d H:i:s"));
     }
     if (!$oWall->getIp()) {
         $oWall->setIp(func_getIp());
     }
     if ($iId = $this->oMapper->AddWall($oWall)) {
         $oWall->setId($iId);
         /**
          * Обновляем данные у родительской записи
          */
         if ($oPidWall = $oWall->GetPidWall()) {
             $this->UpdatePidWall($oPidWall);
         }
         return $oWall;
     }
     return false;
 }
开发者ID:narush,项目名称:livestreet,代码行数:27,代码来源:Wall.class.php

示例7: GetUserById

 public function GetUserById($nUserId)
 {
     $iCurrentUserId = -1;
     $sql = "SELECT\n                u.*,\n  \t\tIF(ua.user_id IS NULL,0,1) as user_is_administrator,\n                ab.banline, ab.banunlim, ab.bancomment, ab.banactive,\n\t\tINET_ATON('" . func_getIp() . "') as ipn\n            FROM\n                " . Config::Get('db.table.user') . " as u\n            LEFT JOIN " . Config::Get('db.table.user_administrator') . " AS ua ON u.user_id=ua.user_id\n            LEFT JOIN " . Config::Get('db.table.adminban') . " AS ab ON u.user_id=ab.user_id\n            WHERE\n                u.user_id = ? ";
     if ($aRow = @$this->oDb->selectRow($sql, $nUserId)) {
         $aRow['tpoics_count'] = $this->GetCountTopicsByUserId($nUserId);
         $aRow['comments_count'] = $this->GetCountCommentsByUserId($nUserId);
         $sql = "SELECT id FROM " . Config::Get('db.table.adminips') . "\n                WHERE (? BETWEEN ip1 AND ip2) AND (banactive=1) AND (banunlim>0 OR Now()<banline) ";
         if ($nId = $this->oDb->selectCell($sql, $aRow['ipn'])) {
             $aRow['ban_ip'] = $nId;
         } else {
             $aRow['ban_ip'] = 0;
         }
         return new PluginAceadminpanel_ModuleAdmin_EntityUser($aRow);
     }
     return null;
 }
开发者ID:lifecom,项目名称:Huddlebuddle,代码行数:17,代码来源:Admin.mapper.class.php

示例8: SubmitComment

 /**
  * Обработка добавление комментария
  *
  * @return bool
  */
 protected function SubmitComment()
 {
     /**
      * Проверям авторизован ли пользователь
      */
     if (!$this->User_IsAuthorization()) {
         $this->Message_AddErrorSingle($this->Lang_Get('need_authorization'), $this->Lang_Get('error'));
         return;
     }
     /* @var $oImage PluginLsgallery_ModuleImage_EntityImage */
     if (!($oImage = $this->PluginLsgallery_Image_GetImageById(getRequest('cmt_target_id')))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     /* @var $oAlbum PluginLsgallery_ModuleAlbum_EntityAlbum */
     if (!($oAlbum = $this->PluginLsgallery_Album_GetAlbumById($oImage->getAlbumId()))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     if (!$this->ACL_AllowViewAlbumImages($this->oUserCurrent, $oAlbum)) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверяем разрешено ли постить комменты
      */
     if (!$this->ACL_CanPostComment($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_comment_acl'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверяем разрешено ли постить комменты по времени
      */
     if (!$this->ACL_CanPostCommentTime($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_comment_limit'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверяем текст комментария
      */
     $sText = $this->Text_Parser(getRequest('comment_text'));
     if (!func_check($sText, 'text', 2, 10000)) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_comment_add_text_error'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверям на какой коммент отвечаем
      */
     $sParentId = (int) getRequest('reply');
     if (!func_check($sParentId, 'id')) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     $oCommentParent = null;
     if ($sParentId != 0) {
         /**
          * Проверяем существует ли комментарий на который отвечаем
          */
         if (!($oCommentParent = $this->Comment_GetCommentById($sParentId))) {
             $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             return;
         }
         /**
          * Проверяем из одного топика ли новый коммент и тот на который отвечаем
          */
         if ($oCommentParent->getTargetId() != $oImage->getId()) {
             $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             return;
         }
     } else {
         /**
          * Корневой комментарий
          */
         $sParentId = null;
     }
     /**
      * Проверка на дублирующий коммент
      */
     if ($this->Comment_GetCommentUnique($oImage->getId(), 'image', $this->oUserCurrent->getId(), $sParentId, md5($sText))) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_comment_spam'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Создаём коммент
      */
     $oCommentNew = Engine::GetEntity('Comment');
     $oCommentNew->setTargetId($oImage->getId());
     $oCommentNew->setTargetType('image');
     $oCommentNew->setTargetParentId($oImage->getAlbumId());
     $oCommentNew->setUserId($this->oUserCurrent->getId());
     $oCommentNew->setText($sText);
     $oCommentNew->setDate(date("Y-m-d H:i:s"));
     $oCommentNew->setUserIp(func_getIp());
     $oCommentNew->setPid($sParentId);
     $oCommentNew->setTextHash(md5($sText));
//.........这里部分代码省略.........
开发者ID:webnitros,项目名称:ls-plugin_lsgallery,代码行数:101,代码来源:ActionGallery.class.php

示例9: SubmitComment

 /**
  * Обработка добавление комментария к топику
  *	 
  * @return unknown
  */
 protected function SubmitComment()
 {
     /**
      * Проверям авторизован ли пользователь
      */
     if (!$this->User_IsAuthorization()) {
         $this->Message_AddErrorSingle($this->Lang_Get('need_authorization'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверяем разговор
      */
     if (!($oTalk = $this->Talk_GetTalkById(getRequest('cmt_target_id')))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     if (!($oTalkUser = $this->Talk_GetTalkUser($oTalk->getId(), $this->oUserCurrent->getId()))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверяем разрешено ли отправлять инбокс по времени
      */
     if (!$this->ACL_CanPostTalkCommentTime($this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('talk_time_limit'), $this->Lang_Get('error'));
         return false;
     }
     /**
      * Проверяем текст комментария
      */
     $sText = $this->Text_Parser(getRequest('comment_text'));
     if (!func_check($sText, 'text', 2, 3000)) {
         $this->Message_AddErrorSingle($this->Lang_Get('talk_comment_add_text_error'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Проверям на какой коммент отвечаем
      */
     $sParentId = (int) getRequest('reply');
     if (!func_check($sParentId, 'id')) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     $oCommentParent = null;
     if ($sParentId != 0) {
         /**
          * Проверяем существует ли комментарий на который отвечаем
          */
         if (!($oCommentParent = $this->Comment_GetCommentById($sParentId))) {
             $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             return;
         }
         /**
          * Проверяем из одного топика ли новый коммент и тот на который отвечаем
          */
         if ($oCommentParent->getTargetId() != $oTalk->getId()) {
             $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             return;
         }
     } else {
         /**
          * Корневой комментарий
          */
         $sParentId = null;
     }
     /**
      * Проверка на дублирующий коммент
      */
     if ($this->Comment_GetCommentUnique($oTalk->getId(), 'talk', $this->oUserCurrent->getId(), $sParentId, md5($sText))) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_comment_spam'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Создаём коммент
      */
     $oCommentNew = Engine::GetEntity('Comment');
     $oCommentNew->setTargetId($oTalk->getId());
     $oCommentNew->setTargetType('talk');
     $oCommentNew->setUserId($this->oUserCurrent->getId());
     $oCommentNew->setText($sText);
     $oCommentNew->setDate(date("Y-m-d H:i:s"));
     $oCommentNew->setUserIp(func_getIp());
     $oCommentNew->setPid($sParentId);
     $oCommentNew->setTextHash(md5($sText));
     /**
      * Добавляем коммент
      */
     if ($this->Comment_AddComment($oCommentNew)) {
         $this->Viewer_AssignAjax('sCommentId', $oCommentNew->getId());
         $oTalk->setDateLast(date("Y-m-d H:i:s"));
         $oTalk->setCountComment($oTalk->getCountComment() + 1);
         $this->Talk_UpdateTalk($oTalk);
         /**
          * Отсылаем уведомления всем адресатам
          */
//.........这里部分代码省略.........
开发者ID:lifecom,项目名称:test,代码行数:101,代码来源:ActionTalk.class.php

示例10: GetVoteByUser

 /**
  * Возвращает объект голосования текущего пользователя за конкретный опрос
  *
  * @param ModulePoll_EntityPoll $oPoll
  * @param int|null $iUserId Если null, то проверяется для гостя
  * @return ModulePoll_EntityVote
  */
 public function GetVoteByUser($oPoll, $iUserId)
 {
     $iUserId = is_object($iUserId) ? $iUserId->getId() : $iUserId;
     if (is_null($iUserId)) {
         /**
          * Для гостя
          * Два варианта - проверка по IP и по кукам
          */
         if ($oPoll->getIsGuestCheckIp()) {
             if ($oVote = $this->Poll_GetVoteByIpAndPollId(func_getIp(), $oPoll->getId())) {
                 return $oVote;
             }
         }
         /**
          * По кукам
          */
         if ($sKey = $this->Session_GetCookie($this->GetCookieVoteName($oPoll))) {
             return $this->Poll_GetVoteByGuestKeyAndPollId($sKey, $oPoll->getId());
         }
         return false;
     } else {
         /**
          * Для авторизованного
          */
         return $this->Poll_GetVoteByUserIdAndPollId($iUserId, $oPoll->getId());
     }
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:34,代码来源:Poll.class.php

示例11: SubmitEdit

 /**
  * Обработка редактирования топика
  *
  * @param ModuleTopic_EntityTopic $oTopic
  * @return mixed
  */
 protected function SubmitEdit($oTopic)
 {
     $oTopic->_setValidateScenario('topic');
     /**
      * Сохраняем старое значение идентификатора блога
      */
     $sBlogIdOld = $oTopic->getBlogId();
     /**
      * Заполняем поля для валидации
      */
     $oTopic->setBlogId(getRequestStr('blog_id'));
     $oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
     $oTopic->setTextSource(getRequestStr('topic_text'));
     $oTopic->setTags(getRequestStr('topic_tags'));
     $oTopic->setUserIp(func_getIp());
     /**
      * Проверка корректности полей формы
      */
     if (!$this->checkTopicFields($oTopic)) {
         return false;
     }
     /**
      * Определяем в какой блог делаем запись
      */
     $iBlogId = $oTopic->getBlogId();
     if ($iBlogId == 0) {
         $oBlog = $this->Blog_GetPersonalBlogByUserId($oTopic->getUserId());
     } else {
         $oBlog = $this->Blog_GetBlogById($iBlogId);
     }
     /**
      * Если блог не определен выдаем предупреждение
      */
     if (!$oBlog) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_unknown'), $this->Lang_Get('error'));
         return false;
     }
     /**
      * Проверяем права на постинг в блог
      */
     if (!$this->ACL_IsAllowBlog($oBlog, $this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_noallow'), $this->Lang_Get('error'));
         return false;
     }
     /**
      * Проверяем разрешено ли постить топик по времени
      */
     if (isPost('submit_topic_publish') and !$oTopic->getPublishDraft() and !$this->ACL_CanPostTopicTime($this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'), $this->Lang_Get('error'));
         return;
     }
     $oTopic->setBlogId($oBlog->getId());
     /**
      * Получаемый и устанавливаем разрезанный текст по тегу <cut>
      */
     list($sTextShort, $sTextNew, $sTextCut) = $this->Text_Cut($oTopic->getTextSource());
     $oTopic->setCutText($sTextCut);
     $oTopic->setText($this->Text_Parser($sTextNew));
     $oTopic->setTextShort($this->Text_Parser($sTextShort));
     /**
      * Публикуем или сохраняем в черновиках
      */
     $bSendNotify = false;
     if (isset($_REQUEST['submit_topic_publish'])) {
         $oTopic->setPublish(1);
         if ($oTopic->getPublishDraft() == 0) {
             $oTopic->setPublishDraft(1);
             $oTopic->setDateAdd(date("Y-m-d H:i:s"));
             $bSendNotify = true;
         }
     } else {
         $oTopic->setPublish(0);
     }
     /**
      * Принудительный вывод на главную
      */
     if ($this->ACL_IsAllowPublishIndex($this->oUserCurrent)) {
         if (getRequest('topic_publish_index')) {
             $oTopic->setPublishIndex(1);
         } else {
             $oTopic->setPublishIndex(0);
         }
     }
     /**
      * Запрет на комментарии к топику
      */
     $oTopic->setForbidComment(0);
     if (getRequest('topic_forbid_comment')) {
         $oTopic->setForbidComment(1);
     }
     $this->Hook_Run('topic_edit_before', array('oTopic' => $oTopic, 'oBlog' => $oBlog));
     /**
      * Сохраняем топик
      */
//.........这里部分代码省略.........
开发者ID:lunavod,项目名称:bunker_stable,代码行数:101,代码来源:ActionTopic.class.php

示例12: EventAjaxAdd

 protected function EventAjaxAdd()
 {
     $this->Viewer_SetResponseAjax();
     /**
      * Проверяем тип топика
      */
     $sTopicType = getRequestStr('topic_type');
     if (!($oTopicType = $this->Topic_GetTopicType($sTopicType))) {
         return $this->EventErrorDebug();
     }
     /**
      * Проверяем права на создание топика
      */
     if (!$this->ACL_CanAddTopic($this->oUserCurrent, $oTopicType)) {
         $this->Message_AddErrorSingle($this->Rbac_GetMsgLast());
         return false;
     }
     /**
      * Создаем топик
      */
     $oTopic = Engine::GetEntity('Topic');
     $oTopic->_setDataSafe(getRequest('topic'));
     $oTopic->setProperties(getRequest('property'));
     $oTopic->setUserCreator($this->oUserCurrent);
     $oTopic->setUserId($this->oUserCurrent->getId());
     $oTopic->setDateAdd(date("Y-m-d H:i:s"));
     $oTopic->setUserIp(func_getIp());
     $oTopic->setTopicType($sTopicType);
     if (!$oTopic->getTags() or !$oTopic->getTypeObject()->getParam('allow_tags')) {
         $oTopic->setTags('');
     }
     /**
      * Публикуем или сохраняем
      */
     if (!isset($_REQUEST['is_draft'])) {
         $oTopic->setPublish(1);
         $oTopic->setPublishDraft(1);
     } else {
         $oTopic->setPublish(0);
         $oTopic->setPublishDraft(0);
     }
     /**
      * Принудительный вывод на главную
      */
     $oTopic->setPublishIndex(0);
     if ($this->ACL_IsAllowTopicPublishIndex($this->oUserCurrent)) {
         if (isset($_REQUEST['topic']['topic_publish_index'])) {
             $oTopic->setPublishIndex(1);
         }
     }
     /**
      * Принудительный запрет вывода на главную
      */
     $oTopic->setSkipIndex(0);
     if ($this->ACL_IsAllowTopicSkipIndex($this->oUserCurrent)) {
         if (isset($_REQUEST['topic']['topic_skip_index'])) {
             $oTopic->setSkipIndex(1);
         }
     }
     /**
      * Запрет на комментарии к топику
      */
     $oTopic->setForbidComment(0);
     if (isset($_REQUEST['topic']['topic_forbid_comment'])) {
         $oTopic->setForbidComment(1);
     }
     $this->Hook_Run('topic_add_validate_before', array('oTopic' => $oTopic));
     if ($oTopic->_Validate()) {
         $oBlog = $oTopic->getBlog();
         /**
          * Получаем и устанавливаем разрезанный текст по тегу <cut>
          */
         if ($oTopic->getTypeObject()->getParam('allow_text')) {
             list($sTextShort, $sTextNew, $sTextCut) = $this->Text_Cut($oTopic->getTextSource());
             $oTopic->setCutText($sTextCut);
             $oTopic->setText($this->Topic_Parser($sTextNew, $oTopic));
             if ($sTextShort != $sTextNew) {
                 $oTopic->setTextShort($this->Topic_Parser($sTextShort, $oTopic));
             } else {
                 $oTopic->setTextShort('');
             }
         } else {
             $oTopic->setCutText('');
             $oTopic->setText('');
             $oTopic->setTextShort('');
             $oTopic->setTextSource('');
         }
         $this->Hook_Run('topic_add_before', array('oTopic' => $oTopic, 'oBlog' => $oBlog));
         if ($this->Topic_AddTopic($oTopic)) {
             $this->Hook_Run('topic_add_after', array('oTopic' => $oTopic, 'oBlog' => $oBlog));
             /**
              * Получаем топик, чтоб подцепить связанные данные
              */
             $oTopic = $this->Topic_GetTopicById($oTopic->getId());
             /**
              * Обновляем количество топиков в блогах
              */
             $this->Blog_RecalculateCountTopicByBlogId($oTopic->getBlogsId());
             /**
              * Фиксируем ID у media файлов топика
//.........这里部分代码省略.........
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:101,代码来源:ActionContent.class.php

示例13: SubmitEdit

 /**
  * Обработка редактирования топика
  *
  * @param unknown_type $oTopic
  * @return unknown
  */
 protected function SubmitEdit($oTopic)
 {
     /**
      * Проверка корректности полей формы
      */
     if (!$this->checkTopicFields($oTopic)) {
         return false;
     }
     /**
      * Определяем в какой блог делаем запись
      */
     $iBlogId = getRequest('blog_id');
     if ($iBlogId == 0) {
         $oBlog = $this->Blog_GetPersonalBlogByUserId($oTopic->getUserId());
     } else {
         $oBlog = $this->Blog_GetBlogById($iBlogId);
     }
     /**
      * Если блог не определен выдаем предупреждение
      */
     if (!$oBlog) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_unknown'), $this->Lang_Get('error'));
         return false;
     }
     /**
      * Проверяем права на постинг в блог
      */
     if (!$this->ACL_IsAllowBlog($oBlog, $this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_noallow'), $this->Lang_Get('error'));
         return false;
     }
     /**
      * Проверяем разрешено ли постить топик по времени
      */
     if (isPost('submit_topic_publish') and !$oTopic->getPublishDraft() and !$this->ACL_CanPostTopicTime($this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Сохраняем старое значение идентификатора блога
      */
     $sBlogIdOld = $oTopic->getBlogId();
     /**
      * Теперь можно смело редактировать топик
      */
     $oTopic->setBlogId($oBlog->getId());
     $oTopic->setText(htmlspecialchars(getRequest('topic_text')));
     $oTopic->setTextShort(htmlspecialchars(getRequest('topic_text')));
     $oTopic->setTextSource(getRequest('topic_text'));
     $oTopic->setTags(getRequest('topic_tags'));
     $oTopic->setUserIp(func_getIp());
     /**
      * изменяем вопрос/ответы только если еще никто не голосовал
      */
     if ($oTopic->getQuestionCountVote() == 0) {
         $oTopic->setTitle(getRequest('topic_title'));
         $oTopic->clearQuestionAnswer();
         foreach (getRequest('answer', array()) as $sAnswer) {
             $oTopic->addQuestionAnswer($sAnswer);
         }
     }
     $oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getText() . $oTopic->getTitle()));
     /**
      * Проверяем топик на уникальность
      */
     if ($oTopicEquivalent = $this->Topic_GetTopicUnique($this->oUserCurrent->getId(), $oTopic->getTextHash())) {
         if ($oTopicEquivalent->getId() != $oTopic->getId()) {
             $this->Message_AddErrorSingle($this->Lang_Get('topic_create_text_error_unique'), $this->Lang_Get('error'));
             return false;
         }
     }
     /**
      * Публикуем или сохраняем в черновиках
      */
     $bSendNotify = false;
     if (isset($_REQUEST['submit_topic_publish'])) {
         $oTopic->setPublish(1);
         if ($oTopic->getPublishDraft() == 0) {
             $oTopic->setPublishDraft(1);
             $oTopic->setDateAdd(date("Y-m-d H:i:s"));
             $bSendNotify = true;
         }
     } else {
         $oTopic->setPublish(0);
     }
     /**
      * Принудительный вывод на главную
      */
     if ($this->ACL_IsAllowPublishIndex($this->oUserCurrent)) {
         if (getRequest('topic_publish_index')) {
             $oTopic->setPublishIndex(1);
         } else {
             $oTopic->setPublishIndex(0);
         }
//.........这里部分代码省略.........
开发者ID:narush,项目名称:livestreet,代码行数:101,代码来源:ActionQuestion.class.php

示例14: blackMail

 public function blackMail($sMail, $sName = null)
 {
     $sIp = func_getIp();
     if (!empty($sMail) && $this->check_whitelist_users_mail($sMail) || !empty($sName) && $this->check_whitelist_users_name($sName) || !empty($sIp) && $this->check_whitelist_users_ip($sIp) || $this->check_whitelist_domains($sMail)) {
         return false;
     }
     if (!empty($sMail) && $this->check_blacklist_users_mail($sMail) || !empty($sName) && $this->check_blacklist_users_name($sName) || !empty($sIp) && $this->check_blacklist_users_ip($sIp) || $this->check_blacklist_domains($sMail)) {
         return true;
     }
     $bCheckMail = Config::Get('plugin.blacklist.check_mail') && $sMail;
     $bCheckIp = Config::Get('plugin.blacklist.check_ip') && $sIp && $sIp !== '127.0.0.1';
     if (!$bCheckMail && !$bCheckIp) {
         return false;
     }
     $bIpExact = Config::Get('plugin.blacklist.check_ip_exact');
     $aResult = $this->check_local_base($sMail, $sIp, $bCheckMail, $bCheckIp);
     if (is_array($aResult)) {
         if ($this->analyse_result($aResult, $bCheckMail, $bCheckIp, $bIpExact)) {
             return true;
         } elseif ((!$bCheckMail || $bCheckMail && isset($aResult[self::TYPE_MAIL])) && (!$bCheckIp || $bCheckIp && isset($aResult[self::TYPE_IP]))) {
             return false;
         }
     }
     $bMail = false;
     $bIp = false;
     $bResult = false;
     if (Config::Get('plugin.blacklist.use_stopforumspam_com')) {
         $aResult = $this->check_stopforumspam_com($sMail, $sIp, $bCheckMail, $bCheckIp);
         $bMail |= is_array($aResult) && isset($aResult[self::TYPE_MAIL]) ? $aResult[self::TYPE_MAIL] : false;
         $bIp |= is_array($aResult) && isset($aResult[self::TYPE_IP]) ? $aResult[self::TYPE_IP] : false;
         $bResult = $this->analyse_result($aResult, $bCheckMail, $bCheckIp, $bIpExact);
         if ($bCheckMail) {
             $this->AddMailResult($sMail, $bMail, self::SERVICE_STOPFORUMSPAM_COM);
         }
         if ($bCheckIp) {
             $this->AddIpResult($sIp, $bIp, self::SERVICE_STOPFORUMSPAM_COM);
         }
     }
     if (!$bResult && Config::Get('plugin.blacklist.use_botscout_com')) {
         $aResult = $this->check_botscout_com($sMail, $sIp, $bCheckMail, $bCheckIp);
         $bMail |= is_array($aResult) && isset($aResult[self::TYPE_MAIL]) ? $aResult[self::TYPE_MAIL] : false;
         $bIp |= is_array($aResult) && isset($aResult[self::TYPE_IP]) ? $aResult[self::TYPE_IP] : false;
         $bResult = $this->analyse_result($aResult, $bCheckMail, $bCheckIp, $bIpExact);
         if ($bCheckMail) {
             $this->AddMailResult($sMail, $bMail, self::SERVICE_BOTSCOUT_COM);
         }
         if ($bCheckIp) {
             $this->AddIpResult($sIp, $bIp, self::SERVICE_BOTSCOUT_COM);
         }
     }
     if (!$bResult && Config::Get('plugin.blacklist.use_fspamlist_com')) {
         $aResult = $this->check_fspamlist_com($sMail, $sIp, $bCheckMail, $bCheckIp);
         $bMail |= is_array($aResult) && isset($aResult[self::TYPE_MAIL]) ? $aResult[self::TYPE_MAIL] : false;
         $bIp |= is_array($aResult) && isset($aResult[self::TYPE_IP]) ? $aResult[self::TYPE_IP] : false;
         $bResult = $this->analyse_result($aResult, $bCheckMail, $bCheckIp, $bIpExact);
         if ($bCheckMail) {
             $this->AddMailResult($sMail, $bMail, self::SERVICE_FSPAMLIST_COM);
         }
         if ($bCheckIp) {
             $this->AddIpResult($sIp, $bIp, self::SERVICE_FSPAMLIST_COM);
         }
     }
     return $bResult;
 }
开发者ID:wasja1982,项目名称:livestreet_blacklist,代码行数:64,代码来源:Blacklist.class.php

示例15: CreateSession

 protected function CreateSession(ModuleUser_EntityUser $oUser, $sKey)
 {
     $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('user_session_update'));
     $this->Cache_Delete("user_session_{$oUser->getId()}");
     $oSession = Engine::GetEntity('User_Session');
     $oSession->setUserId($oUser->getId());
     $oSession->setKey($sKey);
     $oSession->setIpLast(func_getIp());
     $oSession->setIpCreate(func_getIp());
     $oSession->setDateLast(date("Y-m-d H:i:s"));
     $oSession->setDateCreate(date("Y-m-d H:i:s"));
     if ($this->oMapper->CreateSession($oSession)) {
         $this->oSession = $oSession;
         return true;
     }
     return false;
 }
开发者ID:lifecom,项目名称:Huddlebuddle,代码行数:17,代码来源:User.class.php


注:本文中的func_getIp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。