Example #1
0
 /**
  * Run the job
  *
  */
 protected function __construct()
 {
     JLoader::register('PostHelper', JPATH_AUTOTWEET_HELPERS . '/post.php');
     // Cronjob params
     $this->cron_enabled = EParameter::getComponentParam(CAUTOTWEETNG, 'cron_enabled', false);
     $this->max_posts = EParameter::getComponentParam(CAUTOTWEETNG, 'max_posts', 1);
     // Wrapper for mbstrings
     // include_once dirname(__FILE__) . '/mbstringwrapper/mbstringwrapper.php';
 }
Example #2
0
 /**
  * getInstance
  *
  * @return	object
  */
 public static function &getInstance()
 {
     if (!self::$_instance) {
         $log_level = EParameter::getComponentParam(CAUTOTWEETNG, 'log_level', JLog::ERROR);
         $log_mode = EParameter::getComponentParam(CAUTOTWEETNG, 'log_mode', ELog::LOG_MODE_SCREEN);
         self::$_instance = new ELog($log_level, $log_mode);
     }
     return self::$_instance;
 }
Example #3
0
 /**
  * Runs before rendering the view template, echoing HTML to put before the
  * view template's generated HTML
  *
  * @return void
  */
 protected function preRender()
 {
     parent::preRender();
     if (!AUTOTWEETNG_FREE) {
         $cron_enabled = EParameter::getComponentParam(CAUTOTWEETNG, 'cron_enabled');
         if (!$cron_enabled && F0FModel::getTmpInstance('Channels', 'AutoTweetModel')->getTotal() > self::CHANNELS_PAGE_LOAD_LIMIT) {
             echo JText::_('COM_AUTOTWEET_LBL_CHANNELS_TOOMANY_NOTCRON');
         }
     }
 }
 /**
  * FeedHelper
  *
  */
 public function __construct()
 {
     include_once 'feedcontent.php';
     include_once 'feeddupchecker.php';
     include_once 'feedimage.php';
     include_once 'feedtext.php';
     self::$_params = null;
     $this->_shorturl_always = EParameter::getComponentParam(CAUTOTWEETNG, 'shorturl_always', 1);
     $this->_logger = AutotweetLogger::getInstance();
 }
Example #5
0
 /**
  * Checks the record for validity
  *
  * @return  int  True if the record is valid
  */
 public function check()
 {
     if (empty($this->image_url)) {
         // Default image: used in media mode when no image is available
         $this->image_url = EParameter::getComponentParam(CAUTOTWEETNG, 'default_image', '');
     }
     if (!empty($this->image_url)) {
         $routeHelp = RouteHelp::getInstance();
         $this->image_url = $routeHelp->getAbsoluteUrl($this->image_url, true);
     }
     return true;
 }
 /**
  * sendMessage.
  *
  * @param   string  $message  Params
  * @param   object  $data     Params
  *
  * @return	boolean
  */
 public function sendMessage($message, $data)
 {
     $title = $data->title;
     $text = $data->fulltext;
     $url = $data->url;
     $org_url = $data->org_url;
     $image_url = $data->image_url;
     $media_mode = $this->getMediaMode();
     $logger = AutotweetLogger::getInstance();
     $logger->log(JLog::INFO, 'sendFacebookMessage', $message);
     if (empty($image_url)) {
         return array(true, 'No photo.');
     }
     $fb_id = $this->getFbChannelId();
     $fbalbum_id = $this->get('fbalbum_id');
     $fb_token = $this->get('fbchannel_access_token');
     $result = null;
     $status_type = array('value' => 'added_photos');
     // Photo object: /user/photos
     $arguments = array('message' => $message, 'url' => $image_url, 'access_token' => $fb_token, 'type' => 'photo', 'created_time' => JFactory::getDate()->toISO8601(), 'status_type' => json_encode($status_type));
     $isUserProfile = $this->isUserProfile();
     if ($isUserProfile) {
         $privacy = $this->get('sharedwith', 'EVERYONE');
         $privacy = array('value' => $privacy);
         $arguments['privacy'] = json_encode($privacy);
     }
     $target_id = $data->xtform->get('target_id');
     if (EParameter::getComponentParam(CAUTOTWEETNG, 'targeting', false) && $target_id) {
         $this->addTargetArguments($arguments, $target_id);
     }
     try {
         $api = $this->getApiInstance();
         $api->setFileUploadSupport(true);
         // Simulated
         if ($this->channel->params->get('use_own_api') == 0) {
             $this->getApiInstance()->api("/me/permissions");
             $result = array(true, JText::_('COM_AUTOTWEET_VIEW_SIMULATED_OK'));
         } else {
             if ($fbalbum_id) {
                 $result = $this->getApiInstance()->api("/{$fbalbum_id}/photos", 'post', $arguments);
             } else {
                 $result = $this->getApiInstance()->api("/{$fb_id}/photos", 'post', $arguments);
             }
             $msg = 'Facebook id: ' . $result['id'];
             $result = array(true, $msg);
         }
     } catch (Exception $e) {
         $result = array(false, $e->getCode() . ' - ' . $e->getMessage());
     }
     return $result;
 }
Example #7
0
 /**
  * ShorturlHelper. No public access (singleton pattern).
  *
  */
 protected function __construct()
 {
     JLoader::register('AutotweetShortservice', dirname(__FILE__) . '/urlshortservices/autotweetshortservice.php');
     JLoader::register('AutotweetURLShortserviceFactory', dirname(__FILE__) . '/urlshortservices/autotweeturlshortservicefactory.php');
     // General params for message and posting
     $this->resend_attempts = EParameter::getComponentParam(CAUTOTWEETNG, 'resend_attempts', 2);
     $this->shorturl_service = EParameter::getComponentParam(CAUTOTWEETNG, 'shorturl_service', 'Tinyurlcom');
     // Bit.ly, Goog.gl and yourls account data
     $this->bit_username = EParameter::getComponentParam(CAUTOTWEETNG, 'bit_username', null);
     $this->bit_key = EParameter::getComponentParam(CAUTOTWEETNG, 'bit_key', null);
     $this->google_api_key = EParameter::getComponentParam(CAUTOTWEETNG, 'google_api_key', null);
     $this->yourls_host = EParameter::getComponentParam(CAUTOTWEETNG, 'yourls_host', null);
     $this->yourls_token = EParameter::getComponentParam(CAUTOTWEETNG, 'yourls_token', null);
     // Init AutoTweet logging
     $this->logger = AutotweetLogger::getInstance();
 }
