Skip to content

Commit

Permalink
You have an error in your SQL syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Aug 5, 2009
1 parent e7e8013 commit 64e5387
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
25 changes: 13 additions & 12 deletions app/omb/controllers/posts.php
Expand Up @@ -18,16 +18,17 @@ function get( &$vars ) {
function post( &$vars ) {
extract( $vars );
global $request;
trigger_before( 'insert_from_post', $Post, $request );
$table = 'posts';
$modelvar = classify($request->resource);
trigger_before( 'insert_from_post', $$modelvar, $request );
$table = $request->resource;
$content_type = 'text/html';
$rec = $Post->base();
if (!($Post->can_create( $table )))
$rec = $$modelvar->base();
if (!($$modelvar->can_create( $table )))
trigger_error( "Sorry, you do not have permission to " . $request->action . " " . $table, E_USER_ERROR );
$fields = $Post->fields_from_request($request);
$fieldlist = $fields['posts'];
$fields = $$modelvar->fields_from_request($request);
$fieldlist = $fields[$table];
foreach ( $fieldlist as $field=>$type ) {
if ($Post->has_metadata && is_blob($table.'.'.$field)) {
if ($$modelvar->has_metadata && is_blob($table.'.'.$field)) {
if (isset($_FILES[strtolower(classify($table))]['name'][$field]))
$content_type = type_of( $_FILES[strtolower(classify($table))]['name'][$field] );
}
Expand All @@ -37,9 +38,9 @@ function post( &$vars ) {
$result = $rec->save_changes();
if ( !$result )
trigger_error( "The record could not be saved into the database.", E_USER_ERROR );
$atomentry = $Post->set_metadata($rec,$content_type,$table,'id');
$Post->set_categories($rec,$request,$atomentry);
if ((is_upload('posts','attachment'))) {
$atomentry = $$modelvar->set_metadata($rec,$content_type,$table,'id');
$$modelvar->set_categories($rec,$request,$atomentry);
if ((is_upload($table,'attachment'))) {

$upload_types = environment('upload_types');

Expand All @@ -52,7 +53,7 @@ function post( &$vars ) {
trigger_error('Sorry, this site only allows the following file types: '.implode(',',$upload_types), E_USER_ERROR);

$url = $request->url_for(array(
'resource'=>'posts',
'resource'=>$table,
'id'=>$rec->id
));
$title = substr($rec->title,0,140);
Expand All @@ -79,7 +80,7 @@ function post( &$vars ) {

}

trigger_after( 'insert_from_post', $Post, $rec );
trigger_after( 'insert_from_post', $$modelvar, $rec );
header_status( '201 Created' );
redirect_to( $request->base );

Expand Down
2 changes: 1 addition & 1 deletion app/omb/models/Post.php
Expand Up @@ -7,7 +7,7 @@ function Post() {
// fields

if (TWEET_SIZE)
$this->char_field( 'title', TWEET_SIZE );
$this->char_field( 'title', array('len'=>TWEET_SIZE) );
else
$this->char_field( 'title' );

Expand Down
2 changes: 2 additions & 0 deletions install.php
Expand Up @@ -74,6 +74,7 @@
$db_user = trim($_POST['db_user']);
$db_pw = trim($_POST['db_pw']);
$db_host = trim($_POST['db_host']);
$tweet_size = "140";
$db_charset = trim($_POST['db_charset']);
$db_collate = trim($_POST['db_collate']);
$pretty_urls = trim($_POST['pretty_urls']);
Expand Down Expand Up @@ -109,6 +110,7 @@
define( \"PING\", \"$ping\" ); // change to 0 for silent operation\n
define( \"REALTIME_HOST\", \"$cometpush_host\" ); // host for comet push\n
define( \"REALTIME_PORT\", \"$cometpush_port\" ); // port for comet push\n\n\n
define( \"TWEET_SIZE\", \"$tweet_size\" ); // length of posts.title\n\n\n
// more database settings\n\n
Expand Down
5 changes: 1 addition & 4 deletions wp-content/themes/p2/footer.php
Expand Up @@ -2,10 +2,7 @@
</div> <!-- // wrapper -->

<div id="footer">
<p><a href="http://openmicroblogger.org/">OpenMicroblogger <?php global $ombversion; echo $ombversion; ?></a> | P2 theme by <a href="http://automattic.com/">Automattic</a><?php render_partial( array(
'resource'=>'posts',
'action'=>'pagespan'
)); ?></p>
<p><a href="http://openmicroblogger.org/">OpenMicroblogger <?php global $ombversion; echo $ombversion; ?></a> | P2 theme by <a href="http://automattic.com/">Automattic</a><?php global $request; if ($request->resource == 'posts') render_partial('pagespan'); ?></p>
</div>

<?php wp_footer(); ?>
Expand Down

0 comments on commit 64e5387

Please sign in to comment.