Issues (884)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

search.php (73 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * XOOPS global search
14
 *
15
 * @copyright       XOOPS Project https://xoops.org/
16
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
17
 * @package         core
18
 * @since           2.0.0
19
 * @author          Kazumi Ono (AKA onokazu)
20
 * @author          Taiwen Jiang <[email protected]>
21
 * @author          Edited by John Mordo (jlm69)
22
 * @version         $Id$
23
 */
24
25
use Xoops\Core\Request;
26
use Xoops\Core\Kernel\Handlers\XoopsUser;
27
28
include dirname(dirname(__DIR__)) . '/mainfile.php';
29
include_once __DIR__ . '/header.php';
30
include_once __DIR__ . '/include/common.php';
31
$alumni = Alumni::getInstance();
32
$search = Search::getInstance();
33
if (!$search->getConfig('enable_search')) {
34
    header('Location: ' . XOOPS_URL . '/index.php');
35
    exit();
36
}
37
38
$xoops = Xoops::getInstance();
39
40
$action  = Request::getCmd('action', 'search');
41
$query   = Request::getString('query', '');
42
$andor   = Request::getWord('andor', 'AND');
43
$mid     = Request::getInt('mid', 0);
44
$uid     = Request::getInt('uid', 0);
45
$start   = Request::getInt('start', 0);
46
$limit   = Request::getInt('start', 1000);
47
$by_cat  = Request::getInt('by_cat');
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
48
$mids    = Request::getArray('mids', []);
49
$xmid    = $xoops->module->getVar('mid');
50
$queries = [];
51
52
if ('results' === $action) {
53
    if ('' == $query && ('' == $by_cat)) {
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
54
        $xoops->redirect('index.php', 1, _MD_SEARCH_PLZENTER);
55
    }
56
} else {
57
    if ('showall' === $action) {
58
        if ('' == $query || empty($mid)) {
59
            $xoops->redirect('index.php', 1, _MD_SEARCH_PLZENTER);
60
        }
61
    } else {
62
        if ('showallbyuser' === $action) {
63
            if (empty($mid) || empty($uid)) {
64
                $xoops->redirect('index.php', 1, _MD_SEARCH_PLZENTER);
65
            }
66
        }
67
    }
68
}
69
70
$gperm_handler     = $xoops->getHandlerGroupPermission();
0 ignored issues
show
$gperm_handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
71
$available_modules = $gperm_handler->getItemIds('module_read', $xoops->getUserGroups());
0 ignored issues
show
$available_modules does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
72
$available_plugins = \Xoops\Module\Plugin::getPlugins('search');
0 ignored issues
show
$available_plugins does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
73
74
if ('search' === $action) {
75
    $xoops->header();
76
    /* @var $formHandler SearchSearchForm */
77
    $formHandler = $alumni->getForm(null, 'search');
78
    $form        = $formHandler->alumni_getSearchFrom($andor, $queries, $mids, $mid, $by_cat);
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
79
    $form->display();
80
    $xoops->footer();
81
}
82
if ('OR' !== $andor && 'exact' !== $andor && 'AND' !== $andor) {
83
    $andor = 'AND';
84
}
85
86
$ignored_queries = []; // holds kewords that are shorter than allowed minmum length
0 ignored issues
show
$ignored_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
87
$queries_pattern = [];
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
88
$myts            = \Xoops\Core\Text\Sanitizer::getInstance();
89
if ('showallbyuser' !== $action) {
90
    if ('exact' !== $andor) {
91
        $temp_queries = str_getcsv($query, ' ', '"');
0 ignored issues
show
$temp_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
92
        foreach ($temp_queries as $q) {
0 ignored issues
show
$temp_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
93
            $q = trim($q);
94
            if (mb_strlen($q) >= $search->getConfig('keyword_min')) {
95
                $queries[]         = $q;
96
                $queries_pattern[] = '~(' . $q . ')~sUi';
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
97
            } else {
98
                $ignored_queries[] = $q;
0 ignored issues
show
$ignored_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
99
            }
100
        }
101
        if (0 == count($queries) && ('' == $by_cat)) {
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
102
            $xoops->redirect('index.php', 2, sprintf(XoopsLocale::EF_KEYWORDS_MUST_BE_GREATER_THAN, $search->getConfig('keyword_min')));
103
        }
104
    } else {
105
        $query = trim($query);
106
        if (mb_strlen($query) < $search->getConfig('keyword_min')) {
107
            $xoops->redirect('index.php', 2, sprintf(XoopsLocale::EF_KEYWORDS_MUST_BE_GREATER_THAN, $search->getConfig('keyword_min')));
108
        }
109
        $queries           = [$query];
110
        $queries_pattern[] = '~(' . $query . ')~sUi';
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
111
    }
112
}
113
114
switch ($action) {
115
    case 'results':
116
        $module_handler = $xoops->getHandlerModule();
0 ignored issues
show
$module_handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
117
        $criteria       = new CriteriaCompo();
118
        $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN'));
0 ignored issues
show
$available_plugins does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
119
        $modules = $module_handler->getObjectsArray($criteria, true);
0 ignored issues
show
$module_handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
120
        if (empty($mids) || !is_array($mids)) {
121
            unset($mids);
122
            $mids = array_keys($modules);
123
        }
124
        $xoops->header('module:alumni/alumni_search.tpl');
125
        $nomatch = true;
126
        $xoops->tpl()->assign('search', true);
127
        $xoops->tpl()->assign('queries', $queries);
128
        $xoops->tpl()->assign('ignored_words', sprintf(XoopsLocale::F_KEYWORDS_SHORTER_THAN_WILL_BE_IGNORED, $search->getConfig('keyword_min')));
129
        $xoops->tpl()->assign('ignored_queries', $ignored_queries);
0 ignored issues
show
$ignored_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
130
131
        $modules_result = [];
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
132
        foreach ($mids as $mid) {
133
            $mid = (int)$mid;
134
            /* @var $module XoopsModule */
135
            $module = $modules[$xmid];
136
            /* @var $plugin SearchPluginInterface */
137
            $plugin      = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search');
138
            $all_results = $plugin->search($queries, $andor, $limit, 0, null);
0 ignored issues
show
$all_results does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
139
            $count2      = count($all_results);
0 ignored issues
show
$all_results does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
140
            $results     = $plugin->search($queries, $andor, 5, 0, null);
141
            $count       = count($results);
142
143
            $mid = $module->getVar('mid');
144
145
            $xoops->tpl()->assign('sr_showing', '');
146
            if ($count > 0) {
147
                $xoops->tpl()->assign('sr_showing', sprintf(XoopsLocale::F_SHOWING_RESULTS, $start + 1, $start + $count));
148
                $xoops->tpl()->assign('showing_of', AlumniLocale::OF . "$count2");
149
            }
150
            $xoops->tpl()->assign('in_category', '');
151
            $xoops->tpl()->assign('cat_name', '');
152 View Code Duplication
            if (!empty($by_cat)) {
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
                $cat_name                  = '';
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
154
                $alumni_categories_Handler = $xoops->getModuleHandler('category', 'alumni');
0 ignored issues
show
$alumni_categories_Handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
155
                $catObj                    = $alumni_categories_Handler->get($by_cat);
0 ignored issues
show
$alumni_categories_Handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
156
                $cat_name                  = $catObj->getVar('title');
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
157
                $xoops->tpl()->assign('in_category', AlumniLocale::INCATEGORY);
158
                $xoops->tpl()->assign('cat_name', "<b> :  &nbsp;&nbsp; $cat_name</b>");
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
159
            }
160
161
            $res = [];
162
            if (is_array($results) && $count > 0) {
163
                $nomatch                      = false;
164
                $modules_result[$mid]['name'] = $module->getVar('name');
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
165
                if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) {
166
                    $modules_result[$mid]['image'] = $xoops->url($image);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
167
                } else {
168
                    $modules_result[$mid]['image'] = $xoops->url('images/icons/posticon2.gif');
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
169
                }
170
                $res = [];
171
                for ($i = 0; $i < $count; ++$i) {
172
                    if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
173
                        $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
174
                    } else {
175
                        $res[$i]['link'] = $results[$i]['link'];
176
                    }
177
                    $res[$i]['title']          = $myts->htmlSpecialChars($results[$i]['title']);
178
                    $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title']));
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
179
                    if (!empty($results[$i]['uid'])) {
180
                        $res[$i]['uid']   = (int)$results[$i]['uid'];
181
                        $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true);
182
                    }
183
                    $res[$i]['time']    = !empty($results[$i]['time']) ? XoopsLocale::formatTimestamp((int)$results[$i]['time']) : '';
184
                    $res[$i]['content'] = empty($results[$i]['content']) ? '' : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']);
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
185
                }
186
                if ($count >= 5) {
187
                    $search_url                         = XOOPS_URL . '/modules/alumni/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
0 ignored issues
show
$search_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
188
                    $search_url                         .= "&mid={$mid}&action=showall&andor={$andor}&by_cat=$by_cat";
0 ignored issues
show
$search_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
189
                    $modules_result[$mid]['search_url'] = htmlspecialchars($search_url);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
190
                }
191
            }
