Skip to content

Commit

Permalink
Merge branch 'newLanguages' of https://github.com/bbannon/webcalendar
Browse files Browse the repository at this point in the history
…into newLanguages
  • Loading branch information
bbannon committed Oct 10, 2024
2 parents 637c15a + 402a92a commit 4169643
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,12 @@ function save_pref ( $prefs, $src ) {
<div class="form-inline mt-1 mb-2"><label title="' . tooltip ( 'email-smtp-username' ) . '">'
. translate ( 'SMTP Username' )
. ':</label><input type="text" size="30" name="admin_SMTP_USERNAME" value="'
. ( $s['SMTP_USERNAME'] ?: '' )
. ( $s['SMTP_USERNAME'] ??= '' )
. '"></div>
<div class="form-inline mt-1 mb-2"><label title="' . tooltip ( 'email-smtp-password' ) . '">'
. translate ( 'SMTP Password' )
. ':</label><input type="text" size="30" name="admin_SMTP_PASSWORD" value="'
. ( $s['SMTP_PASSWORD'] ?: '' )
. ( $s['SMTP_PASSWORD'] ??= '' )
. '"></div>
</div>
</div>
Expand Down
12 changes: 7 additions & 5 deletions category_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function updateIconBlob($catId, $iconData, $iconMimeType) {
if (!dbi_execute(
'DELETE FROM webcal_categories
WHERE cat_id = ? AND ( cat_owner = ?'
. ($is_admin ? ' OR cat_owner IS NULL )' : ' )'),
. ($is_admin ? ' OR cat_owner = \'\' )' : ' )'),
[$id, $login]
)) {
$error = db_error();
Expand Down Expand Up @@ -95,16 +95,18 @@ function updateIconBlob($catId, $iconData, $iconMimeType) {
$row = dbi_fetch_row($res);
$id = $row[0] + 1;
dbi_free_result($res);
// Set catowner to NULL for global category
$catowner = ($is_admin ? ($isglobal == 'Y' ? null : $login) : $login);
// Set catowner to empty string for global category
$catowner = ($is_admin ? ($isglobal == 'Y' ? '' : $login) : $login);
if (!dbi_execute(
'INSERT INTO webcal_categories ( cat_id, cat_owner,
cat_name, cat_color ) VALUES ( ?, ?, ?, ? )',
[$id, $catowner, $catname, $catcolor]
))
)) {
$error = db_error();
} else
}
} else {
$error = db_error();
}
}
if (empty($delIcon) && (!empty($ENABLE_ICON_UPLOADS) && $ENABLE_ICON_UPLOADS == 'Y' || $is_admin)) {
// Save icon if uploaded.
Expand Down
2 changes: 1 addition & 1 deletion edit_entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function time_selection($prefix, $time = '', $trigger = false)
if (!empty($cat_id)) {
$res = dbi_execute(
'SELECT cat_name FROM webcal_categories ' .
'WHERE cat_id = ? AND ( cat_owner = ? OR cat_owner IS NULL )',
'WHERE cat_id = ? AND ( cat_owner = ? OR cat_owner = \'\' )',
[$cat_id, $real_user]
);
if ($res) {
Expand Down
7 changes: 7 additions & 0 deletions includes/classes/RptEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,18 @@ class RepeatingEvent extends Event {
* @access private
*/
var $_repeatEndDateTime;
/**
* The UNIX timestamp for the end date/time of the repetition.
* @var int
* @access private
*/
var $_repeatEndDateTimeTS;
/**
* The frequency of the repetition.
* @var int
* @access private
*/

var $_repeatFrequency;
/**
* The days each week the event occurs
Expand Down
4 changes: 2 additions & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,7 @@ function get_categories_by_id ( $id, $user, $asterisk = false ) {

$res = dbi_execute ( 'SELECT wc.cat_name, wc.cat_id, wec.cat_owner
FROM webcal_categories wc, webcal_entry_categories wec WHERE wec.cal_id = ?
AND wec.cat_id = wc.cat_id AND ( wc.cat_owner = ? OR wc.cat_owner IS NULL )
AND wec.cat_id = wc.cat_id AND ( wc.cat_owner = ? OR wc.cat_owner = \'\' )
ORDER BY wec.cat_order', [$id, ( empty ( $user ) ? $login : $user )] );
while ( $row = dbi_fetch_row ( $res ) ) {
$categories[ ( empty ( $row[2] ) ? - $row[1] : $row[1] ) ] = $row[0]
Expand Down Expand Up @@ -4209,7 +4209,7 @@ function load_user_categories ( $ex_global = '' ) {
( $is_assistant || $is_admin ) ? $user : $login );
$rows = dbi_get_cached_rows ( 'SELECT cat_id, cat_name, cat_owner, cat_color, cat_icon_mime
FROM webcal_categories WHERE ( cat_owner = ? ) ' . ( $ex_global == ''
? 'OR ( cat_owner IS NULL ) ORDER BY cat_owner,' : 'ORDER BY' )
? 'OR ( cat_owner = \'\' ) ORDER BY cat_owner,' : 'ORDER BY' )
. ' cat_name', $query_params );
if ( $rows ) {
for ( $i = 0, $cnt = count ( $rows ); $i < $cnt; $i++ ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/xcal.php
Original file line number Diff line number Diff line change
Expand Up @@ -3121,7 +3121,7 @@ function get_categories_id_byname ( $cat_names ) {
$categories = explode ( ',', $cat_names );
foreach ( $categories as $cat_name ) {
$res = dbi_execute ( 'SELECT cat_id FROM webcal_categories
WHERE cat_name = ? AND ( cat_owner = ? OR cat_owner IS NULL )',
WHERE cat_name = ? AND ( cat_owner = ? OR cat_owner = \'\' )',
[$cat_name, $login] );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
Expand Down
2 changes: 1 addition & 1 deletion install/sql/tables-mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ CREATE TABLE webcal_entry_log (

/**
* Defines user categories. Categories can be specific to a user or global.
* When a category is global, the cat_owner field will be NULL.
* When a category is global, the cat_owner field will be an empty string.
* (Only an admin user can create a global category.)
*/
CREATE TABLE webcal_categories (
Expand Down

0 comments on commit 4169643

Please sign in to comment.