本文整理匯總了PHP中PHPWS_Settings::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHPWS_Settings::clear方法的具體用法?PHP PHPWS_Settings::clear怎麽用?PHP PHPWS_Settings::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPWS_Settings
的用法示例。
在下文中一共展示了PHPWS_Settings::clear方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: users_install
/**
* boost install file for users
*
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function users_install(&$content)
{
PHPWS_Core::initModClass('users', 'Users.php');
PHPWS_Core::initModClass('users', 'Action.php');
PHPWS_Core::configRequireOnce('users', 'config.php');
if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'branch') {
$db = new PHPWS_DB();
PHPWS_Settings::clear();
if (!createLocalAuthScript()) {
$content[] = 'Could not create authorization script.';
return false;
}
Branch::loadHubDB();
$db = new PHPWS_DB('mod_settings');
$db->addWhere('module', 'users');
$db->addWhere('setting_name', 'site_contact');
$db->addColumn('small_char');
$site_contact = $db->select('one');
$db = new PHPWS_DB('users');
$sql = 'select a.password, b.* from user_authorization as a, users as b where b.deity = 1 and a.username = b.username';
$deities = $db->getAll($sql);
if (PHPWS_Error::isError($deities)) {
PHPWS_Error::log($deities);
$content[] = dgettext('users', 'Could not access hub database.');
Branch::restoreBranchDB();
return FALSE;
} elseif (empty($deities)) {
$content[] = dgettext('users', 'Could not find any hub deities.');
Branch::restoreBranchDB();
return FALSE;
} else {
Branch::restoreBranchDB();
PHPWS_Settings::set('users', 'site_contact', $site_contact);
PHPWS_Settings::save('users');
$auth_db = new PHPWS_DB('user_authorization');
$user_db = new PHPWS_DB('users');
$group_db = new PHPWS_DB('users_groups');
foreach ($deities as $deity) {
$auth_db->addValue('username', $deity['username']);
$auth_db->addValue('password', $deity['password']);
$result = $auth_db->insert();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = dgettext('users', 'Unable to copy deity login to branch.');
continue;
}
unset($deity['password']);
$user_db->addValue($deity);
$result = $user_db->insert();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = dgettext('users', 'Unable to copy deity users to branch.');
Branch::loadBranchDB();
return FALSE;
}
$group_db->addValue('active', 1);
$group_db->addValue('name', $deity['username']);
$group_db->addValue('user_id', $result);
if (PHPWS_Error::logIfError($group_db->insert())) {
$content[] = dgettext('users', 'Unable to copy deity user group to branch.');
Branch::loadBranchDB();
return FALSE;
}
$group_db->reset();
$auth_db->reset();
$user_db->reset();
}
$content[] = dgettext('users', 'Deity users copied to branch.');
}
return TRUE;
}
if (!createLocalAuthScript()) {
$content[] = 'Could not create local authorization script.';
return false;
}
$authorize_id = PHPWS_Settings::get('users', 'local_script');
$user = new PHPWS_User();
$content[] = '<hr />';
return TRUE;
}