Now we also refresh permissions after the user posted connedit.

This commit is contained in:
sirius 2014-04-20 00:58:26 +02:00
parent 3845e1de7d
commit 6cf5a69d7e
2 changed files with 64 additions and 3 deletions

View File

@ -1,5 +1,11 @@
<?php <?php
/* @file connedit.php
* @brief In this file the connection-editor form is generated and evaluated.
*
*
*/
require_once('include/Contact.php'); require_once('include/Contact.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
@ -8,6 +14,11 @@ require_once('include/contact_widgets.php');
require_once('include/zot.php'); require_once('include/zot.php');
require_once('include/widgets.php'); require_once('include/widgets.php');
/* @brief Initialize the connection-editor
*
*
*/
function connedit_init(&$a) { function connedit_init(&$a) {
if(! local_user()) if(! local_user())
@ -31,6 +42,10 @@ function connedit_init(&$a) {
} }
/* @brief Evaluate posted values and set changes
*
*/
function connedit_post(&$a) { function connedit_post(&$a) {
if(! local_user()) if(! local_user())
@ -103,6 +118,15 @@ function connedit_post(&$a) {
intval(local_user()) intval(local_user())
); );
if($orig_record[0]['abook_profile'] != $profile_id) { //Update profile photo permissions
logger('As a new profile was assigned updateing profile photos');
require_once('mod/profile_photo.php');
profile_photo_set_profile_perms($profile_id);
}
if($r) if($r)
info( t('Connection updated.') . EOL); info( t('Connection updated.') . EOL);
else else
@ -158,6 +182,11 @@ function connedit_post(&$a) {
} }
/* @brief Clone connection
*
*
*/
function connedit_clone(&$a) { function connedit_clone(&$a) {
if(! $a->poi) if(! $a->poi)
@ -171,6 +200,10 @@ function connedit_clone(&$a) {
build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone))); build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone)));
} }
/* @brief Generate content of connection edit page
*
*
*/
function connedit_content(&$a) { function connedit_content(&$a) {

View File

@ -18,7 +18,7 @@ function profile_photo_set_profile_perms($profileid = '') {
$allowcid = ''; $allowcid = '';
if (x($profileid)) { if (x($profileid)) {
$r = q("SELECT photo, profile_guid, id, is_default, uid FROM profile WHERE profile.id = %d LIMIT 1", intval($profileid)); $r = q("SELECT photo, profile_guid, id, is_default, uid FROM profile WHERE profile.id = %d OR profile.profile_guid = '%s' LIMIT 1", intval($profileid), dbesc($profileid));
} else { } else {
@ -53,6 +53,13 @@ function profile_photo_set_profile_perms($profileid = '') {
return; return;
} }
/* @brief Initalize the profile-photo edit view
*
* @param $a Current application
* @return void
*
*/
function profile_photo_init(&$a) { function profile_photo_init(&$a) {
if(! local_user()) { if(! local_user()) {
@ -64,6 +71,12 @@ function profile_photo_init(&$a) {
} }
/* @brief Evaluate posted values
*
* @param $a Current application
* @return void
*
*/
function profile_photo_post(&$a) { function profile_photo_post(&$a) {
@ -235,6 +248,13 @@ function profile_photo_post(&$a) {
} }
/* @brief Generate content of profile-photo view
*
* @param $a Current application
* @return void
*
*/
if(! function_exists('profile_photo_content')) { if(! function_exists('profile_photo_content')) {
function profile_photo_content(&$a) { function profile_photo_content(&$a) {
@ -367,6 +387,14 @@ function profile_photo_content(&$a) {
return; // NOTREACHED return; // NOTREACHED
}} }}
/* @brief Generate the UI for photo-cropping
*
* @param $a Current application
* @param $ph Photo-Factory
* @return void
*
*/
if(! function_exists('profile_photo_crop_ui_head')) { if(! function_exists('profile_photo_crop_ui_head')) {
function profile_photo_crop_ui_head(&$a, $ph){ function profile_photo_crop_ui_head(&$a, $ph){