Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.1048 2009/11/23 17:21:22 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.1049 2009/11/24 13:01:03 grubba Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:4010:    return res;    }       mapping tomapp( mixed what )    {    if( mappingp( what ))    return what;    return ([ "":what ]);    }    -  string store( array|string|mapping data, RequestID id ) +  string store( array|string|mapping data, RequestID id, int|void timeout )    //! Store the data your draw callback expects to receive as its    //! first argument(s). If the data is an array, the draw callback    //! will be called like <pi>callback( @@data, id )</pi>. -  +  //! +  //! @param timeout +  //! Timeout for the entry in seconds from now. If @expr{UNDEFINED@}, +  //! the entry will not expire. Currently just passed along to +  //! the @[ArgCache].    {    string ci, user;    function update_args = lambda ( mapping a )    {    if (!a->format)    // Make implicit format choice explicit   #if constant(Image.GIF) && constant(Image.GIF.encode)    a->format = "gif";   #else    a->format = "png";
Roxen.git/server/base_server/roxen.pike:4036:    id->misc->authenticated_user &&    !id->misc->authenticated_user->is_transient )    // This entry is not actually used, it's only there to    // generate a unique key.    a["\0u"] = user = id->misc->authenticated_user->name();    };       if( mappingp( data ) )    {    update_args( data ); -  ci = argcache->store( data ); +  ci = argcache->store( data, timeout );    }    else if( arrayp( data ) )    {    if( !mappingp( data[0] ) )    error("Expected mapping as the first element of the argument array\n");    update_args( data[0] ); -  ci = map( map( data, tomapp ), argcache->store )*"$"; +  ci = map( map( data, tomapp ), argcache->store, timeout )*"$";    } else    ci = data;    update_args = 0; // To avoid garbage.       if( zero_type( uid_cache[ ci ] ) )    {    uid_cache[ci] = user;    if( catch(QUERY("INSERT INTO "+name+" "    "(id,uid,atime) VALUES (%s,%s,UNIX_TIMESTAMP())",    ci, user||"")) )