From f3a64cfe2845733851760f0bf691f646b8988ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 1 Jun 2009 00:31:18 +0200 Subject: [PATCH] [svn r21146] prevent double post --- main/wiki/index.php | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/main/wiki/index.php b/main/wiki/index.php index d78ce9af8d..eb8d76cb76 100644 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -198,10 +198,15 @@ else // saving a change if (isset($_POST['SaveWikiChange']) AND $_POST['title']<>'') { + if(empty($_POST['title'])) { Display::display_error_message(get_lang("NoWikiPageTitle")); } + elseif(!double_post($_POST['wpost_id'])) + { + //double post + } else { $return_message=save_wiki(); @@ -216,6 +221,10 @@ if (isset($_POST['SaveWikiNew'])) { Display::display_error_message(get_lang("NoWikiPageTitle")); } + elseif(!double_post($_POST['wpost_id'])) + { + //double post + } else { $_clean['assignment']=Database::escape_string($_POST['assignment']); // for mode assignment @@ -1259,7 +1268,8 @@ if ($_GET['action']=='edit') //echo ''; //off for now //echo ''; //off for now - echo ''; //get current version + echo ''; //get current version + echo get_lang('Progress').':   %'; echo '

'; + echo '';//prevent double post echo ''; //for save icon echo '';//for save button echo ''; @@ -1771,6 +1782,7 @@ if ($_GET['action']=='discuss') + ';//prevent double post ?> @@ -1812,7 +1824,7 @@ if ($_GET['action']=='discuss') 100 %'; echo '

'; + echo '';//prevent double post echo ''; //for save icon echo '';//for button icon echo ''; @@ -3504,6 +3517,32 @@ function export2doc($wikiTitle, $wikiContents, $groupId) } +/** + * Function prevent double post (reload or F5) + */ + +function double_post($wpost_id) +{ + if(isset($_SESSION['wpost_id'])) + { + if ($wpost_id == $_SESSION['wpost_id']) + { + return false; + } + else + { + $_SESSION['wpost_id'] = $wpost_id; + return true; + } + } + else + { + $_SESSION['wpost_id'] = $wpost_id; + return true; + } +} + + /** * Function wizard individual assignment * @author Juan Carlos RaƱa
: