get('timezone')) { $core_pref->set('timezone', 'UTC'); } $frm = e107::getForm(false, true); //enable inner tabindex counter $mes = e107::getMessage(); $tp = e107::getParser(); /* RESET DISPLAY NAMES */ if(isset($_POST['submit_resetdisplaynames'])) { e107::getDb()->db_Update('user', 'user_name=user_loginname'); $mes->addInfo(PRFLAN_157); } //echo '
'; //var_dump($core_pref->getPref()); //echo ''; if (isset($_POST['testemail'])) { sendTest(); } /* UPDATE PREFERENCES */ if(isset($_POST['updateprefs'])) { unset($_POST['updateprefs'], $_POST['sitelanguage']); $_POST['cookie_name'] = str_replace(array(" ", "."), "_", $_POST['cookie_name']); $_POST['cookie_name'] = preg_replace("#[^a-zA-Z0-9_]#", "", $_POST['cookie_name']); $_POST['siteurl'] = trim($_POST['siteurl']) ? trim($_POST['siteurl']) : SITEURL; $_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/"; // If email verification or Email/Password Login Method - email address is required! if (($_POST['user_reg_veri'] == 1 || $_POST['allowEmailLogin'] == 1) && $_POST['disable_emailcheck']) { $_POST['disable_emailcheck'] = 0; $mes->addError(PRFLAN_211); } // Table of range checking values - min and max for numerics. Only do the important ones $pref_limits = array('loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30), 'displayname_maxlength' => array('min' => 5, 'max' => 100, 'default' => 15), 'antiflood_timeout' => array('min' => 3, 'max' => 300, 'default' => 10), 'signup_pass_len' => array('min' => 2, 'max' => 100, 'default' => 4) ); $pref['post_html'] = intval($_POST['post_html']); // This ensures the setting is reflected in set text $smtp_opts = array(); if(!empty($_POST['smtp_options'])) { switch (trim($_POST['smtp_options'])) { case 'smtp_ssl' : $smtp_opts[] = 'secure=SSL'; break; case 'smtp_tls' : $smtp_opts[] = 'secure=TLS'; break; case 'smtp_pop3auth' : $smtp_opts[] = 'pop3auth'; break; } if (!empty($_POST['smtp_keepalive'])) { $smtp_opts[] = 'keepalive'; } if (!empty($_POST['smtp_useVERP'])) { $smtp_opts[] = 'useVERP'; } $_POST['smtp_options'] = implode(',',$smtp_opts); unset($_POST['smtp_keepalive'],$_POST['smtp_useVERP']); // e107::getMessage()->addDebug(print_a($_POST['smtp_options'],true)); } $_POST['membersonly_exceptions'] = explode("\n",$_POST['membersonly_exceptions']); // FIXME - automate - pref model & validation handler $prefChanges = array(); $sessionRegenerate = false; foreach($_POST as $key => $value) { if(isset($pref_limits[$key])) { // Its a numeric value to check if(is_numeric($value)) { if($value < $pref_limits[$key]['min']) { $value = $pref_limits[$key]['min']; $mes->addWarning(str_replace(array('--FIELD--','--VALUE--'),array($key,$value),PRFLAN_213)); } if($value > $pref_limits[$key]['max']) { $value = $pref_limits[$key]['max']; $mes->addWarning(str_replace(array('--FIELD--','--VALUE--'),array($key,$value),PRFLAN_212)); } } else { $value = $pref_limits[$key]['default']; } $newValue = $value; } elseif('cookie_name' == $key && $core_pref->get($key) != $value) { // special case if(!preg_match('/^[\w\-]+$/', $value)) { $newValue = e_COOKIE; $mes->addWarning(PRFLAN_219); } else { $newValue = $value; $sessionRegenerate = true; } } else { $newValue = $tp->toDB($value); } $core_pref->update($key, $newValue); /*if($newValue != $core_pref->get($key)) { // Changed value $core_pref->set($key, $newValue); $prefChanges[$key] = $newValue; }*/ } $core_pref->save(false); // special case, do session cleanup, logout, redirect to login screen if($sessionRegenerate) { // reset cookie cookie($core_pref->get('cookie_name'), $_COOKIE[e_COOKIE], (time() + 3600 * 24 * 30), e_HTTP, e107::getLanguage()->getCookieDomain()); cookie(e_COOKIE, null, null); // regenerate session $s = $_SESSION; e107::getSession()->destroy(); $session = new e_core_session(array('name' => $core_pref->get('cookie_name'))); $_SESSION = $s; } } if (e107::isInstalled('alt_auth')) { $authlist[] = "e107"; $handle = opendir(e_PLUGIN."alt_auth"); while($file = readdir($handle)) { if(preg_match("/^(.*)_auth\.php/", $file, $match)) { $authlist[] = $match[1]; } } } function sendTest() { $log = e107::getAdminLog(); $mes = e107::getMessage(); if(trim($_POST['testaddress']) == '') { $mes->add(LAN_MAILOUT_19, E_MESSAGE_ERROR); $subAction = 'error'; } else { $mailheader_e107id = USERID; $pref = e107::pref('core'); $add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).") " : ' (PHP)'; if($pref['mailer'] == 'smtp') { $add .= "Port: ".varset($pref['smtp_port'],25); $add .= " - ".str_replace("secure=", "", $pref['smtp_options']); } $sendto = trim($_POST['testaddress']); $eml = array(); $eml['email_subject'] = LAN_MAILOUT_113." ".$add; $eml['email_sender_email'] = null; $eml['email_sender_name'] = null; $eml['email_replyto'] = null; $eml['email_replytonames'] = null; $eml['send_html'] = true; $eml['add_html_header'] = null; $eml['email_body'] = str_replace("[br]", "