/** * Check for correct password length * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnngs stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { if (strlen($data[$field]) < C('user.password.min-length') || strlen($data[$field]) > C('user.password.max-length')) { $result->error('password_length', $field); return false; } return true; }
/** * Check Email not exists in SSP * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnngs stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { if (!isNull(M('User')->loadUserByLogin($data[$field]))) { $result->error('email_unique', $field); return false; } return true; }
public function process(array $data, $field, RM_Base_iResult $res) { if (isset($data[$field]) and in_array($data[$field], $this->_list)) { return TRUE; } $res->error('in_list', $field, array('values' => $this->_list, 'value' => @$data[$field])); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (preg_match("/^[Rr]?[\\d]{12}\$/", trim($data[$field]), $matches)) { return TRUE; } $result->error('webmoney', $field, array('value' => $data[$field])); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (preg_match("/^\\+?[-\\d()\\s]+\$/", trim($data[$field]), $matches)) { return TRUE; } $result->error('phone', $field, array('value' => $data[$field])); return FALSE; }
/** * Check for simple password * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnngs stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { if (in_array($data[$field], explode(',', C('user.password.simple')))) { $result->error('password_simple', $field); return false; } return true; }
public function process(array $data, $field, RM_Base_iResult $result) { if (preg_match($this->_regexp, $data[$field])) { return TRUE; } $result->error('not_match', $field, array('value' => $data[$field])); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (isset($data[$field])) { return TRUE; } $result->error('not_null', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (!isNull($script = M('ReportScript')->loadScriptByName($data[$field])) && $script->id() != $data['id']) { $result->error('script_name_not_unique', $field); return FALSE; } return TRUE; }
/** * Check Email not exists in ssp registration (AuthServer) * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnngs stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { if (!isNull($company = M('Client')->loadCompanyByName($data[$field])) && $company->id() != $data['id']) { $result->error('company_name_unique', $field); return false; } return true; }
/** * Check Email not exists in ssp registration (AuthServer) * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnngs stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { if (!isNull($user = M('Client')->loadUserBySslNumber($data[$field])) && $user->id() != $data['id']) { $result->error('client_ssl_unique', $field); return false; } return true; }
public function process(array $data, $field, RM_Base_iResult $result) { if (!isNull(iterFirst(M('Category')->getCategoryList()->filter('name=? and id!=?', $data[$field], $data['id'])))) { $result->error('name_not_unique', $field); return FALSE; } return TRUE; }
public function process(array $data, $field, RM_Base_iResult $result) { if ($this->isNegative($data[$field]) || !$this->checkDiscount($data, $field)) { $result->error('not_correct', $field); return FALSE; } return TRUE; }
public function process(array $data, $field, RM_Base_iResult $result) { if ($data['event']) { return TRUE; } $result->error('daemon', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (isNull($obReceipt = M('Purchase')->receipt()->loadVirtualById($data['id'])) || count($obReceipt->getPurchases())) { $result->error('delete_not_empty_receipt', $field); return FALSE; } return TRUE; }
/** * Check if date valid, format YYYY-MM-DD * * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { $tmp = explode('-', @$data[$field]); if (!@checkdate($tmp[1], $tmp[2], $tmp[0])) { $result->error('date', $field); return false; } }
public function process(array $data, $field, RM_Base_iResult $result) { if (strtotime($data[$field]) <= time()) { return TRUE; } $result->error('date_exist', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { $data[$field] = trim($data[$field]); if (preg_match("/^(http:\\/\\/)([0-9A-Za-z\\-]+)(\\.)(.+)\$/", $data[$field])) { return TRUE; } $result->error('url', $field, array('value' => $data[$field])); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { $data = trim(@$data[$field]); if (!empty($data)) { return TRUE; } $result->error('not_empty', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { // print "is email: ".$data[$field].' : '.M('Tools')->web()->checkEmail($data[$field])."\n"; if (M('Tools')->web()->checkEmail($data[$field])) { return TRUE; } $result->error('email', $field, array('value' => $data[$field])); return FALSE; }
/** * Check is group with such alias exist? * * @param array $data Array with values * @param string $field Field to check * @param RM_Base_iResult Errors and warnings stack * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { $obGroup = M('User')->loadGroupByAlias(trim($data[$field])); if (isNull($obGroup)) { return TRUE; } $result->error('group_alias_exists', $field); return FALSE; }
/** * Check if date valid, format YYYY-MM-DD * * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { $time = strtotime($data[$field]); if (date('Y', $time) < 1900 || $time > strtotime("+1 hour")) { $result->error('date_true', $field); return false; } return true; }
public function process(array $data, $field, RM_Base_iResult $result) { if (empty($data[$field])) { return TRUE; } if ($this->isDataOk($data, $field, $data[$field]) && $this->isHex($data[$field]) && $this->isUnique($data, $field)) { return TRUE; } $result->error('bad_ssl_format', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (empty($data[$field])) { return TRUE; } if (preg_match('/[0-9]{3}/', $data[$field])) { return TRUE; } $result->error('not_correct', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if (me()->isUserInGroup(array('points-unlimit'))) { return TRUE; } if (abs($data[$field]) <= C('point.group-limit')) { return TRUE; } $result->error('limit', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { $iterator = M('Purchase')->getPurchaseList()->filter('user_id=? and bdate=? and check_id=? and is_deleted=0 and shop_id!=?', $data['user_id'], $data['bdate'], $data['check_id'], $data['shop_id']); if ($data['id']) { $iterator->filter('id!=?', $data['id']); } if ($data['shop_id'] < 1 || isNull(iterFirst($iterator))) { return TRUE; } $result->error('shop_not_the_same', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { $search = M('Purchase')->getPurchaseList()->filter('user_id=? and bdate=? and receipt_id=? and is_deleted=0 and barcode_value=?', $data['user_id'], $data['bdate'], $data['receipt_id'], $data['barcode_value']); if ($data['id']) { $search->filter('id!=?', $data['id']); } if ($data['is_deleted'] == 1 || isNull(iterFirst($search))) { return TRUE; } $result->error('barcode_not_unique', $field); return FALSE; }
/** * Check if datetime valid, format YYYY-MM-DD HH:MM * * @return void */ public function process(array $data, $field, RM_Base_iResult $result) { $tmp_arr = explode(' ', $data[$field]); $tmp_date_arr = explode('-', $tmp_arr[0]); $tmp_time_arr = explode(':', $tmp_arr[1]); $time_ok = (int) $tmp_time_arr[0] >= 0 && (int) $tmp_time_arr[0] <= 23 && (int) $tmp_time_arr[1] >= 0 && (int) $tmp_time_arr[1] <= 59; if (!checkdate($tmp_date_arr[1], $tmp_date_arr[2], $tmp_date_arr[0]) || !$time_ok) { $result->error('datetime', $field); return false; } return true; }
public function process(array $data, $field, RM_Base_iResult $result) { $data[$field] = trim($data[$field]); $max_l = C('group.alias-max-length'); $min_l = C('group.alias-min-length'); preg_match("/^([0-9A-Za-z_\\.\\-]{" . $min_l . "," . $max_l . "})\$/", $data[$field], $arr); if (isset($arr[1])) { return TRUE; } //$arr[1]; $result->error('group_alias', $field); return FALSE; }
public function process(array $data, $field, RM_Base_iResult $result) { if ($data['holder_id'] && !isNull(M('Holder')->loadHolderById($data['holder_id']))) { return TRUE; } if ($data['invoice_id'] && !isNull(M('Holder')->loadInvoiceById($data['invoice_id']))) { return TRUE; } if (!$data['holder_id'] && !$data['invoice_id'] && $data['state'] == RM_Equipment_Entity_State::LOSS) { return TRUE; } $result->error('entity_place', $field); return FALSE; }