本文整理汇总了PHP中TBGSettings::getDefaultGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGSettings::getDefaultGroup方法的具体用法?PHP TBGSettings::getDefaultGroup怎么用?PHP TBGSettings::getDefaultGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGSettings
的用法示例。
在下文中一共展示了TBGSettings::getDefaultGroup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _preDelete
public function _preDelete()
{
$crit = TBGUsersTable::getTable()->getCriteria();
$crit->addWhere(TBGUsersTable::GROUP_ID, $this->getID());
if ($this->getID() == TBGSettings::getDefaultGroup()->getID()) {
$crit->addUpdate(TBGUsersTable::GROUP_ID, null);
} else {
$crit->addUpdate(TBGUsersTable::GROUP_ID, TBGSettings::getDefaultGroup()->getID());
}
$res = TBGUsersTable::getTable()->doUpdate($crit);
}
示例2: getGroup
/**
* Returns the user group
*
* @return TBGGroup
*/
public function getGroup()
{
if (!is_object($this->_group_id)) {
try {
if (!is_numeric($this->_group_id)) {
$this->_group_id = TBGUserScopesTable::getTable()->getUserGroupIdByScope($this->getID(), TBGContext::getScope()->getID());
}
if (!is_numeric($this->_group_id)) {
$this->_group_id = TBGSettings::getDefaultGroup();
} else {
$this->_group_id = TBGContext::factory()->TBGGroup($this->_group_id);
}
} catch (Exception $e) {
}
}
return $this->_group_id;
}
示例3: foreach
?>
" id="defaultgroup" style="width: 400px;"<?php
if ($access_level != TBGSettings::ACCESS_FULL) {
?>
disabled<?php
}
?>
>
<?php
foreach (TBGGroup::getAll() as $aGroup) {
?>
<option value="<?php
print $aGroup->getID();
?>
"<?php
if (($default_group = TBGSettings::getDefaultGroup()) instanceof TBGGroup && $default_group->getID() == $aGroup->getID()) {
?>
selected<?php
}
?>
><?php
print $aGroup->getName();
?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
示例4: runRegister
/**
* Registration logic
*
* @param TBGRequest $request
*/
public function runRegister(TBGRequest $request)
{
TBGContext::loadLibrary('common');
$i18n = TBGContext::getI18n();
try {
$username = mb_strtolower(trim($request['fieldusername']));
$buddyname = $request['buddyname'];
$email = mb_strtolower(trim($request['email_address']));
$confirmemail = mb_strtolower(trim($request['email_confirm']));
$security = $request['verification_no'];
$realname = $request['realname'];
$available = TBGUsersTable::getTable()->isUsernameAvailable($username);
$fields = array();
if (!$available) {
throw new Exception($i18n->__('This username is in use'));
}
if (!empty($buddyname) && !empty($email) && !empty($confirmemail) && !empty($security)) {
if ($email != $confirmemail) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('The email address must be valid, and must be typed twice.'));
}
if ($security != $_SESSION['activation_number']) {
array_push($fields, 'verification_no');
throw new Exception($i18n->__('To prevent automatic sign-ups, enter the verification number shown below.'));
}
$email_ok = false;
$valid_domain = false;
if (tbg_check_syntax($email, "EMAIL")) {
$email_ok = true;
}
if ($email_ok && TBGSettings::get('limit_registration') != '') {
$allowed_domains = preg_replace('/[[:space:]]*,[[:space:]]*/', '|', TBGSettings::get('limit_registration'));
if (preg_match('/@(' . $allowed_domains . ')$/i', $email) == false) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('Email adresses from this domain can not be used.'));
}
/*if (count($allowed_domains) > 0)
{
foreach ($allowed_domains as $allowed_domain)
{
$allowed_domain = '@' . trim($allowed_domain);
if (mb_strpos($email, $allowed_domain) !== false ) //mb_strpos checks if $to
{
$valid_domain = true;
break;
}
}
}
else
{
$valid_domain = true;
}*/
}
/*if ($valid_domain == false)
{
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('Email adresses from this domain can not be used.'));
}*/
if ($email_ok == false) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('The email address must be valid, and must be typed twice.'));
}
if ($security != $_SESSION['activation_number']) {
array_push($fields, 'verification_no');
throw new Exception($i18n->__('To prevent automatic sign-ups, enter the verification number shown below.'));
}
$password = TBGUser::createPassword();
$user = new TBGUser();
$user->setUsername($username);
$user->setRealname($realname);
$user->setBuddyname($buddyname);
$user->setGroup(TBGSettings::getDefaultGroup());
$user->setEnabled();
$user->setPassword($password);
$user->setEmail($email);
$user->setJoined();
$user->save();
if ($user->isActivated()) {
TBGContext::setMessage('auto_password', $password);
return $this->renderJSON(array('loginmessage' => $i18n->__('After pressing %continue, you need to set your password.', array('%continue' => $i18n->__('Continue'))), 'one_time_password' => $password, 'activated' => true));
}
return $this->renderJSON(array('loginmessage' => $i18n->__('The account has now been registered - check your email inbox for the activation email. Please be patient - this email can take up to two hours to arrive.'), 'activated' => false));
} else {
array_push($fields, 'email_address', 'email_confirm', 'buddyname', 'verification_no');
throw new Exception($i18n->__('You need to fill out all fields correctly.'));
}
} catch (Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $i18n->__($e->getMessage()), 'fields' => $fields));
}
}
示例5: _preSave
/**
* Pre-save function to check for conflicting usernames and to make
* sure some properties are set
*
* @param boolean $is_new Whether this is a new user object
*/
protected function _preSave($is_new)
{
$compare_user = self::getByUsername($this->getUsername(), $this->getScope());
if ($compare_user instanceof TBGUser && $compare_user->getID() && $compare_user->getID() != $this->getID()) {
throw new Exception(TBGContext::getI18n()->__('This username already exists'));
}
if (!$this->_realname) {
$this->_realname = $this->_username;
}
if (!$this->_buddyname) {
$this->_buddyname = $this->_username;
}
if (!$this->_group_id) {
$this->setGroup(TBGSettings::getDefaultGroup());
}
if ($this->_deleted) {
try {
if ($this->getGroup() instanceof TBGGroup) {
$this->getGroup()->removeMember($this);
}
} catch (Exception $e) {
}
$this->_group_id = null;
TBGTeamMembersTable::getTable()->clearTeamsByUserID($this->getID());
TBGClientMembersTable::getTable()->clearClientsByUserID($this->getID());
}
}
示例6: __
TBGEvent::createNew('core', 'config.createuser.email')->trigger();
?>
<dt><label for="adduser_group"><?php
echo __('Add user to group');
?>
:</label></dt>
<dd>
<select name="group_id">
<?php
foreach ($groups as $group) {
?>
<option value="<?php
echo $group->getID();
?>
" <?php
if ($group->getID() == TBGSettings::getDefaultGroup()->getID()) {
echo ' selected';
}
?>
><?php
echo $group->getName();
?>
</option>
<?php
}
?>
</select>
</dd>
<dt><label for="adduser_teams"><?php
echo __('Add user to team(s)');
?>