Example #1
0
 public function onCalling($args)
 {
     // Setting the header
     header("Content-Type: application/json");
     // If there is no argument given
     if (sizeof($args) == 0) {
         // Stopping
         return;
     }
     // Creating the list
     $list = array();
     // Getting the list of all files in the files folder
     $files = $this->listFolder(self::FILES_FOLDER, array());
     // Getting the selected check method
     $checkMethod = \SUpdateServer\Checking\CheckMethodLoader::getCheckMethodLoader()->getCheckMethod($args[0]);
     // If it returned false (The method wasn't found)
     if (!$checkMethod) {
         // Printing an error message
         echo "Unknown check method. This is normally unpossible so please go away.";
         // And stopping
         return;
     }
     // For each file
     foreach ($files as $file) {
         // If it is a directory
         if (is_dir($file)) {
             // Continuing the loop
             continue;
         }
         // Getting the file infos by the selected check method
         $list[sizeof($list)] = $checkMethod->createFileInfos($file);
     }
     // Finally printing the list
     echo json_encode($list, JSON_PRETTY_PRINT);
 }
 public function onCalling($args)
 {
     // Setting the header
     header("Content-Type: application/json");
     // Printing the result
     if (sizeof($args) == 1) {
         echo json_encode(array("methodPresent" => \SUpdateServer\Checking\CheckMethodLoader::getCheckMethodLoader()->isCheckMethodLoaded($args[0]) ? "true" : "false"), JSON_PRETTY_PRINT);
     }
 }