function preview() { $id = JRequest::getInt('id'); $table = Komento::getTable('mailq'); $table->load($id); $ajax = Komento::getAjax(); $ajax->success($table->body, $table->type); $ajax->send(); }
public function getVersion() { $ajax = Komento::getAjax(); $local = Komento::komentoVersion(); $remote = Komento::getHelper('Version')->getVersion(); $html = '<span class="version_outdated">' . JText::sprintf('COM_KOMENTO_VERSION_OUTDATED', $local) . '</span>'; if ((string) $local >= (string) $remote) { $html = '<span class="version_latest">' . JText::sprintf('COM_KOMENTO_VERSION_LATEST', $local) . '</span>'; } $ajax->success($html); $ajax->send(); }
function migrateSettings() { $ajax = Komento::getAjax(); $fromTable = Komento::getTable('configs'); $toTable = Komento::getTable('configs'); $component = JRequest::getVar('component'); $currentComponent = JRequest::getVar('currentComponent'); $fromTable->load($component); $toTable->load($currentComponent); $toTable->params = $fromTable->params; $toTable->store(); $ajax->success(); $ajax->send(); }
function loadReplies() { $ajax = Komento::getAjax(); $model = Komento::getModel('comments'); $options['parent_id'] = JRequest::getInt('parentId'); $startCount = JRequest::getInt('startCount'); $commentsModel = Komento::getModel('comments'); $comments = $commentsModel->getData($options); $count = count($comments); $this->assign('comments', $comments); $this->assign('search', ''); $this->assign('startCount', $startCount); $this->assign('columns', Komento::getConfig('com_komento_comments_columns', false)); $html = $this->loadTemplate('list_' . $this->getTheme()); $ajax->success($html); $ajax->send(); }
public function getVersion() { $ajax = Komento::getAjax(); $local = Komento::komentoVersion(); $remote = Komento::getHelper('Version')->getVersion(); // Test build only since build will always be incremented regardless of version $localVersion = explode('.', $local); $localBuild = $localVersion[2]; $remoteVersion = explode('.', $remote); $build = $remoteVersion[2]; $html = '<span class="version_outdated">' . JText::sprintf('COM_KOMENTO_VERSION_OUTDATED', $local) . '</span>'; if ($localBuild >= $build) { $html = '<span class="version_latest">' . JText::sprintf('COM_KOMENTO_VERSION_LATEST', $local) . '</span>'; } $ajax->success($html); $ajax->send(); }
public function normalizeStructure() { $sql = Komento::getSql(); $ajax = Komento::getAjax(); $component = JRequest::getString('component'); $cid = JRequest::getString('cid'); // Normalize all invalid parent id first $query = "UPDATE `#__komento_comments` as `a`"; $query .= " LEFT JOIN `#__komento_comments` as `b`"; $query .= " ON `a`.`parent_id` = `b`.`id`"; $query .= " AND `a`.`component` = `b`.`component`"; $query .= " AND `a`.`cid` = `b`.`cid`"; $query .= " SET `a`.`parent_id` = 0, `a`.`depth` = 0"; $query .= " WHERE `b`.`id` is null"; $query .= " AND `a`.`component` = '{$component}'"; $query .= " AND `a`.`cid` = '{$cid}'"; $query .= " AND `a`.`parent_id` <> 0"; $sql->raw($query); $sql->query(); $sql->clear(); // Now we normalize the structure of lft rgt values $sql->select('#__komento_comments')->where('component', $component)->where('cid', $cid)->order('created'); $result = $sql->loadObjectList(); $boundary = 1; foreach ($result as $row) { $table = Komento::getTable('comments'); $table->bind($row); $table->lft = $boundary++; $table->rgt = $boundary++; $table->store(); } $ajax->resolve(); return $ajax->send(); }
function __construct() { $this->ajax = Komento::getAjax(); $this->model = Komento::getModel('migrators', true)->getMigrator(JRequest::getString('type')); $this->kmtmodel = Komento::getModel('comments'); }
public function unsubscribeUser() { $id = JRequest::getInt( 'user', null ); $component = JRequest::getCmd( 'component' ); $cid = JRequest::getCmd( 'cid' ); $model = Komento::getModel( 'subscription' ); $state = $model->unsubscribe( $component, $cid, $id ); $ajax = Komento::getAjax(); if( $state ) { $ajax->success(); } else { $ajax->fail(); } $ajax->send(); }
function getStickedComments() { $loadMore = JRequest::getInt( 'loadMore', 0 ); $ajax = Komento::getAjax(); $model = Komento::getModel( 'comments' ); $uid = JRequest::getInt( 'uid' ); $start = JRequest::getInt( 'start', 0 ); $limit = JRequest::getInt( 'limit', 10 ); $options = array( 'limitstart' => $start, 'limit' => $limit, 'userid' => $uid, 'sticked' => 1, 'threaded' => 0, 'sort' => 'latest' ); $comments = $model->getComments( 'all', 'all', $options ); $total = ''; if( !$loadMore ) { $total = $model->getCount( 'all', 'all', $options ); } $count = count( $comments ); $theme = Komento::getTheme(); $theme->set( 'items', $comments ); $theme->set( 'total', $total ); $html = ''; if( $loadMore ) { $html = $theme->fetch( 'profile/sticked/list.php' ); } else { $html = $theme->fetch( 'profile/sticked.php' ); } $ajax->success( $html, $count, $total); $ajax->send(); }