Typo in cron for profile modifications
[platal.git] / classes / userfilter.php
index c297055..14e9557 100644 (file)
@@ -414,7 +414,7 @@ class UFC_NameTokens implements UserFilterCondition
         foreach ($this->tokens as $i => $token) {
             $sub = $uf->addNameTokensFilter($token);
             if ($this->soundex) {
-                $c = XDB::format($sub . '.soundex = {?}', $token);
+                $c = XDB::format($sub . '.soundex = {?}', soundex_fr($token));
             } else if ($this->exact) {
                 $c = XDB::format($sub . '.token = {?}', $token);
             } else {
@@ -609,7 +609,7 @@ class UFC_Group implements UserFilterCondition
     {
         // Groups have AX visibility.
         if ($uf->getVisibilityLevel() == ProfileVisibility::VIS_PUBLIC) {
-            return PlFilter::COND_TRUE;
+            return self::COND_TRUE;
         }
         $sub = $uf->addGroupFilter($this->group);
         $where = 'gpm' . $sub . '.perms IS NOT NULL';
@@ -638,7 +638,7 @@ class UFC_Binet implements UserFilterCondition
     {
         // Binets are private.
         if ($uf->getVisibilityLevel() != ProfileVisibility::VIS_PRIVATE) {
-            return PlFilter::COND_TRUE;
+            return self::CONF_TRUE;
         }
         $sub = $uf->addBinetsFilter();
         return XDB::format($sub . '.binet_id IN {?}', $this->val);
@@ -663,7 +663,7 @@ class UFC_Section implements UserFilterCondition
     {
         // Sections are private.
         if ($uf->getVisibilityLevel() != ProfileVisibility::VIS_PRIVATE) {
-            return PlFilter::COND_TRUE;
+            return self::CONF_TRUE;
         }
         $uf->requireProfiles();
         return XDB::format('p.section IN {?}', $this->section);
@@ -1072,7 +1072,7 @@ class UFC_Job_Description implements UserFilterCondition
         // don't do anything. Otherwise restrict to standard job visibility.
         if ($this->fields == UserFilter::JOB_CV) {
            if ($uf->getVisibilityLevel() != ProfileVisibility::VIS_PRIVATE) {
-               return PlFilter::COND_TRUE;
+               return self::CONF_TRUE;
            }
         } else {
             $conds[] = $uf->getVisibilityCondition($jsub . '.pub');
@@ -1081,7 +1081,7 @@ class UFC_Job_Description implements UserFilterCondition
         if ($this->fields & UserFilter::JOB_USERDEFINED) {
             $conds[] = $jsub . '.description ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
         }
-        if ($this->fields & UserFilter::JOB_CV && $uf->getVisibilityLevel == ProfileVisibility::VIS_PRIVATE) {
+        if ($this->fields & UserFilter::JOB_CV && $uf->getVisibilityLevel() == ProfileVisibility::VIS_PRIVATE) {
             $uf->requireProfiles();
             $conds[] = 'p.cv ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->description);
         }
@@ -1777,10 +1777,10 @@ class UserFilter extends PlFilter
         $this->buildQuery();
         $token = $this->grouper->getGroupToken($this);
 
-        $groups = XDB::fetchAllRow('SELECT ' . $token . ', COUNT(a.uid)
-                                   ' . $this->query . '
-                                   GROUP BY  ' . $token,
-                                   0);
+        $groups = XDB::rawFetchAllRow('SELECT ' . $token . ', COUNT(a.uid)
+                                      ' . $this->query . '
+                                      GROUP BY  ' . $token,
+                                      0);
         return $groups;
     }
 
@@ -1790,10 +1790,10 @@ class UserFilter extends PlFilter
         $this->buildQuery();
         $token = $this->grouper->getGroupToken($this);
 
-        $groups = XDB::fetchAllRow('SELECT ' . $token . ', COUNT(p.pid)
-                                   ' . $this->query . '
-                                   GROUP BY  ' . $token,
-                                   0);
+        $groups = XDB::rawFetchAllRow('SELECT ' . $token . ', COUNT(p.pid)
+                                      ' . $this->query . '
+                                      GROUP BY  ' . $token,
+                                      0);
         return $groups;
     }
 
@@ -1806,11 +1806,11 @@ class UserFilter extends PlFilter
         if (!empty($uids)) {
             $cond = XDB::format(' AND a.uid IN {?}', $uids);
         }
-        $fetched = XDB::fetchColumn('SELECT SQL_CALC_FOUND_ROWS  a.uid
-                                    ' . $this->query . $cond . '
-                                   GROUP BY  a.uid
-                                    ' . $this->orderby . '
-                                    ' . $lim);
+        $fetched = XDB::rawFetchColumn('SELECT SQL_CALC_FOUND_ROWS  a.uid
+                                       ' . $this->query . $cond . '
+                                       GROUP BY  a.uid
+                                       ' . $this->orderby . '
+                                       ' . $lim);
         $this->lastusercount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
         return $fetched;
     }
@@ -1824,11 +1824,11 @@ class UserFilter extends PlFilter
         if (!is_null($pids)) {
             $cond = XDB::format(' AND p.pid IN {?}', $pids);
         }
-        $fetched = XDB::fetchColumn('SELECT  SQL_CALC_FOUND_ROWS  p.pid
-                                    ' . $this->query . $cond . '
-                                   GROUP BY  p.pid
-                                    ' . $this->orderby . '
-                                    ' . $lim);
+        $fetched = XDB::rawFetchColumn('SELECT  SQL_CALC_FOUND_ROWS  p.pid
+                                       ' . $this->query . $cond . '
+                                       GROUP BY  p.pid
+                                       ' . $this->orderby . '
+                                       ' . $lim);
         $this->lastprofilecount = (int)XDB::fetchOneCell('SELECT FOUND_ROWS()');
         return $fetched;
     }
@@ -1847,8 +1847,9 @@ class UserFilter extends PlFilter
     {
         $this->requireAccounts();
         $this->buildQuery();
-        $count = (int)XDB::fetchOneCell('SELECT  COUNT(*)
-                                        ' . $this->query . XDB::format(' AND a.uid = {?}', $user->id()));
+        $count = (int)XDB::rawFetchOneCell('SELECT  COUNT(*)
+                                           ' . $this->query
+                                             . XDB::format(' AND a.uid = {?}', $user->id()));
         return $count == 1;
     }
 
@@ -1858,8 +1859,9 @@ class UserFilter extends PlFilter
     {
         $this->requireProfiles();
         $this->buildQuery();
-        $count = (int)XDB::fetchOneCell('SELECT  COUNT(*)
-                                        ' . $this->query . XDB::format(' AND p.pid = {?}', $profile->id()));
+        $count = (int)XDB::rawFetchOneCell('SELECT  COUNT(*)
+                                           ' . $this->query
+                                             . XDB::format(' AND p.pid = {?}', $profile->id()));
         return $count == 1;
     }
 
@@ -2010,7 +2012,7 @@ class UserFilter extends PlFilter
         if (is_null($this->lastusercount)) {
             $this->requireAccounts();
             $this->buildQuery();
-            return (int)XDB::fetchOneCell('SELECT  COUNT(DISTINCT a.uid)
+            return (int)XDB::rawFetchOneCell('SELECT  COUNT(DISTINCT a.uid)
                                           ' . $this->query);
         } else {
             return $this->lastusercount;
@@ -2022,7 +2024,7 @@ class UserFilter extends PlFilter
         if (is_null($this->lastprofilecount)) {
             $this->requireProfiles();
             $this->buildQuery();
-            return (int)XDB::fetchOneCell('SELECT  COUNT(DISTINCT p.pid)
+            return (int)XDB::rawFetchOneCell('SELECT  COUNT(DISTINCT p.pid)
                                           ' . $this->query);
         } else {
             return $this->lastprofilecount;