diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/cloud.php | 14 | ||||
-rw-r--r-- | mod/dav.php | 16 | ||||
-rw-r--r-- | mod/post.php | 4 | ||||
-rw-r--r-- | mod/settings.php | 68 | ||||
-rw-r--r-- | mod/wfinger.php | 7 |
5 files changed, 56 insertions, 53 deletions
diff --git a/mod/cloud.php b/mod/cloud.php index 67fc199bf..82d454477 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -7,7 +7,7 @@ */ use Sabre\DAV; -use RedMatrix\RedDAV; +use Zotlabs\Storage; // composer autoloader for SabreDAV require_once('vendor/autoload.php'); @@ -35,7 +35,7 @@ function cloud_init(&$a) { if ($which) profile_load($a, $which, $profile); - $auth = new RedDAV\RedBasicAuth(); + $auth = new Zotlabs\Storage\BasicAuth(); $ob_hash = get_observer_hash(); @@ -63,7 +63,7 @@ function cloud_init(&$a) { $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); - $rootDirectory = new RedDAV\RedDirectory('/', $auth); + $rootDirectory = new Zotlabs\Storage\Directory('/', $auth); // A SabreDAV server-object $server = new DAV\Server($rootDirectory); @@ -86,16 +86,16 @@ function cloud_init(&$a) { } } - require_once('include/RedDAV/RedBrowser.php'); +// require_once('Zotlabs/Storage/Browser.php'); // provide a directory view for the cloud in Hubzilla - $browser = new RedDAV\RedBrowser($auth); + $browser = new Zotlabs\Storage\Browser($auth); $auth->setBrowserPlugin($browser); $server->addPlugin($browser); // Experimental QuotaPlugin -// require_once('include/RedDAV/QuotaPlugin.php'); -// $server->addPlugin(new RedDAV\QuotaPlugin($auth)); +// require_once('Zotlabs\Storage/QuotaPlugin.php'); +// $server->addPlugin(new Zotlabs\Storage\\QuotaPlugin($auth)); // All we need to do now, is to fire up the server $server->exec(); diff --git a/mod/dav.php b/mod/dav.php index d4695a544..272dae4c8 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -7,7 +7,7 @@ */ use Sabre\DAV; -use RedMatrix\RedDAV; +use Zotlabs\Storage; // composer autoloader for SabreDAV require_once('vendor/autoload.php'); @@ -54,7 +54,7 @@ function dav_init(&$a) { if ($which) profile_load($a, $which, $profile); - $auth = new RedDAV\RedBasicAuth(); + $auth = new Zotlabs\Storage\BasicAuth(); $ob_hash = get_observer_hash(); @@ -82,7 +82,7 @@ function dav_init(&$a) { $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); - $rootDirectory = new RedDAV\RedDirectory('/', $auth); + $rootDirectory = new Zotlabs\Storage\Directory('/', $auth); // A SabreDAV server-object $server = new DAV\Server($rootDirectory); @@ -108,7 +108,7 @@ function dav_init(&$a) { if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) { try { $x = RedFileData('/' . $a->cmd, $auth); - if($x instanceof RedDAV\RedFile) + if($x instanceof Zotlabs\Storage\File) $isapublic_file = true; } catch (Exception $e) { @@ -126,14 +126,14 @@ function dav_init(&$a) { } } - require_once('include/RedDAV/RedBrowser.php'); +// require_once('Zotlabs/Storage/Browser.php'); // provide a directory view for the cloud in Hubzilla - $browser = new RedDAV\RedBrowser($auth); + $browser = new Zotlabs\Storage\Browser($auth); $auth->setBrowserPlugin($browser); // Experimental QuotaPlugin -// require_once('include/RedDAV/QuotaPlugin.php'); -// $server->addPlugin(new RedDAV\QuotaPlugin($auth)); +// require_once('Zotlabs/Storage/QuotaPlugin.php'); +// $server->addPlugin(new Zotlabs\Storage\QuotaPlugin($auth)); // All we need to do now, is to fire up the server $server->exec(); diff --git a/mod/post.php b/mod/post.php index 6555a16c2..481a4a896 100644 --- a/mod/post.php +++ b/mod/post.php @@ -12,7 +12,6 @@ require_once('include/zot.php'); function post_init(&$a) { if (array_key_exists('auth', $_REQUEST)) { - require_once('Zotlabs/Zot/Auth.php'); $x = new Zotlabs\Zot\Auth($_REQUEST); exit; } @@ -22,9 +21,6 @@ function post_init(&$a) { function post_post(&$a) { - require_once('Zotlabs/Zot/Receiver.php'); - require_once('Zotlabs/Zot/ZotHandler.php'); - $z = new Zotlabs\Zot\Receiver($_REQUEST['data'],get_config('system','prvkey'), new Zotlabs\Zot\ZotHandler()); // notreached; diff --git a/mod/settings.php b/mod/settings.php index 467cccfc7..2f90b037f 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -225,10 +225,44 @@ function settings_post(&$a) { $errs = array(); + $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); + $account = $a->get_account(); + if($email != $account['account_email']) { + if(! valid_email($email)) + $errs[] = t('Not valid email.'); + $adm = trim(get_config('system','admin_email')); + if(($adm) && (strcasecmp($email,$adm) == 0)) { + $errs[] = t('Protected email address. Cannot change to that email.'); + $email = $a->user['email']; + } + if(! $errs) { + $r = q("update account set account_email = '%s' where account_id = %d", + dbesc($email), + intval($account['account_id']) + ); + if(! $r) + $errs[] = t('System failure storing new email. Please try again.'); + } + } + + if($errs) { + foreach($errs as $err) + notice($err . EOL); + $errs = array(); + } + + if((x($_POST,'npassword')) || (x($_POST,'confirm'))) { - $newpass = $_POST['npassword']; - $confirm = $_POST['confirm']; + $origpass = trim($_POST['origpass']); + + require_once('include/auth.php'); + if(! account_verify_password($email,$origpass)) { + $errs[] = t('Password verification failed.'); + } + + $newpass = trim($_POST['npassword']); + $confirm = trim($_POST['confirm']); if($newpass != $confirm ) { $errs[] = t('Passwords do not match. Password unchanged.'); @@ -255,31 +289,6 @@ function settings_post(&$a) { } } - if($errs) { - foreach($errs as $err) - notice($err . EOL); - $errs = array(); - } - - $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); - $account = $a->get_account(); - if($email != $account['account_email']) { - if(! valid_email($email)) - $errs[] = t('Not valid email.'); - $adm = trim(get_config('system','admin_email')); - if(($adm) && (strcasecmp($email,$adm) == 0)) { - $errs[] = t('Protected email address. Cannot change to that email.'); - $email = $a->user['email']; - } - if(! $errs) { - $r = q("update account set account_email = '%s' where account_id = %d", - dbesc($email), - intval($account['account_id']) - ); - if(! $r) - $errs[] = t('System failure storing new email. Please try again.'); - } - } if($errs) { foreach($errs as $err) @@ -695,8 +704,9 @@ function settings_content(&$a) { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_account"), '$title' => t('Account Settings'), - '$password1'=> array('npassword', t('Enter New Password:'), '', ''), - '$password2'=> array('confirm', t('Confirm New Password:'), '', t('Leave password fields blank unless changing')), + '$origpass' => array('origpass', t('Current Password'), ' ',''), + '$password1'=> array('npassword', t('Enter New Password'), '', ''), + '$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')), '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), '$removeme' => t('Remove Account'), diff --git a/mod/wfinger.php b/mod/wfinger.php index 5270c8f31..a745d9f84 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -51,8 +51,6 @@ function wfinger_init(&$a) { header('Access-Control-Allow-Origin: *'); - header('Content-type: application/jrd+json'); - if($resource && $r) { @@ -124,7 +122,6 @@ function wfinger_init(&$a) { $arr = array('channel' => $r[0], 'request' => $_REQUEST, 'result' => $result); call_hooks('webfinger',$arr); - echo json_encode($arr['result']); - killme(); + json_return_and_die($arr['result'],'application/jrd+json'); -}
\ No newline at end of file +} |