本文整理汇总了PHP中check_ten函数的典型用法代码示例。如果您正苦于以下问题:PHP check_ten函数的具体用法?PHP check_ten怎么用?PHP check_ten使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_ten函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_regon
function check_regon($regon)
{
$regon = str_replace('-', '', $regon);
$regon = str_replace(' ', '', $regon);
return check_ten($regon);
$sum_nb = 0;
if (strlen($regon) == 9) {
$steps = array(8, 9, 2, 3, 4, 5, 6, 7);
for ($x = 0; $x < 8; $x++) {
$sum_nb += $steps[$x] * $regon[$x];
}
$mod = $sum_nb % 11;
if ($mod == 10) {
$mod = 0;
}
if ($mod == $regon[8]) {
return true;
}
} elseif (strlen($regon) == 7) {
$steps = array(2, 3, 4, 5, 6, 7);
for ($x = 0; $x < 6; $x++) {
$sum_nb += $steps[$x] * $regon[$x];
}
$mod = $sum_nb % 11;
if ($mod == 10) {
$mod = 0;
}
if ($mod == $regon[6]) {
return true;
}
}
return false;
}
示例2: trans
if ($customeradd['street'] == '') {
$error['street'] = trans('Street name required!');
}
if ($customeradd['building'] != '' && $customeradd['street'] == '') {
$error['street'] = trans('Street name required!');
}
if ($customeradd['apartment'] != '' && $customeradd['building'] == '') {
$error['building'] = trans('Building number required!');
}
if ($customeradd['post_building'] != '' && $customeradd['post_street'] == '') {
$error['post_street'] = trans('Street name required!');
}
if ($customeradd['post_apartment'] != '' && $customeradd['post_building'] == '') {
$error['post_building'] = trans('Building number required!');
}
if ($customeradd['ten'] != '' && !check_ten($customeradd['ten']) && !isset($customeradd['tenwarning'])) {
$error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.');
$customeradd['tenwarning'] = 1;
}
if ($customeradd['ssn'] != '' && !check_ssn($customeradd['ssn']) && !isset($customeradd['ssnwarning'])) {
$error['ssn'] = trans('Incorrect Social Security Number! If you are sure you want to accept it, then click "Submit" again.');
$customeradd['ssnwarning'] = 1;
}
if ($customeradd['icn'] != '' && !check_icn($customeradd['icn'])) {
$error['icn'] = trans('Incorrect Identity Card Number!');
}
if ($customeradd['regon'] != '' && !check_regon($customeradd['regon'])) {
$error['regon'] = trans('Incorrect Business Registration Number!');
}
if ($customeradd['zip'] != '' && !check_zip($customeradd['zip']) && !isset($customeradd['zipwarning'])) {
$error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
示例3: trans
$error['shortname'] = trans('Division short name is required!');
} elseif ($DB->GetOne('SELECT 1 FROM divisions WHERE shortname = ?', array($division['shortname']))) {
$error['shortname'] = trans('Division with specified name already exists!');
}
if ($division['address'] == '') {
$error['address'] = trans('Address is required!');
}
if ($division['city'] == '') {
$error['city'] = trans('City is required!');
}
if ($division['zip'] == '') {
$error['zip'] = trans('Zip code is required!');
} elseif (!check_zip($division['zip'])) {
$error['zip'] = trans('Incorrect ZIP code!');
}
if ($division['ten'] != '' && !check_ten($division['ten']) && !isset($division['tenwarning'])) {
$error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.');
$division['tenwarning'] = 1;
}
if ($division['regon'] != '' && !check_regon($division['regon'])) {
$error['regon'] = trans('Incorrect Business Registration Number!');
}
if ($division['account'] != '' && (strlen($division['account']) > 48 || !preg_match('/^([A-Z][A-Z])?[0-9]+$/', $division['account']))) {
$error['account'] = trans('Wrong account number!');
}
if ($division['inv_paytime'] == '') {
$division['inv_paytime'] = NULL;
}
if (!$error) {
$args = array('name' => $division['name'], 'shortname' => $division['shortname'], 'address' => $division['address'], 'city' => $division['city'], 'zip' => $division['zip'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_COUNTRY] => $division['countryid'], 'ten' => $division['ten'], 'regon' => $division['regon'], 'account' => $division['account'], 'inv_header' => $division['inv_header'], 'inv_footer' => $division['inv_footer'], 'inv_author' => $division['inv_author'], 'inv_cplace' => $division['inv_cplace'], 'inv_paytime' => $division['inv_paytime'], 'inv_paytype' => $division['inv_paytype'] ? $division['inv_paytype'] : null, 'description' => $division['description']);
$DB->Execute('INSERT INTO divisions (name, shortname, address, city, zip,
示例4: trans
$error['street'] = trans('Street name required!');
}
if ($customerdata['building'] != '' && $customerdata['street'] == '') {
$error['street'] = trans('Street name required!');
}
if ($customerdata['apartment'] != '' && $customerdata['building'] == '') {
$error['building'] = trans('Building number required!');
}
if ($customerdata['post_building'] != '' && $customerdata['post_street'] == '') {
$error['post_street'] = trans('Street name required!');
}
if ($customerdata['post_apartment'] != '' && $customerdata['post_building'] == '') {
$error['post_building'] = trans('Building number required!');
}
if ($customerdata['ten'] != '') {
if (!isset($customerdata['tenwarning']) && !check_ten($customerdata['ten'])) {
$error['ten'] = trans('Incorrect Tax Exempt Number! If you are sure you want to accept it, then click "Submit" again.');
$tenwarning = 1;
}
$ten_existence_check = ConfigHelper::getConfig('phpui.customer_ten_existence_check', 'none');
$ten_exists = $DB->GetOne("SELECT id FROM customers WHERE id <> ? AND REPLACE(REPLACE(ten, '-', ''), ' ', '') = ?", array($_GET['id'], preg_replace('/- /', '', $customerdata['ten']))) > 0;
switch ($ten_existence_check) {
case 'warning':
if (!isset($customerdata['tenexistencewarning']) && $ten_exists) {
$error['ten'] = trans('Customer with specified Tax Exempt Number already exists! If you are sure you want to accept it, then click "Submit" again.');
$tenexistencewarning = 1;
}
break;
case 'error':
if ($ten_exists) {
$error['ten'] = trans('Customer with specified Tax Exempt Number already exists!');
示例5: module_updateusersave
function module_updateusersave()
{
global $LMS, $SMARTY, $SESSION, $rights, $error;
$userinfo = $LMS->GetCustomer($SESSION->id);
$userinfo['im'] = isset($userinfo['messengers'][IM_GG]) ? $userinfo['messengers'][IM_GG]['uid'] : '';
$userinfo['yahoo'] = isset($userinfo['messengers'][IM_YAHOO]) ? $userinfo['messengers'][IM_YAHOO]['uid'] : '';
$userinfo['skype'] = isset($userinfo['messengers'][IM_SKYPE]) ? $userinfo['messengers'][IM_SKYPE]['uid'] : '';
$userdata = $_POST['userdata'];
$right = $rights['info'];
$id = $SESSION->id;
$error = NULL;
if (isset($right['edit_addr']) || isset($right['edit_addr_ack']) || isset($right['edit_contact']) || isset($right['edit_contact_ack'])) {
foreach (array_diff_assoc($userdata, $userinfo) as $field => $val) {
if ($field == 'phone' || $field == 'email') {
$type = $field == 'phone' ? 'contacts' : 'emails';
foreach ($val as $i => $v) {
$v = trim(htmlspecialchars($v, ENT_NOQUOTES));
if (isset($right['edit_contact'])) {
if (isset($userinfo[$type][$i]) && $userinfo[$type][$i][$field] != $v) {
if ($v) {
$LMS->DB->Execute('UPDATE customercontacts SET contact = ? WHERE id = ? AND customerid = ?', array($v, $i, $id));
} else {
$LMS->DB->Execute('DELETE FROM customercontacts WHERE id = ? AND customerid = ?', array($i, $id));
}
} elseif (!isset($userinfo[$type][$i]) && $v) {
$LMS->DB->Execute('INSERT INTO customercontacts (customerid, contact, type) VALUES (?, ?, ?)', array($id, $v, CONTACT_LANDLINE));
}
$userinfo[$type][$i][$field] = $v;
} elseif (isset($right['edit_contact_ack']) && ($v || isset($userinfo['contacts'][$i]))) {
if (!isset($userinfo[$type][$i]) || $userinfo[$type][$i][$field] != $v) {
$LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue)
VALUES(?, ?, ?)', array($id, $field . $i, $v));
}
}
}
continue;
} else {
$val = trim(htmlspecialchars($val, ENT_NOQUOTES));
}
switch ($field) {
case 'name':
case 'lastname':
case 'street':
case 'building':
case 'apartment':
case 'zip':
case 'city':
if (isset($right['edit_addr'])) {
$userinfo[$field] = $val;
$needupdate = 1;
} elseif (isset($right['edit_addr_ack'])) {
$LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue)
VALUES(?, ?, ?)', array($id, $field, $val));
}
break;
case 'email':
if ($val != '' && !check_email($val)) {
$error['email'] = 1;
} else {
if (isset($right['edit_contact'])) {
$userinfo[$field] = $val;
$needupdate = 1;
} elseif (isset($right['edit_contact_ack'])) {
$LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue)
VALUES(?, ?, ?)', array($id, $field, $val));
}
}
break;
case 'ten':
if ($val != '' && !check_ten($val)) {
$error['ten'] = 1;
} else {
if (isset($right['edit_addr'])) {
$userinfo[$field] = $val;
$needupdate = 1;
} elseif (isset($right['edit_addr_ack'])) {
$LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue)
VALUES(?, ?, ?)', array($id, $field, $val));
}
}
break;
case 'ssn':
if ($val != '' && !check_ssn($val)) {
$error['ssn'] = 1;
} else {
if (isset($right['edit_addr'])) {
$userinfo[$field] = $val;
$needupdate = 1;
} elseif (isset($right['edit_addr_ack'])) {
$LMS->DB->Execute('INSERT INTO up_info_changes(customerid, fieldname, fieldvalue)
VALUES(?, ?, ?)', array($id, $field, $val));
}
}
break;
case 'im':
if (isset($right['edit_contact'])) {
$LMS->DB->Execute('DELETE FROM imessengers WHERE customerid = ? AND type = ?', array($id, IM_GG));
if ($val) {
$LMS->DB->Execute('INSERT INTO imessengers (customerid, uid, type) VALUES (?,?,?)', array($id, $val, IM_GG));
}
//.........这里部分代码省略.........