Beispiel #1
0
                           $image->setVar('imgcat_id', $newid );//$imgcat_id);
                           if (!$imageHandler->insert($image)) {
                               $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename'));
                           }
         */
         //============================
     }
 }
 if (!$publisher->getHandler('category')->insert($categoryObj)) {
     echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '<br/>';
     continue;
 }
 //copy all images to Image Manager
 $src = $GLOBALS['xoops']->path('uploads/AMS/topics/');
 $dst = $GLOBALS['xoops']->path('uploads');
 PublisherUtilities::recurseCopy($src, $dst);
 //populate the Image Manager with images from xNews articles (by Bleekk)
 $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('image') . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`)\n       SELECT\n       s.picture,\n       RIGHT(s.picture,13) AS nicename,\n       CONCAT('image/', RIGHT(s.picture,3)) AS `mimetype`,\n       1 AS image_display,\n       0 AS image_weight,\n       c.imgcat_id\n       FROM " . $GLOBALS['xoopsDB']->prefix('ams_article') . ' s, ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . " c\n       WHERE s.picture <> ''\n       AND c.imgcat_name = '" . PUBLISHER_DIRNAME . "'";
 $resultPictures = $GLOBALS['xoopsDB']->query($sql);
 $newCat['newid'] = $categoryObj->categoryid();
 ++$cnt_imported_cat;
 echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . '<br/>';
 $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_article') . ' WHERE topicid=' . $arrCat['topic_id'];
 $resultArticles = $GLOBALS['xoopsDB']->query($sql);
 while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) {
     // insert article
     $itemObj =& $publisher->getHandler('item')->create();
     $itemObj->setVar('categoryid', $categoryObj->categoryid());
     $itemObj->setVar('title', $arrArticle['title']);
     $itemObj->setVar('uid', $arrArticle['uid']);
     $itemObj->setVar('summary', $arrArticle['hometext']);