예제 #1
0
 public function __construct()
 {
     $this->my = JFactory::getUser();
     $this->config = EB::config();
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * Default user listings page.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  */
 public function display($tpl = null)
 {
     $this->checkAccess('easyblog.manage.languages');
     $this->setHeading('COM_EASYBLOG_HEADING_LANGUAGES', '', 'fa-language');
     // Get configuration
     $config = EB::config();
     // Get the api key from the config
     $key = $config->get('main_apikey');
     // Add Joomla buttons
     JToolbarHelper::title(JText::_('COM_EASYBLOG_HEADING_LANGUAGES'));
     if (!$key) {
         JToolbarHelper::custom('savekey', 'save', '', JText::_('COM_EASYBLOG_SAVE_APIKEY_BUTTON'), false);
         $return = base64_encode('index.php?option=com_easyblog&view=languages');
         $this->set('return', $return);
         return parent::display('languages/key');
     }
     JToolbarHelper::custom('languages.discover', 'refresh', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_FIND_UPDATES'), false);
     JToolbarHelper::custom('languages.install', 'upload', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_INSTALL_OR_UPDATE'));
     JToolbarHelper::custom('languages.purge', 'purge', '', JText::_('COM_EASYBLOG_TOOLBAR_BUTTON_PURGE_CACHE'), false);
     // Get the languages that are already stored on the db
     $model = EB::model('Languages');
     $initialized = $model->initialized();
     if (!$initialized) {
         $this->set('key', $key);
         return parent::display('languages/initialize');
     }
     // Get languages
     $languages = $model->getLanguages();
     foreach ($languages as &$language) {
         $translators = json_decode($language->translator);
         $language->translator = $translators;
     }
     $this->set("languages", $languages);
     parent::display('languages/default');
 }
예제 #4
0
 public function __construct()
 {
     $this->config = EB::config();
     $this->doc = JFactory::getDocument();
     // If environment is set to production, change to static.
     $environment = $this->config->get('easyblog_environment');
     if ($environment == 'production') {
         $environment = 'static';
     }
     $this->namespace = 'EASYBLOG';
     $this->shortName = 'eb';
     $this->environment = $environment;
     $this->mode = $this->config->get('easyblog_mode');
     $this->version = (string) EB::getLocalVersion();
     $this->baseUrl = EB::getBaseUrl();
     $this->token = EB::getToken();
     $this->inline = $this->config->get('inline_configuration');
     $this->enableCdn = $this->config->get('enable_cdn');
     $this->ajaxUrl = JURI::base() . '?option=com_easyblog';
     // If we should use http://site.com/index.php for the ajax calls, we need to append it here
     if ($this->config->get('ajax_use_index')) {
         $this->ajaxUrl = JURI::base() . 'index.php?option=com_easyblog';
     }
     parent::__construct();
 }
예제 #5
0
 public function __construct($location, $name = null, $useOverride = false)
 {
     static $defaultWorkspace;
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     $this->config = EB::config();
     $this->doc = JFactory::getDocument();
     // Determines if this is a module section
     if ($location == 'module') {
         $this->isModule = true;
         $location = 'site';
     }
     if (!isset($defaultWorkspace)) {
         $override = $this->app->getTemplate();
         $defaultWorkspace = array('site' => strtolower($this->config->get('theme_site')), 'site_base' => strtolower($this->config->get('theme_site_base')), 'admin' => strtolower($this->config->get('theme_admin')), 'admin_base' => strtolower($this->config->get('theme_admin_base')), 'module' => null, 'override' => $override);
     }
     $this->workspace = $defaultWorkspace;
     $workspace = array();
     // Internally, override is a location.
     if ($useOverride) {
         $location = 'override';
     }
     // For specific template, else default template will be used.
     if (!empty($name)) {
         $workspace[$location] = $name;
     }
     // Because we can't do late static binding on PHP < 5.3.
     // Used by $this->override() method.
     $this->class = __CLASS__;
     parent::__construct('EASYBLOG', $workspace, $location);
 }
예제 #6
0
 public function __construct()
 {
     $config = EB::config();
     $this->config = $config;
     $this->url = $config->get('subscription_sendy_url');
     $this->id = $config->get('subscription_sendy_listid');
 }
예제 #7
0
 /**
  * Add / Update an existing blog subscription
  *
  * @since   4.0
  * @access  public
  * @param   string
  * @return
  */
 public function addBlogSubscription($blogId, $email, $userId = '0', $fullname = '')
 {
     $config = EB::config();
     $acl = EB::acl();
     $my = JFactory::getUser();
     // If user is not allowed here, skip this
     if (!$acl->get('allow_subscription') || !$my->id && !$config->get('main_allowguestsubscribe')) {
         return false;
     }
     // Check if user already has an existing subscription
     $subscriptionId = $this->isBlogSubscribed($blogId, $email, $userId);
     // Get the subscriber object
     $subscriber = EB::table('Subscriptions');
     // Try to load the subscription data
     if ($subscriptionId) {
         $subscriber->load($subscriptionId);
     }
     $subscriber->utype = EBLOG_SUBSCRIPTION_ENTRY;
     $subscriber->uid = $blogId;
     // Set the email address
     $subscriber->email = $email;
     // Set the subscribers name
     $subscriber->fullname = $fullname;
     // Set the creation date
     $date = EB::date();
     $subscriber->created = $date->toMySQL();
     // Try to save the new subscription
     $state = $subscriber->store();
     if (!$state) {
         return false;
     }
     return $subscriber;
 }
예제 #8
0
 /**
  * Displays a list of voters
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function voters()
 {
     // Get the composite keys
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', '', 'cmd');
     // Get maximum number of voters to show up in the dialog.
     $limit = EB::config()->get('main_ratings_display_raters_max');
     // Get the ratings
     $model = EB::model('Ratings');
     $votes = $model->getRatingUsers($uid, $type, $limit);
     // Determines the total number of guest votes
     $totalGuests = 0;
     // Format the votes
     if ($votes) {
         foreach ($votes as &$vote) {
             $vote->user = false;
             if ($vote->created_by) {
                 $user = EB::user($vote->created_by);
                 $vote->user = $user;
             } else {
                 $totalGuests += 1;
             }
         }
     }
     $theme = EB::template();
     $theme->set('totalGuests', $totalGuests);
     $theme->set('votes', $votes);
     $output = $theme->output('site/ratings/dialog.voters');
     return $this->ajax->resolve($output);
 }
예제 #9
0
 /**
  * Discover new languages
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function discover()
 {
     $config = EB::config();
     $key = $config->get('main_apikey');
     $connector = EB::connector();
     $connector->addUrl(EBLOG_LANGUAGES_SERVER);
     $connector->addQuery('key', $key);
     $connector->setMethod('POST');
     $connector->execute();
     $contents = $connector->getResult(EBLOG_LANGUAGES_SERVER);
     if (!$contents) {
         $result = new stdClass();
         $result->message = 'No language found';
         return $result;
     }
     // Decode the result
     $result = json_decode($contents);
     if ($result->code != 200) {
         $return = base64_encode('index.php?option=com_easyblog&view=languages');
         return $result->message;
     }
     foreach ($result->languages as $language) {
         // If it does, load it instead of overwriting it.
         $table = EB::table('Language');
         $exists = $table->load(array('locale' => $language->locale));
         // We do not want to bind the id
         unset($language->id);
         // Since this is the retrieval, the state should always be disabled
         if (!$exists) {
             $table->state = EBLOG_LANGUAGES_NOT_INSTALLED;
         }
         // Then check if the language needs to be updated. If it does, update the ->state to EBLOG_LANGUAGES_NEEDS_UPDATING
         // We need to check if the language updated time is greater than the local updated time
         if ($exists && $table->state) {
             $languageTime = strtotime($language->updated);
             $localLanguageTime = strtotime($table->updated);
             if ($languageTime > $localLanguageTime && $table->state == EBLOG_LANGUAGES_INSTALLED) {
                 $table->state = EBLOG_LANGUAGES_NEEDS_UPDATING;
             }
         }
         // Set the title
         $table->title = $language->title;
         // Set the locale
         $table->locale = $language->locale;
         // Set the translator
         $table->translator = $language->translator;
         // Set the updated time
         $table->updated = $language->updated;
         // Update the progress
         $table->progress = $language->progress;
         // Update the table with the appropriate params
         $params = new JRegistry();
         $params->set('download', $language->download);
         $params->set('md5', $language->md5);
         $table->params = $params->toString();
         $table->store();
     }
     return true;
 }
예제 #10
0
 public function __construct()
 {
     $this->config = EB::config();
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     // Determines if the current request is for debug
     $this->debug = $this->input->get('debug', false, 'bool');
 }
예제 #11
0
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     $config = EB::config();
     $key = $config->get('integrations_flickr_api_key');
     $secret = $config->get('integrations_flickr_secret_key');
     parent::__construct($key, $secret);
 }
예제 #12
0
 public function loadProvider($provider = null)
 {
     // If provider is empty, then we get it based on settings
     if (empty($provider)) {
         $provider = EB::config()->get('location_service_provider', '');
     }
     $this->provider = $this->getProvider($provider);
     return $this->provider;
 }
예제 #13
0
 public function __construct()
 {
     $this->my = JFactory::getUser();
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     $this->acl = EB::acl();
     $this->config = EB::config();
     // Set the user project
     $this->user = EB::user($this->my->id);
 }
예제 #14
0
 public function __construct()
 {
     // Get the config object
     $this->config = EB::config();
     // Get app settings
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     // Assign the key and secret
     $this->key = $this->config->get('amazon_key');
     $this->secret = $this->config->get('amazon_secret');
 }
예제 #15
0
 public static function getPosts(&$params)
 {
     $config = EB::config();
     $count = (int) $params->get('count', 0);
     // Retrieve the model from the component.
     $model = EB::model('Blog');
     $categories = trim($params->get('catid'));
     $type = !empty($categories) ? 'category' : '';
     if (!empty($categories)) {
         $categories = explode(',', $categories);
     }
     $sorting = array();
     $sorting[] = $params->get('sorting', 'latest');
     $sorting[] = $params->get('ordering', 'desc');
     $rows = $model->getBlogsBy($type, $categories, $sorting, $count, EBLOG_FILTER_PUBLISHED, null, false);
     $posts = array();
     // Retreive settings from params
     $maxWidth = $params->get('imagewidth', 300);
     $maxHeight = $params->get('imageheight', 200);
     foreach ($rows as $data) {
         $row = EB::post($data->id);
         $row->bind($data);
         $row->media = '';
         //var_dump($row->image);
         if (!empty($row->image)) {
             $media = $row->getImage('thumbnail');
             $imgHtml = $media;
             $row->media = $imgHtml;
         } else {
             $image = self::getImage($row->intro . $row->content);
             if ($image !== false) {
                 // TODO: Here's where we need to crop the image based on the cropping ratio provided in the params.
                 // Currently this is just a lame hack to fix the width and height
                 $pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'>]*)/i';
                 preg_match($pattern, $image, $matches);
                 $imageurl = '';
                 if ($matches) {
                     $imageurl = isset($matches[1]) ? $matches[1] : '';
                 }
                 if (!empty($imageurl)) {
                     // $imgHtml = '<img title="'.$row->title.'" src="' . $imageurl . '" style="width: '. $maxWidth . 'px !important;height: '. $maxHeight . 'px !important;" />';
                     $imgHtml = $imageurl;
                     $row->media = $imgHtml;
                 } else {
                     $row->media = $image;
                 }
             }
         }
         if (!empty($row->media)) {
             $posts[] = $row;
         }
     }
     return $posts;
 }
예제 #16
0
 private function init($url = '')
 {
     $config = EB::config();
     if (!$config->get('comment_akismet_key')) {
         return false;
     }
     if (is_null($this->akismet)) {
         $url = !empty($url) ? $url : JURI::root();
         $this->akismet = new Akismet($url, $config->get('comment_akismet_key'));
     }
     return $this;
 }
예제 #17
0
 /**
  * Retrieves a list of albums from the content
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($content, $userId = '')
 {
     $file = JPATH_ROOT . '/components/com_community//libraries/core.php';
     $cfg = EB::config();
     $result = array();
     jimport('joomla.filesystem.file');
     // If jomsocial doesn't even exist, just skip this.
     if (!JFile::exists($file) || !$cfg->get('integrations_jomsocial_album')) {
         return $result;
     }
     require_once $file;
     // @task: Process new gallery tags. These tags are only used in 3.5 onwards.
     $pattern = '/\\[embed=album\\](.*)\\[\\/embed\\]/i';
     preg_match_all($pattern, $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $match) {
             // The full text of the matched content.
             $text = $match[0];
             // The json string
             $jsonString = $match[1];
             // Let's parse the JSON string and get the result.
             $obj = json_decode($jsonString);
             // @task: When there's nothing there, we just return the original content.
             if ($obj === false) {
                 // @TODO: Remove the gallery tag.
                 // @task: Skipe processing for this match.
                 continue;
             }
             $albumId = $obj->file;
             // Let's get a list of photos from this particular album.
             $model = CFactory::getModel('photos');
             // Always retrieve the list of albums first
             $photos = $model->getAllPhotos($albumId);
             if (!$photos) {
                 continue;
             }
             $images = array();
             foreach ($photos as $photo) {
                 $image = new stdClass();
                 $image->title = $photo->caption;
                 $image->original = rtrim(JURI::root(), '/') . '/' . str_ireplace('\\', '/', $photo->image);
                 $image->thumbnail = rtrim(JURI::root(), '/') . '/' . str_ireplace('\\', '/', $photo->thumbnail);
                 $images[] = $image;
             }
             $theme = EB::template();
             $theme->set('uid', uniqid());
             $theme->set('images', $images);
             $output = $theme->output('site/blogs/latest/blog.album');
             $result[] = $output;
         }
     }
     return $result;
 }
예제 #18
0
 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();
     }
 }
예제 #19
0
 public function __construct($overrideTheme = null, $options = array())
 {
     parent::__construct();
     // Determine if this is an admin location
     if (isset($options['admin']) && $options['admin']) {
         $this->admin = true;
     }
     // Determine the configured theme
     $theme = $this->config->get('layout_theme', $overrideTheme);
     // If a view is provided into the theme, the theme files could call methods from a view
     if (isset($options['view']) && is_object($options['view'])) {
         $this->view = $options['view'];
     }
     $this->theme = $theme;
     $obj = new stdClass();
     $obj->config = EB::config();
     $obj->my = JFactory::getUser();
     $obj->admin = EB::isSiteAdmin();
     $obj->profile = EB::user();
     // If it's development mode, allow user to invoke in the url to change theme.
     $environment = $obj->config->get('easyblog_environment');
     if ($environment == 'development') {
         $invokeTheme = $this->input->get('theme', '', 'word');
         if ($invokeTheme) {
             $this->theme = $invokeTheme;
         }
     }
     // If this is entry view, or category view, we need to respect the theme's category
     $this->menu = $this->app->getMenu()->getActive();
     $this->params = new JRegistry();
     // If there is an active menu, try to get the menu parameters.
     if ($this->menu) {
         // Get the params prefix
         $prefix = isset($options['paramsPrefix']) ? $options['paramsPrefix'] : '';
         // Set the current parameters.
         if ($prefix) {
             $model = EB::model('Menu');
             $this->params = $model->getCustomMenuParams($this->menu->id, $this->menu->params, $prefix);
         } else {
             $this->params = $this->menu->params;
         }
         // We will just set it here from the menu when this class first get instantiate.
         // The corresponding view will have to do their own assignment if the view's templates need to access this entryParams
         $this->entryParams = $this->params;
     }
     //is blogger mode flag
     $obj->isBloggerMode = EBR::isBloggerMode();
     $this->my = $obj->my;
     // Assign the acl
     $this->acl = EB::acl();
 }
예제 #20
0
 public function enabled()
 {
     jimport('joomla.filesystem.file');
     $config = EB::config();
     $path = JPATH_ROOT . '/components/com_alphauserpoints/helper.php';
     // make sure the config is enabled
     if ($config->get('main_alpha_userpoint')) {
         if (JFile::exists($path)) {
             require_once $path;
             return true;
         }
     }
     return false;
 }
예제 #21
0
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $this->config = EB::config();
     $this->apiKey = $this->config->get('integrations_linkedin_api_key');
     $this->apiSecret = $this->config->get('integrations_linkedin_secret_key');
     // Default redirection url
     $this->redirect = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&task=linkedin.grant';
     if ($this->input->get('system', false, 'bool')) {
         $this->redirect .= '&system=1';
     }
     $options = array('appKey' => $this->apiKey, 'appSecret' => $this->apiSecret, 'callbackUrl' => $this->redirect);
     parent::__construct($options);
 }
예제 #22
0
 public function getHTML($bloggerid = "")
 {
     $config = EB::config();
     $html = '';
     $easysocial = EB::easysocial();
     if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $badges = $user->getBadges();
         $theme = EB::template();
         $theme->set('badges', $badges);
         $html = $theme->output('site/easysocial/achievements');
     }
     return $html;
 }
예제 #23
0
 /**
  * Attaches the Twitter card into the page header
  *
  * @since	4.0
  * @access	public
  * @param	EasyBlogTableBlog
  * @return
  */
 public static function addCard(EasyBlogPost &$blog)
 {
     $config = EB::config();
     $doc = JFactory::getDocument();
     // Check if the current settings would want to display the twitter cards
     if (!$config->get('main_twitter_cards')) {
         return;
     }
     // Get the absolute permalink for this blog item.
     $url = $blog->getExternalPermalink();
     // Get the image of the blog post.
     $image = self::getImage($blog);
     if ($image) {
         $doc->addCustomTag('<meta property="twitter:image" content="' . $image . '"/>');
     }
     // @task: Get Joomla's document object.
     $doc = JFactory::getDocument();
     // Convert double quotes to html entity in blog title.
     $title = htmlspecialchars($blog->title, ENT_QUOTES);
     // Add card definition.
     $doc->addCustomTag('<meta property="twitter:card" content="summary" />');
     $doc->addCustomTag('<meta property="twitter:url" content="' . $url . '" />');
     $doc->addCustomTag('<meta property="twitter:title" content="' . $title . '" />');
     // Retrieve the stored meta for the blog post
     $meta = $blog->loadMeta();
     // If there's a meta set for the blog, use the stored meta version
     $description = !empty($meta->description) ? $meta->description : $blog->getIntro();
     // Remove unwanted tags
     $description = EB::stripEmbedTags($description);
     // Add any slashes
     $description = addslashes($description);
     // Remove any html tags
     $description = strip_tags($description);
     // Ensure that newlines wouldn't affect the header
     $description = trim($description);
     // Replace htmlentities with the counterpert
     // Perhaps we need to explicitly replace &nbsp; with a space?
     $description = html_entity_decode($description);
     // Remove any quotes (") from the content
     $description = str_ireplace('"', '', $description);
     // Twitter's card maximum length is only set to 137
     $maxLength = 137;
     if (JString::strlen($description) > $maxLength) {
         $description = JString::substr($description, 0, $maxLength) . JText::_('COM_EASYBLOG_ELLIPSES');
     }
     $doc->addCustomTag('<meta property="twitter:description" content="' . $description . '" />');
     return true;
 }
예제 #24
0
 /**
  * Prepares the comment output
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function prepareComments(&$blog)
 {
     $config = EB::config();
     $my = JFactory::getUser();
     $result = new stdClass();
     // add checking if comment system disabled by site owner
     if ($this->config->get('main_comment') && $blog->allowcomment) {
         // Retrieve blog comments
         $comments = EB::comment()->getBlogComment($blog->id);
         $result->pagination = EB::comment()->pagination;
         $result->comments = $comments;
     }
     // Set the total number of comments for this blog post
     $blog->totalComments = EB::comment()->getCommentCount($blog);
     return $result;
 }
예제 #25
0
 public function __construct()
 {
     // EasyBlog's configuration
     $this->config = EB::config();
     $this->jconfig = EB::jconfig();
     // Joomla's document object
     $this->doc = JFactory::getDocument();
     // Joomla's application object
     $this->app = JFactory::getApplication();
     // Request input object
     $this->input = EB::request();
     // Current logged in user.
     $this->my = JFactory::getUser();
     // String library
     $this->string = EB::string();
     $this->lang = JFactory::getLanguage();
 }
예제 #26
0
 public function addUser($values, $source = 'subscribe')
 {
     $userComponent = 'com_users';
     $config = EB::config();
     $usersConfig = JComponentHelper::getParams('com_users');
     $canRegister = $source == 'comment' ? $config->get('comment_registeroncomment', 0) : $config->get('main_registeronsubscribe', 0);
     if ($usersConfig->get('allowUserRegistration') == '0' || !$canRegister) {
         return JText::_('COM_EASYBLOG_REGISTRATION_DISABLED');
     }
     $username = $values['username'];
     $email = $values['email'];
     $fullname = $values['name'];
     $mainframe = JFactory::getApplication();
     $jConfig = EasyBlogHelper::getJConfig();
     $authorize = JFactory::getACL();
     $document = JFactory::getDocument();
     $user = clone JFactory::getUser();
     $pwdClear = $username . '123';
     $newUsertype = $usersConfig->get('new_usertype', 2);
     $userArr = array('username' => $username, 'name' => $fullname, 'email' => $email, 'password' => $pwdClear, 'password2' => $pwdClear, 'groups' => array($newUsertype), 'gid' => '0', 'id' => '0');
     if (!$user->bind($userArr, 'usertype')) {
         return $user->getError();
     }
     $date = EB::date();
     $user->set('registerDate', $date->toSql());
     //check if user require to activate the acct
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1' || $useractivation == '2') {
         jimport('joomla.user.helper');
         $user->set('activation', md5(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     JPluginHelper::importPlugin('user');
     $user->save();
     // Send registration confirmation mail
     $password = $pwdClear;
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     //load com_user language file
     $lang = JFactory::getLanguage();
     $lang->load('com_users');
     // Get the user id.
     $userId = $user->id;
     $this->sendMail($user, $password);
     return $userId;
 }
예제 #27
0
 public function __construct()
 {
     $this->config = EB::config();
     $this->doc = JFactory::getDocument();
     // If environment is set to production, change to static.
     $environment = $this->config->get('easyblog_environment');
     if ($environment == 'production') {
         $environment = 'static';
     }
     $this->namespace = 'EASYBLOG';
     $this->shortName = 'eb';
     $this->environment = $environment;
     $this->mode = $this->config->get('easyblog_mode');
     $this->version = (string) EB::getLocalVersion();
     $this->baseUrl = EB::getBaseUrl();
     $this->token = EB::getToken();
     $this->inline = $this->config->get('inline_configuration');
     $this->enableCdn = $this->config->get('enable_cdn');
     parent::__construct();
 }
예제 #28
0
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $this->config = EB::config();
     $this->apiKey = $this->config->get('integrations_twitter_api_key');
     $this->apiSecret = $this->config->get('integrations_twitter_secret_key');
     // Set the redirection callback for Twitter
     $this->redirect = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&task=twitter.grant';
     // Determines if there's a "system" in the url
     $system = $this->input->get('system', false, 'bool');
     if ($system) {
         $this->redirect .= '&system=1';
     }
     // Determines if there's a "userId" in the url
     $userId = $this->input->get('userId', null, 'default');
     if ($userId) {
         $this->redirect .= '&userId=' . $userId;
     }
     parent::__construct($this->apiKey, $this->apiSecret);
 }
예제 #29
0
 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();
 }
예제 #30
0
 static function getPosts($params)
 {
     $db = EB::db();
     $order = trim($params->get('order', 'postcount_desc'));
     $count = (int) trim($params->get('count', 0));
     $showprivate = $params->get('showprivate', true);
     $config = EB::config();
     $query = 'SELECT a.* , SUM(b.value) AS ratings FROM ' . $db->nameQuote('#__easyblog_post') . ' AS a ' . 'LEFT JOIN ' . $db->nameQuote('#__easyblog_ratings') . ' AS b ' . 'ON a.id=b.uid ' . 'AND b.type=' . $db->Quote('entry') . ' ' . 'INNER JOIN ' . $db->quoteName('#__easyblog_post_category') . ' as c ON a.`id` = c.`post_id` INNER JOIN ' . $db->quoteName('#__easyblog_category') . ' as d ON c.`category_id` = d.`id` ' . 'WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= 'AND a.' . $db->nameQuote('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL) . ' ';
     if (!$showprivate) {
         $query .= ' AND a.' . $db->nameQuote('access') . '=' . $db->Quote(0);
     }
     // Respect inclusion categories
     $categories = $params->get('catid');
     if (!empty($categories)) {
         $categories = explode(',', $categories);
         $query .= ' AND d.`id` IN(';
         if (!is_array($categories)) {
             $categories = array($categories);
         }
         for ($i = 0; $i < count($categories); $i++) {
             $query .= $db->Quote($categories[$i]);
             if (next($categories) !== false) {
                 $query .= ',';
             }
         }
         $query .= ')';
     }
     $query .= ' AND a.' . $db->nameQuote('source_id') . '=' . $db->Quote('0');
     $query .= 'GROUP BY b.uid ';
     $query .= 'ORDER BY ' . $db->nameQuote('ratings') . ' DESC ';
     if (!empty($count)) {
         $query .= ' LIMIT ' . $count;
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $posts = EB::modules()->processItems($result, $params);
     return $posts;
 }