/** * 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; }
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'); }
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(); } }
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(); }
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'); }
public function set($settingName, $value) { $this->settings[$settingName] = $value; \PHPWS_Settings::set('addthis', $settingName, $value); \PHPWS_Settings::save('addthis'); }
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; } }
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(); } }
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(); } }
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; } }
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; }
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'); }
public function set($settingName, $value) { $this->settings[$settingName] = $value; PHPWS_Settings::set('likebox', $settingName, $value); PHPWS_Settings::save('likebox'); }
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'); }
private function changeDisplayType($request) { \PHPWS_Settings::set('menu', 'display_type', (int) $request->getVar('display_type')); \PHPWS_Settings::save('menu'); }
/** * Allows users with sufficient privileges to change the settings associated * with the faxmaster module. */ private function changeSettings() { // Check user's permissions if (!Current_User::allow('faxmaster', 'settings')) { PHPWS_Core::initModClass('faxmaster', 'exception/PermissionException.php'); throw new PermissionException('Permission denied'); } $content = array(); $form = new PHPWS_Form('faxmaster_settings'); // If $_REQUEST data has been given, set the paths if (isset($_REQUEST['fax_path']) && !is_null($_REQUEST['fax_path']) && isset($_REQUEST['archive_path']) && !is_null($_REQUEST['archive_path'])) { clearstatcache(true); // is_readable and is_writable cache results, so you need to clear the cache $faxRead = is_readable($_REQUEST['fax_path']); $faxWrite = is_writable($_REQUEST['fax_path']); $archiveRead = is_readable($_REQUEST['archive_path']); $archiveWrite = is_writable($_REQUEST['archive_path']); if (!$faxRead || !$faxWrite || !$archiveRead || !$archiveWrite) { // Show warnings for invalid paths PHPWS_Core::initModClass('faxmaster', 'FaxmasterNotificationView.php'); if (!$faxRead) { NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not readable or does not exist."); } if (!$faxWrite) { NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not writable or does not exist."); } if (!$archiveRead) { NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not readable or does not exist."); } if (!$archiveWrite) { NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not writable or does not exist."); } $nv = new FaxmasterNotificationView(); $nv->popNotifications(); Layout::add($nv->show()); // Show supplied paths $form->setAction('index.php?module=faxmaster&op=settings'); $form->addTplTag('FAX_PATH', $_REQUEST['fax_path']); $form->addTplTag('ARCHIVE_PATH', $_REQUEST['archive_path']); $form->addSubmit('Try Again'); $tpl = $form->getTemplate(); Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl')); } else { // new paths were valid, so update settings PHPWS_Settings::set('faxmaster', 'fax_path', $_REQUEST['fax_path']); PHPWS_Settings::set('faxmaster', 'archive_path', $_REQUEST['archive_path']); PHPWS_Settings::save('faxmaster'); // Show new paths $form->setAction('index.php?module=faxmaster&op=go_home'); $form->addTplTag('SAVED', 'New Settings Saved!'); $form->addTplTag('FAX_PATH', PHPWS_Settings::get('faxmaster', 'fax_path')); $form->addTplTag('ARCHIVE_PATH', PHPWS_Settings::get('faxmaster', 'archive_path')); $form->addSubmit('Return to Fax List'); $tpl = $form->getTemplate(); Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl')); } } else { // Show initial form to change paths $form->setAction('index.php?module=faxmaster&op=settings'); $form->addTplTag('WARNING', '<strong>WARNING: </strong> Changing paths does not move files. Files must be moved manually.<br /><br \\>'); $form->addText('fax_path', PHPWS_Settings::get('faxmaster', 'fax_path')); $form->setSize('fax_path', 45); $form->addText('archive_path', PHPWS_Settings::get('faxmaster', 'archive_path')); $form->setSize('archive_path', 45); $form->addSubmit('Save Settings'); $tpl = $form->getTemplate(); Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl')); } $this->addNavLinks(); }
/** * Deletes a schedule from the database */ public function delete() { if (empty($this->id)) { return false; } $db = $this->getDB(); $db->addWhere('id', $this->id); $result = $db->delete(); if (!PHPWS_Error::isError($result)) { $db2 = new PHPWS_DB('phpws_key'); $db2->addWhere('module', 'calendar'); $db2->addWhere('item_name', 'event' . $this->id); PHPWS_Error::logIfError($db2->delete()); return PHPWS_DB::dropTable($this->getEventTable()); } else { if (PHPWS_Settings::get('calendar', 'public_schedule') == $this->id) { PHPWS_Settings::set('calendar', 'public_schedule', 0); PHPWS_Settings::save('calendar'); } return $result; } }
public static function postDenyAllow() { if (!Current_User::authorized('access', 'admin_options')) { Current_User::disallow(); exit; } PHPWS_Core::initModClass('access', 'Allow_Deny.php'); if (!empty($_POST['allow_deny_enabled'])) { PHPWS_Settings::set('access', 'allow_deny_enabled', 1); } else { PHPWS_Settings::set('access', 'allow_deny_enabled', 0); } PHPWS_Settings::save('access'); if (isset($_POST['add_allow_address']) && !empty($_POST['allow_address'])) { $allow = new Access_Allow_Deny(); $allow->allow_or_deny = 1; $result = $allow->setIpAddress($_POST['allow_address']); if (!$result) { return $result; } $allow->active = 1; return $allow->save(); } if (isset($_POST['add_deny_address']) && !empty($_POST['deny_address'])) { $deny = new Access_Allow_Deny(); $deny->allow_or_deny = 0; $result = $deny->setIpAddress($_POST['deny_address']); if (!$result) { return $result; } $deny->active = 1; return $deny->save(); } if (isset($_POST['allow_action']) && $_POST['allow_action'] != 'none') { if ($_POST['allow_action'] == 'allow_all') { if (PHPWS_Settings::get('access', 'allow_all')) { PHPWS_Settings::set('access', 'allow_all', 0); } else { PHPWS_Settings::set('access', 'allow_all', 1); } PHPWS_Settings::save('access'); return true; } elseif (!empty($_POST['allows'])) { $db = new PHPWS_DB('access_allow_deny'); // just in case something goes wrong $db->addWhere('allow_or_deny', 1); $db->addWhere('id', $_POST['allows']); switch ($_POST['allow_action']) { case 'active': $db->addValue('active', 1); return $db->update(); break; case 'deactive': $db->addValue('active', 0); return $db->update(); break; case 'delete': return $db->delete(); break; } } } if ($_POST['deny_action'] == 'deny_all') { if (PHPWS_Settings::get('access', 'deny_all')) { PHPWS_Settings::set('access', 'deny_all', 0); } else { PHPWS_Settings::set('access', 'deny_all', 1); } PHPWS_Settings::save('access'); return true; } elseif (!empty($_POST['denys'])) { $db = new PHPWS_DB('access_allow_deny'); // just in case something goes wrong $db->addWhere('allow_or_deny', 0); $db->addWhere('id', $_POST['denys']); switch ($_POST['deny_action']) { case 'active': $db->addValue('active', 1); return $db->update(); break; case 'deactive': $db->addValue('active', 0); return $db->update(); break; case 'delete': return $db->delete(); break; } } return true; }
public static function setCurrentTerm($term) { PHPWS_Settings::set('hms', 'current_term', $term); PHPWS_Settings::save('hms'); PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php'); $username = Current_User::getUsername(); HMS_Activity_Log::log_activity($username, ACTIVITY_CHANGE_ACTIVE_TERM, $username, "Active term set by {$username} to {$term}"); }
public static function saveSettings() { if (isset($_POST['show_alternates'])) { PHPWS_Settings::set('search', 'show_alternates', 1); } else { PHPWS_Settings::set('search', 'show_alternates', 0); } PHPWS_Settings::save('search'); }
public function postAllowedFiles() { if (empty($_POST['allowed_images'])) { PHPWS_Settings::set('filecabinet', 'image_files', ''); } else { PHPWS_Settings::set('filecabinet', 'image_files', implode(',', $_POST['allowed_images'])); } if (empty($_POST['allowed_media'])) { PHPWS_Settings::set('filecabinet', 'media_files', ''); } else { PHPWS_Settings::set('filecabinet', 'media_files', implode(',', $_POST['allowed_media'])); } if (empty($_POST['allowed_documents'])) { PHPWS_Settings::set('filecabinet', 'document_files', ''); } else { PHPWS_Settings::set('filecabinet', 'document_files', implode(',', $_POST['allowed_documents'])); } PHPWS_Settings::save('filecabinet'); }
/** * Loads the settings into the session * */ public static function load($module) { $default = PHPWS_Settings::loadConfig($module); if (!$default) { $GLOBALS['PHPWS_Settings'][$module] = 1; return PHPWS_Error::get(SETTINGS_MISSING_FILE, 'core', 'PHPWS_Settings::load', $module); } include $default; PHPWS_Settings::set($module, $settings); $db = new PHPWS_DB('mod_settings'); $db->addWhere('module', $module); $result = $db->select(); if (PHPWS_Error::isError($result)) { return $result; } elseif (empty($result)) { PHPWS_Settings::save($module); } else { foreach ($result as $key => $value) { switch ($value['setting_type']) { case 1: $setval = $value['small_num']; break; case 2: $setval = $value['large_num']; break; case 3: $setval = $value['small_char']; break; case 4: $setval = $value['large_char']; break; } PHPWS_Settings::set($module, $value['setting_name'], $setval); } } return true; }
function postSettings() { isset($_POST['enable']) ? PHPWS_Settings::set('whatsnew', 'enable', 1) : PHPWS_Settings::set('whatsnew', 'enable', 0); isset($_POST['homeonly']) ? PHPWS_Settings::set('whatsnew', 'homeonly', 1) : PHPWS_Settings::set('whatsnew', 'homeonly', 0); if (!empty($_POST['title'])) { PHPWS_Settings::set('whatsnew', 'title', strip_tags(PHPWS_Text::parseInput($_POST['title']))); } else { PHPWS_Settings::reset('whatsnew', 'title'); } if (!empty($_POST['text'])) { PHPWS_Settings::set('whatsnew', 'text', PHPWS_Text::parseInput($_POST['text'])); } else { PHPWS_Settings::set('whatsnew', 'text', null); } $cache_timeout = (int) $_POST['cache_timeout']; if ((int) $cache_timeout <= 7200) { PHPWS_Settings::set('whatsnew', 'cache_timeout', $cache_timeout); } else { PHPWS_Settings::reset('whatsnew', 'cache_timeout'); } $qty_items = (int) $_POST['qty_items']; if ((int) $qty_items <= 50) { PHPWS_Settings::set('whatsnew', 'qty_items', $qty_items); } else { PHPWS_Settings::reset('whatsnew', 'qty_items'); } isset($_POST['show_summaries']) ? PHPWS_Settings::set('whatsnew', 'show_summaries', 1) : PHPWS_Settings::set('whatsnew', 'show_summaries', 0); isset($_POST['show_dates']) ? PHPWS_Settings::set('whatsnew', 'show_dates', 1) : PHPWS_Settings::set('whatsnew', 'show_dates', 0); isset($_POST['show_source_modules']) ? PHPWS_Settings::set('whatsnew', 'show_source_modules', 1) : PHPWS_Settings::set('whatsnew', 'show_source_modules', 0); if (isset($_POST['exclude'])) { PHPWS_Settings::set('whatsnew', 'exclude', $_POST['exclude']); } if (isset($errors)) { $this->message = implode('<br />', $errors); return false; } else { PHPWS_Cache::remove('whatsnew_cache_key'); if (PHPWS_Settings::save('whatsnew')) { return true; } else { return false; } } }
function createLocalAuthScript() { /* if (PHPWS_Settings::get('users', 'local_script')) { return true; } * */ $db = new PHPWS_DB('users_auth_scripts'); $db->addValue('display_name', dgettext('users', 'Local')); $db->addValue('filename', 'local.php'); $authorize_id = $db->insert(); if (PHPWS_Error::logIfError($authorize_id)) { return false; } PHPWS_Settings::set('users', 'default_authorization', $authorize_id); PHPWS_Settings::set('users', 'local_script', $authorize_id); PHPWS_Settings::save('users'); return true; }
/** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ function users_update(&$content, $currentVersion) { $home_dir = PHPWS_Boost::getHomeDir(); switch ($currentVersion) { case version_compare($currentVersion, '2.2.0', '<'): $content[] = 'This package does not update versions under 2.2.0'; return false; case version_compare($currentVersion, '2.2.1', '<'): $content[] = '+ Fixed a bug causing conflicts between user and group permissions.'; case version_compare($currentVersion, '2.2.2', '<'): $content[] = '+ Set username to the same character size in both users table and user_authorization.'; $content[] = '+ Fixed typo causing branch installation failure on Postgresql.'; case version_compare($currentVersion, '2.3.0', '<'): $content[] = '<pre> 2.3.0 changes ------------------------ + Added translate function calls in classes and my_page.php + my_page hides translation option if language defines disable selection + Added a unrestricted only parameter to Current_User\'s allow and authorize functions + Dropped references from some constructors + Added error check to setPermissions function: won\'t accept empty group id + Changed id default to zero. + Removed unneeded function parameter on getGroups </pre> '; case version_compare($currentVersion, '2.3.1', '<'): $content[] = '<pre>'; $files = array('templates/my_page/user_setting.tpl'); userUpdateFiles($files, $content); $content[] = ' 2.3.1 changes ------------------------ + Added ability for user to set editor preferences </pre> '; case version_compare($currentVersion, '2.3.2', '<'): $content[] = '<pre>2.3.2 changes'; $files = array('img/users.png', 'templates/user_main.tpl'); userUpdateFiles($files, $content); $content[] = '+ Added error check to login. + Changed user control panel icon. + Fixed template typo that broke IE login. + Removed fake French translation (delete mod/users/locale/fr_FR/ directory + Permissions are now ordered alphabetically. + isUser will now always return false if passed a zero id. + Added new function requireLogin that forwards a user to the login screen </pre>'; case version_compare($currentVersion, '2.4.0', '<'): if (!PHPWS_DB::isTable('users_pw_reset')) { $new_table = 'CREATE TABLE users_pw_reset ( user_id INT NOT NULL default 0, authhash CHAR( 32 ) NOT NULL default 0, timeout INT NOT NULL default 0, );'; if (!PHPWS_DB::import($new_table)) { $content[] = 'Unable to create users_pw_reset table.'; return false; } else { $content[] = 'Created new table: users_pw_reset'; } } $files = array('templates/forms/reset_password.tpl', 'templates/forms/forgot.tpl', 'conf/config.php', 'templates/usermenus/top.tpl', 'templates/forms/settings.tpl', 'templates/my_page/user_setting.tpl'); $content[] = '<pre>'; userUpdatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.1', '<'): $content[] = '<pre>'; $files = array('conf/languages.php'); userUpdateFiles($files, $content); $content[] = ' 2.4.1 changes ------------------------ + Default item id on permission check functions is now zero instead of null. This will make checking permissions a little easier on new items. + Bug #1690657 - Changed group select js property to onclick instead of onchange. Thanks singletrack. + Changed the language abbreviation for Danish </pre> '; case version_compare($currentVersion, '2.4.2', '<'): $content[] = '<pre>'; $files = array('templates/usermenus/Default.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_2.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.3', '<'): $content[] = '<pre>'; if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_3.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.4', '<'): $content[] = '<pre>'; $source_dir = PHPWS_SOURCE_DIR . 'mod/users/javascript/'; $dest_dir = $home_dir . 'javascript/modules/users/'; if (PHPWS_File::copy_directory($source_dir, $dest_dir, true)) { $content[] = "--- Successfully copied {$source_dir} to {$dest_dir}"; } else { $content[] = "--- Could not copy {$source_dir} to {$dest_dir}"; } $files = array('conf/error.php', 'templates/forms/permissions.tpl', 'templates/forms/permission_pop.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_4.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.5', '<'): $content[] = '<pre>'; $files = array('conf/error.php', 'conf/languages.php', 'templates/forms/settings.tpl', 'templates/manager/groups.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_5.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.6', '<'): $content[] = '<pre>'; $files = array('templates/forms/forgot.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = ' 2.4.6 changes ------------------- + Added error check to permission menu. + Error for missing user groups now reports user id. + Forgot password will work if CAPTCHA is disabled. + Using new savePermissions function instead of save. + Current_User was calling giveItemPermissions incorrectly.'; } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.7', '<'): $content[] = '<pre> 2.4.7 changes ------------------- + Removed global authorization from change password check since it is not written yet. </pre>'; case version_compare($currentVersion, '2.4.9', '<'): $content[] = '<pre>'; if (PHPWS_Core::isBranch() || PHPWS_Boost::inBranch()) { $user_db = new PHPWS_DB('users'); $user_db->addWhere('deity', 1); $user_db->addColumn('id'); $user_db->addColumn('username'); $user_db->setIndexBy('id'); $user_ids = $user_db->select('col'); if (!empty($user_ids) && !PHPWS_Error::logIfError($user_ids)) { $group_db = new PHPWS_DB('users_groups'); foreach ($user_ids as $id => $username) { $group_db->addWhere('user_id', $id); $result = $group_db->select('row'); if (!$result) { $group_db->reset(); $group_db->addValue('active', 1); $group_db->addValue('name', $username); $group_db->addValue('user_id', $id); if (!PHPWS_Error::logIfError($group_db->insert())) { $content[] = '--- Created missing group for user: '******'2.4.9 changes ----------------- + Raised sql character limit in default username, display_name, and group name installs. + Fixed bug with forbidden usernames + Added a function to group to remove its permissions upon deletion. + Bookmark won\'t return a user to a authkey page if their session dies. + Fixed bug #1850815 : unknown function itemIsAllowed in Permission.php + My Pages are unregistered on module removal. + My Page tab stays fixed. </pre>'; case version_compare($currentVersion, '2.5.0', '<'): $content[] = '<pre>'; $files = array('templates/forms/memberlist.tpl', 'templates/forms/userForm.tpl', 'javascript/generate/head.js', 'templates/manager/groups.tpl', 'templates/manager/users.tpl'); userUpdateFiles($files, $content); $content[] = '2.5.0 changes ------------------- + Members\' names alphabetized + New user email notification added. + Fixed member listing dropping names past 10. + Added random password generator on user edit form. + Removed reference from Action.php causing php notice. + Changed redundant static method call in Permission. + Added dash to allowed display name characters. + Added \\pL to display name characters. + Users will now query modules should a user get deleted. + Added an error check to Permissions. + Users will now look for remove_user.php in all modules\' inc/ directory in order to run the remove_user function. + Using pager\'s addSortHeaders in user and group listing + Added display name to pager search. </pre>'; case version_compare($currentVersion, '2.6.0', '<'): $content[] = '<pre>'; Users_Permission::registerPermissions('users', $content); $db = new PHPWS_DB('users_auth_scripts'); $db->addWhere('filename', 'local.php'); $db->addColumn('id'); $auth_id = $db->select('one'); PHPWS_Settings::set('users', 'local_script', $auth_id); PHPWS_Settings::save('users'); $files = array('conf/languages.php', 'templates/my_page/user_setting.tpl', 'templates/usermenus/css.tpl', 'img/permission.png', 'templates/forms/userForm.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_6_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.6.1', '<'): $content[] = '<pre>2.6.1 changes ------------------ + requireLogin now reroutes dependant on the user authorization + If the user\'s group is missing when they are updated, a new one is properly created. Prior to the fix, a new group was created without an assigned user id. + Added error message to my page if update goes bad. </pre>'; case version_compare($currentVersion, '2.6.2', '<'): $content[] = '<pre>'; $files = array('templates/forms/settings.tpl'); userUpdateFiles($files, $content); $content[] = '2.6.2 changes ------------------ + Moved error file to inc/ + Blank passwords forbidden. + Error check added to cosign authorization. + php fiveasized the classes. + Added some needed error logging to user creation problems + Added ability for default user groups to be set for admin created and newly joined users. + Fixed testing on addMembers. Previous code was nonsensical. + _user_group id gets set upon a user object save. </pre>'; case version_compare($currentVersion, '2.6.3', '<'): $content[] = '<pre>'; $files = array('img/deity.gif', 'img/delete.png', 'img/edit.png', 'img/man.gif', 'img/key.png', 'img/members.png', 'templates/forms/authorization.tpl', 'templates/forms/settings.tpl', 'templates/manager/users.tpl'); userUpdateFiles($files, $content); $db = new PHPWS_DB('users_auth_scripts'); PHPWS_Error::logIfError($db->addTableColumn('default_group', 'int not null default 0')); $content[] = '2.6.3 changes ------------------ + Added icons for admin options under manage users and groups + Disabled active link in groups listing + Authorization scripts now have default group assignments. New members will assigned to a group based on their authorization method. + Removed default group by user or admin from settings. + Added ability to view users by whether or not they are in a particular group. + Added pager caching to group listing + Display name may now not be the same as another user\'s username + Extended user name error to include display name + Added empty password check to ldap script </pre>'; case version_compare($currentVersion, '2.6.4', '<'): $db = new PHPWS_DB('users_auth_scripts'); PHPWS_Error::logIfError($db->addTableColumn('default_group', 'int not null default 0')); $content[] = '<pre>2.6.4 changes ------------------------- + Added missing column to install.sql</pre>'; case version_compare($currentVersion, '2.6.5', '<'): $content[] = '<pre>'; userUpdateFiles(array('conf/languages.php'), $content); $content[] = '2.6.5 changes ------------------------- + Added missing column to install.sql</pre>'; case version_compare($currentVersion, '2.6.6', '<'): $content[] = '<pre>'; userUpdateFiles(array('templates/forms/userForm.tpl'), $content); $content[] = '2.6.6 changes ----------------------- + Graceful recovery from broken authentication scripts. + Authorization script made deity only + Fixed default groups on external authentication + Deleted auth scripts will update users under it to use local instead. + The user constructor was trying to load the authorization script on failed users. Thanks Verdon.</pre>'; case version_compare($currentVersion, '2.7.0', '<'): $content[] = '<pre>2.7.0 changes ------------------------- + Usernames and passwords can not be changed on non local users + Added switch to settings to prevent admins from making new users + Site admin can be set by non-deities again + Fixed bug with users able to change password on alternate auth. + Fixed some bugs with user creation and editing with alternate authentication. + Hiding permissions and members in create group form + Icon class implemented. + Strict PHP 5 changes made. </pre>'; case version_compare($currentVersion, '2.7.1', '<'): $content[] = '<pre>2.7.1 changes ------------------------- + Improved cosign script + Fixed errors getting dropped without logging. </pre>'; case version_compare($currentVersion, '2.7.2', '<'): $content[] = '<pre>2.7.2 changes ------------------------- + Fixed multiple group member bug. + Cleaned up cosign authentication. + Current_User requireLogin to use login_link instead of login_url + New User form now properly respects the "settings" permission for showing user authentication script option. + User constuction allow username parameter. + Trim whitespace from user email addresses. Don\'t modify the member variable unless all the sanity checks passed. </pre>'; case version_compare($currentVersion, '2.7.3', '<'): PHPWS_Core::initModClass('users', 'Action.php'); User_Action::checkPermissionTables(); $content[] = '<pre>2.7.3 changes ------------------------ + Update permissions </pre>'; case version_compare($currentVersion, '2.7.4', '<'): $content[] = '<pre>2.7.4 changes ------------------------ + Fixed 500 error on My Page </pre>'; case version_compare($currentVersion, '2.7.5', '<'): $content[] = '<pre>2.7.5 changes ------------------------ + Loosened group name restrictions + User edit page shows group membership </pre>'; case version_compare($currentVersion, '2.7.6', '<'): $content[] = '<pre>2.7.6 changes ------------------------ + Updated icons to Font Awesome + Email addresses may now be used as user names. + Static method call fixed. + Added exception error for missing authorization file. + My Page no longer is using tabs as other modules use of My Page have been removed. + css.tpl template rewritten. Login now works closer with authentication script. - drop down no longer contains Home or Control Panel. Account link added - takes user to their account page to change their password. </pre>'; case version_compare($currentVersion, '2.8.0', '<'): $content[] = <<<EOF <pre>2.8.0 changes ----------------- + Added suggested bootstrap classes from TRF + Removed call to nonexistent method. + Moved icons to left and set admin-icons class to column. + Added FA icon here for mini admin + Changed to ensure users_auth_scripts table was created properly + Session timeouts are now tracked. Warning to user given before failure. </pre> EOF; case version_compare($currentVersion, '2.8.1', '<'): \PHPWS_Settings::set('users', 'session_warning', 0); \PHPWS_Settings::save('users'); $content[] = <<<EOF <pre>2.8.1 changes ----------------- + Changing default on user session to false. If you want it enabled, do so in settings. </pre> EOF; case version_compare($currentVersion, '2.8.2', '<'): $content[] = <<<EOF <pre>2.8.2 changes ----------------- + Bug Fix: Unstyled permission pop up. </pre> EOF; } // End of switch statement return TRUE; }
public function loadDefaultSchedule() { $sch_id = PHPWS_Settings::get('calendar', 'public_schedule'); if ($sch_id > 0) { $this->schedule = new Calendar_Schedule((int) $sch_id); } elseif ($sch_id == -1) { $this->schedule = new Calendar_Schedule(); } else { $db = new PHPWS_DB('calendar_schedule'); $db->addColumn('id'); $db->addWhere('public', 1); $db->setLimit(1); $id = $db->select('one'); if (PHPWS_Error::isError($id)) { PHPWS_Error::log($id); return; } if (empty($id)) { $id = -1; } PHPWS_Settings::set('calendar', 'public_schedule', $id); PHPWS_Settings::save('calendar'); } }
public function postSettings() { PHPWS_Settings::set('pagesmith', 'auto_link', isset($_POST['auto_link'])); PHPWS_Settings::set('pagesmith', 'create_shortcuts', isset($_POST['create_shortcuts'])); PHPWS_Settings::set('pagesmith', 'back_to_top', isset($_POST['back_to_top'])); PHPWS_Settings::save('pagesmith'); PHPWS_Cache::clearCache(); }
public static function main() { $tpl['MESSAGE'] = NULL; $message = RSS_Admin::getMessage(); PHPWS_Core::initModClass('rss', 'Feed.php'); PHPWS_Core::initModClass('rss', 'Channel.php'); if (!Current_User::allow('rss')) { Current_User::disallow(); } $panel = RSS_Admin::adminPanel(); if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; } elseif (isset($_REQUEST['tab'])) { $command = $_REQUEST['tab']; } else { $command = $panel->getCurrentTab(); } if (isset($_REQUEST['channel_id'])) { $channel = new RSS_Channel($_REQUEST['channel_id']); } else { $channel = new RSS_Channel(); } if (isset($_REQUEST['feed_id'])) { $feed = new RSS_Feed($_REQUEST['feed_id']); } else { $feed = new RSS_Feed(); } switch ($command) { case 'channels': $tpl = RSS_Admin::channels(); break; case 'settings': $tpl = RSS_Admin::settings(); break; case 'save_settings': $result = RSS_Admin::save_settings(); if (!$result) { PHPWS_Settings::save('rss'); $result = dgettext('rss', 'Settings saved successfully.'); } $tpl = RSS_Admin::settings(); $tpl['MESSAGE'] =& $result; break; case 'feedInfo': $feed = new RSS_Feed(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT)); echo json_encode($feed); exit; break; case 'save_feed': $result = $feed->post(); if (is_array($result)) { $tpl['CONTENT'] = RSS_Admin::editFeed($feed, true); $tpl['MESSAGE'] = implode('<br />', $result); } else { $result = $feed->save(); PHPWS_Core::reroute('index.php?module=rss&tab=import'); } break; case 'edit_channel': $tpl = RSS_Admin::editChannel($channel); break; case 'post_channel': $result = $channel->post(); if (is_array($result)) { $message = implode('<br />', $result); $tpl = RSS_Admin::editChannel($channel); } else { $result = $channel->save(); if (PHPWS_Error::isError($result)) { RSS_Admin::sendMessage(dgettext('rss', 'An error occurred when saving your channel.'), 'channels'); } else { RSS_Admin::sendMessage(dgettext('rss', 'Channel saved.'), 'channels'); } } break; case 'reset_feed': $feed->reset(); case 'import': $tpl = RSS_Admin::import(); break; case 'turn_on_display': $feed->display = 1; $feed->save(); $tpl = RSS_Admin::import(); break; case 'turn_off_display': $feed->display = 0; $feed->save(); $tpl = RSS_Admin::import(); break; case 'add_feed': $tpl = RSS_Admin::editFeed($feed); Layout::nakedDisplay(PHPWS_Template::process($tpl, 'rss', 'main.tpl')); exit; break; case 'edit_feed': $tpl = RSS_Admin::editFeed($feed); Layout::nakedDisplay(PHPWS_Template::process($tpl, 'rss', 'main.tpl')); exit; break; case 'delete_feed': $feed->delete(); $tpl = RSS_Admin::import(); break; default: PHPWS_Core::errorPage('404'); break; } if (!empty($message)) { $tpl['MESSAGE'] = $message; } $content = PHPWS_Template::process($tpl, 'rss', 'main.tpl'); $panel->setContent($content); $content = $panel->display(); Layout::add(PHPWS_ControlPanel::display($content)); }
/** * Save new settings * * @author Greg Meiste <*****@*****.**> */ function save() { PHPWS_Settings::set('wiki', 'show_on_home', (int) isset($_POST['show_on_home'])); PHPWS_Settings::set('wiki', 'allow_anon_view', (int) isset($_POST['allow_anon_view'])); PHPWS_Settings::set('wiki', 'allow_page_edit', (int) isset($_POST['allow_page_edit'])); PHPWS_Settings::set('wiki', 'allow_image_upload', (int) isset($_POST['allow_image_upload'])); PHPWS_Settings::set('wiki', 'allow_bbcode', (int) isset($_POST['allow_bbcode'])); PHPWS_Settings::set('wiki', 'ext_chars_support', (int) isset($_POST['ext_chars_support'])); PHPWS_Settings::set('wiki', 'add_to_title', (int) isset($_POST['add_to_title'])); PHPWS_Settings::set('wiki', 'format_title', (int) isset($_POST['format_title'])); PHPWS_Settings::set('wiki', 'show_modified_info', (int) isset($_POST['show_modified_info'])); PHPWS_Settings::set('wiki', 'monitor_edits', (int) isset($_POST['monitor_edits'])); if (isset($_POST['diff_type'])) { PHPWS_Settings::set('wiki', 'diff_type', 'one_col'); } else { PHPWS_Settings::set('wiki', 'diff_type', 'two_col'); } PHPWS_Core::initCoreClass('Mail.php'); if (isset($_POST['admin_email']) && PHPWS_Mail::checkAddress($_POST['admin_email'])) { PHPWS_Settings::set('wiki', 'admin_email', PHPWS_Text::parseInput($_POST['admin_email'])); } if (isset($_POST['email_text'])) { PHPWS_Settings::set('wiki', 'email_text', PHPWS_Text::parseInput($_POST['email_text'])); } if (isset($_POST['default_page']) && strlen($_POST['default_page']) > 0) { PHPWS_Settings::set('wiki', 'default_page', PHPWS_Text::parseInput($_POST['default_page'])); } if (isset($_POST['ext_page_target'])) { PHPWS_Settings::set('wiki', 'ext_page_target', PHPWS_Text::parseInput($_POST['ext_page_target'])); } PHPWS_Settings::set('wiki', 'immutable_page', (int) isset($_POST['immutable_page'])); PHPWS_Settings::set('wiki', 'raw_text', (int) isset($_POST['raw_text'])); PHPWS_Settings::set('wiki', 'print_view', (int) isset($_POST['print_view'])); PHPWS_Settings::set('wiki', 'what_links_here', (int) isset($_POST['what_links_here'])); PHPWS_Settings::set('wiki', 'recent_changes', (int) isset($_POST['recent_changes'])); PHPWS_Settings::set('wiki', 'random_page', (int) isset($_POST['random_page'])); PHPWS_Settings::set('wiki', 'discussion', (int) isset($_POST['discussion'])); if (isset($_POST['discussion_anon'])) { PHPWS_Settings::set('wiki', 'discussion', 1); PHPWS_Settings::set('wiki', 'discussion_anon', 1); } else { PHPWS_Settings::set('wiki', 'discussion_anon', 0); } if (PHPWS_Error::logIfError(PHPWS_Settings::save('wiki'))) { return dgettext('wiki', 'There was an error saving the settings.'); } return dgettext('wiki', 'Your settings have been successfully saved.'); }