Skip to content

Commit

Permalink
#27 #97 #58 #95 #93 #91 #90
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Aug 6, 2009
1 parent 64e5387 commit 7ae4ce3
Show file tree
Hide file tree
Showing 25 changed files with 671 additions and 112 deletions.
8 changes: 7 additions & 1 deletion app/identica/controllers/dents.php
Expand Up @@ -106,8 +106,14 @@ function _edit( &$vars ) {
'enabled'=>'enabled'
);

$RemoteServer =& $db->model('RemoteServer');
$RemoteServer->find();
$servers = array();
while ($r = $RemoteServer->MoveNext())
$servers[] = $r;

return vars(
array( &$akidentica_tw_text_options,&$status,&$staturl,&$pword,&$userurl,&$passurl,&$password,&$sEntry,&$username,&$uEntry,&$pEntry, &$profile ),
array( &$servers,&$akidentica_tw_text_options,&$status,&$staturl,&$pword,&$userurl,&$passurl,&$password,&$sEntry,&$username,&$uEntry,&$pEntry, &$profile ),
get_defined_vars()
);

Expand Down
6 changes: 6 additions & 0 deletions app/identica/views/dents/_edit.html
Expand Up @@ -108,6 +108,8 @@

});

<?php setting_widget_text_post_helper('server',$serverurl); ?>

// ]]>
</script>

Expand All @@ -134,6 +136,10 @@ <h4><?php echo $txt['identica_settings_status']; ?>:</h4>
</div>

<br /><br />
<p class="jeditable_server" id="jeditable_server"></p>






96 changes: 96 additions & 0 deletions app/omb/controllers/admin.php
Expand Up @@ -57,6 +57,102 @@ function _theme( &$vars ) {

}

function _config( &$vars ) {

// admin/index() is executing before this code
// good for security, !member_of test
// but it's slow XXX

extract( $vars );
$Setting =& $db->model('Setting');

$Setting->find_by(array(
'eq' => 'like',
'name' => 'config%'
));

$setenv = array();
$setperm = array();
$setother = array();

$returnvars = array();

while ($s = $Setting->MoveNext()) {

$set = split('\.',$s->name);

if (is_array($set) && $set[0] == 'config') {

if ($set[1] == 'env') {


$modevar = 'n'.$set[2].'mode';
$urlvar = 'n'.$set[2].'url';
$entryvar = 'n'.$set[2].'entry';

$$modevar = $s;

if ($$modevar->id) {
$setenv[$set[2]] = $s->value;
$$urlvar = $request->url_for(array('resource'=>'settings','id'=>$$modevar->id,'action'=>'put'));
$$entryvar = $$modevar->FirstChild('entries');

$returnvars[] = &$$modevar;
$returnvars[] = &$$urlvar;
$returnvars[] = &$$entryvar;
}

} elseif ($set[1] == 'perms') {

$setperm[$set[2]] = $s->value;
//$tab =& $db->models[$set[2]];
//if ($tab)
// $tab->permission_mask( $set[3],$s->value,$set[4] );

} else {

$setother[$set[2]] = $s->value;

}
}
}
global $env;

$envpost = array();
foreach ($env as $k=>$v) {
if (!is_array($v) && !isset($setenv[$k]) && substr($k,0,5) =='site_') {
$envpost[$k] = $v;
$urlvar = 'n'.$k.'url';
$$urlvar = $request->url_for(array('resource'=>'settings','action'=>'post'));
$returnvars[] = &$$urlvar;
}
}

$envpost2 = array();
foreach ($env as $k=>$v) {
if (!is_array($v) && !isset($setenv[$k]) && substr($k,0,5) !='site_') {
$envpost2[$k] = $v;
$urlvar = 'n'.$k.'url';
$$urlvar = $request->url_for(array('resource'=>'settings','action'=>'post'));
$returnvars[] = &$$urlvar;
}
}

$returnvars[] = &$envpost;
$returnvars[] = &$envpost2;
$returnvars[] = &$setenv;
$returnvars[] = &$setperm;
$returnvars[] = &$setother;
$returnvars[] = &$env;

return vars(
$returnvars,
get_defined_vars()
);

}


