head	1.6;
access;
symbols;
locks; strict;
comment	@# @;


1.6
date	2000.08.28.02.28.24;	author chuck;	state dead;
branches;
next	1.5;

1.5
date	2000.01.16.20.34.16;	author chuck;	state Exp;
branches;
next	1.4;

1.4
date	2000.01.16.18.49.41;	author chuck;	state Exp;
branches;
next	1.3;

1.3
date	99.08.04.04.16.00;	author chuck;	state Exp;
branches;
next	1.2;

1.2
date	99.08.03.04.12.55;	author chuck;	state Exp;
branches;
next	1.1;

1.1
date	99.07.20.07.36.30;	author jon;	state Exp;
branches;
next	;


desc
@@


1.6
log
@starting to modernize babel - nothing autogenerated, standard
directory/library names, etc.
@
text
@function store_post ($request_ref, &$post_ref) {
  global $dbh;
  
  if (!($author_id = is_anonymous($request_ref) ? $request_ref->anon_id : $request_ref->user_id))
    return error("author_id not set");
  
  $parent = $post_ref['parent'];
  
  if (!($topic = $request_ref->topic))
    return error("topic undefined");
  
  $created = $post_ref['created'];
  $modified = $post_ref['modified'];
  $subject = addslashes($post_ref['subject']);
  $locked = $post_ref['locked'] ? '1' : '0';
  $body = addslashes($post_ref['body']);
  
  $query  = 'INSERT INTO posts ';
  $query .= '(parent, topic, subject, author_id, created, ';
  $query .= 'modified, locked, body) ';
  $query .= 'VALUES (';
  $query .= "$parent, '$topic', '$subject', '$author_id', $created, ";
  $query .= "$modified, $locked, '$body'";
  $query .= ')';
  
  if (!$dbh->query($query))
    return error("could not run query: $query" . $dbh->Error);
  $dbh->free();
  
  $post_ref['id'] = mysql_insert_id($dbh->Link_ID); // FIXME
  
  return success();
}
@


1.5
log
@Babel should now completely use the PHPLIB database abstraction code. The
SQL schema still needs to be revised for portability - it's tied to mysql
now through auto_increment - but I want to redo the schema anyway in order
to get rid of most recursive queries. And this should make it easier for
people to set up - I'm going to try and put together an installable tarball
later today.

A friend of mine has promised to do some design work to improve the UI and
generally change things to match IMP/other horde stuff by the end of
January, so I'm hoping to get feedback on what's good and what's bad in the
current UI.

Hoping that this and the Turba commit might jumpstart some work on modules
other than IMP...
@
text
@@


1.4
log
@Babel no longer keeps it's own user table; it grabs Horde (phplib)
usernames/ids and uses those. We'll need to figure out a way of storing
email and fullname prefs with Horde accounts.
@
text
@d2 1
a2 4
  if (!($dbh = $request_ref->dbh))
    return error("dbh undefined");
  
  $id = 0;
a12 1
  $author = $post_ref['author'];
d14 1
a14 1
  $subject = $post_ref['subject'];
d18 5
a22 5
  $query  = "INSERT INTO posts ";
  $query .= "(id, parent, topic, subject, author_id, author, created, ";
  $query .= "modified, locked, body) ";
  $query .= "VALUES (";
  $query .= "$id, $parent, '$topic', '$subject', '$author_id', '$author', $created, ";
d24 1
a24 7
  $query .= ")";
  
  if (!($sth = $dbh->prepare($query)))
    return error("could not prepare: " . $dbh->errstr);
  
  if (!($sth->execute()))
    return error("could not execute: " . $sth->errstr); 
d26 3
a28 1
  $post_ref['id'] = $sth->insertid;
d30 1
a30 1
  $sth->finish();
@


1.3
log
@cjh: pruning out all the code that either isn't used or is only used for
maintaining/creating users - all of which is moving to Horde proper. Also a
few more fixes for the new session/user stuff, though I haven't quite gotten
rid of the "users" table yet - that's coming, though.

babel.php3 is a nice bit shorter, now... ;)

Anyway, a bit more work, and a better Horde user framework, and babel should
be more or less ready for primetime. oh, there's that whole customization
thing, too.

Speaking of which, what do people prefer: imp-style defaults.php3, or
babel-style babel.conf. I figure we should standardize on one; they're both
easy to auto-generate; babel's is maybe a little bit more overhead to parse,
but it's a bit more user friendly as well. Thoughts?
@
text
@d20 1
a20 1
  $body = $post_ref['body'];
@


1.2
log
@cjh: Babel is probably half-broken now, as I begin moving it to use phplib
session storage. Already got rid of the open_posts db table in favor of a
session var; read_posts will follow, and then I'll fix the rest of it.
@
text
@d16 1
a16 1
  
d18 1
a18 3
  
  $subject = addslashes($post_ref['subject']);
  
d20 1
a20 2
  
  $body = addslashes($post_ref['body']);
d23 1
a23 1
  $query .= "(id, parent, topic, subject, author_id, created, ";
d26 1
a26 1
  $query .= "$id, $parent, '$topic', '$subject', '$author_id', $created, ";
@


1.1
log
@
jon: alrighty, babel.php3.in is now broken down into seperate
     function files.  they're jusy dying to be combined into
     objects and seperate source files.
@
text
@d29 1
a29 1
  $query .= "$id, $parent, '$topic', '$subject', $author_id, $created, ";
@

