diff --git a/.dockerignore b/.dockerignore
index 8d25d3e84..6895048b1 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -17,6 +17,7 @@ docs/WebCalendar-UserManual.html
includes/settings.php
java
Makefile
+sqlite-data
release-files
tests
TODO
diff --git a/.gitignore b/.gitignore
index b049111bf..f34d28451 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@ pub/
__pycache__
*.save
*.sha
+sqlite-data
tests/.phpunit.result.cache
vendor/
-wc-icons/
\ No newline at end of file
+wc-icons/
diff --git a/Makefile b/Makefile
index aee4c241d..b6853e235 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,7 @@ $(PHPMAILER_DIR)/SMTP.php: $(PHPMAILER_VENDOR_DIR)/SMTP.php
_ICONS: \
$(BOOTSTRAP_ICON_DIR)/printer.svg \
$(BOOTSTRAP_ICON_DIR)/search.svg \
+ $(BOOTSTRAP_ICON_DIR)/arrow-left.svg \
$(BOOTSTRAP_ICON_DIR)/arrow-right-circle.svg \
$(BOOTSTRAP_ICON_DIR)/arrow-left-circle.svg \
$(BOOTSTRAP_ICON_DIR)/arrow-up-short.svg \
@@ -61,7 +62,8 @@ _ICONS: \
$(BOOTSTRAP_ICON_DIR)/check-circle.svg \
$(BOOTSTRAP_ICON_DIR)/trash.svg \
$(BOOTSTRAP_ICON_DIR)/key-fill.svg \
- $(BOOTSTRAP_ICON_DIR)/info-circle-fill.svg
+ $(BOOTSTRAP_ICON_DIR)/info-circle-fill.svg \
+ $(BOOTSTRAP_ICON_DIR)/circle.svg
$(BOOTSTRAP_ICON_DIR)/printer.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/printer.svg
cp $< $@
@@ -72,6 +74,9 @@ $(BOOTSTRAP_ICON_DIR)/search.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/search.svg
$(BOOTSTRAP_ICON_DIR)/arrow-right-circle.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/arrow-right-circle.svg
cp $< $@
+$(BOOTSTRAP_ICON_DIR)/arrow-left.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/arrow-left.svg
+ cp $< $@
+
$(BOOTSTRAP_ICON_DIR)/arrow-left-circle.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/arrow-left-circle.svg
cp $< $@
@@ -114,6 +119,9 @@ $(BOOTSTRAP_ICON_DIR)/key-fill.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/key-fill.svg
$(BOOTSTRAP_ICON_DIR)/info-circle-fill.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/info-circle-fill.svg
cp $< $@
+$(BOOTSTRAP_ICON_DIR)/circle.svg: $(BOOTSTRAP_ICON_VENDOR_DIR)/circle.svg
+ cp $< $@
+
includes/load_assets.php: \
pub/bootstrap.min.css \
pub/bootstrap.min.css.sha \
diff --git a/UPGRADING.html b/UPGRADING.html
index b928d5f29..a0914a9bb 100644
--- a/UPGRADING.html
+++ b/UPGRADING.html
@@ -15,7 +15,7 @@
'
- . (is_dir($icon_path) &&
- (($ENABLE_ICON_UPLOADS == 'Y' || $is_admin) && $canWrite)
+ . (($ENABLE_ICON_UPLOADS == 'Y' || $is_admin)
? translate('Add Icon to Category') . ':
@@ -132,9 +102,6 @@
foreach ($categories as $K => $V) {
if ($K < 1)
continue;
- $catIcon = $icon_path . 'cat-' . $K . '.gif';
- if (!file_exists($catIcon))
- $catIcon = $icon_path . 'cat-' . $K . '.png';
$catStr = '
' . htmlentities($V['cat_name']) . ' ';
@@ -147,8 +114,11 @@
$global_found = true;
}
- echo (file_exists($catIcon) ? '
' : '') . '';
+ if (!empty($V['cat_icon_mime'])) {
+ echo '
';
+ }
+ echo '';
}
echo '
';
diff --git a/category_handler.php b/category_handler.php
index 4a6c42311..f5cea9fa6 100644
--- a/category_handler.php
+++ b/category_handler.php
@@ -4,19 +4,21 @@
$icon_max_size = '6000';
$icon_path = 'wc-icons/';
-/**
- * Rename any icons associated with this cat_id.
- */
-function renameIcon($id)
-{
- global $icon_path;
- $bakIcon = $catIcon = $icon_path . 'cat-';
- $bakIcon .= date('YmdHis') . '.gif';
- $catIcon .= $id . '.gif';
- if (!file_exists($catIcon))
- $catIcon = $icon_path . '/cat-' . $id . '.png';
- if (file_exists($catIcon))
- rename($catIcon, $bakIcon);
+
+function updateIconBlob($catId, $iconData, $iconMimeType) {
+ // Update the icon binary data in the database.
+ dbi_update_blob(
+ 'webcal_categories',
+ 'cat_icon_blob',
+ "cat_id = $catId",
+ $iconData
+ );
+
+ // Update the MIME type of the icon in the database.
+ dbi_execute(
+ 'UPDATE webcal_categories SET cat_icon_mime = ? WHERE cat_id = ?',
+ [$iconMimeType, $catId]
+ );
}
// Does the category belong to the user?
@@ -74,8 +76,6 @@ function renameIcon($id)
)) {
$error = db_error();
}
- // Rename any icons associated with this cat_id.
- renameIcon($id);
} else if (empty($error) && empty($catname)) {
$error = translate('Category name is required');
} else if (empty($error)) {
@@ -87,9 +87,6 @@ function renameIcon($id)
[$catname, $catcolor, $id]
))
$error = db_error();
-
- if (!empty($delIcon) && $delIcon == 'Y')
- renameIcon($id);
} else {
// Add new category.
// Get new id.
@@ -109,42 +106,34 @@ function renameIcon($id)
} else
$error = db_error();
}
- if (empty($delIcon) && is_dir($icon_path) && (!empty($ENABLE_ICON_UPLOADS) && $ENABLE_ICON_UPLOADS == 'Y' ||
- $is_admin)) {
+ if (empty($delIcon) && (!empty($ENABLE_ICON_UPLOADS) && $ENABLE_ICON_UPLOADS == 'Y' || $is_admin)) {
// Save icon if uploaded.
if (!empty($file['tmp_name'])) {
- if (($file['type'] == 'image/gif' || $file['type'] == 'image/png')
- && $file['size'] <= $icon_max_size
- ) {
- // $icon_props = getimagesize( $file['tmp_name'] );
- // print_r ($icon_props );
- $path_parts = pathinfo($_SERVER['SCRIPT_FILENAME']);
- $fullIcon = $path_parts['dirname'] . '/'
- . $icon_path . 'cat-' . $id;
- if ($file['type'] == 'image/gif')
- $fullIcon .= '.gif';
- else
- $fullIcon .= '.png';
- renameIcon($id);
- $file_result = move_uploaded_file($file['tmp_name'], $fullIcon);
- // echo "Upload Result:" . $file_result;
- } else if ($file['size'] > $icon_max_size) {
- $error = translate('File size exceeds maximum.');
- } else if (
- $file['type'] != 'image/gif' &&
- $file['type'] != 'image/png'
- ) {
- $error = translate('File is not a GIF or PNG image') . ': '
- . $file['type'];
- }
+ if (($file['type'] == 'image/gif' || $file['type'] == 'image/png')
+ && $file['size'] <= $icon_max_size) {
+ // Get binary data of the icon.
+ $iconData = file_get_contents($file['tmp_name']);
+ // Update the icon data and MIME type in the database.
+ updateIconBlob($id, $iconData, $file['type']);
+ } else if ($file['size'] > $icon_max_size) {
+ $error = translate('File size exceeds maximum.');
+ } else if (
+ $file['type'] != 'image/gif' &&
+ $file['type'] != 'image/png'
+ ) {
+ $error = translate('File is not a GIF or PNG image') . ': '
+ . $file['type'];
+ }
}
// Copy icon if local file specified.
$urlname = getPostvalue('urlname');
if (!empty($urlname) && file_exists($icon_path . $urlname)) {
- if (preg_match('/.(gif|GIF)$/', $urlname))
- copy($icon_path . $urlname, $icon_path . 'cat-' . $id . '.gif');
- else
- copy($icon_path . $urlname, $icon_path . 'cat-' . $id . '.png');
+ // Get binary data of the icon.
+ $iconData = file_get_contents($icon_path . $urlname);
+ // Determine the MIME type based on the file extension.
+ $iconMimeType = (preg_match('/.(gif|GIF)$/', $urlname)) ? 'image/gif' : 'image/png';
+ // Update the icon data and MIME type in the database.
+ updateIconBlob($id, $iconData, $iconMimeType);
}
}
}
diff --git a/composer.json b/composer.json
index bd0811f59..9125a46af 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "k5n/webcalendar",
"type": "project",
"description": "Multi-user web-based calendar app",
- "version": "1.9.10",
+ "version": "1.9.12",
"homepage": "https://www.k5n.us/webcalendar/",
"authors": [
{
diff --git a/composer.lock b/composer.lock
index d7adbc7a6..91982ab86 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "c1feaefa310526e57a89a1f696f398e3",
+ "content-hash": "f79c4018d6e61e62b0f7342654c1d79a",
"packages": [
{
"name": "ckeditor/ckeditor",
diff --git a/getIcon.php b/getIcon.php
new file mode 100644
index 000000000..680c47bbf
--- /dev/null
+++ b/getIcon.php
@@ -0,0 +1,23 @@
+
+
+
\ No newline at end of file
diff --git a/images/bootstrap-icons/circle.svg b/images/bootstrap-icons/circle.svg
new file mode 100644
index 000000000..dc57919b3
--- /dev/null
+++ b/images/bootstrap-icons/circle.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/includes/config.php b/includes/config.php
index cd8bc4b26..825ea5c33 100644
--- a/includes/config.php
+++ b/includes/config.php
@@ -20,6 +20,26 @@
// See composer.json for version.
require_once 'load_assets.php';
+// Define possible app settings and their types
+$config_possible_settings = [
+ 'install_password' => 'string',
+ 'install_password_hint' => 'string',
+ 'db_cachedir' => 'string',
+ 'db_database' => 'string',
+ 'db_debug' => 'boolean',
+ 'db_host' => 'string',
+ 'db_login' => 'string',
+ 'db_password' => 'string',
+ 'db_persistent' => 'boolean',
+ 'db_type' => 'string',
+ 'readonly' => 'string', # "Y" or "N"
+ 'single_user' => 'string', # "Y" or "N"
+ 'use_http_auth' => 'boolean',
+ 'user_inc' => 'string',
+ 'config_inc' => 'string',
+ 'mode' => 'string' # "dev" or "prod"
+];
+
/**
* Prints a fatal error message to the user along with a link to the
* Troubleshooting section of the WebCalendar System Administrator's Guide.
@@ -133,37 +153,21 @@ function get_full_include_path($filename)
* @global string $TROUBLE_URL URL pointing to the Troubleshooting section.
* @global string $user_inc Indicates the type of user authentication.
*/
-
-function do_config()
+function do_config($callingFromInstall=false)
{
- global $db_database, $db_host, $db_login, $db_password, $db_persistent,
+ global $db_database, $db_debug, $db_host, $db_login, $db_password, $db_persistent,
$db_type, $ignore_user_case, $NONUSER_PREFIX, $phpdbiVerbose, $PROGRAM_DATE,
$PROGRAM_NAME, $PROGRAM_URL, $PROGRAM_VERSION, $readonly, $run_mode, $settings,
$single_user, $single_user_login, $TROUBLE_URL, $user_inc, $use_http_auth;
+ global $config_possible_settings;
// Define possible app settings and their types
- $possible_settings = [
- 'install_password' => 'string',
- 'db_cachedir' => 'string',
- 'db_database' => 'string',
- 'db_debug' => 'boolean',
- 'db_host' => 'string',
- 'db_login' => 'string',
- 'db_password' => 'string',
- 'db_persistent' => 'boolean',
- 'db_type' => 'string',
- 'readonly' => 'string', # "Y" or "N"
- 'single_user' => 'string', # "Y" or "N"
- 'use_http_auth' => 'boolean',
- 'user_inc' => 'string',
- 'config_inc' => 'string',
- 'mode' => 'string' # "dev" or "prod"
- ];
+ $possible_settings = $config_possible_settings;
// When changing PROGRAM VERSION, also change it in install/default_config.php
- $PROGRAM_VERSION = 'v1.9.10';
+ $PROGRAM_VERSION = 'v1.9.12';
// Update PROGRAM_DATE with official release data
- $PROGRAM_DATE = '02 Oct 2023';
+ $PROGRAM_DATE = '03 Nov 2023';
$PROGRAM_NAME = 'WebCalendar ' . "$PROGRAM_VERSION ($PROGRAM_DATE)";
$PROGRAM_URL = 'http://k5n.us/wp/webcalendar/';
@@ -191,6 +195,9 @@ function do_config()
// Load from settings.php file
$settings_content = file_get_contents(__DIR__ . '/settings.php');
if (empty($settings_content)) {
+ if ($callingFromInstall) {
+ return; // not an error during install
+ }
// There is no settings.php file.
// Redirect user to install page if it exists.
if (file_exists('install/index.php')) {
@@ -206,6 +213,7 @@ function do_config()
$value = trim($matches[1]);
$settings[$key] = ($type === 'boolean') ? filter_var($value, FILTER_VALIDATE_BOOLEAN) : $value;
} else {
+ // Setting not found
if ($type === 'boolean') {
$settings[$key] = false;
}
@@ -228,25 +236,34 @@ function do_config()
$db_persistent = (preg_match(
'/(1|yes|true|on)/i',
$settings['db_persistent']
- ) ? '1' : '0');
+ ) ? true : false );
+ $db_debug = (preg_match(
+ '/(1|yes|true|on)/i',
+ $settings['db_debug']
+ ) ? true : false);
$db_type = $settings['db_type'];
// If no db settings, then user has likely started install but not yet
// completed. So, send them back to the install script.
if (empty($db_type)) {
+ if ($callingFromInstall) {
+ return; // not an error during install
+ }
if (file_exists('install/index.php')) {
- header('Location: install/index.php?reason=no_dbtype');
+ header('Location: install/index.php');
exit;
} else
die_miserable_death(translate('Incomplete settings.php file...'));
}
// Use 'db_cachedir' if found, otherwise look for 'cachedir'.
- if (!empty($settings['db_cachedir']))
- dbi_init_cache($settings['db_cachedir']);
- else
- if (!empty($settings['cachedir']))
- dbi_init_cache($settings['cachedir']);
+ if (!$callingFromInstall) {
+ if (!empty($settings['db_cachedir']))
+ dbi_init_cache($settings['db_cachedir']);
+ else
+ if (!empty($settings['cachedir']))
+ dbi_init_cache($settings['cachedir']);
+ }
if (
!empty($settings['db_debug'])
@@ -254,13 +271,15 @@ function do_config()
)
dbi_set_debug(true);
- foreach ( ['db_type', 'db_host', 'db_login'] as $s) {
- if (empty($settings[$s]))
- die_miserable_death(str_replace(
- 'XXX',
- $s,
- translate('Could not find XXX defined in...')
- ));
+ if (!$callingFromInstall) {
+ foreach ( ['db_type', 'db_host', 'db_login'] as $s) {
+ if (empty($settings[$s]))
+ die_miserable_death(str_replace(
+ 'XXX',
+ $s,
+ translate('Could not find XXX defined in...')
+ ));
+ }
}
// Allow special settings of 'none' in some settings[] values.
@@ -269,25 +288,26 @@ function do_config()
$db_password = (empty($db_password) || $db_password == 'none'
? '' : $db_password);
- if (empty($settings['readonly']))
- $settings['readonly'] = 'N';
- $readonly = preg_match(
- '/(1|yes|true|on|y)/i',
- $settings['readonly']
- ) ? 'Y' : 'N';
+ $readonly = $settings['readonly'] = (!empty($settings['readonly'])
+ && preg_match('/(1|true|yes|enable|on)/i', $settings['readonly'])) ? 'Y' : 'N';
+
if (empty($settings['mode']))
$settings['mode'] = 'prod';
$run_mode = (preg_match('/(dev)/i', $settings['mode']) ? 'dev' : 'prod');
$phpdbiVerbose = ($run_mode == 'dev');
+ $single_user = $settings['single_user'] = (!empty($settings['single_user'])
+ && preg_match('/(1|true|yes|enable|on)/i', $settings['single_user'])) ? 'Y' : 'N';
if (isset($single_user) && $single_user == 'Y') {
$single_user_login = $settings['single_user_login'];
- if (empty($single_user_login))
- die_miserable_death(str_replace(
- 'XXX',
- 'single_user_login',
- translate('You must define XXX in')
- ));
+ if (!$callingFromInstall) {
+ if (empty($single_user_login))
+ die_miserable_death(str_replace(
+ 'XXX',
+ 'single_user_login',
+ translate('You must define XXX in')
+ ));
+ }
} else {
$single_user = 'N';
$single_user_login = '';
@@ -302,8 +322,7 @@ function do_config()
$db_database = get_full_include_path($db_database);
}
- // & does not work here...leave it as &.
- $locateStr = 'Location: install/index.php?action=mismatch&version=';
+ $locateStr = 'Location: install/index.php';
// Check the current installation version.
// Redirect user to install page if it is different from stored value.
@@ -311,7 +330,7 @@ function do_config()
// (typically through the web-based install pages).
$c = @dbi_connect($db_host, $db_login, $db_password, $db_database, false);
- if ($c) {
+ if ($c && !$callingFromInstall) {
$rows = dbi_get_cached_rows('SELECT cal_value FROM webcal_config
WHERE cal_setting = \'WEBCAL_PROGRAM_VERSION\'');
@@ -339,9 +358,11 @@ function do_config()
}
dbi_close($c);
} else {
- // Must mean we don't have a settings.php file or env variables.
- header($locateStr . 'UNKNOWN');
- exit;
+ if (!$callingFromInstall) {
+ // Must mean we don't have a settings.php file or env variables.
+ header($locateStr . 'UNKNOWN');
+ exit;
+ }
}
// We can add extra "nonuser" calendars such as a holiday, corporate,
@@ -355,3 +376,14 @@ function do_config()
return $settings;
}
+
+
+function setSettingsInSession() {
+ global $config_possible_settings, $settings;
+ //echo "
settings:\n"; print_r($settings); echo " ";
+ foreach ($config_possible_settings as $key => $type) {
+ if (isset($settings[$key])) {
+ $_SESSION[$key] = $settings[$key];
+ }
+ }
+}
diff --git a/includes/dbi4php.php b/includes/dbi4php.php
index 3716d9672..034fc1252 100644
--- a/includes/dbi4php.php
+++ b/includes/dbi4php.php
@@ -151,20 +151,25 @@ function dbi_connect( $host, $login, $password, $database, $lazy = true ) {
return $c;
} else
return false;
- } elseif( strcmp( $GLOBALS['db_type'], 'mysqli' ) == 0 ) {
- #mysqli_report(MYSQLI_REPORT_ALL);
- $c = new mysqli( $host, $login, $password, $database );
-
- if( $c ) {
- if( mysqli_connect_errno() && ! empty( $database ) )
+ } elseif (strcmp($GLOBALS['db_type'], 'mysqli') == 0) {
+ // mysqli_report(MYSQLI_REPORT_ALL);
+ $c = null;
+ $errorString = "";
+ try {
+ $c = new mysqli($host, $login, $password, $database);
+ if ($c->connect_error) {
+ $db_connection_info['last_error'] = $c->connect_error;
return false;
+ }
- $db_connection_info['connected'] = true;
- $db_connection_info['connection'] =
- $GLOBALS['db_connection'] = $c;
+ $db_connection_info['connected'] = true;
+ $db_connection_info['connection'] = $GLOBALS['db_connection'] = $c;
+ $db_connection_info['last_error'] = '';
return $c;
- } else
+ } catch (Exception $e) {
+ $db_connection_info['last_error'] = $e->getMessage();
return false;
+ }
} elseif( strcmp( $GLOBALS['db_type'], 'odbc' ) == 0 ) {
$c = ( $GLOBALS['db_persistent']
? odbc_pconnect( $database, $login, $password )
@@ -216,15 +221,16 @@ function dbi_connect( $host, $login, $password, $database, $lazy = true ) {
$GLOBALS['sqlite_c'] = $c;
return $c;
} elseif( strcmp( $GLOBALS['db_type'], 'sqlite3' ) == 0 ) {
- $c = new SQLite3 ( $database );
-
- if( ! $c ) {
- echo str_replace( 'XXX', $db_sqlite_error_str,
- translate( 'Error connecting to database XXX' ) ) . "\n";
- exit;
+ try {
+ $c = new SQLite3($database);
+ $db_connection_info['connected'] = true;
+ $db_connection_info['connection'] = $GLOBALS['sqlite3_c'] = $c;
+ $db_connection_info['last_error'] = '';
+ return $c;
+ } catch (Exception $e) {
+ $GLOBALS['db_sqlite_error_str'] = $db_connection_info['last_error'] = $e->getMessage();
+ return false;
}
- $db_connection_info['connected'] = true;
- $db_connection_info['connection'] = $GLOBALS['sqlite3_c'] = $c;
return $c;
} else
dbi_fatal_error( 'dbi_connect(): '
@@ -409,11 +415,12 @@ function dbi_query( $sql, $fatalOnError = true, $showError = true ) {
}
if( $found_db_type ) {
- if( ! $res )
+ if( ! $res ) {
+ //echo "
Db error: " . dbi_error() . " \n";
dbi_fatal_error( translate( 'Error executing query.' )
. ( $phpdbiVerbose ? ( dbi_error() . "\n\n
\n" . $sql ) : '' ),
$fatalOnError, $showError );
-
+ }
return $res;
} else
dbi_fatal_error( 'dbi_query(): ' . translate( 'db_type not defined.' ) );
@@ -667,9 +674,13 @@ function dbi_error() {
$ret = mssql_get_last_message();
elseif( strcmp( $GLOBALS['db_type'], 'mysql' ) == 0 )
$ret = mysql_error();
- elseif( strcmp( $GLOBALS['db_type'], 'mysqli' ) == 0 )
- $ret = $GLOBALS['db_connection']->error;
- elseif( strcmp( $GLOBALS['db_type'], 'odbc' ) == 0 )
+ elseif (strcmp($GLOBALS['db_type'], 'mysqli') == 0) {
+ if (!empty($GLOBALS['db_connection_info']['last_error'])) {
+ $ret = $GLOBALS['db_connection_info']['last_error'];
+ } else {
+ $ret = $GLOBALS['db_connection']->error;
+ }
+ } elseif( strcmp( $GLOBALS['db_type'], 'odbc' ) == 0 )
// No way to get error from ODBC API.
$ret = translate( 'Unknown ODBC error.' );
elseif( strcmp( $GLOBALS['db_type'], 'oracle' ) == 0 ) {
@@ -686,7 +697,16 @@ function dbi_error() {
$GLOBALS['db_sqlite_error_str'] = '';
}
} elseif ( strcmp ( $GLOBALS['db_type'], 'sqlite3' ) == 0 ) {
- $ret = $GLOBALS['sqlite3_c']->lastErrorMsg ();
+ try {
+ if ( empty($$GLOBALS['sqlite3_c']) || !empty($GLOBALS['db_sqlite_error_str'])) {
+ $ret = $GLOBALS['db_sqlite_error_str'];
+ } else {
+ $ret = $GLOBALS['sqlite3_c']->lastErrorMsg ();
+ }
+ } catch ( Exception $e) {
+ $GLOBALS['db_sqlite_error_str'] = $e->getMessage();
+ $ret = $e->getMessage();
+ }
} else
$ret = 'dbi_error(): ' . translate( 'db_type not defined.' );
@@ -776,6 +796,7 @@ function dbi_escape_string( $string ) {
function dbi_execute ( $sql, $params = [], $fatalOnError = true,
$showError = true ) {
+ //echo "SQL: $sql
\n";
if( count( $params ) == 0 )
return dbi_query( $sql, $fatalOnError, $showError );
diff --git a/includes/functions.php b/includes/functions.php
index 0fc933e94..a37afa831 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -3110,7 +3110,7 @@ function get_preferred_view ( $indate = '', $args = '' ) {
$xdate = ( empty ( $indate ) ? $thisdate : $indate );
$url .= ( empty ( $xdate ) ? '' : ( strstr ( $url, '?' ) ? '&' : '?' )
- . 'date=' . $xdate );
+ . 'date=' . ( $xdate instanceof DateTime ? $xdate->format('Ymd') : $xdate ) );
$url .= ( empty ( $args ) ? '' : ( strstr ( $url, '?' ) ? '&' : '?' )
. $args );
@@ -3602,9 +3602,7 @@ function html_for_event_day_at_a_glance ( $event, $date ) {
$time_only = 'N';
$view_text = translate ( 'View this event' );
- $catIcon = 'wc-icons/cat-' . $getCat . '.gif';
- if ( ! file_exists ( $catIcon ) )
- $catIcon = 'wc-icons/cat-' . $getCat . '.png';
+ $catIcon = get_category_icon_url($getCat);
$key++;
if( access_is_enabled() ) {
@@ -3758,9 +3756,7 @@ function html_for_event_week_at_a_glance ( $event, $date,
$time_only = 'N';
$title = '
0 ) {
- $catIcon = 'wc-icons/cat-' . $catNum . '.gif';
- if ( ! file_exists ( $catIcon ) )
- $catIcon = 'wc-icons/cat-' . $catNum . '.png';
- if ( ! file_exists ( $catIcon ) )
- $catIcon = '';
+ $catIcon = get_category_icon_url($catNum);
}
if ( empty ( $catIcon ) )
diff --git a/includes/init.php b/includes/init.php
index d5fc235ee..cc454e375 100644
--- a/includes/init.php
+++ b/includes/init.php
@@ -360,7 +360,7 @@ function print_trailer( $include_nav_links = true, $closeDb = true,
$MENU_DATE_TOP, $MENU_ENABLED, $NONUSER_ENABLED, $PUBLIC_ACCESS,
$PUBLIC_ACCESS_CAN_ADD, $PUBLIC_ACCESS_FULLNAME, $PUBLIC_ACCESS_OTHERS,
$readonly, $REPORTS_ENABLED, $REQUIRE_APPROVALS, $single_user, $STARTVIEW,
- $thisday, $thismonth, $thisyear, $use_http_auth, $user, $views, $WEEK_START;
+ $SQLLOG, $thisday, $thismonth, $thisyear, $use_http_auth, $user, $views, $WEEK_START;
$ret = '';
@@ -393,6 +393,19 @@ function print_trailer( $include_nav_links = true, $closeDb = true,
$GLOBALS['ALLOW_HTML_DESCRIPTION'] == 'Y' &&
in_array ( $GLOBALS['SCRIPT'], $pagesWithFullEditor );
+ $debug = '';
+ if (dbi_get_debug()) {
+ $debug = ''
+ . 'Executed queries:' . dbi_num_queries()
+ . ' Cached queries: ' . dbi_num_cached_queries()
+ . "\n";
+ $log = $GLOBALS['SQLLOG'];
+ $logcnt = count ( $log );
+ for ( $i = 0; $i < $logcnt; $i++ ) {
+ $debug .= '' . $log[$i] . ' ';
+ }
+ $debug .= " \n \n";
+ }
return $ret .
'' .
( $includeCkeditor ?
@@ -408,8 +421,8 @@ function print_trailer( $include_nav_links = true, $closeDb = true,
'
. '
' : '' )/* Close HTML page properly. */ . '
-
-