Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #420

Merged
merged 15 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

#### 27-02-2018
### Fixed
* Saving bug resulting in call on null / rp_id() / location()
* Event and event repeat selector not working due to incorrect JSession Check
* Emptying trashed events
* Joomla 3.6.x fatal error when trying to load Joomla 3.7 new calendar.

#### 17-02-2018 Geraint Edwards
* JEvents 3.4.44
* Authorisation check on save should check creator and editor permissions
Expand Down
19 changes: 10 additions & 9 deletions component/admin/controllers/icalevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,6 @@ protected function toggleICalEventPublish($cid, $newstate)

function emptytrash()
{
$app = JFactory::getApplication();
$jinput = $app->input();
// clean out the cache
$cache = JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
Expand All @@ -1470,8 +1468,11 @@ function emptytrash()
return false;
}
*/
$cid = $jinput->get('cid', array(0), "array");

$app = JFactory::getApplication();
$jinput = $app->input;

$cid = $jinput->get('cid', array(0), "array");
$cid = ArrayHelper::toInteger($cid);

// front end passes the id as evid
Expand Down Expand Up @@ -1551,25 +1552,25 @@ function emptytrash()
}
else
{
$Itemid = $app->getInt("Itemid");
$Itemid = $jinput->getInt("Itemid");
list($year, $month, $day) = JEVHelper::getYMD();
$rettask = $app->getString("rettask", "day.listevents");
$rettask = $jinput->getString("rettask", "day.listevents");
$this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task=$rettask&year=$year&month=$month&day=$day&Itemid=$Itemid", false), JTEXT::_("ICAL_EVENT_DELETED"));
$this->redirect();
}
}
else
{
if (JFactory::getApplication()->isAdmin())
if ($app->isAdmin())
{
$this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=icalevent.list");
$this->redirect();
}
else
{
$Itemid = $app->getInt("Itemid");
$Itemid = $jinput->getInt("Itemid");
list($year, $month, $day) = JEVHelper::getYMD();
$rettask = $app->getString("rettask", "day.listevents");
$rettask = $jinput-getString("rettask", "day.listevents");
$this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task=$rettask&year=$year&month=$month&day=$day&Itemid=$Itemid", false));
$this->redirect();
}
Expand Down Expand Up @@ -1598,7 +1599,7 @@ function _checkValidCategories()

function select()
{
JSession::checkToken('default') or jexit('Invalid Token');
JSession::checkToken('request') or jexit('Invalid Token');

// get the view
if (JFactory::getApplication()->isAdmin()){
Expand Down
2 changes: 1 addition & 1 deletion component/admin/controllers/icalrepeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function apply()

function select()
{
JSession::checkToken('default') or jexit('Invalid Token');
JSession::checkToken('request') or jexit('Invalid Token');

$app = JFactory::getApplication();
$jinput = $app->input;
Expand Down
142 changes: 97 additions & 45 deletions component/site/libraries/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,69 +655,121 @@ function loadElectricCalendar($fieldname, $fieldid, $value, $minyear, $maxyear,
//JHtml::_('stylesheet', 'system/calendar-jos.css', array('version' => 'auto', 'relative' => true), $attribs);

$tag = JFactory::getLanguage()->getTag();
$calendar = JFactory::getLanguage()->getCalendar();
$direction = strtolower(JFactory::getDocument()->getDirection());

// Get the appropriate file for the current language date helper
$helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';

if (!empty($calendar) && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar)))
if (version_compare(JVERSION, '3.7.0', '<'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just reinstating the old code for versions prior to 3.7.0 ?

{
$helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
}
$calendar = JFactory::getLanguage()->getCalendar();
$direction = strtolower(JFactory::getDocument()->getDirection());

// Get the appropriate locale file for the current language
$localesPath = 'system/fields/calendar-locales/en.js';
// Get the appropriate file for the current language date helper
$helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';

if (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js'))
{
$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
}
elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
{
$localesPath = 'system/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
}

$direction = strtolower(JFactory::getDocument()->getDirection());
$cssFileExt = ($direction === 'rtl') ? '-rtl.css' : '.css';

// Load polyfills for older IE
JHtml::_('behavior.polyfill', array('event', 'classlist', 'map'), 'lte IE 11');
if (!empty($calendar) && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar)))
{
$helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
}

// Get the appropriate locale file for the current language
$localesPath = 'system/fields/calendar-locales/en.js';

if (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js'))
{
$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
}
elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
{
$localesPath = 'system/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
}

$direction = strtolower(JFactory::getDocument()->getDirection());
$cssFileExt = ($direction === 'rtl') ? '-rtl.css' : '.css';

// The static assets for the calendar
JHtml::_('script', $localesPath, false, true, false, false, true);
JHtml::_('script', $helperPath, false, true, false, false, true);
JHtml::_('script', 'system/fields/calendar.min.js', false, true, false, false, true);
JHtml::_('stylesheet', 'system/fields/calendar' . $cssFileExt, array(), true);

// Hide button using inline styles for readonly/disabled fields
$btn_style = ($readonly || $disabled) ? ' style="display:none;"' : '';
$div_class = (!$readonly && !$disabled) ? ' class="input-append"' : '';
// Load polyfills for older IE
JHtml::_('behavior.polyfill', array('event', 'classlist', 'map'), 'lte IE 11');

echo '<div class=" field-calendar">'
. '<div' . $div_class . '>'
// The static assets for the calendar
JHtml::_('script', $localesPath, false, true, false, false, true);
JHtml::_('script', $helperPath, false, true, false, false, true);
JHtml::_('script', 'system/fields/calendar.min.js', false, true, false, false, true);
JHtml::_('stylesheet', 'system/fields/calendar' . $cssFileExt, array(), true);

// Hide button using inline styles for readonly/disabled fields
$btn_style = ($readonly || $disabled) ? ' style="display:none;"' : '';
$div_class = (!$readonly && !$disabled) ? ' class="input-append"' : '';

echo '<div class=" field-calendar">'
. '<div' . $div_class . '>'
. '<input type="text" title="' . ($inputvalue ? JHtml::_('date', $value, null, null) : '')
. '" name="' . $name . '" id="' . $fieldid . '" '
. 'value="' . htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') . '" '
. 'data-alt-value="'. htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') .'" ' . $attribs . ' />'
. '<button type="button" class="btn btn-secondary '.$btn_style.'"
. 'value="' . htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') . '" '
. 'data-alt-value="' . htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') . '" ' . $attribs . ' />'
. '<button type="button" class="btn btn-secondary ' . $btn_style . '"
id="' . $fieldid . '_btn"
data-inputfield="' . $fieldid . '"
data-dayformat="' . $format .'"
data-dayformat="' . $format . '"
data-button="' . $fieldid . '_btn"
data-firstday="'.$offset.'"
data-weekend="'. JFactory::getLanguage()->getWeekEnd(). '"
data-firstday="' . $offset . '"
data-weekend="' . JFactory::getLanguage()->getWeekEnd() . '"
data-today-btn="1"
data-week-numbers="0"
data-show-time="0"
data-show-others="1"
data-only-months-nav="0"
data-time-24="24"
'. (!empty($minYear) ? 'data-min-year="' . $minYear . '"' : "") .'
'. (!empty($maxYear) ? 'data-max-year="' . $maxYear . '"' : "") .'
' . (!empty($minYear) ? 'data-min-year="' . $minYear . '"' : "") . '
' . (!empty($maxYear) ? 'data-max-year="' . $maxYear . '"' : "") . '
><span class="icon-calendar"></span></button>. '
. '</div>'
. '</div>';
. '</div>'
. '</div>';
} else {
JHtml::_('script', $tag . '/calendar-setup.js', array('version' => 'auto', 'relative' => true));
JHtml::_('stylesheet', 'system/calendar-jos.css', array('version' => 'auto', 'relative' => true), $attribs);

// Only display the triggers once for each control.
if (!in_array($fieldid, $done))
{
$document = JFactory::getDocument();
$document
->addScriptDeclaration(
'jQuery(document).ready(function($) {
if (!jQuery("#' . $fieldid . '").length) {
alert("' . JText::sprintf("JEV_MISSING_CALENDAR_FIELD_IN_PAGE", true) . '\n\n" + "' . $fieldid . '" );
return;
}
Calendar.setup({
// Id of the input field
inputField: "' . $fieldid . '",
// Format of the input field
ifFormat: "' . $format . '",
// Trigger for the calendar (button ID)
button: "' . $fieldid . '_img",
// Alignment (defaults to "Bl")
align: "Tl",
// firstDay numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc.
firstDay: '.$offset.',
// Allowable date range for picker
range:['.$minyear.','.$maxyear.'],
// electric false means field update ONLY when a day cell is clicked
electric:false,
singleClick: true,
showsTime:'.$showtime.',
timeFormat:'.$timeformat.',
});});'
);
$done[] = $fieldid;
}

// Hide button using inline styles for readonly/disabled fields
$btn_style = ($readonly || $disabled) ? ' style="display:none;"' : '';
$div_class = (!$readonly && !$disabled) ? ' class="input-append"' : '';

echo '<div' . $div_class . '>'
. '<input type="text" title="' . ($inputvalue ? JHtml::_('date', $value, null, null) : '')
. '" name="' . $name . '" id="' . $fieldid . '" value="' . htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') . '" ' . $attribs . ' />'
. '<button type="button" class="btn" id="' . $fieldid . '_img"' . $btn_style . '><span class="icon-calendar"></span></button>'
. '</div>';

}

}

Expand Down
4 changes: 2 additions & 2 deletions component/site/libraries/jeventshtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ public static function buildCategorySelect($catid, $args, $catidList = null, $wi
$html = ob_get_clean();
if (count($options) == 1)
{
$html = "<div class='catname'>". $options[0]->text. "</div>";
$html .= "<input type='hidden' name='$fieldname' value='$catid' />";
$html = "<div class='catname'>". $options[0]->text. "</div>";
$html .= "<input type='hidden' name='" . $fieldname . "[]' value='$catid' />";
}
return $html;
}
Expand Down