Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
QUIQQER
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
163
Issues
163
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QUIQQER
QUIQQER
Commits
4f5065cf
Commit
4f5065cf
authored
Mar 07, 2019
by
Henning Leutz
🥋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: QVE-12-2019-3 to -11
parent
c40811da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
34 deletions
+70
-34
composer.json
composer.json
+1
-1
lib/QUI/Projects/Media/Folder.php
lib/QUI/Projects/Media/Folder.php
+69
-33
No files found.
composer.json
View file @
4f5065cf
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"name"
:
"quiqqer/quiqqer"
,
"name"
:
"quiqqer/quiqqer"
,
"type"
:
"quiqqer-system"
,
"type"
:
"quiqqer-system"
,
"description"
:
"A modular based management system written in JavaScript and PHP"
,
"description"
:
"A modular based management system written in JavaScript and PHP"
,
"version"
:
"1.2.
9
"
,
"version"
:
"1.2.
10
"
,
"license"
:
"GPL-3.0+"
,
"license"
:
"GPL-3.0+"
,
"authors"
:
[
"authors"
:
[
{
{
...
...
lib/QUI/Projects/Media/Folder.php
View file @
4f5065cf
...
@@ -10,6 +10,7 @@ use QUI;
...
@@ -10,6 +10,7 @@ use QUI;
use
QUI\Projects\Media\Utils
as
MediaUtils
;
use
QUI\Projects\Media\Utils
as
MediaUtils
;
use
QUI\Utils\System\File
as
FileUtils
;
use
QUI\Utils\System\File
as
FileUtils
;
use
QUI\Utils\StringHelper
as
StringUtils
;
use
QUI\Utils\StringHelper
as
StringUtils
;
use
QUI\Utils\Security\Orthos
;
/**
/**
* A media folder
* A media folder
...
@@ -596,45 +597,47 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
...
@@ -596,45 +597,47 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
$order
=
'name'
;
$order
=
'name'
;
}
}
$table
=
Orthos
::
cleanupDatabaseFieldName
(
$table
);
$table_rel
=
Orthos
::
cleanupDatabaseFieldName
(
$table_rel
);
$table_parent
=
$table_rel
.
'.`parent`'
;
$table_child
=
$table_rel
.
'.`child`'
;
$table_id
=
$table
.
'.`id`'
;
$table_delete
=
$table
.
'.`deleted`'
;
$table_type
=
$table
.
'.`type`'
;
$table_cDate
=
$table
.
'.`c_date`'
;
$table_name
=
$table
.
'.`name`'
;
$parentId
=
$this
->
getId
();
switch
(
$order
)
{
switch
(
$order
)
{
case
'id'
:
case
'id'
:
case
'id ASC'
:
case
'id ASC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') DESC,
{
$table_id
}
"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') DESC, '
.
$table
.
'.id'
;
break
;
break
;
case
'id DESC'
:
case
'id DESC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') DESC,
{
$table_id
}
DESC"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') DESC, '
.
$table
.
'.id DESC'
;
break
;
break
;
case
'c_date'
:
case
'c_date'
:
case
'c_date ASC'
:
case
'c_date ASC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') DESC,
{
$table_cDate
}
"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') DESC, '
.
$table
.
'.c_date'
;
break
;
break
;
case
'c_date DESC'
:
case
'c_date DESC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') DESC,
{
$table_cDate
}
DESC"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') DESC, '
.
$table
.
'.c_date DESC'
;
break
;
break
;
case
'name ASC'
:
case
'name ASC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') ASC,
{
$table_name
}
"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') ASC, '
.
$table
.
'.name'
;
break
;
break
;
default
:
default
:
case
'name'
:
case
'name'
:
case
'name DESC'
:
case
'name DESC'
:
$order_by
$order_by
=
"find_in_set(
{
$table_type
}
, 'folder') DESC,
{
$table_name
}
"
;
=
'find_in_set('
.
$table
.
'.type, \'folder\') DESC, '
.
$table
.
'.name'
;
break
;
break
;
case
'priority'
:
case
'priority'
:
...
@@ -643,26 +646,58 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
...
@@ -643,26 +646,58 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
$order_by
=
$order
;
$order_by
=
$order
;
}
}
$limit
=
''
;
if
(
isset
(
$params
[
'limit'
]))
{
if
(
isset
(
$params
[
'limit'
]))
{
$query
[
'limit'
]
=
$params
[
'limit'
];
$limitParams
=
explode
(
','
,
$params
[
'limit'
]);
if
(
count
(
$limitParams
)
===
2
)
{
$limitParams
[
0
]
=
(
int
)
$limitParams
[
0
];
$limitParams
[
1
]
=
(
int
)
$limitParams
[
1
];
$limit
=
"LIMIT
{
$limitParams
[
0
]
}
,
{
$limitParams
[
1
]
}
"
;
}
else
{
$limitParams
[
0
]
=
(
int
)
$limitParams
[
0
];
$limit
=
"LIMIT
{
$limitParams
[
0
]
}
"
;
}
}
}
$query
=
[
$query
=
"
'select'
=>
'id'
,
'from'
=>
[
SELECT id
$table
,
FROM
{
$table
}
,
{
$table_rel
}
$table_rel
WHERE
],
{
$table_parent
}
=
{
$parentId
}
AND
'where'
=>
[
{
$table_child
}
=
{
$table_id
}
AND
$table_rel
.
'.parent'
=>
$this
->
getId
(),
{
$table_delete
}
= 0
$table_rel
.
'.child'
=>
'`'
.
$table
.
'.id`'
,
ORDER BY
$table
.
'.deleted'
=>
0
{
$order_by
}
{
$limit
}
],
;
'order'
=>
$order_by
"
;
];
// $query = [
// 'select' => 'id',
// 'from' => [
// $table,
// $table_rel
// ],
// 'where' => [
// $table_rel.'.parent' => $this->getId(),
// $table_rel.'.child' => '`'.$table.'.id`',
// $table.'.deleted' => 0
// ],
// 'order' => $order_by
// ];
$fetch
=
QUI
::
getDataBase
()
->
fetch
(
$query
);
try
{
$fetch
=
QUI
::
getDataBase
()
->
fetchSQL
(
$query
);
}
catch
(
QUI\Exception
$Exception
)
{
QUI\System\Log
::
writeException
(
$Exception
);
return
[];
}
$result
=
[];
$result
=
[];
foreach
(
$fetch
as
$entry
)
{
foreach
(
$fetch
as
$entry
)
{
...
@@ -670,6 +705,7 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
...
@@ -670,6 +705,7 @@ class Folder extends Item implements QUI\Interfaces\Projects\Media\File
}
}
return
$result
;
return
$result
;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment