Example #1
0
	if($customerdata['icn'] != '' && !check_icn($customerdata['icn']))
		$error['icn'] = trans('Incorrect Identity Card Number!');

	if($customerdata['zip'] !='' && !check_zip($customerdata['zip']) && !isset($customerdata['zipwarning']))
	{
		$error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
		$zipwarning = 1;
	}
	if($customerdata['post_zip'] !='' && !check_zip($customerdata['post_zip']) && !isset($customerdata['post_zipwarning']))
	{
		$error['post_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
		$post_zipwarning = 1;
	}

	if($customerdata['email']!='' && !check_emails($customerdata['email']))
		$error['email'] = trans('Incorrect email!');

	if($customerdata['pin'] == '')
		$error['pin'] = trans('PIN code is required!');
	elseif(!preg_match('/^[0-9]{4,6}$/',$customerdata['pin']))
		$error['pin'] = trans('Incorrect PIN code!');

	if($customerdata['status'] == 1 && $LMS->GetCustomerNodesNo($customerdata['id'])) 
		$error['status'] = trans('Interested customers can\'t have computers!');

	foreach($customerdata['uid'] as $idx => $val)
	{
		$val = trim($val);
		switch($idx)
		{
Example #2
0
	{
		$error['zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
		$customeradd['zipwarning'] = 1;
	}
	if($customeradd['post_zip'] !='' && !check_zip($customeradd['post_zip']) && !isset($customeradd['post_zipwarning']))
	{
		$error['post_zip'] = trans('Incorrect ZIP code! If you are sure you want to accept it, then click "Submit" again.');
		$customeradd['post_zipwarning'] = 1;
	}

	if($customeradd['pin'] == '')
		$error['pin'] = trans('PIN code is required!');
        elseif(!preg_match('/^[0-9]{4,6}$/', $customeradd['pin']))
	        $error['pin'] = trans('Incorrect PIN code!');

	if($customeradd['email']!='' && !check_emails($customeradd['email']))
		$error['email'] = trans('Incorrect email!');

	foreach($customeradd['uid'] as $idx => $val)
	{
		$val = trim($val);
		switch($idx)
		{
			case IM_GG:
				if($val!='' && !check_gg($val))
					$error['gg'] = trans('Incorrect IM uin!');
			break;
			case IM_YAHOO:
				if($val!='' && !check_yahoo($val))
					$error['yahoo'] = trans('Incorrect IM uin!');
			break;
Example #3
0
             break;
         case IM_SKYPE:
             if ($val != '' && !check_skype($val)) {
                 $error['skype'] = trans('Incorrect IM uin!');
             }
             break;
     }
     if ($val) {
         $im[$idx] = $val;
     }
 }
 $contacts = array();
 foreach ($customerdata['emails'] as $idx => $val) {
     $email = trim($val['email']);
     $name = trim($val['name']);
     if ($email != '' && !check_emails($email)) {
         $error['email' . $idx] = trans('Incorrect email!');
     } elseif ($name && !$email) {
         $error['email' . $idx] = trans('Email address is required!');
     } elseif ($email) {
         $contacts[] = array('name' => $name, 'contact' => $email, 'type' => CONTACT_EMAIL);
     }
 }
 foreach ($customerdata['contacts'] as $idx => $val) {
     $phone = trim($val['phone']);
     $name = trim($val['name']);
     $type = !empty($val['type']) ? array_sum($val['type']) : NULL;
     $customerdata['contacts'][$idx]['type'] = $type;
     if ($name && !$phone) {
         $error['contact' . $idx] = trans('Phone number is required!');
     } elseif ($phone) {
Example #4
0
            if (@rename($file['tmp_name'], $newfile)) {
                $DB->Execute('INSERT INTO rtattachments (messageid, filename, contenttype) 
						VALUES (?,?,?)', array($id, $file['name'], $file['type']));
            }
        }
    }
}
if (isset($_POST['message'])) {
    $message = $_POST['message'];
    if ($message['subject'] == '') {
        $error['subject'] = trans('Message subject not specified!');
    }
    if ($message['body'] == '') {
        $error['body'] = trans('Message body not specified!');
    }
    if ($message['destination'] != '' && !check_emails($message['destination'])) {
        $error['destination'] = trans('Incorrect email!');
    }
    if ($message['destination'] != '' && $message['sender'] == 'customer') {
        $error['destination'] = trans('Customer cannot send message!');
    }
    $files = array();
    foreach ($_FILES['files']['name'] as $fileidx => $filename) {
        if (!empty($filename)) {
            if (is_uploaded_file($_FILES['files']['tmp_name'][$fileidx]) && $_FILES['files']['size'][$fileidx]) {
                $filecontents = '';
                $fd = fopen($_FILES['files']['tmp_name'][$fileidx], 'r');
                if ($fd) {
                    while (!feof($fd)) {
                        $filecontents .= fread($fd, 256);
                    }