aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorMichael Meer <michael@meer.name>2014-01-27 10:37:15 +0100
committerMichael Meer <michael@meer.name>2014-01-27 10:37:15 +0100
commita3bf272753183f61723fea5dccd52abe6f0662dd (patch)
tree70a7e3a2e4ed5544abbddb8ee73226b638c01099 /mod
parent844df110586e6726581c620754fef5419f6bea5e (diff)
parentd67fdd129921549b6a1e7cb5e5ebea7bdc38bf0e (diff)
downloadvolse-hubzilla-a3bf272753183f61723fea5dccd52abe6f0662dd.tar.gz
volse-hubzilla-a3bf272753183f61723fea5dccd52abe6f0662dd.tar.bz2
volse-hubzilla-a3bf272753183f61723fea5dccd52abe6f0662dd.zip
Merge branch 'master' of https://github.com/MicMee/red
to be in sync
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php21
-rw-r--r--mod/cloud.php28
-rw-r--r--mod/filestorage.php3
-rw-r--r--mod/settings.php2
-rw-r--r--mod/siteinfo.php4
5 files changed, 48 insertions, 10 deletions
diff --git a/mod/admin.php b/mod/admin.php
index fbd342425..950c7e5ce 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -215,13 +215,14 @@ function admin_page_site_post(&$a){
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
- $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
+ $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
+ $admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
- $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
- $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : '');
- $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
- $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
+ $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
+ $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : '');
+ $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
+ $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
@@ -301,6 +302,12 @@ function admin_page_site_post(&$a){
set_config('system','banner', $banner);
}
+ if ($admininfo==''){
+ del_config('system','admininfo');
+ }
+ else {
+ set_config('system','admininfo', $admininfo);
+ }
set_config('system','language', $language);
set_config('system','theme', $theme);
if ( $theme_mobile === '---' ) {
@@ -393,6 +400,9 @@ function admin_page_site(&$a) {
$banner = 'red';
$banner = htmlspecialchars($banner);
+ /* Admin Info */
+ $admininfo = get_config('system','admininfo');
+
/* Register policy */
$register_choices = Array(
REGISTER_CLOSED => t("Closed"),
@@ -427,6 +437,7 @@ function admin_page_site(&$a) {
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
+ '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
diff --git a/mod/cloud.php b/mod/cloud.php
index de42249fe..18b61f941 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -67,13 +67,18 @@ function cloud_init(&$a) {
$auth->observer = $ob_hash;
}
+ if($_GET['davguest'])
+ $_SESSION['davguest'] = true;
+
+
$_SERVER['QUERY_STRING'] = str_replace(array('?f=','&f='),array('',''),$_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = preg_replace('/[\?&]zid=(.*?)([\?&]|$)/ism','',$_SERVER['QUERY_STRING']);
+ $_SERVER['QUERY_STRING'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism','',$_SERVER['QUERY_STRING']);
$_SERVER['REQUEST_URI'] = str_replace(array('?f=','&f='),array('',''),$_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = preg_replace('/[\?&]zid=(.*?)([\?&]|$)/ism','',$_SERVER['REQUEST_URI']);
-
+ $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism','',$_SERVER['REQUEST_URI']);
$rootDirectory = new RedDirectory('/',$auth);
$server = new DAV\Server($rootDirectory);
@@ -82,8 +87,27 @@ function cloud_init(&$a) {
$server->addPlugin($lockPlugin);
+ // The next section of code allows us to bypass prompting for http-auth if a FILE is being accessed anonymously and permissions
+ // allow this. This way one can create hotlinks to public media files in their cloud and anonymous viewers won't get asked to login.
+ // If a DIRECTORY is accessed or there are permission issues accessing the file and we aren't previously authenticated via zot,
+ // prompt for HTTP-auth. This will be the default case for mounting a DAV directory.
+ // In order to avoid prompting for passwords for viewing a DIRECTORY, add the URL query parameter 'davguest=1'
+
+ $isapublic_file = false;
+ $davguest = ((x($_SESSION,'davguest')) ? true : false);
+
+ if((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
+ try {
+ $x = RedFileData('/' . $a->cmd,$auth);
+ if($x instanceof RedFile)
+ $isapublic_file = true;
+ }
+ catch ( Exception $e ) {
+ $isapublic_file = false;
+ }
+ }
- if(! $auth->observer) {
+ if((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
try {
$auth->Authenticate($server, t('Red Matrix - Guests: Username: {your email address}, Password: +++'));
}
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 18760dd45..3e53a1e93 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -69,7 +69,6 @@ function filestorage_content(&$a) {
return;
}
- // TODO This will also need to check for files on disk and delete them from there as well as the DB.
if(argc() > 3 && argv(3) === 'delete') {
if(! $perms['write_storage']) {
@@ -110,7 +109,7 @@ function filestorage_content(&$a) {
$channel = $a->get_channel();
- $cloudpath = get_cloudpath($f);
+ $cloudpath = get_cloudpath($f) . (($f['flags'] & ATTACH_FLAG_DIR) ? '?f=&davguest=1' : '');
$aclselect_e = populate_acl($f);
$is_a_dir = (($f['flags'] & ATTACH_FLAG_DIR) ? true : false);
diff --git a/mod/settings.php b/mod/settings.php
index 5aa018cc2..ee6ef45de 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -635,7 +635,7 @@ function settings_content(&$a) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
- $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
+ $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(feature_enabled(local_user(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
}
}
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 9f65f59e4..37cba02ec 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -88,6 +88,8 @@ function siteinfo_content(&$a) {
else
$plugins_text = t('No installed plugins/addons/apps');
+ $admininfo = bbcode(get_config('system','admininfo'));
+
$o = replace_macros(get_markup_template('siteinfo.tpl'), array(
'$title' => t('Red'),
'$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralised privacy enhanced websites.'),
@@ -99,6 +101,8 @@ function siteinfo_content(&$a) {
'$bug_link_url' => 'https://github.com/friendica/red/issues',
'$bug_link_text' => 'redmatrix issues',
'$contact' => t('Suggestions, praise, donations, etc. - please email "redmatrix" at librelist - dot com'),
+ '$adminlabel' => t('Site Administrators'),
+ '$admininfo' => $admininfo,
'$plugins_text' => $plugins_text,
'$plugins_list' => $plugins_list
));