private function sendInvites($profile, $emails_list) { $results = array('success' => array(), 'failed' => array()); $emails = string_explode_list($emails_list); $auth_controller = cmsCore::getController('auth'); $auth_model = cmsCore::getModel('auth'); $messenger = cmsCore::getController('messages'); foreach ($emails as $email) { if ($this->validate_email($email) !== true) { $results['failed'][$email] = ERR_VALIDATE_EMAIL; continue; } if ($this->model->getUserByEmail($email)) { $results['failed'][$email] = LANG_REG_EMAIL_EXISTS; continue; } if (!$auth_controller->isEmailAllowed($email)) { $results['failed'][$email] = LANG_AUTH_RESTRICTED_EMAILS; continue; } $invite = $auth_model->getNextInvite($this->cms_user->id); $to = array('email' => $email, 'name' => $email); $letter = array('name' => 'users_invite'); $messenger->sendEmail($to, $letter, array('nickname' => $this->cms_user->nickname, 'code' => $invite['code'], 'page_url' => href_to_abs('auth', 'register') . "?inv={$invite['code']}")); $results['success'][$email] = true; $auth_model->markInviteSended($invite['id'], $this->cms_user->id, $email); if (sizeof($results['success']) + sizeof($results['failed']) >= $profile['invites_count']) { break; } } return $results; }
public function __construct() { parent::__construct(); $this->config = cmsController::loadOptions('photos'); if (!empty($this->config['types'])) { $this->config['types'] = string_explode_list($this->config['types']); } }
public function setOptions($options) { parent::setOptions($options); if (!isset($this->items) && $this->hasDefaultValue()) { $this->items = string_explode_list($this->getDefaultValue()); $this->default = null; } }
public function getListItems() { $items = array(); if (isset($this->items)) { $items = $this->items; } else { if (isset($this->generator)) { $generator = $this->generator; $items = $generator($this->item); } else { if ($this->hasDefaultValue()) { $items = string_explode_list($this->getDefaultValue()); } } } return $items; }
public function parseListItems($string) { return string_explode_list($string); }
public function getPropsFields($props) { $fields = array(); if (!is_array($props)) { return $fields; } foreach ($props as $prop) { $field_name = "props:{$prop['id']}"; $rules = array(); if (!empty($prop['options']['is_required'])) { $rules[] = array('required'); } switch ($prop['type']) { case 'list': $rules[] = array('digits'); $field = new fieldList($field_name, array('title' => $prop['title'], 'items' => string_explode_list($prop['values']), 'rules' => $rules)); break; case 'string': $field = new fieldString($field_name, array('title' => $prop['title'], 'rules' => $rules)); break; case 'number': $field = new fieldNumber($field_name, array('title' => $prop['title'], 'units' => !empty($prop['options']['units']) ? $prop['options']['units'] : false, 'rules' => $rules)); break; } $fields[$prop['id']] = $field; } return $fields; }