Example #1
0
 /**
  * Insert page into Tiki using its builtin methods
  *
  * @param array $page
  * @return string|bool page name if was possible to create the new page or false
  */
 function insertPage($page)
 {
     $objectlib = TikiLib::lib('object');
     $this->instantiateImporterWiki();
     $pageName = $this->importerWiki->insertPage($page);
     // maybe this should go to TikiImporter_Wiki::insertPage()
     if ($pageName) {
         $objectlib->insert_object('wiki page', $pageName, '', $pageName, 'tiki-index.php?page=' . urlencode($pageName));
     }
     return $pageName;
 }
 /**
  * Insert page into Tiki using its builtin methods
  *
  * @param array $page
  * @return string|bool page name if was possible to create the new page or false
  */
 function insertPage($page)
 {
     global $objectlib;
     require_once 'lib/objectlib.php';
     $this->instantiateImporterWiki();
     $pageName = $this->importerWiki->insertPage($page);
     // maybe this should go to TikiImporter_Wiki::insertPage()
     if ($pageName) {
         $objectlib->insert_object('wiki page', $pageName, '', $pageName, 'tiki-index.php?page=' . urlencode($pageName));
     }
     return $pageName;
 }
 /**
  * Start the importing process by loading the XML file.
  *
  * @see lib/importer/TikiImporter_Wiki#import()
  *
  * @param string $filePath path to the XML file
  * @return void
  * @throws UnexpectedValueException if invalid file mime type
  */
 function import($filePath)
 {
     if (isset($_FILES['importFile']) && !in_array($_FILES['importFile']['type'], $this->validTypes)) {
         throw new UnexpectedValueException(tra('Invalid file mime type'));
     }
     if (!empty($_POST['importAttachments']) && $_POST['importAttachments'] == 'on') {
         $this->checkRequirementsForAttachments();
     }
     $this->saveAndDisplayLog("Loading and validating the XML file\n");
     $this->dom = new DOMDocument();
     $this->dom->load($filePath);
     $this->configureParser();
     if (!empty($_POST['importAttachments']) && $_POST['importAttachments'] == 'on') {
         $this->downloadAttachments();
     }
     parent::import();
 }