If any person has been admitted to the hospital as a voluntary patient, the director of the hospital has the same authority and control over him as if such patient had been admitted by order of court; except that a voluntary patient shall not be detained against his will or that of the person having legal custody or control over him for a period of more than ten days unless said director has within such interval obtained an order of commitment.