Giter Site home page Giter Site logo

craigk5n / webcalendar Goto Github PK

View Code? Open in Web Editor NEW
143.0 23.0 69.0 115.39 MB

WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.

Home Page: http://www.k5n.us/webcalendar.php

License: GNU General Public License v2.0

HTML 1.23% PHP 87.45% JavaScript 1.98% CSS 1.63% Makefile 0.56% Java 5.73% Shell 0.31% Perl 0.61% Hack 0.01% Python 0.49%
calendar icalendar ics web-calendar

webcalendar's Introduction

WebCalendar README

Project Home Page: https://k5n.us/webcalendar/ Project Owner: Craig Knudsen, [email protected] Documentation:

Developer Resources:

Roadmap

v1.9.X

  • Clean up bugs
  • Resolve any PHP 8 issues
  • New installer
  • Better support for running as a container
  • Improve translations for most popular languages (using new tools/complete-translation.py.)
  • Testing/validation of databases other than MySQL (which has received most of the attention)

v2.0.X

  • Stable release based on the v1.9 releases

v2.1.X

  • Add support for database caching with Redis

Installation Instructions

After unzipping your files (or transferring the files to your hosting provider), you will need to go to the web-based install script. If your files are installed in a "webcalendar" folder under your parent web server document root, you can access the script by going to:

https://yourserverhere/webcalendar/

(Obviously, put the correct server name in above.) The toplevel URL will automatically redirect to the installation wizard.

Alternatively, there is a headless installation/update script you can run from the shell:

php webcalendar/install/headless.php

Option 1: settings.php

You should create an empty includes/settings.php yourself before running the headless install script that the web service process has write permissions to.

Option 2: Environment Variables

Instead of using the includes/settings.php file for your settings, you can use environment variables instead. This is primarily targeted towards those running WebCalendar in containers (docker, AWS Fargate, etc) where it's easier to pass in environment settings than to write to a config file on a container. You can do this with the docker-compose file if you are using docker. If you want to do this with a standard Web Server, you can set the evironment variables within your web server's configuration. Depending on your web server, there may be more than one way to do this. You could do this in your php.ini file, but those env vars would be available to all PHP apps on the server. A better solution would be to setup a .htaccess file in your WebCalendar directory that looked something like:

SetEnv WEBCALENDAR_USE_ENV true
SetEnv WEBCALENDAR_INSTALL_PASSWORD "da1437a2c74ee0b35eed71e27d00c618"
SetEnv WEBCALENDAR_DB_TYPE mysqli
SetEnv WEBCALENDAR_DB_DATABASE webcalendar
SetEnv WEBCALENDAR_DB_LOGIN webcalendar
SetEnv WEBCALENDAR_DB_PASSWORD "ChangeThisPassword"
SetEnv WEBCALENDAR_DB_HOST db
SetEnv WEBCALENDAR_DB_PERSISTENT true
SetEnv WEBCALENDAR_USER_INC user.php
SetEnv WEBCALENDAR_MODE prod

Note: Don't forget to enable mod_env for Apache for this to work, and to allow access to environment variables from PHP:

php_value expose_php ON

Running WebCalendar with Docker

