function print_apierror($errors, $debugstr = '') { if (!is_array($errors)) { $errors = array($errors); } $data = array(); if ($api_version < VB5_API_VERSION_START) { vB_Api::map_vb5_errors_to_vb4(VB4_MAPI_METHOD, $errors); $data = $errors; print_apioutput($data); return; } else { $data = array('errors' => $errors); } $vb5_config =& vB::getConfig(); if ($debugstr and $vb5_config['Misc']['debug']) { $data['debug'] = $debugstr; } print_apioutput($data); }