192
            if (count($res) > 0) {
193
                $modules_result[$mid]['result'] = $res;
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
194
            }
195
        }
196
        unset($results);
197
        unset($module);
198
199
        $xoops->tpl()->assign('modules', $modules_result);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
200
201
        /* @var $formHandler SearchSearchForm */
202
        $formHandler = $alumni->getForm(null, 'search');
203
        $form        = $formHandler->alumni_getSearchFrom($andor, $queries, $mids, $mid, $by_cat);
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
204
        $form->display();
205
        break;
206
207
    case 'showall':
208
    case 'showallbyuser':
209
        $xoops->header('module:search/search.tpl');
210
        $xoops->tpl()->assign('search', true);
211
        $xoops->tpl()->assign('queries', $queries);
212
        $xoops->tpl()->assign('ignored_words', sprintf(_MA_ALUMNI_IGNOREDWORDS, $search->getConfig('keyword_min')));
213
        $xoops->tpl()->assign('ignored_queries', $ignored_queries);
0 ignored issues
show
$ignored_queries does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
214
215
        $module_handler = $xoops->getHandlerModule();
0 ignored issues
show
$module_handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
216
        $module         = $xoops->getModuleById($mid);
217
        /* @var $plugin SearchPluginInterface */
218
        $plugin   = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search');
