mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 03:51:25 +01:00
clean code (#35512)
This commit is contained in:
@@ -9660,18 +9660,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../htdocs/core/lib/website.lib.php
|
path: ../../../htdocs/core/lib/website.lib.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Ternary operator condition is always false\.$#'
|
|
||||||
identifier: ternary.alwaysFalse
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/core/lib/website.lib.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Ternary operator condition is always true\.$#'
|
|
||||||
identifier: ternary.alwaysTrue
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/core/lib/website.lib.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
|
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
|
||||||
identifier: function.alreadyNarrowedType
|
identifier: function.alreadyNarrowedType
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -1227,6 +1227,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||||||
{
|
{
|
||||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
||||||
'@phan-var-force Website $website';
|
'@phan-var-force Website $website';
|
||||||
|
/** @var Website $website */
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$arrayresult = array('code' => '', 'list' => array());
|
$arrayresult = array('code' => '', 'list' => array());
|
||||||
@@ -1291,9 +1292,9 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||||||
$searchalgo = '';
|
$searchalgo = '';
|
||||||
if (preg_match('/meta/', $algo)) {
|
if (preg_match('/meta/', $algo)) {
|
||||||
// TODO Use a better way to scan keywords
|
// TODO Use a better way to scan keywords
|
||||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($db->escapeforlike($searchstring))."%' OR wp.description LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
$searchalgo .= "wp.title LIKE '%".$db->escape($db->escapeforlike($searchstring))."%' OR wp.description LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
||||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.pageurl LIKE '%".$db->escape($db->escapeforlike($searchstring))."%' OR wp.aliasalt LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
$searchalgo .= " OR wp.pageurl LIKE '%".$db->escape($db->escapeforlike($searchstring))."%' OR wp.aliasalt LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
||||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($db->escapeforlike($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escape($db->escapeforlike($searchstring))."%'";
|
$searchalgo .= " OR wp.keywords LIKE '".$db->escape($db->escapeforlike($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escape($db->escapeforlike($searchstring))."%'";
|
||||||
}
|
}
|
||||||
if (preg_match('/content/', $algo)) {
|
if (preg_match('/content/', $algo)) {
|
||||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($db->escapeforlike($searchstring))."%'";
|
||||||
|
|||||||
Reference in New Issue
Block a user