소스 검색

Added parameter check of OpenClassRooms.

Sebastien SAUVAGE 10 년 전
부모
커밋
a1152aee96
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      bridges/OpenClassroomsBridge.php

+ 6 - 1
bridges/OpenClassroomsBridge.php

@@ -11,8 +11,13 @@
 class OpenClassroomsBridge extends BridgeAbstract{
 
     public function collectData(array $param){
+        if ($param['u']!='informatique' && $param['u']!='sciences')
+        {
+            $this->returnError('Error: You must chose "informatique" or "science".', 404);
+        }
+    
         $html = '';
-        $link = 'http://fr.openclassrooms.com/'.$param[u].'/cours?title=&sort=updatedAt+desc';
+        $link = 'http://fr.openclassrooms.com/'.$param['u'].'/cours?title=&sort=updatedAt+desc';
 
         $html = file_get_html($link) or $this->returnError('Could not request OpenClassrooms.', 404);