219
        $results  = $plugin->search($queries, $andor, 20, $start, $uid);
220
        $results2 = $plugin->search($queries, $andor, '', $start, $uid);
221
222
        $modules_result[$mid]['name']  = $module->getVar('name');
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
223
        $modules_result[$mid]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_large.png');
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
224
225
        $count  = count($results);
226
        $count2 = count($results2);
227
228
        $xoops->tpl()->assign('sr_showing', '');
229
        if (is_array($results) && $count > 0) {
230
            $next_results = $plugin->search($queries, $andor, 1, $start + 20, $uid);
0 ignored issues
show
$next_results does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
231
            $next_count   = count($next_results);
0 ignored issues
show
$next_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
232
            $has_next     = false;
0 ignored issues
show
$has_next does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
233
            if (is_array($next_results) && 1 == $next_count) {
0 ignored issues
show
$next_results does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
234
                $has_next = true;
0 ignored issues
show
$has_next does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
235
            }
236
            $xoops->tpl()->assign('sr_showing', sprintf(XoopsLocale::F_SHOWING_RESULTS, $start + 1, $start + $count));
237
            $xoops->tpl()->assign('showing_of', constant($main_lang . '_OF') . "&nbsp;$count2");
0 ignored issues
show
$main_lang does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
238
239 View Code Duplication
            if (!empty($by_cat)) {
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
240
                $cat_name                  = '';
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
241
                $alumni_categories_Handler = $xoops->getModuleHandler('category', 'alumni');
0 ignored issues
show
$alumni_categories_Handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
242
                $catObj                    = $alumni_categories_Handler->get($by_cat);
0 ignored issues
show
$alumni_categories_Handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
243
                $cat_name                  = $catObj->getVar('title');
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
244
                $xoops->tpl()->assign('in_category', AlumniLocale::INCATEGORY);
245
                $xoops->tpl()->assign('cat_name', "<b> :  &nbsp;&nbsp; $cat_name</b>");
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
246
            }
247
248
            $res = [];
249
            for ($i = 0; $i < $count; ++$i) {
250
                if (isset($results[$i]['image']) && '' != $results[$i]['image']) {
251
                    $res[$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']);
252
                } else {
253
                    $res[$i]['image'] = $xoops->url('images/icons/posticon2.gif');
254
                }
255
                if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
256
                    $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
257
                } else {
258
                    $res[$i]['link'] = $results[$i]['link'];
259
                }
260
                $res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
261
                if (isset($queries_pattern)) {
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
262
                    $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title']));
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
263
                } else {
264
                    $res[$i]['title_highligh'] = $myts->htmlSpecialChars($results[$i]['title']);
265
                }
266
                if (!empty($results[$i]['uid'])) {
267
                    $res[$i]['uid']   = @(int)$results[$i]['uid'];
268
                    $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true);
269
                }
270
                $res[$i]['time']    = !empty($results[$i]['time']) ? ' (' . XoopsLocale::formatTimestamp((int)$results[$i]['time']) . ')' : '';
271
                $res[$i]['content'] = empty($results[$i]['content']) ? '' : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']);
0 ignored issues
show
$queries_pattern does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
272
            }