Example #8
0
 /**
  * onAdd.
  *
  * @param   string  $tpl  Param
  *
  * @return	void
  */
 public function onAdd($tpl = null)
 {
     $jlang = JFactory::getLanguage();
     $jlang->load('com_content');
     Extly::loadAwesome();
     $file = EHtml::getRelativeFile('js', 'com_autotweet/feed.min.js');
     if ($file) {
         $dependencies = array();
         $paths = array();
         $ajax_import = EParameter::getComponentParam(CAUTOTWEETNG, 'ajax_import', true);
         $this->assignRef('ajax_import', $ajax_import);
         if ($ajax_import) {
             $paths['import'] = 'media/com_autotweet/js/import.min';
         }
         Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies, $paths);
     }
     return parent::onAdd($tpl);
 }
Example #9
0
 /**
  * isValidImageFile
  *
  * @param   string  $imagefile  Param
  *
  * @return	bool
  */
 public function isValidImageFile($imagefile)
 {
     list($width, $height, $type, $attr) = getimagesize($imagefile);
     $logger = AutotweetLogger::getInstance();
     $logger->log(JLog::INFO, "isValidImage ({$width}, {$height}, {$type}, {$attr})");
     if (!in_array($type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
         return false;
     }
     $image_minx = EParameter::getComponentParam(CAUTOTWEETNG, 'image_minx', 100);
     if ($width < $image_minx) {
         return false;
     }
     $image_miny = EParameter::getComponentParam(CAUTOTWEETNG, 'image_miny', 0);
     if ($height < $image_miny) {
         return false;
     }
     return true;
 }
Example #10
0
 /**
  * publishPosts - This static function should used from backend only for manual (re)posting attempts
  *
  * @param   array  $posts   Param
  * @param   int    $userid  Param
  *
  * @return	boolean
  */
 public static function publishPosts($posts, $userid = null)
 {
     JLoader::register('SharingHelper', JPATH_AUTOTWEET_HELPERS . '/sharing.php');
     $cron_enabled = EParameter::getComponentParam(CAUTOTWEETNG, 'cron_enabled', 0);
     $success = false;
     $sharinghelper = SharingHelper::getInstance();
     $post = F0FModel::getTmpInstance('Posts', 'AutoTweetModel')->getTable();
     foreach ($posts as $pid) {
         $post->reset();
         $post->load($pid);
         $post->xtform = EForm::paramsToRegistry($post);
         if ($post->pubstate == AutotweetPostHelper::POST_APPROVE && $cron_enabled) {
             $success = self::savePost(AutotweetPostHelper::POST_CRONJOB, 'COM_AUTOTWEET_MSG_POSTRESULT_CRONJOB', $post, $userid);
         } else {
             $success = $sharinghelper->publishPost($post, $userid);
         }
     }
     return $success;
 }
Example #11
0
 /**
  * Public constructor. Initialises the protected members as well.
  *
  * @param   array  $config  Param
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     $dlid = EParameter::getComponentParam(CAUTOTWEETNG, 'update_dlid', '');
     $this->extraQuery = '';
     // If I have a valid Download ID I will need to use a non-blank extra_query in Joomla! 3.2+
     if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) {
         $this->extraQuery = 'dlid=' . $dlid;
     }
     $this->updateSiteName = VersionHelper::getFlavourName();
     $this->updateSite = VersionHelper::getUpdatesSite();
     $minstability = EParameter::getComponentParam(CAUTOTWEETNG, 'minstability');
     if ($minstability == self::CONFIG_AUTOUPDATE_BETA) {
         // Live site
         $this->updateSite .= '-beta';
     }
     // $this->updateSite = 'http://www.extly.com/update-autotweetng-free-test.xml';
     // $this->updateSite = 'http://www.extly.com/update-autotweetng-joocial-test.xml';
 }
 /**
  * postQueuedMessages
  *
  * @param   integer  $max  Param
  *
  * @return	boolean
  */
 public function postQueuedMessages($max)
 {
     $now = JFactory::getDate();
     $logger = AutotweetLogger::getInstance();
     if (AUTOTWEETNG_JOOCIAL && !VirtualManager::getInstance()->isWorking($now)) {
         $logger->log(JLog::INFO, 'AutotweetPostHelper - VM not working now ' . $now->toISO8601(true));
         return false;
     }
     // Get msgs from queue (sending is allowed only, when publish date is not in the future)
     // Sub 1 minute to avoid problems when automator plugin and extension plugin are executed at the same time...
     $check_date = $now->toUnix();
     // Sub 1 minute check
     $mincheck_time_intval = EParameter::getComponentParam(CAUTOTWEETNG, 'mincheck_time_intval', 60);
     $check_date = $check_date - $mincheck_time_intval;
     $check_date = JFactory::getDate($check_date);
     $requests = RequestHelp::getRequestList($check_date, $max);
     $sharingHelper = SharingHelper::getInstance();
     $logger->log(JLog::INFO, 'postQueuedMessages Requests: ' . count($requests));
     foreach ($requests as $request) {
         $result = false;
         $message = null;
         try {
             $result = $sharingHelper->publishRequest($request);
         } catch (Exception $e) {
             $message = $e->getMessage();
             $logger->log(JLog::ERROR, 'postQueuedMessages: Exception! ' . $message);
         }
         if ($result) {
             RequestHelp::processed($request->id);
         } else {
             RequestHelp::saveError($request->id, $message);
         }
     }
     if (AUTOTWEETNG_JOOCIAL && empty($requests)) {
         $logger->log(JLog::INFO, 'VirtualManager: anything else to publish?');
         VirtualManager::getInstance()->enqueueEvergreenMessage($check_date, $max);
     }
 }
Example #13
0
 /**
  * onBrowse
  *
  * @param   string  $tpl  Param
  *
  * @return	bool
  */
 protected function onBrowse($tpl = null)
 {
     Extly::loadAwesome();
     GridHelper::loadComponentInfo($this);
     GridHelper::loadStats($this);
     GridHelper::loadStatsTimeline($this);
     $document = JFactory::getDocument();
     $document->addScript('//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js');
     $document->addScript('//cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.js');
     $document->addStyleSheet('//cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.css');
     // Get component parameter - Offline mode
     $version_check = EParameter::getComponentParam(CAUTOTWEETNG, 'version_check', 1);
     $this->assign('version_check', $version_check);
     $platform = F0FPlatform::getInstance();
     if ($version_check && $platform->isBackend()) {
         $file = EHtml::getRelativeFile('js', 'com_autotweet/liveupdate.min.js');
         if ($file) {
             $dependencies = array();
             $dependencies['liveupdate'] = array('extlycore');
             Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies);
         }
     }
     parent::onBrowse($tpl);
 }
