- Timestamp:
- Jul 3, 2007 8:41:36 AM (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Auth_SQL.inc.php
r259 r266 638 638 639 639 /** 640 * Tests if the "blocked" flag is set for a user. 641 * 642 * @param int $user_id User id to look for. 643 * @return boolean True if the user is blocked, false otherwise. 644 */ 645 function isBlocked($user_id=null) 646 { 647 $db =& DB::getInstance(); 648 649 $this->initDB(); 650 651 if ($this->getParam('blocking')) { 652 // Get user_id if specified. 653 $user_id = isset($user_id) ? $user_id : $this->getVal('user_id'); 654 $qid = $db->query(" 655 SELECT 1 656 FROM " . $this->_params['db_table'] . " 657 WHERE blocked = 'true' 658 AND " . $this->_params['db_primary_key'] . " = '" . $db->escapeString($user_id) . "' 659 "); 660 return mysql_num_rows($qid) === 1; 661 } 662 } 663 664 /** 640 665 * Unblocks a user in the db_table, and clears any blocked_reason. 641 666 */ … … 902 927 /** 903 928 * If the current user has access to the specified $security_zone, return true. 904 * If the optional $priv is supplied, test that against the zone. 929 * If the optional $user_type is supplied, test that against the zone. 930 * 931 * NOTE: "user_type" used to be called "priv" in some older implementations. 905 932 * 906 933 * @param constant $security_zone string of comma delimited priviliges for the zone 907 * @param string $ priva privilege that might be found in a zone934 * @param string $user_type a privilege that might be found in a zone 908 935 * @return bool true if user is a member of security zone, false otherwise 909 936 */ 910 function inClearanceZone($security_zone, $ priv='')937 function inClearanceZone($security_zone, $user_type='') 911 938 { 912 939 return true; 913 940 $zone_members = preg_split('/,\s*/', $security_zone); 914 $ priv = empty($priv) ? $this->get('priv') : $priv;941 $user_type = empty($user_type) ? $this->get('user_type') : $user_type; 915 942 916 943 // If the current user's privilege level is NOT in that array or if the 917 944 // user has no privilege, return false. Otherwise the user is clear. 918 if (!in_array($ priv, $zone_members) || empty($priv)) {945 if (!in_array($user_type, $zone_members) || empty($user_type)) { 919 946 return false; 920 947 } else { … … 926 953 * This function tests a list of arguments $security_zone against the priv that the current user has. 927 954 * If the user doesn't have one of the supplied privs, die. 955 * 956 * NOTE: "user_type" used to be called "priv" in some older implementations. 928 957 * 929 958 * @param constant $security_zone string of comma delimited priviliges for the zone … … 938 967 /* If the current user's privilege level is NOT in that array or if the 939 968 * user has no privilege, DIE with a message. */ 940 if (!in_array($this->get(' priv'), $zone_members) || !$this->get('priv')) {969 if (!in_array($this->get('user_type'), $zone_members) || !$this->get('user_type')) { 941 970 $message = empty($message) ? _("You have insufficient privileges to view that page.") : $message; 942 971 $app->raiseMsg($message, MSG_NOTICE, __FILE__, __LINE__); -
trunk/lib/FormValidator.inc.php
r241 r266 40 40 class FormValidator extends Validator { 41 41 42 // Class parameters. 43 var $_params = array( 44 'error' => ' sc-msg-error ', 45 'warning' => ' sc-msg-warning ', 46 'notice' => ' sc-msg-notice ', 47 'success' => ' sc-msg-success ', 48 ); 49 42 50 // Array filling with error messages. 43 51 var $errors = array(); 52 53 /** 54 * Set (or overwrite existing) parameters by passing an array of new parameters. 55 * 56 * @access public 57 * @param array $params Array of parameters (key => val pairs). 58 */ 59 function setParam($params) 60 { 61 $app =& App::getInstance(); 62 63 if (isset($params) && is_array($params)) { 64 // Merge new parameters with old overriding only those passed. 65 $this->_params = array_merge($this->_params, $params); 66 } else { 67 $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__); 68 } 69 } 70 71 /** 72 * Return the value of a parameter, if it exists. 73 * 74 * @access public 75 * @param string $param Which parameter to return. 76 * @return mixed Configured parameter value. 77 */ 78 function getParam($param) 79 { 80 $app =& App::getInstance(); 81 82 if (isset($this->_params[$param])) { 83 return $this->_params[$param]; 84 } else { 85 $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__); 86 return null; 87 } 88 } 44 89 45 90 /** … … 164 209 case MSG_ERR: 165 210 default: 166 echo ' sc-msg-error ';211 echo $this->getParam('error'); 167 212 break; 168 213 169 214 case MSG_WARNING: 170 echo ' sc-msg-warning ';215 echo $this->getParam('warning'); 171 216 break; 172 217 218 case MSG_NOTICE: 219 echo $this->getParam('notice'); 220 break; 221 173 222 case MSG_SUCCESS: 174 echo ' sc-msg-success '; 175 break; 176 177 case MSG_NOTICE: 178 echo ' sc-msg-notice '; 223 echo $this->getParam('success'); 179 224 break; 180 225 } -
trunk/lib/Validator.inc.php
r247 r266 208 208 $timestamp = strtotime($val); 209 209 // Return values change between php4 and php5. 210 if ( $timestamp === -1 || $timestamp === false) {210 if ('' != trim($val) && ($timestamp === -1 || $timestamp === false)) { 211 211 return false; 212 212 } else {
Note: See TracChangeset
for help on using the changeset viewer.