public function store($updateNulls = false) { if (empty($this->key)) { $this->key = $this->generate(); } return parent::store($updateNulls); }
/** * Saves a new rating item * * @since 5.0 * @access public * @param string * @return */ public function store($updateNulls = false) { $config = EB::config(); $state = parent::store(); if ($this->type == 'entry' && $this->created_by) { // Load the post item $post = EB::post($this->uid); // Get the author of the post $author = $post->getAuthor(); // Get the link to the post $link = $post->getExternalPermalink(); // Notify EasySocial users that someone rated their post EB::easysocial()->notifySubscribers($post, 'ratings.add'); // Assign EasySocial points EB::easysocial()->assignPoints('blog.rate'); EB::easysocial()->assignPoints('blog.rated', $post->created_by); // Assign badge for users that report blog post. // Only give points if the viewer is viewing another person's blog post. EB::easysocial()->assignBadge('blog.rate', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_RATED_BLOG')); // Assign points for AUP EB::aup()->assign('plgaup_easyblog_rate_blog', '', 'easyblog_rating', JText::_('COM_EASYBLOG_AUP_BLOG_RATED')); // Add notifications for EasyDiscuss // Add notifications // EB::jomsocial()->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', str_replace("administrator/","", $author->getProfileLink()), $author->getName() , $link , $blog->title), 'easyblog_new_blog' , $target , $author , $link); // Add notifications for easydiscuss if ($config->get('integrations_jomsocial_notification_rating')) { $target = array($post->created_by); EB::easydiscuss()->addNotification($post, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_RATING_FOR_YOUR_BLOG', $author->getName(), $post->title), EBLOG_NOTIFICATIONS_TYPE_RATING, array($post->created_by), $this->created_by, $link); } } return $state; }
public function store($updateNulls = false) { if (!$this->created) { $this->created = EB::date()->toMySQL(); } return parent::store($updateNulls); }
public function store($updateNulls = false) { if (!$this->created) { $this->created = EasyBlogHelper::getDate()->toMySQL(); } return parent::store($updateNulls); }
public function store() { $isNew = empty($this->id) ? true : false; $state = parent::store(); if ($state && $isNew) { $blog = EasyBlogHelper::getTable('Blog'); $blog->load($this->post_id); $profile = EasyBlogHelper::getTable('Profile'); $profile->load($blog->created_by); $obj = new stdClass(); $obj->blogtitle = $blog->title; $obj->blogauthor = $profile->getName(); $obj->subscribername = $this->fullname; $obj->subscriberemail = $this->email; $activity = new stdClass(); $activity->actor_id = empty($this->user_id) ? '0' : $this->user_id; $activity->target_id = $blog->created_by; $activity->context_type = 'post'; $activity->context_id = $this->post_id; $activity->verb = 'subscribe'; $activity->source_id = $this->id; $activity->uuid = serialize($obj); EasyBlogHelper::activityLog($activity); } return $state; }
public function store() { // @task: Load language file from the front end. JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); $this->clear($this->draft_id); // @rule: Send notification to the author of the post. $draft = EasyBlogHelper::getTable('Draft'); $draft->load($this->draft_id); $author = EasyBlogHelper::getTable('Profile'); $author->load($draft->created_by); $data['blogTitle'] = $draft->title; $data['blogAuthor'] = $author->getName(); $data['blogAuthorAvatar'] = $author->getAvatar(); $data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true); $data['blogAuthorEmail'] = $author->user->email; $data['rejectMessage'] = $this->message; // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls. $sh404exists = EasyBlogRouter::isSh404Enabled(); if (JFactory::getApplication()->isAdmin() && $sh404exists) { $data['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id; } $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED'); $obj = new StdClass(); $obj->unsubscribe = false; $obj->email = $author->user->email; $emails = array($obj); $notification = EasyBlogHelper::getHelper('Notification'); $notification->send($emails, $emailTitle, 'email.blog.rejected', $data); return parent::store(); }
/** * Override the parents store method so we can send confirmation email * * @since 5.0 * @access public * @param string * @return */ public function store($updateNulls = false) { $isNew = !$this->id ? true : false; // Ensure that the `created` column is valid if (!$this->created) { $this->created = JFactory::getDate()->toSql(); } // Let the parent save the object first. $state = parent::store($updateNulls); $config = EB::config(); // Send confirmation email to subscribers if ($isNew && $config->get('main_subscription_confirmation')) { $subscription = EB::subscription(); $template = $subscription->getTemplate(); $template->uid = $this->uid; $template->utype = $this->utype; $template->user_id = $this->user_id; $template->uemail = $this->email; $template->ufullname = $this->fullname; $template->ucreated = $this->created; $target = $this->getObject(); $template->targetname = $target->title; $template->targetlink = $target->objPermalink; $subscription->addMailQueue($template); } // Notify site admins when there is a new subscriber if ($isNew && $config->get('main_subscription_admin_notification')) { $this->notifyAdmin(); } return $state; }
/** * Override the implementation of store * * @since 5.0 * @access public * @param string * @return */ public function store($updateNulls = false) { // Check if creation date have been set if (!$this->created) { $this->created = EB::date()->toSql(); } return parent::store($updateNulls); }
function loadBySource($postId, $key, $source) { $db = EasyBlogHelper::db(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('uid') . '=' . $db->Quote($key) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . '=' . $db->Quote($postId) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('source') . '=' . $db->Quote($source); $db->setQuery($query); $obj = $db->loadObject(); return parent::bind($obj); }
/** * Override the parent's store behavior * * @since 5.0 * @access public * @param string * @return */ public function store($updateNulls = false) { // @task: Load language file from the front end. JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); // Clear any previous messages $model = EB::model('PostReject'); $model->clear($this->post_id); return parent::store(); }
/** * Deletes a custom field group * * @since 4.0 * @access public * @param string * @return */ public function delete($pk = null) { // Require the parent to delete the group $state = parent::delete($pk); // Remove custom fields associated with the group $model = EB::model('Fields'); $model->deleteGroupAssociation($this->id); return $state; }
public function loadByPostId($id) { $db = $this->getDBO(); $query = 'select * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl); $query .= ' where `post_id`= ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadAssoc(); return parent::bind($result); }
public function load($path = null, $type = true) { $db = EasyBlogHelper::db(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl); $query .= ' WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('path') . '=' . $db->Quote($path); $query .= ' AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('type') . '=' . $db->Quote($type); $db->setQuery($query); $obj = $db->loadObject(); return parent::bind($obj); }
/** * Overrides parent's delete method to add our own logic. * * @return boolean * @param object $db */ public function delete($pk = null) { $db = $this->getDBO(); $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__easyblog_post') . ' ' . 'WHERE ' . $db->nameQuote('category_id') . '=' . $db->Quote($this->id); $db->setQuery($query); $count = $db->loadResult(); if ($count > 0) { return false; } return parent::delete($pk); }
function bindPost() { $data = array('nickname' => JRequest::getWord('nickname'), 'description' => JRequest::getVar('description'), 'url' => JRequest::getVar('url'), 'biography' => JRequest::getVar('biography'), 'title' => JRequest::getVar('title')); pr($data); exit; parent::bind($data); $avatar = JRequest::getVar('avatar', '', 'Files'); if (!empty($avatar['tmp_name'])) { require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'image.php'; } }
function loadByUser($id, $type) { $db = $this->getDBO(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('user_id') . '=' . $db->Quote($id) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('type') . '=' . $db->Quote($type) . ' ' . 'LIMIT 1'; $db->setQuery($query); $result = $db->loadObject(); if (!$result) { return false; } return parent::bind($result); }
function load($id = null, $loadPostId = false) { if (!$loadPostId) { return parent::load($id); } $db = EasyBlogHelper::db(); $query = 'select `id` from `#__easyblog_autoarticle_map` where `post_id` = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); return parent::load($result); }
public function load($id = null, $type = '') { $db = EasyBlogHelper::db(); $query = 'SELECT * FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('content_id') . '=' . $db->Quote($id) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('type') . '=' . $db->Quote($type); $db->setQuery($query); $result = $db->loadObject(); if (!$result) { return false; } return parent::bind($result); }
public function loadByUser($id, $type) { $db = EB::db(); $query = 'SELECT * FROM ' . $db->quoteName($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('user_id') . '=' . $db->Quote($id) . ' ' . 'AND ' . $db->nameQuote('type') . '=' . $db->Quote($type) . ' ' . 'LIMIT 1'; $db->setQuery($query); $result = $db->loadObject(); if (!$result) { return false; } return parent::bind($result); }
/** * Loads a micro posting from twitter given the post id * * @since 5.0 * @access public * @param string * @return */ public function loadByPostId($id) { $db = EB::db(); $query = array(); $query[] = 'SELECT * FROM ' . $db->qn($this->_tbl); $query[] = 'WHERE ' . $db->qn('post_id') . '=' . $db->Quote($id); $query = implode(' ', $query); $db->setQuery($query); $result = $db->loadObject(); $state = parent::bind($result); return $state; }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($appname) { if (!parent::load($appname) && !empty($appname)) { $db = $this->getDBO(); $obj = new stdClass(); $obj->appname = $appname; $obj->description = ''; $obj->created = ''; $obj->modified = ''; $db->insertObject('#__easyblog_apps', $obj); } return parent::load($appname); }
function load($id = null, $reset = true) { $db = $this->getDBO(); $query = 'select `id` FROM ' . $db->nameQuote($this->_tbl); $query .= ' where user_id = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { $this->user_id = $id; return $this; } else { return parent::load($result, $reset); } }
function load($id) { $db = $this->getDBO(); $query = 'select `id` FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl); $query .= ' where user_id = ' . $db->Quote($id); $db->setQuery($query); $result = $db->loadResult(); if (empty($result)) { $this->user_id = $id; return $this; } else { return parent::load($result); } }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($id) { if (!parent::load($id) && $id != 0) { $db = $this->getDBO(); $obj = new stdClass(); $obj->app_id = ''; $obj->user_id = ''; $obj->created = ''; $obj->modified = ''; $obj->published = ''; $obj->ordering = ''; $db->insertObject('#__easyblog_userapps', $obj); } return parent::load($id); }
function load($id, $isUrl = false, $postId = '') { if (!$isUrl) { return parent::load($id); } else { $url = $id; } $db = EasyBlogHelper::db(); $query = 'SELECT * FROM #__easyblog_trackback_sent WHERE `url`=' . $db->Quote($url) . ' AND `post_id`=' . $db->Quote($postId); $db->setQuery($query); $result = $db->loadObject(); if ($result) { $this->id = $result->id; $this->post_id = $result->post_id; $this->url = $result->url; $this->sent = $result->sent; return true; } return false; }
public function store($updateNulls = false) { $config = EasyBlogHelper::getConfig(); $maxTimes = $config->get('main_reporting_maxip'); // @task: Run some checks on reported items and if ($maxTimes > 0) { $db = EasyBlogHelper::db(); $query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote($this->_tbl) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('obj_id') . ' = ' . $db->Quote($this->obj_id) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('obj_type') . ' = ' . $db->Quote($this->obj_type) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('ip') . ' = ' . $db->Quote($this->ip); $db->setQuery($query); $total = (int) $db->loadResult(); if ($total >= $maxTimes) { JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); $this->setError(JText::_('COM_EASYBLOG_REPORT_ALREADY_REPORTED')); return false; } } // Assign badge for users that report blog post. // Only give points if the viewer is viewing another person's blog post. EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.report', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_REPORT_BLOG')); return parent::store(); }
/** * override load method. * if user record not found in eblog_profile, create one record. * */ function load($id = null, $reset = true) { static $users = null; $id = $id == '0' ? null : $id; if (is_null($id)) { $this->bind(JFactory::getUser(0)); return $this; } if (empty($id)) { // When the id is null or 0 $this->bind(JFactory::getUser()); return $this; } if (!isset($users[$id])) { if (!parent::load($id) && $id != 0) { $obj = $this->_createDefault($id); $this->bind($obj); } $users[$id] = clone $this; } $this->user = JFactory::getUser($id); $this->bind($users[$id]); return $users[$id]; }
/** * Constructor for this class. * * @return * @param object $db */ function __construct(&$db) { parent::__construct('#__easyblog_team_users', 'id', $db); }
/** * Override parent's implementation of store * * @since 4.0 * @access public * @param string * @return */ public function store($updateNulls = false) { if (!$this->created) { $this->created = EB::date()->toSql(); } // Generate an alias if alias is empty if (!$this->alias) { $this->alias = EBR::normalizePermalink($this->title); } $my = JFactory::getUser(); // Add point integrations for new categories if ($this->id == 0 && $my->id > 0) { EB::loadLanguages(); // Integrations with EasyDiscuss EB::easydiscuss()->log('easyblog.new.category', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_CATEGORY', $this->title)); EB::easydiscuss()->addPoint('easyblog.new.category', $my->id); EB::easydiscuss()->addBadge('easyblog.new.category', $my->id); // AlphaUserPoints EB::aup()->assign('plgaup_easyblog_add_category', '', 'easyblog_add_category_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_CATEGORY_CREATED', $this->title)); // JomSocial integrations EB::jomsocial()->assignPoints('com_easyblog.category.add', $my->id); // Assign EasySocial points EB::easysocial()->assignPoints('category.create', $my->id); } // Figure out the proper nested set model if ($this->id == 0 && $this->lft == 0) { // No parent id, we use the current lft,rgt if ($this->parent_id) { $left = $this->getLeft($this->parent_id); $this->lft = $left; $this->rgt = $this->lft + 1; // Update parent's right $this->updateRight($left); $this->updateLeft($left); } else { $this->lft = $this->getLeft() + 1; $this->rgt = $this->lft + 1; } } if ($this->id == 0) { // new cats. we need to store the ordering. $this->ordering = $this->getOrdering($this->parent_id) + 1; } $isNew = !$this->id ? true : false; $state = parent::store(); return $state; }
/** * Constructor for this class. * * @return * @param object $db */ function __construct(&$db) { parent::__construct('#__easyblog_captcha', 'id', $db); }