Ejemplo n.º 1
0
 public function joomla()
 {
     $this->setHeading('COM_EASYBLOG_MIGRATOR_JOOMLA', '', 'fa-joomla');
     $categories[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_CATEGORY') . ' -');
     $authors[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_AUTHOR') . ' -', 'created_by', 'name');
     $lists['sectionid'] = array();
     $articleCat = JHtml::_('category.options', 'com_content');
     $articleAuthors = $this->get('ArticleAuthors16');
     $categories = array_merge($categories, $articleCat);
     $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catId', 'class="form-control" data-migrate-article-category', 'value', 'text', '');
     $authors = array_merge($authors, $articleAuthors);
     $lists['authorid'] = JHTML::_('select.genericlist', $authors, 'authorId', 'class="form-control" data-migrate-article-author', 'created_by', 'name', 0);
     // state filter
     $state = $this->getDefaultState();
     $articleState = array();
     foreach ($state as $key => $val) {
         $obj = new stdClass();
         $obj->state = $val;
         $obj->value = $key;
         $articleState[] = $obj;
     }
     $stateList = array();
     $stateList[] = JHTML::_('select.option', '*', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_STATE') . ' -', 'value', 'state');
     $stateList = array_merge($stateList, $articleState);
     $lists['state'] = JHTML::_('select.genericlist', $stateList, 'stateId', 'class="form-control" data-migrate-article-state', 'value', 'state', '*');
     $jomcommentInstalled = $this->jomcommentExists();
     //check if myblog installed or not.
     $myblogInstalled = $this->myBlogExists();
     $myBlogSection = '';
     if ($myblogInstalled) {
         require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_myblog' . DIRECTORY_SEPARATOR . 'config.myblog.php';
         $myblogConfig = new MYBLOG_Config();
         $myBlogSection = $myblogConfig->get('postSection');
     }
     $ebCategories = $this->getEasyBlogCategories();
     $theme = EB::template();
     $theme->set('myBlogSection', $myBlogSection);
     $theme->set('jomcommentInstalled', $jomcommentInstalled);
     $theme->set('lists', $lists);
     $theme->set('ebCategories', $ebCategories);
     $output = $theme->output('admin/migrators/adapters/article');
     return $output;
     // parent::display('migrators/adapters/article');
 }
Ejemplo n.º 2
0
 function getMyBlog(&$xmap, &$parent, &$params)
 {
     if (defined('JPATH_SITE')) {
         $database =& JFactory::getDBO();
         $mosConfig_absolute_path = JPATH_SITE;
         $my =& JFactory::getUser();
     } else {
         global $database, $mosConfig_absolute_path, $my;
     }
     $my_id = $parent->id;
     require_once $mosConfig_absolute_path . '/components/com_myblog/functions.myblog.php';
     require_once $mosConfig_absolute_path . '/administrator/components/com_myblog/config.myblog.php';
     $_MY_CONFIG = new MYBLOG_Config();
     $managed_sections = $_MY_CONFIG->get('managedSections');
     // include popular bloggers by default
     $query = "SELECT created_by, sum(hits) AS hits from #__content  WHERE sectionid IN (" . $managed_sections . ") AND state=1 group by created_by order by hits desc";
     if ($params['number_of_bloggers']) {
         $query .= " limit 0, " . $params['number_of_bloggers'];
     }
     $database->setQuery($query);
     $rows = $database->loadObjectList();
     $modified = time();
     $xmap->changeLevel(1);
     $node = new stdclass();
     $node->browserNav = $parent->browserNav;
     $node->id = $parent->id;
     $node->uid = $parent->uid . 'b';
     $node->priority = $params['blogger_priority'];
     $node->changefreq = $params['blogger_changefreq'];
     $node->name = $params["text_bloggers"];
     $node->link = "index.php?option=com_myblog&task=blogs";
     $node->modified = time();
     $node->expandible = true;
     $xmap->printNode($node);
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $database->setQuery("SELECT username FROM #__users WHERE id='{$row->created_by}'");
         $username = $database->loadResult();
         if ($username) {
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'b' . $node->username;
             $node->priority = $params['blogger_priority'];
             $node->changefreq = $params['blogger_changefreq'];
             $node->browserNav = $parent->browserNav;
             $node->name = $username;
             $node->modified = $modified;
             $node->link = "index.php?option=com_myblog&blogger=" . $node->name;
             $node->expandible = true;
             $xmap->printNode($node);
             if ($params['include_blogger_posts']) {
                 $sql = "SELECT id, title, created_by, modified from #__content where created_by=" . $row->created_by . " and sectionid in (" . $managed_sections . ") and\r\nstate=1 order by modified desc";
                 if ($params['number_of_post_per_blogger']) {
                     $sql .= " limit 0, " . $params['number_of_post_per_blogger'];
                 }
                 $res = $database->SetQuery($sql);
                 $posts = $database->loadObjectList();
                 $xmap->changeLevel(1);
                 foreach ($posts as $post) {
                     $permalink = xmap_com_myblog::GetPermalink($post->id);
                     $node = new stdclass();
                     $node->id = $post->id;
                     $node->uid = $parent->uid . 'p' . $post->id;
                     $node->priority = $params['entry_priority'];
                     $node->changefreq = $params['entry_changefreq'];
                     $node->browserNav = $parent->browserNav;
                     $node->modified = intval($post->modified);
                     $node->name = $post->title;
                     $node->link = "index.php?option=com_myblog&show=" . $permalink . "&Itemid=" . $my_id;
                     $node->expandible = false;
                     $xmap->printNode($node);
                 }
                 $xmap->changeLevel(-1);
             }
         }
     }
     $xmap->changeLevel(-2);
     // retrieve tag clouds
     if ($params['include_tag_clouds']) {
         $node = new stdclass();
         $node->browserNav = $parent->browserNav;
         $node->id = $parent->id;
         $node->uid = $parent->uid . 't';
         $node->priority = $params['cats_priority'];
         $node->changefreq = $params['cats_changefreq'];
         $node->name = "Tag Clouds";
         $node->link = "index.php?option=com_myblog&task=categories";
         $node->expandible = true;
         $xmap->printNode($node);
         // http://archive/index.php?option=com_myblog&category=sports&Itemid=8
         $query = "SELECT * from #__myblog_categories";
         $database->setQuery($query);
         $tagrows = $database->loadObjectList();
         $tag_clouds = array();
         $j = count($tagrows);
         $i = 0;
         $xmap->changeLevel(1);
         while ($i < $j) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 't' . $tagrows[$i]->name;
             $node->priority = $params['tag_priority'];
             $node->changefreq = $params['tag_changefreq'];
             $node->browserNav = $parent->browserNav;
             $node->name = $tagrows[$i]->name;
             $node->modified = $modified;
             $node->link = "index.php?option=com_myblog&category=" . $node->name;
             $node->expandible = false;
             $xmap->printNode($node);
             if ($params['include_feed']) {
                 $node = new stdclass();
                 $node->id = $parent->id;
                 $node->uid = $parent->uid . 'f' . $tagrows[$i]->name;
                 $node->priority = $params['feed_priority'];
                 $node->changefreq = $params['feed_changefreq'];
                 $node->browserNav = $parent->browserNav;
                 $node->name = $tagrows[$i]->name . ' Feed';
                 $node->modified = $modified;
                 $node->link = "index.php?option=com_myblog&category=" . $tagrows[$i]->name . "&task=rss";
                 $xmap->printNode($node);
             }
             $i++;
         }
         $xmap->changeLevel(-1);
     }
     // time to retrieve archives now
     if ($params['include_archives']) {
         $query = 'SELECT DISTINCT (date_format(jc.created,"%M-%Y")) as archive FROM #__content as jc WHERE jc.sectionid IN(' . $managed_sections . ') and state = 1 ORDER BY jc.created DESC';
         $database->setQuery($query);
         $objList = $database->loadObjectList();
         foreach ($objList as $obj) {
             $node = new stdclass();
             $node->browserNav = $parent->browserNav;
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'a' . $obj->archive;
             $node->priority = $params['arc_priority'];
             $node->changefreq = $params['arc_changefreq'];
             $node->name = $obj->archive;
             $node->link = "index.php?option=com_myblog&archive=" . $obj->archive;
             $node->expandible = false;
             $xmap->printNode($node);
         }
     }
     if ($params['include_feed']) {
         $node = new stdclass();
         $node->browserNav = $parent->browserNav;
         $node->id = $parent->id;
         $node->uid = $parent->uid . 'f';
         $node->priority = $params['feed_priority'];
         $node->changefreq = $params['feed_changefreq'];
         $node->name = 'Feed';
         $node->link = "index.php?option=com_myblog&task=rss";
         $node->modified = time();
         $node->expandible = false;
         $xmap->printNode($node);
     }
 }
Ejemplo n.º 3
0
 function migrateArticle($params)
 {
     $post = EasyBlogStringHelper::ejaxPostToArray($params);
     if (isset($post['com_type'])) {
         $migrateStat = new stdClass();
         $migrateStat->blog = 0;
         $migrateStat->category = 0;
         $migrateStat->comments = 0;
         $migrateStat->images = 0;
         $migrateStat->user = array();
         $jSession = JFactory::getSession();
         $jSession->set('EBLOG_MIGRATOR_JOOMLA_STAT', $migrateStat, 'EASYBLOG');
         $com_type = $post['com_type'];
         switch ($com_type) {
             case 'com_blog':
                 $migrateComment = isset($post['smartblog_comment']) ? $post['smartblog_comment'] : '0';
                 $migrateImage = isset($post['smartblog_image']) ? $post['smartblog_image'] : '0';
                 $imagePath = isset($post['smartblog_imagepath']) ? $post['smartblog_imagepath'] : '';
                 $this->_processSmartBlog($migrateComment, $migrateImage, $imagePath);
                 break;
             case 'com_content':
                 $authorId = isset($post['authorId']) ? $post['authorId'] : '0';
                 $stateId = isset($post['stateId']) ? $post['stateId'] : '*';
                 $catId = isset($post['catId']) ? $post['catId'] : '0';
                 $sectionId = isset($post['sectionId']) ? $post['sectionId'] : '-1';
                 $start = 1;
                 $myblogSection = isset($post['$myblogSection']) ? $post['$myblogSection'] : '';
                 $jomcomment = isset($post['content-jomcomment']) ? true : false;
                 $this->_process($authorId, $stateId, $catId, $sectionId, $myblogSection, $jomcomment);
                 break;
             case 'com_lyftenbloggie':
                 //migrate lyftenbloggie tags
                 $migrateComment = isset($post['lyften_comment']) ? $post['lyften_comment'] : '0';
                 $this->_migrateLyftenTags();
                 $this->_processLyftenBloggie($migrateComment);
                 break;
             case 'com_myblog':
                 require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_myblog' . DIRECTORY_SEPARATOR . 'config.myblog.php';
                 $myblogConfig = new MYBLOG_Config();
                 $myBlogSection = $myblogConfig->get('postSection');
                 $jomcomment = isset($post['myblog-jomcomment']) ? true : false;
                 $this->_processMyBlog($myBlogSection, $jomcomment);
                 break;
             case 'com_wordpress':
                 $wpBlogId = isset($post['wpBlogId']) ? $post['wpBlogId'] : '-1';
                 $this->_processWordPress($wpBlogId);
                 break;
             case 'xml_wordpress':
                 $fileName = $post['wpxmlfiles'];
                 $authorId = $post['authorid'];
                 $this->_processWordPressXML($fileName, $authorId);
                 break;
             case 'xml_blogger':
                 $fileName = $post['bloggerxmlfiles'];
                 $authorId = $post['authorid'];
                 $categoryId = $post['categoryid'];
                 $this->_processBloggerXML($fileName, $authorId, $categoryId);
                 break;
             default:
                 break;
         }
     }
 }
Ejemplo n.º 4
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.migrator', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     //check if myblog installed or not.
     $myblogInstalled = $this->myBlogExists();
     $myBlogSection = '';
     if ($myblogInstalled) {
         require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_myblog' . DIRECTORY_SEPARATOR . 'config.myblog.php';
         $myblogConfig = new MYBLOG_Config();
         $myBlogSection = $myblogConfig->get('postSection');
     }
     JHTML::_('behavior.tooltip');
     $categories[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_CATEGORY') . ' -');
     $authors[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_AUTHOR') . ' -', 'created_by', 'name');
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $lists['sectionid'] = array();
         $articleCat = JHtml::_('category.options', 'com_content');
         $articleAuthors = $this->get('ArticleAuthors16');
     } else {
         // get list of sections for dropdown filter
         $lists['sectionid'] = $this->section($myBlogSection, 'sectionId', -1, '');
         // get article categories from model
         $model = $this->getModel('Migrators');
         $articleCat = $model->getArticleCategories($myBlogSection);
         // get article authors from model
         $articleAuthors = $this->get('ArticleAuthors');
     }
     $categories = array_merge($categories, $articleCat);
     $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catId', 'class="inputbox"', 'value', 'text', '');
     $authors = array_merge($authors, $articleAuthors);
     $lists['authorid'] = JHTML::_('select.genericlist', $authors, 'authorId', 'class="inputbox"', 'created_by', 'name', 0);
     // state filter
     $state = $this->getDefaultState();
     //$state			= array('P' => 'Published', 'U' => 'Unpublished', 'A' => 'Archived');
     $articleState = array();
     foreach ($state as $key => $val) {
         $obj = new stdClass();
         $obj->state = $val;
         $obj->value = $key;
         $articleState[] = $obj;
     }
     $stateList = array();
     $stateList[] = JHTML::_('select.option', '*', '- ' . JText::_('COM_EASYBLOG_MIGRATORS_SELECT_STATE') . ' -', 'value', 'state');
     $stateList = array_merge($stateList, $articleState);
     $lists['state'] = JHTML::_('select.genericlist', $stateList, 'stateId', 'class="inputbox"', 'value', 'state', '*');
     //check if wordpress installed or not.
     $lists['wpblogs'] = array();
     $wpInstalled = $this->wpExists();
     $wpBlogsList = '';
     if ($wpInstalled) {
         $wpBlogsList = $this->getWPBlogs();
         $lists['wpblogs'] = JHTML::_('select.genericlist', $wpBlogsList, 'wpBlogId', 'class="inputbox"', 'value', 'state', '');
     }
     // Fetch K2 categories
     $lists['k2cats'] = $this->getK2Categories();
     // get wp xml files
     $wpxmlfiles = $this->getXMLFiles('wordpress');
     $lists['wpxmlfiles'] = JHTML::_('select.genericlist', $wpxmlfiles, 'wpxmlfiles', 'class="inputbox"', 'value', 'state', '');
     $bloggerxmlfiles = $this->getXMLFiles('blogger');
     $lists['bloggerxmlfiles'] = JHTML::_('select.genericlist', $bloggerxmlfiles, 'bloggerxmlfiles', 'class="inputbox"', 'value', 'state', '');
     $smartblogInstalled = $this->smartBlogExists();
     $lyftenbloggieInstalled = $this->lyftenBloggieExists();
     $jomcommentInstalled = $this->jomcommentExists();
     $this->assignRef('smartblogInstalled', $smartblogInstalled);
     $this->assignRef('lyftenbloggieInstalled', $lyftenbloggieInstalled);
     $this->assignRef('jomcommentInstalled', $jomcommentInstalled);
     $this->assignRef('myblogInstalled', $myblogInstalled);
     $this->assignRef('myBlogSection', $myBlogSection);
     $this->assignRef('wpInstalled', $wpInstalled);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }