Skip to content
Permalink
Browse files

Changed user directories structure and related functions

  • Loading branch information...
tvannini committed Sep 7, 2019
1 parent d5c902a commit 5a2deb14bb5183392508301cfa3ff8c773db3d4c
Showing with 16 additions and 74 deletions.
  1. +13 −43 lib/jxapp.inc
  2. +3 −31 lib/jxfnx.inc
@@ -259,26 +259,10 @@ class o2_app {
* @var o2_dir
*/
public $dir_models = ''; /* Application printout models folder (o2_dir) */
/**
* @var o2_dir
*/
public $dir_models_u = ''; /* User personal reports models folder (o2_dir) */
/**
* @var o2_dir
*/
public $dir_img = ''; /* Applications images folder (o2_dir) */
/**
* @var o2_dir
*/
public $dir_img_u = ''; /* User personal images folder (o2_dir) */
/**
* @var o2_dir
*/
public $dir_spool_in = ''; /* User spoolin folder (o2_dir) */
/**
* @var o2_dir
*/
public $dir_spool_out = ''; /* User spoolout folder (o2_dir) */
/**
* @var o2_dir
*/
@@ -950,10 +934,11 @@ class o2_app {
$users_dirs = new o2_dir($this->dir_home."/users/");
foreach ($users_dirs->all_elements() as $users_dir) {
if ($users_dir->tipo == "D") {
$tmp_dirs = new o2_dir($users_dir."tmp/");
$tmp_dirs = new o2_dir($users_dir);
foreach ($tmp_dirs->all_elements() as $tmp_dir) {
// ____________________________________ Check if session is active ___
if (!in_array(substr($tmp_dir->nome, 3), $active_sess)) {
if ($tmp_dir->tipo == "D" &&
!in_array(substr($tmp_dir->nome, 3), $active_sess)) {
$tmp_dir->remove();
}
}
@@ -3083,13 +3068,11 @@ class o2_app {
*
* Filesystem structure
*
* /app home
* '-/users users personal folders
* '-/default default user home
* |-/img images files
* |-/models frf models for reports production
* |-/tmp tmp files
* '-/uploads uploaded files
* /app home
* '-/users users personal folders
* '-/<user-name> user home
* '-/<sess-ID> user TMP folder per session
* '-/jxuploads uploaded files tmp folder
*
*/
function crea_cartelle_pers() {
@@ -3100,21 +3083,13 @@ class o2_app {
$this->dir_user = new o2_dir($this->dir_home."users".DIRECTORY_SEPARATOR.
$user_local.DIRECTORY_SEPARATOR);
$this->dir_user->crea();
// ____________________________________________________ /app/users/default/tmp ___
$dir_tmp = new o2_dir($this->dir_user."tmp".DIRECTORY_SEPARATOR);
$dir_tmp->crea();
// _____________________________________________ /app/users/default/tmp/sessid ___
$this->dir_tmp = new o2_dir($dir_tmp."tmp".$this->session_id.DIRECTORY_SEPARATOR);
// _________________________________________________ /app/users/default/sessid ___
$this->dir_tmp = new o2_dir($this->dir_user."tmp".$this->session_id.
DIRECTORY_SEPARATOR);
$this->dir_tmp->crea();
// ___________________________________ /app/users/default/tmp/sessid/jxuploads ___
// _______________________________________ /app/users/default/sessid/jxuploads ___
$this->dir_uploads = new o2_dir($this->dir_tmp."jxuploads".DIRECTORY_SEPARATOR);
$this->dir_uploads->crea();
// ____________________________________________________ /app/users/default/img ___
$this->dir_img_u = new o2_dir($this->dir_user."img".DIRECTORY_SEPARATOR);
$this->dir_img_u->crea();
// _________________________________________________ /app/users/default/models ___
$this->dir_models_u = new o2_dir($this->dir_user."models".DIRECTORY_SEPARATOR);
$this->dir_models_u->crea();
}
@@ -3145,17 +3120,12 @@ class o2_app {
}
return "";
break;
/* Ritorna il path fisico al modello dell'utente (se esiste) o a quello
dell'applicazione */
// _____________________ Returns path to file in application models folder ___
case "MODELS":
if ($this->dir_models_u->exists(basename($nome_file))) {
return $this->dir_models_u.basename($nome_file);
}
if ($this->dir_models->exists(basename($nome_file))) {
return $this->dir_models.basename($nome_file);
}
break;
default:
throw new o2_exception("Unknown folder <i>".$cartella.
"<i> requested for file <i>".$nome_file."</i>",
@@ -2931,7 +2931,7 @@ function o2app_dir_trn() {
*
* @package application
* @return string
* @see o2app_dir_usertemplates(), o2app_dir_tmp(), o2app_dir_home()
* @see o2app_dir_tmp(), o2app_dir_home()
*/
function o2app_dir_templates() {
@@ -2940,26 +2940,12 @@ function o2app_dir_templates() {
}
/**
* Returns user personal pdf printing templates folder path
*
* @package application
* @return string
* @see o2app_dir_templates(), o2app_dir_tmp(), o2app_dir_home()
*/
function o2app_dir_usertemplates() {
return $_SESSION['o2_app']->dir_models_u->nome_completo;
}
/**
* Returns images folder path
*
* @package application
* @return string
* @see o2app_dir_userimg(), o2app_dir_css(), o2app_dir_home()
* @see o2app_dir_css(), o2app_dir_home()
*/
function o2app_dir_img() {
@@ -2968,26 +2954,12 @@ function o2app_dir_img() {
}
/**
* Returns user personal images folder path
*
* @package application
* @return string
* @see o2app_dir_img(), o2app_dir_css(), o2app_dir_home()
*/
function o2app_dir_userimg() {
return $_SESSION['o2_app']->dir_img_u->nome_completo;
}
/**
* Returns currently logged user
*
* @package application
* @return string
* @see o2app_dir_usertemplates(), o2app_userimg(), o2app_dir_home(), o2app_user()
* @see o2app_userimg(), o2app_dir_home(), o2app_user()
*/
function o2app_dir_user() {

0 comments on commit 5a2deb1

Please sign in to comment.
You can’t perform that action at this time.