@@ -54,7 +54,7 @@ function onBeforeInsert() {
5454 global $ app , $ conf ;
5555
5656 //* Security settings check
57- if (isset ($ this ->dataRecord ['typ ' ]) && $ this ->dataRecord ['typ ' ][ 0 ] == ' admin ' ) {
57+ if (isset ($ this ->dataRecord ['typ ' ]) && in_array ( ' admin ' , $ this ->dataRecord ['typ ' ]) ) {
5858 $ app ->auth ->check_security_permissions ('admin_allow_new_admin ' );
5959 }
6060
@@ -63,7 +63,7 @@ function onBeforeInsert() {
6363 }
6464
6565 //* Do not add users here
66- if (isset ($ this ->dataRecord ['typ ' ]) && $ this ->dataRecord ['typ ' ][ 0 ] == ' user ' ) {
66+ if (isset ($ this ->dataRecord ['typ ' ]) && in_array ( ' user ' , $ this ->dataRecord ['typ ' ]) ) {
6767 $ app ->tform ->errorMessage .= $ app ->tform ->wordbook ['no_user_insert ' ];
6868 }
6969
@@ -75,7 +75,7 @@ function onBeforeUpdate() {
7575 if ($ conf ['demo_mode ' ] == true && $ _REQUEST ['id ' ] <= 3 ) $ app ->error ('This function is disabled in demo mode. ' );
7676
7777 //* Security settings check
78- if (isset ($ this ->dataRecord ['typ ' ]) && $ this ->dataRecord ['typ ' ][ 0 ] == ' admin ' ) {
78+ if (isset ($ this ->dataRecord ['typ ' ]) && in_array ( ' admin ' , $ this ->dataRecord ['typ ' ]) ) {
7979 $ app ->auth ->check_security_permissions ('admin_allow_new_admin ' );
8080 }
8181
@@ -86,12 +86,12 @@ function onBeforeUpdate() {
8686 $ this ->oldDataRecord = $ app ->tform ->getDataRecord ($ this ->id );
8787
8888 //* A user that belongs to a client record (client or reseller) may not have typ admin
89- if (isset ($ this ->dataRecord ['typ ' ]) && $ this ->dataRecord ['typ ' ][ 0 ] == ' admin ' && $ this ->oldDataRecord ['client_id ' ] > 0 ) {
89+ if (isset ($ this ->dataRecord ['typ ' ]) && in_array ( ' admin ' , $ this ->dataRecord ['typ ' ]) && $ this ->oldDataRecord ['client_id ' ] > 0 ) {
9090 $ app ->tform ->errorMessage .= $ app ->tform ->wordbook ['client_not_admin_err ' ];
9191 }
9292
9393 //* Users have to belong to clients
94- if (isset ($ this ->dataRecord ['typ ' ]) && $ this ->dataRecord ['typ ' ][ 0 ] == ' user ' && $ this ->oldDataRecord ['client_id ' ] == 0 ) {
94+ if (isset ($ this ->dataRecord ['typ ' ]) && in_array ( ' user ' , $ this ->dataRecord ['typ ' ]) && $ this ->oldDataRecord ['client_id ' ] == 0 ) {
9595 $ app ->tform ->errorMessage .= $ app ->tform ->wordbook ['no_user_insert ' ];
9696 }
9797
0 commit comments