cvs: pearweb /public_html/bugs/include functions.inc

From: Date: Wed, 26 Mar 2008 20:53:30 +0000
Subject: cvs: pearweb /public_html/bugs/include functions.inc
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7398@lists.php.net to get a copy of this message
dufuz Wed Mar 26 20:53:30 2008 UTC Modified files: /pearweb/public_html/bugs/include functions.inc Log: remove oneof(), it was being used like a tereny operator so why not just use real tereny http://cvs.php.net/viewvc.cgi/pearweb/public_html/bugs/include/functions.inc?r1=1.170&r2=1.171&diff_format=u Index: pearweb/public_html/bugs/include/functions.inc diff -u pearweb/public_html/bugs/include/functions.inc:1.170 pearweb/public_html/bugs/include/functions.inc:1.171 --- pearweb/public_html/bugs/include/functions.inc:1.170 Tue Mar 25 02:14:18 2008 +++ pearweb/public_html/bugs/include/functions.inc Wed Mar 26 20:53:30 2008 @@ -15,7 +15,7 @@ * @package Bugs * @copyright Copyright (c) 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id: functions.inc,v 1.170 2008/03/25 02:14:18 dufuz Exp $ + * @version $Id: functions.inc,v 1.171 2008/03/26 20:53:30 dufuz Exp $ */ @@ -99,7 +99,7 @@ * * @return string the sanitized string * - * @see escapeSQL(), oneof(), field(), txfield() + * @see escapeSQL(), field(), txfield() */ function clean($in) { @@ -117,7 +117,7 @@ * * @return string|array the sanitized data * - * @see clean(), oneof(), field(), txfield() + * @see clean(), field(), txfield() */ function escapeSQL($in) { @@ -134,27 +134,6 @@ } /** - * Goes through each variable submitted and returns the value - * from the first variable which has a non-empty value - * - * Handy function for when you're dealing with user input or a default. - * - * @param mixed as many variables as you wish to check - * - * @return mixed the value, if any - * - * @see clean(), escapeSQL(), field(), txfield() - */ -function oneof() -{ - foreach (func_get_args() as $arg) { - if ($arg) { - return $arg; - } - } -} - -/** * Returns the data from the field requested and sanitizes * it for use as HTML * @@ -165,11 +144,11 @@ * * @return mixed the data requested * - * @see clean(), escapeSQL(), oneof(), txfield() + * @see clean(), escapeSQL(), txfield() */ function field($n) { - $in = isset($_POST['in']) ? clean($_POST['in'][$n]) : null; - return oneof($in, clean($GLOBALS['bug'][$n])); + $in = isset($_POST['in']) ? clean($_POST['in'][$n]) : clean($GLOBALS['bug'][$n]); + return $in; } /** @@ -183,13 +162,14 @@ * * @return mixed the data requested * - * @see clean(), escapeSQL(), oneof(), field() + * @see clean(), escapeSQL(), field() */ function txfield($n, $bug = null, $in = null) { - $one = (isset($in) && isset($in[$n])) ? $in[$n] : false; + $one = (isset($in) && isset($in[$n])) ? $in[$n] : false; + if ($one) return $one; $two = (isset($bug) && isset($bug[$n])) ? $bug[$n] : false; - return oneof($one, $two); + if ($two) return $two; } /** @@ -616,7 +596,8 @@ /* Default addresses */ include_once 'bugs/pear-bugs-utils.php'; $pbu = new PEAR_Bugs_Utils; - list($mailto, $mailfrom, $Bcc) = $pbu->getPackageMail(oneof($in['package_name'], $bug['package_name']), $id); + $pm = isset($in['package_name']) ? $in['package_name'] : $bug['package_name']; + list($mailto, $mailfrom, $Bcc) = $pbu->getPackageMail($pm, $id); $headers[] = array(" ID", $bug['id']);

« previous php.pear.core (#7398) next »