diff options
author | Elan Ruusamäe | 2010-07-14 16:35:45 (GMT) |
---|---|---|
committer | cvs2git | 2012-06-24 12:13:13 (GMT) |
commit | 74b685f96f6c0494040c2bcffe9bd243f82da217 (patch) | |
tree | 91b6853582000f1c527e4a835cfe46e44642e123 | |
parent | b090e810402e689fb4ff738dff8693ad0c6d5368 (diff) | |
download | phorum-mod-sphinx_search-74b685f96f6c0494040c2bcffe9bd243f82da217.zip phorum-mod-sphinx_search-74b685f96f6c0494040c2bcffe9bd243f82da217.tar.gz |
- fix forum_id filter, closes also restriction skip on THISONE filter (i did not check acl)
Changed files:
forum_id-filter.patch -> 1.1
phorum-mod-sphinx_search.spec -> 1.12
-rw-r--r-- | forum_id-filter.patch | 48 | ||||
-rw-r--r-- | phorum-mod-sphinx_search.spec | 2 |
2 files changed, 50 insertions, 0 deletions
diff --git a/forum_id-filter.patch b/forum_id-filter.patch new file mode 100644 index 0000000..dc4d38f --- /dev/null +++ b/forum_id-filter.patch @@ -0,0 +1,48 @@ +--- ./sphinx_search.php 2010-07-14 19:30:16.278208412 +0300 ++++ /usr/share/phorum/mods/sphinx_search/sphinx_search.php 2010-07-14 19:31:49.977588050 +0300 +@@ -66,23 +65,29 @@ + + } + +- // add the forum(s) to search +- if($arrSearch['match_forum'] == 'THISONE') { +- $forumid_clean = (int)$PHORUM['forum_id']; +- $sphinx->SetFilter ( "forum_id", array($forumid_clean) ); +- +- } else { +- +- // have to check what forums they can read first. +- // $allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ); +-// $allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ); +- $allowed_forums = phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, PHORUM_ACCESS_LIST); +- +- // if they are not allowed to search any forums, return the emtpy $arr; +- if(empty($allowed_forums) || ($PHORUM['forum_id']>0 && !in_array($PHORUM['forum_id'], $allowed_forums)) ) return $arr; ++ // Check what forums the active Phorum user can read. ++ $allowed_forums = phorum_api_user_check_access( ++ PHORUM_USER_ALLOW_READ, PHORUM_ACCESS_LIST ++ ); ++ ++ // If the user is not allowed to search any forum or the current ++ // active forum, then return the emtpy search results array. ++ if (empty($allowed_forums) || ($PHORUM['forum_id']>0 && !in_array($PHORUM['forum_id'], $allowed_forums))) { ++ return array('count' => 0, 'rows' => array()); ++ } + +- $sphinx->SetFilter ( "forum_id", $allowed_forums ); +- } ++ // Prepare forum_id restriction. ++ $search_forums = array(); ++ foreach (explode(',', $arrSearch['match_forum']) as $forum_id) { ++ if ($forum_id == 'ALL') { ++ $search_forums = $allowed_forums; ++ break; ++ } ++ if (isset($allowed_forums[$forum_id])) { ++ $search_forums[] = $forum_id; ++ } ++ } ++ $sphinx->SetFilter("forum_id", $search_forums); + + // set the sort-mode + $sphinx->SetSortMode(SPH_SORT_ATTR_DESC,"datestamp"); diff --git a/phorum-mod-sphinx_search.spec b/phorum-mod-sphinx_search.spec index 314b06f..32f73e0 100644 --- a/phorum-mod-sphinx_search.spec +++ b/phorum-mod-sphinx_search.spec @@ -19,6 +19,7 @@ Patch3: cleanup-junk.patch Patch4: doc-updates.patch Patch5: defaultport.patch Patch6: sphinx_api.patch +Patch7: forum_id-filter.patch URL: http://www.phorum.org/phorum5/read.php?62,136982,138325 BuildRequires: rpm-php-pearprov BuildRequires: rpmbuild(macros) >= 1.553 @@ -59,6 +60,7 @@ cp -a %{SOURCE3} . %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 # php-sphinx rm sphinxclient.php |