protected function _childValidation() { $email = $this->getFieldValue($this->loadObject(true), 'email'); if (!Validate::isEmail($email)) { $this->_errors[] = Tools::displayError('Invalid e-mail'); } else { if (Employee::employeeExists($email) and !Tools::getValue('id_employee')) { $this->_errors[] = Tools::displayError('an account already exists for this e-mail address:') . ' ' . $email; } } }
public static function createSellerAccount($customer) { $toqkiomv = "customer"; global $cookie; if (!Validate::isLoadedObject(${$toqkiomv})) { return; } require_once dirname(__FILE__) . "/SellerInfo.php"; $sid = AgileSellerManager::getLinkedSellerID($customer->id); if ($sid > 0) { return; } ${${"GLOBALS"}["qkyaztoiww"]} = Address::getFirstCustomerAddressId($customer->id, true); $quvvpsbmm = "address"; ${${"GLOBALS"}["ttgfmxhakl"]} = new Address(intval(${${"GLOBALS"}["qkyaztoiww"]})); if (!Validate::isLoadedObject(${$quvvpsbmm})) { $address->id_country = Configuration::get("PS_COUNTRY_DEFAULT"); } if (Employee::employeeExists($customer->email)) { $ixpzflfvjdl = "emp"; ${"GLOBALS"}["tuwsmwyun"] = "seller_emp"; ${$ixpzflfvjdl} = new Employee(); ${${"GLOBALS"}["tuwsmwyun"]} = $emp->getByEmail($customer->email); } else { $jdiwblvo = "seller_emp"; ${$jdiwblvo} = new Employee(); $seller_emp->firstname = $customer->firstname; $seller_emp->lastname = $customer->lastname; $seller_emp->email = $customer->email; $seller_emp->id_profile = (int) Configuration::get("AGILE_MS_PROFILE_ID"); $seller_emp->active = intval(Configuration::get("AGILE_MS_SELLER_APPROVAL")) == 1 ? 0 : 1; $seller_emp->id_lang = $cookie->id_lang; $seller_emp->passwd = $customer->passwd; $seller_emp->default_tab = Tab::getIdFromClassName("AdminProducts"); $seller_emp->bo_theme = "default"; $seller_emp->optin = 0; $seller_emp->add(); } AgileSellerManager::assignObjectOwner("customer", $customer->id, $seller_emp->id); ${"GLOBALS"}["pienutr"] = "customer"; ${${"GLOBALS"}["atnqtpp"]} = self::createSellerInfo(${${"GLOBALS"}["pienutr"]}, ${${"GLOBALS"}["ttgfmxhakl"]}, ${${"GLOBALS"}["mbnicd"]}); self::sendNewSellerAccountEmail($sellerinfo->id); }
protected function _childValidation() { if (!($obj = $this->loadObject(true))) { return false; } if (Tools::getValue('id_profile') == _PS_ADMIN_PROFILE_ && $this->context->employee->id_profile != _PS_ADMIN_PROFILE_) { $this->errors[] = Tools::displayError('The provided profile is invalid'); } $email = $this->getFieldValue($obj, 'email'); if (Validate::isEmail($email) && Employee::employeeExists($email) && (!Tools::getValue('id_employee') || ($employee = new Employee((int) Tools::getValue('id_employee'))) && $employee->email != $email)) { $this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $email; } }
protected function _childValidation() { if (!($obj = $this->loadObject(true))) { return false; } $email = $this->getFieldValue($obj, 'email'); if (Validate::isEmail($email) && Employee::employeeExists($email) && (!Tools::getValue('id_employee') || ($employee = new Employee((int) Tools::getValue('id_employee'))) && $employee->email != $email)) { $this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $email; } }
} if (is_array($employee->_errors) and count($employee->_errors) > 0) { $errors = $employee->_errors; } else { $_GET['id'] = $employee->id; UIAdminAlerts::conf('管理员已添加'); } } if (isset($_GET['id'])) { $id = (int) $_GET['id']; $obj = new Employee($id); } if (Tools::P('saveEmployee') == 'edit') { if (Tools::P('passwd') != Tools::P('passwd_conf')) { $obj->_errors[] = '两次输入的密码不一样!'; } elseif (Tools::P('email') != $obj->email && Employee::employeeExists(Tools::getRequest('email'))) { $obj->_errors[] = '邮箱地址已存在!'; } elseif (Validate::isLoadedObject($obj)) { $obj->copyFromPost(); $obj->update(); } if (is_array($obj->_errors) and count($obj->_errors) > 0) { $errors = $obj->_errors; } else { UIAdminAlerts::conf('管理员已更新'); } } if (isset($errors)) { UIAdminAlerts::MError($errors); } $breadcrumb = new UIAdminBreadcrumb();
public static function add_employee($email, $password, $profile, $firstName, $lastName, $active = true, $optin = false, $defaultTab = 1, $boTheme = 'default', $boMenu = 1) { if (Employee::employeeExists($email)) { echo "Cannot add {$email}, this email address is already registered !\n"; return false; } if (!Validate::isEmail($email)) { echo "email: {$email} is not a valid email address\n"; return false; } if (!Validate::isPasswd($password, 1)) { echo "Provided password is not a valid password\n"; return false; } if ($lastName == '') { echo "Last name cannot be empty !\n"; return false; } if ($firstName == '') { echo "First name cannot be empty !\n"; return false; } if (!Validate::isName($firstName)) { echo "{$firstName} is not a valid name\n"; return false; } if (!Validate::isName($lastName)) { echo "{$lastName} is not a valid name\n"; return false; } $employee = new Employee(); $employee->firstname = $firstName; $employee->lastname = $lastName; $employee->email = $email; $employee->passwd = md5(_COOKIE_KEY_ . $password); $employee->last_passwd_gen = date('Y-m-d h:i:s', strtotime('-360 minutes')); $employee->bo_theme = $boTheme; $employee->default_tab = $defaultTab; $employee->active = $active; $employee->optin = $optin; $employee->id_profile = $profile; $employee->id_lang = Configuration::get('PS_LANG_DEFAULT'); $employee->bo_menu = $boMenu; $res = $employee->add(true, true); if ($res) { echo "Successfully added user: {$email}\n"; return true; } else { echo "Could not add user: {$email}\n"; return false; } }