function index( &$vars ) {
extract( $vars );

Expand Down
87 changes: 86 additions & 1 deletion app/omb/controllers/identities.php
Expand Up @@ -347,9 +347,47 @@ function _edit( &$vars ) {
}
$n2url = $request->url_for(array('resource'=>'settings','id'=>$n2mode->id,'action'=>'put'));
$n2entry = $n2mode->FirstChild('entries');

$settingvalue = $Setting->find_by(array('name'=>'background_image','profile_id'=>get_profile_id()));

if (!$settingvalue) {
$settingvalue = $Setting->base();
$settingvalue->set_value('profile_id',get_profile_id());
$settingvalue->set_value('person_id',get_person_id());
$settingvalue->set_value('name','background_image');
$settingvalue->save_changes();
$settingvalue->set_etag();
$settingvalue = $Setting->find($settingvalue->id);
}

// get the one-to-one-related child-record from "entries"
$sEntry =& $settingvalue->FirstChild('entries');

$settingurl = $request->url_for(array('resource'=>'settings','id'=>$settingvalue->id,'action'=>'put'));

$setting_name = 'background_tile';
$boolean_options = array(
'0'=>'false',
'1'=>'true'
);
$setting_list = $boolean_options;
$setting_mode = $Setting->find_by(array('name'=>$setting_name,'profile_id'=>get_profile_id()));
if (!$setting_mode) {
$setting_mode = $Setting->base();
$setting_mode->set_value('profile_id',get_profile_id());
$setting_mode->set_value('person_id',get_person_id());
$setting_mode->set_value('name',$setting_name);
$setting_mode->set_value('value','0');
$setting_mode->save_changes();
$setting_mode->set_etag();
$setting_mode = $Setting->find($setting_mode->id);
}
$setting_url = $request->url_for(array('resource'=>'settings','id'=>$setting_mode->id,'action'=>'put'));
$setting_entry = $setting_mode->FirstChild('entries');


return vars(
array( &$Member, &$Entry, &$profile, &$identity_tz_options, &$n2mode,&$n2url,&$n2entry,&$n2list ),
array( &$Member, &$Entry, &$profile, &$identity_tz_options, &$n2mode,&$n2url,&$n2entry,&$n2list,&$setting_mode,&$setting_url,&$setting_entry,&$setting_list, &$settingurl, &$settingvalue, &$boolean_options, &$sEntry ),
get_defined_vars()
);
}
Expand Down Expand Up @@ -525,3 +563,50 @@ function installed_apps_json( &$vars ) {
exit;
}

function _background( &$vars ) {
extract( $vars );

$settingvalue = $Setting->find_by(array('name'=>'background_image','profile_id'=>get_profile_id()));

if (!$settingvalue) {
$settingvalue = $Setting->base();
$settingvalue->set_value('profile_id',get_profile_id());
$settingvalue->set_value('person_id',get_person_id());
$settingvalue->set_value('name','background_image');
$settingvalue->save_changes();
$settingvalue->set_etag();
$settingvalue = $Setting->find($settingvalue->id);
}

// get the one-to-one-related child-record from "entries"
$Entry =& $settingvalue->FirstChild('entries');

$settingurl = $request->url_for(array('resource'=>'settings','id'=>$settingvalue->id,'action'=>'put'));

$setting_name = 'background_tile';
$boolean_options = array(
'0'=>'false',
'1'=>'true'
);
$setting_list = $boolean_options;
$setting_mode = $Setting->find_by(array('name'=>$setting_name,'profile_id'=>get_profile_id()));
if (!$setting_mode) {
$setting_mode = $Setting->base();
$setting_mode->set_value('profile_id',get_profile_id());
$setting_mode->set_value('person_id',get_person_id());
$setting_mode->set_value('name',$setting_name);
$setting_mode->set_value('value','0');
$setting_mode->save_changes();
$setting_mode->set_etag();
$setting_mode = $Setting->find($setting_mode->id);
}
$setting_url = $request->url_for(array('resource'=>'settings','id'=>$setting_mode->id,'action'=>'put'));
$setting_entry = $setting_mode->FirstChild('entries');


return vars(
array( &$setting_mode,&$setting_url,&$setting_entry,&$setting_list,&$Member, &$Entry, &$profile, &$settingurl, &$settingvalue, &$boolean_options ),
get_defined_vars()
);

}
41 changes: 34 additions & 7 deletions app/omb/controllers/posts.php
Expand Up @@ -270,14 +270,45 @@ function _oembed( &$vars ) {

$version = '1.0';

$type = 'photo'; // photo video link rich

$p = $Post->find($id);
$e = $p->FirstChild('entries');
$title = $p->title;

$o = owner_of($p);

if (extension_for($e->content_type) == 'mp3') {
$type = 'rich'; // photo video link rich
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$id,
'action'=>'attachment.mp3'
));
} elseif (extension_for($e->content_type) == 'jpg') {
$type = 'photo';
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$id,
'action'=>'preview'
));
} elseif (extension_for($e->content_type) == 'mov') {
$type = 'video';
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$id,
'action'=>'attachment.mov'
));
} elseif (extension_for($e->content_type) == 'avi') {
$type = 'video';
$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$id,
'action'=>'attachment.avi'
));
} else {
exit;
}


