Beispiel #1
6
function ForceIncomingString($VariableName, $DefaultValue) {
	// First check the querystring
	$sReturn = ForceSet(@$_GET[$VariableName], $DefaultValue);
	$sReturn = ForceString($sReturn, $DefaultValue);
	// If the default value was defined, then check the post variables
	if ($sReturn == $DefaultValue) {
		$sReturn = ForceSet(@$_POST[$VariableName], $DefaultValue);
		$sReturn = ForceString($sReturn, $DefaultValue);
	}
	// And strip slashes from the string
   $sReturn = stripslashes($sReturn);
	return $sReturn;	
}
function ForceIncomingInt($VariableName, $DefaultValue)
{
    // First check the querystring
    $iReturn = ForceSet(@$_GET[$VariableName], $DefaultValue);
    $iReturn = ForceInt($iReturn, $DefaultValue);
    // If the default value was defined, then check the form variables
    if ($iReturn == $DefaultValue) {
        $iReturn = ForceSet(@$_POST[$VariableName], $DefaultValue);
        $iReturn = ForceInt($iReturn, $DefaultValue);
    }
    // If the value found was less than 0, set it to the default value
    if ($iReturn < 0) {
        $iReturn == $DefaultValue;
    }
    return $iReturn;
}
/*
* Copyright 2003 - 2005 Mark O'Sullivan
* This file is part of Vanilla.
* Vanilla 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 2 of the License, or (at your option) any later version.
* Vanilla 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 Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
* The latest source code for Vanilla is available at www.lussumo.com
* Contact Mark O'Sullivan at mark [at] lussumo [dot] com
*
* Description: File used by Dynamic Data Management object to fill autocomplete data on user input field
*/
include "../appg/settings.php";
include "../appg/init_ajax.php";
$Context->Session->Check(agSAFE_REDIRECT);
$Search = ForceSet(@$_GET["Search"], "");
$Search = urldecode($Search);
$Search = FormatStringForDatabaseInput($Search);
$Sender = ForceIncomingString("Sender", "");
if ($Search != "") {
    $s = $Context->ObjectFactory->NewContextObject($Context, "SqlBuilder");
    $s->SetMainTable("User", "u");
    $s->AddSelect("Name", "u");
    $s->AddWhere("Name", $Search . "%", "like");
    $s->AddOrderBy("Name", "u", "asc");
    $s->AddLimit(0, 10);
    $ResultSet = $Context->Database->Select($Context, $s, "Tools", "AutoComplete", "An error occurred while retrieving autocomplete items.", 0);
    $Name = "";
    $Loop = 1;
    if ($ResultSet) {
        while ($row = $Context->Database->GetRow($ResultSet)) {