/** * Removes featured status from an object * * @since 4.0 * @access public * @param string * @return */ public function removeFeatured() { $ajax = EB::ajax(); // Ensure that the user has privileges if (!EB::isSiteAdmin() && !$this->acl->get('feature_entry')) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED')); } $type = $this->input->get('type', '', 'word'); $id = $this->input->get('id', '', 'int'); if ($type == 'blogger') { $title = JText::_('COM_EASYBLOG_UNFEATURE_AUTHOR_DIALOG_TITLE'); $content = JText::_('COM_EASYBLOG_UNFEATURE_AUTHOR_DIALOG_CONTENT'); } if ($type == 'teamblog') { $title = JText::_('COM_EASYBLOG_UNFEATURE_TEAMBLOG_DIALOG_TITLE'); $content = JText::_('COM_EASYBLOG_UNFEATURE_TEAMBLOG_DIALOG_CONTENT'); } $model = EB::model('Featured'); $model->removeFeatured($type, $id); $theme = EB::template(); $theme->set('title', $title); $theme->set('content', $content); $output = $theme->output('site/featured/dialog.unfeature'); return $ajax->resolve($output); }
/** * Allows admin to create a new manual subscriber on the site * * @since 4.0 * @access public * @param string * @return */ public function form() { // Check for access $this->checkAccess('easyblog.manage.subscription'); $ajax = EB::ajax(); // Get the type $type = $this->input->get('type', '', 'word'); $theme = EB::template(); $theme->set('type', $type); $output = $theme->output('admin/subscriptions/dialog.form'); return $ajax->resolve($output); }
public function __construct($config = array()) { parent::__construct($config); $this->app = JFactory::getApplication(); $this->input = EB::request(); $this->doc = JFactory::getDocument(); $this->config = EB::config(); $this->my = JFactory::getUser(); $this->info = EB::info(); if ($this->doc->getType() == 'ajax') { $this->ajax = EB::ajax(); } }
public function __construct() { $this->config = EB::getConfig(); $this->jconfig = JFactory::getConfig(); $this->app = JFactory::getApplication(); $this->doc = JFactory::getDocument(); $this->my = JFactory::getUser(); $this->input = EB::request(); $this->info = EB::info(); $this->theme = EB::getTemplate(null, array('view' => $this, 'admin' => true)); if ($this->doc->getType() == 'ajax') { $this->ajax = EB::ajax(); } parent::__construct(); }
public function __construct() { $this->doc = JFactory::getDocument(); $this->app = JFactory::getApplication(); $this->my = JFactory::getUser(); $this->config = EB::config(); $this->info = EB::info(); $this->jconfig = EB::jconfig(); $this->acl = EB::acl(); // If this is a dashboard theme, we need to let the theme object know $options = array('paramsPrefix' => $this->paramsPrefix); // If this is an ajax document, we should pass the $ajax library to the client if ($this->doc->getType() == 'ajax') { //we need to load frontend language from here incase it was called from backend. JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); $this->ajax = EB::ajax(); } // Create an instance of the theme so child can start setting variables to it. $this->theme = EB::template(null, $options); // Set the input object $this->input = EB::request(); }
// Redirect the user back to EasyBlog return $app->redirect('index.php?option=com_easyblog'); } // If manual installation is invoked, we need to create the installer file $install = $app->input->get('setup', false, 'bool'); if ($install) { $obj = new stdClass(); $obj->new = false; $obj->step = 1; $obj->status = 'installing'; $contents = json_encode($obj); JFile::write($file, $contents); } // Check if there's a file initiated for installation $installCompleted = $app->input->get('active') == 'complete'; if (JFile::exists($file) || $installCompleted) { require_once dirname(__FILE__) . '/setup/bootstrap.php'; exit; } // Load up EasyBlog's framework require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; // Process ajax calls EB::ajax()->process(); // Test for user access if (!JFactory::getUser()->authorise('core.manage', 'com_easyblog')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $controller = JControllerLegacy::getInstance('easyblog'); $task = $app->input->get('task'); $controller->execute($task); $controller->redirect();
/** * Saves the tags when the blog post is stored. * * @since 5.0 * @access public * @param string * @return */ public function saveTags() { // Assuming that tags are a comma separated keywords $tags = $this->tags; // Assuming that this is the current copy. if ($this->isReady() && !empty($this->tags)) { // Ensure that the tags are in an array $tags = explode(',', $this->tags); // Delete any existing tags associated with this post first $postTagModel = EB::model('PostTag'); // Delete related tags with this post first. $postTagModel->deletePostTag($this->id); // Get a list of default tags on the site $model = EB::model('Tags'); $defaultTags = $model->getDefaultTagsTitle(); if (!empty($defaultTags)) { foreach ($defaultTags as $title) { $tags[] = $title; } } //remove spacing from start and end of the tags title. if ($tags) { for ($i = 0; $i < count($tags); $i++) { $tags[$i] = JString::trim($tags[$i]); } } // Ensure that the tags are unique $tags = array_unique($tags); if ($tags) { foreach ($tags as $tag) { $tag = trim($tag); // Ensure that the tag is valid if (empty($tag)) { continue; } $table = EB::table('Tag'); $exists = $table->load($tag, true); // If the tag does not exist and the user does not have any privileges to create any tag, // we shouldn't allow them to create them. if (!$exists && !$this->acl->get('create_tag')) { continue; } // When the tag does not exist, create a new tag first if (!$exists) { $table->created_by = $this->created_by; $table->title = $tag; $table->created = EB::date()->toSql(); $table->published = true; $table->status = ''; $state = $table->store(); if (!$state) { EB::ajax()->notify($tag . ':' . $table->getError(), 'debug'); } } // Add the association of tags here. $postTagModel->add($table->id, $this->id, EB::date()->toSql()); } } } }
/** * Displays the terms and condition popup * * @since 4.0 * @access public * @param string * @return */ public function terms() { $ajax = EB::ajax(); $text = $this->config->get('comment_tnctext'); $text = nl2br($text); $theme = EB::template(); $theme->set('text', $text); $output = $theme->output('site/comments/dialog.terms'); return $ajax->resolve($output); }
public function diff() { $ajax = EB::ajax(); $source = $this->input->get('source', null, 'int'); $target = $this->input->get('target', null, 'int'); $html = EB::revisions()->renderDiff($source, $target); if ($html instanceof EasyBlogException) { $ajax->reject($html); } $ajax->resolve($html); }
/** * Load media configuration * * @since 4.0 * @access public * @param string * @return */ public function mediaConfiguration() { $ajax = EB::ajax(); // Require login EB::requireLogin(); $user = EB::user($this->my->id); $tpl = EB::template(); $blogger_id = $user->id; $tpl->set('blogger_id', $blogger_id); // @since: 3.6 // Media manager options $tpl->set('session', JFactory::getSession()); $mediamanager = EB::mediamanager(); $userFolders = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'user'), 'folders'); $userFiles = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'user'), 'files'); $sharedFolders = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'shared'), 'folders'); $sharedFiles = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'shared'), 'files'); $tpl->set('userFolders', $userFolders); $tpl->set('userFiles', $userFiles); $tpl->set('sharedFolders', $sharedFolders); $tpl->set('sharedFiles', $sharedFiles); // @rule: Test if the user is already associated with Flickr $oauth = EB::table('OAuth'); $associated = $oauth->loadByUser($this->my->id, EBLOG_OAUTH_FLICKR); $tpl->set('flickrAssociated', $associated); // Retrieve flickr's data $flickr = $this->getFlickrData(); // Retrieve dropbox's data $dropbox = $this->getDropboxData(); $tpl->set('flickr', $flickr); $tpl->set('dropbox', $dropbox); $html = $tpl->output('site/media/configuration'); $ajax->resolve($html); }
public function __construct() { $this->db = EB::db(); $this->ajax = EB::ajax(); }