Skip to content

Commit

Permalink
permission editor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Apr 11, 2009
1 parent 6f52082 commit f71bce9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
29 changes: 18 additions & 11 deletions app/omb/controllers/posts.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<?php


after_filter( 'append_url_for_blobs', 'insert_from_post' );

function append_url_for_blobs( &$model, &$rec ) {
global $request;
if ((is_upload('posts','attachment'))) {
$post = $model->find($request->id);
if ($post) {
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$post->id
));
$post->set_value('title',substr(substr($post->title,0,140),0,-(strlen($url)+1))." ".$url);
$post->save_changes();
}
}
}

function get( &$vars ) {
extract( $vars );
switch ( count( $collection->members )) {
Expand All @@ -18,17 +35,7 @@ function post( &$vars ) {

$resource->insert_from_post( $request );

if ((is_upload('posts','attachment'))) {
$post = $resource->find($request->id);
if ($post) {
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$post->id
));
$post->set_value('title',substr(substr($post->title,0,140),0,-(strlen($url)+1))." ".$url);
$post->save_changes();
}
}


header_status( '201 Created' );
redirect_to( $request->base );
Expand Down
23 changes: 20 additions & 3 deletions app/omb/plugins/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,14 @@ function _oauth( &$vars ) {

if (empty($user))
trigger_error('The server said: '.$content, E_USER_ERROR );


if (empty($prefix) && in_array('invites',$db->tables)) {
$Invite =& $db->model( 'Invite' );
$result = $Invite->find_by( 'nickname',$user->screen_name );
if (!$result)
trigger_error('Sorry, you have not been invited yet '.environment('email_from'), E_USER_ERROR);
}

$Identity =& $db->model('Identity');
$Person =& $db->model('Person');
$TwitterUser =& $db->model('TwitterUser');
Expand Down Expand Up @@ -866,7 +873,7 @@ function _oauth( &$vars ) {
}

function make_identity( $user ) {
global $db,$prefix;
global $db,$prefix,$request;
$Identity =& $db->model('Identity');
$Person =& $db->model('Person');
$p = $Person->base();
Expand Down Expand Up @@ -895,7 +902,17 @@ function make_identity( $user ) {
$i->set_value( 'person_id', $p->id );
$i->save_changes();
$i->set_etag($p->id);
//$i->set_value( 'profile', $prof );

if (empty($prefix) && in_array('invites',$db->tables)) {
$Membership =& $db->model( 'Membership' );
$m = $Membership->base();
$m->set_value( 'group_id', 4 ); // XXX
$m->set_value( 'person_id', $p->id );
$m->save_changes();
}

$i->set_value( 'profile', $request->url_for(array('resource'=>$nicker)) );
$i->save_changes();
//$i->set_value( 'update_profile', $updateProfile );
//$i->set_value( 'post_notice', $postNotice );
return $i;
Expand Down
8 changes: 4 additions & 4 deletions app/omb/views/groups/_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
});
});
<?php $disabled = true; if (!$disabled) : ?>
<?php foreach($avatars as $key=>$ava) : ?>
<?php $pname = $key."avatar"; ?>
Expand All @@ -74,7 +74,7 @@
});

<?php endforeach; ?>

<?php endif; ?>


});
Expand Down Expand Up @@ -212,7 +212,7 @@ <h3>Permissions:</h3>
</table>
</td></tr></table>
</td></tr>

</form>

<tr><td colspan="2">
<?php
Expand Down Expand Up @@ -274,7 +274,7 @@ <h3>Permissions:</h3>

</td></tr>

</form>

<tr>
<td colspan="2">
<br /><br /><br /><br />
Expand Down

0 comments on commit f71bce9

Please sign in to comment.