$author_name = $o->nickname;
$author_url = $o->profile;
$cache_age = 3600;
Expand All @@ -288,11 +319,7 @@ function _oembed( &$vars ) {
$thumbnail_width = 0;
$thumbnail_height = 0;

$url = $request->url_for(array(
'resource'=>'posts',
'id'=>$id,
'action'=>'preview'
));


return vars(
array(
Expand Down
5 changes: 5 additions & 0 deletions app/omb/plugins/security.php
Expand Up @@ -860,6 +860,11 @@ function _oauth( &$vars ) {
$i = $Identity->find($twuser->profile_id);
if (!$i)
trigger_error('sorry I was unable to find the identity', E_USER_ERROR);
if ($session_oauth_token != $twuser->oauth_key) {
$twuser->set_value('oauth_key',$session_oauth_token);
$twuser->set_value('oauth_secret',$session_oauth_secret);
$twuser->save_changes();
}
}
} else {
// c
Expand Down
16 changes: 15 additions & 1 deletion app/omb/plugins/wp.php
Expand Up @@ -2133,7 +2133,21 @@ function followgrid() {

}


function in_reply_to(&$the_post) {
$text = ' ';
if ($the_post->parent_id > 0) {
global $db,$request;
$result = $db->get_result("select profile_id from ".$db->prefix."posts where id = ".$the_post->parent_id);
if ($db->num_rows($result) == 1) {
$id = $db->result_value($result,0,"profile_id");
$profile = get_profile($id);
$text .= '<a href="'.$request->url_for(array('resource'=>'posts','id'=>$the_post->parent_id)).'">';
$text .= 'in reply to '.$profile->nickname;
$text .= '</a>';
}
}
return $text;
}



Expand Down
23 changes: 16 additions & 7 deletions app/omb/views/admin/index.html
Expand Up @@ -16,7 +16,7 @@
$("#tabs").click(function() {

var b = $("#tabs").tabs('option', 'selected');
if (b == 5) location.href='<?php base_url(); ?>';
if (b == 6) location.href='<?php base_url(); ?>';

});
});
Expand All @@ -32,15 +32,22 @@
<ul>

<li><a href="#tabs-1">Admin</a></li>
<li><a href="<?php url_for(array(
'resource'=>'admin',
'action'=>'config/partial'
)); ?>">Config</a></li>
<li><a href="<?php url_for(array(
'resource'=>'admin',
'action'=>'sources/partial'
)); ?>">Sources</a></li>
<?php if (environment('categories')) : ?>
<li><a href="<?php url_for(array(
'resource'=>'categories',
'action'=>'manage/partial'
)); ?>">Categories</a></li>

<?php else : ?>
<li><a href="#tabs-3">&nbsp;</a></li>
<?php endif; ?>
<li><a href="<?php url_for(array(
'resource'=>'admin',
'action'=>'theme/partial'
Expand Down Expand Up @@ -204,7 +211,12 @@
<p>
OpenMicroblogger Administration Tools
</p>
<p>


<ul class="admin-settings">
<li class="admin-settings"><a href="<?php url_for(array('resource'=>'migrate')); ?>">Update Database</a></li>
<li class="admin-settings"><a href="<?php url_for(array('resource'=>'groups')); ?>">Rest API Permissions</a></li>
</ul> <p>
<table cellpadding="10" border="0">
<tr>
<td>
Expand Down Expand Up @@ -265,10 +277,7 @@ <h4>Preview Image Size (in pixels):</h4>


</p>
<ul class="admin-settings">
<li class="admin-settings"><a href="<?php url_for(array('resource'=>'migrate')); ?>">Update Database</a></li>
<li class="admin-settings"><a href="<?php url_for(array('resource'=>'groups')); ?>">Rest API Permissions</a></li>
</ul>

</div>

</div>
Expand Down

0 comments on commit 7ae4ce3

Please sign in to comment.