Set Smarty compile and cache folder to non document root

The smarty template_c and cache folder are now set on BASE folder and
not in the folder where the script is
This commit is contained in:
Clemens Schwaighofer
2018-04-03 17:41:02 +09:00
parent bf5486a59e
commit f51b74d8b5
7 changed files with 19 additions and 12 deletions

View File

@@ -1 +0,0 @@
../cache/

View File

@@ -307,7 +307,12 @@ $CONTENT_DATA = array_merge($HEADER, $DATA, $DEBUG_DATA);
while (list($key, $value) = each($CONTENT_DATA)) {
$smarty->assign($key, $value);
}
if (is_dir(BASE.TEMPLATES_C)) {
$smarty->setCompileDir(BASE.TEMPLATES_C);
}
if (is_dir(BASE.CACHE)) {
$smarty->setCacheDir(BASE.CACHE);
}
$smarty->display('edit_body.tpl');
// debug output

View File

@@ -202,10 +202,10 @@ if ($cms->action == 'save') {
$file = DEV_SCHEMA."_".$file_uid;
// now upload the file
if ($_FILES['file_up']['name']) {
$upload_file = ROOT.MEDIA.$cms->data_path[$file_type].$file;
$upload_file = BASE.MEDIA.$cms->data_path[$file_type].$file;
// wipe out any old tmp data for this new upload
if (is_array(glob(ROOT.TMP."thumb_".$file."*"))) {
foreach (glob(ROOT.TMP."thumb_".$file."*") as $filename) {
if (is_array(glob(BASE.TMP."thumb_".$file."*"))) {
foreach (glob(BASE.TMP."thumb_".$file."*") as $filename) {
@unlink($filename);
}
}
@@ -242,7 +242,7 @@ if ($cms->action == 'save') {
}
$q .= ") VALUES ('".$cms->queue_name."', '".$file_uid."', 'file_uid', '".$sql_action."', 'file', '".$cms->db_escape_string($sql_data)."', '".$cms->queue_key."', '".$cms->action."'";
if ($_FILES['file_up']['name']) {
$q .= ", '".ROOT.MEDIA.$cms->data_path[$file_type].$file."#".ROOT.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."'";
$q .= ", '".BASE.MEDIA.$cms->data_path[$file_type].$file."#".BASE.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."'";
}
$q .= ")";
$cms->db_exec($q);
@@ -262,9 +262,9 @@ if ($cms->action == 'delete' && $cms->action_yes == 'true') {
}
if (QUEUE == 'live_queue') {
$q = "INSERT INTO ".GLOBAL_DB_SCHEMA.".live_queue (queue_key, key_value, key_name, type, target, data, group_key, action, file) VALUES (";
$q .= "'".$cms->queue_name."', '".$file_uid."', 'file_uid', 'DELETE', 'file', '', '".$cms->queue_key."', '".$cms->action."', '".ROOT.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."')";
$q .= "'".$cms->queue_name."', '".$file_uid."', 'file_uid', 'DELETE', 'file', '', '".$cms->queue_key."', '".$cms->action."', '".BASE.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."')";
}
@unlink(ROOT.MEDIA.$cms->data_path[$file_type].DEV_SCHEMA."_".$file_uid);
@unlink(BASE.MEDIA.$cms->data_path[$file_type].DEV_SCHEMA."_".$file_uid);
unset($file_uid);
unset($file_id);
$delete_done = 1;
@@ -296,7 +296,7 @@ if ($cms->action_flag == 'set_live' && $cms->action = 'set_delete') {
while ($res = $cms->db_return($q)) {
$q_del = "DELETE FROM ".PUBLIC_SCHEMA.".file WHERE file_uid = '".$res['pkid'].'"';
$cms->db_exec($q_del);
@unlink(ROOT.MEDIA.$cms->data_path[$res['type']].PUBLIC_SCHEMA."_".$res['file_uid']);
@unlink(BASE.MEDIA.$cms->data_path[$res['type']].PUBLIC_SCHEMA."_".$res['file_uid']);
}
$q = "DELETE FROM ".LOGIN_DB_SCHEMA.".set_live WHERE table_name = '".$cms->page_name."' AND delete_flag = 't'";
$cms->db_exec($q);

View File

@@ -1 +0,0 @@
../log/

View File

@@ -93,4 +93,10 @@ $cms->CONTENT_DATA = array_merge($cms->HEADER, $cms->DATA, $cms->DEBUG_DATA);
while (list($key, $value) = each($cms->CONTENT_DATA)) {
$smarty->assign($key, $value);
}
if (is_dir(BASE.TEMPLATES_C)) {
$smarty->setCompileDir(BASE.TEMPLATES_C);
}
if (is_dir(BASE.CACHE)) {
$smarty->setCacheDir(BASE.CACHE);
}
$smarty->display($MASTER_TEMPLATE_NAME, $TEMPLATE.$lang, $TEMPLATE.$lang);

View File

@@ -1 +0,0 @@
../templates_c/

View File

@@ -1 +0,0 @@
../tmp/