Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
MetaComments: Fix comments inheritance when filenames are similar (e.…
Browse files Browse the repository at this point in the history
…g; doc / docx)
  • Loading branch information
cdujeu committed Sep 8, 2014
1 parent 7c48d24 commit 1aba7b5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
17 changes: 12 additions & 5 deletions core/src/plugins/feed.sql/class.AJXP_SqlFeedStore.php
Expand Up @@ -281,15 +281,22 @@ public function persistMetaObject($indexPath, $data, $repositoryId, $repositoryS
}
}

public function findMetaObjectsByIndexPath($repositoryId, $indexPath, $userId, $userGroup, $offset = 0, $limit = 20, $orderBy = "date", $orderDir = "desc")
public function findMetaObjectsByIndexPath($repositoryId, $indexPath, $userId, $userGroup, $offset = 0, $limit = 20, $orderBy = "date", $orderDir = "desc", $recurring = true)
{
if($this->sqlDriver["password"] == "XXXX") return array();
require_once(AJXP_BIN_FOLDER."/dibi.compact.php");
dibi::connect($this->sqlDriver);
$res = dibi::query("SELECT * FROM [ajxp_feed]
WHERE [etype] = %s AND [repository_id] = %s AND [index_path] LIKE %like~
ORDER BY %by %lmt %ofs
", "meta", $repositoryId, $indexPath, array('edate' => $orderDir), $limit, $offset);
if($recurring){
$res = dibi::query("SELECT * FROM [ajxp_feed]
WHERE [etype] = %s AND [repository_id] = %s AND [index_path] LIKE %like~
ORDER BY %by %lmt %ofs
", "meta", $repositoryId, $indexPath, array('edate' => $orderDir), $limit, $offset);
}else{
$res = dibi::query("SELECT * FROM [ajxp_feed]
WHERE [etype] = %s AND [repository_id] = %s AND [index_path] = %s
ORDER BY %by %lmt %ofs
", "meta", $repositoryId, $indexPath, array('edate' => $orderDir), $limit, $offset);
}

$data = array();
foreach ($res as $n => $row) {
Expand Down
13 changes: 12 additions & 1 deletion core/src/plugins/meta.comments/class.CommentsMetaManager.php
Expand Up @@ -146,7 +146,18 @@ public function switchActions($actionName, $httpVars, $fileVars)
$sortDir = isSet($httpVars["sort_dir"])?AJXP_Utils::decodeSecureMagic($httpVars["sort_dir"]):"asc";
$offset = isSet($httpVars["offset"]) ? intval($httpVars["offset"]) : 0;
$limit = isSet($httpVars["limit"]) ? intval($httpVars["limit"]) : 100;
$data = $feedStore->findMetaObjectsByIndexPath($this->accessDriver->repository->getId(), $uniqNode->getPath(), AuthService::getLoggedUser()->getId(), AuthService::getLoggedUser()->getGroupPath(), $offset, $limit, $sortBy, $sortDir);
$uniqNode->loadNodeInfo();
$data = $feedStore->findMetaObjectsByIndexPath(
$this->accessDriver->repository->getId(),
$uniqNode->getPath(),
AuthService::getLoggedUser()->getId(),
AuthService::getLoggedUser()->getGroupPath(),
$offset,
$limit,
$sortBy,
$sortDir,
!$uniqNode->isLeaf()
);
$theFeed = array();
foreach ($data as $stdObject) {
$rPath = substr($stdObject->path, strlen($uniqNode->getPath()));
Expand Down

0 comments on commit 1aba7b5

Please sign in to comment.