Example #14
0
 /**
  * _getInternalViews
  *
  * @return  array
  */
 private function _getInternalViews()
 {
     $views = array('cpanels', 'composer');
     if (EXTLY_J3) {
         // Activities menu definition
         $activities = array('requests');
         // Rules and evergreens - Only in the backend
         if ($this->isBackend) {
             if (AUTOTWEETNG_JOOCIAL) {
                 $activities[] = 'evergreens';
             }
             $activities[] = 'rules';
         }
         $activities[] = 'posts';
         $views['COM_AUTOTWEET_TITLE_ACTIVITIES'] = $activities;
     } else {
         $views[] = 'requests';
         // Rules and evergreens - Only in the backend
         if ($this->isBackend) {
             if (AUTOTWEETNG_JOOCIAL) {
                 $views[] = 'evergreens';
             }
             $views[] = 'rules';
         }
         $views[] = 'posts';
     }
     $views[] = 'channels';
     // Feeds and System Check - Only in the backend
     if ($this->isBackend) {
         // Targeting - Only in Joocial
         if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'targeting', false)) {
             array_push($views, 'targets');
         }
         $views[] = 'feeds';
         $views[] = 'infos';
         $views[] = 'usermanual';
         if (EXTLY_J3) {
             $views[] = 'options';
         }
     }
     return $views;
 }
Example #15
0
 /**
  * loadAjaxImporter
  *
  * @param   object  $view  Param
  *
  * @return	void
  */
 public static function loadAjaxImporter($view)
 {
     $ajax_import = EParameter::getComponentParam(CAUTOTWEETNG, 'ajax_import', true);
     $view->assignRef('ajax_import', $ajax_import);
     if ($ajax_import) {
         $file = EHtml::getRelativeFile('js', 'com_autotweet/import.min.js');
         if ($file) {
             $dependencies = array();
             $dependencies['import'] = array('extlycore');
             Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies);
         }
     } else {
         Extly::initApp(CAUTOTWEETNG_VERSION);
     }
 }
Example #16
0
 /**
  * sampleAutoTweetNGIntegration
  *
  * @param   int    $productId  Param
  * @param   array  &$data      Param
  *
  * Example of how to save AutoTweetNG Request
  * Copy-paste into your extension, and customize freely
  *
  * @return	void
  */
 private static function sampleAutoTweetNGIntegration($productId, &$data)
 {
     // If product is not published, nothing else to do
     if (!$data['published']) {
         return;
     }
     $typeinfo = 99;
     $native_object = json_encode($data);
     // Product Url
     $viewProductUrl = EshopRoute::getProductRoute($productId, EshopHelper::getProductCategory($productId));
     // Image Url
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->clear();
     $query->select('image')->from('#__eshop_productimages')->where('product_id = ' . intval($productId))->order('ordering');
     $db->setQuery($query);
     $product_image = $db->loadResult();
     $image_url = null;
     if ($product_image && JFile::exists(JPATH_ROOT . '/media/com_eshop/products/' . $product_image)) {
         $image_url = 'media/com_eshop/products/' . $product_image;
     }
     $langmgmt_default_language = EParameter::getComponentParam(CAUTOTWEETNG, 'langmgmt_default_language');
     if ($langmgmt_default_language) {
         $key = 'product_name_' . $langmgmt_default_language;
         if (array_key_exists($key, $data)) {
             $title = $data[$key];
         }
         $key = 'product_desc_' . $langmgmt_default_language;
         if (array_key_exists($key, $data)) {
             $description = TextUtil::cleanText($data[$key]);
         }
     }
     if (empty($title)) {
         $title = $data['product_name'];
     }
     if (empty($description)) {
         $description = TextUtil::cleanText($data['product_desc']);
     }
     if (empty($title)) {
         return;
     }
     // Saving Advanced Attributes
     $autotweet_advanced = $data['autotweet_advanced_attrs'];
     $advanced_attrs = AdvancedattrsHelper::retrieveAdvancedAttrs($autotweet_advanced);
     AdvancedattrsHelper::saveAdvancedAttrs($advanced_attrs, $productId);
     // AutotweetAPI
     $id = self::insertRequest($productId, 'autotweetpost', JFactory::getDate()->toSql(), $title, $typeinfo, $viewProductUrl, $image_url, $native_object, $advanced_attrs);
     // Adding more information to the request
     $requestsModel = F0FModel::getTmpInstance('Requests', 'AutoTweetModel');
     $request = $requestsModel->getItem($id);
     $request = (array) $request;
     $request['xtform']->set('title', $title);
     $request['xtform']->set('fulltext', $description);
     $request['xtform']->set('author', JFactory::getUser()->username);
     $requestsModel->save($request);
 }
Example #17
0
 /**
  * getApp
  *
  * @return	string
  */
 protected function getApp()
 {
     $root = JFactory::getUri()->root();
     $platform = F0FPlatform::getInstance();
     $key = $this->getAppKey();
     $file = $platform->getCache($key);
     $cached = true;
     $expiration = EParameter::getExpiration();
     if (empty($file) || !file_exists($file) || filectime($file) < $expiration) {
         $cached = false;
         $file = $this->_getOptimizedApp($this->appDependencies, $this->appPaths);
     }
     $url = $root . str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR, '', $file);
     $jsapp = '<script src="' . $root . 'media/lib_extly/js/require/require.min.js"></script>' . "\n";
     $jsapp .= '<script src="' . $url . ($this->version ? '?' . $this->version : '') . '" ></script>' . "\n";
     $jsapp .= $this->_generateRequire($key);
     $this->addPostRequireHook($jsapp);
     if (!$cached) {
         $platform->setCache($key, $file);
     }
     return $jsapp;
 }
