Ejemplo n.º 1
0
 public function editAjaxAction(\Difra\Param\AnyString $module, \Difra\Param\AnyInt $tagId)
 {
     $tagData = \Difra\Plugins\Tags::getInstance()->getTag($module->val(), $tagId->val());
     if (!empty($tagData)) {
         /** @var \DOMElement $mainNode */
         $mainNode = $this->root->appendChild($this->xml->createElement('tagsEditForm'));
         $mainNode->setAttribute('id', $tagData['id']);
         $mainNode->setAttribute('module', $module->val());
         $mainNode->setAttribute('tag', $tagData['tag']);
         $html = \Difra\View::render($this->xml, 'forms', true);
         $this->ajax->display($html);
     }
 }
Ejemplo n.º 2
0
 /**
  * Disable plugin
  *
  * @param \Difra\Param\AnyString $name
  */
 public function disableAjaxAction(\Difra\Param\AnyString $name)
 {
     if (!\Difra\Plugger::turnOff($name->val())) {
         \Difra\Ajaxer::notify(\Difra\Locales::get('adm/plugins/failed'));
     }
     \Difra\Ajaxer::refresh();
 }
Ejemplo n.º 3
0
 /**
  * Alter table for Unify object
  *
  * @param \Difra\Param\AnyString $name
  */
 public function alterAjaxAction(\Difra\Param\AnyString $name)
 {
     try {
         /** @var \Difra\Unify\Item $class */
         $class = \Difra\Unify\Storage::getClass($name->val());
         $status = $class::getObjDbStatus();
         if ($status['status'] == 'alter') {
             \Difra\MySQL::getInstance()->query($status['sql']);
         }
     } catch (\Difra\Exception $ex) {
         \Difra\Ajaxer::notify($ex->getMessage());
     }
     \Difra\Ajaxer::refresh();
 }
Ejemplo n.º 4
0
 public function channeldeleteAjaxAction(Param\AnyString $name)
 {
     \Difra\Plugins\Radio::getInstance()->deleteChannel($name->val());
     $this->ajax->refresh();
 }
Ejemplo n.º 5
0
 public function importantAjaxAction(\Difra\Param\AnyInt $newsId, \Difra\Param\AnyString $status)
 {
     \Difra\Plugins\News::getInstance()->changeImportant($newsId->val(), $status->val());
     $this->ajax->refresh();
 }
Ejemplo n.º 6
0
 public function deleteAjaxAction(Param\AnyString $module, Param\AnyInt $commentId)
 {
     \Difra\Plugins\Comments\Comment::delete($commentId->val(), $module->val());
     $this->ajax->refresh();
 }
Ejemplo n.º 7
0
 /**
  * Change password using recovery link
  * @param AnyString $code
  * @param AjaxString $password1
  * @param AjaxString $password2
  * @throws Exception
  */
 public function submitAjaxAction(AnyString $code, AjaxString $password1, AjaxString $password2)
 {
     try {
         Recover::verify($code->val());
     } catch (\Difra\Plugins\Users\UsersException $ex) {
         Ajaxer::notify(Locales::get('auth/recover/' . $ex->getMessage()));
         return;
     }
     // verify passwords
     $register = new \Difra\Plugins\Users\Register();
     $register->setPassword1($password1->val());
     $register->setPassword2($password2->val());
     if (!$register->validatePasswords()) {
         $register->callAjaxerEvents();
         return;
     }
     Recover::recoverSetPassword($code->val(), $password1->val());
     Cookies::getInstance()->notify(Locales::get('auth/recover/done'));
     Ajaxer::redirect('/');
 }
Ejemplo n.º 8
0
 public function sortAjaxAction(\Difra\Param\AnyString $sort)
 {
     \Difra\Plugins\Catalog::getInstance()->setSort($sort->val());
     \Difra\Ajaxer::refresh();
 }
Ejemplo n.º 9
0
 /**
  * Activation link
  * @param AnyString $code
  */
 public function activateAction(AnyString $code)
 {
     try {
         Register::activate($code->val());
         $this->afterActivate();
     } catch (UsersException $error) {
         Cookies::getInstance()->notify(Locales::get('auth/activate/' . $error->getMessage()), true);
         \Difra\View::redirect('/');
     }
 }
Ejemplo n.º 10
0
 public function tagsAction(Param\NamedInt $page = null, Param\AnyString $tagName = null)
 {
     $page = $page ? $page->val() : 1;
     /** @var \DOMElement $blogsViewNode */
     $blogsViewNode = $this->root->appendChild($this->xml->createElement('blogsTagsView'));
     $blogsViewNode->setAttribute('left', 1);
     $Tags = Difra\Plugins\Tags::getInstance();
     if ($tagName) {
         /** @var \DOMElement $currentTagNode */
         $currentTagNode = $this->root->appendChild($this->xml->createElement('currentTag', $tagName->val()));
         $blogsViewNode->setAttribute('link', '/blogs/tags/' . $tagName->val());
         $tagName = rawurldecode($tagName->val());
         $currentTagNode->setAttribute('name', $Tags->getTagByLink('posts', $tagName));
         $tagItems = $Tags->getItemsByLink('posts', $tagName);
         Difra\Plugins\Blogs::getInstance()->getAllPostsXML($blogsViewNode, $page, $tagItems);
     } else {
         $blogsViewNode->setAttribute('link', '/blogs/tags');
         Difra\Plugins\Blogs::getInstance()->getAllPostsXML($blogsViewNode, $page);
     }
     if (Difra\Auth::getInstance()->isAuthorized()) {
         /** @var \DOMElement $mypageWidgetNode */
         $mypageWidgetNode = $this->root->appendChild($this->xml->createElement('myPageWidget'));
         $mypageWidgetNode->setAttribute('right', 1);
     }
     /** @var \DOMElement $controlNode */
     $controlNode = $this->root->appendChild($this->xml->createElement('artistControl'));
     $controlNode->setAttribute('right', 1);
     if ($Tags->getCloudXml('posts', $this->root)) {
         /** @var \DOMElement $tagsNode */
         $tagsNode = $this->root->appendChild($this->xml->createElement('postsTags'));
         $tagsNode->setAttribute('right', 1);
     }
 }