本文整理汇总了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;
}