From 3b97a9f76664be49ab70537bbc7fc1131f157e80 Mon Sep 17 00:00:00 2001 From: phellmes Date: Mon, 15 Feb 2016 21:23:04 +0100 Subject: Add string translation to auto approval option Make the description for the auto-approval option translatable. Put the switch array of that option (with another missing t-funtion) into a $yes_no variable to be consistent with other settings pages. --- mod/connedit.php | 66 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/mod/connedit.php b/mod/connedit.php index cb785fc31..d50783d31 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -25,7 +25,7 @@ function connedit_init(&$a) { return; if((argc() >= 2) && intval(argv(1))) { - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -58,14 +58,14 @@ function connedit_post(&$a) { $channel = $a->get_channel(); // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the - // connection enable is toggled to a special autopost url and set permissions immediately, leaving - // the other form elements alone pending a manual submit of the form. The downside is that there + // connection enable is toggled to a special autopost url and set permissions immediately, leaving + // the other form elements alone pending a manual submit of the form. The downside is that there // will be a window of opportunity when the permissions have been set but before you've had a chance // to review and possibly restrict them. The upside is we won't have to warn you that your connection - // can't do anything until you save the bloody form. + // can't do anything until you save the bloody form. $autopost = (((argc() > 2) && (argv(2) === 'auto')) ? true : false); - + $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($contact_id), intval(local_channel()) @@ -145,7 +145,7 @@ function connedit_post(&$a) { if($z) { $record = $z[0]['xlink_id']; - $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s' + $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s' where xlink_id = %d", intval($rating), dbesc($rating_text), @@ -172,7 +172,7 @@ function connedit_post(&$a) { } if($record) { proc_run('php','include/ratenotif.php','rating',$record); - } + } } if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) { @@ -181,7 +181,7 @@ function connedit_post(&$a) { // @fixme it won't be common, but when you accept a new connection request // the permissions will now be that of your permissions role and ignore // any you may have set manually on the form. We'll probably see a bug if somebody - // tries to set the permissions *and* approve the connection in the same + // tries to set the permissions *and* approve the connection in the same // request. The workaround is to approve the connection, then go back and // adjust permissions as desired. @@ -210,7 +210,7 @@ function connedit_post(&$a) { intval(local_channel()) ); - if($orig_record[0]['abook_profile'] != $profile_id) { + if($orig_record[0]['abook_profile'] != $profile_id) { //Update profile photo permissions logger('A new profile was assigned - updating profile photos'); @@ -224,7 +224,7 @@ function connedit_post(&$a) { else notice( t('Failed to update connection record.') . EOL); - if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms + if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms && (! intval($a->poi['abook_self']))) { proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id); } @@ -238,8 +238,8 @@ function connedit_post(&$a) { group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']); } - // Check if settings permit ("post new friend activity" is allowed, and - // friends in general or this friend in particular aren't hidden) + // Check if settings permit ("post new friend activity" is allowed, and + // friends in general or this friend in particular aren't hidden) // and send out a new friend activity $pr = q("select * from profile where uid = %d and is_default = 1 and hide_friends = 0", @@ -285,7 +285,7 @@ function connedit_post(&$a) { // Refresh the structure in memory with the new data - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -300,7 +300,7 @@ function connedit_post(&$a) { call_hooks('accept_follow', $arr); } - if(! is_null($autoperms)) + if(! is_null($autoperms)) set_pconfig(local_channel(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0)); connedit_clone($a); @@ -322,7 +322,7 @@ function connedit_clone(&$a) { if(! $a->poi) return; - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -365,6 +365,8 @@ function connedit_content(&$a) { $my_perms = $x['perms_accept']; } + $yes_no = array(t('No'),t('Yes')); + if($my_perms) { $o .= "