+16
-5
@@ -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),
|
||||
|
||||
+26
-2
@@ -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'
|
||||
|
||||
if(! $auth->observer) {
|
||||
$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) && (! $isapublic_file) && (! $davguest)) {
|
||||
try {
|
||||
$auth->Authenticate($server, t('Red Matrix - Guests: Username: {your email address}, Password: +++'));
|
||||
}
|
||||
|
||||
+1
-2
@@ -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);
|
||||
|
||||
+1
-1
@@ -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')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user