Vergleich admin/settings.php - 1.2.0 - 1.2.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 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 3355 2007-09-30 22:42:26Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 60Zeile 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']);
}
}
}
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);
$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")

	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");
}
if(!$db->is_fulltext(TABLE_PREFIX."posts") && $db->supports_fulltext(TABLE_PREFIX."threads"))

		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");
}
}

			$db->create_fulltext_index(TABLE_PREFIX."threads", "subject");
}
}

Zeile 87Zeile 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 107Zeile 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'])

		$g = $db->fetch_array($query);
if($g['name'])

		{

		{

			cperror($lang->group_exists);

			cperror($lang->group_exists);

 
		}

$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']),

		}
$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'])


			"disporder" => $disporder,
'isdefault' => 'no'

		);
if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7")
{

		);
if(md5($debugmode) == "0100e895f975e14f4193538dac4d0dc7")
{

Zeile 153Zeile 198
	else
{
header("Location: settings.php?".SID);

	else
{
header("Location: settings.php?".SID);

	}
}

	}
}

if($mybb->input['action'] == "export")
{
$gidwhere = "";

if($mybb->input['action'] == "export")
{
$gidwhere = "";

Zeile 168Zeile 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 251Zeile 296
		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 339Zeile 384
	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 429Zeile 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 444Zeile 491
	
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)

			foreach($setting_groups as $groupinfo)



			{

			{

				$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'] = 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>";
}
$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

				starttable();
$title_lang = "setting_group_".$groupinfo['name'];
if($lang->$title_lang)
{
$groupinfo['title'] = $lang->$title_lang;
}
tableheader($groupinfo['title'], "", 2);

if(is_array($setting_list[$groupinfo['gid']]))
{
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>";
}
else if($type[0] == "yesno")
{
if($setting['value'] == "yes")
{
$yeschecked = "checked";
$nochecked = "";
}
else










































































































							{

							{

								$sel = "";


								$nochecked = "checked";
$yeschecked = "";

							}

							}

							$options .= "<option value=\"$optionsexp[0]\" $sel>{$lang_string}</option>";

							$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] == "radio")

						else if($type[0] == "onoff")

						{

						{

							if($setting[value] == $optionsexp[0])

							if($setting['value'] == "on")

							{

							{

								$sel = "checked";


								$onchecked = "checked";
$offchecked = "";

							}
else
{

							}
else
{

								$sel = "";


								$offchecked = "checked";
$onchecked = "";

							}

							}

							$options .= "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel />&nbsp;{$lang_string}<br />";

							$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";

						}

						}

						else if($type[0] == "checkbox")


































































						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>";
}
$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

						{

						{

							if($setting[value] == $optionsexp[0])


							$type_count = count($type);
for($i = 0; $i < $type_count; $i++)

							{

							{

								$sel = "checked";






















































								$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
{
$sel = "";
}
$options .= "<input type=\"radio\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel />&nbsp;{$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 />&nbsp;{$lang_string}<br />";
}
}
if($type[0] == "select")
{
$settingcode = "<select name=\"upsetting[$setting[sid]]\">$options</select>";

							}
else
{

							}
else
{

								$sel = "";

								$settingcode = "$options";

							}

							}

							$options .= "<input type=\"checkbox\" name=\"upsetting[$setting[sid]]\" value=\"$optionsexp[0]\" $sel />&nbsp;{$lang_string}<br />";

 
						}

						}

 
						// 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 = "";

					}

					}

					if($type[0] == "select")
{
$settingcode = "<select name=\"upsetting[$setting[sid]]\">$options</select>";
}
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 = "";

				endtable();



			}

			}

			endtable();

 
		}
endform($lang->submit_changes, $lang->reset_button);
}

		}
endform($lang->submit_changes, $lang->reset_button);
}

Zeile 658Zeile 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 683Zeile 736
			
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."&amp;action=change&amp;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."&amp;action=change&amp;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";
}