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

Abstract nulldate #11396

Merged
merged 3 commits into from
Aug 7, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<?php echo JStringPunycode::emailToUTF8($this->escape($item->email)); ?>
</td>
<td class="hidden-phone hidden-tablet">
<?php if ($item->lastvisitDate != '0000-00-00 00:00:00'):?>
<?php if ($item->lastvisitDate != $this->db->getNullDate()):?>
<?php echo JHtml::_('date', $item->lastvisitDate, 'Y-m-d H:i:s'); ?>
<?php else:?>
<?php echo JText::_('JNEVER'); ?>
Expand Down
33 changes: 33 additions & 0 deletions administrator/components/com_users/views/users/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ class UsersViewUsers extends JViewLegacy
* @since 1.6
*/
protected $state;

/**
* A JForm instance with filter fields.
*
* @var JForm
* @since 3.6
*/
public $filterForm;

/**
* An array with active filters.
*
* @var array
* @since 3.6
*/
public $activeFilters;

/**
* An ACL object to verify user rights.
*
* @var JObject
* @since 3.6
*/
protected $canDo;

/**
* An instance of JDatabaseDriver.
*
* @var JDatabaseDriver
* @since 3.6
*/
protected $db;

/**
* Display the view
Expand All @@ -55,6 +87,7 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->canDo = JHelperContent::getActions('com_users');
$this->db = JFactory::getDbo();

UsersHelper::addSubmenu('users');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<?php echo $this->escape($item->email); ?>
</td>
<td class="center">
<?php if ($item->lastvisitDate != '0000-00-00 00:00:00') : ?>
<?php if ($item->lastvisitDate != $this->db->getNullDate()) : ?>
<?php echo JHtml::_('date', $item->lastvisitDate, 'Y-m-d H:i:s'); ?>
<?php else:?>
<?php echo JText::_('JNEVER'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<?php endif; ?>

<?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate())
|| ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != '0000-00-00 00:00:00' )) : ?>
|| ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?>
</div>
<?php endif; ?>

Expand Down
10 changes: 9 additions & 1 deletion components/com_content/views/featured/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class ContentViewFeatured extends JViewLegacy
protected $link_items = array();

protected $columns = 1;

/**
* An instance of JDatabaseDriver.
*
* @var JDatabaseDriver
* @since 3.6
*/
protected $db;

/**
* Execute and display a template script.
Expand Down Expand Up @@ -62,7 +70,6 @@ public function display($tpl = null)
// Get the metrics for the structural page layout.
$numLeading = (int) $params->def('num_leading_articles', 1);
$numIntro = (int) $params->def('num_intro_articles', 4);
$numLinks = (int) $params->def('num_links', 4);

// Compute the article slugs and prepare introtext (runs content plugins).
foreach ($items as &$item)
Expand Down Expand Up @@ -145,6 +152,7 @@ public function display($tpl = null)
$this->items = &$items;
$this->pagination = &$pagination;
$this->user = &$user;
$this->db = JFactory::getDbo();

$this->_prepareDocument();

Expand Down
2 changes: 1 addition & 1 deletion components/com_users/views/profile/tmpl/default_core.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<?php echo JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL'); ?>
</dt>

<?php if ($this->data->lastvisitDate != '0000-00-00 00:00:00') : ?>
<?php if ($this->data->lastvisitDate != $this->db->getNullDate()) : ?>
<dd>
<?php echo JHtml::_('date', $this->data->lastvisitDate); ?>
</dd>
Expand Down
9 changes: 9 additions & 0 deletions components/com_users/views/profile/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ class UsersViewProfile extends JViewLegacy

protected $state;

/**
* An instance of JDatabaseDriver.
*
* @var JDatabaseDriver
* @since 3.6
*/
protected $db;

/**
* Execute and display a template script.
*
Expand All @@ -43,6 +51,7 @@ public function display($tpl = null)
$this->twofactorform = $this->get('Twofactorform');
$this->twofactormethods = UsersHelper::getTwoFactorMethods();
$this->otpConfig = $this->get('OtpConfig');
$this->db = JFactory::getDbo();

// Check for errors.
if (count($errors = $this->get('Errors')))
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/user/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static function activateUser($activation)
->from($db->quoteName('#__users'))
->where($db->quoteName('activation') . ' = ' . $db->quote($activation))
->where($db->quoteName('block') . ' = 1')
->where($db->quoteName('lastvisitDate') . ' = ' . $db->quote('0000-00-00 00:00:00'));
->where($db->quoteName('lastvisitDate') . ' = ' . $db->quote($db->getNullDate()));
$db->setQuery($query);
$id = (int) $db->loadResult();

Expand Down