username in this form, just get it when processing changes.
$state->setDeviceInfo($device);
} elseif (!empty($devId)) {
// @TODO: Check if the empty check is necessary
- $device = $state->getDeviceInfo($devId, $this->_driver->getUser());
+ $device = $state->loadDeviceInfo($devId, $this->_driver->getUser());
}
/* Load the request handler to handle the request */
* header - which is against the specification. Check the user agent
* for Android (maybe need version sniffing in the future) and set the
* policykey to null for those devices. */
- $this->_device = $this->_state->getDeviceInfo($this->_device->id, $this->_driver->getUser());
+ $this->_device = $this->_state->loadDeviceInfo($this->_device->id, $this->_driver->getUser());
if (strpos($this->_device->userAgent, 'Android') !== false) {
$sentKey = null;
}
/* Initialize the state machine */
$this->_state = &$this->_driver->getStateObject();
- $this->_state->getDeviceInfo($this->_device->id, $this->_driver->getUser());
+ $this->_state->loadDeviceInfo($this->_device->id, $this->_driver->getUser());
/* See if we have an existing PING state. Need to do this here, before
* we read in the PING request since the PING request is allowed to omit
*
* @return StdClass
*/
- abstract public function getDeviceInfo($device, $user);
+ abstract public function loadDeviceInfo($device, $user);
/**
* Check that a given device id is known to the server. This is regardless
* @return object The device info object
* @throws Horde_ActiveSync_Exception
*/
- public function getDeviceInfo($devId, $user)
+ public function loadDeviceInfo($devId, $user)
{
$this->_devId = $devId;
$file = $this->_stateDir . '/' . $user . '/info-' . $devId;
*/
public function setPolicyKey($devId, $key)
{
- $info = $this->getDeviceInfo($devId);
+ $info = $this->loadDeviceInfo($devId);
$info->policykey = $key;
$this->setDeviceInfo($info);
$this->_logger->info('[' . $devId . '] New policykey saved: ' . $key);
*/
public function setDeviceRWStatus($devId, $status)
{
- $info = $this->getDeviceInfo($devId);
+ $info = $this->loadDeviceInfo($devId);
$info->rwstatus = $status;
$this->setDeviceInfo($info);
$this->_logger->info('[' . $devId . '] Setting DeviceRWStatus: ' . $status);
*/
public function initPingState($device)
{
- /* This would normally already be loaded by getDeviceInfo() but we
+ /* This would normally already be loaded by loadDeviceInfo() but we
* should verify we have the correct device loaded etc... */
if (!isset($this->_pingState) || $this->_devId !== $device->id) {
throw new Horde_ActiveSync_Exception('Device not loaded');
* @return object The device obejct
* @throws Horde_ActiveSync_Exception
*/
- public function getDeviceInfo($devId, $user)
+ public function loadDeviceInfo($devId, $user)
{
//@TODO - combine _devId and _deviceInfo
/* See if we have it already */
$t->setOption('gettext', true);
$selfurl = $ui->selfUrl();
$t->set('reset', $selfurl->copy()->add('reset', 1));
- $t->set('username', Horde_Auth::getAuth());
$devices = $stateMachine->listDevices(Horde_Auth::getAuth());
$devs = array();
$i = 1;
foreach ($devices as $device) {
$device['class'] = fmod($i++, 2) ? 'rowOdd' : 'rowEven';
- $stateMachine->getDeviceInfo($device['device_id'], Horde_Auth::getAuth());
+ $stateMachine->loadDeviceInfo($device['device_id'], Horde_Auth::getAuth());
$ts = $stateMachine->getLastSyncTimestamp();
$device['ts'] = empty($ts) ? _("None") : strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $ts);
switch ($device['device_rwstatus']) {
$stateMachine = new Horde_ActiveSync_State_History($state_params);
$stateMachine->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger'));
if ($ui->vars->wipeid) {
+ $stateMachine->loadDeviceInfo($ui->vars->wipeid, Horde_Auth::getAuth());
$stateMachine->setDeviceRWStatus($ui->vars->wipeid, Horde_ActiveSync::RWSTATUS_PENDING);
$GLOBALS['notification']->push(sprintf(_("A Remote Wipe for device id %s has been initiated. The device will be wiped during the next SYNC request."), $ui->vars->wipe));
} elseif ($ui->vars->cancelwipe) {
+ $stateMachine->loadDeviceInfo($ui->vars->cancelwipe, Horde_Auth::getAuth());
$stateMachine->setDeviceRWStatus($ui->vars->cancelwipe, Horde_ActiveSync::RWSTATUS_OK);
$GLOBALS['notification']->push(sprintf(_("The Remote Wipe for device id %s has been cancelled."), $ui->vars->wipe));
} elseif ($ui->vars->reset) {
$devices = $stateMachine->listDevices(Horde_Auth::getAuth());
foreach ($devices as $device) {
- $stateMachine->removeState(null, $device['device_id'], $ui->vars->removeuser);
+ $stateMachine->removeState(null, $device['device_id'], Horde_Auth::getAuth());
}
$GLOBALS['notification']->push(_("All state removed for your devices. They will resynchronize next time they connect to the server."));
} elseif ($ui->vars->removedevice) {
- $stateMachine->removeState(null, $ui->vars->removedevice, $ui->vars->removeuser);
+ $stateMachine->removeState(null, $ui->vars->removedevice, Horde_Auth::getAuth());
}
}
<input type="hidden" id="removedevice" name="removedevice" />
<input type="hidden" name="wipeid" id="wipeid" />
<input type="hidden" name="cancelwipe" id="cancelwipe" />
-<input type="hidden" name="removeuser" id="removeuser" value="<tag:username />" />
<table class="horde-table striped">
<tr>
<th></th>