rendered paste body<?php/** ** @package events* @version $Id: condition_varchar.php,v 1.14 2005/12/24 05:14:32 davidmj Exp $* @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License **//*** Returns a list of available comparing operators*/function &evc_varchar_compare(){ static $compare_methods; if (empty($compare_methods)) { global $user; $compare_methods = array( $user->lang['CONDITION_COMPARE']['IS_LIKE'], $user->lang['CONDITION_COMPARE']['IS'], $user->lang['CONDITION_COMPARE']['BEGINS_WITH'], $user->lang['CONDITION_COMPARE']['ENDS_WITH']); } return $compare_methods;}/*** Check whether the condition is met*/function evc_varchar_check(&$options, &$varchar, &$info){ $compare_method = $options[0]; switch ($compare_method) { case 0: if ($options[1]['regexp']) { $matches = preg_match('/' . escape_slashes($options[1]['string']) . '/i', $varchar); } else { $matches = preg_match('/' . preg_quote($options[1]['string']) . '/i', $varchar); } break; case 1: $matches = ((string) $varchar == $options[1]['string']); break; case 2: $matches = preg_match('/^' . preg_quote($options[1]['string']) . '/i', $varchar); break; case 3: $matches = preg_match('/' . preg_quote($options[1]['string']) . '$/i', $varchar); break; } return $matches;}?>