示例#1
0
 /**
  * Main function of the module
  *
  * @access	public
  *
  * @return	void
  */
 public function main()
 {
     // Is the user allowed to access this page?
     $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin();
     if ($this->id && $access) {
         // Check if page is sysfolder.
         if ($this->pageInfo['doktype'] != 254) {
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.wrongPageTypeMsg'), tx_dlf_helper::getLL('flash.wrongPageType', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
             tx_dlf_helper::addMessage($_message);
             $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
             $this->printContent();
             return;
         }
         // Should we do something?
         if (!empty($this->CMD)) {
             // Sanitize input...
             $_method = 'cmd' . ucfirst($this->CMD);
             // ...and unset to prevent infinite looping.
             unset($this->CMD);
             if (method_exists($this, $_method)) {
                 $this->{$_method}();
             }
         }
         // Check for existing structure configuration.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_structures', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_structures'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             // Fine.
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.structureOkayMsg'), tx_dlf_helper::getLL('flash.structureOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
         } else {
             // Configuration missing.
             $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addStructure')));
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.structureNotOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         // Check for existing metadata configuration.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_metadata', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_metadata'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             // Fine.
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.metadataOkayMsg'), tx_dlf_helper::getLL('flash.metadataOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
         } else {
             // Configuration missing.
             $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addMetadata')));
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         // Check the access conditions for the command line indexer's user.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,db_mountpoints', 'be_groups', 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups') . ' AND ' . $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] . '=0' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) {
                 // Fine.
                 $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.usergroupOkayMsg'), tx_dlf_helper::getLL('flash.usergroupOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
             } else {
                 // Configuration missing.
                 $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addAccessRights')));
                 $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
             }
         } else {
             // Usergoup missing.
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.usergroupMissingMsg'), tx_dlf_helper::getLL('flash.usergroupMissing', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         // Check for existing Solr core.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid', 'tx_dlf_solrcores', 'pid IN (' . intval($this->id) . ',0)' . tx_dlf_helper::whereClause('tx_dlf_solrcores'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
             if ($resArray['pid']) {
                 // Fine.
                 $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.solrcoreOkayMsg'), tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
             } else {
                 // Default core available, but this is deprecated.
                 $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addSolrcore')));
                 $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url), tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE, FALSE);
             }
         } else {
             // Solr core missing.
             $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addSolrcore')));
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url), tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
     } else {
         // TODO: Ändern!
         $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.';
     }
     $this->printContent();
 }
示例#2
0
 /**
  * Main function of the module
  *
  * @access	public
  *
  * @return	void
  */
 public function main()
 {
     // Is the user allowed to access this page?
     $access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin();
     if ($this->id && $access) {
         // Increase max_execution_time and max_input_time for large documents.
         if (!ini_get('safe_mode')) {
             ini_set('max_execution_time', '0');
             ini_set('max_input_time', '-1');
         }
         switch ($this->CMD) {
             case 'indexFile':
                 if (!empty($this->data['id']) && isset($this->data['core'])) {
                     // Save document to database and index.
                     $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE);
                     if ($doc->ready) {
                         $doc->save($this->id, $this->data['core']);
                     } else {
                         $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.fileNotLoaded'), $this->data['id'])), tx_dlf_helper::getLL('flash.error', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, TRUE);
                         tx_dlf_helper::addMessage($_message);
                     }
                 }
                 break;
             case 'reindexDocs':
                 if (isset($this->data['core'])) {
                     if (!empty($this->data['collection'])) {
                         // Get all documents in this collection.
                         $_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_documents.pid=' . intval($this->id) . ' AND tx_dlf_collections.uid=' . intval($this->data['collection']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_documents') . tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_documents.uid', '', '');
                     } else {
                         // Get all documents.
                         $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_documents.pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_documents'), '', '', '');
                     }
                     // Save them as a list object in user's session.
                     $elements = array();
                     while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
                         $elements[] = array($resArray['uid'], $resArray['title']);
                     }
                     $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list', $elements);
                     // Start index looping.
                     if (count($this->list) > 0) {
                         $this->indexLoop();
                     }
                 }
                 break;
             case 'indexLoop':
                 // Refresh user's session to prevent session timeout.
                 $GLOBALS['BE_USER']->fetchUserSession();
                 // Get document list from user's session.
                 $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
                 // Continue index looping.
                 if (count($this->list) > 0 && isset($this->data['core'])) {
                     $this->indexLoop();
                 } else {
                     $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.seeLog', TRUE), tx_dlf_helper::getLL('flash.done', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, TRUE);
                     tx_dlf_helper::addMessage($_message);
                 }
                 break;
         }
         $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
         switch ($this->MOD_SETTINGS['function']) {
             case 'indexFile':
                 $this->markerArray['CONTENT'] .= $this->getFileForm();
                 break;
             case 'reindexDoc':
                 $this->markerArray['CONTENT'] .= $this->getDocList();
                 break;
             case 'reindexDocs':
                 $this->markerArray['CONTENT'] .= $this->getCollList();
                 break;
         }
     } else {
         // TODO: Ändern!
         $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.';
     }
     $this->printContent();
 }
示例#3
0
 /**
  * Main function of the module
  *
  * @access	public
  *
  * @return	void
  */
 public function main()
 {
     // Is the user allowed to access this page?
     $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin();
     if ($this->id && $access) {
         // Check if page is sysfolder.
         if ($this->pageInfo['doktype'] != 254) {
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('flash.wrongPageTypeMsg'), $GLOBALS['LANG']->getLL('flash.wrongPageType', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
             tx_dlf_helper::addMessage($_message);
             $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
             $this->printContent();
             return;
         }
         // Should we do something?
         if (!empty($this->CMD)) {
             // Sanitize input...
             $_method = 'cmd' . ucfirst($this->CMD);
             // ...and unset to prevent infinite looping.
             unset($this->CMD);
             if (method_exists($this, $_method)) {
                 $this->{$_method}();
             }
         }
         // Check for existing structure configuration.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_structures', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_structures'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             // Fine.
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('flash.structureOkayMsg'), $GLOBALS['LANG']->getLL('flash.structureOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
         } else {
             // Configuration missing.
             $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addStructure')));
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('flash.structureNotOkayMsg'), $_url), $GLOBALS['LANG']->getLL('flash.structureNotOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         // Check for existing metadata configuration.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_metadata', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_metadata'));
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
             // Fine.
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('flash.metadataOkayMsg'), $GLOBALS['LANG']->getLL('flash.metadataOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
         } else {
             // Configuration missing.
             $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'addMetadata')));
             $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('flash.metadataNotOkayMsg'), $_url), $GLOBALS['LANG']->getLL('flash.metadataNotOkay', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
         }
         tx_dlf_helper::addMessage($_message);
         $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
     } else {
         // TODO: Ändern!
         $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.';
     }
     $this->printContent();
 }