From cf005c7671a6b46afbfb23cd25a3ab8e32a55d90 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 26 Jun 2024 07:43:23 -0600 Subject: [PATCH] Template engine use sys_get_temp_dir Used to get the operating system temp directory. --- .../resources/classes/plugins/database.php | 5 +---- .../authentication/resources/classes/plugins/email.php | 10 ++-------- core/authentication/resources/classes/plugins/ldap.php | 5 +---- core/authentication/resources/classes/plugins/totp.php | 10 ++-------- core/install/install.php | 5 +---- resources/footer.php | 2 +- 6 files changed, 8 insertions(+), 29 deletions(-) diff --git a/core/authentication/resources/classes/plugins/database.php b/core/authentication/resources/classes/plugins/database.php index 99ff25c852..57c22bac44 100644 --- a/core/authentication/resources/classes/plugins/database.php +++ b/core/authentication/resources/classes/plugins/database.php @@ -75,9 +75,6 @@ class plugin_database { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //create token //$object = new token; //$token = $object->create('login'); @@ -90,7 +87,7 @@ class plugin_database { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //add translations diff --git a/core/authentication/resources/classes/plugins/email.php b/core/authentication/resources/classes/plugins/email.php index eb464e6363..6ae6126a8c 100644 --- a/core/authentication/resources/classes/plugins/email.php +++ b/core/authentication/resources/classes/plugins/email.php @@ -67,9 +67,6 @@ class plugin_email { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //use the session username if (isset($_SESSION['username'])) { $_POST['username'] = $_SESSION['username']; @@ -87,7 +84,7 @@ class plugin_email { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //assign default values to the template @@ -321,9 +318,6 @@ class plugin_email { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //create token //$object = new token; //$token = $object->create('login'); @@ -336,7 +330,7 @@ class plugin_email { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //assign default values to the template diff --git a/core/authentication/resources/classes/plugins/ldap.php b/core/authentication/resources/classes/plugins/ldap.php index d61fc5dec9..0ddcf86aa0 100644 --- a/core/authentication/resources/classes/plugins/ldap.php +++ b/core/authentication/resources/classes/plugins/ldap.php @@ -38,9 +38,6 @@ class plugin_ldap { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //create token //$object = new token; //$token = $object->create('login'); @@ -53,7 +50,7 @@ class plugin_ldap { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //add translations diff --git a/core/authentication/resources/classes/plugins/totp.php b/core/authentication/resources/classes/plugins/totp.php index 22927d522c..8bc9f46c0b 100644 --- a/core/authentication/resources/classes/plugins/totp.php +++ b/core/authentication/resources/classes/plugins/totp.php @@ -79,9 +79,6 @@ class plugin_totp { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //create token //$object = new token; //$token = $object->create('login'); @@ -94,7 +91,7 @@ class plugin_totp { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //assign default values to the template @@ -189,9 +186,6 @@ class plugin_totp { $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; - //temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //create token //$object = new token; //$token = $object->create('login'); @@ -204,7 +198,7 @@ class plugin_totp { $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //assign values to the template diff --git a/core/install/install.php b/core/install/install.php index 13efb1a7c5..9f6724a153 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -350,14 +350,11 @@ $domain_array = explode(":", $_SERVER["HTTP_HOST"]); $domain_name = $domain_array[0]; -//temp directory - $_SESSION['server']['temp']['dir'] = '/tmp'; - //initialize a template object $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/install/resources/views/'; - $view->cache_dir = $_SESSION['server']['temp']['dir']; + $view->cache_dir = sys_get_temp_dir(); $view->init(); //assign default values to the template diff --git a/resources/footer.php b/resources/footer.php index e2aacf4992..3b7fde5624 100644 --- a/resources/footer.php +++ b/resources/footer.php @@ -71,7 +71,7 @@ $view = new template(); $view->engine = 'smarty'; $view->template_dir = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/themes/'.$_SESSION['domain']['template']['name'].'/'; - $view->cache_dir = $_SESSION['server']['temp']['dir'] ?: sys_get_temp_dir(); + $view->cache_dir = sys_get_temp_dir(); $view->init(); //add multi-lingual support