本文整理汇总了PHP中PHPWS_Settings::set方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Settings::set方法的具体用法?PHP PHPWS_Settings::set怎么用?PHP PHPWS_Settings::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Settings
的用法示例。
在下文中一共展示了PHPWS_Settings::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: faxmaster_update
/**
* update.php - FaxMaster update script
*
*/
function faxmaster_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '0.1.0', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.1.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.2', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.2.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.3', '<'):
PHPWS_Core::initModClass('users', 'Permission.php');
Users_Permission::registerPermissions('faxmaster', $content);
case version_compare($currentVersion, '0.1.5', '<'):
PHPWS_Settings::set('faxmaster', 'fax_path', '/var/fax/');
PHPWS_Settings::save('faxmaster');
case version_compare($currentVersion, '0.1.6', '<'):
$content[] = '<pre>';
slcUpdateFiles(array('class/FaxPager.php', 'class/Faxmaster.php', 'templates/faxList.tpl', 'templates/style.css', 'templates/statistics.tpl'), $content);
$content[] = '0.1.6 Changes
---------------
+ Added a statistics page to view monthly fax stats.
+ Added CSV export to the new statistics page.</pre>';
case version_compare($currentVersion, '0.1.7', '<'):
$content[] = '<pre>';
// Add 2 new columns to the database related to archiving
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.7.sql');
if (PEAR::isError($result)) {
return $result;
}
slcUpdateFiles(array('boost/boost.php', 'boost/install.sql', 'boost/permission.php', 'boost/update.php', 'boost/update-0.1.7.sql', 'class/ArchiveDownload.php', 'class/exception/InstallException.php', 'class/Fax.php', 'class/FaxPager.php', 'class/Faxmaster.php', 'inc/settings.php', 'templates/archivePager.tpl', 'templates/faxList.tpl', 'templates/settings.tpl', 'templates/style.css'), $content);
$content[] = '0.1.7 Changes
---------------
+ Added an archive method that is only accessbile by URL.
+ Added the ability to Download an Archive file.
+ Added permissions related to archiving and settings.
+ Added 2 database columns needed for archiving.
+ Added a View Archive page to view a list of all archived faxes.
+ Added a Settings page to configure the fax and archive paths.
</pre>';
case version_compare($currentVersion, '0.1.8', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.8.sql');
if (PEAR::isError($result)) {
return $result;
}
}
return true;
}
示例2: save
private function save($request)
{
$studentDataApiUrl = $request->getVar('studentDataApiUrl');
\PHPWS_Settings::set('election', 'studentDataApiUrl', $studentDataApiUrl);
$studentOrgApiUrl = $request->getVar('studentOrgApiUrl');
\PHPWS_Settings::set('election', 'studentOrgApiUrl', $studentOrgApiUrl);
$fromAddress = $request->getVar('fromAddress');
\PHPWS_Settings::set('election', 'fromAddress', $fromAddress);
$surveyLink = $request->getVar('surveyLink');
\PHPWS_Settings::set('election', 'surveyLink', $surveyLink);
$supportLink = $request->getVar('supportLink');
\PHPWS_Settings::set('election', 'supportLink', $supportLink);
\PHPWS_Settings::save('election');
}
示例3: purgeProperties
function purgeProperties()
{
$last_purge = \PHPWS_Settings::get('properties', 'last_purge') + 86400;
$current_time = time();
if ($last_purge < $current_time) {
\PHPWS_Settings::set('properties', 'last_purge', $current_time);
\PHPWS_Settings::save('properties');
$db = new PHPWS_DB('properties');
$db->addWhere('timeout', time(), '<');
$db->addValue('active', 0);
$db->update();
$db = new PHPWS_DB('prop_roommate');
$db->addWhere('timeout', time(), '<');
$db->delete();
}
}
示例4: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'lottery_admin')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to administer re-application features.');
}
$viewCmd = CommandFactory::getCommand('ShowLotterySettings');
$lotteryTerm = $context->get('lottery_term');
$hardCap = !is_null($context->get('hard_cap')) ? $context->get('hard_cap') : 0;
$jrGoal = !is_null($context->get('jr_goal')) ? $context->get('jr_goal') : 0;
$srGoal = !is_null($context->get('sr_goal')) ? $context->get('sr_goal') : 0;
PHPWS_Settings::set('hms', 'lottery_term', $lotteryTerm);
PHPWS_Settings::set('hms', 'lottery_hard_cap', $hardCap);
PHPWS_Settings::set('hms', 'lottery_jr_goal', $jrGoal);
PHPWS_Settings::set('hms', 'lottery_sr_goal', $srGoal);
PHPWS_Settings::save('hms');
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Lottery settings saved.');
$viewCmd->redirect();
}
示例5: moduleWarning
public static function moduleWarning($module)
{
// disabling as it is broken
return;
if (!LOG_DEPRECATIONS) {
return;
}
$dep_name = $module . '_deprecated';
$last_warned = PHPWS_Settings::get('users', $dep_name);
$spacing = time() - 86400 * DEPRECATE_DAY_SPACING;
// It hasn't been long enough to log the warning.
if ($last_warned && $last_warned > $spacing) {
return;
}
$warning = "The {$module} module is deprecated and support is discontinued. Please consider uninstalling it.";
PHPWS_Core::log($warning, 'deprecated.log');
PHPWS_Settings::set('users', $dep_name, time());
PHPWS_Settings::save('users');
}
示例6: set
public function set($settingName, $value)
{
$this->settings[$settingName] = $value;
\PHPWS_Settings::set('addthis', $settingName, $value);
\PHPWS_Settings::save('addthis');
}
示例7: postSettings
public static function postSettings()
{
if (empty($_POST['max_image_width']) || $_POST['max_image_width'] < 50) {
$error[] = dgettext('block', 'Max image width must be greater than 50px');
} elseif ($_POST['max_image_width'] > 1024) {
$error[] = dgettext('block', 'Max image width must be smaller than 1024px');
} else {
PHPWS_Settings::set('block', 'max_image_width', (int) $_POST['max_image_width']);
}
if (empty($_POST['max_image_height']) || $_POST['max_image_height'] < 50) {
$error[] = dgettext('block', 'Max image height must be greater than 50px');
} elseif ($_POST['max_image_height'] > 3000) {
$error[] = dgettext('block', 'Max image height must be smaller than 3000px');
} else {
PHPWS_Settings::set('block', 'max_image_height', (int) $_POST['max_image_height']);
}
PHPWS_Settings::save('block');
if (isset($error)) {
return $error;
} else {
return true;
}
}
示例8: postMeta
public static function postMeta()
{
$values['page_title'] = strip_tags($_POST['page_title']);
$values['meta_keywords'] = strip_tags($_POST['meta_keywords']);
$values['meta_description'] = strip_tags($_POST['meta_description']);
if (isset($_POST['index'])) {
$index = 1;
} else {
$index = 0;
}
if (isset($_POST['follow'])) {
$follow = 1;
} else {
$follow = 0;
}
PHPWS_Settings::set('layout', 'use_key_summaries', (int) isset($_POST['use_key_summaries']));
PHPWS_Settings::save('layout');
$values['meta_robots'] = $index . $follow;
if (isset($_POST['key_id'])) {
$key_id = (int) $_POST['key_id'];
}
if (isset($key_id)) {
$values['key_id'] = $key_id;
$db = new PHPWS_DB('layout_metatags');
$db->addWhere('key_id', $key_id);
$db->delete();
if (isset($_POST['reset'])) {
return true;
}
$db->reset();
$db->addValue($values);
return $db->insert();
} else {
$db = new PHPWS_DB('layout_config');
$db->addValue($values);
return $db->update();
}
}
示例9: postSchedule
public function postSchedule()
{
$default_public = PHPWS_Settings::get('calendar', 'public_schedule');
if ($this->calendar->schedule->post()) {
if (!$this->allowSchedulePost()) {
Current_User::disallow();
return;
}
$result = $this->calendar->schedule->save();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
if (PHPWS_Calendar::isJS()) {
$this->sendMessage(dgettext('calendar', 'An error occurred when saving your schedule.'), null, false);
javascript('close_refresh');
Layout::nakedDisplay();
exit;
} else {
$this->sendMessage(dgettext('calendar', 'An error occurred when saving your schedule.'), 'aop=schedules');
}
} else {
if ($this->calendar->schedule->public && $default_public < 1) {
PHPWS_Settings::set('calendar', 'public_schedule', $this->calendar->schedule->id);
PHPWS_Settings::save('calendar');
}
if (!$this->calendar->schedule->public && $this->calendar->schedule->id == $default_public) {
PHPWS_Settings::set('calendar', 'public_schedule', 0);
PHPWS_Settings::save('calendar');
}
if (PHPWS_Calendar::isJS()) {
javascript('close_refresh');
Layout::nakedDisplay();
exit;
} else {
$this->sendMessage(dgettext('calendar', 'Schedule saved.'), 'aop=schedules');
}
}
} else {
$this->message = $this->calendar->schedule->_error;
$this->editSchedule();
}
}
示例10: postSettings
private function postSettings()
{
if (!empty($_POST['login_link']) && preg_match('/[^\\w\\-\\?&=:+\\/]/', $_POST['login_link'])) {
$this->errors['login_link'] = 'Login link had non-url characters';
} else {
\PHPWS_Settings::set('properties', 'login_link', $_POST['login_link']);
}
if (!\PHPWS_Text::isValidInput($_POST['email'], 'email')) {
$this->errors['email'] = 'Email address is empty or malformed.';
} else {
\PHPWS_Settings::set('properties', 'email', $_POST['email']);
}
\PHPWS_Settings::set('properties', 'roommate_only', (int) isset($_POST['roommate_only']));
if (!isset($this->errors)) {
\PHPWS_Settings::save('properties');
return true;
} else {
return false;
}
}
示例11: postAuthorization
public static function postAuthorization()
{
if (isset($_POST['add_script'])) {
if (!isset($_POST['file_list'])) {
return false;
}
$db = new PHPWS_DB('users_auth_scripts');
$db->addWhere('filename', strip_tags($_POST['file_list']));
$result = $db->select('one');
if (PHPWS_Error::isError($result)) {
return $result;
} elseif (!empty($result)) {
return false;
}
$db->resetWhere();
$db->addValue('display_name', $_POST['file_list']);
$db->addValue('filename', $_POST['file_list']);
$result = $db->insert();
if (PHPWS_Error::isError($result)) {
return $result;
}
} else {
if (isset($_POST['default_authorization'])) {
PHPWS_Settings::set('users', 'default_authorization', (int) $_POST['default_authorization']);
PHPWS_Settings::save('users');
}
if (!empty($_POST['default_group'])) {
$db = new PHPWS_DB('users_auth_scripts');
foreach ($_POST['default_group'] as $auth_id => $group_id) {
$db->reset();
$db->addWhere('id', $auth_id);
$db->addValue('default_group', $group_id);
PHPWS_Error::logIfError($db->update());
}
}
}
return true;
}
示例12: postSettings
public function postSettings()
{
if (isset($_POST['add'])) {
$reason = trim(strip_tags($_POST['new_reason']));
if (!empty($reason)) {
$this->addReason($reason);
}
}
PHPWS_Settings::set('checkin', 'staff_see_reports', (int) isset($_POST['staff_see_reports']));
PHPWS_Settings::set('checkin', 'unassigned_seen', (int) isset($_POST['unassigned_seen']));
PHPWS_Settings::set('checkin', 'front_page', (int) isset($_POST['front_page']));
PHPWS_Settings::set('checkin', 'collapse_signin', (int) isset($_POST['collapse_signin']));
PHPWS_Settings::set('checkin', 'sendback', (int) isset($_POST['sendback']));
PHPWS_Settings::set('checkin', 'email', (int) isset($_POST['email']));
PHPWS_Settings::set('checkin', 'gender', (int) isset($_POST['gender']));
PHPWS_Settings::set('checkin', 'birthdate', (int) isset($_POST['birthdate']));
// If checkin does not ask for gender, make sure no staff member is filtering by gender
if (!isset($_POST['gender'])) {
$this->loadStaffList();
foreach ($this->staff_list as $staff) {
$staff->filter_type = $staff->filter_type & ~GENDER_BITMASK;
$staff->save();
}
}
// If checkin does not ask for birthdate, make sure no staff member is filtering by birthdate
if (!isset($_POST['birthdate'])) {
$this->loadstaffList();
foreach ($this->staff_list as $staff) {
$staff->filter_type = $staff->filter_type & ~BIRTHDATE_BITMASK;
$staff->save();
}
}
$seconds = (int) $_POST['assign_refresh'];
if ($seconds < 1) {
$seconds = 15;
}
PHPWS_Settings::set('checkin', 'assign_refresh', $seconds);
$seconds = (int) $_POST['waiting_refresh'];
if ($seconds < 1) {
$seconds = 15;
}
PHPWS_Settings::set('checkin', 'waiting_refresh', $seconds);
PHPWS_Settings::save('checkin');
}
示例13: set
public function set($settingName, $value)
{
$this->settings[$settingName] = $value;
PHPWS_Settings::set('likebox', $settingName, $value);
PHPWS_Settings::save('likebox');
}
示例14: postSettings
public static function postSettings()
{
if (isset($_POST['show_recent'])) {
PHPWS_Settings::set('blog', 'show_recent', $_POST['show_recent']);
}
isset($_POST['captcha_submissions']) ? PHPWS_Settings::set('blog', 'captcha_submissions', 1) : PHPWS_Settings::set('blog', 'captcha_submissions', 0);
isset($_POST['home_page_display']) ? PHPWS_Settings::set('blog', 'home_page_display', 1) : PHPWS_Settings::set('blog', 'home_page_display', 0);
isset($_POST['allow_anonymous_submits']) ? PHPWS_Settings::set('blog', 'allow_anonymous_submits', 1) : PHPWS_Settings::set('blog', 'allow_anonymous_submits', 0);
isset($_POST['logged_users_only']) ? PHPWS_Settings::set('blog', 'logged_users_only', 1) : PHPWS_Settings::set('blog', 'logged_users_only', 0);
isset($_POST['show_posted_date']) ? PHPWS_Settings::set('blog', 'show_posted_date', 1) : PHPWS_Settings::set('blog', 'show_posted_date', 0);
isset($_POST['show_posted_by']) ? PHPWS_Settings::set('blog', 'show_posted_by', 1) : PHPWS_Settings::set('blog', 'show_posted_by', 0);
if (isset($_POST['view_only']) && is_array($_POST['view_only'])) {
$view_only = implode(':', $_POST['view_only']);
} else {
$view_only = null;
}
PHPWS_Settings::set('blog', 'view_only', $view_only);
if (isset($_POST['simple_image'])) {
PHPWS_Settings::set('blog', 'simple_image', 1);
isset($_POST['mod_folders_only']) ? PHPWS_Settings::set('blog', 'mod_folders_only', 1) : PHPWS_Settings::set('blog', 'mod_folders_only', 0);
if (!empty($_POST['max_width'])) {
$max_width = (int) $_POST['max_width'];
if ($max_width >= 50 && $max_width <= 2048) {
PHPWS_Settings::set('blog', 'max_width', $max_width);
}
}
if (!empty($_POST['max_height'])) {
$max_height = (int) $_POST['max_height'];
if ($max_height >= 50 && $max_height <= 2048) {
PHPWS_Settings::set('blog', 'max_height', $max_height);
}
}
} else {
PHPWS_Settings::set('blog', 'simple_image', 0);
}
$past_limit = (int) $_POST['past_entries'];
if ((int) $past_limit >= 0) {
PHPWS_Settings::set('blog', 'past_entries', $past_limit);
} else {
PHPWS_Settings::reset('blog', 'past_entries');
}
$blog_limit = (int) $_POST['blog_limit'];
if ((int) $blog_limit > 0) {
PHPWS_Settings::set('blog', 'blog_limit', $blog_limit);
} else {
PHPWS_Settings::reset('blog', 'blog_limit');
}
PHPWS_Settings::set('blog', 'comment_script', $_POST['comment_script']);
PHPWS_Settings::save('blog');
}
示例15: changeDisplayType
private function changeDisplayType($request)
{
\PHPWS_Settings::set('menu', 'display_type', (int) $request->getVar('display_type'));
\PHPWS_Settings::save('menu');
}