Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/inc/GnuBoat/Service.php

    r1ba85cf r0662b2d  
    4444                $this->process();
    4545        }
     46       
     47        public static function errorStatic($message, $additionalContent = array(), $debug)
     48        {
     49                error_log($message);
     50                if($debug > 0)
     51                        print $message ."\n";
     52                $result = ["error" => 1, "errormessage" => $message];
     53                Service::outputStatic(array_merge($result, $additionalContent), $debug);
     54        }
     55       
     56        public static function outputStatic($content, $debug)
     57        {
     58                header('Content-Type: application/json');
     59                if($debug > 0){
     60                        echo json_encode($content,  JSON_PRETTY_PRINT) ."\n";
     61                }
     62                else{
     63                        echo json_encode($content) ."\n";
     64                }
     65        }
     66       
     67        protected function error($message, $additionalContent = array())
     68        {
     69                Service::errorStatic($message, $additionalContent, $this->debug());
     70        }
     71       
     72        protected function output($content)
     73        {
     74                Service::outputStatic($content, $this->debug());
     75        }
    4676
    4777        /**
Note: See TracChangeset for help on using the changeset viewer.