コード例 #1
0
ファイル: ri.php プロジェクト: henrikau/confusa
 if (!is_null($xml)) {
     try {
         $parsedXML = new SimpleXMLElement($xml);
     } catch (Exception $e) {
         echo $e->getMessage();
         exit(0);
     }
     $name = $parsedXML->getName();
     if ($name != "ConfusaRobot") {
         echo "Wrong type of XML. Aborting.\n";
         exit(0);
     }
     foreach ($parsedXML as $key => $value) {
         switch ($key) {
             case 'revocationList':
                 $res = Robot::parseRevList($value, $admin);
                 break;
             default:
                 if (Config::get_config('debug')) {
                     echo "Unknown type ({$key}). Are you sure you are following the DTD?\n";
                     /* only exit in debug-mode to minimize
                      * number of log-entries etc.
                      *
                      * In prod. we want to parse the entire file.
                      */
                     exit(0);
                 }
                 break;
         }
     }
 }