public function sendSelfMsg() { $message = new Message(); $message->setTo(\common_session_SessionManager::getSession()->getUser()); $message->setBody('<h1>Tao Dev Message send on the ' . \tao_helpers_Date::displayeDate(time()) . '</h1>'); $success = MessagingService::singleton()->send($message); return $this->returnJson(array('success' => $success, 'message' => __('Send a message'))); }
/** * * @param Transport $transport * @return MessagingService */ protected function getMessagingService($transport) { $messagingService = MessagingService::singleton(); $refObject = new ReflectionObject($messagingService); $refProperty = $refObject->getProperty('transport'); $refProperty->setAccessible(true); $refProperty->setValue($messagingService, $transport); return $messagingService; }
/** * Authentication form, * default page, main entry point to the user * * @return void */ public function login() { $params = array(); if ($this->hasRequestParameter('redirect')) { $redirectUrl = $_REQUEST['redirect']; if (substr($redirectUrl, 0, 1) == '/' || substr($redirectUrl, 0, strlen(ROOT_URL)) == ROOT_URL) { $params['redirect'] = $redirectUrl; } } $myLoginFormContainer = new tao_actions_form_Login($params); $myForm = $myLoginFormContainer->getForm(); if ($myForm->isSubmited()) { if ($myForm->isValid()) { $success = LoginService::login($myForm->getValue('login'), $myForm->getValue('password')); if ($success) { \common_Logger::i("Successful login of user '" . $myForm->getValue('login') . "'."); if ($this->hasRequestParameter('redirect') && tao_models_classes_accessControl_AclProxy::hasAccessUrl($_REQUEST['redirect'])) { $this->redirect($_REQUEST['redirect']); } else { $this->redirect(_url('entry', 'Main')); } } else { \common_Logger::i("Unsuccessful login of user '" . $myForm->getValue('login') . "'."); $this->setData('errorMessage', __('Invalid login or password. Please try again.')); } } } $this->setData('form', $myForm->render()); $this->setData('title', __("TAO Login")); $this->setData('messageServiceIsAvailable', MessagingService::singleton()->isAvailable()); if ($this->hasRequestParameter('msg')) { $this->setData('msg', $this->getRequestParameter('msg')); } $this->setData('content-template', array('blocks/login.tpl', 'tao')); $this->setView('layout.tpl', 'tao'); }
/** * Get messaging service * * @return MessagingService */ public function getMessagingService() { if (is_null($this->messagingSerivce)) { $this->messagingSerivce = MessagingService::singleton(); } return $this->messagingSerivce; }