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


PHP User_group::allowedNickname方法代码示例

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


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

示例1: trySave

 function trySave()
 {
     $cur = common_current_user();
     if (!$cur->isAdmin($this->group)) {
         // TRANS: Client error displayed trying to edit a group while not being a group admin.
         $this->clientError(_('You must be an admin to edit the group.'), 403);
         return;
     }
     if (Event::handle('StartGroupSaveForm', array($this))) {
         $nickname = Nickname::normalize($this->trimmed('newnickname'));
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
         $description = $this->trimmed('description');
         $location = $this->trimmed('location');
         $aliasstring = $this->trimmed('aliases');
         $private = $this->boolean('private');
         if ($private) {
             $force_scope = 1;
             $join_policy = User_group::JOIN_POLICY_MODERATE;
         } else {
             $force_scope = 0;
             $join_policy = User_group::JOIN_POLICY_OPEN;
         }
         if ($this->nicknameExists($nickname)) {
             // TRANS: Group edit form validation error.
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 // TRANS: Group edit form validation error.
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     // TRANS: Group edit form validation error.
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         // TRANS: Group edit form validation error.
                         $this->showForm(_('Full name is too long (maximum 255 characters).'));
                         return;
                     } else {
                         if (User_group::descriptionTooLong($description)) {
                             $this->showForm(sprintf(_m('Description is too long (maximum %d character).', 'Description is too long (maximum %d characters).', User_group::maxDescription()), User_group::maxDescription()));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 // TRANS: Group edit form validation error.
                                 $this->showForm(_('Location is too long (maximum 255 characters).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
         if (!empty($aliasstring)) {
             $aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\\s,]+/', $aliasstring)));
         } else {
             $aliases = array();
         }
         if (count($aliases) > common_config('group', 'maxaliases')) {
             // TRANS: Group edit form validation error.
             // TRANS: %d is the maximum number of allowed aliases.
             $this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.', 'Too many aliases! Maximum %d allowed.', common_config('group', 'maxaliases')), common_config('group', 'maxaliases')));
             return;
         }
         foreach ($aliases as $alias) {
             if (!Nickname::isValid($alias)) {
                 // TRANS: Group edit form validation error.
                 $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
                 return;
             }
             if ($this->nicknameExists($alias)) {
                 // TRANS: Group edit form validation error.
                 $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias));
                 return;
             }
             // XXX assumes alphanum nicknames
             if (strcmp($alias, $nickname) == 0) {
                 // TRANS: Group edit form validation error.
                 $this->showForm(_('Alias can\'t be the same as nickname.'));
                 return;
             }
         }
         // Comprobamos si hay algo que actualizar, o si no ha cambiado nada el usuario.
         $part1 = false;
         if ($this->group->nickname == $nickname && $this->group->fullname == $fullname && $this->group->homepage == $homepage && $this->group->description == $description && $this->group->location == $location && $this->group->mainpage == common_local_url('showgroup', array('nickname' => $nickname)) && $this->group->join_policy == $join_policy && $this->group->force_scope == $force_scope) {
             $part1 = true;
         } else {
             $this->group->query('BEGIN');
             $orig = clone $this->group;
             $this->group->nickname = $nickname;
             $this->group->fullname = $fullname;
             $this->group->homepage = $homepage;
             $this->group->description = $description;
             $this->group->location = $location;
             $this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
             $this->group->join_policy = $join_policy;
//.........这里部分代码省略.........
开发者ID:Grasia,项目名称:bolotweet,代码行数:101,代码来源:editgroup.php

示例2: trySave

 function trySave()
 {
     $cur = common_current_user();
     if (!$cur->isAdmin($this->group)) {
         $this->clientError(_('You must be an admin to edit the group.'), 403);
         return;
     }
     $nickname = common_canonical_nickname($this->trimmed('nickname'));
     $fullname = $this->trimmed('fullname');
     $homepage = $this->trimmed('homepage');
     $description = $this->trimmed('description');
     $location = $this->trimmed('location');
     $aliasstring = $this->trimmed('aliases');
     if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
         $this->showForm(_('Nickname must have only lowercase letters ' . 'and numbers and no spaces.'));
         return;
     } else {
         if ($this->nicknameExists($nickname)) {
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         $this->showForm(_('Full name is too long (max 255 chars).'));
                         return;
                     } else {
                         if (User_group::descriptionTooLong($description)) {
                             $this->showForm(sprintf(_('description is too long (max %d chars).'), User_group::maxDescription()));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 $this->showForm(_('Location is too long (max 255 chars).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($aliasstring)) {
         $aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\\s,]+/', $aliasstring)));
     } else {
         $aliases = array();
     }
     if (count($aliases) > common_config('group', 'maxaliases')) {
         $this->showForm(sprintf(_('Too many aliases! Maximum %d.'), common_config('group', 'maxaliases')));
         return;
     }
     foreach ($aliases as $alias) {
         if (!Validate::string($alias, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
             $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
             return;
         }
         if ($this->nicknameExists($alias)) {
             $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias));
             return;
         }
         // XXX assumes alphanum nicknames
         if (strcmp($alias, $nickname) == 0) {
             $this->showForm(_('Alias can\'t be the same as nickname.'));
             return;
         }
     }
     $this->group->query('BEGIN');
     $orig = clone $this->group;
     $this->group->nickname = $nickname;
     $this->group->fullname = $fullname;
     $this->group->homepage = $homepage;
     $this->group->description = $description;
     $this->group->location = $location;
     $this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
     $result = $this->group->update($orig);
     if (!$result) {
         common_log_db_error($this->group, 'UPDATE', __FILE__);
         $this->serverError(_('Could not update group.'));
     }
     $result = $this->group->setAliases($aliases);
     if (!$result) {
         $this->serverError(_('Could not create aliases.'));
     }
     if ($nickname != $orig->nickname) {
         common_log(LOG_INFO, "Saving local group info.");
         $local = Local_group::staticGet('group_id', $this->group->id);
         $local->setNickname($nickname);
     }
     $this->group->query('COMMIT');
     if ($this->group->nickname != $orig->nickname) {
         common_redirect(common_local_url('editgroup', array('nickname' => $nickname)), 303);
     } else {
         $this->showForm(_('Options saved.'));
     }
 }
开发者ID:himmelex,项目名称:NTW,代码行数:100,代码来源:editgroup.php

示例3: trySave

 function trySave()
 {
     $nickname = $this->trimmed('nickname');
     $fullname = $this->trimmed('fullname');
     $homepage = $this->trimmed('homepage');
     $description = $this->trimmed('description');
     $location = $this->trimmed('location');
     $aliasstring = $this->trimmed('aliases');
     if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
         $this->showForm(_('Nickname must have only lowercase letters ' . 'and numbers and no spaces.'));
         return;
     } else {
         if ($this->nicknameExists($nickname)) {
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         $this->showForm(_('Full name is too long (max 255 chars).'));
                         return;
                     } else {
                         if (User_group::descriptionTooLong($description)) {
                             $this->showForm(sprintf(_('description is too long (max %d chars).'), User_group::maxDescription()));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 $this->showForm(_('Location is too long (max 255 chars).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!empty($aliasstring)) {
         $aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\\s,]+/', $aliasstring)));
     } else {
         $aliases = array();
     }
     if (count($aliases) > common_config('group', 'maxaliases')) {
         $this->showForm(sprintf(_('Too many aliases! Maximum %d.'), common_config('group', 'maxaliases')));
         return;
     }
     foreach ($aliases as $alias) {
         if (!Validate::string($alias, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
             $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
             return;
         }
         if ($this->nicknameExists($alias)) {
             $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias));
             return;
         }
         // XXX assumes alphanum nicknames
         if (strcmp($alias, $nickname) == 0) {
             $this->showForm(_('Alias can\'t be the same as nickname.'));
             return;
         }
     }
     $mainpage = common_local_url('showgroup', array('nickname' => $nickname));
     $cur = common_current_user();
     // Checked in prepare() above
     assert(!is_null($cur));
     $group = User_group::register(array('nickname' => $nickname, 'fullname' => $fullname, 'homepage' => $homepage, 'description' => $description, 'location' => $location, 'aliases' => $aliases, 'userid' => $cur->id, 'mainpage' => $mainpage, 'local' => true));
     common_redirect($group->homeUrl(), 303);
 }
开发者ID:himmelex,项目名称:NTW,代码行数:73,代码来源:newgroup.php

示例4: validateParams

 /**
  * Validate params for the new group
  *
  * @return void
  */
 function validateParams()
 {
     $valid = Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT));
     if (!$valid) {
         $this->clientError(_('Nickname must have only lowercase letters ' . 'and numbers and no spaces.'), 403, $this->format);
         return false;
     } elseif ($this->groupNicknameExists($this->nickname)) {
         $this->clientError(_('Nickname already in use. Try another one.'), 403, $this->format);
         return false;
     } else {
         if (!User_group::allowedNickname($this->nickname)) {
             $this->clientError(_('Not a valid nickname.'), 403, $this->format);
             return false;
         } elseif (!is_null($this->homepage) && strlen($this->homepage) > 0 && !Validate::uri($this->homepage, array('allowed_schemes' => array('http', 'https')))) {
             $this->clientError(_('Homepage is not a valid URL.'), 403, $this->format);
             return false;
         } elseif (!is_null($this->fullname) && mb_strlen($this->fullname) > 255) {
             $this->clientError(_('Full name is too long (maximum 255 characters).'), 403, $this->format);
             return false;
         } elseif (User_group::descriptionTooLong($this->description)) {
             $this->clientError(sprintf(_m('Description is too long (maximum %d character).', 'Description is too long (maximum %d characters).', User_group::maxDescription()), User_group::maxDescription()), 403, $this->format);
             return false;
         } elseif (!is_null($this->location) && mb_strlen($this->location) > 255) {
             $this->clientError(_('Location is too long (maximum 255 characters).'), 403, $this->format);
             return false;
         }
     }
     if (!empty($this->aliasstring)) {
         $this->aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\\s,]+/', $this->aliasstring)));
     } else {
         $this->aliases = array();
     }
     if (count($this->aliases) > common_config('group', 'maxaliases')) {
         $this->clientError(sprintf(_m('Too many aliases! Maximum %d allowed.', 'Too many aliases! Maximum %d allowed.', common_config('group', 'maxaliases')), common_config('group', 'maxaliases')), 403, $this->format);
         return false;
     }
     foreach ($this->aliases as $alias) {
         $valid = Validate::string($alias, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT));
         if (!$valid) {
             $this->clientError(sprintf(_('Invalid alias: "%s".'), $alias), 403, $this->format);
             return false;
         }
         if ($this->groupNicknameExists($alias)) {
             $this->clientError(sprintf(_('Alias "%s" already in use. Try another one.'), $alias), 403, $this->format);
             return false;
         }
         // XXX assumes alphanum nicknames
         if (strcmp($alias, $this->nickname) == 0) {
             $this->clientError(_('Alias can\'t be the same as nickname.'), 403, $this->format);
             return false;
         }
     }
     // Everything looks OK
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:60,代码来源:apigroupcreate.php

示例5: trySave

 function trySave()
 {
     if (Event::handle('StartGroupSaveForm', array($this))) {
         try {
             $nickname = Nickname::normalize($this->trimmed('nickname'));
         } catch (NicknameException $e) {
             $this->showForm($e->getMessage());
         }
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
         $description = $this->trimmed('description');
         $location = $this->trimmed('location');
         $aliasstring = $this->trimmed('aliases');
         if ($this->nicknameExists($nickname)) {
             // TRANS: Group create form validation error.
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 // TRANS: Group create form validation error.
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     // TRANS: Group create form validation error.
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         // TRANS: Group create form validation error.
                         $this->showForm(_('Full name is too long (maximum 255 characters).'));
                         return;
                     } else {
                         if (User_group::descriptionTooLong($description)) {
                             // TRANS: Group create form validation error.
                             // TRANS: %d is the maximum number of allowed characters.
                             $this->showForm(sprintf(_m('Description is too long (maximum %d character).', 'Description is too long (maximum %d characters).', User_group::maxDescription()), User_group::maxDescription()));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 // TRANS: Group create form validation error.
                                 $this->showForm(_('Location is too long (maximum 255 characters).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
         if (!empty($aliasstring)) {
             $aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\\s,]+/', $aliasstring)));
         } else {
             $aliases = array();
         }
         if (count($aliases) > common_config('group', 'maxaliases')) {
             // TRANS: Group create form validation error.
             // TRANS: %d is the maximum number of allowed aliases.
             $this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.', 'Too many aliases! Maximum %d allowed.', common_config('group', 'maxaliases')), common_config('group', 'maxaliases')));
             return;
         }
         foreach ($aliases as $alias) {
             if (!Nickname::isValid($alias)) {
                 // TRANS: Group create form validation error.
                 // TRANS: %s is the invalid alias.
                 $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
                 return;
             }
             if ($this->nicknameExists($alias)) {
                 // TRANS: Group create form validation error. %s is the already used alias.
                 $this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'), $alias));
                 return;
             }
             // XXX assumes alphanum nicknames
             if (strcmp($alias, $nickname) == 0) {
                 // TRANS: Group create form validation error.
                 $this->showForm(_('Alias cannot be the same as nickname.'));
                 return;
             }
         }
         $cur = common_current_user();
         // Checked in prepare() above
         assert(!is_null($cur));
         $group = User_group::register(array('nickname' => $nickname, 'fullname' => $fullname, 'homepage' => $homepage, 'description' => $description, 'location' => $location, 'aliases' => $aliases, 'userid' => $cur->id, 'local' => true));
         $this->group = $group;
         Event::handle('EndGroupSaveForm', array($this));
         common_redirect($group->homeUrl(), 303);
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:88,代码来源:newgroup.php

示例6: validateNickname

 function validateNickname()
 {
     if (!Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
         throw new ApiValidationException(_('Nickname must have only lowercase letters and numbers and no spaces.'));
     } else {
         if ($this->nicknameExists($this->nickname)) {
             throw new ApiValidationException(_('Nickname already in use. Try another one.'));
         } else {
             if (!User_group::allowedNickname($this->nickname)) {
                 throw new ApiValidationException(_('Not a valid nickname.'));
             }
         }
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:15,代码来源:apigroupprofileupdate.php

示例7: trySave

 function trySave()
 {
     $nickname = $this->trimmed('nickname');
     $fullname = $this->trimmed('fullname');
     $homepage = $this->trimmed('homepage');
     $description = $this->trimmed('description');
     $location = $this->trimmed('location');
     if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
         $this->showForm(_('Nickname must have only lowercase letters ' . 'and numbers and no spaces.'));
         return;
     } else {
         if ($this->nicknameExists($nickname)) {
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         $this->showForm(_('Full name is too long (max 255 chars).'));
                         return;
                     } else {
                         if (!is_null($description) && mb_strlen($description) > 140) {
                             $this->showForm(_('description is too long (max 140 chars).'));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 $this->showForm(_('Location is too long (max 255 chars).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
     }
     $cur = common_current_user();
     // Checked in prepare() above
     assert(!is_null($cur));
     $group = new User_group();
     $group->query('BEGIN');
     $group->nickname = $nickname;
     $group->fullname = $fullname;
     $group->homepage = $homepage;
     $group->description = $description;
     $group->location = $location;
     $group->created = common_sql_now();
     $result = $group->insert();
     if (!$result) {
         common_log_db_error($group, 'INSERT', __FILE__);
         $this->serverError(_('Could not create group.'));
     }
     $member = new Group_member();
     $member->group_id = $group->id;
     $member->profile_id = $cur->id;
     $member->is_admin = 1;
     $member->created = $group->created;
     $result = $member->insert();
     if (!$result) {
         common_log_db_error($member, 'INSERT', __FILE__);
         $this->serverError(_('Could not set group membership.'));
     }
     $group->query('COMMIT');
     common_redirect($group->homeUrl(), 307);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:70,代码来源:newgroup.php

示例8: trySave

 function trySave()
 {
     $cur = common_current_user();
     if (!$cur->isAdmin($this->group)) {
         $this->clientError(_('You must be an admin to edit the group'), 403);
         return;
     }
     $nickname = common_canonical_nickname($this->trimmed('nickname'));
     $fullname = $this->trimmed('fullname');
     $homepage = $this->trimmed('homepage');
     $description = $this->trimmed('description');
     $location = $this->trimmed('location');
     if (!Validate::string($nickname, array('min_length' => 1, 'max_length' => 64, 'format' => NICKNAME_FMT))) {
         $this->showForm(_('Nickname must have only lowercase letters ' . 'and numbers and no spaces.'));
         return;
     } else {
         if ($this->nicknameExists($nickname)) {
             $this->showForm(_('Nickname already in use. Try another one.'));
             return;
         } else {
             if (!User_group::allowedNickname($nickname)) {
                 $this->showForm(_('Not a valid nickname.'));
                 return;
             } else {
                 if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
                     $this->showForm(_('Homepage is not a valid URL.'));
                     return;
                 } else {
                     if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                         $this->showForm(_('Full name is too long (max 255 chars).'));
                         return;
                     } else {
                         if (!is_null($description) && mb_strlen($description) > 140) {
                             $this->showForm(_('description is too long (max 140 chars).'));
                             return;
                         } else {
                             if (!is_null($location) && mb_strlen($location) > 255) {
                                 $this->showForm(_('Location is too long (max 255 chars).'));
                                 return;
                             }
                         }
                     }
                 }
             }
         }
     }
     $orig = clone $this->group;
     $this->group->nickname = $nickname;
     $this->group->fullname = $fullname;
     $this->group->homepage = $homepage;
     $this->group->description = $description;
     $this->group->location = $location;
     $this->group->created = common_sql_now();
     $result = $this->group->update($orig);
     if (!$result) {
         common_log_db_error($this->group, 'UPDATE', __FILE__);
         $this->serverError(_('Could not update group.'));
     }
     if ($this->group->nickname != $orig->nickname) {
         common_redirect(common_local_url('editgroup', array('nickname' => $nickname)), 307);
     } else {
         $this->showForm(_('Options saved.'));
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:64,代码来源:editgroup.php

示例9: exit

    }
} else {
    print "You must provide a nickname.\n";
    exit(1);
}
// Cogemos nick de grupo de parámetro
if (have_option('g', 'group')) {
    $gnick = get_option_value('g', 'group');
} else {
    print "You must provide the nickname of the group.\n";
    exit(1);
}
// Comprobamos que el nick del grupo sea válido
try {
    $nickname = Nickname::normalize($gnick);
    if (!User_group::allowedNickname($nickname)) {
        print "Nick de grupo no válido.\n";
        exit(1);
    }
} catch (NicknameException $e) {
    print "Nick de grupo no válido.\n";
    exit(1);
}
// Comprobamos si ese nick de grupo existe.
$local = Local_group::staticGet('nickname', $nickname);
$alias = Group_alias::staticGet('alias', $nickname);
if (!empty($alias) || !empty($local)) {
    print "Nick de grupo en uso, elige otro nombre de grupo.\n";
    exit(1);
}
// Si hemos llegado aquí es que el usuario y el nick del grupo son válidos.
开发者ID:Grasia,项目名称:bolotweet,代码行数:31,代码来源:createGroup.php


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