diff options
Diffstat (limited to 'mod/settings.php')
-rw-r--r-- | mod/settings.php | 72 |
1 files changed, 22 insertions, 50 deletions
diff --git a/mod/settings.php b/mod/settings.php index b0ba04dfc..8bfff3765 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -123,13 +123,6 @@ function settings_post(&$a) { call_hooks('feature_settings_post', $_POST); - if($_POST['dspr-submit']) { - set_pconfig(local_channel(),'system','diaspora_allowed',intval($_POST['dspr_allowed'])); - set_pconfig(local_channel(),'system','diaspora_public_comments',intval($_POST['dspr_pubcomment'])); - set_pconfig(local_channel(),'system','prevent_tag_hijacking',intval($_POST['dspr_hijack'])); - info( t('Diaspora Policy Settings updated.') . EOL); - } - build_sync_packet(); return; } @@ -318,17 +311,16 @@ function settings_post(&$a) { foreach($global_perms as $k => $v) { $set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' '; } - - $str_group_allow = perms2str($_POST['group_allow']); - $str_contact_allow = perms2str($_POST['contact_allow']); - $str_group_deny = perms2str($_POST['group_deny']); - $str_contact_deny = perms2str($_POST['contact_deny']); - $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' - where channel_id = %d", - dbesc($str_contact_allow), - dbesc($str_group_allow), - dbesc($str_contact_deny), - dbesc($str_group_deny), + $acl = new AccessList($channel); + $acl->set_from_array($_POST); + $x = $acl->get(); + + $r = q("update channel set channel_allow_cid = '%s', channel_allow_gid = '%s', + channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d", + dbesc($x['allow_cid']), + dbesc($x['allow_gid']), + dbesc($x['deny_cid']), + dbesc($x['deny_gid']), intval(local_channel()) ); } @@ -373,10 +365,9 @@ function settings_post(&$a) { ); } - $r = q("update abook set abook_my_perms = %d where abook_channel = %d and (abook_flags & %d)>0", + $r = q("update abook set abook_my_perms = %d where abook_channel = %d and abook_self = 1", intval(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0), - intval(local_channel()), - intval(ABOOK_FLAG_SELF) + intval(local_channel()) ); set_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0)); @@ -401,6 +392,8 @@ function settings_post(&$a) { $maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0); $expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0); $evdays = ((x($_POST,'evdays')) ? intval($_POST['evdays']) : 3); + $photo_path = ((x($_POST,'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : ''); + $attach_path = ((x($_POST,'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : ''); $channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : ''); @@ -507,6 +500,8 @@ function settings_post(&$a) { set_pconfig(local_channel(),'system','vnotify',$vnotify); set_pconfig(local_channel(),'system','always_show_in_notices',$always_show_in_notices); set_pconfig(local_channel(),'system','evdays',$evdays); + set_pconfig(local_channel(),'system','photo_path',$photo_path); + set_pconfig(local_channel(),'system','attach_path',$attach_path); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d", dbesc($username), @@ -661,35 +656,17 @@ function settings_content(&$a) { $settings_addons = ""; $o = ''; - $diaspora_enabled = get_config('system','diaspora_enabled'); $r = q("SELECT * FROM `hook` WHERE `hook` = 'feature_settings' "); - if((! $r) && (! $diaspora_enabled)) + if(! $r) $settings_addons = t('No feature settings configured'); - if($diaspora_enabled) { - $dspr_allowed = get_pconfig(local_channel(),'system','diaspora_allowed'); - if($dspr_allowed === false) - $dspr_allowed = 1; - $pubcomments = get_pconfig(local_channel(),'system','diaspora_public_comments'); - if($pubcomments === false) - $pubcomments = 1; - $hijacking = get_pconfig(local_channel(),'system','prevent_tag_hijacking'); - } - call_hooks('feature_settings', $settings_addons); $tpl = get_markup_template("settings_addons.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_featured"), '$title' => t('Feature/Addon Settings'), - '$diaspora_enabled' => $diaspora_enabled, - '$dsprdesc' => t('Settings for the built-in Diaspora emulator'), - '$pubcomments' => array('dspr_pubcomment', t('Allow any Diaspora member to comment on your public posts'), $pubcomments, '', $yes_no), - '$dspr_allowed' => array('dspr_allowed', t('Enable the Diaspora protocol for this channel'), $dspr_allowed, '', $yes_no), - '$dsprtitle' => t('Diaspora Policy Settings'), - '$hijacking' => array('dspr_hijack', t('Prevent your hashtags from being redirected to other sites'), $hijacking, '', $yes_no), - '$dsprsubmit' => t('Submit'), '$settings_addons' => $settings_addons )); return $o; @@ -1005,15 +982,8 @@ function settings_content(&$a) { $stpl = get_markup_template('settings.tpl'); - $celeb = false; - - $perm_defaults = array( - 'allow_cid' => $channel['channel_allow_cid'], - 'allow_gid' => $channel['channel_allow_gid'], - 'deny_cid' => $channel['channel_deny_cid'], - 'deny_gid' => $channel['channel_deny_gid'] - ); - + $acl = new AccessList($channel); + $perm_defaults = $acl->get(); require_once('include/group.php'); $group_select = mini_group_select(local_channel(),$channel['channel_default_group']); @@ -1132,7 +1102,9 @@ function settings_content(&$a) { '$expert' => feature_enabled(local_channel(),'expert'), '$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'), '$lbl_misc' => t('Miscellaneous Settings'), - '$menus' => $menu, + '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), '%Y - current year, %m - current month'), + '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), '%Y - current year, %m - current month'), + '$menus' => $menu, '$menu_desc' => t('Personal menu to display in your channel pages'), '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), |