Example #18
0
 /**
  * publishRequest
  *
  * @param   array   $request  Param
  * @param   object  $userid   Param
  *
  * @return	boolean
  */
 public function publishRequest($request, $userid = null)
 {
     $this->logger->log(JLog::INFO, 'publishRequest request', $request);
     // Default: generate new entry for repost of entry with state success
     $postid = 0;
     $data = $this->_getContentData($request);
     if (!$data) {
         return false;
     }
     // Convert array to object
     $json = json_encode($data);
     $post = json_decode($json);
     if (AUTOTWEETNG_JOOCIAL) {
         $params = AdvancedattrsHelper::getAdvancedAttrByReq($request->id);
     }
     $post->ref_id = $request->ref_id;
     $post->plugin = $request->plugin;
     $post->postdate = $request->publish_up;
     $post->message = $post->text;
     unset($post->text);
     // Url
     if (isset($post->url) && !empty($post->url)) {
         $routeHelp = RouteHelp::getInstance();
         $url = $routeHelp->getAbsoluteUrl($post->url);
         $post->url = $url;
     } elseif (isset($request->url) && !empty($request->url)) {
         $post->url = $request->url;
     } else {
         $this->logger->log(JLog::INFO, 'publishRequest: No url');
         $post->url = '';
     }
     $this->logger->log(JLog::INFO, 'publishRequest: url = ' . $post->url);
     // Image url
     if (isset($post->image_url) && !empty($post->image_url)) {
         // If defined in getExtendedData, use this image_url
         $routeHelp = RouteHelp::getInstance();
         $url = $routeHelp->getAbsoluteUrl($post->image_url);
         // Only if it's a valid Url
         if (!ImageUtil::getInstance()->isValidImageUrl($url)) {
             $url = null;
         }
         $post->image_url = $url;
     } elseif (isset($request->image_url) && !empty($request->image_url)) {
         $url = $request->image_url;
         // Only if it's a valid Url
         if (!ImageUtil::getInstance()->isValidImageUrl($url)) {
             $url = null;
         }
         // Use this image_url (it's already routed)
         $post->image_url = $url;
     } else {
         $this->logger->log(JLog::INFO, 'publishRequest: No image url');
         $post->image_url = null;
     }
     $this->logger->log(JLog::INFO, 'publishRequest: image url = ' . $post->image_url);
     // Title
     // Truncate title and fulltext for new messages ('if' is for backward compatibillity)
     if (isset($post->title)) {
         $title = TextUtil::cleanText($post->title);
         $post->title = TextUtil::truncString($title, self::MAX_CHARS_TITLE);
     } else {
         $post->title = '';
     }
     // Fulltext
     if (!isset($post->fulltext)) {
         $post->fulltext = '';
     }
     if (AUTOTWEETNG_JOOCIAL) {
         if (isset($params->fulltext) && !empty($params->fulltext)) {
             $post->fulltext = $params->fulltext;
         }
     }
     if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_mode') && ($fulltext = EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_titleonly'))) {
         $post->fulltext = $fulltext;
     }
     $fulltext = TextUtil::cleanText($post->fulltext);
     $post->fulltext = TextUtil::truncString($fulltext, self::MAX_CHARS_FULLTEXT);
     $post->xtform = new JRegistry();
     // Catids
     if (isset($post->catids)) {
         $catids = $post->catids;
         unset($post->catids);
         $post->xtform->set('catids', $catids);
     } else {
         $post->xtform->set('catids', array());
     }
     // Author
     if (isset($post->author)) {
         $author = $post->author;
         unset($post->author);
         $post->xtform->set('author', $author);
     }
     // Language
     if (isset($post->language)) {
         $language = $post->language;
         unset($post->language);
         $post->xtform->set('language', $language);
     }
     // Access
     if (isset($post->access)) {
         $access = $post->access;
         unset($post->access);
         $post->xtform->set('access', $access);
     }
     // Target_id
     if (isset($post->target_id)) {
         $target_id = $post->target_id;
         unset($post->target_id);
         $post->xtform->set('target_id', $target_id);
     }
     // Hashtags
     if (isset($post->hashtags)) {
         $hashtags = $post->hashtags;
         unset($post->hashtags);
         $post->xtform->set('hashtags', $hashtags);
     }
     // Native object
     if (isset($request->native_object)) {
         $native_object = $request->native_object;
         $native_object = json_decode($native_object);
         if ($native_object) {
             $post->xtform->set('native_object', $native_object);
         } else {
             $this->logger->log(JLog::INFO, 'publishRequest: Inavlid JSON native_object');
         }
     }
     // Featured
     if (isset($post->featured)) {
         $post->xtform->set('featured', $post->featured);
         unset($post->featured);
     }
     return $this->sendRequest($request, $post, $userid);
 }
/**
 * @package     Extly.Components
 * @subpackage  com_autotweet - A powerful social content platform to manage multiple social networks.
 *
 * @author      Prieco S.A. <*****@*****.**>
 * @copyright   Copyright (C) 2007 - 2015 Prieco, S.A. All rights reserved.
 * @license     http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @link        http://www.extly.com http://support.extly.com
 */
