Skip to content

Commit 98a0d93

Browse files
committed
- Fix intelephense error
- Remove unneeded GROUP BY - Add missing isGuid function.
1 parent 21a3961 commit 98a0d93

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

server/actions/patterns/save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function execute() {
3131
function savePattern($userProfile) {
3232
$keywords = $this->getValue('keywords');
3333
$name = $this->getValue('name');
34-
$pattern = addslashes($this->getValue('expression'));
34+
$pattern = addslashes($this->getValue('expression') ?? '');
3535
$content = $this->getValue('text');
3636
$description = $this->getValue('description');
3737
$id = $this->getValue('id');

server/actions/patterns/search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function searchCommunity($query, $startIndex, $limit, $type) {
6161
$q .= " AND (" . implode(" OR ", $whereStatements) . ")";
6262
}
6363

64-
$q .= " GROUP BY p.id ORDER by p.ratingSort DESC LIMIT ?, ?";
64+
$q .= " ORDER BY p.ratingSort DESC LIMIT ?, ?";
6565
$searchSqlParams[] = ["s", $startIndex];
6666
$searchSqlParams[] = ["s", $limit];
6767

server/utils.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
// Global utility methods.
2121

22+
2223
/**
2324
* @param $value
2425
* @param $key
@@ -66,6 +67,11 @@ function now() {
6667
return microtime(true)*1000;
6768
}
6869

70+
function isGuid($guid) {
71+
$match = preg_match("/^[a-f0-9]{8}(-[a-f0-9]{4}){4}[a-f0-9]{8}$/i", $guid);
72+
return $match == 1;
73+
}
74+
6975
function formatActionNameForExecution($name) {
7076
return str_replace("/", "\\", $name);
7177
}

0 commit comments

Comments
 (0)