2015-10-11 22:46:23 +02:00
|
|
|
<?php
|
2015-10-21 20:23:50 +02:00
|
|
|
|
2018-01-16 19:21:04 +01:00
|
|
|
if (!function_exists('ereg')) {
|
|
|
|
function ereg($pattern, $subject, &$matches = array())
|
|
|
|
{
|
|
|
|
return preg_match('/'.$pattern.'/', $subject, $matches);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-21 20:23:50 +02:00
|
|
|
function arguments($argv) {
|
|
|
|
$_ARG = array();
|
|
|
|
foreach ($argv as $arg) {
|
|
|
|
if (ereg('--([^=]+)=(.*)',$arg,$reg)) {
|
|
|
|
$_ARG[$reg[1]] = $reg[2];
|
|
|
|
} elseif(ereg('^-([a-zA-Z0-9])',$arg,$reg)) {
|
|
|
|
$_ARG[$reg[1]] = 'true';
|
|
|
|
} else {
|
|
|
|
$_ARG['input'][]=$arg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get args:
|
|
|
|
$args = arguments($argv);
|
|
|
|
|
2015-10-11 22:46:23 +02:00
|
|
|
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
2015-10-21 20:23:50 +02:00
|
|
|
include $args['index'];
|
2015-10-11 22:46:23 +02:00
|
|
|
|
|
|
|
$oConfig = \RainLoop\Api::Config();
|
2015-10-21 23:43:02 +02:00
|
|
|
$oConfig->SetPassword($args['password']);
|
2015-10-11 22:46:23 +02:00
|
|
|
echo $oConfig->Save() ? 'Admin password updated' : 'Admin password not updated';
|
|
|
|
|
2018-01-16 19:21:04 +01:00
|
|
|
?>
|