// No direct access
defined('_JEXEC') or die('Restricted access');
$channeltypeId = $this->input->get('channeltype_id', AutotweetModelChanneltypes::TYPE_LIOAUTH2_CHANNEL, 'cmd');
$accessTokenEncoded = htmlentities($accessToken);
$expires_date = $this->item->xtform->get('expires_date');
$expires_date = EParameter::convertUTCLocal($expires_date);
$lioauth2ChannelHelper = new LiOAuth2ChannelHelper($this->item);
$authUrl = $lioauth2ChannelHelper->getAuthorizationUrl();
if (!empty($accessTokenEncoded) && $channeltypeId == AutotweetModelChanneltypes::TYPE_LIOAUTH2COMPANY_CHANNEL) {
    ?>

<div class="control-group">
	<label class="required control-label" for="xtformlioauth2company_id" id="lioauth2company_id-lbl"><?php 
    echo JText::_('COM_AUTOTWEET_CHANNEL_LINKEDIN_COMPANY_ID');
    ?>
 <span class="star">&nbsp;*</span></label>
	<div class="controls">
		<a class="btn btn-info" id="lioauth2companyloadbutton"><?php 
    echo JText::_('COM_AUTOTWEET_VIEW_CHANNEL_LOADBUTTON_TITLE');
    ?>
</a>
Example #20
0
 /**
  * _addUtm
  *
  * @param   string  $url  Param
  *
  * @return	string
  */
 private function _addUtm($url)
 {
     if (empty($url)) {
         return $url;
     }
     $utm_source = EParameter::getComponentParam(CAUTOTWEETNG, 'utm_source');
     $utm_medium = EParameter::getComponentParam(CAUTOTWEETNG, 'utm_medium');
     $utm_term = EParameter::getComponentParam(CAUTOTWEETNG, 'utm_term');
     $utm_content = EParameter::getComponentParam(CAUTOTWEETNG, 'utm_content');
     $utm_campaign = EParameter::getComponentParam(CAUTOTWEETNG, 'utm_campaign');
     if ($utm_source || $utm_medium || $utm_term || $utm_content || $utm_campaign) {
         $uri = JUri::getInstance($url);
         if ($utm_source) {
             $uri->setVar('utm_source', $utm_source);
         }
         if ($utm_medium) {
             $uri->setVar('utm_medium', $utm_medium);
         }
         if ($utm_term) {
             $uri->setVar('utm_term', $utm_term);
         }
         if ($utm_content) {
             $uri->setVar('utm_content', $utm_content);
         }
         if ($utm_campaign) {
             $uri->setVar('utm_campaign', $utm_campaign);
         }
         $url = $uri->toString();
     }
     return $url;
 }
Example #21
0
 /**
  * _getAjaxData.
  *
  * @return	array
  */
 private function _getAjaxData()
 {
     $data = array();
     $publish_up = $this->input->get('publish_up', null, 'string');
     if (empty($publish_up)) {
         $publish_up = EParameter::convertUTCLocal(JFactory::getDate()->toSql());
     }
     $description = $this->input->get('description', null, 'string');
     if (empty($description)) {
         throw new Exception('Invalid message');
     }
     $url = $this->input->get('url', null, 'string');
     $title = $this->input->get('title', null, 'string');
     if (empty($title)) {
         $title = $description;
     }
     $data['publish_up'] = $publish_up;
     $data['plugin'] = $this->input->get('plugin', null, 'cmd');
     $data['ref_id'] = $this->input->get('ref_id', null, 'string');
     $data['description'] = $description;
     $data['url'] = $url;
     $data['image_url'] = $this->input->get('image_url', null, 'string');
     $data['published'] = $this->input->get('published', 0, 'int');
     $data['id'] = $this->input->get('id', 0, 'int');
     $xtform = array();
     $xtform['title'] = $title;
     $xtform['hashtags'] = $this->input->get('hashtags', null, 'string');
     $xtform['fulltext'] = $this->input->get('fulltext', null, 'string');
     $xtform['catid'] = $this->input->get('catid', null, 'string');
     $xtform['author'] = $this->input->get('author', null, 'string');
     $xtform['language'] = $this->input->get('language', null, 'string');
     $xtform['access'] = $this->input->get('access', null, 'string');
     $xtform['target_id'] = $this->input->get('target_id', null, 'string');
     $data['xtform'] = $xtform;
     if (AUTOTWEETNG_JOOCIAL) {
         $data['autotweet_advanced_attrs'] = $this->input->get('autotweet_advanced_attrs', null, 'string');
     }
     return $data;
 }
Example #22
0
 /**
  * sendMessage.
  *
  * @param   string  $message  Params
  * @param   object  $data     Params
  *
  * @return	booleans
  */
 public function sendMessage($message, $data)
 {
     $isUserProfile = $this->isUserProfile();
     if ($this->channel->params->get('open_graph_features') && $isUserProfile) {
         return $this->sendFacebookOG($message, $data->title, $data->fulltext, $data->url, $data->org_url, $data->image_url, $this->getMediaMode(), $data);
     }
     $title = $data->title;
     $text = $data->fulltext;
     $url = $data->url;
     $org_url = $data->org_url;
     $image_url = $data->image_url;
     $media_mode = $this->getMediaMode();
     $logger = AutotweetLogger::getInstance();
     $logger->log(JLog::INFO, 'sendFacebookMessage', $message);
     $fb_id = $this->getFbChannelId();
     $fb_token = $this->get('fbchannel_access_token');
     // Includes a workaround for Facebook ?ref=nf url extension problem and short urls
     // if API bug is fixed, replace all org_url variables by url
     $result = null;
     // Post message and/or attachment
     switch ($media_mode) {
         case 'attachment':
             $post_attach = true;
             $post_msg = false;
             break;
         case 'both':
             $post_msg = true;
             $post_attach = true;
             break;
         case 'message':
         default:
             $post_msg = true;
             $post_attach = false;
     }
     if (empty($org_url)) {
         $post_attach = false;
     }
     if (empty($text) && empty($image_url)) {
         $post_attach = false;
     }
     // Attachment: do also not post when text and image are empty
     if ($post_attach) {
         // Extract data for action link
         $url_comps = parse_url($org_url);
         $actionlink_text = $url_comps['host'];
         $actions = array();
         $actions['name'] = $actionlink_text;
         $actions['link'] = $org_url;
         $status_type = array('value' => 'wall_post');
         $title = TextUtil::truncString($title, self::MAX_CHARS_NAME);
         $arguments = array('link' => $org_url, 'name' => $title, 'caption' => $actionlink_text, 'description' => $text, 'actions' => json_encode($actions), 'access_token' => $fb_token, 'status_type' => json_encode($status_type));
         if ($isUserProfile) {
             $privacy = $this->get('sharedwith', 'EVERYONE');
             $privacy = array('value' => $privacy);
             $arguments['privacy'] = json_encode($privacy);
         }
         // Include image tag only, when image url is not empty to avoid error "... must have a valid src..."
         if (!empty($image_url)) {
             $arguments['picture'] = $image_url;
         }
         // Message
         if ($post_msg) {
             $arguments['message'] = $message;
         }
     } else {
         $arguments = array('message' => $message, 'access_token' => $fb_token);
     }
     $target_id = $data->xtform->get('target_id');
     if (EParameter::getComponentParam(CAUTOTWEETNG, 'targeting', false) && $target_id) {
         $this->addTargetArguments($arguments, $target_id);
     }
     try {
         $fbapi = $this->getApiInstance();
         // Simulated
         if ($this->channel->params->get('use_own_api') == 0) {
             $fbapi->api("/me/permissions");
             $result = array(true, JText::_('COM_AUTOTWEET_VIEW_SIMULATED_OK'));
         } else {
             $result = $fbapi->api("/{$fb_id}/feed", 'post', $arguments);
             $msg = 'Facebook id: ' . $result['id'];
             $result = array(true, $msg);
         }
     } catch (Exception $e) {
         $code = $e->getCode();
         $msg = $code . ' - ' . $e->getMessage();
         $donot_fberror02 = EParameter::getComponentParam(CAUTOTWEETNG, 'donot_fberror02', 0);
         $donottrack_error = $donot_fberror02 && ($code == 0 || $code == 2);
         if ($donottrack_error) {
             $logger = AutotweetLogger::getInstance();
             $logger->log(JLog::ERROR, 'DONOT_FBERROR02: ' . $msg);
             $result = array(true, $msg);
         } else {
             $result = array(false, $msg);
         }
     }
     return $result;
 }
Example #23
0
 /**
  * This method runs before the $data is saved to the $table. Return false to
  * stop saving.
  *
  * @param   array   &$data   Param
  * @param   JTable  &$table  Param
  *
  * @return bool
  */
 protected function onBeforeSave(&$data, &$table)
 {
     $data['params'] = EForm::paramsToString($data);
     $data['postdate'] = EParameter::convertLocalUTC($data['postdate']);
     // Cleaning annoying spaces
     $data = array_map('trim', $data);
     return parent::onBeforeSave($data, $table);
 }
Example #24
0
 /**
  * renderRouting
  *
  * @return  string  HTML
  */
 public static function renderRoutingTags()
 {
     $formToken = JFactory::getSession()->getFormToken();
     $input = new F0FInput();
     $Itemid = $input->getInt('Itemid', 0);
     $lang = EParameter::getLanguageSef();
     $output = array();
     if ($formToken) {
         $output[] = '<input type="hidden" id="XTtoken" name="' . $formToken . '" value="1" />';
     }
     if ($Itemid) {
         $output[] = '<input type="hidden" id="XTItemid" name="Itemid" value="' . $Itemid . '" />';
     }
     if ($lang) {
         $output[] = '<input type="hidden" id="XTlang" name="lang" value="' . $lang . '" />';
     }
     return implode("\n", $output);
 }
Example #25
0
 /**
  * adminNotification
  *
  * @param   string  $channel  Param
  * @param   string  $msg      Param
  * @param   object  &$post    Param
  *
  * @return	boolean
  */
 public static function adminNotification($channel, $msg, &$post)
 {
     if (!EParameter::getComponentParam(CAUTOTWEETNG, 'admin_notification', 0)) {
         return;
     }
     JLoader::import('extly.mail.notification');
     $postmsg = print_r($post, true);
     $emailSubject = 'AutoTweetNG Notification - Error on Channel "' . $channel . '"';
     $emailBody = "<h2>Hi,</h2>\n\t\t<p>This is an <b>AutoTweetNG</b> Notification, about an error on channel \"{$channel}\".</p>\n\t\t<h3>Error Message</h3>\n\t\t<p>{$msg}</p>\n\t\t<h3>Post details</h3>\n\t\t<p>{$postmsg}</p>\n\t\t<p>If you are working in the configuration, it must be related with your work. However, if the site is stable, you should check if there's any problem (E.g. an expired token).</p>\n\t\t<p><br></p>\n\t\t<p>If you have any question, the support team is ready to answer!</p>\n\t\t<p>Best regards,</p>\n\t\t<p>Support Team<br> <b>Extly.com</b> - Extensions<br> Support: <a target=\"_blank\" href=\"http://support.extly.com\">http://support.extly.com</a><br> Twitter @extly | Facebook <a target=\"_blank\" href=\"http://www.facebook.com/extly\">www.facebook.com/extly</a></p>";
     Notification::mailToAdmin($emailSubject, $emailBody);
 }
Example #26
0
 /**
  * This method runs before the $data is saved to the $table. Return false to
  * stop saving.
  *
  * @param   array   &$data   Param
  * @param   JTable  &$table  Param
  *
  * @return bool
  */
 protected function onBeforeSave(&$data, &$table)
 {
     $data['params'] = EForm::paramsToString($data);
     if (array_key_exists('publish_up', $data)) {
         $data['publish_up'] = EParameter::convertLocalUTC($data['publish_up']);
     } else {
         $data['publish_up'] = JFactory::getDate()->toSql();
     }
     // Cleaning annoying spaces
     $data = array_map('trim', $data);
     if (array_key_exists('autotweet_advanced_attrs', $data)) {
         $this->advanced_attrs = AdvancedattrsHelper::retrieveAdvancedAttrs($data['autotweet_advanced_attrs']);
     }
     return parent::onBeforeSave($data, $table);
 }
Example #27
0
							<label class="control-label" for="show_url" id="show_url-lbl" rel="tooltip" data-original-title="<?php 
echo JText::_('COM_AUTOTWEET_VIEW_CHANNEL_SHOWURL_DESC');
?>
"><?php 
echo JText::_('COM_AUTOTWEET_VIEW_SHOWURL_TITLE');
?>
</label>
							<div class="controls inline">
								<?php 
echo SelectControlHelper::showurl($this->item->xtform->get('show_url'), 'xtform[show_url]');
?>
							</div>
						</div>

						<?php 
if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'targeting', false)) {
    ?>
			            <hr/>

			            <div class="control-group">
			              <label class="control-label" for="xtformtarget_id" id="target_id-lbl"><?php 
    echo JText::_('COM_AUTOTWEET_VIEW_FBWACCOUNT_TARGETING_TITLE');
    ?>
</label>
			              <div class="controls">
			                <?php 
    echo SelectControlHelper::targets($this->item->xtform->get('target_id'), 'xtform[target_id]', null);
    ?>
			              </div>
			            </div>
Example #28
0
 /**
  * queueMessage
  *
  * @param   string  $articleid         Param
  * @param   string  $source_plugin     Param
  * @param   string  $publish_up        Param
  * @param   string  $description       Param
  * @param   string  $typeinfo          Param
  * @param   string  $url               Param
  * @param   string  $image_url         Param
  * @param   object  &$native_object    Param
  * @param   string  &$advanced_attrs   Param
  * @param   string  &$params           Param
  * @param   string  $content_language  Param
  *
  * @return	mixed - false, or id of request
  */
 public static function insertRequest($articleid, $source_plugin, $publish_up, $description, $typeinfo = 0, $url = '', $image_url = '', &$native_object = null, &$advanced_attrs = null, &$params = null, $content_language = null)
 {
     $logger = AutotweetLogger::getInstance();
     // Check if message is already queued (it makes no sense to queue message more than once when modfied)
     // if message is already queued, correct the publish date
     $requestsModel = F0FModel::getTmpInstance('Requests', 'AutoTweetModel');
     $requestsModel->set('ref_id', $articleid);
     $requestsModel->set('plugin', $source_plugin);
     $requestsModel->set('typeinfo', $typeinfo);
     $row = $requestsModel->getFirstItem();
     $id = $row->id;
     // Avoid databse warnings when desc is longer then expected
     if (!empty($description)) {
         $description = TextUtil::cleanText($description);
         $description = JString::substr($description, 0, SharingHelper::MAX_CHARS_TITLE);
     }
     $routeHelp = RouteHelp::getInstance();
     if ($content_language) {
         $routeHelp->setContentLanguage($content_language);
     }
     if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_mode') && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_donot_post_url')) {
         $url = 'index.php';
     }
     $url = $routeHelp->getAbsoluteUrl($url);
     if (AUTOTWEETNG_JOOCIAL && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_mode') && EParameter::getComponentParam(CAUTOTWEETNG, 'paywall_donot_image_url')) {
         $image_url = null;
     }
     if (empty($image_url)) {
         // Default image: used in media mode when no image is available
         $image_url = EParameter::getComponentParam(CAUTOTWEETNG, 'default_image', '');
     }
     if (!empty($image_url)) {
         $image_url = $routeHelp->getAbsoluteUrl($image_url, true);
     }
     $row->reset();
     if ($id) {
         $row->load($id);
     }
     // If there's no date, it means now
     if (empty($publish_up)) {
         $publish_up = JFactory::getDate()->toSql();
     }
     $request = array('id' => $id, 'ref_id' => $articleid, 'plugin' => $source_plugin, 'publish_up' => $publish_up, 'description' => $description, 'typeinfo' => $typeinfo, 'url' => $url, 'image_url' => $image_url, 'native_object' => $native_object, 'params' => $params, 'published' => 0);
     $logger->log(JLog::INFO, 'Enqueued request', $request);
     // Saving the request
     $queued = $row->save($request);
     if (!$queued) {
         $logger->log(JLog::ERROR, 'queueMessage: error storing message to database message queue, article id = ' . $articleid . ', error message = ' . $row->getError());
     } else {
         $logger->log(JLog::INFO, 'queueMessage: message stored/updated to database message queue, article id = ' . $articleid);
     }
     if (!$id) {
         $id = $row->id;
     }
     if ($advanced_attrs && isset($advanced_attrs->attr_id)) {
         $row = F0FModel::getTmpInstance('Advancedattrs', 'AutoTweetModel')->getTable();
         $row->reset();
         $row->load($advanced_attrs->attr_id);
         $attr = array('id' => $advanced_attrs->attr_id, 'request_id' => $id);
         // Updating attr
         $result = $row->save($attr);
         if (!$result) {
             $logger->log(JLog::ERROR, 'Updating attr, attr_id = ' . $advanced_attrs->attr_id . ', error message = ' . $row->getError());
         } else {
             $logger->log(JLog::INFO, 'Updating attr, attr_id = ' . $advanced_attrs->attr_id);
         }
     }
     $app = JFactory::getApplication();
     if ($app->isAdmin() && JFactory::getConfig()->get('show_req_notification', true)) {
         $msg = VersionHelper::getFlavourName() . ': ' . JText::sprintf('COM_AUTOTWEET_REQUEST_ENQUEUED_MSG', $id);
         $app->enqueueMessage($msg);
     }
     return $queued ? $id : false;
 }
