Get the database connection for save_phrases_xml.php.

This commit is contained in:
markjcrane 2016-04-15 19:52:21 -06:00
parent f1ac6eb9bd
commit 29e3c2eda2
1 changed files with 10 additions and 1 deletions

View File

@ -5,8 +5,17 @@ function save_phrases_xml() {
if (strlen($_SESSION['switch']['phrases']['dir']) == 0) { if (strlen($_SESSION['switch']['phrases']['dir']) == 0) {
return; return;
} }
//declare the global variables //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 //remove old phrase files for the domain
$phrase_list = glob($_SESSION['switch']['phrases']['dir']."/*/phrases/".$domain_uuid.".xml"); $phrase_list = glob($_SESSION['switch']['phrases']['dir']."/*/phrases/".$domain_uuid.".xml");