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


1.5
date	2000.08.28.02.28.21;	author chuck;	state dead;
branches;
next	1.4;

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

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

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

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


desc
@@


1.5
log
@starting to modernize babel - nothing autogenerated, standard
directory/library names, etc.
@
text
@function erase_post (&$request_ref) {
  global $babel, $dbh;
  
  $id = $request_ref->id;
  
  if ($id == 1)
    return error("can not delete post 1");
  
  if (!$request_ref->post['parent'])
    return error("parent not found");
  
  if (!(can_erase($request_ref)))
    return error("can not erase post");
  
  if (!($topic = $request_ref->topic))
    return error("'topic' undefined in request");
  
  $parent = $request_ref->post['parent'];
  
  $query  = "DELETE FROM posts WHERE id = $id";
  if (!$dbh->query($query))
    return error("could not run query: $query : " . $dbh->Error);
  
  $query  = "UPDATE posts SET parent = $parent WHERE parent = $id";
  if (!$dbh->query($query))
    return error("could not run query: $query : " . $dbh->Error);
  
  $dbh->free();
  
  unset($babel['read_posts'][$topic][$id]);
  unset($babel['open_posts'][$topic][$id]);
  unset($request_ref->read_posts[$id]);
  unset($request_ref->open_posts[$id]);
  
  return success();
}
@


1.4
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.3
log
@cjh: use session storage for read_posts as well. one more db table gone... :)
@
text
@d2 1
a2 1
  global $babel;
a14 3
  if (!($dbh = $request_ref->dbh))
    return error("database undefined");
  
d21 2
a22 6
  
  if (!($sth = $dbh->prepare($query)))
    return error("could not prepare: " . $dbh->errstr);
  
  if (!($sth->execute()))
    return error("could not execute: " . $sth->errstr); 
d25 2
d28 1
a28 7
  if (!($sth = $dbh->prepare($query)))
    return error("could not prepare: " . $dbh->errstr);
  
  if (!($sth->execute()))
    return error("could not execute: " . $sth->errstr); 
  
  $sth->finish();
@


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
@d41 1
a41 10
  $query  = "DELETE FROM read_posts WHERE post_id = $id";
  
  if (!($sth = $dbh->prepare($query)))
    return error("could not prepare: " . $dbh->errstr);
  
  if (!($sth->execute()))
    return error("could not execute: " . $sth->errstr); 
  
  $sth->finish();
  
d43 2
a44 1
  unset($request_ref->read_posts[$topic][$id]);
@


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
@d2 2
a49 10

  $query  = "DELETE FROM open_posts WHERE post_id = $id";
  
  if (!($sth = $dbh->prepare($query)))
    return error("could not prepare: " . $dbh->errstr);
  
  if (!($sth->execute()))
    return error("could not execute: " . $sth->errstr); 
  
  $sth->finish();
d51 1
@

