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


PHP FabrikString::filteredIp方法代码示例

本文整理汇总了PHP中FabrikString::filteredIp方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::filteredIp方法的具体用法?PHP FabrikString::filteredIp怎么用?PHP FabrikString::filteredIp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FabrikString的用法示例。


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

示例1: validate

 /**
  * Internal element validation
  *
  * @param   array $data          form data
  * @param   int   $repeatCounter repeat group counter
  *
  * @return bool
  */
 public function validate($data, $repeatCounter = 0)
 {
     $params = $this->getParams();
     $input = $this->app->input;
     if (!$this->canUse()) {
         return true;
     }
     if ($params->get('captcha-method') == 'recaptcha') {
         if (!function_exists('_recaptcha_qsencode')) {
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/recaptcha-php-1.11/recaptchalib.php';
         }
         $privateKey = $params->get('recaptcha_privatekey');
         if ($input->get('recaptcha_response_field')) {
             $challenge = $input->get('recaptcha_challenge_field');
             $response = $input->get('recaptcha_response_field');
             $resp = recaptcha_check_answer($privateKey, FabrikString::filteredIp(), $challenge, $response);
             return $resp->is_valid ? true : false;
         }
         return false;
     } elseif ($params->get('captcha-method') == 'nocaptcha') {
         if ($input->get('g-recaptcha-response')) {
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ReCaptcha/ReCaptcha.php';
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ReCaptcha/RequestMethod.php';
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ReCaptcha/RequestMethod/Post.php';
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ReCaptcha/RequestParameters.php';
             require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ReCaptcha/Response.php';
             $privateKey = $params->get('recaptcha_privatekey');
             $noCaptcha = new \ReCaptcha\ReCaptcha($privateKey);
             $response = $input->get('g-recaptcha-response');
             $server = $input->server->get('REMOTE_ADDR');
             $resp = $noCaptcha->verify($response, $server);
             if ($resp->isSuccess()) {
                 return true;
             } else {
                 if (FabrikHelperHTML::isDebug()) {
                     $msg = "noCaptcha error: ";
                     foreach ($resp->getErrorCodes() as $code) {
                         $msg .= '<tt>' . $code . '</tt> ';
                     }
                     $this->app->enqueueMessage($msg);
                 }
                 return false;
             }
         }
         if (FabrikHelperHTML::isDebug()) {
             $this->app->enqueueMessage("No g-recaptcha-response!");
         }
         return false;
     } elseif ($params->get('captcha-method') == 'playthru') {
         if (!defined('AYAH_PUBLISHER_KEY')) {
             define('AYAH_PUBLISHER_KEY', $params->get('playthru_publisher_key', ''));
             define('AYAH_SCORING_KEY', $params->get('playthru_scoring_key', ''));
         }
         require_once JPATH_SITE . '/plugins/fabrik_element/captcha/libs/ayah_php_bundle_1.1.7/ayah.php';
         $ayah = new AYAH();
         return $ayah->scoreResult();
     } else {
         $this->getParams();
         if ($this->session->get('com_' . $this->package . '.element.captcha.security_code', null) != $data) {
             return false;
         }
         return true;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:72,代码来源:captcha.php

示例2: makeStandardMessage

 /**
  * Make a standard log message
  *
  * @param   string $result_compare Not sure?!
  *
  * @return  string  json encoded objects
  */
 protected function makeStandardMessage($result_compare)
 {
     $params = $this->getParams();
     $input = $this->app->input;
     $msg = new stdClass();
     if ($params->get('logs_record_ip') == 1) {
         $msg->ip = FabrikString::filteredIp();
     }
     if ($params->get('logs_record_useragent') == 1) {
         $msg->userAgent = $input->server->getString('HTTP_USER_AGENT');
     }
     if ($params->get('compare_data') == 1) {
         $result_compare = preg_replace('/<br\\/>/', '- ', $result_compare);
         $msg->comparison = preg_replace('/\\n/', '- ', $result_compare);
     }
     return json_encode($msg);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:24,代码来源:logs.php

示例3: getCookieName

 /**
  * Get the cookie name
  *
  * @param   int     $listId  List id
  * @param   string  $rowId  Row id
  *
  * @return  string
  */
 private function getCookieName($listId, $rowId)
 {
     $cookieName = 'thumb-table_' . $listId . '_row_' . $rowId . '_ip_' . FabrikString::filteredIp();
     jimport('joomla.utilities.utility');
     $version = new JVersion();
     if (version_compare($version->RELEASE, '3.1', '>')) {
         return JApplicationHelper::getHash($cookieName);
     } else {
         return JApplication::getHash($cookieName);
     }
 }
开发者ID:pascal26,项目名称:fabrik,代码行数:19,代码来源:thumbs.php

示例4: getDefaultValue

 /**
  * This really does get just the default value (as defined in the element's settings)
  *
  * @param   array  $data  form data
  *
  * @return mixed
  */
 public function getDefaultValue($data = array())
 {
     if (!isset($this->default)) {
         $this->default = FabrikString::filteredIp();
     }
     return $this->default;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:14,代码来源:ip.php

示例5: getCookieName

 /**
  * Get cookie name
  *
  * @param   int     $listId  List id
  * @param   string  $rowId  Row id
  *
  * @return string  Hashed cookie name.
  */
 private function getCookieName($listId, $rowId)
 {
     $cookieName = "rating-table_{$listId}_row_{$rowId}" . FabrikString::filteredIp();
     jimport('joomla.utilities.utility');
     return JApplication::getHash($cookieName);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:14,代码来源:rating.php

示例6: onAddComment

 /**
  * Add a comment called from ajax request
  *
  * @return  void
  */
 public function onAddComment()
 {
     $input = $this->app->input;
     $row = FabTable::getInstance('comment', 'FabrikTable');
     $filter = JFilterInput::getInstance();
     $request = $filter->clean($_REQUEST, 'array');
     $row->bind($request);
     $row->ipaddress = FabrikString::filteredIp();
     $row->user_id = $this->user->get('id');
     $row->approved = 1;
     // @TODO this isn't set?
     $row->url = $input->server->get('HTTP_REFERER', '', 'string');
     $rowId = $input->get('rowid', '', 'string');
     $row->formid = $input->getInt('formid');
     $row->row_id = $rowId;
     if ($this->user->get('id') != 0) {
         $row->name = $this->user->get('name');
         $row->email = $this->user->get('email');
     }
     // Load up the correct params for the plugin -
     // First load all form params
     $formModel = $this->setFormModel();
     $params = $formModel->getParams();
     $this->renderOrder = (int) $input->get('renderOrder', 0);
     // Then map that data (for correct render order) onto this plugins params
     $params = $this->setParams($params, $this->renderOrder);
     $row->store();
     // $$$ rob 16/10/2012 db queries run when element/plugin selected in admin, so just return false if error now
     $obj = new stdClass();
     // Do this to get the depth of the comment
     $comments = $this->getComments($row->formid, $row->row_id);
     $row = $comments[$row->id];
     $obj->content = $this->writeComment($params, $row);
     $obj->depth = (int) $row->depth;
     $obj->id = $row->id;
     $notificationPlugin = $this->useNotificationPlugin();
     $this->fixTable();
     if ($notificationPlugin) {
         $this->addNotificationEvent($row);
     }
     // Do we notify everyone?
     if ($notificationPlugin) {
         $this->saveNotificationToPlugin($row, $comments);
     } else {
         $this->sentNotifications($row, $comments);
     }
     echo json_encode($obj);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:53,代码来源:comment.php


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