/** * Approves a blog post that is currently in moderation * * @since 4.0 * @access public */ public function approve() { // Check for request forgeries EB::checkToken(); // Ensure that user is logged in EB::requireLogin(); // Get any return url $return = EB::_('index.php?option=com_easyblog&view=dashboard&layout=moderate'); if ($this->getReturnURL()) { $return = $this->getReturnURL(); } // Check if the user is privileged enough if (!$this->acl->get('add_entry') && !$this->acl->get('manage_pending')) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NO_PERMISSION_TO_MODERATE_BLOG')); } // Load the draft $ids = $this->input->get('ids', array(), 'array'); foreach ($ids as $id) { $post = EB::post($id); $post->approve(); } // Set the success message / notice. $message = JText::_('COM_EASYBLOG_DASHBOARD_ENTRIES_SAVED'); EB::info()->set(JText::_('COM_EASYBLOG_MODERATE_BLOG_POSTS_APPROVED_SUCCESSFULLY'), 'success'); return $this->app->redirect($return); }
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(); }
/** * Removes a pending blog post * * @since 4.0 * @access public * @param string * @return */ public function remove() { // Check for request forgeries EB::checkToken(); // Get the list of ids to be deleted $ids = $this->input->get('cid', array(), 'array'); if (!$ids) { // Do something exit; } foreach ($ids as $id) { $post = EB::post((int) $id); $post->delete(); } $message = JText::_('COM_EASYBLOG_PENDING_POSTS_DELETED_SUCCESSFULLY'); EB::info()->set($message, 'success'); return $this->app->redirect('index.php?option=com_easyblog&view=blogs&layout=pending'); }
/** * Install language file on the site * * @since 4.0 * @access public * @param string * @return */ public function install() { // Check for request forgeries here EB::checkToken(); // Get the language id $ids = $this->input->get('cid', array(), 'array'); foreach ($ids as $id) { $table = EB::table('Language'); $table->load($id); $state = $table->install(); if (!$state) { EB::info()->set($table->getError(), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=languages'); } } EB::info()->set(JText::_('COM_EASYBLOG_LANGUAGE_INSTALLED_SUCCESSFULLY'), 'success'); $this->app->redirect('index.php?option=com_easyblog&view=languages'); }
/** * Allows caller to submit a report * * @since 4.0 * @access public * @param string * @return */ public function submit() { // Check for request forgeries EB::checkToken(); // Get the composite keys $id = $this->input->get('id', 0, 'int'); $type = $this->input->get('type', '', 'cmd'); // Initialize redirection link $redirect = EB::_('index.php?option=com_easyblog&view=entry&id=' . $id, false); // Check if guest is allowed to report or not. if ($this->my->guest && !$this->config->get('main_reporting_guests')) { $this->info->set('COM_EASYBLOG_CATEGORIES_FOR_REGISTERED_USERS_ONLY', 'error'); return $this->app->redirect($redirect); } // Ensure that the report reason is not empty. $reason = $this->input->get('reason', '', 'default'); if (!$reason) { EB::info()->set(JText::_('COM_EASYBLOG_REPORT_PLEASE_SPECIFY_REASON'), 'error'); return $this->app->redirect($redirect); } $report = EB::table('Report'); $report->obj_id = $id; $report->obj_type = $type; $report->reason = $reason; $report->created = EB::date()->toSql(); $report->created_by = $this->my->id; $report->ip = @$_SERVER['REMOTE_ADDR']; $state = $report->store(); if (!$state) { $this->info->set($report->getError()); return $this->app->redirect($redirect); } // Notify the site admin when there's a new report made $post = EB::post($id); $report->notify($post); $message = JText::_('COM_EASYBLOG_THANKS_FOR_REPORTING'); $this->info->set($message, 'success'); return $this->app->redirect($redirect); }
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(); }
/** * Displays the ACL form * * @since 4.0 * @access public */ public function form() { $model = EB::model('Acl'); $id = JRequest::getInt('id'); $add = JRequest::getVar('add'); if (empty($id) && empty($add)) { EB::info()->set(JText::_('COM_EASYBLOG_ACL_INVALID_ID_PROVIDED'), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=acls'); } // Get a list of rule sets. $ruleset = $model->getInstalledRules($id, $add); $groups = $model->getGroups(); $this->setHeading('COM_EASYBLOG_TITLE_ACL', '', 'fa-lock'); $this->doc->setTitle(JText::_("COM_EASYBLOG_ACL_JOOMLA_USER_GROUP")); JToolBarHelper::title(JText::_('COM_EASYBLOG_ACL_JOOMLA_USER_GROUP'), 'acl'); $filter = EB::table('ACLFilter'); $filter->load($id); $this->set('groups', $groups); $this->set('filter', $filter); $this->set('ruleset', $ruleset); $this->set('add', $add); parent::display('acls/form'); }
/** * Retrieves the editor * * @since 4.0 * @access public * @param string * @return */ public static function getEditor() { $config = EB::config(); // If configured the respect author's editor, pickup the correct editor. $useAuthorEditor = $config->get('layout_editor_author'); if ($useAuthorEditor) { $my = JFactory::getUser(); $registry = new JRegistry($my->params); $editor = JFactory::getEditor($registry->get('editor', $config->get('layout_editor'))); return $editor; } // If use system editor, we should check if the configured editor exists or enabled. $selectedEditor = $config->get('layout_editor'); // Test if the plugin is enabled $enabled = JPluginHelper::isEnabled('editors', $selectedEditor); // If the editor isn't enabled, we need to intelligently find one that is enabled. if (!$enabled) { $model = EB::model('Settings'); $randomEditor = $model->getAvailableEditor(); if (!$randomEditor) { // No editors enabled on the site. WTF? EB::info()->set(JText::_('COM_EASYBLOG_NO_EDITORS_ENABLED_ON_SITE'), 'error'); return false; } // Use the random enabled editor $selectedEditor = $randomEditor; // Show some error message that the configured editor isn't available. EB::info()->set(JText::sprintf('COM_EASYBLOG_SELECTED_EDITOR_NOT_ENABLED', $selectedEditor, $randomEditor), 'error'); } $editor = JFactory::getEditor($selectedEditor); return $editor; }
/** * Allows caller to save their api key * * @since 4.0 * @access public * @param string * @return */ public function saveApi() { // Check for request forgeries EB::checkToken(); // @task: Check for acl rules. $this->checkAccess('setting'); $model = EB::model('Settings'); $key = $this->input->get('apikey', '', 'default'); $from = $this->input->get('from', '', 'default'); $return = $this->input->get('return', '', 'default'); // Save the apikey $model->save(array('main_apikey' => $key)); EB::info()->set(JText::_('COM_EASYBLOG_API_KEY_SAVED'), 'success'); // If return is specified, respect that if (!empty($return)) { $return = base64_decode($return); $this->app->redirect($return); } if (empty($from)) { $this->app->redirect('index.php?option=com_easyblog', JText::_('')); } else { $this->app->redirect('index.php?option=com_easyblog&view=updater', JText::_('COM_EASYBLOG_API_KEY_SAVED')); } }
/** * Respond to a team request * * @since 4.0 * @access public */ public function respond() { // Check for request forgeries EB::checkToken(); // Check for acl rules. $this->checkAccess('teamblog'); $ids = $this->input->get('cid', '', 'array'); if (!$ids) { EB::info()->set(JText::_('COM_EASYBLOG_TEAMBLOGS_INVALID_ID_PROVIDED'), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=teamblogs&layout=requests'); } // Get the task $task = $this->getTask(); foreach ($ids as $id) { // Load the request $request = EB::table('TeamBlogRequest'); $request->load($id); $request->{$task}(); } $message = $task == 'approve' ? JText::_('COM_EASYBLOG_TEAMBLOGS_APPROVED_REQUESTS_SUCCESS') : JText::_('COM_EASYBLOG_TEAMBLOGS_REJECT_REQUESTS_SUCCESS'); EB::info()->set($message, 'success'); return $this->app->redirect('index.php?option=com_easyblog&view=teamblogs&layout=requests'); }
/** * Toggles the featured status of the blog post * * @since 4.0 * @access public * @param string * @return */ public function toggleFeatured() { // Check for request forgeries EB::checkToken(); // Check for acl rules. $this->checkAccess('blog'); // Get the list of items to toggle $ids = $this->input->get('cid', array(), 'default'); $task = $this->getTask(); if (empty($ids)) { EB::info()->set(JText::_('COM_EASYBLOG_BLOGS_INVALID_ID'), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=blogs'); } foreach ($ids as $id) { $post = EB::post($id); if ($task == 'unfeature') { $post->removeFeatured(); } if ($task == 'feature') { $post->setFeatured(); } } $message = JText::_('COM_EASYBLOG_BLOGS_FEATURED_SUCCESSFULLY'); if ($task == 'unfeature') { $message = JText::_('COM_EASYBLOG_BLOGS_UNFEATURED_SUCCESSFULLY'); } EB::info()->set($message, 'success'); $this->app->redirect('index.php?option=com_easyblog&view=blogs'); }
/** * Saves the google auto posting settings * * @since 4.0 * @access public * @param string * @return */ public function save() { // Check for request forgeries EB::checkToken(); // Get the client id $post = $this->input->getArray('post'); unset($post['task']); unset($post['option']); unset($post[EB::getToken()]); // Get the model so that we can store the settings $model = EB::model('Settings'); $model->save($post); // Redirect the user EB::info()->set(JText::_('COM_EASYBLOG_AUTOPOSTING_TWITTER_SAVE_SUCCESS'), 'success'); $this->app->redirect('index.php?option=com_easyblog&view=autoposting&layout=twitter'); }
/** * Toggle publish for comments * * @since 4.0 * @access public * @param string * @return */ public function togglePublish() { // Check for tokens EB::checkToken(); // Get any return url $return = EB::_('index.php?option=com_easyblog&view=dashboard&layout=comments'); if ($this->getReturnURL()) { $return = $this->getReturnURL(); } // Ensure that the user has access to publish items if ($this->my->id == 0) { die('COM_EASYBLOG_NO_PERMISSION_TO_PUBLISH_OR_UNPUBLISH_BLOG'); return; } // Get the task $task = $this->getTask(); // Get id's $ids = $this->input->get('ids', '', 'array'); foreach ($ids as $id) { $comment = EB::table('Comment'); $comment->load((int) $id); if (method_exists($comment, $task)) { $comment->{$task}(); } } $message = JText::_('COM_EASYBLOG_DASHBOARD_COMMENTS_COMMENT_PUBLISHED_SUCCESS'); if ($task == 'unpublish') { $message = JText::_('COM_EASYBLOG_DASHBOARD_COMMENTS_COMMENT_UNPUBLISHED_SUCCESS'); } // Set info data EB::info()->set($message, 'success'); $this->app->redirect($return); }
/** * Saves a new field group * * @since 4.0 * @access public * @param string * @return */ public function saveGroup() { // Check for request forgeries EB::checkToken(); // Get the title $title = $this->input->get('title', '', 'default'); $read = $this->input->get('read', '', 'default'); $write = $this->input->get('write', '', 'default'); $state = $this->input->get('state', '', 'boolean'); // User could be editing the group $id = $this->input->get('id', 0, 'int'); // validation here if (!$title) { EB::info()->set(JText::_('COM_EASYBLOG_FIELDS_GROUP_TITLE_EMPTY_WARNING'), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=fields&layout=groupForm&id=' . $id); } $group = EB::table('FieldGroup'); $group->load($id); $group->title = $title; $group->read = json_encode($read); $group->write = json_encode($write); $group->state = $state; // Save the group $state = $group->store(); if (!$state) { EB::info()->set($group->getError(), 'error'); } else { EB::info()->set(JText::_('COM_EASYBLOG_FIELDS_GROUP_SAVED_SUCCESS'), 'success'); } $task = $this->getTask(); if ($task == 'applyGroup') { return $this->app->redirect('index.php?option=com_easyblog&view=fields&layout=groupForm&id=' . $group->id); } if ($task == 'saveNewGroup') { return $this->app->redirect('index.php?option=com_easyblog&view=fields&layout=groupForm'); } $this->app->redirect('index.php?option=com_easyblog&view=fields&layout=groups'); }
/** * Saves the google auto posting settings * * @since 4.0 * @access public * @param string * @return */ public function save() { // Check for request forgeries EB::checkToken(); // Get the client id $post = $this->input->getArray('post'); unset($post['task']); unset($post['option']); unset($post[EB::getToken()]); if (isset($post['integrations_facebook_page_id'])) { $pages = $post['integrations_facebook_page_id']; // We need to merge them to be comma separated values $post['integrations_facebook_page_id'] = implode(',', $pages); } if (isset($post['integrations_facebook_group_id'])) { $groups = $post['integrations_facebook_group_id']; // Merge the array into string values $post['integrations_facebook_group_id'] = implode(',', $groups); } // Get the model so that we can store the settings $model = EB::model('Settings'); $model->save($post); // Redirect the user EB::info()->set(JText::_('COM_EASYBLOG_AUTOPOSTING_FACEBOOK_SAVE_SUCCESS'), 'success'); $this->app->redirect('index.php?option=com_easyblog&view=autoposting&layout=facebook'); }
/** * Allow users to import csv files into subscriptions table * * @since 4.0 * @access public * @param string * @return */ public function importFile() { // Check for request forgeries EB::checkToken(); $file = JRequest::getVar('package', '', 'files', 'array'); $model = EB::model('Subscription'); // Check if the file exists if (!$file || !isset($file['tmp_name']) || empty($file['tmp_name'])) { EB::info()->set('COM_EASYBLOG_SUBSCRIPTION_IMPORT_FILE_NOT_EXIST', 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=subscriptions'); } //the name of the file in PHP's temp directory that we are going to move to our folder $fileTemp = $file['tmp_name']; $fileName = $file['name']; //always use constants when making file paths, to avoid the possibilty of remote file inclusion $uploadPath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $fileName; $model = EB::model('Subscription'); $result = $model->massAssignSubscriber($fileTemp); //var_dump($result); if ($result) { // Redirect user back EB::info()->set(count($result) . ' successfully added to subsription list', 'success'); // $this->app = JFactory::getApplication(); $this->app->redirect('index.php?option=com_easyblog&view=subscriptions'); } else { EB::info()->set('No one be added to subsription list', 'success'); $this->app->redirect('index.php?option=com_easyblog&view=subscriptions'); } }
/** * @since 3.0 * Unsubscribe a user with email to a blog post * * @param int Subscription ID * @param int Blog post ID * * @return bool True on success */ public function unsubscribe() { $subscriptionId = JRequest::getInt('subscription_id'); $blogId = JRequest::getInt('blog_id'); $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); $redirect = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $blogId, false); // Check variables if ($my->id == 0 || !$subscriptionId || !$blogId) { EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error'); $mainframe->redirect($redirect); } // Need to ensure that whatever id passed in is owned by the current browser $blogModel = EB::model('Blog'); $sid = $blogModel->isBlogSubscribedUser($blogId, $my->id, $my->email); if ($subscriptionId != $sid) { EB::info()->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error'); $mainframe->redirect($redirect); } // Proceed to unsubscribe $table = EB::table('Subscriptions'); $table->load($subscriptionId); if (!$table->delete()) { EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_FAILED'), 'error'); $mainframe->redirect($redirect); } EB::info()->set(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_SUCCESS'), 'success'); $mainframe->redirect($redirect); }
/** * Saves a category * * @since 4.0 * @access public */ public function save() { // Check for request forgeries EB::checkToken(); // Get posted data $post = $this->input->getArray('post'); $task = $this->getTask(); // Get the category id $id = $this->input->get('id', '', 'int'); $category = EB::table('Category'); $category->load($id); // Determines if this is a new category $isNew = $category->id ? false : true; // Bind the posted data $category->bind($post); // Construct the redirection url $url = 'index.php?option=com_easyblog&view=categories&layout=form'; if ($category->id) { $url .= '&id=' . $id; } if (!$category->title) { EB::info()->set(JText::_('COM_EASYBLOG_CATEGORIES_INVALID_CATEGORY'), 'error'); return $this->app->redirect($url); } if (!$category->isNotAssigned() && $category->isDefault()) { EB::info()->set(JText::_('COM_EASYBLOG_CATEGORIES_SAVE_NOT_PUBLIC'), 'error'); return $this->app->redirect($url); } if (!$category->created_by && empty($category->created_by)) { $category->created_by = $this->my->id; } // Get the description for the category $category->description = $this->input->get('description', '', 'raw'); // Process the params $raw = $this->input->get('params', '', 'array'); // var_dump($raw);exit; $category->params = json_encode($raw); // Try to save the category now $state = $category->store(); if (!$state) { EB::info()->set($category->getError(), 'error'); return $this->app->redirect($url); } // Bind the category with the custom fields $fieldGroup = $this->input->get('field_group', '', 'int'); if ($fieldGroup) { $category->bindCustomFieldGroup($fieldGroup); } else { $category->removeFieldGroup(); } // Once the category is saved, delete existing acls $category->deleteACL(); if ($category->private == CATEGORY_PRIVACY_ACL) { $category->saveACL($post); } // Set the meta for the category $category->createMeta(); // Process category avatars $file = $this->input->files->get('Filedata', '', 'avatar'); if (isset($file['tmp_name']) && !empty($file['name'])) { $avatar = EB::uploadCategoryAvatar($category, true); $category->avatar = $avatar; $category->store(); } $message = JText::_('COM_EASYBLOG_CATEGORIES_SAVED_SUCCESS'); EB::info()->set($message, 'success'); if ($task == 'savenew') { return $this->app->redirect('index.php?option=com_easyblog&view=categories&layout=form'); } if ($task == 'apply') { return $this->app->redirect('index.php?option=com_easyblog&view=categories&layout=form&id=' . $category->id); } return $this->app->redirect('index.php?option=com_easyblog&view=categories'); }
/** * Stores a new rss feed import * * @since 4.0 * @access public */ public function save() { // Check for request forgeries EB::checkToken(); // @task: Check for acl rules. $this->checkAccess('feeds'); $post = JRequest::get('post'); $id = $this->input->get('id', 0, 'int'); $feed = EB::table('Feed'); $feed->load($id); $feed->bind($post); if (!$feed->item_creator) { EB::info()->set('COM_EASYBLOG_BLOGS_FEEDS_ERROR_AUTHOR', 'error'); $session = JFactory::getSession(); $session->set('feeds.data', $post, 'easyblog'); return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } if (!$feed->item_category) { EB::info()->set('COM_EASYBLOG_BLOGS_FEEDS_ERROR_CATEGORY', 'error'); $session = JFactory::getSession(); $session->set('feeds.data', $post, 'easyblog'); return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } if (!$feed->url) { EB::info()->set('COM_EASYBLOG_BLOGS_FEEDS_ERROR_URL', 'error'); $session = JFactory::getSession(); $session->set('feeds.data', $post, 'easyblog'); return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } if (!$feed->title) { EB::info()->set('COM_EASYBLOG_BLOGS_FEEDS_ERROR_TITLE', 'error'); $session = JFactory::getSession(); $session->set('feeds.data', $post, 'easyblog'); return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } // Store the allowed tags here. $allowed = JRequest::getVar('item_allowed_tags', '', 'REQUEST', 'none', JREQUEST_ALLOWRAW); $copyrights = JRequest::getVar('copyrights', ''); $sourceLinks = JRequest::getVar('sourceLinks', '0'); $feedamount = JRequest::getVar('feedamount', '0'); $autopost = JRequest::getVar('autopost', 0); $params = EB::getRegistry(); $params->set('allowed', $allowed); $params->set('copyrights', $copyrights); $params->set('sourceLinks', $sourceLinks); $params->set('autopost', $autopost); $params->set('feedamount', $feedamount); $params->set('item_get_fulltext', $this->input->get('item_get_fulltext', '', 'default')); $params->set('notify', $this->input->get('notify', '', 'default')); $feed->params = $params->toString(); $state = $feed->store(); if (!$state) { EB::info()->set($feed->getError(), 'error'); $session = JFactory::getSession(); $session->set('feeds.data', $post, 'easyblog'); return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } EB::info()->set('COM_EASYBLOG_BLOGS_FEEDS_SAVE_SUCCESS', 'success'); $task = $this->getTask(); if ($task == 'apply') { return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form&id=' . $feed->id); } if ($task == 'save') { return $this->app->redirect('index.php?option=com_easyblog&view=feeds'); } if ($task == 'savenew') { return $this->app->redirect('index.php?option=com_easyblog&view=feeds&layout=form'); } }
/** * Deletes blog posts * * @since 4.0 * @access public * @param string * @return */ public function delete() { // Check for tokens EB::checkToken(); // Get the list of blog id's $ids = $this->input->get('ids', '', 'array'); // Get any return url $return = EB::_('index.php?option=com_easyblog&view=dashboard&layout=entries', false); if ($this->getReturnURL()) { $return = $this->getReturnURL(); } foreach ($ids as $id) { $post = EB::post($id); if (!$post->canDelete()) { $this->info->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_BLOG'), 'error'); return $this->app->redirect($return); } $post->delete(); } EB::info()->set(JText::_('COM_EASYBLOG_DASHBOARD_DELETE_SUCCESS'), 'success'); return $this->app->redirect($return); }
/** * Make the provided theme a default theme for EasyBlog * * @since 4.0 * @access public */ public function setDefault() { // Check for request forgeries EB::checkToken(); // Check for acl rules. $this->checkAccess('theme'); $element = $this->input->get('cid', '', 'array'); $element = $element[0]; if (!$element || !isset($element[0])) { EB::info()->set(JText::_('COM_EASYBLOG_THEME_INVALID_THEME_PROVIDED'), 'error'); return $this->app->redirect('index.php?option=com_easyblog&view=themes'); } // Legacy codes and should be removed soon $this->config->set('layout_theme', $element); // Get the configuration object $this->config->set('theme_site', $element); $table = EB::table('Configs'); $table->load('config'); $table->params = $this->config->toString('INI'); $table->store(); // Clear the component's cache $cache = JFactory::getCache('com_easyblog'); $cache->clean(); EB::info()->set(JText::sprintf('COM_EASYBLOG_THEME_SET_AS_DEFAULT', $element), 'success'); $this->app->redirect('index.php?option=com_easyblog&view=themes'); }
<span class="input-group-btn"> <a class="btn btn-default" href="javascript:void(0);" data-eb-form-search> <i class="fa fa-search"></i> </a> </span> </div> <a class="btn btn-default ml-5" data-eb-categories-create><?php echo JText::_('COM_EASYBLOG_DASHBOARD_CATEGORIES_CREATE'); ?> </a> </div> </div> <?php echo EB::info()->html(); ?> <?php if ($categories) { ?> <div class="eb-table eb-box"> <div class="eb-table-body"> <?php foreach ($categories as $category) { ?> <div class="row-table align-top" data-eb-category-item data-id="<?php echo $category->id; ?> "> <div class="col-cell">
/** * Allow current user to remove their own profile picture. * */ public function removePicture() { $mainframe = JFactory::getApplication(); $acl = EB::acl(); $my = JFactory::getUser(); $config = EasyBlogHelper::getConfig(); if (!$config->get('layout_avatar') || !$acl->get('upload_avatar')) { EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error'); $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false)); $mainframe->close(); } JTable::addIncludePath(EBLOG_TABLES); $profile = EB::user($my->id); $avatar_config_path = $config->get('main_avatarpath'); $avatar_config_path = rtrim($avatar_config_path, '/'); $avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path); $path = JPATH_ROOT . DIRECTORY_SEPARATOR . $avatar_config_path . DIRECTORY_SEPARATOR . $profile->avatar; if (!JFile::delete($path)) { EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error'); $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false)); $mainframe->close(); } // @rule: Update avatar in database $profile->avatar = ''; $profile->store(); EB::info()->set(JText::_('COM_EASYBLOG_PROFILE_PICTURE_REMOVED')); $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false)); $mainframe->close(); }