if($mybb->input['action'] == "options")
{
$plugins->run_hooks("usercp_options_start");
if($errors != '')
{
$user = $mybb->input;
}
else
{
$user = $mybb->user;
}
$languages = $lang->get_languages();
$langoptions = '';
foreach($languages as $lname => $language)
{
$sel = "";
if($user['language'] == $lname)
{
$sel = " selected=\"selected\"";
}
$langoptions .= "<option value=\"$lname\"$sel>$language</option>\n";
}
// Lets work out which options the user has selected and check the boxes
if($user['allownotices'] == "yes")
{
$allownoticescheck = "checked=\"checked\"";
}
else
{
$allownoticescheck = "";
}
if($user['invisible'] == "yes")
{
$invisiblecheck = "checked=\"checked\"";
}
else
{
$invisiblecheck = "";
}
if($user['hideemail'] == "yes")
{
$hideemailcheck = "checked=\"checked\"";
}
else
{
$hideemailcheck = "";
}
if($user['emailnotify'] == "yes")
{
$emailnotifycheck = "checked=\"checked\"";
}
else
{
$emailnotifycheck = "";
}
if($user['showsigs'] == "yes")
{
$showsigscheck = "checked=\"checked\"";;
}
else
{
$showsigscheck = "";
}
if($user['showavatars'] == "yes")
{
$showavatarscheck = "checked=\"checked\"";
}
else
{
$showavatarscheck = "";
}
if($user['showquickreply'] == "yes")
{
$showquickreplycheck = "checked=\"checked\"";
}
else
{
$showquickreplycheck = "";
}
if($user['remember'] == "yes")
{
$remembercheck = "checked=\"checked\"";
}
else
{
$remembercheck = "";
}
if($user['receivepms'] == "yes")
{
$receivepmscheck = "checked=\"checked\"";
}
else
{
$receivepmscheck = "";
}
if($user['pmpopup'] == "yes")
{
$pmpopupcheck = "checked=\"checked\"";
}
else
{
$pmpopupcheck = "";
}
if($user['dst'] == "yes")
{
$dstcheck = "checked=\"checked\"";
--$mybb->user['timezone'];
}
else
{
$dstcheck = "";
}
if($user['showcodebuttons'] == 1)
{
$showcodebuttonscheck = "checked=\"checked\"";
}
else
{
$showcodebuttonscheck = "";
}
if($user['showredirect'] != "no")
{
$showredirectcheck = "checked=\"checked\"";
}
else
{
$showredirectcheck = "";
}
if($user['pmnotify'] != "no")
{
$pmnotifycheck = "checked=\"checked\"";
}
else
{
$pmnotifycheck = "";
}
if($user['threadmode'] != "threaded")
{
$user['threadmode'] = "linear";
}
$dateselect[$user['dateformat']] = "selected";
$timeselect[$user['timeformat']] = "selected";
$user['timezone'] = $user['timezone']*10;
$user['timezone'] = str_replace("-", "n", $user['timezone']);
$timezoneselect[$user['timezone']] = "selected";
// We need to revisit this to see if it can be optomitized and made smaller
// maybe in version 5
$tempzone = $user['timezone'];
$user['timezone'] = "";
$timenow = my_date($mybb->settings['timeformat'], time(), "-");
for($i = -12; $i <= 12; $i++)
{
if($i == 0)
{
$i2 = "-";
}
else
{
$i2 = $i;
}
$temptime = my_date($mybb->settings['timeformat'], time(), $i2);
$zone = $i*10;
$zone = str_replace("-", "n", $zone);
$timein[$zone] = $temptime;
}
// Sad code for all the weird timezones
$timein[n35] = my_date($mybb->settings['timeformat'], time(), -3.5);
$timein[35] = my_date($mybb->settings['timeformat'], time(), 3.5);
$timein[45] = my_date($mybb->settings['timeformat'], time(), 4.5);
$timein[55] = my_date($mybb->settings['timeformat'], time(), 5.5);
$timein[575] = my_date($mybb->settings['timeformat'], time(), 5.75);
$timein[95] = my_date($mybb->settings['timeformat'], time(), 9.5);
$timein[105] = my_date($mybb->settings['timeformat'], time(), 10.5);
$mybb->user['timezone'] = $tempzone;
eval("\$tzselect = \"".$templates->get("usercp_options_timezoneselect")."\";");
$threadview[$user['threadmode']] = 'selected="selected"';
$daysprunesel[$user['daysprune']] = 'selected="selected"';
$stylelist = build_theme_select("style", $user['style']);
if($mybb->settings['usertppoptions'])
{
$explodedtpp = explode(",", $mybb->settings['usertppoptions']);
$tppoptions = '';
if(is_array($explodedtpp))
{
foreach($explodedtpp as $key => $val)
{
$val = trim($val);
$selected = "";
if($user['tpp'] == $val)
{
$selected = "selected=\"selected\"";
}
$tppoptions .= "<option value=\"$val\" $selected>".sprintf($lang->tpp_option, $val)."</option>\n";
}
}
eval("\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");
}
if($mybb->settings['userpppoptions'])
{
$explodedppp = explode(",", $mybb->settings['userpppoptions']);
$pppoptions = '';
if(is_array($explodedppp))
{
foreach($explodedppp as $key => $val)
{
$val = trim($val);
$selected = "";
if($user['ppp'] == $val)
{
$selected = "selected=\"selected\"";
}
$pppoptions .= "<option value=\"$val\" $selected>".sprintf($lang->ppp_option, $val)."</option>\n";
}
}
eval("\$pppselect = \"".$templates->get("usercp_options_pppselect")."\";");
}
eval("\$editprofile = \"".$templates->get("usercp_options")."\";");
$plugins->run_hooks("usercp_options_end");
output_page($editprofile);
}