Skip to content

Commit

Permalink
Bug: 13336 Fix removing device state when multiple accounts exist on …
Browse files Browse the repository at this point in the history
…the same device.
  • Loading branch information
mrubinsk committed Jul 10, 2014
1 parent a70df7a commit 01b2639
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions horde/admin/activesync.php
Expand Up @@ -27,6 +27,11 @@
/** Check for any actions **/
if ($actionID = Horde_Util::getPost('actionID')) {
$deviceID = Horde_Util::getPost('deviceID');

$device_desc = explode(':', $deviceID);
$deviceID = $device_desc[0];
$user = $device_desc[1];

switch ($actionID) {
case 'wipe':
$state->setDeviceRWStatus($deviceID, Horde_ActiveSync::RWSTATUS_PENDING);
Expand Down Expand Up @@ -82,13 +87,14 @@
$view->reset = $selfurl->copy()->add('reset', 1);
$devs = array();
$js = array();
foreach ($devices as $key => $device) {
$collections = array();
foreach (array_values($devices) as $device) {
$dev = $state->loadDeviceInfo($device['device_id'], $device['device_user']);
$syncCache = new Horde_ActiveSync_SyncCache($state, $dev->id, $dev->user, $injector->getInstance('Horde_Log_Logger'));
$dev->hbinterval = $syncCache->hbinterval
? $syncCache->hbinterval
: ($syncCache->wait ? $syncCache->wait * 60 : _("Unavailable"));
$js[$dev->id] = array(
$js[$dev->id . ':' . $dev->user] = array(
'id' => $dev->id,
'user' => $dev->user
);
Expand Down
10 changes: 5 additions & 5 deletions horde/templates/activesync/device_table.html.php
Expand Up @@ -30,17 +30,17 @@
</td>
<td>
<?php if ($d->policykey): ?>
<input class="horde-delete" type="button" value="<?php echo _("Wipe") ?>" id="wipe_<?php echo $d->id ?>" />
<input class="horde-delete" type="button" value="<?php echo _("Wipe") ?>" id="wipe_<?php echo $d->id . ':' . $d->user ?>" />
<?php endif; ?>
<?php if ($d->rwstatus == Horde_ActiveSync::RWSTATUS_PENDING): ?>
<input type="button" value="<?php echo _("Cancel Wipe") ?>" id="cancel_<?php echo $d->id ?>" />
<input type="button" value="<?php echo _("Cancel Wipe") ?>" id="cancel_<?php echo $d->id . ':' . $d->user?>" />
<?php endif; ?>
<input class="horde-delete" type="button" value="<?php echo _("Remove") ?>" id="remove_<?php echo $d->id ?>" /><br />
<input class="horde-delete" type="button" value="<?php echo _("Remove") ?>" id="remove_<?php echo $d->id . ':' . $d->user ?>" /><br />
<br class="spacer" />
<?php if ($d->blocked && $this->isAdmin): ?>
<input class="horde-button" type="button" value="<?php echo _("Unblock")?>" id="unblock_<?php echo $d->id?>" />
<input class="horde-button" type="button" value="<?php echo _("Unblock")?>" id="unblock_<?php echo $d->id . ':' . $d->user ?>" />
<?php elseif ($this->isAdmin): ?>
<input class="horde-delete" type="button" value="<?php echo _("Block")?>" id="block_<?php echo $d->id?>" />
<input class="horde-delete" type="button" value="<?php echo _("Block")?>" id="block_<?php echo $d->id . ':' . $d->user ?>" />
<?php endif; ?>
</td>
</tr>
Expand Down

0 comments on commit 01b2639

Please sign in to comment.