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 2228 2006-09-17 19:49:10Z Tikitiki $
| * $Id: settings.php 3355 2007-09-30 22:42:26Z Tikitiki $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 74 | Zeile 74 |
---|
} } }
|
} } }
|
| else if(isset($mybb->input['upsetting']['96']) && $mybb->input['upsetting']['96'] == "db") { $query = $db->simple_select(TABLE_PREFIX."settings", "value", "sid='96'"); if($db->fetch_field($query, "value") == "file") { $query = $db->simple_select(TABLE_PREFIX."themes", "tid", "csscached!='0'"); while($theme = $db->fetch_array($query)) { @unlink(MYBB_ROOT.'css/theme_'.intval($theme['tid']).'.css'); } $db->update_query(TABLE_PREFIX."themes", array('csscached' => 0), "csscached != '0'"); } }
|
foreach($mybb->input['upsetting'] as $key => $val) { $val = $db->escape_string($val);
| foreach($mybb->input['upsetting'] as $key => $val) { $val = $db->escape_string($val);
|
Zeile 89 | Zeile 103 |
---|
if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext_boolean(TABLE_PREFIX."posts")) { $db->create_fulltext_index(TABLE_PREFIX."posts", "message");
|
if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext_boolean(TABLE_PREFIX."posts")) { $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");
|
Zeile 102 | Zeile 116 |
---|
{ if($mybb->input['add'] == "setting") {
|
{ if($mybb->input['add'] == "setting") {
|
| if(empty($mybb->input['name']) || empty($mybb->input['title'])) { cperror($lang->setting_add_error); }
|
if($mybb->input['type'] == "custom") { $mybb->input['type'] = $db->escape_string($mybb->input['code']);
| if($mybb->input['type'] == "custom") { $mybb->input['type'] = $db->escape_string($mybb->input['code']);
|
Zeile 122 | Zeile 140 |
---|
} else if($mybb->input['add'] == "group") {
|
} else if($mybb->input['add'] == "group") {
|
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups WHERE name='".$db->escape_string($mybb->input['name'])."'");
| if(empty($mybb->input['name']) || empty($mybb->input['title'])) { cperror($lang->group_add_error); } $query = $db->query("SELECT name FROM ".TABLE_PREFIX."settinggroups WHERE name='".$db->escape_string($mybb->input['name'])."'");
|
$g = $db->fetch_array($query); if($g['name']) { cperror($lang->group_exists);
|
$g = $db->fetch_array($query); if($g['name']) { cperror($lang->group_exists);
|
} $settinggrouparray = array( "name" => $db->escape_string($mybb->input['name']), "title" => $db->escape_string($mybb->input['title']), "description" => $db->escape_string($mybb->input['description']), "disporder" => intval($mybb->input['disporder']) ); if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7") {
| }
$disporder = intval($mybb->input['disporder']); if($disporder == 0) { $query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups ORDER BY `gid` DESC LIMIT 0,1"); $disporder = intval($db->fetch_field($query, 'gid')+1); } $settinggrouparray = array( "name" => $db->escape_string($mybb->input['name']), "title" => $db->escape_string($mybb->input['title']), "description" => $db->escape_string($mybb->input['description']), "disporder" => $disporder, 'isdefault' => 'no' ); if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7") {
|
$settinggrouparray['isdefault'] = $mybb->input['isdefault']; } $plugins->run_hooks("admin_settings_do_add_group");
| $settinggrouparray['isdefault'] = $mybb->input['isdefault']; } $plugins->run_hooks("admin_settings_do_add_group");
|
Zeile 183 | Zeile 213 |
---|
$settinglist[$setting['gid']][] = $setting; } $plugins->run_hooks("admin_settings_export");
|
$settinglist[$setting['gid']][] = $setting; } $plugins->run_hooks("admin_settings_export");
|
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?".">\n";
| $xml = "<?xml version=\"1.0\" encoding=\"{$lang->settings['charset']}\"?".">\n";
|
$xml = "<settings version=\"".$mybb->version_code."\" exported=\"".time()."\">\n"; $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups $gidwhere ORDER BY name ASC"); while($settinggroup = $db->fetch_array($query))
| $xml = "<settings version=\"".$mybb->version_code."\" exported=\"".time()."\">\n"; $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups $gidwhere ORDER BY name ASC"); while($settinggroup = $db->fetch_array($query))
|
Zeile 254 | Zeile 284 |
---|
}
if($mybb->input['action'] == "edit")
|
}
if($mybb->input['action'] == "edit")
|
{ cpheader(); if($mybb->input['sid']) { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settings WHERE sid='".intval($mybb->input['sid'])."'");
| { cpheader(); if($mybb->input['sid']) { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settings WHERE sid='".intval($mybb->input['sid'])."'");
|
$setting = $db->fetch_array($query); $plugins->run_hooks("admin_settings_edit_seting"); $type[$setting['type']] = "selected";
| $setting = $db->fetch_array($query); $plugins->run_hooks("admin_settings_edit_seting"); $type[$setting['type']] = "selected";
|
Zeile 319 | Zeile 349 |
---|
endform(); } else if($mybb->input['gid'])
|
endform(); } else if($mybb->input['gid'])
|
{
| {
|
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups WHERE gid='".intval($mybb->input['gid'])."'"); $group = $db->fetch_array($query); $plugins->run_hooks("admin_settings_delete_group");
| $query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups WHERE gid='".intval($mybb->input['gid'])."'"); $group = $db->fetch_array($query); $plugins->run_hooks("admin_settings_delete_group");
|
Zeile 332 | Zeile 362 |
---|
makelabelcode("<div align=\"center\">$lang->delete_group_confirm<br /><br />$yes$no</div>", ""); endtable(); endform();
|
makelabelcode("<div align=\"center\">$lang->delete_group_confirm<br /><br />$yes$no</div>", ""); endtable(); endform();
|
} cpfooter(); }
| } cpfooter(); }
|
if($mybb->input['action'] == "add") { cpheader();
| if($mybb->input['action'] == "add") { cpheader();
|
Zeile 350 | Zeile 380 |
---|
startform("settings.php", "", "do_add"); makehiddencode("add", "group");
|
startform("settings.php", "", "do_add"); makehiddencode("add", "group");
|
starttable();
| starttable();
|
tableheader($lang->add_group); makeinputcode($lang->group_name, "name"); makeinputcode($lang->group_title, "title");
|
tableheader($lang->add_group); makeinputcode($lang->group_name, "name"); makeinputcode($lang->group_title, "title");
|
| maketextareacode($lang->group_description, "description");
|
makeinputcode($lang->disp_order, "disporder", "", 4); endtable(); endform($lang->add_group, $lang->reset_button);
| makeinputcode($lang->disp_order, "disporder", "", 4); endtable(); endform($lang->add_group, $lang->reset_button);
|
Zeile 380 | Zeile 411 |
---|
foreach($mybb->input['disporder'] as $sid => $order) { $db->query("UPDATE ".TABLE_PREFIX."settings SET disporder='".intval($order)."' WHERE sid='".intval($sid)."'");
|
foreach($mybb->input['disporder'] as $sid => $order) { $db->query("UPDATE ".TABLE_PREFIX."settings SET disporder='".intval($order)."' WHERE sid='".intval($sid)."'");
|
}
| }
|
foreach($mybb->input['dispordercats'] as $gid => $order) { $db->query("UPDATE ".TABLE_PREFIX."settinggroups SET disporder='".intval($order)."' WHERE gid='".intval($gid)."'");
| foreach($mybb->input['dispordercats'] as $gid => $order) { $db->query("UPDATE ".TABLE_PREFIX."settinggroups SET disporder='".intval($order)."' WHERE gid='".intval($gid)."'");
|
Zeile 444 | Zeile 475 |
---|
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 459 | Zeile 491 |
---|
startform("settings.php", "", "do_change");
|
startform("settings.php", "", "do_change");
|
if(is_array($setting_list[$groupinfo['gid']]))
| if(is_array($setting_list[$groupinfo['gid']]) || ($groupinfo == "all" && is_array($setting_list)))
|
{ foreach($setting_groups as $groupinfo) {
| { foreach($setting_groups as $groupinfo) {
|
Zeile 471 | Zeile 503 |
---|
} tableheader($groupinfo['title'], "", 2);
|
} tableheader($groupinfo['title'], "", 2);
|
foreach($setting_list[$groupinfo['gid']] as $setting)
| if(is_array($setting_list[$groupinfo['gid']]))
|
{
|
{
|
$options = ""; $type = explode("\n", $setting['optionscode']); $type[0] = trim($type[0]); if($type[0] == "text" || $type[0] == "")
| foreach($setting_list[$groupinfo['gid']] as $setting)
|
{
|
{
|
$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>"; } 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))
| $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>"; } 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")
|
{
|
{
|
if($file != "." && $file != ".." && @file_exists(MYBB_ADMIN_DIR."/styles/$folder/stylesheet.css"))
| $languages = $lang->get_languages(1); foreach($languages as $lname => $language)
|
{
|
{
|
$folders[$folder] = $folder;
| 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>";
|
}
|
}
|
closedir($dir); ksort($folders); foreach($folders as $key => $val)
| elseif($type[0] == "php")
|
{
|
{
|
if($val == $setting['value']) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$val\" $sel>$val</option>";
| $setting['optionscode'] = my_substr($setting['optionscode'], 3); eval("\$settingcode = \"".$setting['optionscode']."\";");
|
}
|
}
|
$settingcode = "<select name=\"upsetting[$setting[sid]]\" size=\"4\">$options</select>"; } elseif($type[0] == "language") { $languages = $lang->get_languages(); foreach($languages as $lname => $language)
| else
|
{
|
{
|
if($setting['value'] == $lname)
| $type_count = count($type); for($i = 0; $i < $type_count; $i++)
|
{
|
{
|
$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) { $lang_string = $lang->$lang_string; } else { $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
| $optionsexp = explode("=", $type[$i]); $lang_string = "setting_".$setting['name']."_".$optionsexp[0]; if($lang->$lang_string) { $lang_string = $lang->$lang_string; } else { $lang_string = $optionsexp[1]; } if(!$optionsexp[1]) { continue; } if($type[0] == "select")
|
{
|
{
|
$sel = "";
| if($setting[value] == $optionsexp[0]) { $sel = "selected"; } else { $sel = ""; } $options .= "<option value=\"$optionsexp[0]\" $sel>{$lang_string}</option>";
|
}
|
}
|
$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])
| else if($type[0] == "radio")
|
{
|
{
|
$sel = "checked";
| 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
| else if($type[0] == "checkbox")
|
{
|
{
|
$sel = "";
| 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>"; } else { $settingcode = "$options";
| $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 = "";
|
}
|
}
|
// 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 = "";
| |
} endtable(); }
| } endtable(); }
|
Zeile 676 | Zeile 711 |
---|
echo "<td class=\"subheader\">$lang->sections</td>\n"; echo "<td class=\"subheader\" align=\"center\">$lang->options</td>\n"; echo "</tr>\n";
|
echo "<td class=\"subheader\">$lang->sections</td>\n"; echo "<td class=\"subheader\" align=\"center\">$lang->options</td>\n"; echo "</tr>\n";
|
$query = $db->query("SELECT g.*, COUNT(s.sid) AS settingcount FROM ".TABLE_PREFIX."settinggroups g LEFT JOIN ".TABLE_PREFIX."settings s ON (s.gid=g.gid) WHERE g.disporder>0 GROUP BY s.gid ORDER BY g.disporder");
| $query = $db->query("SELECT g.*, COUNT(s.sid) AS settingcount FROM ".TABLE_PREFIX."settinggroups g LEFT JOIN ".TABLE_PREFIX."settings s ON (s.gid=g.gid) WHERE g.disporder>0 AND s.sid>0 GROUP BY s.gid ORDER BY g.disporder");
|
while($group = $db->fetch_array($query)) { if($group['settingcount'] != 1)
| while($group = $db->fetch_array($query)) { if($group['settingcount'] != 1)
|
Zeile 709 | Zeile 744 |
---|
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") {
|
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"; startform("settings.php");
| } echo "<td class=\"$bgcolor\" align=\"right\" nowrap=\"nowrap\">\n"; startform("settings.php");
|