/** {@inheritDoc} */ public function process() { $propKey = $this->getProperty('propkey'); if (empty($propKey)) { return $this->el->failure($this->el->lexicon('err_propkey_ns')); } $properties = $this->el->getProperties($propKey); if (empty($properties)) { return $this->el->failure($this->el->lexicon('err_properties_ns')); } if (!$this->el->logoutUser(array('id' => $this->modx->user->id, 'loginContext' => $properties['loginContext'], 'addContexts' => $properties['addContexts']))) { $this->modx->log(modX::LOG_LEVEL_ERROR, "[el] Could not logout for user: {$this->modx->user->id}"); } $linkLogin = $this->el->getLink('login', $properties); $linkLogout = $this->el->getLink('logout', $properties); $array = array('process' => array('id' => $this->modx->user->id, 'type' => 'user', 'output' => $this->el->processSnippet(array_merge($properties, array('id' => 0)))), 'properties' => array('link_login' => $linkLogin, 'link_logout' => $linkLogout)); return $this->success($this->el->lexicon('logout_success'), $array); }
public static function registerLogger($loggerId, $conf) { return RemoteConnection::getInstance()->write(el::newLogger($loggerId, $conf)); }
function testBed() { $p = new el('p'); $br = new el('br'); echo 'This sentence should break here' . $br . 'if break element was created.' . $br . $br; $img = new el('img', $atts = array('src' => '../../images/test1.jpg', 'width' => '250', 'height' => '149')); echo 'A plain image should appear here: ' . $img . $br . $br; $atts = array("href" => "http://www.dogpile.com/", 'title' => 'Can "you" guess?', 'text' => 'My favourite search engine. =)'); $a = new el('a', $atts); echo $a . $br . $br; $a->re_set('href', 'http://www.google.com'); $a->re_set('title', "I'm now a sheep I in the doghouse. o_o"); $a->re_set('text', "I'm now an easily herded simple minded sheep like everyone else. =( "); echo $a . $br . $br; $a->remove('href'); $a->re_set('text', "I am now a dead link. =|"); echo $a . $br . $br; $a->remove('text'); $a->set('href', 'http://www.mamma.com/'); $a->re_set('title', "You better good or mama will put you in the doghouse. o_~"); $a->nest($img); echo 'Image link points to mother of all search engines: ' . $a . $br . $br; $a->clear(); echo 'I am now a dead image-link: ' . $a . $br . $br; }
/** {@inheritDoc} */ public function process() { $email = $this->getProperty('email'); if (empty($email)) { return $this->el->failure($this->el->lexicon('err_email_ns')); } $propKey = $this->getProperty('propkey'); if (empty($propKey)) { return $this->el->failure($this->el->lexicon('err_propkey_ns')); } $properties = $this->el->getProperties($propKey); if (empty($properties)) { return $this->el->failure($this->el->lexicon('err_properties_ns')); } $userId = $this->el->getUserId($email); if (empty($userId)) { $locked = $this->el->addLock(array('key' => 'email', 'id' => session_id()), array('ttlLock' => $properties['ttlLock'])); if ($locked !== true) { return $this->el->failure($this->el->lexicon('err_limit_action')); } $create = $this->el->createUser(array('email' => $email, 'groups' => $properties['groups'])); if (!$create) { return $this->el->failure($this->el->lexicon('err_create_user')); } $userId = $this->el->getUserId($email); } $hash = $this->el->getHash(array('id' => $userId)); $locked = $this->el->addLock(array('key' => 'link', 'id' => $hash, 'user' => $userId, 'properties' => $properties), array('ttlLock' => $properties['ttlLink'])); if ($locked !== true) { return $this->el->failure($this->el->lexicon('err_login_link_send')); } $linkLogin = $this->el->getLink('login', $properties, array('email' => $email, 'hash' => $hash)); $linkLogout = $this->el->getLink('logout', $properties); if (!$this->el->sendEmail(array('user' => $userId, 'body' => $this->modx->getChunk($properties['tplLink'], array_merge($this->el->getUserData($userId), array('link_login' => $linkLogin, 'link_logout' => $linkLogout)))))) { return $this->el->failure($this->el->lexicon('err_email_send', array('errors' => $this->modx->mail->mailer->errorInfo))); } $locked = $this->el->addLock(array('key' => 'send', 'id' => session_id()), array('ttlLock' => $properties['ttlLink'])); if ($locked !== true) { return $this->el->failure($this->el->lexicon('err_login_link_send')); } $array = array('process' => array('id' => '0', 'type' => 'user', 'output' => $this->el->processSnippet($properties)), 'properties' => array()); return $this->success($this->el->lexicon('login_link_send'), $array); }