Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sproctor/php-calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
vagrant committed Jan 1, 2018
2 parents 68ff692 + 68e9d79 commit 33fb38a
Show file tree
Hide file tree
Showing 31 changed files with 2,894 additions and 2,719 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
NEWS
-----

2.0.10 (6 April 2017):
- Update jquery/jquery ui versions
- Use markdown to format event descriptions

2.0.9 (5 January 2015):
- A few minor attempts at improving security.
- Fixed search and day displays for timezones other than the server.
Expand Down
54 changes: 29 additions & 25 deletions includes/calendar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright 2012 Sean Proctor
* Copyright 2017 Sean Proctor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -701,7 +701,7 @@ function init_config_options() {
* @return array
*/
function get_theme_list() {
$themes = array(
$themes = array('base',
'black-tie',
'blitzer',
'cupertino',
Expand Down Expand Up @@ -769,7 +769,7 @@ function get_date_format_list()
* @return Html
*/
function display_phpc() {
global $phpc_messages, $phpc_redirect, $phpc_script, $phpc_prefix;
global $phpc_messages, $phpc_redirect, $phpc_script, $phpc_prefix, $phpc_home_url, $phpc_cal, $phpcdb;

$navbar = false;

Expand All @@ -785,13 +785,24 @@ function display_phpc() {
// If we're redirecting, the messages might not get
// seen, so don't clear them
if(empty($phpc_redirect))
$_SESSION["{$phpc_prefix}messages"] = NULL;
$_SESSION[$phpc_prefix . 'messages'] = null;
} else {
$messages = '';
}

return tag('', $navbar, $messages,
$content, footer());
$list = array();
foreach($phpcdb->get_calendars() as $calendar) {
$list[$phpc_home_url . '?phpcid=' . $calendar->get_cid()] = $calendar->get_title();
}

return tag('div', attributes('class="php-calendar ui-widget"'),
userMenu(),
tag('br', attrs('style="clear:both;"')),
tag('h1', attrs('class="ui-widget-header"'),
create_dropdown_list(tag('a', attrs("href='$phpc_home_url?phpcid={$phpc_cal->get_cid()}'",
'class="phpc-dropdown-list-title"'),
$phpc_cal->get_title()), $list)),
$navbar, $messages, $content, footer());
} catch(PermissionException $e) {
$results = tag('');
// TODO: make navbar show if there is an error in do_action()
Expand Down Expand Up @@ -904,10 +915,10 @@ function get_header_tags($path)

$theme = $phpc_cal->theme;
if(empty($theme))
$theme = 'smoothness';
$jquery_version = "1.12.4";
$jqueryui_version = "1.12.1";
$jpicker_version = "1.1.6";
$theme = 'base';
$jquery_version = "3.2.1";
$jqueryui_version = "1.12.1";
$showdown_version = "1.8.2";

return array(
tag('link', attrs('rel="stylesheet"', 'type="text/css"',
Expand All @@ -916,22 +927,15 @@ function get_header_tags($path)
"href=\"//ajax.googleapis.com/ajax/libs/jqueryui/$jqueryui_version/themes/$theme/jquery-ui$jq_min.css\"")),
tag('link', attrs('rel="stylesheet"', 'type="text/css"',
"href=\"$path/jquery-ui-timepicker.css\"")),
tag("script", attrs('type="text/javascript"',
"src=\"//ajax.googleapis.com/ajax/libs/jquery/$jquery_version/jquery$jq_min.js\""), ''),
tag("script", attrs('type="text/javascript"',
"src=\"//ajax.googleapis.com/ajax/libs/jqueryui/$jqueryui_version/jquery-ui$jq_min.js\""), ''),
tag('script', attrs('type="text/javascript"'),
"var imagePath='$path/images/'"),
tag('script', attrs('type="text/javascript"',
"src=\"$path/phpc.js\""), ''),
tag("script", attrs('type="text/javascript"',
"src=\"$path/jquery.ui.timepicker.js\""), ''),
tag("script", attributes('type="text/javascript"',
"src=\"$path/jquery.hoverIntent.minified.js\""), ''),
tag("script", attrs('type="text/javascript"',
"src=\"$path/jpicker-$jpicker_version$jq_min.js\""), ''),
tag("script", attrs("src=\"//ajax.googleapis.com/ajax/libs/jquery/$jquery_version/jquery$jq_min.js\""), ''),
tag("script", attrs("src=\"//ajax.googleapis.com/ajax/libs/jqueryui/$jqueryui_version/jquery-ui$jq_min.js\""), ''),
tag('script', attrs("src=\"$path/phpc.js\""), ''),
tag("script", attrs("src=\"$path/jquery.ui.timepicker.js\""), ''),
tag("script", attrs("src=\"$path/jquery.hoverIntent.minified.js\""), ''),
tag("script", attrs("src=\"$path/spectrum.js\""), ''),
tag('link', attrs('rel="stylesheet"', 'type="text/css"',
"href=\"$path/jPicker-$jpicker_version$jq_min.css\"")),
"href=\"$path/spectrum.css\"")),
tag("script", attrs("src=\"https://cdnjs.cloudflare.com/ajax/libs/showdown/$showdown_version/showdown.min.js\""), ''),
);
}

Expand Down
4 changes: 2 additions & 2 deletions includes/category_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function category_form() {
);
} else {
$defaults = array(
'text-color' => '000000',
'bg-color' => 'FFFFFF',
'text-color' => '#000000',
'bg-color' => '#FFFFFF',
);
}
return $form->get_form($defaults);
Expand Down
12 changes: 8 additions & 4 deletions includes/category_submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ function category_submit()
// The current widget produces hex values without the "#".
// We may in the future want to allow different input, so store the
// values with the "#"
$text_color = '#'.$vars["text-color"];
$bg_color = '#'.$vars["bg-color"];
$text_color = $vars["text-color"];
$bg_color = $vars["bg-color"];
if(empty($vars['gid']) || strlen($vars['gid']) == 0)
$gid = 0;
else
$gid = $vars['gid'];

if(!check_color($text_color) || !check_color($bg_color))
soft_error(__("Invalid color."));
if(!check_color($text_color)) {
soft_error(__("Invalid color: ") . "\"$text_color\"");
}
if(!check_color($bg_color)) {
soft_error(__("Invalid color: ") . "\"$bg_color\"");
}

if(!isset($vars['catid'])) {
$modify = false;
Expand Down
2 changes: 1 addition & 1 deletion includes/display_day.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function display_day()
$html_body->add(tag('tr',
$html_subject,
tag('td', $event->get_time_span_string()),
tag('td', $event->get_desc())));
tag('td', attributes('class="phpc-desc"'), $event->get_desc())));
}

