diff --git a/app/phrases/resources/functions/save_phrases_xml.php b/app/phrases/resources/functions/save_phrases_xml.php index 597971fedb..60625c7f86 100644 --- a/app/phrases/resources/functions/save_phrases_xml.php +++ b/app/phrases/resources/functions/save_phrases_xml.php @@ -5,8 +5,17 @@ function save_phrases_xml() { if (strlen($_SESSION['switch']['phrases']['dir']) == 0) { return; } + //declare the global variables - global $db, $domain_uuid, $config; + global $domain_uuid, $config; + + //connect to the database if not connected + if (!$db) { + require_once "resources/classes/database.php"; + $database = new database; + $database->connect(); + $db = $database->db; + } //remove old phrase files for the domain $phrase_list = glob($_SESSION['switch']['phrases']['dir']."/*/phrases/".$domain_uuid.".xml");