Compare commits

...

3 Commits

Author SHA1 Message Date
Clemens Schwaighofer
382cc0524a file upload page updates, config updates
Update the files upload page with missing unlinks for certain actions
and ACL settings

Add LIVE_SCHEMA to config & var set check
2018-05-24 15:08:18 +09:00
Clemens Schwaighofer
aa57c6218f various fixes for PHP 7.2 compatible 2018-05-16 13:42:31 +09:00
Clemens Schwaighofer
b3f9fd27e6 Update for <? in the table_array list, fix binaries folder name 2018-05-14 15:37:05 +09:00
16 changed files with 111 additions and 47 deletions

View File

@@ -52,6 +52,9 @@ if (!$show_type) {
$show_type = 'P';
}
// set edit access array
$edit_access_ids = array_keys($cms->user_unit);
// yes no list (online)
$yesno_list['f'] = 'No';
$yesno_list['t'] = 'Yes';
@@ -262,9 +265,16 @@ 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."', '".BASE.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."', '".
$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;
@@ -297,6 +307,12 @@ if ($cms->action_flag == 'set_live' && $cms->action = 'set_delete') {
$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);
@@ -304,13 +320,21 @@ if ($cms->action_flag == 'set_live' && $cms->action = 'set_delete') {
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 type in ('".str_replace(',', "','", $show_type)."') ";
$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))."%' ";
}

View File

