| @@ 106-138 (lines=33) @@ | ||
| 103 | * @param string $sAction |
|
| 104 | * @param array $aResponseItem |
|
| 105 | */ |
|
| 106 | public function FilterAjaxResponse($sAction, &$aResponseItem) |
|
| 107 | { |
|
| 108 | if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result'])) |
|
| 109 | { |
|
| 110 | $oCacher = $this->Manager()->Actions()->Cacher(); |
|
| 111 | $iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0); |
|
| 112 | $sKey = $this->getCaptchaCacherKey(); |
|
| 113 | ||
| 114 | if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited()) |
|
| 115 | { |
|
| 116 | if (false === $aResponseItem['Result']) |
|
| 117 | { |
|
| 118 | $iLimit = 0; |
|
| 119 | $sLimut = $oCacher->Get($sKey); |
|
| 120 | if (0 < strlen($sLimut) && is_numeric($sLimut)) |
|
| 121 | { |
|
| 122 | $iLimit = (int) $sLimut; |
|
| 123 | } |
|
| 124 | ||
| 125 | $oCacher->Set($sKey, ++$iLimit); |
|
| 126 | ||
| 127 | if ($iConfigLimit <= $iLimit) |
|
| 128 | { |
|
| 129 | $aResponseItem['Captcha'] = true; |
|
| 130 | } |
|
| 131 | } |
|
| 132 | else |
|
| 133 | { |
|
| 134 | $oCacher->Delete($sKey); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | } |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| @@ 117-150 (lines=34) @@ | ||
| 114 | * @param string $sAction |
|
| 115 | * @param array $aResponseItem |
|
| 116 | */ |
|
| 117 | public function FilterAjaxResponse($sAction, &$aResponseItem) |
|
| 118 | {
|
|
| 119 | if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result']))
|
|
| 120 | {
|
|
| 121 | $oCacher = $this->Manager()->Actions()->Cacher(); |
|
| 122 | $iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0);
|
|
| 123 | ||
| 124 | $sKey = $this->getCaptchaCacherKey(); |
|
| 125 | ||
| 126 | if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited()) |
|
| 127 | {
|
|
| 128 | if (false === $aResponseItem['Result']) |
|
| 129 | {
|
|
| 130 | $iLimit = 0; |
|
| 131 | $sLimut = $oCacher->Get($sKey); |
|
| 132 | if (0 < \strlen($sLimut) && \is_numeric($sLimut)) |
|
| 133 | {
|
|
| 134 | $iLimit = (int) $sLimut; |
|
| 135 | } |
|
| 136 | ||
| 137 | $oCacher->Set($sKey, ++$iLimit); |
|
| 138 | ||
| 139 | if ($iConfigLimit <= $iLimit) |
|
| 140 | {
|
|
| 141 | $aResponseItem['Captcha'] = true; |
|
| 142 | } |
|
| 143 | } |
|
| 144 | else |
|
| 145 | {
|
|
| 146 | $oCacher->Delete($sKey); |
|
| 147 | } |
|
| 148 | } |
|
| 149 | } |
|
| 150 | } |
|
| 151 | } |
|
| 152 | ||