packages: phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec, phorum-mo...
glen
glen at pld-linux.org
Wed Jul 14 18:35:50 CEST 2010
Author: glen Date: Wed Jul 14 16:35:50 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- fix forum_id filter, closes also restriction skip on THISONE filter (i did not check acl)
---- Files affected:
packages/phorum-mod-sphinx_search:
phorum-mod-sphinx_search.spec (1.11 -> 1.12) , forum_id-filter.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec
diff -u packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec:1.11 packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec:1.12
--- packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec:1.11 Wed Jul 14 18:34:55 2010
+++ packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec Wed Jul 14 18:35:45 2010
@@ -20,6 +20,7 @@
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
@@ -60,6 +61,7 @@
%patch4 -p1
%patch5 -p1
%patch6 -p1
+%patch7 -p1
# php-sphinx
rm sphinxclient.php
@@ -88,6 +90,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.12 2010/07/14 16:35:45 glen
+- fix forum_id filter, closes also restriction skip on THISONE filter (i did not check acl)
+
Revision 1.11 2010/07/14 16:34:55 glen
- fix sphinx api
================================================================
Index: packages/phorum-mod-sphinx_search/forum_id-filter.patch
diff -u /dev/null packages/phorum-mod-sphinx_search/forum_id-filter.patch:1.1
--- /dev/null Wed Jul 14 18:35:50 2010
+++ packages/phorum-mod-sphinx_search/forum_id-filter.patch Wed Jul 14 18:35:45 2010
@@ -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");
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/phorum-mod-sphinx_search/phorum-mod-sphinx_search.spec?r1=1.11&r2=1.12&f=u
More information about the pld-cvs-commit
mailing list