Example #29
0
 /**
  * _sendTwitterMessageWithImage
  *
  * @param   string  $status_msg  Param
  * @param   string  $imagefile   Param
  *
  * @return	array
  */
 private function _sendTwitterMessageWithImage($status_msg, $imagefile)
 {
     $logger = AutotweetLogger::getInstance();
     $logger->log(JLog::INFO, '_sendTwitterMessageWithImage: ' . $status_msg . ' - ' . $imagefile);
     $api = $this->getApiInstance();
     if ($imagefile) {
         $basename = basename($imagefile);
         list($width, $height, $type, $attr) = getimagesize($imagefile);
         $mimetype = image_type_to_mime_type($type);
         $binaryimage_load = EParameter::getComponentParam(CAUTOTWEETNG, 'binaryimage_load');
         if ($binaryimage_load) {
             $handle = fopen($imagefile, "rb");
             $postimage = fread($handle, filesize($imagefile));
             fclose($handle);
         } else {
             $postimage = '@' . $imagefile;
         }
         $code = $api->request('POST', $api->url('1.1/statuses/update_with_media'), array('media[]' => "{$postimage};type={$mimetype};filename={$basename}", 'status' => $status_msg), true, true);
     } else {
         $code = $api->request('POST', $api->url('1.1/statuses/update'), array('status' => $status_msg));
     }
     return $this->_processResponse($code, $api);
 }
