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


1.4
date	2000.08.28.02.28.23;	author chuck;	state dead;
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.55;	author chuck;	state Exp;
branches;
next	1.1;

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


desc
@@


1.4
log
@starting to modernize babel - nothing autogenerated, standard
directory/library names, etc.
@
text
@function mark_as_read (&$request_ref) {
  global $babel;
  
  if (!($post_id = $request_ref->id))
    return FAILURE;
  
  if (is_read($request_ref, $post_id))
    return success();
  
  if (!($topic = $request_ref->topic))
    return error("topic undefined");
  
  $babel['read_posts'][$topic][$post_id] = 1;
  $request_ref->read_posts[$post_id] = 1;
  
  return success();
}
@


1.3
log
@cjh: use session storage for read_posts as well. one more db table gone... :)
@
text
@@


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
@d2 2
a9 3
  if (!($dbh = $request_ref->dbh))
    return error("database undefined");
  
d13 2
a14 15
  if (!($user_id = $request_ref->user_id))
    return error("'user_id' not specified");
  
  $query  = "INSERT INTO read_posts (topic, post_id, user_id) ";
  $query .= "VALUES ('$topic', '$post_id', '$user_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();
    
  $request_ref->read_posts[$topic][$post_id] = $request_ref->read_posts[$topic][$post_id] + 1;
@


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
@d18 1
a18 1
  $query .= "VALUES ('$topic', $post_id, $user_id)";
@

