(file) Return to session-utils.inc.php CVS log (file) (dir) Up to [Development] / advokit-installer-bak

File: [Development] / advokit-installer-bak / session-utils.inc.php (download) / (as text)
Revision: 1.3, Tue Aug 10 16:29:23 2004 UTC (6 years ago) by travislow
Branch: MAIN
CVS Tags: r0-9-5, HEAD
Changes since 1.2: +1 -1 lines
Bugzilla #149 -- applied patches provided by C. Scott Ananian

**** DO NOT USE THIS CODE YET ****

or else you won't be able to login anymore on your existing installation.

<?
# ======================================================================
# AdvoKit -- a campaign managment tool
# Copyright (C) 2004  OrchidSuites, Inc. (info@orchidsuites.net)
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the AFFERO GENERAL PUBLIC LICENSE
# as published by Affero, Inc.; either version 1
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# AFFERO GENERAL PUBLIC LICENSE for more details.
# 
# You should have received a copy of the AFFERO GENERAL PUBLIC LICENSE
# along with this program; if not, write to Affero, Inc. at
# 510 Third Street - Suite 225, San Francisco, CA 94107, USA
# or visit <http://www.affero.org>.
# ======================================================================

#.................................................. addSessionInfoToPage
#
# Embed session information in the page by including a hidden
# field in any forms on the page, and by modifying all internal
# links to include the session info in the URL.
#
function addSessionInfoToPage( $compiled_template )
{ 
    global $t_sesshandler;
    $sessionname = $t_sesshandler->getSessionName();
    $sessionid = $t_sesshandler->sessioncookie->toString($t_sesshandler->config);
    $compiled_template = preg_replace( "/([ 	]*)(<form[^>]*>)/", "$1$2\n  $1<input type=\"hidden\" name=\"".$sessionname."\" value=\"".$sessionid."\">", $compiled_template );
    $compiled_template = preg_replace( "/href=\"index.php\?([^\"]*)\"/", "href=\"index.php?$1&".$sessionname."=".$sessionid."\"", $compiled_template );
    $compiled_template = preg_replace( "/(showPopup\\s*\\(\\s*'[^']*)/", "\$1&".$sessionname."=".$sessionid, $compiled_template );
    $compiled_template = preg_replace( "/(onClick=\"location.href='index.php\?)/", "$1".$sessionname."=".$sessionid."&", $compiled_template );

    return $compiled_template;
}
?>

cvsadmin@voter2voter.org
CVS Snapshots (updated daily)