Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: settings.php 2163 2006-08-30 05:53:05Z chris $
| * $Id: settings.php 2932 2007-03-10 05:48:55Z chris $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 60 | Zeile 60 |
---|
$plugins->run_hooks("admin_settings_do_change"); if(is_array($mybb->input['upsetting'])) {
|
$plugins->run_hooks("admin_settings_do_change"); if(is_array($mybb->input['upsetting'])) {
|
| // Check to see if we changing CSS Mediums if(isset($mybb->input['upsetting']['96']) && $mybb->input['upsetting']['96'] == "file") { $query = $db->simple_select(TABLE_PREFIX."settings", "value", "sid='96'"); if($db->fetch_field($query, "value") == "db") { $mybb->settings['cssmedium'] = 'file'; $query = $db->simple_select(TABLE_PREFIX."themes", "tid", "csscached='0'"); while($theme = $db->fetch_array($query)) { update_css_file($theme['tid']); } } }
|
foreach($mybb->input['upsetting'] as $key => $val) { $val = $db->escape_string($val); $key = intval($key); $db->query("UPDATE ".TABLE_PREFIX."settings SET value='$val' WHERE sid='$key'");
|
foreach($mybb->input['upsetting'] as $key => $val) { $val = $db->escape_string($val); $key = intval($key); $db->query("UPDATE ".TABLE_PREFIX."settings SET value='$val' WHERE sid='$key'");
|
} }
| } }
|
rebuildsettings(); // Check if we need to create our fulltext index after changing the search mode if($mybb->settings['searchtype'] == "fulltext") { if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext_boolean(TABLE_PREFIX."posts"))
|
rebuildsettings(); // Check if we need to create our fulltext index after changing the search mode if($mybb->settings['searchtype'] == "fulltext") { if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext_boolean(TABLE_PREFIX."posts"))
|
{
| {
|
$db->create_fulltext_index(TABLE_PREFIX."posts", "message");
|
$db->create_fulltext_index(TABLE_PREFIX."posts", "message");
|
}
| }
|
if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext(TABLE_PREFIX."threads")) { $db->create_fulltext_index(TABLE_PREFIX."threads", "subject");
|
if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext(TABLE_PREFIX."threads")) { $db->create_fulltext_index(TABLE_PREFIX."threads", "subject");
|
} }
| } }
|
cpredirect("settings.php?".SID, $lang->settings_updated); }
| cpredirect("settings.php?".SID, $lang->settings_updated); }
|
Zeile 112 | Zeile 127 |
---|
if($g['name']) { cperror($lang->group_exists);
|
if($g['name']) { cperror($lang->group_exists);
|
}
| }
|
$settinggrouparray = array( "name" => $db->escape_string($mybb->input['name']), "title" => $db->escape_string($mybb->input['title']),
| $settinggrouparray = array( "name" => $db->escape_string($mybb->input['name']), "title" => $db->escape_string($mybb->input['title']),
|
Zeile 230 | Zeile 245 |
---|
if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7") { $settinggrouparray['isdefault'] = $mybb->input['isdefault'];
|
if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7") { $settinggrouparray['isdefault'] = $mybb->input['isdefault'];
|
}
| }
|
$plugins->run_hooks("admin_setings_do_edit_group"); $db->update_query(TABLE_PREFIX."settinggroups", $settinggrouparray, "gid='".intval($mybb->input['gid'])."'"); rebuildsettings();
| $plugins->run_hooks("admin_setings_do_edit_group"); $db->update_query(TABLE_PREFIX."settinggroups", $settinggrouparray, "gid='".intval($mybb->input['gid'])."'"); rebuildsettings();
|
Zeile 251 | Zeile 266 |
---|
makehiddencode("sid", $mybb->input['sid']); starttable(); tableheader($lang->modify_setting);
|
makehiddencode("sid", $mybb->input['sid']); starttable(); tableheader($lang->modify_setting);
|
makeinputcode($lang->setting_title, "title", $setting[title]); maketextareacode($lang->description, "description", $setting[description]); makeinputcode($lang->setting_name, "name", $setting[name]); maketextareacode($lang->setting_type, "type", $setting[optionscode], 6, 50); makeinputcode($lang->value, "value", $setting[value]);
| makeinputcode($lang->setting_title, "title", $setting['title']); maketextareacode($lang->description, "description", $setting['description']); makeinputcode($lang->setting_name, "name", $setting['name']); maketextareacode($lang->setting_type, "type", $setting['optionscode'], 6, 50); makeinputcode($lang->value, "value", $setting['value']);
|
makeinputcode($lang->disp_order, "disporder", $setting['disporder'], 4); makeselectcode($lang->group, "gid", "settinggroups", "gid", "name", $setting['gid']); endtable();
| makeinputcode($lang->disp_order, "disporder", $setting['disporder'], 4); makeselectcode($lang->group, "gid", "settinggroups", "gid", "name", $setting['gid']); endtable();
|
Zeile 429 | Zeile 444 |
---|
else { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups ORDER BY disporder");
|
else { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups ORDER BY disporder");
|
| $groupinfo = "all";
|
} while($group = $db->fetch_array($query)) {
| } while($group = $db->fetch_array($query)) {
|
Zeile 444 | Zeile 460 |
---|
startform("settings.php", "", "do_change");
|
startform("settings.php", "", "do_change");
|
foreach($setting_groups as $groupinfo)
| if(is_array($setting_list[$groupinfo['gid']]) || ($groupinfo == "all" && is_array($setting_list)))
|
{
|
{
|
starttable(); $title_lang = "setting_group_".$groupinfo['name']; if($lang->$title_lang) { $groupinfo['title'] = $lang->$title_lang; } tableheader($groupinfo['title'], "", 2); foreach($setting_list[$groupinfo['gid']] as $setting)
| foreach($setting_groups as $groupinfo)
|
{
|
{
|
$options = ""; $type = explode("\n", $setting['optionscode']); $type[0] = trim($type[0]); if($type[0] == "text" || $type[0] == "") { $setting['value'] = htmlentities($setting['value']); $settingcode = "<input type=\"text\" name=\"upsetting[$setting[sid]]\" value=\"$setting[value]\" size=\"25\" />"; } else if($type[0] == "textarea") { $setting['value'] = htmlspecialchars_uni($setting['value']); $settingcode = "<textarea name=\"upsetting[$setting[sid]]\" rows=\"6\" cols=\"50\">$setting[value]</textarea>"; } else if($type[0] == "yesno") { if($setting['value'] == "yes") { $yeschecked = "checked"; $nochecked = ""; } else { $nochecked = "checked"; $yeschecked = ""; } $settingcode = "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"yes\" $yeschecked /> $lang->yes <input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"no\" $nochecked /> $lang->no"; } else if($type[0] == "onoff") { if($setting['value'] == "on") { $onchecked = "checked"; $offchecked = ""; } else { $offchecked = "checked"; $onchecked = ""; } $settingcode = "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"on\" $onchecked /> $lang->on <input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"off\" $offchecked /> $lang->off"; } elseif($type[0] == "cpstyle") { $dir = @opendir(MYBB_ADMIN_DIR."/styles"); while($folder = readdir($dir)) { if($file != "." && $file != ".." && @file_exists(MYBB_ADMIN_DIR."/styles/$folder/stylesheet.css")) { $folders[$folder] = $folder; } } closedir($dir); ksort($folders); foreach($folders as $key => $val) { if($val == $setting['value']) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$val\" $sel>$val</option>"; } $settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "language") { $languages = $lang->get_languages(); foreach($languages as $lname => $language) { if($setting['value'] == $lname) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$lname\" $sel>$language</option>"; } $settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "adminlanguage") { $languages = $lang->get_languages(1); foreach($languages as $lname => $language) { if($setting['value'] == $lname) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$lname\" $sel>$language</option>";
| starttable(); $title_lang = "setting_group_".$groupinfo['name']; if($lang->$title_lang) { $groupinfo['title'] = $lang->$title_lang; } tableheader($groupinfo['title'], "", 2); foreach($setting_list[$groupinfo['gid']] as $setting) { $options = ""; $type = explode("\n", $setting['optionscode']); $type[0] = trim($type[0]); if($type[0] == "text" || $type[0] == "") { $setting['value'] = htmlspecialchars_uni($setting['value']); $settingcode = "<input type=\"text\" name=\"upsetting[$setting[sid]]\" value=\"$setting[value]\" size=\"25\" />"; } else if($type[0] == "textarea") { $setting['value'] = htmlspecialchars_uni($setting['value']); $settingcode = "<textarea name=\"upsetting[$setting[sid]]\" rows=\"6\" cols=\"50\">$setting[value]</textarea>";
|
}
|
}
|
$settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "php") { $setting['optionscode'] = my_substr($setting['optionscode'], 3); eval("\$settingcode = \"".$setting['optionscode']."\";"); } else { $type_count = count($type); for($i = 0; $i < $type_count; $i++)
| else if($type[0] == "yesno")
|
{
|
{
|
$optionsexp = explode("=", $type[$i]); $lang_string = "setting_".$setting['name']."_".$optionsexp[0]; if($lang->$lang_string) { $lang_string = $lang->$lang_string;
| if($setting['value'] == "yes") { $yeschecked = "checked"; $nochecked = "";
|
} else {
|
} else {
|
$lang_string = $optionsexp[1];
| $nochecked = "checked"; $yeschecked = ""; } $settingcode = "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"yes\" $yeschecked /> $lang->yes <input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"no\" $nochecked /> $lang->no"; } else if($type[0] == "onoff") { if($setting['value'] == "on") { $onchecked = "checked"; $offchecked = "";
|
}
|
}
|
if(!$optionsexp[1]) { continue; } if($type[0] == "select") { if($setting[value] == $optionsexp[0]) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$optionsexp[0]\" $sel>{$lang_string}</option>"; } else if($type[0] == "radio")
| else
|
{
|
{
|
if($setting[value] == $optionsexp[0])
| $offchecked = "checked"; $onchecked = ""; } $settingcode = "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"on\" $onchecked /> $lang->on <input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"off\" $offchecked /> $lang->off"; } elseif($type[0] == "cpstyle") { $dir = @opendir(MYBB_ADMIN_DIR."/styles"); while($folder = readdir($dir)) { if($file != "." && $file != ".." && @file_exists(MYBB_ADMIN_DIR."/styles/$folder/stylesheet.css"))
|
{
|
{
|
$sel = "checked"; } else { $sel = "";
| $folders[$folder] = $folder;
|
}
|
}
|
$options .= "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel /> {$lang_string}<br />"; } else if($type[0] == "checkbox") { if($setting[value] == $optionsexp[0])
| } closedir($dir); ksort($folders); foreach($folders as $key => $val) { if($val == $setting['value']) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$val\" $sel>$val</option>"; } $settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "language") { $languages = $lang->get_languages(); foreach($languages as $lname => $language) { if($setting['value'] == $lname) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$lname\" $sel>$language</option>"; } $settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "adminlanguage") { $languages = $lang->get_languages(1); foreach($languages as $lname => $language) { if($setting['value'] == $lname) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$lname\" $sel>$language</option>"; } $settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "php") { $setting['optionscode'] = my_substr($setting['optionscode'], 3); eval("\$settingcode = \"".$setting['optionscode']."\";"); } else { $type_count = count($type); for($i = 0; $i < $type_count; $i++) { $optionsexp = explode("=", $type[$i]); $lang_string = "setting_".$setting['name']."_".$optionsexp[0]; if($lang->$lang_string)
|
{
|
{
|
$sel = "checked";
| $lang_string = $lang->$lang_string;
|
} else {
|
} else {
|
$sel = "";
| $lang_string = $optionsexp[1]; } if(!$optionsexp[1]) { continue; } if($type[0] == "select") { if($setting[value] == $optionsexp[0]) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$optionsexp[0]\" $sel>{$lang_string}</option>"; } else if($type[0] == "radio") { if($setting[value] == $optionsexp[0]) { $sel = "checked"; } else { $sel = ""; } $options .= "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel /> {$lang_string}<br />"; } else if($type[0] == "checkbox") { if($setting[value] == $optionsexp[0]) { $sel = "checked"; } else { $sel = ""; } $options .= "<input type=\"checkbox\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel /> {$lang_string}<br />";
|
}
|
}
|
$options .= "<input type=\"checkbox\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel /> {$lang_string}<br />";
| } if($type[0] == "select") { $settingcode = "<select name=\"upsetting[$setting[sid]]\">$options</select>"; } else { $settingcode = "$options";
|
} }
|
} }
|
if($type[0] == "select")
| // Check if a custom language string exists for this setting title and description $title_lang = "setting_".$setting['name']; $desc_lang = $title_lang."_desc"; if($lang->$title_lang)
|
{
|
{
|
$settingcode = "<select name=\"upsetting[$setting[sid]]\">$options</select>";
| $setting['title'] = $lang->$title_lang; } if($lang->$desc_lang) { $setting['description'] = $lang->$desc_lang;
|
}
|
}
|
else { $settingcode = "$options"; } } // Check if a custom language string exists for this setting title and description $title_lang = "setting_".$setting['name']; $desc_lang = $title_lang."_desc"; if($lang->$title_lang) { $setting['title'] = $lang->$title_lang; } if($lang->$desc_lang) { $setting['description'] = $lang->$desc_lang;
| tablesubheader("<span title=\"{$setting['name']}\">{$setting['title']}</span>", "", 2, "left"); makelabelcode("<small>{$setting['description']}</small>", $settingcode); $settingcode = "";
|
}
|
}
|
tablesubheader("<span title=\"{$setting['name']}\">{$setting['title']}</span>", "", 2, "left"); makelabelcode("<small>{$setting['description']}</small>", $settingcode); $settingcode = "";
| endtable();
|
}
|
}
|
endtable();
| |
} endform($lang->submit_changes, $lang->reset_button); }
| } endform($lang->submit_changes, $lang->reset_button); }
|
Zeile 683 | Zeile 702 |
---|
if($group['description']) {
|
if($group['description']) {
|
$group['description'] = "<small>\n".$group['description']."\n</small>\n"; }
| $group['description'] = "<small>\n".$group['description']."\n</small>\n"; }
|
$bgcolor = getaltbg(); echo "<tr>\n"; echo "<td class=\"$bgcolor\" width=\"88%\">\n<strong>\n<a href=\"settings.php?".SID."&action=change&gid=".$group['gid']."\">".$group['title']."</a>\n</strong>\n (".$settings_count.")\n<br />\n".$group['description']; if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7" || $group['isdefault'] != "yes") {
|
$bgcolor = getaltbg(); echo "<tr>\n"; echo "<td class=\"$bgcolor\" width=\"88%\">\n<strong>\n<a href=\"settings.php?".SID."&action=change&gid=".$group['gid']."\">".$group['title']."</a>\n</strong>\n (".$settings_count.")\n<br />\n".$group['description']; if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7" || $group['isdefault'] != "yes") {
|
$options['change'] = $lang->modify_settings; $options['edit'] = $lang->edit_setting_group; $options['add'] = $lang->add_setting; $options['delete'] = $lang->delete_setting_group;
| $options = array( 'change' => $lang->modify_settings, 'edit' => $lang->edit_setting_group, 'add' => $lang->add_setting, 'delete' => $lang->delete_setting_group, );
|
} else {
|
} else {
|
$options['change'] = $lang->modify_settings;
| $options = array( 'change' => $lang->modify_settings, );
|
} echo "<td class=\"$bgcolor\" align=\"right\" nowrap=\"nowrap\">\n";
|
} echo "<td class=\"$bgcolor\" align=\"right\" nowrap=\"nowrap\">\n";
|
startform("settings.php"); makehiddencode("gid", $group['gid']); echo makehopper("action", $options); endform(); echo "</td>\n";
| startform("settings.php"); makehiddencode("gid", $group['gid']); echo makehopper("action", $options); endform(); echo "</td>\n";
|
unset($options); echo "</tr>\n"; }
| unset($options); echo "</tr>\n"; }
|