$html_table->add($html_body);
Expand Down
9 changes: 5 additions & 4 deletions includes/display_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ function display_event_by_oid($oid)
$month = $event->get_start_month();
$day = $event->get_start_day();

$desc_tag = tag('div', attributes('class="phpc-desc"'),
$desc_tag = tag('div',
tag('h3', __("Description")),
tag('p', $event->get_desc()));
tag('p', attributes('class="phpc-desc"'),
$event->get_desc()));

return tag('div', attributes('class="phpc-main phpc-event"'),
tag('h2', $event->get_subject()), $event_header,
Expand Down Expand Up @@ -178,9 +179,9 @@ function display_event_by_eid($eid)
'event_delete', $eid)));
}

$desc_tag = tag('div', attributes('class="phpc-desc"'),
$desc_tag = tag('div',
tag('h3', __("Description")),
tag('p', $event->get_desc()));
tag('p', attributes('class="phpc-desc"'), $event->get_desc()));

$occurrences_tag = tag('ul');
$occurrences = $phpcdb->get_occurrences_by_eid($eid);
Expand Down
8 changes: 1 addition & 7 deletions includes/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@
require_once("$phpc_includes_path/setup.php");

$calendar_title = $phpc_cal->get_title();
$content = tag('div', attributes('class="php-calendar ui-widget"'),
userMenu(),
tag('br', attributes('style="clear:both;"')),
tag('h1', attrs('class="ui-widget-header"'),
tag('a', attributes("href='$phpc_home_url?phpcid={$phpc_cal->get_cid()}'"),
$calendar_title)),
display_phpc());
$content = display_phpc();
} catch(Exception $e) {
$calendar_title = $e->getMessage();
$content = tag('div', attributes('class="php-calendar"'),
Expand Down
Loading

0 comments on commit 33fb38a

Please sign in to comment.