X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=blobdiff_plain;f=session_messages.php;h=cefe24f734881099a41de0fa186a7d584818077c;hp=c3e16f071fc4a99f4506964ea71612f11d24fa3d;hb=15459c86d0996ab3037b1738a8be6efd378c1258;hpb=4f94560f060a7305ea791def3950adb1bda092ec diff --git a/session_messages.php b/session_messages.php index c3e16f0..cefe24f 100644 --- a/session_messages.php +++ b/session_messages.php @@ -2,21 +2,18 @@ # Copyright (C) 2007 Jason Woofenden # -# This file is part of wfpl. -# -# wfpl is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; either version 2.1 of the License, or (at your option) -# any later version. -# -# wfpl 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 GNU Lesser General Public License for -# more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with wfpl; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 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 +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # require_once() this file instead of messages.php if you'd like to store @@ -26,9 +23,9 @@ # see messages.php for documentation on how to use it. -require_once('code/wfpl/session.php'); -require_once('code/wfpl/string_array.php'); -require_once('code/wfpl/messages.php'); +require_once(__DIR__.'/'.'session.php'); +require_once(__DIR__.'/'.'string_array.php'); +require_once(__DIR__.'/'.'messages.php'); function session_save_messages() { if(!isset($GLOBALS['wfpl_messages'])) { @@ -43,18 +40,12 @@ function session_save_messages() { } function session_restore_messages() { - if(!session_exists()) { - return false; - } - $messages = session_get('wfpl_messages'); - if($messages !== false) { - $messages = string_to_array($messages); - if(!(isset($GLOBALS['wfpl_messages']) && is_array($GLOBALS['wfpl_messages']))) { - $GLOBALS['wfpl_messages'] = array(); + if(session_exists()) { + $messages = session_get('wfpl_messages'); + if($messages !== false) { + session_clear('wfpl_messages'); + return string_to_array($messages); } - # messages from the previous run happened first - $GLOBALS['wfpl_messages'] = array_merge($messages, $GLOBALS['wfpl_messages']); - } - session_clear('wfpl_messages'); + return array(); }