273
            if (count($res) > 0) {
274
                $modules_result[$mid]['result'] = $res;
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
275
            }
276
277
            $search_url = XOOPS_URL . '/modules/alumni/search.php?query=' . urlencode(stripslashes(implode(' ', $queries)));
0 ignored issues
show
$search_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
278
            $search_url .= "&mid={$mid}&action={$action}&andor={$andor}&by_cat=$by_cat";
0 ignored issues
show
$search_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
279
            if ('showallbyuser' === $action) {
280
                $search_url .= "&uid={$uid}";
0 ignored issues
show
$search_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
281
            }
282 View Code Duplication
            if ($start > 0) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
283
                $prev                         = $start - 20;
284
                $search_url_prev              = $search_url . "&start={$prev}";
0 ignored issues
show
$search_url_prev does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
285
                $modules_result[$mid]['prev'] = htmlspecialchars($search_url_prev);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
286
            }
287 View Code Duplication
            if (false != $has_next) {
0 ignored issues
show
$has_next does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison !== instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
288
                $next                         = $start + 20;
289
                $search_url_next              = $search_url . "&start={$next}";
0 ignored issues
show
$search_url_next does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
290
                $modules_result[$mid]['next'] = htmlspecialchars($search_url_next);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
291
            }
292
            $xoops->tpl()->assign('modules', $modules_result);
0 ignored issues
show
$modules_result does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
293
        }
294
295
        /* @var $formHandler SearchSearchForm */
296
        $formHandler = $alumni->getForm(null, 'search');
297
        $form        = $formHandler->alumni_getSearchFrom($andor, $queries, $mids, $mid, $by_cat);
0 ignored issues
show
$by_cat does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
298
        $form->display();
299
        break;
300
}
301
$xoops->footer();
302