Skip to content

Commit

Permalink
show my Tweeple in my Personal tab
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Nov 7, 2008
1 parent 1669833 commit 80fd1aa
Show file tree
Hide file tree
Showing 14 changed files with 300 additions and 50 deletions.
1 change: 1 addition & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ env:
awsSecretKey:
awsBucket:

zeepKeyWord:
zeepAccessKey:
zeepSecretKey:
zeepUrl: https://api.zeepmobile.com/messaging/2008-07-14/send_message
Expand Down
49 changes: 36 additions & 13 deletions app/plugins/wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,28 +784,48 @@ function attribute_escape( $value ) {
function the_post() {
global $the_post,$response,$the_author,$the_entry,$request;
$the_post =& $response->collection->MoveNext();
if (isset($the_post->profile_id)){
if (isset($the_post->profile_id) && $the_post->table == 'posts'){
$the_author = get_profile($the_post->profile_id);
}else{
global $db;
$Identity =& $db->model('Identity');
if ($the_post) {
$the_entry = $the_post->FirstChild( 'entries' );
if ($the_entry->person_id) {
$the_author = $Identity->find_by('entries.person_id',$the_entry->person_id);
if ($the_post && $the_post->table == 'ak_twitter') {

$TwitterUser =& $db->model('TwitterUser');
$the_author = $TwitterUser->find_by('twitter_id',$the_post->profile_id);
if ($the_author) {
$the_author->profile_url = $the_author->url;
$the_author->profile = $the_author->url;
$the_author->nickname = $the_author->screen_name;
$the_author->email_value = '';

$the_author->avatar = $the_author->profile_image_url;
$the_author->fullname = $the_author->name;
$the_author->id = $the_author->twitter_id;

$the_post->local = 0;
$the_post->parent_id = 0;
$the_post->title = $the_post->tw_text;
}
} else {

if ($the_post) {
$the_entry = $the_post->FirstChild( 'entries' );
if ($the_entry && $the_entry->person_id) {
$the_author = owner_of($the_post);
} else {
$the_author = $Identity->base();
}
} else {
$Post =& $db->model('Post');
$the_post = $Post->base();
$the_author = $Identity->base();
}
} else {
$Post =& $db->model('Post');
$the_post = $Post->base();
}
}



if (!empty($the_author->profile_url)) $the_author->profile = $the_author->profile_url;

global $comment_author;
global $comment_author_email;
global $comment_author_url;
Expand All @@ -816,7 +836,7 @@ function the_post() {

// show pretty URLs if not a Remote user
if (empty($the_author->post_notice)) $the_author->profile = $request->url_for(array('resource'=>$the_author->nickname));

return "";
}
function get_links() {
Expand Down Expand Up @@ -961,7 +981,7 @@ function have_posts() {
return false;
if (!$response->collection->EOF && (0 < $rows))
return true;
return $response->collection->EOF;
return !$response->collection->EOF;
}

function get_author_feed_link( $id ) {
Expand Down Expand Up @@ -1076,6 +1096,9 @@ function get_settings($opt) {
function wp_specialchars($var) {
return htmlspecialchars($var);
}
function make_clickable($text) {
return $text;
}
function is_home() {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions app/views/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<!-- list of collection members -->
<?php foreach ( $collection->members as $id => $resource ) : ?>
<a href="<?php print url_for( array( 'resource'=>$resource, 'id'=>$id ) ); ?>">
<?php print classify($resource) . " " . $id . "<br>"; ?>
<a href="<?php print url_for( array( 'resource'=>$collection->resource, 'id'=>$id ) ); ?>">
<?php print classify($collection->resource) . " " . $id . "<br>"; ?>
</a>
<?php endforeach; ?>

Expand Down
11 changes: 10 additions & 1 deletion app/views/_mobile.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@
style="width: 100%; height: 300px; border: none;"
id="zeep_mobile_settings_panel"
src="https://secure.zeepmobile.com/subscription/settings?api_key=<?php echo environment('zeepAccessKey'); ?>&user_id=<?php echo get_profile_id(); ?>">
</iframe>
</iframe>
<?php $kw = environment('zeepKeyWord'); global $request; ?>
<div><br /><br /><br />
<?php if (!empty($kw)) : ?>
<p>Use the Zeep Mobile control panel (above) to set your phone number.</p>
<p>
Post to <?php echo $request->base; ?> from your phone like this:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<b><?php echo $kw; ?></b> hello <?php echo environment('site_title'); ?>!&quot;
</p>
<?php endif; ?>
</div>
8 changes: 5 additions & 3 deletions app/views/identities/_subs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$Subscription =& $db->model('Subscription');
$Identity =& $db->model('Identity');


$zeep = environment('zeepKeyWord');
?>


Expand All @@ -24,12 +24,13 @@ <h3><?php echo $si->nickname; ?>
&nbsp;(<?php echo $si->fullname; ?>)
<?php endif; ?></h3>

<p><a style="hover:none;" href="<?php echo $request->url_for(array('resource'=>$si->nickname)); ?>"><img style="border:none;width:48px;height:48px;" src="<?php echo $si->avatar; ?>"></a>&nbsp;&nbsp;&nbsp;&nbsp;SMS&nbsp;<input name="do_sms<?php echo $subscriber->id; ?>" id="do_sms<?php echo $subscriber->id; ?>" type="checkbox" <?php if ($subscriber->sms) echo "checked"; ?>>&nbsp;&nbsp;&nbsp;&nbsp;E-mail&nbsp;<input name="do_email<?php echo $subscriber->id; ?>" id="do_email<?php echo $subscriber->id; ?>" type="checkbox" <?php if ($subscriber->email) echo "checked"; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<a style="hover:none;" href="<?php echo $request->url_for(array('resource'=>'subscriptions','id'=>$subscriber->id,'action'=>'remove')); ?>"><img style="border:none;width:16px;height:16px;" src="resource/block.gif"></a></p>
<p><a style="hover:none;" href="<?php echo $request->url_for(array('resource'=>$si->nickname)); ?>"><img style="border:none;width:48px;height:48px;" src="<?php echo $si->avatar; ?>"></a>&nbsp;&nbsp;&nbsp;&nbsp;<?php if (!empty($zeep)) : ?>SMS&nbsp;<input name="do_sms<?php echo $subscriber->id; ?>" id="do_sms<?php echo $subscriber->id; ?>" type="checkbox" <?php if ($subscriber->sms) echo "checked"; ?>><?php endif; ?>&nbsp;&nbsp;&nbsp;&nbsp;E-mail&nbsp;<input name="do_email<?php echo $subscriber->id; ?>" id="do_email<?php echo $subscriber->id; ?>" type="checkbox" <?php if ($subscriber->email) echo "checked"; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<a style="hover:none;" href="<?php echo $request->url_for(array('resource'=>'subscriptions','id'=>$subscriber->id,'action'=>'remove')); ?>"><img style="border:none;width:16px;height:16px;" src="resource/block.gif"></a></p>


<script type="text/javascript">
$(document).ready(function(){


<?php if (!empty($zeep)) : ?>
$("#do_sms<?php echo $subscriber->id; ?>").click(function(e){
var submitdata = {};
if (!$("#do_sms<?php echo $subscriber->id; ?>").attr('checked')) {
Expand All @@ -46,6 +47,7 @@ <h3><?php echo $si->nickname; ?>
//alert(str);
});
});
<?php endif; ?>

$("#do_email<?php echo $subscriber->id; ?>").click(function(e){
var submitdata = {};
Expand Down
4 changes: 2 additions & 2 deletions app/views/introspection/_index.atom
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<?php if (isset($collection)) : ?>
<?php foreach ( $collection->members as $resource ) : ?>
<collection
href="<?php url_for( $resource ); ?>">
<atom:title><?php print ucwords($resource); ?></atom:title>
href="<?php url_for( $collection->resource ); ?>">
<atom:title><?php print ucwords($collection->resource); ?></atom:title>
<accept>entry</accept>
<categories fixed="yes">
<atom:category
Expand Down
17 changes: 15 additions & 2 deletions db/library/dbscript/_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,8 @@ function render_theme( $theme ) {
global $req, $wp_rewrite, $wp_version, $openid, $user_identity, $logic;
global $submenu;
global $comment_author;
global $comment_author_email;
global $comment_author_url;
global $comment_author_email;
global $comment_author_url;

$folder = $GLOBALS['PATH']['themes'] . $theme . DIRECTORY_SEPARATOR;

Expand Down Expand Up @@ -2396,4 +2396,17 @@ function app_init($appname) {
}


function array_sort($array,$key){
for ($i = 0; $i < sizeof($array); $i++) {
$sort_values[$i] = $array[$i][$key];
}
arsort ($sort_values);
reset ($sort_values);
while (list ($arr_key, $arr_val) = each ($sort_values)) {
$sorted_arr[] = $array[$arr_key];
}
return $sorted_arr;
}


?>
6 changes: 4 additions & 2 deletions db/library/dbscript/collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ function Collection( $resource, $find_by = NULL, $accept = "text/html" ) {
if (isset($request->params['page']) && !is_array($request->params['page']))
$table->set_offset( ($this->per_page * $request->params['page']) - $this->per_page );

if ( !$request->id )
if ( !( $find_by == NULL ))
$table->find_by( $find_by );
elseif ( !$request->id )
$table->find();
else
$table->find( $request->id );
Expand All @@ -124,7 +126,7 @@ function Collection( $resource, $find_by = NULL, $accept = "text/html" ) {
$Member->etag = $Entry->etag;
}
}
$this->members[$Member->$uri_key] = $resource;
$this->members[$Member->$uri_key] = $Entry->last_modified;
$this->updated = timestamp();
if (isset($Member->modified) && !empty($Member->modified))
$this->updated = $Member->modified;
Expand Down
18 changes: 13 additions & 5 deletions db/library/dbscript/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,19 @@ function &get_objects() {
trigger_before( 'get_objects', $this, $this );
$objects = array();
$skip = array( '.', '..' );
if ( $handle = opendir( model_path() )) {
while ( false !== ( $file = readdir( $handle ))) {
if (!(in_array($file, $skip)) && substr( $file, -4 ) == '.php' ) {
$o = substr( $file, 0, -4 );
$objects[$o] =& $this->get_table( tableize($o) );
$paths = array(model_path());
if (isset($GLOBALS['PATH']['apps'])) {
foreach($GLOBALS['PATH']['apps'] as $k=>$v) {
$paths[] = $v['model_path'];
}
}
foreach ($paths as $path) {
if ( $handle = opendir( $path )) {
while ( false !== ( $file = readdir( $handle ))) {
if (!(in_array($file, $skip)) && substr( $file, -4 ) == '.php' ) {
$o = substr( $file, 0, -4 );
$objects[$o] =& $this->get_table( tableize($o) );
}
}
}
foreach( $objects as $name=>$model )
Expand Down
18 changes: 9 additions & 9 deletions db/library/dbscript/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,19 +589,19 @@ function get_query( $id=NULL, $find_by=NULL, &$model ) {
$spl = split("\.",$val["fkey"]);
if (!($this->models[$spl[0]]->exists))
$$spl[0] =& $this->get_table($spl[0]);
if (($val["type"] != 'child-many'))
$leftsql .= "(";
$leftsql .= "(";
}
$skippedrel = false;

foreach ($relfields as $key=>$val) {
$spl = split("\.",$val["fkey"]);
if (($val["type"] == 'child-many')) {
if ($first)
$skippedrel = true;
continue;
}
foreach ($this->models[$spl[0]]->field_array as $fieldname=>$datatypename) {
$fieldstring .= $spl[0].".".$fieldname." as \"".$spl[0].".".$fieldname."\", " . "\n";
$join =& $this->get_table($model->join_table_for($table, $val['tab']));
$spl[0] = $join->table;
$val["fkey"] = $join->table.'.'.strtolower(classify($table))."_".$model->foreign_key_for( $table);
}else{
foreach ($this->models[$spl[0]]->field_array as $fieldname=>$datatypename) {
$fieldstring .= $spl[0].".".$fieldname." as \"".$spl[0].".".$fieldname."\", " . "\n";
}
}
if ($first)
$leftsql .= $table;
Expand Down
18 changes: 9 additions & 9 deletions db/library/dbscript/postgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,19 +660,19 @@ function get_query( $id=NULL, $find_by=NULL, &$model ) {
$spl = split("\.",$val["fkey"]);
if (!($this->models[$spl[0]]->exists))
$$spl[0] =& $this->get_table($spl[0]);
if (($val["type"] != 'child-many'))
$leftsql .= "(";
$leftsql .= "(";
}
$skippedrel = false;

foreach ($relfields as $key=>$val) {
$spl = split("\.",$val["fkey"]);
if (($val["type"] == 'child-many')) {
if ($first)
$skippedrel = true;
continue;
}
foreach ($this->models[$spl[0]]->field_array as $fieldname=>$datatypename) {
$fieldstring .= $spl[0].".".$fieldname." as \"".$spl[0].".".$fieldname."\", " . "\n";
$join =& $this->get_table($model->join_table_for($table, $val['tab']));
$spl[0] = $join->table;
$val["fkey"] = $join->table.'.'.strtolower(classify($table))."_".$model->foreign_key_for( $table);
}else{
foreach ($this->models[$spl[0]]->field_array as $fieldname=>$datatypename) {
$fieldstring .= $spl[0].".".$fieldname." as \"".$spl[0].".".$fieldname."\", " . "\n";
}
}
if ($first)
$leftsql .= $table;
Expand Down
10 changes: 9 additions & 1 deletion twitter/models/AkTwitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ function AkTwitter() {
$this->auto_field( 'id' );
$this->char_field( 'tw_id' );
$this->char_field( 'tw_text' );
$this->char_field( 'tw_reply_username' );
$this->char_field( 'tw_reply_tweet' );
$this->time_field( 'tw_created_at' );
$this->time_field( 'modified' );
$this->int_field( 'profile_id' );
$this->int_field( 'entry_id' );

$this->has_one('entry');

$this->has_and_belongs_to_many('identities');

// primary key
$this->set_primary_key( 'id' );
Expand All @@ -27,4 +35,4 @@ function AkTwitter() {
}


?>
?>

0 comments on commit 80fd1aa

Please sign in to comment.