当前位置: 首页>>代码示例>>PHP>>正文


PHP Organization::forDomain方法代码示例

本文整理汇总了PHP中Organization::forDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::forDomain方法的具体用法?PHP Organization::forDomain怎么用?PHP Organization::forDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Organization的用法示例。


在下文中一共展示了Organization::forDomain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create


//.........这里部分代码省略.........
     }
     if (!$errors) {
         # Perform ticket filter actions on the new ticket arguments
         $__form = null;
         if ($vars['topicId']) {
             if (($__topic = Topic::lookup($vars['topicId'])) && ($__form = $__topic->getForm())) {
                 $__form = $__form->instanciate();
                 $__form->setSource($vars);
             }
         }
         try {
             $vars = self::filterTicketData($origin, $vars, array($form, $__form), $user);
         } catch (RejectedException $ex) {
             return $reject_ticket(sprintf(_S('Ticket rejected (%s) by filter "%s"'), $ex->vars['email'], $ex->getRejectingFilter()->getName()));
         }
         //Make sure the open ticket limit hasn't been reached. (LOOP CONTROL)
         if ($cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff') && ($_user = TicketUser::lookupByEmail($vars['email'])) && ($openTickets = $_user->getNumOpenTickets()) && $openTickets >= $cfg->getMaxOpenTickets()) {
             $errors = array('err' => __("You've reached the maximum open tickets allowed."));
             $ost->logWarning(sprintf(_S('Ticket denied - %s'), $vars['email']), sprintf(_S('Max open tickets (%1$d) reached for %2$s'), $cfg->getMaxOpenTickets(), $vars['email']), false);
             return 0;
         }
         // Allow vars to be changed in ticket filter and applied to the user
         // account created or detected
         if (!$user && $vars['email']) {
             $user = User::lookupByEmail($vars['email']);
         }
         if (!$user) {
             // Reject emails if not from registered clients (if
             // configured)
             if (strcasecmp($origin, 'email') === 0 && !$cfg->acceptUnregisteredEmail()) {
                 list($mailbox, $domain) = explode('@', $vars['email'], 2);
                 // Users not yet created but linked to an organization
                 // are still acceptable
                 if (!Organization::forDomain($domain)) {
                     return $reject_ticket(sprintf(_S('Ticket rejected (%s) (unregistered client)'), $vars['email']));
                 }
             }
             $user_form = UserForm::getUserForm()->getForm($vars);
             if (!$user_form->isValid($field_filter('user')) || !($user = User::fromVars($user_form->getClean()))) {
                 $errors['user'] = __('Incomplete client information');
             }
         }
     }
     if ($vars['topicId']) {
         if ($topic = Topic::lookup($vars['topicId'])) {
             if ($topic_form = $topic->getForm()) {
                 $TF = $topic_form->getForm($vars);
                 $topic_form = $topic_form->instanciate();
                 $topic_form->setSource($vars);
                 if (!$TF->isValid($field_filter('topic'))) {
                     $errors = array_merge($errors, $TF->errors());
                 }
             }
         } else {
             $errors['topicId'] = 'Invalid help topic selected';
         }
     }
     // Any error above is fatal.
     if ($errors) {
         return 0;
     }
     Signal::send('ticket.create.validated', null, $vars);
     # Some things will need to be unpacked back into the scope of this
     # function
     if (isset($vars['autorespond'])) {
         $autorespond = $vars['autorespond'];
开发者ID:gizur,项目名称:osticket,代码行数:67,代码来源:class.ticket.php

示例2: fromVars

 static function fromVars($vars)
 {
     // Try and lookup by email address
     $user = static::lookupByEmail($vars['email']);
     if (!$user) {
         $name = $vars['name'];
         if (!$name) {
             list($name) = explode('@', $vars['email'], 2);
         }
         $user = User::create(array('name' => Format::htmldecode(Format::sanitize($name, false)), 'created' => new SqlFunction('NOW'), 'updated' => new SqlFunction('NOW'), 'default_email' => UserEmail::ensure($vars['email'])));
         // Is there an organization registered for this domain
         list($mailbox, $domain) = explode('@', $vars['email'], 2);
         if (isset($vars['org_id'])) {
             $user->set('org_id', $vars['org_id']);
         } elseif ($org = Organization::forDomain($domain)) {
             $user->setOrganization($org, false);
         }
         try {
             $user->save(true);
             $user->emails->add($user->default_email);
             // Attach initial custom fields
             $user->addDynamicData($vars);
         } catch (OrmException $e) {
             return null;
         }
     }
     return $user;
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:28,代码来源:class.user.php

示例3: create


//.........这里部分代码省略.........
     }
     if (!$errors) {
         # Perform ticket filter actions on the new ticket arguments
         $__form = null;
         if ($vars['topicId']) {
             if (($__topic = Topic::lookup($vars['topicId'])) && ($__form = $__topic->getForm())) {
                 $__form = $__form->instanciate();
                 $__form->setSource($vars);
             }
         }
         try {
             $vars = self::filterTicketData($origin, $vars, array($form, $__form), $user);
         } catch (RejectedException $ex) {
             return $reject_ticket(sprintf(_S('Ticket rejected (%s) by filter "%s"'), $ex->vars['email'], $ex->getRejectingFilter()->getName()));
         }
         //Make sure the open ticket limit hasn't been reached. (LOOP CONTROL)
         if ($cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff') && ($_user = TicketUser::lookupByEmail($vars['email'])) && ($openTickets = $_user->getNumOpenTickets()) && $openTickets >= $cfg->getMaxOpenTickets()) {
             $errors = array('err' => __("You've reached the maximum open tickets allowed."));
             $ost->logWarning(sprintf(_S('Ticket denied - %s'), $vars['email']), sprintf(_S('Max open tickets (%1$d) reached for %2$s'), $cfg->getMaxOpenTickets(), $vars['email']), false);
             return 0;
         }
         // Allow vars to be changed in ticket filter and applied to the user
         // account created or detected
         if (!$user && $vars['email']) {
             $user = User::lookupByEmail($vars['email']);
         }
         if (!$user) {
             // Reject emails if not from registered clients (if
             // configured)
             if (strcasecmp($origin, 'email') === 0 && !$cfg->acceptUnregisteredEmail()) {
                 list($mailbox, $domain) = explode('@', $vars['email'], 2);
                 // Users not yet created but linked to an organization
                 // are still acceptable
                 if (!Organization::forDomain($domain)) {
                     return $reject_ticket(sprintf(_S('Ticket rejected (%s) (unregistered client)'), $vars['email']));
                 }
             }
             $user_form = UserForm::getUserForm()->getForm($vars);
             if (!$user_form->isValid($field_filter('user')) || !($user = User::fromVars($user_form->getClean()))) {
                 $errors['user'] = __('Incomplete client information');
             }
         }
     }
     if ($vars['topicId']) {
         if ($topic = Topic::lookup($vars['topicId'])) {
             if ($topic_form = $topic->getForm()) {
                 $TF = $topic_form->getForm($vars);
                 $topic_form = $topic_form->instanciate();
                 $topic_form->setSource($vars);
                 if (!$TF->isValid($field_filter('topic'))) {
                     $errors = array_merge($errors, $TF->errors());
                 }
             }
         } else {
             $errors['topicId'] = 'Invalid help topic selected';
         }
     }
     // Any error above is fatal.
     if ($errors) {
         return 0;
     }
     Signal::send('ticket.create.validated', null, $vars);
     # Some things will need to be unpacked back into the scope of this
     # function
     if (isset($vars['autorespond'])) {
         $autorespond = $vars['autorespond'];
开发者ID:jmangarret,项目名称:ostickets,代码行数:67,代码来源:class.ticket.php

示例4: fromVars

 static function fromVars($vars, $update = false)
 {
     // Try and lookup by email address
     $user = static::lookupByEmail($vars['email']);
     if (!$user) {
         $name = $vars['name'];
         if (!$name) {
             list($name) = explode('@', $vars['email'], 2);
         }
         $user = User::create(array('name' => Format::htmldecode(Format::sanitize($name, false)), 'created' => new SqlFunction('NOW'), 'updated' => new SqlFunction('NOW'), 'default_email' => UserEmail::ensure($vars['email'])));
         // Is there an organization registered for this domain
         list($mailbox, $domain) = explode('@', $vars['email'], 2);
         if (isset($vars['org_id'])) {
             $user->set('org_id', $vars['org_id']);
         } elseif ($org = Organization::forDomain($domain)) {
             $user->setOrganization($org, false);
         }
         try {
             $user->save(true);
             $user->emails->add($user->default_email);
             // Attach initial custom fields
             $user->addDynamicData($vars);
         } catch (OrmException $e) {
             return null;
         }
     } elseif ($update) {
         $errors = array();
         $user->updateInfo($vars, $errors, true);
     }
     /* INICIO
        Anthony Parisi
        */
     if (isset($_SESSION["crmEmail"])) {
         $mysqli = new mysqli("localhost", "root", "ip15x0", "vtigercrm600");
         $sqlUser = $mysqli->query("SELECT MAX(id) FROM `vtigercrm600`.vtiger_modtracker_detail;");
         $resUser = $sqlUser->fetch_array();
         $mysqli->query("UPDATE `vtigercrm600`.`vtiger_contactdetails` SET `mobile` = '" . $_SESSION["crmPhone"] . "' WHERE UPPER(`vtiger_contactdetails`.`email`) = UPPER('" . $_SESSION["crmEmail"] . "');");
         $mysqli->query("INSERT INTO `vtigercrm600`.vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES('" . $resUser[0] . "','email',NULL,'" . $_SESSION["crmPhone"] . "');");
         unset($_SESSION["crmEmail"]);
         unset($_SESSION["crmPhone"]);
     }
     /* FIN */
     return $user;
 }
开发者ID:jmangarret,项目名称:ostickets,代码行数:44,代码来源:class.user.php


注:本文中的Organization::forDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。