You can use a prebuilt WebCalendar image rather than building it yourself locally. You will need to shell into the MariaDb container to grant access. Because we also need a database, we use a local network with WebCalendar and MariaDb running that is setup with the docker-compose command.

  • Start the containers: docker-compose -f docker/docker-compose-php8.yml up
  • In order to grant the proper permissions inside of MariaDb, you will need to run a few MySQL commands. First shell into the mariadb container: docker-compose -f docker/docker-compose-php8.yml exec db /bin/sh
  • Start up the db client: /bin/mariadb -p (the password will be "Webcalendar.1" as specified in the `docker-compose-php8.yml' file. You can change it to make your dev environment more secure (before you build the containers in step above).
  • Run the following db commands:
    GRANT ALL PRIVILEGES ON *.* TO webcalendar_php8@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    QUIT
    
  • Start up your web browser and go to: http://localhost:8080/.
  • Follow the guided web-based setup and choose "mysqli" as the database type. Be sure to use the same MariaDb credentials specified above (Password WebCalendar.1 and Database Name webcalendar_php8.)

Setting Up a Docker Dev Environment (PHP 8.1)

You can setup a docker environment with PHP 8.1 and MariaDb with a few steps. This docker setup differs from the normal WebCalendar docker image in that the local WebCalendar files are mounted into the container so that changes to your local filesystem will also apply to the WebCalanedar files in the container.

  • Build the docker container with docker-compose -f docker/docker-compose-php8-dev.yml build
  • Start the containers with docker-compose -f docker/docker-compose-php8-dev.yml up
  • In order to grant the proper permissions inside of MariaDb, you will need to run a few MySQL commands. First shell into the mariadb container: docker-compose -f docker/docker-compose-php8-dev.yml exec db /bin/sh
  • Start up the db client: /bin/mariadb -p (the password will be "Webcalendar.1" as specified in the `docker-compose-php8-dev.yml' file. You can change it to make your dev environment more secure (before you build the containers in step above).
  • Run the following db commands:
    GRANT ALL PRIVILEGES ON *.* TO webcalendar_php8@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    QUIT
    
  • Start up your web browser and go to: http://localhost:8080/.
  • Follow the guided web-based setup and choose "mysqli" as the database type. Be sure to use the same MariaDb credentials specified above (Password WebCalendar.1 and Database Name webcalendar_php8.)

Integrating WebCalendar with External Applications

Web Calendar can be configured to pull user and configuration data from an external application. This allows tighter integration when using Web Calendar alongside your own website or application.

The user integration is accomplished by creating a "bridge" script in the includes directory, for example, includes/user-app-myapp.php. There are several functions you will need to define in this script. See the built-in integrations for Joomla and LDAP as examples for the interface you'll need to implement.

Once the script is created, add the following line to includes/settings.php:

user_inc: user-app-myapp.php

The process is much the same for external configs. Create a script such as includes/config-app-myapp.php and define a single function in that script called do_external_configs. This function receives an associative array of all the settings defined in includes/settings.php, and should return a new associated array that overrides those settings. Then, simply add this line to includes/settings.php:

config_inc: config-app-myapp.php

External configs will allow your application to supply, for example, database credentials to Web Calendar, rather than these needing to be stored in plain text in the webcalendar directory.

webcalendar's People

Contributors

bbannon avatar bodqhrohro avatar craigk5n avatar cyfrax avatar dependabot[bot] avatar dmjohnsson23 avatar imgbotapp avatar jawtheshark avatar jeifour avatar ka-mau avatar monnerat avatar ngrgpp avatar peterberbec avatar realsebfox avatar siggen avatar tuaris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webcalendar's Issues

Undefined vars in edit_entry.php

In git master, when accessing edit_entry.php, the site complains of use_fckedit and use_htmlarea being undefined. I've tried with and without includes/FCKeditor-2.0 being present.

At the top of the page, under Add Entry (event):

Notice: Undefined variable: use_fckeditor in <path>/webcalendar-git/edit_entry.php on line 612
Notice: Undefined variable: use_htmlarea in <path>/webcalendar-git/edit_entry.php on line 612

And then, just above the Save button,

Notice: Undefined variable: use_fckeditor in <path>/webcalendar-git/edit_entry.php on line 1693

Needless to say hitting the save button does nothing.

Patches from the sourceforge repo

Hi Craig,

As the Fedora packager of WebCalendar, I left some patches a long time ago on the SF repo: these were never merged nor rejected:

If you are interested in merging them, I can create a PR for you.

Thanks for your reply,
Patrick

postgresql pg_exec(): Query failed

On Ubuntu 16.04 and 14.04:
When using psql as database for the webcalendar some queries constantly fail with the following error: "Warning: pg_exec(): Query failed: ERROR: column "A" does not exist LINE 3: AND cal_status IN ( "A", "W" ) ^ in /var/www/html/calendar/includes/dbi4php.php on line 395".
The reason for this i found were missing escape characters in the following code snipped: WHERE cal_id = ? AND cal_status IN ( "A", "W" ) , which can be found in edit_entry.php(line 365), del_entry.php(line 116) and view_entry.php(lines 237, 263). Which means i am unable do edit and/or delete entries. surprisingly viewing entries works just fine, despite using the same code, except for one place: ( $eType == 'task' ? ' AND cal_status IN ( \'A\', \'W\' )' : '' ) in view_entry(line 648) , which is using the correct escape characters. After adding the correct escape characters to the php-files everything worked as intended.

I'm using php version 7.0.22, psql 9.5.10 and the current version of webCalendar.

Cheers

You cannot access this file directly!

Fresh install of latest version.
All worked fine and all of sudden only : " You cannot access this file directly!" is displayed.

login.php answers normally, but after submitting credentials same "You cannot access this file directly!" is displayed.

Looked through code and "defined ( '_ISVALID' ) or die ( 'You cannot access this file directly!' );" is in the beginning of many .php files.

I bet the reason is _ISVALID. Unfortunately my skills are not good enough to find the root cause....

Many thanks in advance.
Heikki T.

BTW. changing include 'includes/formvars.php'; to include_once 'includes/formvars.php'; in few places helped to fix another issue...

"Invalid referring URL" error when adding an appointment with Safari 10.1.2

I am using Safari 10.1.2 with macOS Sierra 10.12.6. We use PHP 5.6

Its not possible to add an appointment, I get the following error "Invalid referring URL".

We are having the same problem with the latest version 1.3.0 as well as with 1.2.7. Upgrading to 1.3.0 didn't solve the problem...As a workaround we used a different browser (Chrome, Firefox latest versions are OK) just for that...

I now fixed it temporarily with Eribertos suggestion: https://sourceforge.net/p/webcalendar/discussion/11588/thread/cf59cd8c/

This fix doesn't work for Safari latest version: https://sourceforge.net/p/webcalendar/bugs/2607/

Maybe you could integrate a (proper) fix for the next version.

How to display domain name in URL instead of IP

Can anyone give instructions on how to display the correct site address in url?
It's currently displaying my ip, I've created an A record on the domain register site pointing to the ip.
When I type https://calendar.mydomainname.com on the browser it redirects me to xx.xxx.xx.xxx
What should I do?
I've tried editing apache conf files but had no success.

Multiple issues with repeating events

Current build out of github, Apache 2.4.27, PHP 7.1.9.

  1. After creating a repeating event, attempts to edit it will return an error and a skewed Type field. The error returned is:

Warning: A non-numeric value encountered in /usr/local/apache2/htdocs/.../calendar/edit_entry.php on line 765

  1. In the Repeat tab for a repeating event, Exclusions and Inclusions do not work. Clicking on the "Add Exception" or "Add Inclusion" buttons does nothing.

  2. In the Repeat tab for a repeating event, selecting a Weekly repeat type and then choosing individual days for the event seems to have random results as to which days the event will actually repeat and which won't. I can find no rhyme or reason for how it decides.

PHP version support of WebCalender 1.2.8

Can WebCalendar 1.2.8 be used safely with PHP 5.6?

WebCalendar 1.2.7 IIRC only worked faultlessly with PHP 5.3.

I am planning to first update from 1.2.7 to 1.2.8 using PHP 5.3 and then switch to PHP 5.6.

P.S.: Is this the right place to ask questions like that?

Times are wrong after Upgrade

All times (where a time has been added to an event) are shown 4h earlier than they where entered. An event is actually at 20:30 but displayed as 16:30.
It does not matter if I change the timezone in the settings.
What can I do to correct this for all entries?

thanks alot
Jens

Global categories are assigned an owner in webcal_entry_categories

This seems prevent the global category icon from displaying for other users.

Problem seems to be that edit_entry_handler on line 715 assigns the user login to cat_owner even if the category is global. Maybe due to taking the absolute value of the category id a few lines earlier.

How to fix some erros

Comment all lines in install/install_functions.php and install/index.php where set_magic_quotes_runtime appears.
Replace code in includes/formvars.php line 33:
from:
$teststr = preg_replace ( "#(\\x[0-9A-F]{2})#e",
"chr(hexdec('\1'))", $instr[$j] );
to:
$teststr = preg_replace_callback ( "#(\\x[0-9A-F]{2})#",
function ($m){ return chr(hexdec('0x'.$m[1]));}, $instr[$j] );

Not sure if it's the best solution but it did work.
The previous functions doesn't work in PHP 7.0
If I've done something wrong I'll gladly listen to you.

edit: seems that the second solution was already covered in issue #66
edit2:I'll fork the code to make pull request, I'm still a git newbie

UTF-8 support for database (WebCalendar 1.2.8)

I wanted to convert a WebCalendar 1.2.7 install (latin1 encoding) to WebCalendar 1.2.8 (UTF-8).

To do so I made an SQL dump, replaced "=latin1;" with "=utf8;" and imported the SQL file using phpMyAdmin. I am unsure if this is sufficient. In addition, I enabled UTF-8 in WebCalendar's German translations file.

However, entries containing umlauts etc. are missing in the calendar.

I found out that the mySQL server's character_set_server is set to latin1. Unfortunately I am not allowed to change this setting.

Thus the character set must be overridden after the connection to the SQL server has been established using this server default.

I was able to fix the problem by editing "dbi4php.php" and adding a new line 124 containing mysqli_set_charset($c, "utf8");.

I just want to make sure that this is currently the way to go. Or is there any other solution/setting I missed?

Any recommendations on the right choice of the database character set ('utf8' vs. 'utf8mb') are appreciated too.

Remote calendar import requires php7.0-xml (SOLVED)

[Wed Nov 08 20:48:12.361140 2017] [:error] [pid 28430] [client 10.81.228.23:49952] PHP Fatal error: Uncaught Error: Call to undefined function utf8_decode() in /var/www/html/calendar.fair.domain/public_html/WebCalendar-1.2.9/includes/xcal.php:2507\nStack trace:\n#0 /var/www/html/calendar.fair.coop/public_html/WebCalendar-1.2.9/includes/xcal.php(2134): format_ical(Array)\n#1 /var/www/html/calendar.fair.coop/public_html/WebCalendar-1.2.9/edit_remotes_handler.php(116): parse_ical('https://fairkom...', 'remoteics')\n#2 {main}\n thrown in /var/www/html/calendar.fair.domain/public_html/WebCalendar-1.2.9/includes/xcal.php on line 2507, referer: http://calendar.fair.domain/edit_remotes.php?add=1

mysql Ver 14.14 Distrib 5.7.20
PHP 7.0.22-0ubuntu0.16.04.1

You need to add php xml extensions, they are no longer available in standard php7:
sudo apt-get install php7.0-xml

About page has wrong date. 28 Sep 2008

In 1.3 about page has a date 28 sept 2008.
Should be someting in August 2017 or even later.


WebCalendar

version v1.3.0
28 Sep 2008

WebCalendar is a PHP application used to maintain a calendar for a single user or an internet / intranet group of users. It can also be configured as an event calendar.

cross-site request forgery check fails after moving to SSL site.

After moving the webcalender install from something like this:

http://calendar.domain.info

to something like this:

https://comain.info/calender

and adjusting SERVER_URL in the database, the "cross-site request forgery" in functions.php fails.

This happens because the protocol specification (https/http) in $_SERVER['HTTP_REFERER'] does not match with $SERVER_URL. In fact $SERVER_URL contains still "http://..." and not "https://..".

But i still don't understand where $SERVER_URL is set.
It get it's value after $WebCalendar->initializeSecondPhase (); in init.php.
But strangely it isn't set before exiting initializeSecondPhase() in classes/WebCalendar.class itself.
Is there some magic in between?

Title, Description, Location etc NOT SHOWING unless logged in.

Everytime an entry is made the Title, Description, Location etc information only appears when someone is logged in. Everything is set to Public as far as I can tell. Here are a couple of examples of how things are appearing:

  1. On the calendar Month View this is what appears in the window for that day:
    06:00 - 09:00» Not available
    08:00 - 11:00» Not available
    21:00 - 00:00» Not available

  2. When you click on an event to view it, this is how it appears:

Description: | Not available
Location: | Not available
URL: | Not available
Date: | Sunday, February 25, 2018
Repeat Type: | Daily
Time: | 06:00-09:00 EST
Duration: | 3 hours
Access: | Public
Category: | ECHOLINK NET*
Created by: | DEFAULT ADMINISTRATOR
Updated: | Saturday, February 24, 2018 17:48 GMT
Comments: | None

Please let me know what I am doing wrong or how this can be corrected. If you need to view my calendar you can by visiting http://www.NetSchedule.Info

Thank You
James

IPV6 support

I am running calendar on our sports club and the login screen does not work with IPV6 enabled on the server. When it is only IPV4 then it works fine.

The issue on our server is with login: ...\login.php --> that gives http error 500.
With IPV4 works smoothly.

Unfortunately I do not have deeper understanding on root cause. I hope reporting this issue helps.

Calendar entries and descriptions containing umlauts are not shown (WebCalendar 1.2.9)

I updated WebCalendar 1.2.7 to 1.2.9 and switched from PHP 5.3 to PHP 5.6. My WebCalendar install is used in German language and thus data entered in the calendar can contain umlauts.

Strings in my WebCalendar database use the encoding 'latin1' (ISO-8859-1).

Unfortunately updating the PHP version to anything higher than 5.3 breaks WebCalendar. More specifically, calendar entry titles and descriptions containing umlauts and other special characters are not shown in the calendar.

There has been an according bug report on SourceForge: https://sourceforge.net/p/webcalendar/bugs/2709/

I believe this problem will affect most people using a language other than English.

(I was able to circumvent the problem by switching everything to UTF-8, which, however, required a change in a WebCalendar core PHP file to set the proper encoding, see #33).

User manager - cannot switch to Group Tab

Hello,
if you want to add group, you have to go to User Manager Settings. There is several tabs (depending what you have seleceted in preferences). If you click on Group tab, nothing happens.

There is an error in \includes\js\users.php
missing commas

right code:
var tabs = ['','users','groups','nonusers','remotes'];

PHP Fatal error: Cannot redeclare preventhacking() in \x18\xb7,\xe3ZU on line 21

In webserver error log plenty of preventhacking on line 21.
Endresult is that login page gives 500 error and I can not login.
About 1/5th of refereshes gives ok response, 4/5 gives 500 error from login page.

[Mon Aug 21 20:58:44.022136 2017] [:error] [pid 5233] [client 91.152.167.194:57134] PHP Fatal error: Cannot redeclare preventhacking() in \x18\xb7,\xe3ZU on line 21, referer: xxxxx /month.php
[Mon Aug 21 20:58:47.679431 2017] [:error] [pid 5236] [client 91.152.167.194:57137] PHP Fatal error: Cannot redeclare preventhacking() in \xf8\xabs\xe3ZU on line 21,

Problème création événement

Bonjour,

J'ai rencontré à plusieurs reprise un problème de création d'événement.
En effet, à la création tout apparaît super et après la fermeture et réouverture de l'agenda tout est vide.

A quoi cela peut-être dû ?

Bonne journée

PHP 7.0 throws stderr

Updated to the latest Master for WebCalendar.

Using PHP 5.6, webcalendar version 1.3.0 (28 Sep 2008)

Using PHP 7.0 -- Error Log

mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /home/************/public_html/*********/includes/dbi4php.php:144
mod_fcgid: stderr: Stack trace:
mod_fcgid: stderr: #0 /home/******/public_html/*********/includes/config.php(244): dbi_connect('localhost', '********', '******************...', '**********', false)
mod_fcgid: stderr: #1 /home/*********/public_html/***********/includes/classes/WebCalendar.class(292): do_config('/home/*********/...')
mod_fcgid: stderr: #2 /home/************/public_html/************/includes/classes/WebCalendar.class(978): WebCalendar->_initConfig()
mod_fcgid: stderr: #3 /home/************/public_html/************/includes/classes/WebCalendar.class(990): WebCalendar->_doInit(1)
mod_fcgid: stderr: #4 /home/************/public_html/************/includes/init.php(64): WebCalendar->initializeFirstPhase()
mod_fcgid: stderr: #5 /home/************/public_html/************/index.php(2): include_once('/home/newburns/...')
mod_fcgid: stderr: #6 {main}
mod_fcgid: stderr:   thrown in /home/************/public_html/************/includes/dbi4php.php on line 144

[Question] How to improve security?

What should be the optimal files and folder permissions to improve security?
What's needed in order to deny files reads/writes that aren't needed for WebCalendar to run?
Current setup: www-data owns the whole folder, and the permissions are the default except for includes folder, for which I've denied write permission. I've also removed Indexes in apache2.conf to disable directory listing.
Thanks!

Invalid referring URL after switching from http to https

Running V1.2.7 - life was good and no problems. Added a Cert and switched over to httpS - Calendar comes up but when I try to add an event and "Save" I get "Invalid referring URL".
In includes/functions.php I commented out "die_miserable_death" and it seems to be working again - I hope it's working - but something else may have broken.
It fails because "$_SERVER['HTTP_REFERER']" is empty.

What is the proper fix? Thanks

different time displayed in webcalendar and Google calendar

I'm using the webcalender on my homepage and so far it all looks fine. After updating to the newest version some of my termins were 5h back but after editing them everything looks fine.

Now I wanted to connect the calender to my google calendar. For that I went to google and added a new calendar by url "www.mypage.de/Calendar/publish.php/BBD.ics"

Google displays my termins now all but for some the time value is correct and for some the time value is one hour back. How can this be? For example this: One repeating entry has the same time and the other is one hour difference
that's how it looks in webcalendar
webcal

this is how it looks at google
googlecal

The used time zone is Berlin

I'm not sure maybe one is still from the old calender and one after installing the latest version. How can I fix this?

When I look in google at the ical url then I see that google says the webcalende ical would be (GMT+00:00) UTC but in the webcalender I have Berlin as time zone. Maybe that's the problem?

Error in ADMIN.php

In admin PHP when I change the Email settings it looks lik it's not working.
also toggle SMTP settings are vissible when PHP-m,ail is selected

ALso there are some floating " (double quotes)

image

Creating new menu items (other users' calendars)

My apologies if I've put this in the wrong place.

I'm looking at the custom menu part of menu_config.php and am just wanting to make a menu item containing direct links to the different users' calendars (rather than having to select from the select_user.php page).

I feel this must be pretty easily done in the $menuExtras section of menu_config.php but I don't know where to find out what I can actually put in here! Any help hugely appreciated.

I'm running 1.3.0.

time zone errors in generated ical (or at least as received by local iPad)

My webcal server is in central standard time in America, an example of this is Chicago. I have set my server to Chicago. I run the server from Melbourne, Australia and have set the time zone in preferences accordingly.
My problem is that when I generate an event in the calendar it is recorded, seemingly accurately.
However, when I export to vcal and add to my iPad calendar I get the event but with a 10-hour error.
The settings generated for this bug report show that I have a setting of NewYork for my home or user timezone ( this is where I think I should have Melbourne, Australia).

Hidden macOS settings files in the release package (WebCalendar 1.2.8)

The WebCalendar 1.2.8 release package contains macOS setting files which should not be included in the release. These files are not shown on macOS, but they are visible on Windows and they have to be deleted manually before uploading the files from the release package to the server. The file names start with "._", e.g., "._GPL.html", "._favicon.ico", "docs/._newwin.gif", "icons/._example.gif", etc.

TZ environment variable

On page: http://php.net/%20date_default_timezone_set
Note:
Since PHP 5.1.0 (when the date/time functions were rewritten), every call to a date/time function will generate a E_NOTICE if the timezone isn't valid, and/or a E_WARNING message if using the system settings or the TZ environment variable.

So, maybe we should stop using set_env ('TZ')

Admin Available Themes are missing

When trying to save on the new 1.29 I can't change the System Settings themes.

Error log
mod_fcgid: stderr: PHP Warning: include_once(): Failed opening 'includes/available_themes.php' for inclusion (include_path='.:/opt/rh/rh-php70/root/usr/share/pear:/opt/rh/rh-php70/root/usr/share/php') in /home/newburns/public_html/eaglecal/admin.php on line 6

Advanced Search does not work

Current build out of github, Apache 2.4.27, PHP 7.1.9

Normal searches out of the search box work fine, but all advanced searches only search the logged-in user (even if you select other users), and return this error message:

Warning: addslashes() expects parameter 1 to be string, array given in /usr/local/apache2/htdocs/.../calendar/includes/formvars.php on line 112

Umlauts are not displayed (correctly)

Hello,

I am working for a small Theater and we used the Webcalendar v1.0.4) since quite some years.
Now I had to move to a new Webserver with PHP 5.6. The current version of the calendar did no longer work.
So, I upgraded to Version 1.2.9 and all seems to be fine except the Titles of Events which are with umlauts like é, ö etc. are not displayed correctly. In the calendar view the time is displayed or just a dot but no title and when I open the entry the title is displayed like this:
bildschirmfoto 2018-06-28 um 17 44 14

Hope one can help me with this.

thanks
Jens

Adding a new task creates an error message, because of a nunnumeric value - fixed

Adding a new task creates an error message, because of a nunnumeric value - fixed

Just a minor issue:
Creating a new task, if running on PHP 7.x leads to an error message that a nunumeric value is used. It boils down to line 453 in release 1.2.9. I fixed it and added a new pull-request.

old code:
// Avoid error for using undefined vars.
if ( ! isset ( $hour ) && $hour != 0 )
$hour = -1;
else
if ( isset ( $hour ) && $hour >= 0 )
$cal_time = ( $hour * 10000 ) + ( isset ( $minute ) ? $minute * 100 : 0 );

problem:
$minute can be set but it can be non numeric, so you have to check that as well

new code:
// Avoid error for using undefined vars.
if ( ! isset ( $hour ) && $hour != 0 )
$hour = -1;
else
if ( isset ( $hour ) && $hour >= 0 )
{
// FG: Make sure that $minute is set and numeric or set it to 0 to avoid am error message
if (isset ( $minute ))
{
if (!is_numeric ($minute)) $minute = 0;
}
else $minute = 0;
$cal_time = ( $hour * 10000 ) + ( $minute * 100 );
}

No issue: Step by step guide 1. upgrade from 1.27 to 1.29 and 2. make it run under PHP 7.1.x

Experience and lessons learned while upgrading from 1.27 to 1.29 and porting WebCalendar 1.29 to PHP 7.1

Dear Users,

as I do not belong to the project I cannot update the source code (at least as of now).

History
I am using the WebCalendar in Germany for about 50 users on MySQL on a server at a German hosting company. We installed the application via our internet hosting company, that used a PLESK Software to administrate the account, initially on the basis of PHP 5.3.x. In September 2017 the internet provider announced that PHP 5.3.x will no longer be supported because of security concerns. We could choose between 5.6.x, 7.0.x and 7.1.x which in turn did not allow WebCalendar to work.
As the internet provider offered no help and we wanted to keep using WebCalendar, we decided to adapt the code and to make it run under PHP 7.1.x and to keep the data (to avoid re-entering anything). In the end we were successful. The following is a step by step explanation of what we did to make it work.

What we did:

  1. We downloaded the release 1.29 and installed it alongside the 1.27 release (each in a separate) directory.
  2. We exported the database from our live system (for backup reasons using PHPMyAdmin).
  3. We updated the table webcal_config in the MYSQL database, actually just one single record: SERVER_URL must point to the new test site and path where your WebCalendar software is located (in our case the /.
  4. We updated the file /include/settings.php -> actually all you have to do is to remove the installation password. That causes that you are being asked to provide a new password (which is necessary to proceed in the upgrading process). This step is only necessary if you do not know the old installation password (as I did - reason being the automated install of version 1.27 was done by someone else)
    The second necessary change in the file /include/settings.php was the line with the db_type (previous setting mysql) which must be changed to mysqli (i stands for improved). The reason for that is, that the PHP function mysql_connect does not exist in PHP 7.x (was deprecated in 5.5 and later). The new connection method (mysqli) is quite different as it allows several database connection to the same server, but already supported by the WebCalendar code (already in release 1.27).
  5. Update the source code according to the appended list (incompatible changes in PHP 7.x and the libraries)
  6. Next you start your browser with the install directory of your /WebCalendar129 (in my case). This will guide you quite nicely through the upgrade process.
  7. Then start up the calendar in your browser and you are done => WebCalendar runs on PHP 7.1 - which is quite a bit faster as it was before due to improvements in PHP 7.x (over 5.x).

That makes the code work und PHP 7.1.x without any warning messages. We did not check through all functions, but on those we did there was no problem we could find and we use the WebCalendar quite extensively. In fact the changes needed were minimal and the effort to implement the changes took only a few hours. Following the steps above takes an hour or less (my estimate).

In case you have trouble implementing these changes you could send me an e-mail. But beware: It might take some time for me to answer. Please be aware that I am not the project owner of the project WebCalendar I am just using it and I am very grateful for the extensive and well functioning work that had been done by Mr Knudsen. As it is an open source project I am able to adapt it to my needs.

kind regards
Franz Gotsis
Munich, Germany
[email protected]

List of source code changes I did so far (but could not check in).
I did not yet walk through the code systematically, but I did change the code whenever I got errors or unintended behaviour. So be aware that these changes might not be everything that is needed. The changes might as well not be the most elegant ones, I did just enough to make the code work.

a) /includes/menu/index.php)
old: (lines 238 onwards)
$tmp['name'] = $f;
$tmp['url'] = $xurl;
$groups[] = $tmp;
new:
$tmp=array();
$tmp['name'] = $f;
$tmp['url'] = $xurl;
$groups = array();
$groups[] = $tmp;

The reason is that implicit array declarations are no longer supported since PHP 7.0. You have to initialise all array variables before you use them. In this case the arrays groups and tmp had not been initialised before assigning values.

b) /includes/formvar.php (just warnings - but those point to vulnerabilities) - lines 34 onwards
The purpose of these lines of codes (also according to the existing comments) is to prevent attacks on the integrity of the WebCalendar server by adding commands into the post code that should not be there. In line 21 there is a list of tags (words) to look for, that might mean adding code into the post command that could lead to a generation of html pages that might listen on users o trick them into providing passwords or do any other malicious activities.
To prevent the code searching the POST or GET (HTTP) commands from failing because of hiding the names of these tags in escape commands (the tag SCRIPT could be hidden as \x53\x43\x52\x49\x50\x54). The idea of the code was to replace the hexcodes by their proper ASCII characters and then to do a text search. The method intended to achieve that goal was a call to the built-in function preg_replace, which in PHP 5.x allowed not only a replacement by strings, but when given the "/e" option in the first argument (equivalent to #e) to execute function on the matches found.
Starting with PHP 7.x this will not work as the /e option is ignored which leads to a failure of the security mechanism. The PHP function to use now is preg_replace_callback, which calls a user provided function for every match.

Previous code:
$teststr = preg_replace ( "#(\\x[0-9A-F]{2})#e",
"chr(hexdec('\1'))", $instr[$j] );
PHP 5.6 onwards compatible tested replacement:
$teststr = preg_replace_callback(
'/(\\x[0-9A-Fa-f]{2})/',
function($matches){
foreach($matches as $match){
return chr(hexdec($match));
}
},
$instr[$j]
);

====================
These were all the changes (pretty few) that I found necessary to make the code run on a site that uses PHP 7.1 or later (currently - 28.12.2017) the latest PHP release.
None of the changes affects data or the user aware functions of the program WebCalendar.

Translation

Can you please guide me on how I can fix my characters view?
Can't read those words ç/á/é/í/ó/ú/ã/õ/à/è/ì/ò/ù

Entry's Brief Description Overwrites Long Description When Editing

Hi,

I noticed weird behavior when setting the allowed summary length to e.g. 2000. Then, when creating a new entry, I can add a very long description; the description is correctly saved and shown in the PopUp of the entry. If I now edit the entry, only the short version (80 characters for me) is shown in the entry's brief description input field. So when I save, the long description is overwritten with the short one.

Not sure if that's a bug, intended or I misunderstood the allowed summary length setting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.