public static function showImport()
 {
     $sources = JCommentsMigrationTool::getSources();
     HTML_JCommentsMigrationTool::showImport($sources);
 }
 function doImport()
 {
     $vars = JCommentsInput::getVar('vars', array());
     $source = trim(strtolower($vars['import']));
     $cnt = 0;
     if ($source != '' && $source != 'com_jcomments') {
         JCommentsMigrationTool::deleteCommentsBySource($source);
         $language = JCommentsInput::getVar($source . '_lang', '');
         switch ($source) {
             case 'akocomment':
                 JCommentsMigrationTool::importAkoComment($source, $language);
                 break;
             case 'moscom':
                 JCommentsMigrationTool::importMosCom($source, $language);
                 break;
             case 'combomax':
                 JCommentsMigrationTool::importComboMax($source, $language);
                 break;
             case 'joomlacomment':
                 JCommentsMigrationTool::importJoomlaComment($source, $language);
                 break;
             case 'jomcomment':
                 JCommentsMigrationTool::importJomComment($source, $language);
                 break;
             case 'urcomment':
                 JCommentsMigrationTool::importUrComment($source, $language);
                 break;
             case 'datsogallery':
                 JCommentsMigrationTool::importDatsoGalleryComment($source, $language);
                 break;
             case 'joomgallery':
                 JCommentsMigrationTool::importJoomGalleryComment($source, $language);
                 break;
             case 'icegallery':
                 JCommentsMigrationTool::importIceGalleryComment($source, $language);
                 break;
             case 'remository':
                 JCommentsMigrationTool::importRemositoryComment($source, $language);
                 break;
             case 'paxxgallery':
                 JCommentsMigrationTool::importPAXXGalleryComment($source, $language);
                 break;
             case 'phocagallery':
                 JCommentsMigrationTool::importPhocaGalleryComment($source, $language);
                 break;
             case 'cinema':
                 JCommentsMigrationTool::importCinemaComment($source, $language);
                 break;
             case 'jmovies':
                 JCommentsMigrationTool::importJMoviesComment($source, $language);
                 break;
             case 'mosetstree':
                 JCommentsMigrationTool::importMosetsTree($source, $language);
                 break;
             case 'linkdirectory':
                 JCommentsMigrationTool::importLinkDirectory($source, $language);
                 break;
             case 'mxcomment':
                 JCommentsMigrationTool::importmXcomment($source, $language);
                 break;
             case 'zoommediagallery':
                 JCommentsMigrationTool::importZoom($source, $language);
                 break;
             case 'rsgallery2':
                 JCommentsMigrationTool::importRSGallery2($source, $language);
                 break;
             case 'hotornot2':
                 JCommentsMigrationTool::importHotOrNot2($source, $language);
                 break;
             case 'easycomments':
                 JCommentsMigrationTool::importEasyComments($source, $language);
                 break;
             case 'musicbox':
                 JCommentsMigrationTool::importMusicBox($source, $language);
                 break;
             case 'jreviews':
                 JCommentsMigrationTool::importJReviews($source, $language);
                 break;
             case 'tutorials':
                 JCommentsMigrationTool::importTutorialsComments($source, $language);
                 break;
             case 'idoblog':
                 JCommentsMigrationTool::importIDoBlogComments($source, $language);
                 break;
             case 'sobi2reviews':
                 JCommentsMigrationTool::importSobi2Reviews($source, $language);
                 break;
             case 'jreactions':
                 JCommentsMigrationTool::importJReactions($source, $language);
                 break;
             case 'virtuemart':
                 JCommentsMigrationTool::importVirtueMart($source, $language);
                 break;
             case 'jxtendedcomments':
                 JCommentsMigrationTool::importJXtendedComments($source, $language);
                 break;
             case 'chronocomments':
                 JCommentsMigrationTool::importChronoComments($source, $language);
                 break;
             case 'akobook':
                 JCommentsMigrationTool::importAkoBook($source, $language);
                 break;
             case 'jambook':
                 JCommentsMigrationTool::importJamBook($source, $language);
                 break;
             case 'k2':
                 JCommentsMigrationTool::importK2($source, $language);
                 break;
             case 'smartblog':
                 JCommentsMigrationTool::importSmartBlog($source, $language);
                 break;
             case 'yvcomment':
                 JCommentsMigrationTool::importYvComment($source, $language);
                 break;
             case 'zimb':
                 JCommentsMigrationTool::importZimbComment($source, $language);
                 break;
             case 'rdbscomment':
                 JCommentsMigrationTool::importRDBSComment($source, $language);
                 break;
             case 'lyftenbloggie':
                 JCommentsMigrationTool::importLyftenBloggie($source, $language);
                 break;
             case 'webee':
                 JCommentsMigrationTool::importWebeeComment($source, $language);
                 break;
             case 'resource':
                 JCommentsMigrationTool::importResourceComments($source, $language);
                 break;
             case 'jacomment':
                 JCommentsMigrationTool::importJAComment($source, $language);
                 break;
             case 'tpdugg':
                 JCommentsMigrationTool::importTPDuggComments($source, $language);
                 break;
             case 'zoo':
                 JCommentsMigrationTool::importZooComments($source, $language);
                 break;
             case 'beeheard':
                 JCommentsMigrationTool::importBeeHeardComments($source, $language);
                 break;
             case 'jmylife':
                 JCommentsMigrationTool::importJMyLifeComments($source, $language);
                 break;
             case 'muscol':
                 JCommentsMigrationTool::importMusicCollectionsComments($source, $language);
                 break;
             case 'rscomments':
                 JCommentsMigrationTool::importRSComments($source, $language);
                 break;
         }
         $cnt = JCommentsMigrationTool::countCommentsBySource($source);
     }
     if ($cnt > 0) {
         JCommentsMigrationTool::updateParent($source);
         $message = sprintf(JText::_('A_IMPORT_DONE'), $cnt);
     } else {
         $message = JText::_('A_IMPORT_FAILED');
     }
     return $message;
 }
 public static function importCommentsAjax($source, $language, $start = 0)
 {
     $response = JCommentsFactory::getAjaxResponse();
     require_once dirname(__FILE__) . '/admin.jcomments.migration.php';
     $importer = new JCommentsMigrationTool($source, $language, $start);
     $importer->import();
     if ($importer->getStart() == 0 && $importer->getImported() == 0) {
         // if we couldn't import any items on first step
         $message = JText::_('A_IMPORT_FAILED');
         $response->addScript("jcbackend.showMessage('{$message}', 'info', 'jcomments-message-" . strtolower($source) . "',1);");
         $response->addScript("finishCommentsImport('{$source}');");
     } else {
         if ($importer->getImported() == $importer->getTotal()) {
             $message = JText::sprintf('A_IMPORT_DONE', $importer->getImported());
             $response->addScript("jcbackend.showMessage('{$message}', 'info', 'jcomments-message-" . strtolower($source) . "');");
             $response->addScript("finishCommentsImport('{$source}');");
         } else {
             if ($importer->getImported() < $importer->getTotal()) {
                 $imported = $importer->getImported();
                 $total = $importer->getTotal();
                 $percent = ceil($imported / $total * 100);
                 $message = JText::sprintf('%s %% (%s from %s)', $percent, $imported, $total);
                 $response->addScript("jcbackend.showMessage('{$message}', 'wait', 'jcomments-message-" . strtolower($source) . "');");
                 $start = $importer->getStart() + $importer->getLimit();
                 $response->addScript("JCommentsImportCommentsAJAX('{$source}', '{$language}', '{$start}');");
             }
         }
     }
     return $response;
 }
Beispiel #4
0
 function importCommentsDefault()
 {
     require_once dirname(__FILE__) . DS . 'admin.jcomments.migration.php';
     $message = JCommentsMigrationTool::doImport();
     JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=import', $message);
 }