nextcloud /
server
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
||
| 4 | * |
||
| 5 | * @author Bart Visscher <[email protected]> |
||
| 6 | * @author Björn Schießle <[email protected]> |
||
| 7 | * @author Frank Karlitschek <[email protected]> |
||
| 8 | * @author Lukas Reschke <[email protected]> |
||
| 9 | * @author Sam Tuke <[email protected]> |
||
| 10 | * @author Vincent Petry <[email protected]> |
||
| 11 | * |
||
| 12 | * @license AGPL-3.0 |
||
| 13 | * |
||
| 14 | * This code is free software: you can redistribute it and/or modify |
||
| 15 | * it under the terms of the GNU Affero General Public License, version 3, |
||
| 16 | * as published by the Free Software Foundation. |
||
| 17 | * |
||
| 18 | * This program is distributed in the hope that it will be useful, |
||
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 21 | * GNU Affero General Public License for more details. |
||
| 22 | * |
||
| 23 | * You should have received a copy of the GNU Affero General Public License, version 3, |
||
| 24 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
||
| 25 | * |
||
| 26 | */ |
||
| 27 | OCP\JSON::checkLoggedIn(); |
||
|
0 ignored issues
–
show
|
|||
| 28 | OCP\JSON::callCheck(); |
||
|
0 ignored issues
–
show
The method
OCP\JSON::callCheck() has been deprecated with message: 8.1.0 Use annotation based CSRF checks from the AppFramework instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. Loading history...
|
|||
| 29 | OCP\JSON::checkAppEnabled('files_versions'); |
||
|
0 ignored issues
–
show
The method
OCP\JSON::checkAppEnabled() has been deprecated with message: 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled.
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. Loading history...
|
|||
| 30 | |||
| 31 | $source = (string)$_GET['source']; |
||
| 32 | $start = (int)$_GET['start']; |
||
| 33 | list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source); |
||
| 34 | $count = 5; //show the newest revisions |
||
| 35 | $versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source); |
||
| 36 | if( $versions ) { |
||
|
0 ignored issues
–
show
The expression
$versions of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using Loading history...
|
|||
| 37 | |||
| 38 | $endReached = false; |
||
| 39 | if (count($versions) <= $start+$count) { |
||
| 40 | $endReached = true; |
||
| 41 | } |
||
| 42 | |||
| 43 | $versions = array_slice($versions, $start, $count); |
||
| 44 | |||
| 45 | // remove owner path from request to not disclose it to the recipient |
||
| 46 | foreach ($versions as $version) { |
||
| 47 | unset($version['path']); |
||
| 48 | } |
||
| 49 | |||
| 50 | \OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached))); |
||
|
0 ignored issues
–
show
The method
OCP\JSON::success() has been deprecated with message: 8.1.0 Use a AppFramework JSONResponse instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. Loading history...
|
|||
| 51 | |||
| 52 | } else { |
||
| 53 | |||
| 54 | \OCP\JSON::success(array('data' => array('versions' => [], 'endReached' => true))); |
||
|
0 ignored issues
–
show
The method
OCP\JSON::success() has been deprecated with message: 8.1.0 Use a AppFramework JSONResponse instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. Loading history...
|
|||
| 55 | |||
| 56 | } |
||
| 57 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.