Vergleich admin/settings.php - 1.2.7 - 1.2.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: settings.php 2932 2007-03-10 05:48:55Z chris $

 * $Id: settings.php 3355 2007-09-30 22:42:26Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 74Zeile 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 89Zeile 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 102Zeile 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 122Zeile 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")
{
$settinggrouparray['isdefault'] = $mybb->input['isdefault'];
}










$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");
$db->insert_query(TABLE_PREFIX."settinggroups", $settinggrouparray);
rebuildsettings();

		$plugins->run_hooks("admin_settings_do_add_group");
$db->insert_query(TABLE_PREFIX."settinggroups", $settinggrouparray);
rebuildsettings();

Zeile 183Zeile 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 254Zeile 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'])."'");
$setting = $db->fetch_array($query);

{
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";
startform("settings.php", "", "do_edit");

		$plugins->run_hooks("admin_settings_edit_seting");
$type[$setting['type']] = "selected";
startform("settings.php", "", "do_edit");

Zeile 354Zeile 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 442Zeile 473
			$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups WHERE gid='".intval($mybb->input['gid'])."'");
}
else

			$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups WHERE gid='".intval($mybb->input['gid'])."'");
}
else

		{

		{

			$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups ORDER BY disporder");
$groupinfo = "all";
}

			$query = $db->query("SELECT * FROM ".TABLE_PREFIX."settinggroups ORDER BY disporder");
$groupinfo = "all";
}

Zeile 472Zeile 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 = "";



















































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

						}

						}

						$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))

						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)
{
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++)

						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")
{
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

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

									$lang_string = $lang->$lang_string;

								}

								}

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

								else
{
$lang_string = $optionsexp[1];
}
if(!$optionsexp[1])

								{

								{

									$sel = "checked";

























									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

								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 />&nbsp;{$lang_string}<br />";

								}

								}

								$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
{
$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 677Zeile 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)