1.x - Chizra
* Config change: Added new entry. See upgrade/from-version-1.5.txt. It won't work if it is missing.
* Config change: Added new theme config. See upgrade/from-version-1.5.txt. It won't work if it is missing.
+ * Added: #6 Feature: Duplicate search
+ This is a very limited like search based on the title field. Needs improvement and better search data.
* Licence change to GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
- * Cleanups
* Fixed: #21 Debug? string in error log
* Fixed: #22 98 theme. Attachment selection checkbox are not all selectable
* Fixed: #26 98 theme. max column with
* Fixed: #23 basic search result order
* Fixed: Bulkedit in 98 theme and default
* Fixed: #24 Image upload. Automatic resize?
+ * Cleanups
1.5 - Sacred Passage 2023-05-01
* Added google books parser. See upgrade file for more infos.
+* change the search data. Maybe an extra search field in which all the searchable information of an entry will be
+ saved.
* change multiple-attachment to a field which tells it is used for a image gallery
* update JS and remove deprecations
* complete profile view. Groups still missing.
return $ret;
}
+ /**
+ * Check for duplicates based on the given entryData.
+ * Could be extended to use more attributes from the entry
+ * Currently uses the title field, which is a hard dependency
+ *
+ * @param array $entryData
+ * @return array
+ */
+ public function checkForDuplicates(array $entryData): array {
+ $ret = array();
+
+ $queryStr = "SELECT `id`, `title`
+ FROM `".DB_PREFIX."_collection_entry_".$this->_collectionId."`
+ WHERE `title` LIKE '".$this->_DB->real_escape_string($entryData['title'])."%'
+ AND `id` != '".$this->_DB->real_escape_string($entryData['id'])."'
+ AND ".$this->_User->getSQLRightsString()."";
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
+ try {
+ $query = $this->_DB->query($queryStr);
+ if ($query !== false && $query->num_rows > 0) {
+ if (($row = $query->fetch_assoc()) != false) {
+ $ret[] = $row;
+ }
+ }
+ }
+ catch (Exception $e) {
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ }
+
+ return $ret;
+ }
+
/**
* Check if given entryid can be deleted from current collection
* and user
private function _saveField_upload__coverimage(array $data, array $queryData): array {
$queryData = $this->_saveField_upload($data, $queryData);
+ if(!isset($queryData['after']['upload'])) {
+ return $queryData;
+ }
+
$workWith = $queryData['after']['upload'][0]['tmp_name'];
if(file_exists($workWith)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
<p>
<a href="index.php?p=entry&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&id=<?php echo $TemplateData['editData']['id']; ?>">View entry</a>
</p>
+<?php if(!empty($TemplateData['possibleDuplicates'])) { ?>
+Possible duplicate
+<ul>
+ <?php
+ foreach($TemplateData['possibleDuplicates'] as $key=>$entry) {
+ echo '<li><a href="index.php?p=entry&collection='.$TemplateData['loadedCollection']['id'].'&id='.$entry['id'].'" target="_blank">'.$entry['title'].'</a></li>';
+ }
+ ?>
+</ul>
+<?php } ?>
<?php } else { ?>
<h3>Add an entry to: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
<?php } ?>
<span uk-icon="arrow-left"></span>
<a href="index.php?p=entry&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>&id=<?php echo $TemplateData['editData']['id']; ?>">View entry</a>
</p>
+<?php if(!empty($TemplateData['possibleDuplicates'])) { ?>
+Possible duplicate
+<ul>
+ <?php
+ foreach($TemplateData['possibleDuplicates'] as $key=>$entry) {
+ echo '<li><a href="index.php?p=entry&collection='.$TemplateData['loadedCollection']['id'].'&id='.$entry['id'].'" target="_blank">'.$entry['title'].'</a></li>';
+ }
+ ?>
+</ul>
+<?php } ?>
<?php } else { ?>
<h3 class="uk-h3">Add an entry to: <a href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>"><?php echo $TemplateData['loadedCollection']['name']; ?></a></h3>
<?php } ?>
$TemplateData['loadedCollection'] = '';
$TemplateData['storagePath'] = '';
$TemplateData['existingCollections'] = array();
+$TemplateData['possibleDuplicates'] = array();
$TemplateData['_editFieldViewDefault'] = Summoner::themefile('manageentry/field-unknown.html', UI_THEME);
}
else {
$TemplateData['pageTitle'] = 'Edit - '.$TemplateData['editData']['title'].' - '.$Trite->param('name');
+ $TemplateData['possibleDuplicates'] = $ManageEntry->checkForDuplicates($TemplateData['editData']);
}
}