public function editImapAccount() { $_POST = mswMultiDimensionalArrayMap('mswSafeImportString', $_POST); // Defaults if not set.. $_POST['im_piping'] = isset($_POST['im_piping']) ? 'yes' : 'no'; $_POST['im_flags'] = isset($_POST['im_flags']) ? imap::filterImapFlag($_POST['im_flags']) : ''; $_POST['im_attach'] = isset($_POST['im_attach']) ? 'yes' : 'no'; $_POST['im_ssl'] = isset($_POST['im_ssl']) ? 'yes' : 'no'; $_POST['im_port'] = (int) $_POST['im_port']; $_POST['im_messages'] = (int) $_POST['im_messages']; $_POST['im_move'] = isset($_POST['im_move']) ? $_POST['im_move'] : ''; $_POST['im_spam'] = isset($_POST['im_spam']) ? 'yes' : 'no'; $_POST['im_spam_purge'] = isset($_POST['im_spam_purge']) ? 'yes' : 'no'; $_GET['edit'] = (int) $_GET['edit']; mysql_query("UPDATE `" . DB_PREFIX . "imap` SET\n `im_piping` = '{$_POST['im_piping']}',\n `im_protocol` = 'imap',\n `im_host` = '{$_POST['im_host']}',\n `im_user` = '{$_POST['im_user']}',\n `im_pass` = '{$_POST['im_pass']}',\n `im_port` = '{$_POST['im_port']}',\n `im_name` = '{$_POST['im_name']}',\n `im_flags` = '{$_POST['im_flags']}',\n `im_attach` = '{$_POST['im_attach']}',\n `im_move` = '{$_POST['im_move']}',\n `im_messages` = '{$_POST['im_messages']}',\n `im_ssl` = '{$_POST['im_ssl']}',\n `im_priority` = '{$_POST['im_priority']}',\n `im_dept` = '{$_POST['im_dept']}',\n `im_email` = '{$_POST['im_email']}',\n `im_spam` = '{$_POST['im_spam']}',\n `im_spam_purge` = '{$_POST['im_spam_purge']}',\n `im_score` = '{$_POST['im_score']}'\n WHERE `id` = '{$_GET['edit']}'\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); }
public function updateSettings() { $_POST = mswMultiDimensionalArrayMap('mswSafeImportString', $_POST); // Defaults if not set.. $_POST['attachment'] = isset($_POST['attachment']) ? 'yes' : 'no'; $_POST['rename'] = isset($_POST['rename']) ? 'yes' : 'no'; $_POST['weekStart'] = isset($_POST['weekStart']) && in_array($_POST['weekStart'], array('sun', 'mon')) ? $_POST['weekStart'] : 'sun'; $_POST['enSpamSum'] = isset($_POST['enSpamSum']) && in_array($_POST['enSpamSum'], array('yes', 'no')) ? $_POST['enSpamSum'] : 'yes'; $_POST['enableBBCode'] = isset($_POST['enableBBCode']) ? 'yes' : 'no'; $_POST['disputes'] = isset($_POST['disputes']) ? 'yes' : 'no'; $_POST['multiplevotes'] = isset($_POST['multiplevotes']) ? 'yes' : 'no'; $_POST['enableVotes'] = isset($_POST['enableVotes']) ? 'yes' : 'no'; $_POST['enCapLogin'] = isset($_POST['enCapLogin']) ? 'yes' : 'no'; $_POST['sysstatus'] = isset($_POST['sysstatus']) ? 'yes' : 'no'; $_POST['autoenable'] = $_POST['autoenable'] ? $this->datetime->mswDatePickerFormat($_POST['autoenable']) : '0000-00-00'; $_POST['kbase'] = isset($_POST['kbase']) ? 'yes' : 'no'; $_POST['scriptpath'] = systemSettings::filterInstallationPath($_POST['scriptpath']); $_POST['attachpath'] = systemSettings::filterInstallationPath($_POST['attachpath']); $_POST['attachhref'] = systemSettings::filterInstallationPath($_POST['attachhref']); $_POST['attachpathfaq'] = systemSettings::filterInstallationPath($_POST['attachpathfaq']); $_POST['attachhreffaq'] = systemSettings::filterInstallationPath($_POST['attachhreffaq']); $_POST['imap_param'] = $_POST['imap_param'] ? $_POST['imap_param'] : 'pipe'; $_POST['renamefaq'] = isset($_POST['renamefaq']) ? 'yes' : 'no'; $_POST['smtp_debug'] = isset($_POST['smtp_debug']) ? 'yes' : 'no'; $_POST['createPref'] = isset($_POST['createPref']) ? 'yes' : 'no'; $_POST['createAcc'] = isset($_POST['createAcc']) ? 'yes' : 'no'; $_POST['ticketHistory'] = isset($_POST['ticketHistory']) ? 'yes' : 'no'; $_POST['closenotify'] = isset($_POST['closenotify']) ? 'yes' : 'no'; $_POST['accProfNotify'] = isset($_POST['accProfNotify']) ? 'yes' : 'no'; $_POST['newAccNotify'] = isset($_POST['newAccNotify']) ? 'yes' : 'no'; $_POST['enableLog'] = isset($_POST['enableLog']) ? 'yes' : 'no'; $_POST['enableMail'] = isset($_POST['enableMail']) ? 'yes' : 'no'; $_POST['imap_debug'] = isset($_POST['imap_debug']) ? 'yes' : 'no'; $_POST['apiLog'] = isset($_POST['apiLog']) ? 'yes' : 'no'; $_POST['disputeAdminStop'] = isset($_POST['disputeAdminStop']) ? 'yes' : 'no'; // Enforce digits.. $_POST['maxsize'] = (int) $_POST['maxsize'] > 0 ? $_POST['maxsize'] : '0'; $_POST['popquestions'] = (int) $_POST['popquestions'] > 0 ? $_POST['popquestions'] : '10'; $_POST['quePerPage'] = (int) $_POST['quePerPage'] > 0 ? $_POST['quePerPage'] : '10'; $_POST['cookiedays'] = (int) $_POST['cookiedays'] > 0 ? $_POST['cookiedays'] : '60'; $_POST['attachboxes'] = (int) $_POST['attachboxes'] > 0 ? $_POST['attachboxes'] : '1'; $_POST['autoClose'] = (int) $_POST['autoClose'] > 0 ? $_POST['autoClose'] : '0'; $_POST['smtp_port'] = (int) $_POST['smtp_port'] > 0 ? $_POST['smtp_port'] : '25'; $_POST['loginLimit'] = (int) $_POST['loginLimit'] > 0 ? $_POST['loginLimit'] : '0'; $_POST['banTime'] = (int) $_POST['banTime'] > 0 ? $_POST['banTime'] : '25'; $_POST['minPassValue'] = (int) $_POST['minPassValue'] > 0 ? $_POST['minPassValue'] : '8'; $_POST['minTickDigits'] = (int) $_POST['minTickDigits'] > 0 ? $_POST['minTickDigits'] : '5'; $_POST['imap_timeout'] = (int) $_POST['imap_timeout'] > 0 ? $_POST['imap_timeout'] : '0'; $_POST['imap_memory'] = (int) $_POST['imap_memory'] > 0 ? $_POST['imap_memory'] : '0'; // Restrictions.. if (LICENCE_VER == 'locked') { $_POST['attachboxes'] = RESTR_ATTACH; $_POST['adminFooter'] = 'To add your own footer code, click "Settings & Tools > Other Options > Edit Footers"'; $_POST['publicFooter'] = 'To add your own footer code, click "Settings & Tools > Other Options > Edit Footers"'; } // Serialized data.. $langSets = !empty($_POST['templateSet']) ? serialize($_POST['templateSet']) : ''; if ($_POST['defKeepLogs']['user'] == '') { $_POST['defKeepLogs']['user'] = '******'; } if ($_POST['defKeepLogs']['acc'] == '') { $_POST['defKeepLogs']['acc'] = '0'; } $defLog = !empty($_POST['defKeepLogs']) ? serialize($_POST['defKeepLogs']) : ''; $handlers = !empty($_POST['apiHandlers']) ? implode(',', $_POST['apiHandlers']) : ''; mysql_query("UPDATE `" . DB_PREFIX . "settings` SET\n `website` = '{$_POST['website']}',\n `email` = '{$_POST['email']}',\n `replyto` = '{$_POST['replyto']}',\n `scriptpath` = '{$_POST['scriptpath']}',\n `attachpath` = '{$_POST['attachpath']}',\n `attachhref` = '{$_POST['attachhref']}',\n `attachpathfaq` = '{$_POST['attachpathfaq']}',\n `attachhreffaq` = '{$_POST['attachhreffaq']}',\n `language` = '{$_POST['language']}',\n `langSets` = '" . mswSafeImportString($langSets) . "',\n `dateformat` = '{$_POST['dateformat']}',\n `timeformat` = '{$_POST['timeformat']}',\n `timezone` = '{$_POST['timezone']}',\n `weekStart` = '{$_POST['weekStart']}',\n `jsDateFormat` = '{$_POST['jsDateFormat']}',\n `kbase` = '{$_POST['kbase']}',\n `enableVotes` = '{$_POST['enableVotes']}',\n `multiplevotes` = '{$_POST['multiplevotes']}',\n `popquestions` = '{$_POST['popquestions']}',\n `quePerPage` = '{$_POST['quePerPage']}',\n `cookiedays` = '{$_POST['cookiedays']}',\n `renamefaq` = '{$_POST['renamefaq']}',\n `attachment` = '{$_POST['attachment']}',\n `rename` = '{$_POST['rename']}',\n `attachboxes` = '{$_POST['attachboxes']}',\n `filetypes` = '{$_POST['filetypes']}',\n `maxsize` = '{$_POST['maxsize']}',\n `enableBBCode` = '{$_POST['enableBBCode']}',\n `afolder` = '{$_POST['afolder']}',\n `autoClose` = '{$_POST['autoClose']}',\n `smtp_host` = '{$_POST['smtp_host']}',\n `smtp_user` = '{$_POST['smtp_user']}',\n `smtp_pass` = '{$_POST['smtp_pass']}',\n `smtp_port` = '{$_POST['smtp_port']}',\n `smtp_security` = '{$_POST['smtp_security']}',\n `smtp_debug` = '{$_POST['smtp_debug']}',\n `adminFooter` = '{$_POST['adminFooter']}',\n `publicFooter` = '{$_POST['publicFooter']}',\n `apiKey` = '{$_POST['apiKey']}',\n `apiLog` = '{$_POST['apiLog']}',\n `apiHandlers` = '{$handlers}',\n `recaptchaPrivateKey` = '{$_POST['recaptchaPrivateKey']}',\n `recaptchaPublicKey` = '{$_POST['recaptchaPublicKey']}',\n `enCapLogin` = '{$_POST['enCapLogin']}',\n `sysstatus` = '{$_POST['sysstatus']}',\n `autoenable` = '{$_POST['autoenable']}',\n `disputes` = '{$_POST['disputes']}',\n `offlineReason` = '{$_POST['offlineReason']}',\n `createPref` = '{$_POST['createPref']}',\n `createAcc` = '{$_POST['createAcc']}',\n `loginLimit` = '{$_POST['loginLimit']}',\n `banTime` = '{$_POST['banTime']}',\n `ticketHistory` = '{$_POST['ticketHistory']}',\n `closenotify` = '{$_POST['closenotify']}',\n `accProfNotify` = '{$_POST['accProfNotify']}',\n `minPassValue` = '{$_POST['minPassValue']}',\n `newAccNotify` = '{$_POST['newAccNotify']}',\n `recaptchaLang` = '{$_POST['recaptchaLang']}',\n `recaptchaTheme` = '{$_POST['recaptchaTheme']}',\n `enableLog` = '{$_POST['enableLog']}',\n `defKeepLogs` = '" . mswSafeImportString($defLog) . "',\n `minTickDigits` = '{$_POST['minTickDigits']}',\n `enableMail` = '{$_POST['enableMail']}',\n `imap_debug` = '{$_POST['imap_debug']}',\n `imap_param` = '{$_POST['imap_param']}',\n `imap_memory` = '{$_POST['imap_memory']}',\n `imap_timeout` = '{$_POST['imap_timeout']}',\n `disputeAdminStop` = '{$_POST['disputeAdminStop']}'\n WHERE `id` = '1'\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); }
function mswMultiDimensionalArrayMap($func, $arr) { $newArr = array(); if (!empty($arr)) { foreach ($arr as $key => $value) { $newArr[$key] = is_array($value) ? mswMultiDimensionalArrayMap($func, $value) : $func($value); } } return $newArr; }