Commit 4c88ee32 by san58

изменил условие результирующео списа

+ добавил домена более 2-го уровня
1 parent 8bfd70ae
...@@ -26,8 +26,17 @@ class Collection extends Component ...@@ -26,8 +26,17 @@ class Collection extends Component
'', '',
utf8_encode($domain) utf8_encode($domain)
); );
if (count( explode('.', $host) ) === 2) if (filter_var($host, FILTER_VALIDATE_IP)===false)
$out = $host; {
$host_parts = explode('.', $host);
$host_parts = array_reverse($host_parts);
$host_parts = array_slice($host_parts, 0, 2);
$host_parts = array_reverse($host_parts);
if (count($host_parts) === 2)
$out = $host;
unset($host_parts);
}
unset($host); unset($host);
return $out; return $out;
} }
......
...@@ -46,7 +46,7 @@ class HostFreeController extends Controller ...@@ -46,7 +46,7 @@ class HostFreeController extends Controller
*/ */
public function actionIndex() public function actionIndex()
{ {
$searchModel = new HostSearch(['wis_status' => Host::STATUS_WIS_FREE, 'status' => Filter::STATUS_ON, 'f1_status' => Filter::STATUS_ON, 'f2_status' => Filter::STATUS_ON, 'f3_status' => Filter::STATUS_ON]); $searchModel = new HostSearch(['wis_status' => Host::STATUS_WIS_FREE, 'status' => Filter::STATUS_ON, 'f1_status' => Filter::STATUS_ON]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [ return $this->render('index', [
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!