From 736415e939a7a904085085d4318bba9ec53b9ece Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 12 Oct 2018 10:42:26 +0900 Subject: [PATCH] Master update of include files First step to clean up all files that are not mandatory for outside access * move all header/footer/smarty/set_paths/config files (inc) into includes/ folder * generate basic config.php that JUST loads the config.inc file (search) * config.inc file has sub sections for db access arrays and host configs, so config.inc is more static * Also move edit base and template arrays to the include folder * move the language po files to the 4dev folder as they do not need to sit outside * remove not maintained "files.php" TODO: split out templates and language files into external layout group perhaps drop the whole sub template include path thing as this is actually never really used and more annoying to maintain eg: layout/frontend/default/ -> layout/frontend eg: layout/fronend/default/template -> includes/frontend/template Also check splitting out the NOT define parts of the config.inc file G_TITLE, EDIT_STYLESHEET, EDIT_JAVASCRIPT, STYLESHEET, JAVASCRIPT to default define? --- .../lang/admin}/messages_en_utf8.po | 0 .../lang/admin}/messages_ja_utf8.po | 0 www/admin/.htaccess | 10 +- www/admin/class_test.php | 3 +- www/admin/config.inc | 1 - www/admin/config.php | 25 + www/admin/edit_access.php | 2 +- www/admin/edit_groups.php | 2 +- www/admin/edit_languages.php | 2 +- www/admin/edit_menu_group.php | 2 +- www/admin/edit_order.php | 2 +- www/admin/edit_pages.php | 2 +- www/admin/edit_schemes.php | 2 +- www/admin/edit_users.php | 2 +- www/admin/edit_visible_group.php | 2 +- www/admin/files.php | 480 ------------------ www/admin/namespace_test.php | 2 +- www/admin/qq_file_upload_ajax.php | 2 +- www/admin/qq_file_upload_front.php | 2 +- www/admin/smarty_test.php | 10 +- www/admin/various_class_test.php | 7 +- www/configs/config.db.inc | 25 + www/configs/config.host.inc | 33 ++ www/configs/config.template.inc | 176 ++++--- www/{admin => }/includes/Date.Vars.inc | 0 .../footer.inc => includes/admin_footer.inc} | 0 .../header.inc => includes/admin_header.inc} | 3 +- .../admin_set_paths.inc} | 28 +- .../smarty.inc => includes/admin_smarty.inc} | 0 www/{admin => includes}/edit_base.inc | 2 +- .../table_arrays/array_edit_access.inc | 0 .../table_arrays/array_edit_groups.inc | 0 .../table_arrays/array_edit_languages.inc | 0 .../table_arrays/array_edit_menu_group.inc | 0 .../table_arrays/array_edit_pages.inc | 0 .../table_arrays/array_edit_schemes.inc | 0 .../table_arrays/array_edit_users.inc | 0 .../table_arrays/array_edit_visible_group.inc | 0 www/layout/admin/default/cache/index.php | 0 www/layout/admin/default/css/index.php | 0 www/layout/admin/default/images/index.php | 0 www/layout/admin/default/index.php | 0 www/layout/admin/default/javascript/index.php | 0 www/layout/admin/index.php | 0 www/layout/frontend/default/cache/index.php | 0 www/layout/frontend/default/css/index.php | 0 www/layout/frontend/default/images/index.php | 0 www/layout/frontend/default/index.php | 0 .../frontend/default/javascript/index.php | 0 www/layout/frontend/index.php | 0 www/lib/CoreLibs/Output/Form/Generate.inc | 7 +- 51 files changed, 241 insertions(+), 593 deletions(-) rename {www/layout/admin/default/lang => 4dev/lang/admin}/messages_en_utf8.po (100%) rename {www/layout/admin/default/lang => 4dev/lang/admin}/messages_ja_utf8.po (100%) delete mode 120000 www/admin/config.inc create mode 100755 www/admin/config.php delete mode 100644 www/admin/files.php mode change 100644 => 100755 www/admin/smarty_test.php create mode 100755 www/configs/config.db.inc create mode 100755 www/configs/config.host.inc rename www/{admin => }/includes/Date.Vars.inc (100%) rename www/{admin/footer.inc => includes/admin_footer.inc} (100%) rename www/{admin/header.inc => includes/admin_header.inc} (98%) rename www/{admin/set_paths.inc => includes/admin_set_paths.inc} (89%) rename www/{admin/smarty.inc => includes/admin_smarty.inc} (100%) rename www/{admin => includes}/edit_base.inc (99%) rename www/{admin => includes}/table_arrays/array_edit_access.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_groups.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_languages.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_menu_group.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_pages.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_schemes.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_users.inc (100%) rename www/{admin => includes}/table_arrays/array_edit_visible_group.inc (100%) create mode 100644 www/layout/admin/default/cache/index.php create mode 100644 www/layout/admin/default/css/index.php create mode 100644 www/layout/admin/default/images/index.php create mode 100644 www/layout/admin/default/index.php create mode 100644 www/layout/admin/default/javascript/index.php create mode 100644 www/layout/admin/index.php create mode 100644 www/layout/frontend/default/cache/index.php create mode 100644 www/layout/frontend/default/css/index.php create mode 100644 www/layout/frontend/default/images/index.php create mode 100644 www/layout/frontend/default/index.php create mode 100644 www/layout/frontend/default/javascript/index.php create mode 100644 www/layout/frontend/index.php diff --git a/www/layout/admin/default/lang/messages_en_utf8.po b/4dev/lang/admin/messages_en_utf8.po similarity index 100% rename from www/layout/admin/default/lang/messages_en_utf8.po rename to 4dev/lang/admin/messages_en_utf8.po diff --git a/www/layout/admin/default/lang/messages_ja_utf8.po b/4dev/lang/admin/messages_ja_utf8.po similarity index 100% rename from www/layout/admin/default/lang/messages_ja_utf8.po rename to 4dev/lang/admin/messages_ja_utf8.po diff --git a/www/admin/.htaccess b/www/admin/.htaccess index 29a2476a..8cd4a9dd 100644 --- a/www/admin/.htaccess +++ b/www/admin/.htaccess @@ -1,3 +1,7 @@ -php_value xdebug.profiler_output_dir /home/developer/html/adidas/20081208_catalogue/4dev/xdebug/ -php_value xdebug.profiler_output_name timestamp -php_value xdebug.profiler_enable 0 +# php_value xdebug.profiler_output_dir /home/developer/xdebug/ +# php_value xdebug.profiler_output_name timestamp +# php_value xdebug.profiler_enable 0 +# all .inc files are denied access from outside + + Require all denied + diff --git a/www/admin/class_test.php b/www/admin/class_test.php index ccbd6349..3a95e779 100644 --- a/www/admin/class_test.php +++ b/www/admin/class_test.php @@ -14,7 +14,8 @@ ob_start(); // basic class test file define('USE_DATABASE', true); // sample config -require("config.inc"); +// require("config.inc"); +require 'config.php'; // set session name if (!defined('SET_SESSION_NAME')) { DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME); diff --git a/www/admin/config.inc b/www/admin/config.inc deleted file mode 120000 index 1e502521..00000000 --- a/www/admin/config.inc +++ /dev/null @@ -1 +0,0 @@ -../configs/config.inc \ No newline at end of file diff --git a/www/admin/config.php b/www/admin/config.php new file mode 100755 index 00000000..0ddfd8a0 --- /dev/null +++ b/www/admin/config.php @@ -0,0 +1,25 @@ + includes master config +* HISTORY: +*********************************************************************/ + +define('CONFIG_PATH', 'configs'.DIRECTORY_SEPARATOR); +// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail +$CONFIG_PATH_PREFIX = ''; +for ($dir_pos = 0, $dir_max = count(explode('/', __DIR__)); $dir_pos <= $dir_max; $dir_pos ++) { + $CONFIG_PATH_PREFIX .= '..'.DIRECTORY_SEPARATOR; + if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc')) { + require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc'; + break; + } +} +// fail if no base DS is not set +if (!defined('DS')) { + exit('Base config unloadable'); +} + +// __END__ diff --git a/www/admin/edit_access.php b/www/admin/edit_access.php index a49144bd..f5399662 120000 --- a/www/admin/edit_access.php +++ b/www/admin/edit_access.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_groups.php b/www/admin/edit_groups.php index a49144bd..f5399662 120000 --- a/www/admin/edit_groups.php +++ b/www/admin/edit_groups.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_languages.php b/www/admin/edit_languages.php index a49144bd..f5399662 120000 --- a/www/admin/edit_languages.php +++ b/www/admin/edit_languages.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_menu_group.php b/www/admin/edit_menu_group.php index a49144bd..f5399662 120000 --- a/www/admin/edit_menu_group.php +++ b/www/admin/edit_menu_group.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_order.php b/www/admin/edit_order.php index ec0b4543..2238fea1 100644 --- a/www/admin/edit_order.php +++ b/www/admin/edit_order.php @@ -16,7 +16,7 @@ $DB_DEBUG = 1; extract($_GET, EXTR_SKIP); extract($_POST, EXTR_SKIP); -include("config.inc"); +require 'config.php'; // set session name define('SET_SESSION_NAME', EDIT_SESSION_NAME); // overrride debug flags diff --git a/www/admin/edit_pages.php b/www/admin/edit_pages.php index a49144bd..f5399662 120000 --- a/www/admin/edit_pages.php +++ b/www/admin/edit_pages.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_schemes.php b/www/admin/edit_schemes.php index a49144bd..f5399662 120000 --- a/www/admin/edit_schemes.php +++ b/www/admin/edit_schemes.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_users.php b/www/admin/edit_users.php index a49144bd..f5399662 120000 --- a/www/admin/edit_users.php +++ b/www/admin/edit_users.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/edit_visible_group.php b/www/admin/edit_visible_group.php index a49144bd..f5399662 120000 --- a/www/admin/edit_visible_group.php +++ b/www/admin/edit_visible_group.php @@ -1 +1 @@ -edit_base.inc \ No newline at end of file +../includes/edit_base.inc \ No newline at end of file diff --git a/www/admin/files.php b/www/admin/files.php deleted file mode 100644 index eee8c14b..00000000 --- a/www/admin/files.php +++ /dev/null @@ -1,480 +0,0 @@ -user_unit); - -// yes no list (online) -$yesno_list['f'] = 'No'; -$yesno_list['t'] = 'Yes'; -// order list -$sort_order_list['date_created'] = 'ID / Insert time'; // default -$sort_order_list['file_name'] = 'File Name'; -$sort_order_list['file_size'] = 'File Size'; -$sort_order_list['mime_type'] = 'Mime Type'; -$sort_order_list['name_en'] = 'Alt Name English'; -$sort_order_list['name_ja'] = 'Alt Name Japanese'; -$sort_order_list['date_updated'] = 'Updated'; -if (!$sort_order) { - $sort_order = 'date_created'; -} -$sort_direction_list['ASC'] = 'Normal'; -$sort_direction_list['DESC'] = 'Reverse'; -if (!$sort_direction) { - $sort_direction = 'ASC'; -} -// set if we need to write to any of the set live queues -// a) on page save with set_live -// b) global page with live_queue -// set via QUEUE variable - -// create 0 entries for: templates, menu, data_group? -if ($cms->action == 'new' && $cms->action_yes == 'true') { - unset($file_uid); - unset($file_id); - unset($file_type); - $new_okay = 1; -} -// file type: P picture, M mouse over picutre, F flash, V video, B binary -if ($cms->action == 'save') { - if (!$file_type) { - $file_type = 'B'; - } - $file_ok = false; - if (!$_FILES['file_up']['name'] && !$file_uid) { - $cms->messages[] = array('msg' => 'No file name given', 'class' => 'error'); - $error = 1; - } - if (!$_FILES['file_up']['name'] && $file_uid) { - $file_ok = true; - } - // echo "FILE TYPE: ".$_FILES['file_up']['type']."
"; - foreach (split(',', $show_type) as $_show_type) { - // check if the uploaded filename matches to the given type - if ($_FILES['file_up']['name'] && preg_match("/jpeg|png|gif/", $_FILES['file_up']['type']) && preg_match("/P/", $show_type)) { - $file_ok = true; - } - if ($_FILES['file_up']['name'] && preg_match("/swf/", $_FILES['file_up']['type']) && preg_match("/F/", $show_type)) { - $file_ok = true; - } - if ($_FILES['file_up']['name'] && preg_match("/video/", $_FILES['file_up']['type']) && preg_match("/V/", $show_type)) { - $file_ok = true; - } - if ($_FILES['file_up']['name'] && preg_match("/msword|vnd.oasis.opendocument.text/", $_FILES['file_up']['type']) && preg_match("/D/", $show_type)) { - $file_ok = true; - } - if ($_FILES['file_up']['name'] && preg_match("/pdf/", $_FILES['file_up']['type']) && preg_match("/A/", $show_type)) { - $file_ok = true; - } - if ($_FILES['file_up']['name'] && preg_match("/B/", $show_type)) { - $file_ok = true; - } - } - // write out error messages according to show type - if (!$file_ok) { - if (preg_match("/P/", $show_type)) { - $cms->messages[] = array('msg' => 'File is not a JPEG/PNG/GIF file', 'class' => 'error'); - $error = 1; - } - if (preg_match("/F/", $show_type)) { - $cms->messages[] = array('msg' => 'File is not a Flash File', 'class' => 'error'); - $error = 1; - } - if (preg_match("/V/", $show_type)) { - $cms->messages[] = array('msg' => 'File is not a Video', 'class' => 'error'); - $error = 1; - } - if (preg_match("/D/", $show_type)) { - $cms->messages[] = array('msg' => 'File is not a DOC/ODT file', 'class' => 'error'); - $error = 1; - } - if (preg_match("/A/", $show_type)) { - $cms->messages[] = array('msg' => 'File is not a PDF file', 'class' => 'error'); - $error = 1; - } - if (preg_match("/B/", $show_type)) { - $cms->messages[] = array('msg' => 'No valid file was given', 'class' => 'error'); - $error = 1; - } - } - // binary: all okay - // if no error, save data - if (!$error) { - if ($_FILES['file_up']['name']) { - $mime_type = $_FILES['file_up']['type']; - $file_size = $_FILES['file_up']['size']; - $file_name = $_FILES['file_up']['name']; - // get picture size - list($width, $height) = getimagesize($_FILES['file_up']['tmp_name']); - $cms->debug('upload', "Width: $width X Height: $height"); - // set the file type and the target folder - if (preg_match("/jpeg|png|gif/", $mime_type)) { - $file_type = 'P'; - } elseif (preg_match("/swf/", $mime_type)) { - $file_type = 'F'; - } elseif (preg_match("/video/", $mime_type)) { - $file_type = 'V'; - } elseif (preg_match("/msword|vnd.oasis.opendocument.text/", $mime_type)) { - $file_type = 'D'; - } elseif (preg_match("/pdf/", $mime_type)) { - $file_type = 'A'; - } elseif ($mime_type) { - $file_type = 'B'; - } - } - // if we have an id -> updated - if ($file_uid) { - $q = "UPDATE file SET"; - $q_set = " name_en = '".addslashes($name_en)."', name_ja = '".addslashes($name_ja)."', file_name = '".addslashes($file_name)."', online = '".$online."' "; - if ($_FILES['file_up']['name']) { - $q_set .= ", type = '".$file_type."', mime_type = '$mime_type', file_size = $file_size, size_x = $width, size_y = $height "; - } - $q .= $q_set."WHERE file_uid = '".$file_uid."'"; - $cms->db_exec($q); - if (QUEUE == 'live_queue') { - $sql_action = 'UPDATE'; - $sql_data = $q_set; - } - } else { - // insert new data - $file_uid = md5(uniqid(rand(), true)); - $q = "INSERT INTO file (name_en, name_ja, file_name, online, mime_type, file_size, size_x, size_y, file_uid, type) VALUES ("; - $q .= "'".addslashes($name_en)."', '".addslashes($name_ja)."', '".addslashes($file_name)."', '".$online."', '".$mime_type."', "; - $q .= "$file_size, ".(($width) ? $width : 'NULL').", ".(($height) ? $height : 'NULL').", '".$file_uid."', '".$file_type."')"; - $cms->db_exec($q); - $file_id = $cms->insert_id; - // if queue - if (QUEUE == 'live_queue') { - $sql_data = $q; - $sql_action = 'INSERT'; - } - } - $size_x = $width; - $size_y = $height; - $file = DEV_SCHEMA."_".$file_uid; - // now upload the file - if ($_FILES['file_up']['name']) { - $upload_file = BASE.MEDIA.$cms->data_path[$file_type].$file; - // wipe out any old tmp data for this new upload - if (is_array(glob(BASE.TMP."thumb_".$file."*"))) { - foreach (glob(BASE.TMP."thumb_".$file."*") as $filename) { - @unlink($filename); - } - } - # copy file to correct path - $error = move_uploaded_file($_FILES['file_up']['tmp_name'], $upload_file); - - $cms->debug('file_upload', "UP: $upload_file"); - $cms->debug('file_upload', "Orig: ".$cms->printAr($_FILES['file_up'])); - - // because I get bogus error info from move_uploaded_file ... - $error = 0; - if ($error) { - $cms->debug('file_upload', "ERROR: $error | INI FSize: ".ini_get("upload_max_filesize")); - $cms->messages[] = array('msg' => 'File upload failed', 'class' => 'error'); - $q = "DELETE FROM file WHERE file_uid = '".$file_uid."'"; - $cms->db_exec($q); - unset($file_id); - unset($file_uid); - $view = 'list'; - } else { - $cms->messages[] = array('msg' => 'File upload successful', 'class' => 'warning'); - // $view = 'list'; - } - } // if file upload - // create thumbs + file size - $picture = $cms->cache_pictures.$cms->adbCreateThumbnail($file, 400, 280, $file_type, '', $cms->cache_pictures_root); - $picture_small = $cms->cache_pictures.$cms->adbCreateThumbnail($file, 80, 60, $file_type, '', $cms->cache_pictures_root); - $file_size = $cms->adbByteStringFormat($file_size); - // for live queue this is here needed - if (QUEUE == 'live_queue') { - $q = "INSERT INTO ".GLOBAL_DB_SCHEMA.".live_queue (queue_key, key_value, key_name, type, target, data, group_key, action"; - if ($_FILES['file_up']['name']) { - $q .= ", file"; - } - $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 .= ", '".BASE.MEDIA.$cms->data_path[$file_type].$file."#".BASE.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."'"; - } - $q .= ")"; - $cms->db_exec($q); - } - } // if not error -} -if ($cms->action == 'delete' && $cms->action_yes == 'true') { - $file_uid = $cms->action_id; - $q = "SELECT type FROM file WHERE file_uid = '".$file_uid."'"; - list ($file_type) = $cms->db_return_row($q); - // get the file type for the file path - $q = "DELETE FROM file WHERE file_uid = '".$file_uid."'"; - $cms->db_exec($q); - if (QUEUE == 'set_live') { - $q = "INSERT INTO ".GLOBAL_DB_SCHEMA.".set_live (table_name, pkid, delete_flag) VALUES ('".$cms->page_name."', ".$file_uid.", 't')"; - $cms->db_exec($q); - } - 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."', '". - $q .= BASE.MEDIA.$cms->data_path[$file_type].PUBLIC_SCHEMA."_".$file_uid."')"; - } - @unlink(BASE.MEDIA.$cms->data_path[$file_type].DEV_SCHEMA."_".$file_uid); - // wipe out any old cache data for this new upload - if (is_array(glob($cms->cache_pictures."thumb_".TEST_SCHEMA."_".$file_uid."*"))) { - foreach (glob($cms->cache_pictures."thumb_".TEST_SCHEMA."_".$file_uid."*") as $filename) { - @unlink($filename); - } - } - unset($file_uid); - unset($file_id); - $delete_done = 1; - $view = 'list'; -} -if ($cms->action == 'load') { - $file_uid = $cms->action_id; - // load the data - $q = "SELECT file_id, name_en, name_ja, file_name, online, mime_type, file_size, size_x, size_y, type FROM file WHERE file_uid = '".$file_uid."'"; - list($file_id, $name_en, $name_ja, $file_name, $online, $mime_type, $file_size, $size_x, $size_y, $file_type) = $cms->db_return_row($q); - // create thumbnail for edit view - $file = DEV_SCHEMA."_".$file_uid; - // thumbnails are only valid for pictures - $picture = $cms->cache_pictures.$cms->adbCreateThumbnail($file, 400, 280, $file_type, '', $cms->cache_pictures_root); - $picture_small = $cms->cache_pictures.$cms->adbCreateThumbnail($file, 80, 60, $file_type, '', $cms->cache_pictures_root); - $file_size = $cms->adbByteStringFormat($file_size); - // view to edit - $view = 'edit'; -} -if ($cms->action == 'add_new') { - $view = 'edit'; -} -if ($cms->action == 'view_files' && $cms->action_yes == 'true') { - $view = 'list'; -} -// set delete live -if ($cms->action_flag == 'set_live' && $cms->action = 'set_delete') { - $q = "SELECT file_uid, pkid, type FROM ".LOGIN_DB_SCHEMA.".set_live sl, file f WHERE sl.pkid = f.file_uid table_name = '".$cms->page_name."' AND delete_flag = 't'"; - while ($res = $cms->db_return($q)) { - $q_del = "DELETE FROM ".PUBLIC_SCHEMA.".file WHERE file_uid = '".$res['pkid'].'"'; - $cms->db_exec($q_del); - @unlink(BASE.MEDIA.$cms->data_path[$res['type']].PUBLIC_SCHEMA."_".$res['file_uid']); - // wipe out any old cache data for this new upload - if (is_array(glob($cms->cache_pictures."thumb_".LIVE_SCHEMA."_".$file_uid."*"))) { - foreach (glob($cms->cache_pictures."thumb_".LIVE_SCHEMA."_".$file_uid."*") as $filename) { - @unlink($filename); - } - } - } - $q = "DELETE FROM ".LOGIN_DB_SCHEMA.".set_live WHERE table_name = '".$cms->page_name."' AND delete_flag = 't'"; - $cms->db_exec($q); -} -if (DEV_SCHEMA != PUBLIC_SCHEMA) { - // read out possible deleted, to add "delete from live" - $q = "SELECT pkid FROM ".LOGIN_DB_SCHEMA.".set_live WHERE table_name = '".$cms->page_name."' AND delete_flag = 't'"; - if ($cms->access_rights['base_acl'] < 90) { - $q .= "AND edit_access_id IN (".join(',', $edit_access_ids).") "; - } - while ($res = $cms->db_return($q, 3)) { - $cms->DATA['set_delete'][]['pkid'] = $res['pkid']; - } -} -// get th max entries -$q = "SELECT COUNT(file_uid) FROM file "; -$q_search_where = "WHERE "; -// only for current edit_access id, unless it is an admin user, then he can see all of them -if ($cms->access_rights['base_acl'] < 90) { - $q_search_where .= "edit_access_id IN (".join(',', $edit_access_ids).") AND "; -} -$q_search_where .= "type in ('".str_replace(',', "','", $show_type)."') "; -if ($search_what) { - $q_search_where .= "AND LOWER(name_en) LIKE '%".addslashes(strtolower($search_what))."%' OR name_ja LIKE '%".addslashes($search_what)."%' OR LOWER(file_name) LIKE '%".addslashes(strtolower($search_what))."%' "; -} -$q .= $q_search_where; -// get selection from show_type -list ($file_count) = $cms->db_return_row($q); - -if ($cms->action == 'browse') { - // browse in the list of data - switch ($cms->action_id) { - case "<<<<": - $start_row = 0; - break; - case "<": - $start_row -= $show_amount; - break; - case ">": - $start_row += $show_amount; - break; - case ">>>>": - $start_row = $file_count - $show_amount; - break; - case "gopage": - // for page is page -1, so page 1 start from 0, etc - $start_row = ((($cms->action_value - 1) > 0) ? ($cms->action_value - 1) * $show_amount : 0); - $current_page = $cms->action_value; - break; - } -} - -// check overflow -if ($start_row < 0) { - $start_row = 0; -} -if ($start_row > $file_count) { - $start_row = $file_count - $show_amount; -} - -// if we have a "fresh_load" -if ($fresh_load) { - $count = 1; - $q = "SELECT file_uid FROM file "; - if ($q_search_where) { - $q .= $q_search_where; - } - $q .= "ORDER BY ".$sort_order." ".$sort_direction." "; - while ($res = $cms->db_return($q)) { - // if data_id is set and not file_id, go to the page where the current highlight is, but only if this is a "virgin" load of the page - if ($data_id && ($data_id == $res['file_uid'])) { - $current_page = floor(($count / $show_amount)); - $start_row = $current_page * $show_amount; - $current_page ++; - } - $count ++; - } -} - -// page forward/back buttons settings -if ($start_row > 0) { - $cms->DATA['show_back'] = 1; -} -$cms->DATA['page_number'] = ceil($start_row / $show_amount) + 1; -$cms->DATA['page_count'] = ceil($file_count / $show_amount); -if ($cms->DATA['page_count'] > 2 && !$current_page) { - $current_page = 1; -} -if (($start_row + $show_amount) < $file_count) { - $cms->DATA['show_forward'] = 1; -} - -$q = "SELECT file_id, name_en, name_ja, file_name, online, mime_type, file_size, size_x, size_y, file_uid, type FROM file "; -// if search what, search in name_en, name_ja, file_name for the string -if ($q_search_where) { - $q .= $q_search_where; -} -$q .= "ORDER BY ".$sort_order." ".$sort_direction." "; -$q .= "LIMIT ".$show_amount." OFFSET ".$start_row; -while ($res = $cms->db_return($q)) { - $data_files[] = array ( - 'id' => $res['file_id'], - 'name_en' => $res['name_en'], - 'name_ja' => $res['name_ja'], - 'file_name' => $res['file_name'], - 'online' => $res['online'], - 'mime_type' => $res['mime_type'], - 'file_size' => $cms->adbByteStringFormat($res['file_size']), - 'size_x' => $res['size_x'], - 'size_y' => $res['size_y'], - 'file_uid' => $res['file_uid'], - 'file_type' => $res['type'], - 'picture' => $cms->cache_pictures.$cms->adbCreateThumbnail(DEV_SCHEMA.'_'.$res['file_uid'], 80, 60, $res['type'], '', $cms->cache_pictures_root) - ); -} - -$cms->DATA['show_type'] = $show_type; -$cms->DATA['data_files'] = $data_files; -$cms->DATA['view'] = $view; -$cms->DATA['images_path'] = MEDIA.$cms->data_path[$file_type]; -// get vars for position (only when) -$cms->DATA['form_name'] = $form_name; -$cms->DATA['value_name'] = $value_name; -$cms->DATA['file_id'] = $file_id; -$cms->DATA['file_uid'] = $file_uid; - -// write back all the other vars -if (!($delete_done || $new_okay)) { - // data name - $cms->DATA['file_name'] = $file_name; - $cms->DATA['name_en'] = $name_en; - $cms->DATA['name_ja'] = $name_ja; - $cms->DATA['mime_type'] = $mime_type; - $cms->DATA['file_size'] = $file_size; - $cms->DATA['size_x'] = $size_x; - $cms->DATA['size_y'] = $size_y; - $cms->DATA['online'] = $online; - $cms->DATA['picture'] = $picture; - $cms->DATA['picture_small'] = $picture_small; - $cms->DATA['file_type'] = $file_type; -} -$cms->DATA['sort_order_list'] = $sort_order_list; -$cms->DATA['sort_order'] = $sort_order; -$cms->DATA['sort_direction_list'] = $sort_direction_list; -$cms->DATA['sort_direction'] = $sort_direction; -$cms->DATA['search_what'] = $search_what; -$cms->DATA['current_page'] = $current_page; -$cms->DATA['yesno_list'] = $yesno_list; -$cms->DATA['start_row'] = $start_row; -$cms->DATA['show_amount'] = $show_amount; -if ($data_id) { - $cms->DATA['data_id'] = $data_id; -} -$cms->DATA['top'] = 0; -$cms->DATA['left'] = 0; - -//------------------------------ processing data end - -//------------------------------ smarty start -require("smarty.inc"); -//------------------------------ smarty end - -//------------------------------ footer -require("footer.inc"); -//------------------------------ footer diff --git a/www/admin/namespace_test.php b/www/admin/namespace_test.php index 6e11a07e..b60c314a 100755 --- a/www/admin/namespace_test.php +++ b/www/admin/namespace_test.php @@ -11,7 +11,7 @@ $DB_DEBUG = 1; ob_start(); // admin class tests -require 'config.inc' ; +require 'config.php'; DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME); echo "DIR: ".DIR."
ROOT: ".ROOT."
BASE: ".BASE."
"; diff --git a/www/admin/qq_file_upload_ajax.php b/www/admin/qq_file_upload_ajax.php index efdfad02..f3f71c7d 100755 --- a/www/admin/qq_file_upload_ajax.php +++ b/www/admin/qq_file_upload_ajax.php @@ -5,7 +5,7 @@ $ECHO_ALL = 0; $PRINT_ALL = 1; // load the Basic && qq file uploader here -require 'config.inc'; +require 'config.php'; // class load $base = new CoreLibs\Basic(); $base->debug('AJAX UPLOAD', 'START Backend'); diff --git a/www/admin/qq_file_upload_front.php b/www/admin/qq_file_upload_front.php index 6d7019a9..cbb5eb3e 100755 --- a/www/admin/qq_file_upload_front.php +++ b/www/admin/qq_file_upload_front.php @@ -6,7 +6,7 @@ $PRINT_ALL = 1; // test file for qqFileUploader (HTML side) // load the Basic class here -require 'config.inc'; +require 'config.php'; $base = new CoreLibs\Basic(); // set max upload size $MAX_UPLOAD_SIZE = $base->StringByteFormat(ini_get('upload_max_filesize')); diff --git a/www/admin/smarty_test.php b/www/admin/smarty_test.php old mode 100644 new mode 100755 index 702843f0..4300de3f --- a/www/admin/smarty_test.php +++ b/www/admin/smarty_test.php @@ -7,14 +7,16 @@ $DB_DEBUG = 1; $LOG_PER_RUN = 1; define('USE_DATABASE', true); -require("header.inc"); +define('USE_HEADER', true); +require 'config.php'; +require BASE.INCLUDES.'admin_header.inc'; $MASTER_TEMPLATE_NAME = 'main_body.tpl'; $TEMPLATE_NAME = 'smarty_test.tpl'; $PAGE_WIDTH = 750; -require("set_paths.inc"); +require BASE.INCLUDES.'admin_set_paths.inc'; // smarty test $cms->DATA['SMARTY_TEST'] = 'Test Data'; -require("smarty.inc"); -require("footer.inc"); +require BASE.INCLUDES.'admin_smarty.inc'; +require BASE.INCLUDES.'admin_footer.inc'; diff --git a/www/admin/various_class_test.php b/www/admin/various_class_test.php index 078d4de1..4446af68 100755 --- a/www/admin/various_class_test.php +++ b/www/admin/various_class_test.php @@ -6,11 +6,16 @@ $PRINT_ALL = 1; $DB_DEBUG = 1; // admin class tests -require 'config.inc' ; +// require 'config.inc'; +require 'config.php'; DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME); $base = new CoreLibs\Basic(); print "THIS HOST: ".HOST_NAME.", with PROTOCOL: ".HOST_PROTOCOL." is running SSL: ".HOST_SSL."
"; +print "DIR: ".DIR."
"; +print "BASE: ".BASE."
"; +print "ROOT: ".ROOT."
"; +print "HOST: ".$HOST_NAME." => DB HOST: ".$DB_HOST[$HOST_NAME]." => ".MAIN_DB."
"; // $test = array ( // 'A' => array ( diff --git a/www/configs/config.db.inc b/www/configs/config.db.inc new file mode 100755 index 00000000..02a97bf5 --- /dev/null +++ b/www/configs/config.db.inc @@ -0,0 +1,25 @@ + array ( + 'db_name' => 'gullevek', + 'db_user' => 'gullevek', + 'db_pass' => 'gullevek', + 'db_host' => 'db.tokyo.tequila.jp', + 'db_port' => '5432', + 'db_schema' => 'public', + 'db_type' => 'pgsql', + 'db_encoding' => '', + 'db_ssl' => 'disable' // allow, disable, require, prefer + ) +); + +// __END__ diff --git a/www/configs/config.host.inc b/www/configs/config.host.inc new file mode 100755 index 00000000..1bf91ae0 --- /dev/null +++ b/www/configs/config.host.inc @@ -0,0 +1,33 @@ +'; +// url redirect database +// $DB_URL_REDIRECT_HOST['soba'] = ''; +// location flagging +// test/dev/live +$LOCATION['soba.tokyo.tequila.jp'] = 'test'; +// show DEBUG override +// true/false +$DEBUG_FLAG['soba.tokyo.tequila.jp'] = true; +// set postgresql paths (schemas) +$DB_PATH['soba.tokyo.tequila.jp'] = PUBLIC_SCHEMA; +// site language +$SITE_LANG['soba.tokyo.tequila.jp'] = 'en_utf8'; + +// __END__ diff --git a/www/configs/config.template.inc b/www/configs/config.template.inc index 3f894dc4..5b9ed941 100644 --- a/www/configs/config.template.inc +++ b/www/configs/config.template.inc @@ -8,17 +8,19 @@ *********************************************************************/ /************* SESSION NAMES *************/ +// server name HASH +DEFINE('SERVER_NAME_HASH', hash('crc32b', $_SERVER['HTTP_HOST'])); // backend -DEFINE('EDIT_SESSION_NAME', ""); +DEFINE('EDIT_SESSION_NAME', ''.SERVER_NAME_HASH); // frontend -DEFINE('SESSION_NAME', ""); -// set the session name -define('SET_SESSION_NAME', EDIT_SESSION_NAME); +DEFINE('SESSION_NAME', ''.SERVER_NAME_HASH); +// SET_SESSION_NAME should be set in the header if a special session name is needed +// DEFINE('SET_SESSION_NAME', SESSION_NAME); /************* LANGUAGE / ENCODING *******/ -DEFINE('DEFAULT_LANG', "en_utf8"); +DEFINE('DEFAULT_LANG', 'en_utf8'); // default web page encoding setting -DEFINE('DEFAULT_ENCODING', "UTF-8"); +DEFINE('DEFAULT_ENCODING', 'UTF-8'); /************* PATHS *********************/ // directory seperator @@ -35,56 +37,58 @@ DEFINE('ROOT', getcwd().DS); // libs path DEFINE('LIB', 'lib'.DS); DEFINE('LIBS', 'lib'.DS); +// configs folder +DEFINE('CONFIGS', 'configs'.DS); // includes (strings, arrays for static, etc) DEFINE('INCLUDES', 'includes'.DS); // layout base path DEFINE('LAYOUT', 'layout'.DS); // pic-root (compatible to CMS) -DEFINE('PICTURES', "images".DS); +DEFINE('PICTURES', 'images'.DS); // images -DEFINE('IMAGES', "images".DS); +DEFINE('IMAGES', 'images'.DS); // icons (below the images/ folder) DEFINE('ICONS', 'icons'.DS); // media -DEFINE('MEDIA', "media".DS); +DEFINE('MEDIA', 'media'.DS); // flash-root (below media) -DEFINE('FLASH', "flash".DS); +DEFINE('FLASH', 'flash'.DS); // uploads (anything to keep) -DEFINE('UPLOADS', "uploads".DS); +DEFINE('UPLOADS', 'uploads'.DS); // files (binaries) (below media) -DEFINE('BINARIES', "binaries".DS); +DEFINE('BINARIES', 'binaries'.DS); // files (videos) (below media) -DEFINE('VIDEOS', "videos".DS); +DEFINE('VIDEOS', 'videos'.DS); // files (documents) (below media) -DEFINE('DOCUMENTS', "documents".DS); +DEFINE('DOCUMENTS', 'documents'.DS); // files (pdfs) (below media) -DEFINE('PDFS', "documents".DS); +DEFINE('PDFS', 'documents'.DS); // CSV DEFINE('CSV', 'csv'.DS); // css -DEFINE('CSS', "css".DS); +DEFINE('CSS', 'css'.DS); // js -DEFINE('JS', "javascript".DS); +DEFINE('JS', 'javascript'.DS); // table arrays -DEFINE('TABLE_ARRAYS', "table_arrays".DS); +DEFINE('TABLE_ARRAYS', 'table_arrays'.DS); // smarty libs path -DEFINE('SMARTY', "Smarty".DS); +DEFINE('SMARTY', 'Smarty'.DS); // po langs -DEFINE('LANG', "lang".DS); +DEFINE('LANG', 'lang'.DS); // cache path -DEFINE('CACHE', "cache".DS); +DEFINE('CACHE', 'cache'.DS); // temp path -DEFINE('TMP', "tmp".DS); +DEFINE('TMP', 'tmp'.DS); // log files DEFINE('LOG', 'log'.DS); // compiled template folder DEFINE('TEMPLATES_C', 'templates_c'.DS); // template base -DEFINE('TEMPLATES', "templates".DS); +DEFINE('TEMPLATES', 'templates'.DS); // frontend template dir', only for admin -DEFINE('TEMPLATES_FRONTEND', "templates_frontend".DS); +DEFINE('TEMPLATES_FRONTEND', 'templates_frontend'.DS); // default template -DEFINE('DEFAULT_TEMPLATE', "default".DS); +DEFINE('DEFAULT_TEMPLATE', 'default'.DS); // default template file DEFINE('DEFAULT_TEMPLATE_FILE', 'default.tpl'); @@ -102,14 +106,14 @@ DEFINE('DEFAULT_ACL_SEND', 70); DEFINE('DEFAULT_ACL_DEL', 80); DEFINE('DEFAULT_ACL_ADMIN', 100); */ // SSL host name -// DEFINE('SSL_HOST', "ssl.host.name"); +// DEFINE('SSL_HOST', 'ssl.host.name'); // error page strictness, Default is 3 // 1: only show error page as the last mesure if really no mid & aid can be loaded and found at all // 2: if template not found, do not search, show error template // 3: if default template is not found, show error template, do not fall back to default tree // 4: very strict, even on normal fixable errors through error // DEFINE('ERROR_STRICT', 3); -// allow page caching in general, set to "FALSE" if you do debugging or development! +// allow page caching in general, set to 'FALSE' if you do debugging or development! // DEFINE('ALLOW_SMARTY_CACHE', FALSE); // cache life time, in seconds, default here is 2 days (172800s) // -1 is never expire cache @@ -120,6 +124,9 @@ DEFINE('DEFAULT_ACL_ADMIN', 100); */ DEFINE('LOGOUT_TARGET', ''); // password change allowed DEFINE('PASSWORD_CHANGE', false); +// min/max password length +DEFINE('PASSWORD_MIN_LENGTH', 8); +DEFINE('PASSWORD_MAX_LENGTH', 255); /************* AJAX / ACCESS *************/ // ajax request type @@ -134,6 +141,11 @@ DEFINE('PAGE_WIDTH', 800); // the default template name DEFINE('MASTER_TEMPLATE_NAME', 'main_body.tpl'); +// below two can be defined here, but they should be +// defined in either the header file or the file itself +/************* LOGGING *******************/ +// DEFINE('LOG_FILE_ID', ''); + /************* QUEUE TABLE *************/ // if we have a dev/live system // set_live is a per page/per item @@ -147,44 +159,56 @@ DEFINE('DEV_SCHEMA', 'public'); DEFINE('TEST_SCHEMA', 'public'); DEFINE('LIVE_SCHEMA', 'public'); -// non constant part -/************* DB ACCESS *****************/ -// please be VERY carefull only to change the right side -$DB_CONFIG = array ( - "" => array ( - "db_name" => "", - "db_user" => "", - "db_pass" => "", - "db_host" => "", - "db_port" => "5432", - "db_schema" => "", // if not set, uses public - "db_type" => "pgsql", - "db_encoding" => '', - "db_ssl" => 'disable' // allow, disable, require, prefer - ) -); - +/************* OTHER PATHS *****************/ // File and Folder paths // ID is TARGET (first array element) -// $PATHS["test"]["csv_path"] = ""; -// $PATHS["test"]["perl_bin"] = ""; -// $PATHS["test"]["redirect_url"] = ""; +// $PATHS['test']['csv_path'] = ''; +// $PATHS['test']['perl_bin'] = ''; +// $PATHS['test']['redirect_url'] = ''; -// each host has a different db_host -// development host -$DB_HOST[''] = ""; -// target host (live) -// $DB_TARGET_HOST[''] = ""; -// url redirect database -// $DB_URL_REDIRECT_HOST[''] = ""; -// location flagging -// test/dev/live -$LOCATION[''] = ''; -// show DEBUG override -// true/false -$DEBUG_FLAG[''] = true; -// set postgresql paths (schemas) -$DB_PATH[''] = PUBLIC_SCHEMA; +// non constant part +/************* DB ACCESS *****************/ +if (file_exists(BASE.CONFIGS.'config.db.inc')) { + require BASE.CONFIGS.'config.db.inc'; +} +// -> below in config.db.inc +// *** START *** +// // please be VERY carefull only to change the right side +// $DB_CONFIG = array ( +// '' => array ( +// 'db_name' => '', +// 'db_user' => '', +// 'db_pass' => '', +// 'db_host' => '', +// 'db_port' => '5432', +// 'db_schema' => '', // if not set, uses public +// 'db_type' => 'pgsql', +// 'db_encoding' => '', +// 'db_ssl' => 'disable' // allow, disable, require, prefer +// ) +// ); +// *** END *** +if (file_exists(BASE.CONFIGS.'config.host.inc')) { + require BASE.CONFIGS.'config.host.inc'; +} +// // -> below in config.host.inc +// *** START *** +// // each host has a different db_host +// // development host +// $DB_HOST[''] = ''; +// // target host (live) +// // $DB_TARGET_HOST[''] = ''; +// // url redirect database +// // $DB_URL_REDIRECT_HOST[''] = ''; +// // location flagging +// // test/dev/live +// $LOCATION[''] = ''; +// // show DEBUG override +// // true/false +// $DEBUG_FLAG[''] = true; +// // set postgresql paths (schemas) +// $DB_PATH[''] = PUBLIC_SCHEMA; +// *** END *** // set the USE_DATABASE var, if there is nothing set, we assume TRUE $USE_DATABASE = defined('USE_DATABASE') ? USE_DATABASE : true; @@ -192,12 +216,22 @@ $USE_DATABASE = defined('USE_DATABASE') ? USE_DATABASE : true; // live frontend pages // ** missing live domains ** // get the name without the port -list($HOST_NAME, $PORT) = array_pad(explode(":", $_SERVER['HTTP_HOST'], 2), 2, null); +list($HOST_NAME, $PORT) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null); if (!$DB_HOST[$HOST_NAME] && $USE_DATABASE) { - echo "No matching DB config found. Contact Admin
"; + echo 'No matching DB config found. Contact Admin
'; exit -1; } - +// set HOST name +DEFINE('HOST_NAME', $HOST_NAME); +// set SSL on +if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || + $_SERVER['SERVER_PORT'] == 443) { + DEFINE('HOST_SSL', true); + DEFINE('HOST_PROTOCOL', 'https://'); +} else { + DEFINE('HOST_SSL', false); + DEFINE('HOST_PROTOCOL', 'http://'); +} // define the static names DEFINE('LOGIN_DB', $DB_HOST[$HOST_NAME]); DEFINE('MAIN_DB', $DB_HOST[$HOST_NAME]); @@ -221,11 +255,11 @@ DEFINE('SHOW_ALL_ERRORS', false); // show all errors if debug_all & show_error_h $G_TITLE = ''; /************ STYLE SHEETS / JS **********/ -$EDIT_STYLESHEET = "edit.css"; -$EDIT_JAVASCRIPT = "edit.js"; +$EDIT_STYLESHEET = 'edit.css'; +$EDIT_JAVASCRIPT = 'edit.js'; -$STYLESHEET = "frontend.css"; -$JAVASCRIPT = "frontend.js"; +$STYLESHEET = 'frontend.css'; +$JAVASCRIPT = 'frontend.js'; /************* CONVERT *******************/ $paths = array ( @@ -235,9 +269,9 @@ $paths = array ( ); // find convert foreach ($paths as $path) { - if (file_exists($path."/convert") && is_file($path."/convert")) { + if (file_exists($path.'/convert') && is_file($path.'/convert')) { // image magick convert location - DEFINE('CONVERT', $path."/convert"); + DEFINE('CONVERT', $path.'/convert'); } } diff --git a/www/admin/includes/Date.Vars.inc b/www/includes/Date.Vars.inc similarity index 100% rename from www/admin/includes/Date.Vars.inc rename to www/includes/Date.Vars.inc diff --git a/www/admin/footer.inc b/www/includes/admin_footer.inc similarity index 100% rename from www/admin/footer.inc rename to www/includes/admin_footer.inc diff --git a/www/admin/header.inc b/www/includes/admin_header.inc similarity index 98% rename from www/admin/header.inc rename to www/includes/admin_header.inc index 170019ec..3be7fe5c 100644 --- a/www/admin/header.inc +++ b/www/includes/admin_header.inc @@ -10,7 +10,7 @@ //------------------------------ variable init start // for dev test we set full error reporting; writes everything, except E_ERROR into logs/php_error-.log if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) { - include("libs/Error.Handling.inc"); + include("../lib/Error.Handling.inc"); } // predefine vars $lang = ''; @@ -22,7 +22,6 @@ extract($_POST, EXTR_SKIP); //------------------------------ library include start // set output to quiet for load of classes & session settings ob_start(); -require("config.inc"); //------------------------------ library include end //------------------------------ basic variable settings start diff --git a/www/admin/set_paths.inc b/www/includes/admin_set_paths.inc similarity index 89% rename from www/admin/set_paths.inc rename to www/includes/admin_set_paths.inc index 81b9e5bb..3162bb1a 100644 --- a/www/admin/set_paths.inc +++ b/www/includes/admin_set_paths.inc @@ -55,13 +55,13 @@ $cms->CSS_SPECIAL_TEMPLATE_NAME = @$CSS_NAME; $cms->JS_SPECIAL_TEMPLATE_NAME = @$JS_NAME; // set basic template path (tmp) -$smarty->setTemplateDir(LAYOUT.$TEMPLATE_DIR.TEMPLATES); -$cms->lang_dir = LAYOUT.$TEMPLATE_DIR.LANG; -$cms->includes = LAYOUT.$TEMPLATE_DIR.INCLUDES; +$smarty->setTemplateDir(LAYOUT.$TEMPLATE_DIR.TEMPLATES); // no outside +$cms->lang_dir = LAYOUT.$TEMPLATE_DIR.LANG; // no outside +$cms->includes = BASE.INCLUDES; // no longer in templates, only global $cms->javascript = LAYOUT.$TEMPLATE_DIR.JS; $cms->css = LAYOUT.$TEMPLATE_DIR.CSS; $cms->pictures = LAYOUT.$TEMPLATE_DIR.IMAGES; -$cms->cache_pictures = LAYOUT.$TEMPLATE_DIR.CACHE.IMAGES; +$cms->cache_pictures = LAYOUT.$TEMPLATE_DIR.CACHE; $cms->cache_pictures_root = ROOT.$cms->cache_pictures; if (!is_dir($cms->cache_pictures_root)) { mkdir($cms->cache_pictures_root); @@ -80,20 +80,13 @@ if (!file_exists(ROOT.$smarty->getTemplateDir()[0].DS.MASTER_TEMPLATE_NAME)) { $smarty->setTemplateDir(LAYOUT.DEFAULT_TEMPLATE.TEMPLATES); $template_set = DEFAULT_TEMPLATE; } -// loop to check if dir exists -// check if file exists, if not reset to default path - -// check if the javascript folder exists in the template path, if not fall back to default -if (!is_dir($cms->javascript)) { - $cms->javascript = LAYOUT.DEFAULT_TEMPLATE.JS; -} // check if lang_dir folder exists in the template path, if not fall back to default if (!is_dir($cms->lang_dir)) { $cms->lang_dir = LAYOUT.DEFAULT_TEMPLATE.LANG; } -// check if include folder exists in the template path, if not fall back to default -if (!is_dir($cms->includes)) { - $cms->includes = LAYOUT.DEFAULT_TEMPLATE.INCLUDES; +// check if the javascript folder exists in the template path, if not fall back to default +if (!is_dir($cms->javascript)) { + $cms->javascript = LAYOUT.DEFAULT_TEMPLATE.JS; } // check if css folder exists in the template path, if not fall back to default if (!is_dir($cms->css)) { @@ -103,12 +96,15 @@ if (!is_dir($cms->pictures)) { $cms->pictures = LAYOUT.DEFAULT_TEMPLATE.PICTURES; } if (!is_dir($cms->cache_pictures)) { - $cms->cache_pictures = LAYOUT.DEFAULT_TEMPLATE.CACHE.IMAGES; + $cms->cache_pictures = LAYOUT.DEFAULT_TEMPLATE.CACHE; + $cms->cache_pictures_root = ROOT.$cms->cache_pictures; } // if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch // if the default lang is not like the lang given, switch lang -if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG, $lang)) { +if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || + strcasecmp(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG, $lang) +) { $cms->debug('LANG', 'Orig: '.LAYOUT.DEFAULT_TEMPLATE.LANG.', New: '.$cms->lang_dir.' | Orig Lang: '.(defined('SITE_LANG') ? SITE_LANG : DEFAULT_LANG).', New Lang: '.$lang); $cms->l->l10nReloadMOfile($lang, $cms->lang_dir); // if we have login class diff --git a/www/admin/smarty.inc b/www/includes/admin_smarty.inc similarity index 100% rename from www/admin/smarty.inc rename to www/includes/admin_smarty.inc diff --git a/www/admin/edit_base.inc b/www/includes/edit_base.inc similarity index 99% rename from www/admin/edit_base.inc rename to www/includes/edit_base.inc index ad6690aa..4f7a7cc6 100644 --- a/www/admin/edit_base.inc +++ b/www/includes/edit_base.inc @@ -27,7 +27,7 @@ $table_width = 750; define('REL_PATH', ''); ob_start(); -include("config.inc"); +require 'config.php'; // set session name here define('SET_SESSION_NAME', EDIT_SESSION_NAME); // overrride debug flags diff --git a/www/admin/table_arrays/array_edit_access.inc b/www/includes/table_arrays/array_edit_access.inc similarity index 100% rename from www/admin/table_arrays/array_edit_access.inc rename to www/includes/table_arrays/array_edit_access.inc diff --git a/www/admin/table_arrays/array_edit_groups.inc b/www/includes/table_arrays/array_edit_groups.inc similarity index 100% rename from www/admin/table_arrays/array_edit_groups.inc rename to www/includes/table_arrays/array_edit_groups.inc diff --git a/www/admin/table_arrays/array_edit_languages.inc b/www/includes/table_arrays/array_edit_languages.inc similarity index 100% rename from www/admin/table_arrays/array_edit_languages.inc rename to www/includes/table_arrays/array_edit_languages.inc diff --git a/www/admin/table_arrays/array_edit_menu_group.inc b/www/includes/table_arrays/array_edit_menu_group.inc similarity index 100% rename from www/admin/table_arrays/array_edit_menu_group.inc rename to www/includes/table_arrays/array_edit_menu_group.inc diff --git a/www/admin/table_arrays/array_edit_pages.inc b/www/includes/table_arrays/array_edit_pages.inc similarity index 100% rename from www/admin/table_arrays/array_edit_pages.inc rename to www/includes/table_arrays/array_edit_pages.inc diff --git a/www/admin/table_arrays/array_edit_schemes.inc b/www/includes/table_arrays/array_edit_schemes.inc similarity index 100% rename from www/admin/table_arrays/array_edit_schemes.inc rename to www/includes/table_arrays/array_edit_schemes.inc diff --git a/www/admin/table_arrays/array_edit_users.inc b/www/includes/table_arrays/array_edit_users.inc similarity index 100% rename from www/admin/table_arrays/array_edit_users.inc rename to www/includes/table_arrays/array_edit_users.inc diff --git a/www/admin/table_arrays/array_edit_visible_group.inc b/www/includes/table_arrays/array_edit_visible_group.inc similarity index 100% rename from www/admin/table_arrays/array_edit_visible_group.inc rename to www/includes/table_arrays/array_edit_visible_group.inc diff --git a/www/layout/admin/default/cache/index.php b/www/layout/admin/default/cache/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/admin/default/css/index.php b/www/layout/admin/default/css/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/admin/default/images/index.php b/www/layout/admin/default/images/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/admin/default/index.php b/www/layout/admin/default/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/admin/default/javascript/index.php b/www/layout/admin/default/javascript/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/admin/index.php b/www/layout/admin/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/default/cache/index.php b/www/layout/frontend/default/cache/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/default/css/index.php b/www/layout/frontend/default/css/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/default/images/index.php b/www/layout/frontend/default/images/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/default/index.php b/www/layout/frontend/default/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/default/javascript/index.php b/www/layout/frontend/default/javascript/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/layout/frontend/index.php b/www/layout/frontend/index.php new file mode 100644 index 00000000..e69de29b diff --git a/www/lib/CoreLibs/Output/Form/Generate.inc b/www/lib/CoreLibs/Output/Form/Generate.inc index a7d4ccf4..8c7d97a3 100644 --- a/www/lib/CoreLibs/Output/Form/Generate.inc +++ b/www/lib/CoreLibs/Output/Form/Generate.inc @@ -256,7 +256,12 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO // load config array // get table array definitions for current page name // WARNING: auto spl load does not work with this as it is an array and not a function/object - include(TABLE_ARRAYS."array_".$this->my_page_name.".inc"); + // check if this is the old path or the new path + if (is_dir(TABLE_ARRAYS)) { + include(TABLE_ARRAYS."array_".$this->my_page_name.".inc"); + } else { + include(BASE.INCLUDES.TABLE_ARRAYS.'array_'.$this->my_page_name.'.inc'); + } $config_array = ${$this->my_page_name}; // start the array_io class which will start db_io ...