function getTicket($force) { if ($force) { $result = $this->m2mService->getM2MTicket(); if (PEAR::isError($result)) { throw new Exception($result->getMessage(), $result->getCode()); } } $ticket = $this->m2mDal->getM2MTicket($this->m2mService->accountId); return $ticket ? $ticket : $this->getTicket(true); }
/** * A method to launch and display the widget * */ function display() { $aConf = $GLOBALS['_MAX']['CONF']; phpAds_PageHeader(null, new OA_Admin_UI_Model_PageHeaderModel(), '', false, false); $oTpl = new OA_Admin_Template('dashboard/main.html'); if (!$aConf['ui']['dashboardEnabled'] || !$aConf['sync']['checkForUpdates']) { $dashboardUrl = MAX::constructURL(MAX_URL_ADMIN, 'dashboard.php?widget=Disabled'); } else { $m2mTicket = OA_Dal_Central_M2M::getM2MTicket(OA_Permission::getAccountId()); if (empty($m2mTicket)) { $dashboardUrl = MAX::constructURL(MAX_URL_ADMIN, 'dashboard.php?widget=Reload'); } else { $dashboardUrl = $this->buildDashboardUrl($m2mTicket, null, '&'); } } $oTpl->assign('dashboardURL', $dashboardUrl); $oTpl->display(); phpAds_PageFooter('', true); }
/** * A method to get an M2M Ticket for the dashboard * * @return string */ function getM2MTicket() { $result = $this->oMapper->getM2MTicket(); if (PEAR::isError($result)) { return $result; } // Store M2M ticket OA_Dal_Central_M2M::setM2MTicket($this->accountId, $result); return $result; }
/** * A method to store the M2M ticket for an account * * @param int $accountId * @param string $m2mTicket * @return bool */ function setM2MTicket($accountId, $m2mTicket) { return OA_Dal_Central_M2M::_setM2MParameter($accountId, 'm2m_ticket', $m2mTicket); }
/** * A private method to call the reconnectM2M method and store the new password * * @return mixed True on success, PEAR_Error otherwise */ function _reconnectM2M() { $result = $this->callM2M('reconnectM2M'); if (PEAR::isError($result)) { return $result; } OA_Dal_Central_M2M::setM2MPassword($this->oCentral->accountId, $result); return true; }