Fix Bug #1021218: Refactor error reporting to use devlog extension

This commit is contained in:
Sebastian Meyer 2012-08-14 14:12:17 +02:00
parent dd63035b61
commit c6f599c3c0
28 changed files with 1348 additions and 1193 deletions

File diff suppressed because it is too large Load Diff

View File

@ -231,15 +231,25 @@ class tx_dlf_helper {
// Check for PHP extension "mcrypt".
if (!extension_loaded('mcrypt')) {
trigger_error('PHP extension "mcrypt" not available', E_USER_WARNING);
if (TYPO3_DLOG) {
return NULL;
t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] PHP extension "mcrypt" not available', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
}
if (empty($encrypted) || empty($hash)) {
return NULL;
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid parameters given for decryption', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return;
}
@ -253,7 +263,13 @@ class tx_dlf_helper {
if ($hashed !== $hash) {
return NULL;
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid hash "'.$hash.'" given for decryption', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
}
@ -276,9 +292,13 @@ class tx_dlf_helper {
// Check for PHP extension "mcrypt".
if (!extension_loaded('mcrypt')) {
trigger_error('PHP extension "mcrypt" not available', E_USER_WARNING);
if (TYPO3_DLOG) {
return NULL;
t3lib_div::devLog('[tx_dlf_helper->encrypt('.$string.')] PHP extension "mcrypt" not available', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
}
@ -316,11 +336,16 @@ class tx_dlf_helper {
} elseif (TYPO3_MODE === 'BE') {
// Return current backend user.
return $GLOBALS['BE_USER'];
} else {
trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getBeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return;
@ -341,11 +366,21 @@ class tx_dlf_helper {
*/
public static function getIndexName($uid, $table, $pid = -1) {
// Save parameters for logging purposes.
$_uid = $uid;
$_pid = $pid;
// Sanitize input.
$uid = max(intval($uid), 0);
if (!$uid || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) {
trigger_error('At least one argument is not valid: UID='.$uid.' or TABLE='.$table, E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] Invalid UID "'.$uid.'" or table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return '';
@ -353,6 +388,7 @@ class tx_dlf_helper {
$where = '';
// Should we check for a specific PID, too?
if ($pid !== -1) {
$pid = max(intval($pid), 0);
@ -361,7 +397,8 @@ class tx_dlf_helper {
}
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
// Get index_name from database.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$table.'.index_name AS index_name',
$table,
$table.'.uid='.$uid.$where.self::whereClause($table),
@ -370,20 +407,26 @@ class tx_dlf_helper {
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
return $resArray['index_name'];
} else {
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] No "index_name" with UID "'.$uid.'" and PID "'.$pid.'" found in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
trigger_error('No "index_name" with UID '.$uid.' found for PID '.$pid.' in TABLE '.$table, E_USER_WARNING);
return '';
}
}
/**
* Get language name from ISO code
*
@ -395,45 +438,52 @@ class tx_dlf_helper {
*/
public static function getLanguageName($code) {
$_code = strtolower(trim($code));
// Analyze code and set appropriate ISO table.
$isoCode = strtolower(trim($code));
if (preg_match('/^[a-z]{3}$/', $_code)) {
if (preg_match('/^[a-z]{3}$/', $isoCode)) {
$_file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml';
$file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml';
} elseif (preg_match('/^[a-z]{2}$/', $_code)) {
} elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
$_file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml';
$file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml';
} else {
// No ISO code, return unchanged.
return $code;
}
// Load ISO table and get localized full name of language.
if (TYPO3_MODE === 'FE') {
$iso639 = $GLOBALS['TSFE']->readLLfile($_file);
$iso639 = $GLOBALS['TSFE']->readLLfile($file);
if (!empty($iso639['default'][$_code])) {
if (!empty($iso639['default'][$isoCode])) {
$lang = $GLOBALS['TSFE']->getLLL($_code, $iso639);
$lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639);
}
} elseif (TYPO3_MODE === 'BE') {
$iso639 = $GLOBALS['LANG']->includeLLFile($_file, FALSE, TRUE);
$iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
if (!empty($iso639['default'][$_code])) {
if (!empty($iso639['default'][$isoCode])) {
$lang = $GLOBALS['LANG']->getLLL($_code, $iso639, FALSE);
$lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639, FALSE);
}
} else {
trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return $code;
@ -445,7 +495,11 @@ class tx_dlf_helper {
} else {
trigger_error('Language code "'.$code.'" not found', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Language code "'.$code.'" not found in ISO-639 table', $this->extKey, SYSLOG_SEVERITY_NOTICE);
}
return $code;
@ -511,7 +565,11 @@ class tx_dlf_helper {
if (preg_match('/[^a-z0-9:-]/', $urn)) {
trigger_error('Invalid chars in URN', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->getURN('.$base.', '.$id.')] Invalid chars in given parameters', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return '';
@ -559,23 +617,31 @@ class tx_dlf_helper {
*
* @access public
*
* @param string $key: Session key for retrieval
* @param string $key: Session data key for retrieval
*
* @return mixed Session value for given key or NULL on failure
*/
public static function loadFromSession($key) {
// Save parameter for logging purposes.
$_key = $key;
// Cast to string for security reasons.
$key = (string) $key;
if (!$key) {
trigger_error('No session key given', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Invalid key "'.$key.'" for session data retrieval', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
}
// Get the session data.
if (TYPO3_MODE === 'FE') {
return $GLOBALS['TSFE']->fe_user->getKey('ses', $key);
@ -586,7 +652,11 @@ class tx_dlf_helper {
} else {
trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return;
@ -647,23 +717,31 @@ class tx_dlf_helper {
* @access public
*
* @param string $value: Value to save
* @param string $key: Session key for retrieval
* @param string $key: Session data key for saving
*
* @return boolean TRUE on success, FALSE on failure
*/
public static function saveToSession($value, $key) {
// Save parameter for logging purposes.
$_key = $key;
// Cast to string for security reasons.
$key = (string) $key;
if (!$key) {
trigger_error('No session key given', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->saveToSession('.$value.', '.$_key.')] Invalid key "'.$key.'" for session data saving', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return FALSE;
}
// Save value in session data.
if (TYPO3_MODE === 'FE') {
$GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value);
@ -680,7 +758,11 @@ class tx_dlf_helper {
} else {
trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->saveToSession('.$value.', '.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return FALSE;
@ -688,82 +770,6 @@ class tx_dlf_helper {
}
/**
* This validates a METS file against its schemas
* TODO: nicht funktionstüchtig!
*
* @access public
*
* @param SimpleXMLElement $xml:
*
* @return void
*/
public static function schemaValidate(SimpleXMLElement $xml) {
$_libxmlErrors = libxml_use_internal_errors(TRUE);
// Get schema locations.
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$_schemaLocations = $xml->xpath('//*[@xsi:schemaLocation]');
foreach ($_schemaLocations as $_schemaLocation) {
$_schemas = explode(' ', (string) $_schemaLocation->attributes('http://www.w3.org/2001/XMLSchema-instance')->schemaLocation);
for ($i = 1, $j = count($_schemas); $i <= $j; $i++) {
if ($_schemas[$i] == 'http://www.loc.gov/METS/') {
$schema['mets'] = $_schemas[$i + 1];
} elseif ($_schemas[$i] == 'http://www.loc.gov/mods/v3') {
$schema['mods'] = $_schemas[$i + 1];
}
}
}
// TODO: Error-Handling (keine Schemas gefunden)
// Validate METS part against schema.
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode(dom_import_simplexml($this->mets), TRUE));
$dom->schemaValidate($schema['mets']);
// TODO: Error-Handling (invalider METS-Part)
// libxml_get_last_error() || libxml_get_errors() || libxml_clear_errors()
// Validate dmdSec parts against schema.
foreach ($this->dmdSec as $dmdSec) {
switch ($dmdSec['type']) {
case 'MODS':
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode(dom_import_simplexml($dmdSec['xml']), TRUE));
$dom->schemaValidate($schema['mods']);
// TODO: Error-Handling (invalider MODS-Part)
// libxml_get_last_error() || libxml_get_errors() || libxml_clear_errors()
break;
}
}
libxml_use_internal_errors($_libxmlErrors);
}
/**
* This translates an internal "index_name"
*
@ -777,13 +783,24 @@ class tx_dlf_helper {
*/
public static function translate($index_name, $table, $pid) {
// Save parameters for logging purposes.
$_index_name = $index_name;
$_pid = $pid;
// Load labels into static variable for future use.
static $labels = array ();
// Sanitize input.
$pid = max(intval($pid), 0);
if (!$pid) {
trigger_error('No PID given for translations', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] Invalid PID "'.$pid.'" for translation', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return $index_name;
@ -841,13 +858,21 @@ class tx_dlf_helper {
} else {
trigger_error('There are no entries with PID '.$pid.' in table '.$table.' or you are not allowed to access them', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translation with PID "'.$pid.'" available in table "'.$table.'" or translation not accessible', $this->extKey, SYSLOG_SEVERITY_NOTICE);
}
}
} else {
trigger_error('The table '.$table.' is not allowed for translation', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translations available for table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
}
@ -916,7 +941,11 @@ class tx_dlf_helper {
} else {
trigger_error('Unexpected TYPO3_MODE', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_helper->whereClause('.$table.', ['.($showHidden ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return ' AND 1=-1';

View File

@ -37,15 +37,6 @@
*/
class tx_dlf_indexing {
/**
* Array of autocompletable metadata
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $autocompleted = array ();
/**
* The extension key
*
@ -55,31 +46,21 @@ class tx_dlf_indexing {
public static $extKey = 'dlf';
/**
* Array of facets
* Array of metadata fields' configuration
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $facets = array ();
/**
* Array of fields' boost values
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $fieldboost = array ();
/**
* Array of indexed metadata
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $indexed = array ();
protected static $fields = array (
'autocompleted' => array (),
'facets' => array (),
'sortables' => array (),
'indexed' => array (),
'stored' => array (),
'tokenized' => array (),
'fieldboost' => array ()
);
/**
* List of already processed documents
@ -97,33 +78,6 @@ class tx_dlf_indexing {
*/
protected static $solr;
/**
* Array of sortable metadata
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $sortables = array ();
/**
* Array of stored metadata
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $stored = array ();
/**
* Array of tokenized metadata
* @see loadIndexConf()
*
* @var array
* @access protected
*/
protected static $tokenized = array ();
/**
* Array of toplevel structure elements
* @see loadIndexConf()
@ -164,7 +118,11 @@ class tx_dlf_indexing {
} else {
trigger_error('Could not load multi-volume work with UID '.$doc->parentid, E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentid.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -195,7 +153,7 @@ class tx_dlf_indexing {
self::$solr->commit();
// Get document title from database.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.title AS title',
'tx_dlf_documents',
'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'),
@ -204,11 +162,11 @@ class tx_dlf_indexing {
'1'
);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)),
$GLOBALS['LANG']->getLL('flash.done', TRUE),
@ -216,7 +174,7 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
@ -226,7 +184,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
$GLOBALS['LANG']->getLL('flash.error', TRUE),
@ -234,11 +192,15 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
trigger_error('Apache Solr exception thrown: '.$e->getMessage(), E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -248,7 +210,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrNoConnection', TRUE),
$GLOBALS['LANG']->getLL('flash.warning', TRUE),
@ -256,11 +218,15 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
trigger_error('Could not connect to Apache Solr server', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -279,6 +245,9 @@ class tx_dlf_indexing {
*/
public static function delete($uid) {
// Save parameter for logging purposes.
$_uid = $uid;
// Sanitize input.
$uid = max(intval($uid), 0);
@ -310,7 +279,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
$GLOBALS['LANG']->getLL('flash.error', TRUE),
@ -318,11 +287,15 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
trigger_error('Apache Solr exception thrown: '.$e->getMessage(), E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -332,7 +305,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrNoConnection', TRUE),
$GLOBALS['LANG']->getLL('flash.error', TRUE),
@ -340,11 +313,15 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
trigger_error('Could not connect to Apache Solr server', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -352,7 +329,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.documentDeleted'), $title, $uid)),
$GLOBALS['LANG']->getLL('flash.done', TRUE),
@ -360,7 +337,7 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}
@ -368,7 +345,11 @@ class tx_dlf_indexing {
} else {
trigger_error('Could not find document with UID '.$uid, E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return 1;
@ -388,7 +369,7 @@ class tx_dlf_indexing {
protected static function loadIndexConf($pid) {
// Get the list of toplevel structures.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_structures.index_name AS index_name',
'tx_dlf_structures',
'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'),
@ -397,14 +378,14 @@ class tx_dlf_indexing {
''
);
while ($_toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
self::$toplevel[] = $_toplevel['index_name'];
self::$toplevel[] = $toplevel['index_name'];
}
// Get the metadata indexing options.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.tokenized AS tokenized,tx_dlf_metadata.stored AS stored,tx_dlf_metadata.indexed AS indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.autocomplete AS autocomplete,tx_dlf_metadata.boost AS boost',
'tx_dlf_metadata',
'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
@ -413,51 +394,51 @@ class tx_dlf_indexing {
''
);
while ($_indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if ($_indexing['tokenized']) {
if ($indexing['tokenized']) {
self::$tokenized[] = $_indexing['index_name'];
self::$fields['tokenized'][] = $indexing['index_name'];
}
if ($_indexing['stored'] || $_indexing['is_listed']) {
if ($indexing['stored'] || $indexing['is_listed']) {
self::$stored[] = $_indexing['index_name'];
self::$fields['stored'][] = $indexing['index_name'];
}
if ($_indexing['indexed']) {
if ($indexing['indexed']) {
self::$indexed[] = $_indexing['index_name'];
self::$fields['indexed'][] = $indexing['index_name'];
}
if ($_indexing['is_sortable']) {
if ($indexing['is_sortable']) {
self::$sortables[] = $_indexing['index_name'];
self::$fields['sortables'][] = $indexing['index_name'];
}
if ($_indexing['is_facet']) {
if ($indexing['is_facet']) {
self::$facets[] = $_indexing['index_name'];
self::$fields['facets'][] = $indexing['index_name'];
}
if ($_indexing['autocomplete']) {
if ($indexing['autocomplete']) {
self::$autocompleted[] = $_indexing['index_name'];
self::$fields['autocompleted'][] = $indexing['index_name'];
}
if ($_indexing['boost'] > 0.0) {
if ($indexing['boost'] > 0.0) {
self::$fieldboost[$_indexing['index_name']] = floatval($_indexing['boost']);
self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['boost']);
} else {
self::$fieldboost[$_indexing['index_name']] = FALSE;
self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
}
@ -513,39 +494,39 @@ class tx_dlf_indexing {
$solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel));
$solrDoc->setField('type', $logicalUnit['type'], self::$fieldboost['type']);
$solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']);
$solrDoc->setField('title', $metadata['title'][0], self::$fieldboost['title']);
$solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
$solrDoc->setField('volume', $metadata['volume'][0], self::$fieldboost['volume']);
$solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
foreach ($metadata as $index_name => $data) {
if (!empty($data) && substr($index_name, -8) !== '_sorting') {
$suffix = (in_array($index_name, self::$tokenized) ? 't' : 'u');
$suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
$suffix .= (in_array($index_name, self::$stored) ? 's' : 'u');
$suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
$suffix .= (in_array($index_name, self::$indexed) ? 'i' : 'u');
$suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
$solrDoc->setField($index_name.'_'.$suffix, $data, self::$fieldboost[$index_name]);
$solrDoc->setField($index_name.'_'.$suffix, $data, self::$fields['fieldboost'][$index_name]);
if (in_array($index_name, self::$sortables)) {
if (in_array($index_name, self::$fields['sortables'])) {
// Add sortable fields to index.
$solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
}
if (in_array($index_name, self::$facets)) {
if (in_array($index_name, self::$fields['facets'])) {
// Add facets to index.
$solrDoc->setField($index_name.'_faceting', $data);
}
if (in_array($index_name, self::$autocompleted)) {
if (in_array($index_name, self::$fields['autocompleted'])) {
// Add autocomplete values to index.
$solrDoc->setField($index_name.'_suggest', $data);
@ -564,7 +545,7 @@ class tx_dlf_indexing {
if (!defined('TYPO3_cliMode')) {
$_message = t3lib_div::makeInstance(
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
$GLOBALS['LANG']->getLL('flash.error', TRUE),
@ -572,7 +553,7 @@ class tx_dlf_indexing {
TRUE
);
t3lib_FlashMessageQueue::addMessage($_message);
t3lib_FlashMessageQueue::addMessage($message);
}

View File

@ -92,11 +92,18 @@ class tx_dlf_list implements t3lib_Singleton {
*/
public function remove($position) {
// Save parameter for logging purposes.
$_position = $position;
$position = intval($position);
if ($position < 0 || $position >= $this->count) {
trigger_error('No valid list position for removal', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
@ -122,12 +129,21 @@ class tx_dlf_list implements t3lib_Singleton {
*/
public function move($position, $steps) {
// Save parameters for logging purposes.
$_position = $position;
$_steps = $steps;
$position = intval($position);
// Check if list position is valid.
if ($position < 0 || $position >= $this->count) {
trigger_error('Invalid list position '.$position, E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
@ -138,7 +154,11 @@ class tx_dlf_list implements t3lib_Singleton {
// Check if moving given amount of steps is possible.
if (($position + $steps) < 0 || ($position + $steps) >= $this->count) {
trigger_error('Element at position '.$position.' can not be moved '.$steps.' steps', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
@ -273,6 +293,14 @@ class tx_dlf_list implements t3lib_Singleton {
$this->elements = $newOrder;
} else {
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}
}
@ -400,17 +428,21 @@ class tx_dlf_list implements t3lib_Singleton {
*/
public function __get($var) {
$_method = '_get'.ucfirst($var);
$method = '_get'.ucfirst($var);
if (!property_exists($this, $var) || !method_exists($this, $_method)) {
if (!property_exists($this, $var) || !method_exists($this, $method)) {
trigger_error('There is no get function for property '.$var, E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
return;
} else {
return $this->$_method();
return $this->$method();
}
@ -428,15 +460,19 @@ class tx_dlf_list implements t3lib_Singleton {
*/
public function __set($var, $value) {
$_method = '_set'.ucfirst($var);
$method = '_set'.ucfirst($var);
if (!property_exists($this, $var) || !method_exists($this, $_method)) {
if (!property_exists($this, $var) || !method_exists($this, $method)) {
trigger_error('There is no set function for property '.$var, E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_list->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
} else {
$this->$_method($value);
$this->$method($value);
}

View File

@ -107,12 +107,6 @@ class tx_dlf_mods implements tx_dlf_format {
$metadata['author'][$i] = trim(implode(', ', $name));
if (!$metadata['author_sorting'][0]) {
$metadata['author_sorting'][0] = trim(implode(', ', $name));
}
}
// Check if there is a display form.
@ -120,12 +114,6 @@ class tx_dlf_mods implements tx_dlf_format {
$metadata['author'][$i] = (string) $displayForm[0];
if (!$metadata['author_sorting'][0]) {
$metadata['author_sorting'][0] = (string) $displayForm[0];
}
}
}

View File

@ -184,15 +184,13 @@ abstract class tx_dlf_module extends t3lib_SCbase {
function jumpToUrl(URL) {
document.location = URL;
}
</script>
';
</script>';
// Add Javascript for convenient module switch.
$this->doc->postCode .= '
<script type="text/javascript">
script_ended = 1;
</script>
';
</script>';
// Render output.
$this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));

View File

@ -155,7 +155,11 @@ abstract class tx_dlf_plugin extends tslib_pibase {
if (!$this->doc->ready) {
// Destroy the incomplete object.
trigger_error('Failed to load document with UID '.$this->piVars['id'], E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
$this->doc = NULL;
@ -193,13 +197,21 @@ abstract class tx_dlf_plugin extends tslib_pibase {
} else {
trigger_error('Failed to load document with record ID '.$this->piVars['recordId'], E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}
} else {
trigger_error('No UID or PID given for document', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}

View File

@ -93,6 +93,9 @@ class tx_dlf_solr {
*/
public static function solrConnect($core = 0) {
// Save parameter for logging purposes.
$_core = $core;
// Load class.
if (!class_exists('Apache_Solr_Service')) {
@ -122,7 +125,11 @@ class tx_dlf_solr {
if (empty($core)) {
trigger_error('Could not find Solr core with UID '.$core, E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_solr->solrConnect('.$_core.')] Invalid UID "'.$_core.'" for Apache Solr core', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return;
@ -146,7 +153,11 @@ class tx_dlf_solr {
} else {
trigger_error('Could not connect to Solr server with core "'.$core.'"', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_solr->solrConnect('.$_core.')] Could not connect to Apache Solr server with core "'.$core.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
return;

View File

@ -109,7 +109,6 @@ CREATE TABLE tx_dlf_formats (
cruser_id int(11) DEFAULT '0' NOT NULL,
deleted tinyint(4) DEFAULT '0' NOT NULL,
type tinytext NOT NULL,
other_type tinyint(4) DEFAULT '0' NOT NULL,
root tinytext NOT NULL,
namespace text NOT NULL,
class text NOT NULL,

View File

@ -9,7 +9,6 @@ CREATE TABLE tx_dlf_formats (
cruser_id int(11) DEFAULT '0' NOT NULL,
deleted tinyint(4) DEFAULT '0' NOT NULL,
type tinytext NOT NULL,
other_type tinyint(4) DEFAULT '0' NOT NULL,
root tinytext NOT NULL,
namespace text NOT NULL,
class text NOT NULL,
@ -18,4 +17,4 @@ CREATE TABLE tx_dlf_formats (
KEY parent (pid)
);
INSERT INTO tx_dlf_formats VALUES ('1', '0', '0', '0', '0', '0', 'MODS', '0', 'mods', 'http://www.loc.gov/mods/v3', 'tx_dlf_mods');
INSERT INTO tx_dlf_formats VALUES ('1', '0', '0', '0', '0', '0', 'MODS', 'mods', 'http://www.loc.gov/mods/v3', 'tx_dlf_mods');

View File

@ -160,7 +160,7 @@ class tx_dlf_em {
$resArray['usergroup'] = explode(',', $resArray['usergroup']);
// Check if user is not disabled.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'1',
'be_users',
'uid='.intval($resArray['uid']).t3lib_BEfunc::BEenableFields('be_users')
@ -169,7 +169,7 @@ class tx_dlf_em {
// Check if user is configured properly.
if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0
&& !$resArray['admin']
&& $GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) {
&& $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) {
$usrUid = $resArray['uid'];
@ -186,12 +186,12 @@ class tx_dlf_em {
if (!$checkOnly && $groupUid) {
// Keep exisiting values and add the new ones.
$_usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup']));
$usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup']));
// Try to configure user.
$data['be_users'][$resArray['uid']] = array (
'admin' => 0,
'usergroup' => implode(',', $_usergroup),
'usergroup' => implode(',', $usergroup),
$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0,
$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0,
$GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0
@ -243,22 +243,22 @@ class tx_dlf_em {
if (!$checkOnly && $groupUid) {
// Try to create user.
$_tempUid = uniqid('NEW');
$tempUid = uniqid('NEW');
$data['be_users'][$_tempUid] = array (
$data['be_users'][$tempUid] = array (
'pid' => 0,
'username' => '_cli_dlf',
'password' => md5($_tempUid),
'password' => md5($tempUid),
'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'),
'usergroup' => intval($groupUid)
);
$_substUid = tx_dlf_helper::processDB($data);
$substUid = tx_dlf_helper::processDB($data);
// Check if creation was successful.
if (!empty($_substUid[$_tempUid])) {
if (!empty($substUid[$tempUid])) {
$usrUid = $_substUid[$_tempUid];
$usrUid = $substUid[$tempUid];
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',
@ -395,17 +395,17 @@ class tx_dlf_em {
if (!$checkOnly) {
// Keep exisiting values and add the new ones.
$_non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields']));
$non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields']));
$_tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select']));
$tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select']));
$_tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify']));
$tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify']));
// Try to configure usergroup.
$data['be_groups'][$resArray['uid']] = array (
'non_exclude_fields' => implode(',', $_non_exclude_fields),
'tables_select' => implode(',', $_tables_select),
'tables_modify' => implode(',', $_tables_modify),
'non_exclude_fields' => implode(',', $non_exclude_fields),
'tables_select' => implode(',', $tables_select),
'tables_modify' => implode(',', $tables_modify),
'inc_access_lists' => 1,
$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0
);
@ -456,9 +456,9 @@ class tx_dlf_em {
if (!$checkOnly) {
// Try to create usergroup.
$_tempUid = uniqid('NEW');
$tempUid = uniqid('NEW');
$data['be_groups'][$_tempUid] = array (
$data['be_groups'][$tempUid] = array (
'pid' => 0,
'title' => '_cli_dlf',
'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'),
@ -468,12 +468,12 @@ class tx_dlf_em {
'inc_access_lists' => 1
);
$_substUid = tx_dlf_helper::processDB($data);
$substUid = tx_dlf_helper::processDB($data);
// Check if creation was successful.
if (!empty($_substUid[$_tempUid])) {
if (!empty($substUid[$tempUid])) {
$grpUid = $_substUid[$_tempUid];
$grpUid = $substUid[$tempUid];
$message = t3lib_div::makeInstance(
't3lib_FlashMessage',

View File

@ -59,9 +59,9 @@ class tx_dlf_tceforms {
// i.e. instead of "18" it reads "pages_18|Title"
if (!t3lib_div::testInt($pages)) {
$_parts = explode('|', $pages);
$parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0]));
$pages = array_pop(explode('_', $parts[0]));
}
@ -114,9 +114,9 @@ class tx_dlf_tceforms {
// i.e. instead of "18" it reads "pages_18|Title"
if (!t3lib_div::testInt($pages)) {
$_parts = explode('|', $pages);
$parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0]));
$pages = array_pop(explode('_', $parts[0]));
}
@ -169,9 +169,9 @@ class tx_dlf_tceforms {
// i.e. instead of "18" it reads "pages_18|Title"
if (!t3lib_div::testInt($pages)) {
$_parts = explode('|', $pages);
$parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0]));
$pages = array_pop(explode('_', $parts[0]));
}

View File

@ -59,37 +59,13 @@ class tx_dlf_tcemain {
// Field post-processing for table "tx_dlf_documents".
case 'tx_dlf_documents':
// Set sorting fields if empty.
// Set sorting field if empty.
if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) {
$fieldArray['title_sorting'] = $fieldArray['title'];
}
if (empty($fieldArray['author_sorting']) && !empty($fieldArray['author'])) {
$fieldArray['author_sorting'] = $fieldArray['author'];
}
if (empty($fieldArray['year_sorting']) && !empty($fieldArray['year'])) {
$fieldArray['year_sorting'] = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $fieldArray['year']));
if (strpos($fieldArray['year_sorting'], '.') || strlen($fieldArray['year_sorting']) < 3) {
$fieldArray['year_sorting'] = ((intval(trim($fieldArray['year_sorting'], '.')) - 1) * 100) + 50;
}
}
if (empty($fieldArray['place_sorting']) && !empty($fieldArray['place'])) {
$fieldArray['place_sorting'] = preg_replace('/[[:punct:]]/', '', (string) $fieldArray['place']);
}
break;
// Field post-processing for tables "tx_dlf_collections", "tx_dlf_libraries", "tx_dlf_metadata" and "tx_dlf_structures".
@ -178,7 +154,11 @@ class tx_dlf_tcemain {
}
trigger_error('Could not create new Solr core "dlfCore'.$coreNumber.'"', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
}
$fieldArray = NULL;
@ -225,7 +205,11 @@ class tx_dlf_tcemain {
}
trigger_error('Prevented change of "index_name" for UID '.intval($id).' in table "'.htmlspecialchars($table).'"', E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray);
}
}
@ -252,7 +236,7 @@ class tx_dlf_tcemain {
*/
public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) {
if ($status == "update") {
if ($status == 'update') {
switch ($table) {
@ -299,7 +283,11 @@ class tx_dlf_tcemain {
} else {
trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
}
}
@ -380,7 +368,11 @@ class tx_dlf_tcemain {
} else {
trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}

View File

@ -64,7 +64,6 @@
<label index="tx_dlf_metadata.tab3">Access</label>
<label index="tx_dlf_formats">Data Formats</label>
<label index="tx_dlf_formats.type">METS Name</label>
<label index="tx_dlf_formats.other_type">Is it @MDTYPE="OTHER" in METS?</label>
<label index="tx_dlf_formats.root">Root Element</label>
<label index="tx_dlf_formats.namespace">Namespace URI</label>
<label index="tx_dlf_formats.class">Class Name</label>
@ -219,7 +218,6 @@
<label index="tx_dlf_metadata.tab3">Zugriff</label>
<label index="tx_dlf_formats">Datenformate</label>
<label index="tx_dlf_formats.type">Bezeichnung in METS</label>
<label index="tx_dlf_formats.other_type">@MDTYPE="OTHER" in METS?</label>
<label index="tx_dlf_formats.root">Root-Element</label>
<label index="tx_dlf_formats.namespace">Namensraum URI</label>
<label index="tx_dlf_formats.class">Klassenname</label>

View File

@ -56,7 +56,11 @@ class tx_dlf_collection extends tx_dlf_plugin {
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
@ -201,9 +205,9 @@ class tx_dlf_collection extends tx_dlf_plugin {
// Add feed link if applicable.
if (!empty($this->conf['targetFeed'])) {
$_img = '<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
$img = '<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
$markerArray[$resArray['uid']]['###FEED###'] = $this->pi_linkTP($_img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
$markerArray[$resArray['uid']]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
} else {
@ -215,21 +219,21 @@ class tx_dlf_collection extends tx_dlf_plugin {
$markerArray[$resArray['uid']]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
// Build statistic's output.
$_labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
$labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
$markerArray[$resArray['uid']]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$_labelTitles);
$markerArray[$resArray['uid']]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
$_labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
$labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
$markerArray[$resArray['uid']]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$_labelVolumes);
$markerArray[$resArray['uid']]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
}
$entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
foreach ($markerArray as $_markerArray) {
foreach ($markerArray as $marker) {
$content .= $this->cObj->substituteMarkerArray($entry, $_markerArray);
$content .= $this->cObj->substituteMarkerArray($entry, $marker);
}
@ -271,9 +275,9 @@ class tx_dlf_collection extends tx_dlf_plugin {
// Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if (empty($_metadata)) {
if (empty($listMetadata)) {
$_metadata = array (
$listMetadata = array (
'label' => htmlspecialchars($resArray['collLabel']),
'description' => $this->pi_RTEcssText($resArray['collDesc']),
'options' => array (
@ -379,7 +383,7 @@ class tx_dlf_collection extends tx_dlf_plugin {
$list->add(array_values($toplevel));
$list->metadata = $_metadata;
$list->metadata = $listMetadata;
$list->save();

View File

@ -77,7 +77,7 @@ class tx_dlf_feeds extends tx_dlf_plugin {
}
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_libraries.label AS label',
'tx_dlf_libraries',
'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
@ -86,11 +86,11 @@ class tx_dlf_feeds extends tx_dlf_plugin {
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$channel->appendChild($rss->createElement('copyright', htmlspecialchars($_resArray['label'], ENT_NOQUOTES, 'UTF-8')));
$channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
}

View File

@ -162,71 +162,71 @@ class tx_dlf_listview extends tx_dlf_plugin {
$element = $this->list->elements[$number];
foreach ($this->metadata as $_index_name => $_metaConf) {
foreach ($this->metadata as $index_name => $metaConf) {
$value = '';
$parsedValue = '';
$fieldwrap = $this->parseTS($_metaConf['wrap']);
$fieldwrap = $this->parseTS($metaConf['wrap']);
do {
$_value = @array_shift($element['metadata'][$_index_name]);
$value = @array_shift($element['metadata'][$index_name]);
// Link title to pageview.
if ($_index_name == 'title') {
if ($index_name == 'title') {
// Get title of parent document if needed.
if (empty($_value) && $this->conf['getTitle']) {
if (empty($value) && $this->conf['getTitle']) {
$_value = '['.tx_dlf_document::getTitle($element['uid'], TRUE).']';
$value = '['.tx_dlf_document::getTitle($element['uid'], TRUE).']';
}
// Set fake title if still not present.
if (empty($_value)) {
if (empty($value)) {
$_value = $this->pi_getLL('noTitle');
$value = $this->pi_getLL('noTitle');
}
$_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $element['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
$value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $element['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
// Translate name of holding library.
} elseif ($_index_name == 'owner' && !empty($_value)) {
} elseif ($index_name == 'owner' && !empty($value)) {
$_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages']));
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
// Translate document type.
} elseif ($_index_name == 'type' && !empty($_value)) {
} elseif ($index_name == 'type' && !empty($value)) {
$_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages']));
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
// Translate ISO 639 language code.
} elseif ($_index_name == 'language' && !empty($_value)) {
} elseif ($index_name == 'language' && !empty($value)) {
$_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value));
$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
} elseif (!empty($_value)) {
} elseif (!empty($value)) {
$_value = htmlspecialchars($_value);
$value = htmlspecialchars($value);
}
$_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']);
if (!empty($_value)) {
$value .= $_value;
}
} while (count($element['metadata'][$_index_name]));
$value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
if (!empty($value)) {
$field = $this->cObj->stdWrap(htmlspecialchars($_metaConf['label']), $fieldwrap['key.']);
$parsedValue .= $value;
$field .= $value;
}
} while (count($element['metadata'][$index_name]));
if (!empty($parsedValue)) {
$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
$field .= $parsedValue;
$markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
@ -276,9 +276,9 @@ class tx_dlf_listview extends tx_dlf_plugin {
}
$_uniqId = uniqid($prefix.'-');
$uniqId = uniqid($prefix.'-');
$sorting .= '<label for="'.$_uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$_uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();"><option value=""></option>';
$sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();"><option value=""></option>';
foreach ($this->sortables as $index_name => $label) {
@ -310,71 +310,71 @@ class tx_dlf_listview extends tx_dlf_plugin {
$markerArray['###SUBMETADATA###'] = '';
foreach ($this->metadata as $_index_name => $_metaConf) {
foreach ($this->metadata as $index_name => $metaConf) {
$value = '';
$parsedValue = '';
$fieldwrap = $this->parseTS($_metaConf['wrap']);
$fieldwrap = $this->parseTS($metaConf['wrap']);
do {
$_value = @array_shift($subpart['metadata'][$_index_name]);
$value = @array_shift($subpart['metadata'][$index_name]);
// Link title to pageview.
if ($_index_name == 'title') {
if ($index_name == 'title') {
// Get title of parent document if needed.
if (empty($_value) && $this->conf['getTitle']) {
if (empty($value) && $this->conf['getTitle']) {
$_value = '['.tx_dlf_document::getTitle($subpart['uid'], TRUE).']';
$value = '['.tx_dlf_document::getTitle($subpart['uid'], TRUE).']';
}
// Set fake title if still not present.
if (empty($_value)) {
if (empty($value)) {
$_value = $this->pi_getLL('noTitle');
$value = $this->pi_getLL('noTitle');
}
$_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $subpart['uid'], 'page' => $subpart['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
$value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $subpart['uid'], 'page' => $subpart['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
// Translate name of holding library.
} elseif ($_index_name == 'owner' && !empty($_value)) {
} elseif ($index_name == 'owner' && !empty($value)) {
$_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages']));
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
// Translate document type.
} elseif ($_index_name == 'type' && !empty($_value)) {
} elseif ($index_name == 'type' && !empty($value)) {
$_value = $this->pi_getLL($_value, tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages']), FALSE);
$value = $this->pi_getLL($value, tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages']), FALSE);
// Translate ISO 639 language code.
} elseif ($_index_name == 'language' && !empty($_value)) {
} elseif ($index_name == 'language' && !empty($value)) {
$_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value));
$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
} elseif (!empty($_value)) {
} elseif (!empty($value)) {
$_value = htmlspecialchars($_value);
$value = htmlspecialchars($value);
}
$_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']);
if (!empty($_value)) {
$value .= $_value;
}
} while (count($subpart['metadata'][$_index_name]));
$value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
if (!empty($value)) {
$field = $this->cObj->stdWrap(htmlspecialchars($_metaConf['label']), $fieldwrap['key.']);
$parsedValue .= $value;
$field .= $value;
}
} while (count($subpart['metadata'][$index_name]));
if (!empty($parsedValue)) {
$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
$field .= $parsedValue;
$markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
@ -456,11 +456,11 @@ class tx_dlf_listview extends tx_dlf_plugin {
$this->list->sort($this->piVars['order'], TRUE);
// Update list's metadata.
$_metadata = $this->list->metadata;
$listMetadata = $this->list->metadata;
$_metadata['options']['order'] = $this->piVars['order'];
$listMetadata['options']['order'] = $this->piVars['order'];
$this->list->metadata = $_metadata;
$this->list->metadata = $listMetadata;
// Save updated list.
$this->list->save();

View File

@ -68,36 +68,36 @@ class tx_dlf_metadata extends tx_dlf_plugin {
if ($this->conf['rootline'] < 2) {
// Get current structure's @ID.
$_ids = array ();
$ids = array ();
if (!empty($this->doc->physicalPages[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]])) {
foreach ($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]] as $_logId) {
foreach ($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]] as $logId) {
$_count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$_logId.'"]/ancestor::*'));
$count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'));
$_ids[$_count][] = $_logId;
$ids[$count][] = $logId;
}
}
ksort($_ids);
ksort($ids);
reset($_ids);
reset($ids);
// Check if we should display all metadata up to the root.
if ($this->conf['rootline'] == 1) {
foreach ($_ids as $_id) {
foreach ($ids as $id) {
foreach ($_id as $id) {
foreach ($id as $sid) {
$_data = $this->doc->getMetadata($id, $this->conf['pages']);
$data = $this->doc->getMetadata($sid, $this->conf['pages']);
$_data['_id'] = $id;
$data['_id'] = $sid;
$metadata[] = $_data;
$metadata[] = $data;
}
@ -105,17 +105,17 @@ class tx_dlf_metadata extends tx_dlf_plugin {
} else {
$_id = array_pop($_ids);
$id = array_pop($ids);
if (is_array($_id)) {
if (is_array($id)) {
foreach ($_id as $id) {
foreach ($id as $sid) {
$_data = $this->doc->getMetadata($id, $this->conf['pages']);
$data = $this->doc->getMetadata($sid, $this->conf['pages']);
$_data['_id'] = $id;
$data['_id'] = $sid;
$metadata[] = $_data;
$metadata[] = $data;
}
@ -128,17 +128,21 @@ class tx_dlf_metadata extends tx_dlf_plugin {
// Get titledata?
if (empty($metadata)) {
$_data = $this->doc->getTitleData($this->conf['pages']);
$data = $this->doc->getTitleData($this->conf['pages']);
$_data['_id'] = $this->doc->toplevelId;
$data['_id'] = $this->doc->toplevelId;
$metadata[] = $_data;
$metadata[] = $data;
}
if (empty($metadata)) {
trigger_error('No metadata found', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
@ -157,11 +161,11 @@ class tx_dlf_metadata extends tx_dlf_plugin {
*
* @access protected
*
* @param array $metadata: The metadata array
* @param array $metadataArray: The metadata array
*
* @return string The metadata array ready for output
*/
protected function printMetadata(array $metadata) {
protected function printMetadata(array $metadataArray) {
// Load template file.
if (!empty($this->conf['templateFile'])) {
@ -181,7 +185,7 @@ class tx_dlf_metadata extends tx_dlf_plugin {
// Get list of metadata to show.
$metaList = array ();
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap',
'tx_dlf_metadata',
'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
@ -190,7 +194,7 @@ class tx_dlf_metadata extends tx_dlf_plugin {
''
);
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if ($this->conf['showFull'] || $resArray['is_listed']) {
@ -207,7 +211,7 @@ class tx_dlf_metadata extends tx_dlf_plugin {
$cObjData = $this->cObj->data;
// Parse the metadata arrays.
foreach ($metadata as $_metadata) {
foreach ($metadataArray as $metadata) {
$markerArray['###METADATA###'] = '';
@ -215,92 +219,92 @@ class tx_dlf_metadata extends tx_dlf_plugin {
$this->cObj->data = $cObjData;
// Load all the metadata values into the content object's data array.
foreach ($_metadata as $_index_name => $_value) {
foreach ($metadata as $index_name => $value) {
if (is_array($_value)) {
if (is_array($value)) {
$this->cObj->data[$_index_name] = implode($this->conf['separator'], $_value);
$this->cObj->data[$index_name] = implode($this->conf['separator'], $value);
} else {
$this->cObj->data[$_index_name] = $_value;
$this->cObj->data[$index_name] = $value;
}
}
// Process each metadate.
foreach ($metaList as $_index_name => $_metaConf) {
foreach ($metaList as $index_name => $metaConf) {
$value = '';
$parsedValue = '';
$fieldwrap = $this->parseTS($_metaConf['wrap']);
$fieldwrap = $this->parseTS($metaConf['wrap']);
do {
$_value = @array_shift($_metadata[$_index_name]);
$value = @array_shift($metadata[$index_name]);
if ($_index_name == 'title') {
if ($index_name == 'title') {
// Get title of parent document if needed.
if (empty($_value) && $this->conf['getTitle'] && $this->doc->parentid) {
if (empty($value) && $this->conf['getTitle'] && $this->doc->parentid) {
$_value = '['.tx_dlf_document::getTitle($this->doc->parentid, TRUE).']';
$value = '['.tx_dlf_document::getTitle($this->doc->parentid, TRUE).']';
}
if (!empty($_value)) {
$_value = htmlspecialchars($_value);
// Link title to pageview.
if ($this->conf['linkTitle'] && $_metadata['_id']) {
$details = $this->doc->getLogicalStructure($_metadata['_id']);
$_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']);
}
}
} elseif ($_index_name == 'owner' && !empty($_value)) {
// Translate name of holding library.
$_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages']));
} elseif ($_index_name == 'type' && !empty($_value)) {
// Translate document type.
$_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages']));
} elseif ($_index_name == 'language' && !empty($_value)) {
// Translate ISO 639 language code.
$_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value));
} elseif (!empty($_value)) {
// Sanitize value for output.
$_value = htmlspecialchars($_value);
}
$_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']);
if (!empty($_value)) {
$value .= $_value;
}
} while (count($_metadata[$_index_name]));
if (!empty($value)) {
$field = $this->cObj->stdWrap(htmlspecialchars($_metaConf['label']), $fieldwrap['key.']);
$value = htmlspecialchars($value);
$field .= $value;
// Link title to pageview.
if ($this->conf['linkTitle'] && $metadata['_id']) {
$details = $this->doc->getLogicalStructure($metadata['_id']);
$value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']);
}
}
} elseif ($index_name == 'owner' && !empty($value)) {
// Translate name of holding library.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
} elseif ($index_name == 'type' && !empty($value)) {
// Translate document type.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
} elseif ($index_name == 'language' && !empty($value)) {
// Translate ISO 639 language code.
$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
} elseif (!empty($value)) {
// Sanitize value for output.
$value = htmlspecialchars($value);
}
$value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
if (!empty($value)) {
$parsedValue .= $value;
}
} while (count($metadata[$index_name]));
if (!empty($parsedValue)) {
$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
$field .= $parsedValue;
$markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);

View File

@ -116,7 +116,7 @@ class tx_dlf_navigation extends tx_dlf_plugin {
}
// Build page selector.
$_uniqId = uniqid($prefix.'-');
$uniqId = uniqid($prefix.'-');
$markerArray['###PAGESELECT###'] = '<form action="'.$this->pi_getPageLink($GLOBALS['TSFE']->id).'" class="'.$prefix.'-pageselect" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
@ -130,7 +130,7 @@ class tx_dlf_navigation extends tx_dlf_plugin {
}
$markerArray['###PAGESELECT###'] .= '<label for="'.$_uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$_uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();">';
$markerArray['###PAGESELECT###'] .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();">';
for ($i = 1; $i <= $this->doc->numPages; $i++) {

View File

@ -89,15 +89,19 @@ class tx_dlf_oai extends tx_dlf_plugin {
protected function deleteExpiredTokens() {
// Delete expired resumption tokens.
$_result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
$result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
'tx_dlf_tokens',
'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.tstamp<'.intval($GLOBALS['EXEC_TIME'] - $this->conf['expired'])
);
if ($GLOBALS['TYPO3_DB']->sql_affected_rows($_result) === -1) {
if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) === -1) {
// Deletion failed.
trigger_error('Could not delete expired resumption tokens', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
}
@ -133,7 +137,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
*/
protected function getUrlParams() {
$_allowedParams = array (
$allowedParams = array (
'verb',
'identifier',
'metadataPrefix',
@ -147,11 +151,11 @@ class tx_dlf_oai extends tx_dlf_plugin {
$this->piVars = array ();
// Set only allowed parameters.
foreach ($_allowedParams as $_param) {
foreach ($allowedParams as $param) {
if (t3lib_div::_GP($_param)) {
if (t3lib_div::_GP($param)) {
$this->piVars[$_param] = t3lib_div::_GP($_param);
$this->piVars[$param] = t3lib_div::_GP($param);
}
@ -223,7 +227,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
if (!empty($metadata['partof'])) {
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.record_id',
'tx_dlf_documents',
'tx_dlf_documents.uid='.intval($metadata['partof']).tx_dlf_helper::whereClause('tx_dlf_documents'),
@ -232,11 +236,11 @@ class tx_dlf_oai extends tx_dlf_plugin {
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$_partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$partof = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($_partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
$oai_dc->appendChild($this->oai->createElementNS('http://purl.org/dc/elements/1.1/', 'dc:relation', htmlspecialchars($partof['record_id'], ENT_NOQUOTES, 'UTF-8')));
}
@ -359,12 +363,21 @@ class tx_dlf_oai extends tx_dlf_plugin {
} else {
trigger_error('No METS node found in file "'.$location.'"', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
}
}
} else {
trigger_error('Could not load file "'.$location.'"', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $metadata);
}
}
@ -411,26 +424,26 @@ class tx_dlf_oai extends tx_dlf_plugin {
// Resolve "EXT:" prefix in file path.
if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
list ($_extKey, $_filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
list ($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
if (t3lib_extMgm::isLoaded($_extKey)) {
if (t3lib_extMgm::isLoaded($extKey)) {
$this->conf['stylesheet'] = t3lib_extMgm::siteRelPath($_extKey).$_filePath;
$this->conf['stylesheet'] = t3lib_extMgm::siteRelPath($extKey).$filePath;
}
}
$_stylesheet = t3lib_div::locationHeaderUrl($this->conf['stylesheet']);
$stylesheet = t3lib_div::locationHeaderUrl($this->conf['stylesheet']);
} else {
// Use default stylesheet if no custom stylesheet is given.
$_stylesheet = t3lib_div::locationHeaderUrl(t3lib_extMgm::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
$stylesheet = t3lib_div::locationHeaderUrl(t3lib_extMgm::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
}
$this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($_stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
$this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
// Create root element.
$root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
@ -545,7 +558,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
protected function resume() {
// Get resumption token.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_tokens.options AS options',
'tx_dlf_tokens',
'tx_dlf_tokens.ident="oai" AND tx_dlf_tokens.token='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['resumptionToken'], 'tx_dlf_tokens'),
@ -554,16 +567,16 @@ class tx_dlf_oai extends tx_dlf_plugin {
'1'
);
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// No resumption token found or resumption token expired.
return $this->error('badResumptionToken');
}
$_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$resultSet = unserialize($_resArray['options']);
$resultSet = unserialize($resArray['options']);
$complete = FALSE;
@ -692,7 +705,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
'metadataPrefix' => $resultSet->metadata['metadataPrefix'],
);
$_result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery(
'tx_dlf_tokens',
array (
'tstamp' => $GLOBALS['EXEC_TIME'],
@ -702,13 +715,17 @@ class tx_dlf_oai extends tx_dlf_plugin {
)
);
if ($GLOBALS['TYPO3_DB']->sql_affected_rows($_result) == 1) {
if ($GLOBALS['TYPO3_DB']->sql_affected_rows($result) == 1) {
$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
} else {
trigger_error('Could not create resumption token', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->resume()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}
@ -763,7 +780,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
$_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.*,GROUP_CONCAT(DISTINCT tx_dlf_collections.oai_name ORDER BY tx_dlf_collections.oai_name SEPARATOR " ") AS collections',
'tx_dlf_documents',
'tx_dlf_relations',
@ -774,13 +791,13 @@ class tx_dlf_oai extends tx_dlf_plugin {
'1'
);
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
return $this->error('idDoesNotExist');
} else {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
// Check for required fields.
foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
@ -879,7 +896,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
// Get repository name and administrative contact.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_libraries.oai_label AS oai_label,tx_dlf_libraries.contact AS contact',
'tx_dlf_libraries',
'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
@ -888,12 +905,12 @@ class tx_dlf_oai extends tx_dlf_plugin {
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
// Get earliest datestamp.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.tstamp AS tstamp',
'tx_dlf_documents',
'tx_dlf_documents.pid='.intval($this->conf['pages']),
@ -902,17 +919,21 @@ class tx_dlf_oai extends tx_dlf_plugin {
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
list ($_timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($_result);
list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
$datestamp = gmdate('Y-m-d\TH:i:s\Z', $_timestamp);
$datestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
} else {
$datestamp = '0000-00-00T00:00:00Z';
trigger_error('No records found with PID '.$this->conf['pages'], E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', $this->extKey, SYSLOG_SEVERITY_NOTICE);
}
}
@ -937,7 +958,11 @@ class tx_dlf_oai extends tx_dlf_plugin {
} else {
trigger_error('OAI interface needs more configuration', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
exit;
@ -997,32 +1022,32 @@ class tx_dlf_oai extends tx_dlf_plugin {
if (!empty($this->piVars['set'])) {
// Get set information.
$_additionalWhere = '';
$additionalWhere = '';
if (!$this->conf['show_userdefined']) {
$_additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
}
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_collections.uid AS uid',
'tx_dlf_collections',
'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$_additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
'',
'',
'1'
);
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
return $this->error('noSetHierarchy');
} else {
$_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$where .= ' AND tx_dlf_collections.uid='.intval($_resArray['uid']);
$where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
}
@ -1031,9 +1056,9 @@ class tx_dlf_oai extends tx_dlf_plugin {
// Check "from" for valid value.
if (!empty($this->piVars['from'])) {
if (is_array($_from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($_from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
$_from = gmmktime($_from['tm_hour'], $_from['tm_min'], $_from['tm_sec'], $_from['tm_mon'] + 1, $_from['tm_mday'], $_from['tm_year'] + 1900);
$from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
} else {
@ -1041,16 +1066,16 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
$where .= ' AND tx_dlf_documents.tstamp>='.intval($_from);
$where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
}
// Check "until" for valid value.
if (!empty($this->piVars['until'])) {
if (is_array($_until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($_until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
$_until = gmmktime($_until['tm_hour'], $_until['tm_min'], $_until['tm_sec'], $_until['tm_mon'] + 1, $_until['tm_mday'], $_until['tm_year'] + 1900);
$until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
} else {
@ -1058,13 +1083,13 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
if (!empty($_from) && $_from > $_until) {
if (!empty($from) && $from > $until) {
return $this->error('badArgument');
}
$where .= ' AND tx_dlf_documents.tstamp<='.intval($_until);
$where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
}
@ -1223,7 +1248,11 @@ class tx_dlf_oai extends tx_dlf_plugin {
} else {
trigger_error('Could not create resumption token', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->verbListIdentifiers()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}
@ -1369,32 +1398,32 @@ class tx_dlf_oai extends tx_dlf_plugin {
if (!empty($this->piVars['set'])) {
// Get set information.
$_additionalWhere = '';
$additionalWhere = '';
if (!$this->conf['show_userdefined']) {
$_additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
}
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_collections.uid AS uid',
'tx_dlf_collections',
'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$_additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'], 'tx_dlf_collections').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_collections'),
'',
'',
'1'
);
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($_result)) {
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
return $this->error('noSetHierarchy');
} else {
$_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$where .= ' AND tx_dlf_collections.uid='.intval($_resArray['uid']);
$where .= ' AND tx_dlf_collections.uid='.intval($resArray['uid']);
}
@ -1403,9 +1432,9 @@ class tx_dlf_oai extends tx_dlf_plugin {
// Check "from" for valid value.
if (!empty($this->piVars['from'])) {
if (is_array($_from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($_from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
if (is_array($from = strptime($this->piVars['from'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($from = strptime($this->piVars['from'], '%Y-%m-%d'))) {
$_from = gmmktime($_from['tm_hour'], $_from['tm_min'], $_from['tm_sec'], $_from['tm_mon'] + 1, $_from['tm_mday'], $_from['tm_year'] + 1900);
$from = gmmktime($from['tm_hour'], $from['tm_min'], $from['tm_sec'], $from['tm_mon'] + 1, $from['tm_mday'], $from['tm_year'] + 1900);
} else {
@ -1413,16 +1442,16 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
$where .= ' AND tx_dlf_documents.tstamp>='.intval($_from);
$where .= ' AND tx_dlf_documents.tstamp>='.intval($from);
}
// Check "until" for valid value.
if (!empty($this->piVars['until'])) {
if (is_array($_until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($_until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
if (is_array($until = strptime($this->piVars['until'], '%Y-%m-%dT%H:%M:%SZ')) || is_array($until = strptime($this->piVars['until'], '%Y-%m-%d'))) {
$_until = gmmktime($_until['tm_hour'], $_until['tm_min'], $_until['tm_sec'], $_until['tm_mon'] + 1, $_until['tm_mday'], $_until['tm_year'] + 1900);
$until = gmmktime($until['tm_hour'], $until['tm_min'], $until['tm_sec'], $until['tm_mon'] + 1, $until['tm_mday'], $until['tm_year'] + 1900);
} else {
@ -1430,13 +1459,13 @@ class tx_dlf_oai extends tx_dlf_plugin {
}
if (!empty($_from) && $_from > $_until) {
if (!empty($from) && $from > $until) {
return $this->error('badArgument');
}
$where .= ' AND tx_dlf_documents.tstamp<='.intval($_until);
$where .= ' AND tx_dlf_documents.tstamp<='.intval($until);
}
@ -1624,7 +1653,11 @@ class tx_dlf_oai extends tx_dlf_plugin {
} else {
trigger_error('Could not create resumption token', E_USER_ERROR);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_oai->verbListRecords()] Could not create resumption token', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
}

View File

@ -54,11 +54,11 @@ class tx_dlf_pageview extends tx_dlf_plugin {
// Add localization file for OpenLayers.
if ($GLOBALS['TSFE']->lang) {
$_langFile = t3lib_extMgm::siteRelPath($this->extKey).'lib/OpenLayers/lib/OpenLayers/Lang/'.strtolower($GLOBALS['TSFE']->lang).'.js';
$langFile = t3lib_extMgm::siteRelPath($this->extKey).'lib/OpenLayers/lib/OpenLayers/Lang/'.strtolower($GLOBALS['TSFE']->lang).'.js';
if (file_exists($_langFile)) {
if (file_exists($langFile)) {
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_olJS_lang'] = ' <script type="text/javascript" src="'.$_langFile.'"></script>';
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_olJS_lang'] = ' <script type="text/javascript" src="'.$langFile.'"></script>';
}
@ -82,6 +82,9 @@ class tx_dlf_pageview extends tx_dlf_plugin {
*/
protected function getImageData($page = 0) {
// Save parameter for logging purposes.
$_page = $page;
// Cast to integer for security reasons.
$page = intval($page);
@ -94,32 +97,36 @@ class tx_dlf_pageview extends tx_dlf_plugin {
$imageData = array ();
$_fileGrps = t3lib_div::trimExplode(',', $this->conf['fileGrps']);
$fileGrps = t3lib_div::trimExplode(',', $this->conf['fileGrps']);
foreach ($_fileGrps as $_fileGrp) {
foreach ($fileGrps as $fileGrp) {
$_fileGrp = strtolower($_fileGrp);
$fileGrp = strtolower($fileGrp);
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$_fileGrp])) {
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp])) {
$_fileGrpUrl = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$_fileGrp]);
$fileGrpUrl = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp]);
// Check file's existence.
$_headers = @get_headers($_fileGrpUrl);
$headers = @get_headers($fileGrpUrl);
if (is_array($_headers) && preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/', $_headers[0])) {
if (is_array($headers) && preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/', $headers[0])) {
$_fileGrpSize = getimagesize($_fileGrpUrl);
$fileGrpSize = getimagesize($fileGrpUrl);
$imageData[] = array (
'width' => $_fileGrpSize[0],
'height' => $_fileGrpSize[1],
'url' => $_fileGrpUrl
'width' => $fileGrpSize[0],
'height' => $fileGrpSize[1],
'url' => $fileGrpUrl
);
} else {
trigger_error('File "'.$_fileGrpUrl.'" not found', E_USER_WARNING);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_pageview->getImageData('.$_page.')] File not found: "'.$fileGrpUrl.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
}

View File

@ -128,7 +128,11 @@ class tx_dlf_search extends tx_dlf_plugin {
// Quit without doing anything if required variables are not set.
if (empty($this->conf['solrcore'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
@ -153,11 +157,11 @@ class tx_dlf_search extends tx_dlf_plugin {
// Set last query if applicable.
$lastQuery = '';
$_list = t3lib_div::makeInstance('tx_dlf_list');
$list = t3lib_div::makeInstance('tx_dlf_list');
if (!empty($_list->metadata['options']['source']) && $_list->metadata['options']['source'] == 'search') {
if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'search') {
$lastQuery = $_list->metadata['options']['select'];
$lastQuery = $list->metadata['options']['select'];
}
@ -190,10 +194,8 @@ class tx_dlf_search extends tx_dlf_plugin {
$numHits = count($query->response->docs);
$_list = array ();
// Set metadata for search.
$_metadata = array (
$listMetadata = array (
'label' => htmlspecialchars(sprintf($this->pi_getLL('searchfor', ''), $this->piVars['query'])),
'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $numHits)).'</p>',
'options' => array (
@ -210,7 +212,7 @@ class tx_dlf_search extends tx_dlf_plugin {
// Get metadata configuration.
if ($numHits) {
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.tokenized AS tokenized,tx_dlf_metadata.indexed AS indexed,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable',
'tx_dlf_metadata',
'(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
@ -223,7 +225,7 @@ class tx_dlf_search extends tx_dlf_plugin {
$sorting = array ();
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if ($resArray['is_listed']) {
@ -395,7 +397,7 @@ class tx_dlf_search extends tx_dlf_plugin {
$list->add(array_values($toplevel));
$list->metadata = $_metadata;
$list->metadata = $listMetadata;
$list->save();

View File

@ -56,7 +56,11 @@ class tx_dlf_statistics extends tx_dlf_plugin {
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;

View File

@ -157,7 +157,11 @@ class tx_dlf_toc extends tx_dlf_plugin {
// Check for typoscript configuration to prevent fatal error.
if (empty($this->conf['menuConf.'])) {
trigger_error('No typoscript configuration for table of contents available', E_USER_NOTICE);
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
return $content;
@ -174,15 +178,15 @@ class tx_dlf_toc extends tx_dlf_plugin {
}
$_TSconfig = array ();
$TSconfig = array ();
$_TSconfig['special'] = 'userfunction';
$TSconfig['special'] = 'userfunction';
$_TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray';
$TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray';
$_TSconfig = t3lib_div::array_merge_recursive_overrule($this->conf['menuConf.'], $_TSconfig);
$TSconfig = t3lib_div::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig);
$markerArray['###TOCMENU###'] = $this->cObj->HMENU($_TSconfig);
$markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig);
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);

View File

@ -79,7 +79,7 @@ class tx_dlf_toolbox extends tx_dlf_plugin {
if (t3lib_div::testInt($this->piVars['id'])) {
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'tx_dlf_documents',
'tx_dlf_documents.uid='.intval($this->piVars['id']).tx_dlf_helper::whereClause('tx_dlf_documents'),
@ -88,15 +88,15 @@ class tx_dlf_toolbox extends tx_dlf_plugin {
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
$data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result);
$data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
}
} else {
// TODO: "data"-Array bei externen METS-Dateien selbst bauen.
// TODO: Build data array "by hand" for external METS files.
}
@ -105,18 +105,18 @@ class tx_dlf_toolbox extends tx_dlf_plugin {
if (!empty($data)) {
$_tools = explode(',', $this->conf['tools']);
$tools = explode(',', $this->conf['tools']);
// Add the tools to the toolbox.
foreach ($_tools as $_tool) {
foreach ($tools as $tool) {
$_tool = trim($_tool);
$tool = trim($tool);
$cObj = t3lib_div::makeInstance('tslib_cObj');
$cObj->data = $data;
$content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$_tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$_tool.'.'])));
$content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool.'.'])));
}

View File

@ -634,13 +634,6 @@ $TCA['tx_dlf_formats'] = array (
'eval' => 'required,nospace,alphanum_x,unique',
),
),
'other_type' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.other_type',
'config' => array (
'type' => 'check',
'default' => 0,
),
),
'root' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.root',
'config' => array (
@ -670,7 +663,7 @@ $TCA['tx_dlf_formats'] = array (
),
),
'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, other, root;;;;2-2-2, namespace, class;;;;3-3-3'),
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, root;;;;2-2-2, namespace, class;;;;3-3-3'),
),
'palettes' => array (
'1' => array ('showitem' => ''),