@@ -117,3 +117,5 @@ if (false === strstr(LAYOUT.DEFAULT_TEMPLATE.LANG, $cms->lang_dir) || strcasecmp
// $cms->debug("LANGUAGE", "L: $lang | ".$cms->lang_dir." | MO File: ".$cms->l->mofile);
$cms->debug("LANGUAGE", "SL: ".$_SESSION['DEFAULT_CHARSET']." | ".$_SESSION['LANG']." | ".$_SESSION['DEFAULT_LANG']);
$cms->debug("TEMPLATE", "P: ".$smarty->getTemplateDir()[0]);
# __END__

View File

@@ -90,7 +90,7 @@ $cms->DEBUG_DATA['DEBUG'] = @$DEBUG_TMPL;
// create main data array
$cms->CONTENT_DATA = array_merge($cms->HEADER, $cms->DATA, $cms->DEBUG_DATA);
// data is 1:1 mapping (all vars, values, etc)
while (list($key, $value) = each($cms->CONTENT_DATA)) {
foreach ($cms->CONTENT_DATA as $key => $value) {
$smarty->assign($key, $value);
}
if (is_dir(BASE.TEMPLATES_C)) {
@@ -100,3 +100,5 @@ if (is_dir(BASE.CACHE)) {
$smarty->setCacheDir(BASE.CACHE);
}
$smarty->display($MASTER_TEMPLATE_NAME, $TEMPLATE.$lang, $TEMPLATE.$lang);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_access = array (
"table_array" => array (
"edit_access_id" => array (
@@ -74,3 +74,5 @@ $edit_access = array (
)
)
);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_groups = array (
"table_array" => array (
"edit_group_id" => array (
@@ -97,3 +97,5 @@ $edit_groups = array (
) // edit pages ggroup
)
);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_languages=array (
"table_array" => array (
"edit_language_id" => array (
@@ -70,3 +70,5 @@ $edit_languages=array (
),
"table_name" => "edit_language"
);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_menu_group = array (
"table_array" => array (
"edit_menu_group_id" => array (
@@ -35,3 +35,5 @@ $edit_menu_group = array (
)
)
);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_pages = array (
"table_array" => array (
"edit_page_id" => array (
@@ -26,7 +26,7 @@ $edit_pages = array (
"int" => 1,
"order" => 1
),
/* "flag" => array (
/* "flag" => array (
"value" => $GLOBALS["flag"],
"output_name" => "Page Flag",
"type" => "drop_down_array",
@@ -175,3 +175,5 @@ $edit_pages = array (
) // query_string element list
) // element list
);
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_schemes = array (
"table_array" => array (
"edit_scheme_id" => array (
@@ -53,3 +53,4 @@ $edit_schemes = array (
)
); // main array
# __END__

View File

@@ -1,4 +1,4 @@
<?
<?php
$edit_users = array (
"table_array" => array (
"edit_user_id" => array (
@@ -251,3 +251,5 @@ $edit_users = array (
) // edit pages ggroup
)
);
# __END__

View File

@@ -1,30 +1,32 @@
<?
$edit_visible_group = array (
"table_array" => array (
"edit_visible_group_id" => array (
"value" => $GLOBALS["edit_visible_group_id"],
"type" => "hidden",
"pk" => 1
),
"name" => array (
"value" => $GLOBALS["name"],
"output_name" => $this->l->__("Group name"),
"mandatory" => 1,
"type" => "text"
),
"flag" => array (
"value" => $GLOBALS["flag"],
"output_name" => $this->l->__("Flag"),
"mandatory" => 1,
"type" => "text",
"error_check" => "alphanumeric|unique"
)
<?php
$edit_visible_group = array (
"table_array" => array (
"edit_visible_group_id" => array (
"value" => $GLOBALS["edit_visible_group_id"],
"type" => "hidden",
"pk" => 1
),
"table_name" => "edit_visible_group",
"load_query" => "SELECT edit_visible_group_id, name FROM edit_visible_group ORDER BY name",
"show_fields" => array (
array (
"name" => "name"
)
"name" => array (
"value" => $GLOBALS["name"],
"output_name" => $this->l->__("Group name"),
"mandatory" => 1,
"type" => "text"
),
"flag" => array (
"value" => $GLOBALS["flag"],
"output_name" => $this->l->__("Flag"),
"mandatory" => 1,
"type" => "text",
"error_check" => "alphanumeric|unique"
)
);
),
"table_name" => "edit_visible_group",
"load_query" => "SELECT edit_visible_group_id, name FROM edit_visible_group ORDER BY name",
"show_fields" => array (
array (
"name" => "name"
)
)
);
# __END__

View File

@@ -272,7 +272,7 @@ input[type="text"]:focus, textarea:focus, select:focus {
}
/* spacer for line break in float elements */
.spacer {
.clr, .spacer {
clear: both;
}

View File

@@ -958,14 +958,14 @@ EOM;
}
// first check if all strings are set from outside, if not, set with default ones
while (list($string, $data) = each($strings)) {
foreach ($strings as $string => $data) {
if (!array_key_exists($string, $this->login_template['strings'])) {
$this->login_template['strings'][$string] = $data;
}
}
// error msgs the same
while (list($code, $data) = each($error_msgs)) {
foreach ($error_msgs as $code => $data) {
if (!array_key_exists($code, $this->login_error_msg)) {
$this->login_error_msg[$code] = $data;
}

View File

@@ -123,7 +123,7 @@ class Basic
private $log_print_file = 'error_msg##LOGID####LEVEL####CLASS####PAGENAME####DATE##';
private $log_file_unique_id; // a unique ID set only once for call derived from this class
public $log_print_file_date = 1; // if set add Y-m-d and do automatic daily rotation
private $log_file_id = LOG_FILE_ID ? LOG_FILE_ID : ''; // a alphanumeric name that has to be set as global definition
private $log_file_id = ''; // a alphanumeric name that has to be set as global definition
public $log_per_level = 0; // set, it will split per level (first parameter in debug call)
public $log_per_class = 0; // set, will split log per class
public $log_per_page = 0; // set, will split log per called file
@@ -179,9 +179,30 @@ class Basic
"class_author" => 'Clemens Schwaighofer'
);
// before we start any work, we should check that all MUST constants are defined
$abort = false;
foreach (array(
'DS', 'DIR', 'BASE', 'ROOT', 'LIB', 'INCLUDES', 'LAYOUT', 'PICTURES', 'FLASH', 'VIDEOS', 'DOCUMENTS', 'PDFS', 'BINARIES', 'ICONS',
'UPLOADS', 'CSV', 'JS', 'CSS', 'TABLE_ARRAYS', 'SMARTY', 'LANG', 'CACHE', 'TMP', 'LOG', 'TEMPLATES', 'TEMPLATES_C',
'TEMPLATES_FRONTEND', 'DEFAULT_TEMPLATE', 'DEFAULT_TEMPLATE_FILE', 'DEFAULT_LANG', 'DEFAULT_ENCODING', 'DEFAULT_HASH',
'DEFAULT_ACL_LEVEL', 'LOGOUT_TARGET', 'PASSWORD_CHANGE', 'AJAX_REQUEST_TYPE', 'USE_PROTOTYPE', 'USE_SCRIPTACULOUS', 'USE_JQUERY',
'PAGE_WIDTH', 'MASTER_TEMPLATE_NAME', 'PUBLIC_SCHEMA', 'TEST_SCHEMA', 'DEV_SCHEMA', 'LIVE_SCHEMA', 'LOGIN_DB', 'MAIN_DB', 'DB_SCHEMA',
'LOGIN_DB_SCHEMA', 'GLOBAL_DB_SCHEMA', 'TARGET', 'DEBUG', 'SHOW_ALL_ERRORS'
) as $constant) {
if (!defined($constant)) {
echo "Constant $constant misssing<br>";
$abort = true;
}
}
if ($abort === true) {
die('Core Constant missing. Check config file.');
}
// set the page name
$this->page_name = $this->getPageName();
$this->host_name = $this->getHostName();
// init the log file id
$this->log_file_id = defined('LOG_FILE_ID') ? LOG_FILE_ID : '';
// set the paths matching to the valid file types
$this->data_path = array (
@@ -328,7 +349,7 @@ class Basic
// initial the session if there is no session running already
if (!session_id()) {
// check if we have an external session name given, else skip this step
if (SET_SESSION_NAME) {
if (defined('SET_SESSION_NAME')) {
// set the session name for possible later check
$this->session_name = SET_SESSION_NAME;
}
@@ -434,7 +455,7 @@ class Basic
// DESC : wrapper around microtime function to print out y-m-d h:i:s.ms
public static function printTime($set_microtime = -1)
{
list($microtime, $timestamp) = explode(" ", microtime());
list($microtime, $timestamp) = explode(' ', microtime());
$string = date("Y-m-d H:i:s", $timestamp);
// if microtime flag is -1 no round, if 0, no microtime, if >= 1, round that size
if ($set_microtime == -1) {

View File

@@ -501,7 +501,7 @@ class IO extends \CoreLibs\Basic
// NOTE : used in db_dump_data only
private function __printArray($array)
{
while (list($key, $value) = each($array)) {
foreach ($array as $key => $value) {
$string .= $this->nbsp.'<b>'.$key.'</b> => ';
if (is_array($value)) {
$this->nbsp .= '&nbsp;&nbsp;&nbsp;';
@@ -1111,7 +1111,7 @@ class IO extends \CoreLibs\Basic
$this->cursor_ext[$md5]['read_rows'] ++;
// if reset is <3 caching is done, else no
if ($reset < 3) {
while (list($field_name, $data) = each($return)) {
foreach ($return as $field_name => $data) {
$temp[$field_name] = $data;
}
$this->cursor_ext[$md5][] = $temp;