]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
Features to src
[friendica.git] / mod / search.php
index 1d28fe141ac6a15642176ee3f6f473579eae43c7..3d9236055392105cffa59af17c32f225e4dc1d29 100644 (file)
@@ -1,24 +1,30 @@
 <?php
-
+/**
+ * @file mod/search.php
+ */
 use Friendica\App;
+use Friendica\Content\Features;
+use Friendica\Core\Cache;
+use Friendica\Core\Config;
+use Friendica\Database\DBM;
 
-require_once("include/bbcode.php");
-require_once('include/security.php');
-require_once('include/conversation.php');
-require_once('mod/dirfind.php');
+require_once "include/bbcode.php";
+require_once 'include/security.php';
+require_once 'include/conversation.php';
+require_once 'mod/dirfind.php';
 
 function search_saved_searches() {
 
        $o = '';
 
-       if (! feature_enabled(local_user(),'savedsearch'))
+       if (! Features::isEnabled(local_user(),'savedsearch'))
                return $o;
 
        $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",
                intval(local_user())
        );
 
-       if (dbm::is_result($r)) {
+       if (DBM::is_result($r)) {
                $saved = array();
                foreach ($r as $rr) {
                        $saved[] = array(
@@ -56,7 +62,7 @@ function search_init(App $a) {
                                intval(local_user()),
                                dbesc($search)
                        );
-                       if (!dbm::is_result($r)) {
+                       if (!DBM::is_result($r)) {
                                dba::insert('search', array('uid' => local_user(), 'term' => $search));
                        }
                }
@@ -85,12 +91,12 @@ function search_post(App $a) {
 
 function search_content(App $a) {
 
-       if (get_config('system','block_public') && !local_user() && !remote_user()) {
+       if (Config::get('system','block_public') && !local_user() && !remote_user()) {
                notice(t('Public access denied.') . EOL);
                return;
        }
 
-       if (get_config('system','local_search') && !local_user() && !remote_user()) {
+       if (Config::get('system','local_search') && !local_user() && !remote_user()) {
                http_status_exit(403,
                                array("title" => t("Public access denied."),
                                        "description" => t("Only logged in users are permitted to perform a search.")));
@@ -99,15 +105,15 @@ function search_content(App $a) {
                //return;
        }
 
-       if (get_config('system','permit_crawling') && !local_user() && !remote_user()) {
+       if (Config::get('system','permit_crawling') && !local_user() && !remote_user()) {
                // Default values:
                // 10 requests are "free", after the 11th only a call per minute is allowed
 
-               $free_crawls = intval(get_config('system','free_crawls'));
+               $free_crawls = intval(Config::get('system','free_crawls'));
                if ($free_crawls == 0)
                        $free_crawls = 10;
 
-               $crawl_permit_period = intval(get_config('system','crawl_permit_period'));
+               $crawl_permit_period = intval(Config::get('system','crawl_permit_period'));
                if ($crawl_permit_period == 0)
                        $crawl_permit_period = 10;
 
@@ -176,7 +182,7 @@ function search_content(App $a) {
        if (! $search)
                return $o;
 
-       if (get_config('system','only_tag_search'))
+       if (Config::get('system','only_tag_search'))
                $tag = true;
 
        // Here is the way permissions work in the search module...
@@ -211,7 +217,7 @@ function search_content(App $a) {
                                intval($a->pager['start']), intval($a->pager['itemspage']));
        }
 
-       if (! dbm::is_result($r)) {
+       if (! DBM::is_result($r)) {
                info( t('No results.') . EOL);
                return $o;
        }