aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-02-19 22:28:57 +0100
committerMario Vavti <mario@mariovavti.com>2016-02-19 22:28:57 +0100
commitfbc6c60805d733e16a3ff7fdf60f564ce69fab64 (patch)
treea17a162fef7d8d3a79a22f2363eae3f4336acd6a
parent02e82e496e3ec8dbd8264248ad8550dd5e335cba (diff)
parent8e586008dd8cceb02fc5378d11fce9673a0d5e41 (diff)
downloadvolse-hubzilla-fbc6c60805d733e16a3ff7fdf60f564ce69fab64.tar.gz
volse-hubzilla-fbc6c60805d733e16a3ff7fdf60f564ce69fab64.tar.bz2
volse-hubzilla-fbc6c60805d733e16a3ff7fdf60f564ce69fab64.zip
Merge branch 'master' of https://github.com/redmatrix/hubzilla
-rw-r--r--Zotlabs/Storage/BasicAuth.php (renamed from include/RedDAV/RedBasicAuth.php)14
-rw-r--r--Zotlabs/Storage/Browser.php (renamed from include/RedDAV/RedBrowser.php)4
-rw-r--r--Zotlabs/Storage/Directory.php (renamed from include/RedDAV/RedDirectory.php)6
-rw-r--r--Zotlabs/Storage/File.php (renamed from include/RedDAV/RedFile.php)4
-rw-r--r--Zotlabs/Zot/ZotHandler.php3
-rw-r--r--include/network.php4
-rw-r--r--include/reddav.php22
-rw-r--r--mod/cloud.php14
-rw-r--r--mod/dav.php16
-rw-r--r--mod/post.php4
-rw-r--r--mod/settings.php68
-rw-r--r--mod/wfinger.php7
-rwxr-xr-xview/tpl/settings_account.tpl1
13 files changed, 84 insertions, 83 deletions
diff --git a/include/RedDAV/RedBasicAuth.php b/Zotlabs/Storage/BasicAuth.php
index 19dd9a5f0..d93525d20 100644
--- a/include/RedDAV/RedBasicAuth.php
+++ b/Zotlabs/Storage/BasicAuth.php
@@ -1,11 +1,11 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Zotlabs\Storage;
use Sabre\DAV;
/**
- * @brief Authentication backend class for RedDAV.
+ * @brief Authentication backend class for DAV.
*
* This class also contains some data which is not necessary for authentication
* like timezone settings.
@@ -15,7 +15,7 @@ use Sabre\DAV;
* @link http://github.com/friendica/red
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
-class RedBasicAuth extends DAV\Auth\Backend\AbstractBasic {
+class BasicAuth extends DAV\Auth\Backend\AbstractBasic {
/**
* @brief This variable holds the currently logged-in channel_address.
@@ -45,18 +45,18 @@ class RedBasicAuth extends DAV\Auth\Backend\AbstractBasic {
public $observer = '';
/**
*
- * @see RedBrowser::set_writeable()
+ * @see Browser::set_writeable()
* @var \Sabre\DAV\Browser\Plugin
*/
public $browser;
/**
- * channel_id of the current visited path. Set in RedDirectory::getDir().
+ * channel_id of the current visited path. Set in Directory::getDir().
*
* @var int
*/
public $owner_id = 0;
/**
- * channel_name of the current visited path. Set in RedDirectory::getDir().
+ * channel_name of the current visited path. Set in Directory::getDir().
*
* Used for creating the path in cloud/
*
@@ -197,7 +197,7 @@ class RedBasicAuth extends DAV\Auth\Backend\AbstractBasic {
}
/**
- * @brief Prints out all RedBasicAuth variables to logger().
+ * @brief Prints out all BasicAuth variables to logger().
*
* @return void
*/
diff --git a/include/RedDAV/RedBrowser.php b/Zotlabs/Storage/Browser.php
index 1aa5f435e..fde443e6f 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Zotlabs\Storage;
use Sabre\DAV;
@@ -15,7 +15,7 @@ use Sabre\DAV;
* @link http://github.com/friendica/red
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
-class RedBrowser extends DAV\Browser\Plugin {
+class Browser extends DAV\Browser\Plugin {
/**
* @see set_writeable()
diff --git a/include/RedDAV/RedDirectory.php b/Zotlabs/Storage/Directory.php
index 8d8af5bd3..e38d76914 100644
--- a/include/RedDAV/RedDirectory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Zotlabs\Storage;
use Sabre\DAV;
@@ -16,7 +16,7 @@ use Sabre\DAV;
* @link http://github.com/friendica/red
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
-class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
+class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
/**
* @brief The path inside /cloud
@@ -116,7 +116,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$modulename = get_app()->module;
if ($this->red_path === '/' && $name === $modulename) {
- return new RedDirectory('/' . $modulename, $this->auth);
+ return new Directory('/' . $modulename, $this->auth);
}
$x = RedFileData($this->ext_path . '/' . $name, $this->auth);
diff --git a/include/RedDAV/RedFile.php b/Zotlabs/Storage/File.php
index 3283a6e88..2a2a8b938 100644
--- a/include/RedDAV/RedFile.php
+++ b/Zotlabs/Storage/File.php
@@ -1,6 +1,6 @@
<?php
-namespace RedMatrix\RedDAV;
+namespace Zotlabs\Storage;
use Sabre\DAV;
@@ -15,7 +15,7 @@ use Sabre\DAV;
* @link http://github.com/friendica/red
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
*/
-class RedFile extends DAV\Node implements DAV\IFile {
+class File extends DAV\Node implements DAV\IFile {
/**
* The file from attach table.
diff --git a/Zotlabs/Zot/ZotHandler.php b/Zotlabs/Zot/ZotHandler.php
index f9bb05410..aab336545 100644
--- a/Zotlabs/Zot/ZotHandler.php
+++ b/Zotlabs/Zot/ZotHandler.php
@@ -2,9 +2,6 @@
namespace Zotlabs\Zot;
-require_once('Zotlabs/Zot/IHandler.php');
-
-
class ZotHandler implements IHandler {
function Ping() {
diff --git a/include/network.php b/include/network.php
index aa6b54945..ecaf4e05f 100644
--- a/include/network.php
+++ b/include/network.php
@@ -294,8 +294,8 @@ function z_post_url_json($url, $params, $redirects = 0, $opts = array()) {
}
-function json_return_and_die($x) {
- header("content-type: application/json");
+function json_return_and_die($x, $content_type = 'application/json') {
+ header("Content-type: $content_type");
echo json_encode($x);
killme();
}
diff --git a/include/reddav.php b/include/reddav.php
index c592597a9..a0bd1b1fc 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -19,13 +19,13 @@
*/
use Sabre\DAV;
-use RedMatrix\RedDAV;
+use Zotlabs\Storage;
require_once('vendor/autoload.php');
require_once('include/attach.php');
-require_once('include/RedDAV/RedFile.php');
-require_once('include/RedDAV/RedDirectory.php');
-require_once('include/RedDAV/RedBasicAuth.php');
+//require_once('Zotlabs/Storage/File.php');
+//require_once('Zotlabs/Storage/Directory.php');
+//require_once('Zotlabs/Storage/BasicAuth.php');
/**
* @brief Returns an array with viewable channels.
@@ -51,7 +51,7 @@ function RedChannelList(&$auth) {
if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage')) {
logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA);
// @todo can't we drop '/cloud'? It gets stripped off anyway in RedDirectory
- $ret[] = new RedDAV\RedDirectory('/cloud/' . $rr['channel_address'], $auth);
+ $ret[] = new Zotlabs\Storage\Directory('/cloud/' . $rr['channel_address'], $auth);
}
}
}
@@ -167,9 +167,9 @@ function RedCollectionData($file, &$auth) {
foreach ($r as $rr) {
//logger('filename: ' . $rr['filename'], LOGGER_DEBUG);
if (intval($rr['is_dir'])) {
- $ret[] = new RedDAV\RedDirectory($path . '/' . $rr['filename'], $auth);
+ $ret[] = new Zotlabs\Storage\Directory($path . '/' . $rr['filename'], $auth);
} else {
- $ret[] = new RedDAV\RedFile($path . '/' . $rr['filename'], $rr, $auth);
+ $ret[] = new Zotlabs\Storage\File($path . '/' . $rr['filename'], $rr, $auth);
}
}
@@ -204,7 +204,7 @@ function RedFileData($file, &$auth, $test = false) {
if ((! $file) || ($file === '/')) {
- return new RedDAV\RedDirectory('/', $auth);
+ return new Zotlabs\Storage\Directory('/', $auth);
}
$file = trim($file, '/');
@@ -274,7 +274,7 @@ function RedFileData($file, &$auth, $test = false) {
if ($test)
return true;
// final component was a directory.
- return new RedDAV\RedDirectory($file, $auth);
+ return new Zotlabs\Storage\Directory($file, $auth);
}
if ($errors) {
@@ -293,9 +293,9 @@ function RedFileData($file, &$auth, $test = false) {
return true;
if (intval($r[0]['is_dir'])) {
- return new RedDAV\RedDirectory($path . '/' . $r[0]['filename'], $auth);
+ return new Zotlabs\Storage\Directory($path . '/' . $r[0]['filename'], $auth);
} else {
- return new RedDAV\RedFile($path . '/' . $r[0]['filename'], $r[0], $auth);
+ return new Zotlabs\Storage\File($path . '/' . $r[0]['filename'], $r[0], $auth);
}
}
return false;
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
+}
diff --git a/view/tpl/settings_account.tpl b/view/tpl/settings_account.tpl
index 9f550fe4a..4a93e0610 100755
--- a/view/tpl/settings_account.tpl
+++ b/view/tpl/settings_account.tpl
@@ -8,6 +8,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<div class="section-content-tools-wrapper">
{{include file="field_input.tpl" field=$email}}
+ {{include file="field_password.tpl" field=$origpass}}
{{include file="field_password.tpl" field=$password1}}
{{include file="field_password.tpl" field=$password2}}
<div class="settings-submit-wrapper" >