/usr/share/phoronix-test-suite/pts-core/commands/openbenchmarking_login.php is in phoronix-test-suite 4.8.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | <?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2012, Phoronix Media
Copyright (C) 2008 - 2012, Michael Larabel
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
class openbenchmarking_login implements pts_option_interface
{
const doc_section = 'OpenBenchmarking.org';
const doc_description = 'This option is used for controlling your Phoronix Test Suite client options for OpenBechmarking.org and syncing the client to your account.';
public static function command_aliases()
{
return array('openbenchmarking_setup');
}
public static function run($r)
{
echo PHP_EOL . 'If you have not already registered for your free OpenBenchmarking.org account, you can do so at http://openbenchmarking.org/' . PHP_EOL . PHP_EOL . 'Once you have registered your account and clicked the link within the verification email, enter your log-in information below.' . PHP_EOL . PHP_EOL;
echo 'User-Name: ';
$username = pts_user_io::read_user_input();
echo 'Password: ';
$password = pts_user_io::read_user_input();
$login_payload = array(
's_u' => $username,
's_p' => sha1($password),
's_s' => base64_encode(phodevi::system_software(true)),
's_h' => base64_encode(phodevi::system_hardware(true))
);
$login_state = pts_openbenchmarking::make_openbenchmarking_request('account_login', $login_payload);
$json = json_decode($login_state, true);
if(isset($json['openbenchmarking']['response']['error']))
{
trigger_error($json['openbenchmarking']['response']['error'], E_USER_ERROR);
pts_storage_object::remove_in_file(PTS_CORE_STORAGE, 'openbenchmarking');
}
else
{
$openbenchmarking_payload = array(
'user_name' => $json['openbenchmarking']['account']['user_name'],
'communication_id' => $json['openbenchmarking']['account']['communication_id'],
'sav' => $json['openbenchmarking']['account']['sav'],
);
pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', $openbenchmarking_payload);
echo PHP_EOL . PHP_EOL . 'The Account Has Been Setup.' . PHP_EOL . PHP_EOL;
}
}
}
?>
|