]> dev.renevier.net Git - syp.git/blobdiff - api.php
fixes CHANGES.txt
[syp.git] / api.php
diff --git a/api.php b/api.php
index bb89c55d924e572ae048d443e89f739738683991..2dbfac4857a88e258513b114b3dcdb262ad770a3 100644 (file)
--- a/api.php
+++ b/api.php
@@ -3,7 +3,8 @@
    license. */
 
 function exit_document ($body) {
-    exit ("<html><head></head><body>$body</body></html>");
+    $charset_meta = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
+    exit ("<html>$charset_meta<head></head><body>$body</body></html>");
 }
 
 function success ($reason) {
@@ -343,6 +344,9 @@ function main ($con) {
             try {
                 $con->setpwd ($user, $newpass);
             } catch (Exception $e) {
+                if ($e->getMessage () == anydbConnection::err_query) {
+                    error_request ();
+                }
                 error_server ();
             }
             setcookies ($user, $newpass);
@@ -363,6 +367,9 @@ function main ($con) {
             try {
                 $con->setpwd ($newuser_name, $newuser_password);
             } catch (Exception $e) {
+                if ($e->getMessage () == anydbConnection::err_query) {
+                    error_request ();
+                }
                 error_server ();
             }
             success_newuser ($newuser_name);
@@ -378,7 +385,7 @@ function main ($con) {
 if (!@include_once ("./inc/settings.php")) {
     error_server ();
 }
-require_once ("./inc/db/mysql.php");
+require_once ("./inc/db/" . (defined ("DBTYPE")? DBTYPE: "mysql") . ".php");
 require_once ("./inc/utils.php");
 
 try {