From: Banana Date: Sun, 21 Mar 2021 10:31:58 +0000 (+0100) Subject: fixing bug #10. URL is now in the search index. X-Git-Tag: 2.6_2021-03-21^2 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F11%2Fhead;p=insipid.git fixing bug #10. URL is now in the search index. --- diff --git a/ChangeLog b/ChangeLog index 79aaf00..d9cf500 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ version 2.6 - Hypostyle + Fixed sql problems with Maria DB. Any_value is not supported there + Fixed some query and data loading brain fucks.. + + Fixed #10. URL is now considered when building search information. + Update search index from stats view to update all the exiting information + Updated third party information in readme + Fixed xml import xsd + Added translation support. More information in translation.txt diff --git a/TODO b/TODO index bcc5912..6f07b65 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,9 @@ TODO / Feature list + adapt new php 7 ++ http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op - ++ view table really still needed? + stats cleanup. Management functions should be standalone + theme support + more "secure" user authentication ++ multiple user accounts and stuff + combine cat and tag class into one. -+ view really still needed? diff --git a/documentation/update.txt b/documentation/update.txt index 30b5ec6..10d2e69 100644 --- a/documentation/update.txt +++ b/documentation/update.txt @@ -5,6 +5,7 @@ the version your are updating from is done. + Update config file with the new language setting. See config.default and translation.txt for more information ++ Run update search index to use the URL within the search index for your existing data. ## version 2.5 - Winnowing Hall diff --git a/webroot/job/email-import.php b/webroot/job/email-import.php index f7db1b6..e786269 100644 --- a/webroot/job/email-import.php +++ b/webroot/job/email-import.php @@ -155,7 +155,6 @@ if(!empty($emails)) { $newdata['title'] = ''; $newdata['image'] = ''; $newdata['status'] = '3'; # moderation required - $newdata['search'] = ''; $newdata['tagArr'] = array(); $newdata['catArr'] = array(); $newdata['hash'] = ''; @@ -199,13 +198,6 @@ if(!empty($emails)) { continue; } - $newdata['search'] = $newdata['title']; - $newdata['search'] .= ' '.$newdata['description']; - $newdata['search'] .= ' '.implode(" ",$newdata['tagArr']); - $newdata['search'] .= ' '.implode(" ",$newdata['catArr']); - $newdata['search'] = trim($newdata['search']); - $newdata['search'] = strtolower($newdata['search']); - if(DEBUG === true) var_dump($newdata); $linkObj = new Link($DB); @@ -225,12 +217,13 @@ if(!empty($emails)) { try { $linkID = $linkObj->create(array( 'hash' => $newdata['hash'], - 'search' => $newdata['search'], 'link' => $newdata['link'], 'status' => $newdata['status'], 'description' => $newdata['description'], 'title' => $newdata['title'], - 'image' => $newdata['image'] + 'image' => $newdata['image'], + 'tagArr' => $newdata['tagArr'], + 'catArr' => $newdata['catArr'] ), true); } catch (Exception $e) { $_m = "WARN Can not create new link into DB." . $e->getMessage(); diff --git a/webroot/lib/link.class.php b/webroot/lib/link.class.php index aa823f0..5c99e50 100644 --- a/webroot/lib/link.class.php +++ b/webroot/lib/link.class.php @@ -158,6 +158,16 @@ class Link { if (!isset($data['hash']) || empty($data['hash'])) return false; if (!isset($data['title']) || empty($data['title'])) return false; + $_t = parse_url($data['link']); + $data['search'] = $data['title']; + $data['search'] .= ' '.$data['description']; + $data['search'] .= ' '.implode(" ",$data['tagArr']); + $data['search'] .= ' '.implode(" ",$data['catArr']); + $data['search'] .= ' '.$_t['host']; + $data['search'] .= ' '.implode(' ',explode('/',$_t['path'])); + $data['search'] = trim($data['search']); + $data['search'] = strtolower($data['search']); + $queryStr = "INSERT INTO `" . DB_PREFIX . "_link` SET `link` = '" . $this->DB->real_escape_string($data['link']) . "', `created` = NOW(), @@ -181,6 +191,7 @@ class Link { /** * update the current loaded link with the given data + * * @param array $data * @return boolean|int */ @@ -194,10 +205,13 @@ class Link { $catArr = Summoner::prepareTagOrCategoryStr($data['category']); $tagArr = Summoner::prepareTagOrCategoryStr($data['tag']); + $_t = parse_url($this->_data['link']); $search = $data['title']; $search .= ' '.$data['description']; $search .= ' '.implode(" ", $tagArr); $search .= ' '.implode(" ", $catArr); + $search .= ' '.$_t['host']; + $search .= ' '.implode(' ',explode('/',$_t['path'])); $search = trim($search); $search = strtolower($search); diff --git a/webroot/lib/management.class.php b/webroot/lib/management.class.php index e269354..a609fff 100644 --- a/webroot/lib/management.class.php +++ b/webroot/lib/management.class.php @@ -686,10 +686,13 @@ class Management { $LinkObj = new Link($this->DB); $l = $LinkObj->load($link['hash']); + $_t = parse_url($l['link']); $searchStr = $l['title']; $searchStr .= ' '.$l['description']; $searchStr .= ' '.implode(' ',$l['tags']); $searchStr .= ' '.implode(' ',$l['categories']); + $searchStr .= ' '.$_t['host']; + $searchStr .= ' '.implode(' ',explode('/',$_t['path'])); $searchStr = trim($searchStr); $searchStr = strtolower($searchStr); @@ -759,7 +762,6 @@ class Management { 'status' => $linkToImport['private'], 'description' => $linkToImport['description'], 'title' => $linkToImport['title'], - 'search' => '', 'image' => $linkToImport['image'] ), true); } catch (Exception $e) { diff --git a/webroot/view/home.inc.php b/webroot/view/home.inc.php index b67c7f9..463f4e8 100644 --- a/webroot/view/home.inc.php +++ b/webroot/view/home.inc.php @@ -125,24 +125,18 @@ if(isset($_POST['data']) && !empty($_POST['data']) && isset($_POST['addnewone']) $catArr = Summoner::prepareTagOrCategoryStr($formData['category']); $tagArr = Summoner::prepareTagOrCategoryStr($formData['tag']); - $search = $formData['title']; - $search .= ' '.$formData['description']; - $search .= ' '.implode(" ",$tagArr); - $search .= ' '.implode(" ",$catArr); - $search .= trim($search); - $search = strtolower($search); - $DB->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); $linkObj = new Link($DB); $linkID = $linkObj->create(array( 'hash' => $hash, - 'search' => $search, 'link' => $formData['url'], 'status' => $formData['private'], 'description' => $formData['description'], 'title' => $formData['title'], - 'image' => $formData['image'] + 'image' => $formData['image'], + 'tagArr' => $tagArr, + 'catArr' => $catArr ),true); if(!empty($linkID)) {