Example #30
0
 /**
  * loadINI
  *
  * @return	bool
  */
 protected static function loadINI()
 {
     if (self::$_compinfo && self::$_pluginfo) {
         return true;
     }
     self::$_compinfo = array();
     self::$_pluginfo = array();
     self::$_thirdparty = array();
     // Get component parameter
     $version_check = EParameter::getComponentParam(CAUTOTWEETNG, 'version_check', 1);
     $remoteFile = self::SERVER_INI_PATH . self::SERVER_INI_FILE;
     $localFile = JPATH_AUTOTWEET_HELPERS . '/' . self::SERVER_INI_FILE;
     $file = $localFile;
     if ($version_check) {
         try {
             $ch = curl_init($remoteFile);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::CXN_TIMEOUT);
             curl_setopt($ch, CURLOPT_TIMEOUT, self::EXEC_TIMEOUT);
             $data = curl_exec($ch);
             curl_close($ch);
             file_put_contents($localFile, $data);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             $logger->log(JLog::ERROR, 'AutoTweetNG - ' . $msg);
         }
     }
     jimport('joomla.error.error');
     jimport('joomla.registry.registry');
     $registry = new JRegistry();
     if (!$registry->loadFile($file, 'INI', array('processSections' => 'true'))) {
         $logger->log(JLog::ERROR, 'AutoTweetNG - error reading INI file ' . $file);
         return false;
     }
     // Init logging
     $logger = AutotweetLogger::getInstance();
     $db = JFactory::getDBO();
     // Get component info and remove from array
     $data = JApplicationHelper::parseXMLInstallFile(JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . self::COMP_INSTALL_FILE);
     self::$_compinfo = array('id' => $registry->get('component.id'), 'name' => $registry->get('component.name'), 'server_version' => $registry->get('component.version'), 'client_version' => $data['version'], 'home' => $registry->get('component.home'), 'faq' => $registry->get('component.faq'), 'download' => $registry->get('component.download'), 'support' => $registry->get('component.support'), 'products' => $registry->get('component.products'), 'twitter' => $registry->get('component.twitter'), 'jed' => $registry->get('component.jed'), 'message' => $registry->get('component.message'), 'news' => $registry->get('component.news'));
     $extensions = TextUtil::listToArray($registry->get('component.extensions'));
     foreach ($extensions as $extension) {
         $state = self::EXT_NOTINSTALLED;
         $config = '';
         $client_version = '';
         $type = $registry->get($extension . '.type');
         $id = $registry->get($extension . '.id');
         $source = $registry->get($extension . '.source');
         if ('module' == $type) {
             $mod_filename = 'mod_' . $id;
             // Get the module id and set url for config
             $pluginsModel = F0FModel::getTmpInstance('Extensions', 'ExtlyModel');
             $pluginsModel->savestate(false)->setState('element', $mod_filename);
             $rows = $pluginsModel->getItemList();
             if (!empty($rows)) {
                 $row = $rows[0];
                 if ($row->client_id) {
                     $path = JPATH_ADMINISTRATOR . '/modules/' . $mod_filename . DIRECTORY_SEPARATOR . $mod_filename . '.xml';
                 } else {
                     $path = JPATH_ROOT . '/modules/' . $mod_filename . DIRECTORY_SEPARATOR . $mod_filename . '.xml';
                 }
                 $data = JApplicationHelper::parseXMLInstallFile($path);
                 $client_version = $data['version'];
                 if (self::_isEnabled($mod_filename)) {
                     $state = self::EXT_ENABLED;
                 } else {
                     $state = self::EXT_DISABLED;
                 }
                 // $config = 'index.php?option=com_modules&task=module.edit&id=' . $row->extension_id;
             }
         } else {
             // Get the plugin id and set url for config
             $pluginsModel = F0FModel::getTmpInstance('Plugins', 'AutoTweetModel');
             $pluginsModel->savestate(false)->set('element_id', $id);
             $rows = $pluginsModel->getItemList();
             if (!empty($rows)) {
                 $row = $rows[0];
                 $path = JPATH_PLUGINS . DIRECTORY_SEPARATOR . $row->folder . DIRECTORY_SEPARATOR . $row->element . DIRECTORY_SEPARATOR . $row->element . '.xml';
                 $data = JApplicationHelper::parseXMLInstallFile($path);
                 $client_version = $data['version'];
                 if (JPluginHelper::isEnabled($row->folder, $row->element)) {
                     $state = self::EXT_ENABLED;
                 } else {
                     $state = self::EXT_DISABLED;
                 }
                 $config = 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . $row->id;
             }
         }
         // Append plugin state to result arrays
         if (self::FM_EXT_SOURCE == $source) {
             self::$_pluginfo[] = array('id' => $id, 'name' => $registry->get($extension . '.name'), 'state' => $state, 'client_version' => $client_version, 'server_version' => $registry->get($extension . '.version'), 'message' => $registry->get($extension . '.message'), 'config' => $config);
         } else {
             self::$_thirdparty[] = array('id' => $id, 'name' => $registry->get($extension . '.name'), 'state' => $state, 'client_version' => $client_version, 'message' => $registry->get($extension . '.message'), 'config' => $config, 'source' => $source, 'download' => $registry->get($extension . '.download'));
         }
     }
     // Add installed plugins without entry in ini file to 3rd party list
     $pluginsModel = F0FModel::getTmpInstance('Plugins', 'AutoTweetModel');
     $pluginsModel->savestate(false);
     $plugins = $pluginsModel->getItemList();
     foreach ($plugins as $plugin) {
         $id = $plugin->element;
         $type = $plugin->folder;
         if (!self::in_array_recursive($id, self::$_pluginfo) && !self::in_array_recursive($id, self::$_thirdparty)) {
             $path = JPATH_PLUGINS . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . $id . '.xml';
             $data = JApplicationHelper::parseXMLInstallFile($path);
             $client_version = $data['version'];
             if (JPluginHelper::isEnabled($type, $id)) {
                 $state = self::EXT_ENABLED;
             } else {
                 $state = self::EXT_DISABLED;
             }
             $config = 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . $plugin->id;
             if (!empty($data['authorUrl'])) {
                 $source = $data['authorUrl'];
                 $download = $data['authorUrl'];
             } else {
                 $source = self::EXT_UNKNOWN;
                 $download = '';
             }
             self::$_thirdparty[] = array('id' => $id, 'name' => $plugin->name, 'state' => $state, 'client_version' => $client_version, 'message' => 'unknown extension plugin', 'config' => $config, 'source' => $source, 'download' => $download);
         }
     }
     return true;
 }