Bläddra i källkod

Merge pull request #45 from emanuele45/master

here it comes!
Spuds 13 år sedan
förälder
incheckning
1bbe12a0a0

+ 92 - 30
Sources/ManageLanguages.php

@@ -77,42 +77,104 @@ function AddLanguage()
 
 		$context['smf_search_term'] = htmlspecialchars(trim($_POST['smf_add']));
 
-		// We're going to use this URL.
-		$url = 'http://download.simplemachines.org/fetch_language.php?version=' . urlencode(strtr($forum_version, array('SMF ' => '')));
+		$listOptions = array(
+			'id' => 'smf_languages',
+			'get_items' => array(
+				'function' => 'list_getLanguagesList',
+			),
+			'columns' => array(
+				'name' => array(
+					'header' => array(
+						'value' => $txt['name'],
+					),
+					'data' => array(
+						'db' => 'name',
+					),
+				),
+				'description' => array(
+					'header' => array(
+						'value' => $txt['add_language_smf_desc'],
+					),
+					'data' => array(
+						'db' => 'description',
+					),
+				),
+				'version' => array(
+					'header' => array(
+						'value' => $txt['add_language_smf_version'],
+					),
+					'data' => array(
+						'db' => 'version',
+					),
+				),
+				'utf8' => array(
+					'header' => array(
+						'value' => $txt['add_language_smf_utf8'],
+					),
+					'data' => array(
+						'db' => 'utf8',
+						'style' => 'text-align: center',
+					),
+				),
+				'install_link' => array(
+					'header' => array(
+						'value' => $txt['add_language_smf_install'],
+					),
+					'data' => array(
+						'db' => 'install_link',
+					),
+				),
+			),
+		);
 
-		// Load the class file and stick it into an array.
-		require_once($sourcedir . '/Class-Package.php');
-		$language_list = new xmlArray(fetch_web_data($url), true);
+		require_once($sourcedir . '/Subs-List.php');
+		createList($listOptions);
 
-		// Check it exists.
-		if (!$language_list->exists('languages/language'))
-			$context['smf_error'] = 'no_response';
-		else
+		$context['default_list'] = 'smf_languages';
+	}
+
+	$context['sub_template'] = 'add_language';
+}
+
+function list_getLanguagesList()
+{
+	global $forum_version, $context, $sourcedir, $smcFunc, $txt, $scripturl;
+
+	// We're going to use this URL.
+	$url = 'http://download.simplemachines.org/fetch_language.php?version=' . urlencode(strtr($forum_version, array('SMF ' => '')));
+
+	// Load the class file and stick it into an array.
+	require_once($sourcedir . '/Class-Package.php');
+	$language_list = new xmlArray(fetch_web_data($url), true);
+
+	// Check it exists.
+	if (!$language_list->exists('languages/language'))
+		$context['smf_error'] = 'no_response';
+	else
+	{
+		$language_list = $language_list->path('languages[0]');
+		$lang_files = $language_list->set('language');
+		$smf_languages = array();
+		foreach ($lang_files as $file)
 		{
-			$language_list = $language_list->path('languages[0]');
-			$lang_files = $language_list->set('language');
-			$context['smf_languages'] = array();
-			foreach ($lang_files as $file)
-			{
-				// Were we searching?
-				if (!empty($context['smf_search_term']) && strpos($file->fetch('name'), $smcFunc['strtolower']($context['smf_search_term'])) === false)
-					continue;
+			// Were we searching?
+			if (!empty($context['smf_search_term']) && strpos($file->fetch('name'), $smcFunc['strtolower']($context['smf_search_term'])) === false)
+				continue;
 
-				$context['smf_languages'][] = array(
-					'id' => $file->fetch('id'),
-					'name' => $smcFunc['ucwords']($file->fetch('name')),
-					'version' => $file->fetch('version'),
-					'utf8' => $file->fetch('utf8'),
-					'description' => $file->fetch('description'),
-					'link' => $scripturl . '?action=admin;area=languages;sa=downloadlang;did=' . $file->fetch('id') . ';' . $context['session_var'] . '=' . $context['session_id'],
-				);
-			}
-			if (empty($context['smf_languages']))
-				$context['smf_error'] = 'no_files';
+			$smf_languages[] = array(
+				'id' => $file->fetch('id'),
+				'name' => $smcFunc['ucwords']($file->fetch('name')),
+				'version' => $file->fetch('version'),
+				'utf8' => $file->fetch('utf8') ? $txt['yes'] : $txt['no'],
+				'description' => $file->fetch('description'),
+				'install_link' => '<a href="' . $scripturl . '?action=admin;area=languages;sa=downloadlang;did=' . $file->fetch('id') . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['add_language_smf_install'] . '</a>',
+			);
 		}
+		if (empty($smf_languages))
+			$context['smf_error'] = 'no_files';
+		else
+			return $smf_languages;
 	}
-
-	$context['sub_template'] = 'add_language';
 }
 
 /**

+ 15 - 11
Sources/News.php

@@ -33,7 +33,7 @@ if (!defined('SMF'))
  */
 function ShowXmlFeed()
 {
-	global $board, $board_info, $context, $scripturl, $txt, $modSettings, $user_info;
+	global $board, $board_info, $context, $scripturl, $boardurl, $txt, $modSettings, $user_info;
 	global $query_this_board, $smcFunc, $forum_version, $cdata_override;
 
 	// If it's not enabled, die.
@@ -278,13 +278,20 @@ function ShowXmlFeed()
 	}
 	elseif ($xml_format == 'atom')
 	{
+		foreach (array('board', 'boards', 'c') as $var)
+			if (isset($_REQUEST[$var]))
+				$url_parts[] = $var . '=' . (is_array($_REQUEST[$var]) ? implode(',', $_REQUEST[$var]) : $_REQUEST[$var]);
+
 		echo '
 <feed xmlns="http://www.w3.org/2005/Atom">
 	<title>', $feed_title, '</title>
 	<link rel="alternate" type="text/html" href="', $scripturl, '" />
+	<link rel="self" type="application/rss+xml" href="', $scripturl, '?type=atom;action=.xml', !empty($url_parts) ? ';' . implode(';', $url_parts) : '', '" />
+	<id>', $scripturl, '</id>
+	<icon>', $boardurl, '/favicon.ico</icon>
 
-	<modified>', gmstrftime('%Y-%m-%dT%H:%M:%SZ'), '</modified>
-	<tagline><![CDATA[', strip_tags($txt['xml_rss_desc']), ']]></tagline>
+	<updated>', gmstrftime('%Y-%m-%dT%H:%M:%SZ'), '</updated>
+	<subtitle><![CDATA[', strip_tags($txt['xml_rss_desc']), ']]></subtitle>
 	<generator uri="http://www.simplemachines.org" version="', strtr($forum_version, array('SMF' => '')), '">SMF</generator>
 	<author>
 		<name>', strip_tags($context['forum_name']), '</name>
@@ -459,6 +466,8 @@ function dumpTags($data, $i, $tag = null, $xml_format = '')
 		// If it's empty/0/nothing simply output an empty tag.
 		if ($val == '')
 			echo '<', $key, ' />';
+		elseif ($xml_format == 'atom' && $key == 'category')
+			echo '<', $key, ' term="', $val, '" />';
 		else
 		{
 			// Beginning tag.
@@ -635,7 +644,7 @@ function getXmlNews($xml_format)
 				'title' => cdata_parse($row['subject']),
 				'link' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
 				'description' => cdata_parse($row['body']),
-				'author' => in_array(showEmailAddress(!empty($row['hide_email']), $row['id_member']), array('yes', 'yes_permission_override')) ? $row['poster_email'] : null,
+				'author' => in_array(showEmailAddress(!empty($row['hide_email']), $row['id_member']), array('yes', 'yes_permission_override')) ? $row['posterEmail'] . ' ('.$row['posterName'].')' : null,
 				'comments' => $scripturl . '?action=post;topic=' . $row['id_topic'] . '.0',
 				'category' => '<![CDATA[' . $row['bname'] . ']]>',
 				'pubDate' => gmdate('D, d M Y H:i:s \G\M\T', $row['poster_time']),
@@ -652,7 +661,7 @@ function getXmlNews($xml_format)
 				'title' => cdata_parse($row['subject']),
 				'link' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
 				'summary' => cdata_parse($row['body']),
-				'category' => array('term' => $row['id_board'], 'label' => cdata_parse($row['bname'])),
+				'category' => $row['bname'],
 				'author' => array(
 					'name' => $row['poster_name'],
 					'email' => in_array(showEmailAddress(!empty($row['hide_email']), $row['id_member']), array('yes', 'yes_permission_override')) ? $row['poster_email'] : null,
@@ -661,7 +670,6 @@ function getXmlNews($xml_format)
 				'published' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $row['poster_time']),
 				'modified' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', empty($row['modified_time']) ? $row['poster_time'] : $row['modified_time']),
 				'id' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
-				'icon' => $settings['images_url'] . '/icons/' . $row['icon'] . '.png',
 			);
 		// The biggest difference here is more information.
 		else
@@ -805,10 +813,7 @@ function getXmlRecent($xml_format)
 				'title' => $row['subject'],
 				'link' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
 				'summary' => cdata_parse($row['body']),
-				'category' => array(
-					'term' => $row['id_board'],
-					'label' => cdata_parse($row['bname'])
-				),
+				'category' => $row['bname'],
 				'author' => array(
 					'name' => $row['poster_name'],
 					'email' => in_array(showEmailAddress(!empty($row['hide_email']), $row['id_member']), array('yes', 'yes_permission_override')) ? $row['poster_email'] : null,
@@ -817,7 +822,6 @@ function getXmlRecent($xml_format)
 				'published' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', $row['poster_time']),
 				'updated' => gmstrftime('%Y-%m-%dT%H:%M:%SZ', empty($row['modified_time']) ? $row['poster_time'] : $row['modified_time']),
 				'id' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
-				'icon' => $settings['images_url'] . '/icons/' . $row['icon'] . '.png',
 			);
 		// A lot of information here.  Should be enough to please the rss-ers.
 		else

+ 132 - 117
Sources/Packages.php

@@ -308,6 +308,7 @@ function PackageInstallTest()
 	{
 		// Not failed until proven otherwise.
 		$failed = false;
+		$thisAction = array();
 
 		if ($action['type'] == 'chmod')
 		{
@@ -351,144 +352,144 @@ function PackageInstallTest()
 					'failed' => true,
 				);
 			}
-
-			if ($action['boardmod'])
-				$mod_actions = parseBoardMod(@file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']), true, $action['reverse'], $theme_paths);
 			else
-				$mod_actions = parseModification(@file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']), true, $action['reverse'], $theme_paths);
-
-			if (count($mod_actions) == 1 && isset($mod_actions[0]) && $mod_actions[0]['type'] == 'error' && $mod_actions[0]['filename'] == '-')
-				$mod_actions[0]['filename'] = $action['filename'];
-
-			foreach ($mod_actions as $key => $mod_action)
 			{
-				// Lets get the last section of the file name.
-				if (isset($mod_action['filename']) && substr($mod_action['filename'], -13) != '.template.php')
-					$actual_filename = strtolower(substr(strrchr($mod_action['filename'], '/'), 1) . '||' . $action['filename']);
-				elseif (isset($mod_action['filename']) && preg_match('~([\w]*)/([\w]*)\.template\.php$~', $mod_action['filename'], $matches))
-					$actual_filename = strtolower($matches[1] . '/' . $matches[2] . '.template.php' . '||' . $action['filename']);
+
+				if ($action['boardmod'])
+					$mod_actions = parseBoardMod(@file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']), true, $action['reverse'], $theme_paths);
 				else
-					$actual_filename = $key;
+					$mod_actions = parseModification(@file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']), true, $action['reverse'], $theme_paths);
 
-				if ($mod_action['type'] == 'opened')
-					$failed = false;
-				elseif ($mod_action['type'] == 'failure')
-				{
-					if (empty($mod_action['is_custom']))
-						$context['has_failure'] = true;
-					$failed = true;
-				}
-				elseif ($mod_action['type'] == 'chmod')
-				{
-					$chmod_files[] = $mod_action['filename'];
-				}
-				elseif ($mod_action['type'] == 'saved')
+				if (count($mod_actions) == 1 && isset($mod_actions[0]) && $mod_actions[0]['type'] == 'error' && $mod_actions[0]['filename'] == '-')
+					$mod_actions[0]['filename'] = $action['filename'];
+
+				foreach ($mod_actions as $key => $mod_action)
 				{
-					if (!empty($mod_action['is_custom']))
+					// Lets get the last section of the file name.
+					if (isset($mod_action['filename']) && substr($mod_action['filename'], -13) != '.template.php')
+						$actual_filename = strtolower(substr(strrchr($mod_action['filename'], '/'), 1) . '||' . $action['filename']);
+					elseif (isset($mod_action['filename']) && preg_match('~([\w]*)/([\w]*)\.template\.php$~', $mod_action['filename'], $matches))
+						$actual_filename = strtolower($matches[1] . '/' . $matches[2] . '.template.php' . '||' . $action['filename']);
+					else
+						$actual_filename = $key;
+
+					if ($mod_action['type'] == 'opened')
+						$failed = false;
+					elseif ($mod_action['type'] == 'failure')
 					{
-						if (!isset($context['theme_actions'][$mod_action['is_custom']]))
-							$context['theme_actions'][$mod_action['is_custom']] = array(
-								'name' => $theme_paths[$mod_action['is_custom']]['name'],
-								'actions' => array(),
-								'has_failure' => $failed,
+						if (empty($mod_action['is_custom']))
+							$context['has_failure'] = true;
+						$failed = true;
+					}
+					elseif ($mod_action['type'] == 'chmod')
+					{
+						$chmod_files[] = $mod_action['filename'];
+					}
+					elseif ($mod_action['type'] == 'saved')
+					{
+						if (!empty($mod_action['is_custom']))
+						{
+							if (!isset($context['theme_actions'][$mod_action['is_custom']]))
+								$context['theme_actions'][$mod_action['is_custom']] = array(
+									'name' => $theme_paths[$mod_action['is_custom']]['name'],
+									'actions' => array(),
+									'has_failure' => $failed,
+								);
+							else
+								$context['theme_actions'][$mod_action['is_custom']]['has_failure'] |= $failed;
+
+							$context['theme_actions'][$mod_action['is_custom']]['actions'][$actual_filename] = array(
+								'type' => $txt['execute_modification'],
+								'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
+								'description' => $failed ? $txt['package_action_failure'] : $txt['package_action_success'],
+								'failed' => $failed,
+							);
+						}
+						elseif (!isset($context['actions'][$actual_filename]))
+						{
+							$context['actions'][$actual_filename] = array(
+								'type' => $txt['execute_modification'],
+								'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
+								'description' => $failed ? $txt['package_action_failure'] : $txt['package_action_success'],
+								'failed' => $failed,
 							);
+						}
 						else
-							$context['theme_actions'][$mod_action['is_custom']]['has_failure'] |= $failed;
-
-						$context['theme_actions'][$mod_action['is_custom']]['actions'][$actual_filename] = array(
-							'type' => $txt['execute_modification'],
-							'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-							'description' => $failed ? $txt['package_action_failure'] : $txt['package_action_success'],
-							'failed' => $failed,
-						);
+						{
+								$context['actions'][$actual_filename]['failed'] |= $failed;
+								$context['actions'][$actual_filename]['description'] = $context['actions'][$actual_filename]['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'];
+						}
 					}
-					elseif (!isset($context['actions'][$actual_filename]))
+					elseif ($mod_action['type'] == 'skipping')
 					{
 						$context['actions'][$actual_filename] = array(
 							'type' => $txt['execute_modification'],
 							'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-							'description' => $failed ? $txt['package_action_failure'] : $txt['package_action_success'],
-							'failed' => $failed,
+							'description' => $txt['package_action_skipping']
 						);
 					}
-					else
+					elseif ($mod_action['type'] == 'missing' && empty($mod_action['is_custom']))
 					{
-							$context['actions'][$actual_filename]['failed'] |= $failed;
-							$context['actions'][$actual_filename]['description'] = $context['actions'][$actual_filename]['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'];
-					}
-				}
-				elseif ($mod_action['type'] == 'skipping')
-				{
-					$context['actions'][$actual_filename] = array(
-						'type' => $txt['execute_modification'],
-						'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-						'description' => $txt['package_action_skipping']
-					);
-				}
-				elseif ($mod_action['type'] == 'missing' && empty($mod_action['is_custom']))
-				{
-					$context['has_failure'] = true;
-					$context['actions'][$actual_filename] = array(
-						'type' => $txt['execute_modification'],
-						'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-						'description' => $txt['package_action_missing'],
-						'failed' => true,
-					);
-				}
-				elseif ($mod_action['type'] == 'error')
-					$context['actions'][$actual_filename] = array(
-						'type' => $txt['execute_modification'],
-						'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-						'description' => $txt['package_action_error'],
-						'failed' => true,
-					);
-			}
-
-			// We need to loop again just to get the operations down correctly.
-			foreach ($mod_actions as $operation_key => $mod_action)
-			{
-				// Lets get the last section of the file name.
-				if (isset($mod_action['filename']) && substr($mod_action['filename'], -13) != '.template.php')
-					$actual_filename = strtolower(substr(strrchr($mod_action['filename'], '/'), 1) . '||' . $action['filename']);
-				elseif (isset($mod_action['filename']) && preg_match('~([\w]*)/([\w]*)\.template\.php$~', $mod_action['filename'], $matches))
-					$actual_filename = strtolower($matches[1] . '/' . $matches[2] . '.template.php' . '||' . $action['filename']);
-				else
-					$actual_filename = $key;
-
-				// We just need it for actual parse changes.
-				if (!in_array($mod_action['type'], array('error', 'result', 'opened', 'saved', 'end', 'missing', 'skipping', 'chmod')))
-				{
-					if (empty($mod_action['is_custom']))
-						$context['actions'][$actual_filename]['operations'][] = array(
+						$context['has_failure'] = true;
+						$context['actions'][$actual_filename] = array(
 							'type' => $txt['execute_modification'],
 							'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-							'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'],
-							'position' => $mod_action['position'],
-							'operation_key' => $operation_key,
-							'filename' => $action['filename'],
-							'is_boardmod' => $action['boardmod'],
-							'failed' => $mod_action['failed'],
-							'ignore_failure' => !empty($mod_action['ignore_failure']),
+							'description' => $txt['package_action_missing'],
+							'failed' => true,
 						);
-
-					// Themes are under the saved type.
-					if (isset($mod_action['is_custom']) && isset($context['theme_actions'][$mod_action['is_custom']]))
-						$context['theme_actions'][$mod_action['is_custom']]['actions'][$actual_filename]['operations'][] = array(
+					}
+					elseif ($mod_action['type'] == 'error')
+						$context['actions'][$actual_filename] = array(
 							'type' => $txt['execute_modification'],
 							'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
-							'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'],
-							'position' => $mod_action['position'],
-							'operation_key' => $operation_key,
-							'filename' => $action['filename'],
-							'is_boardmod' => $action['boardmod'],
-							'failed' => $mod_action['failed'],
-							'ignore_failure' => !empty($mod_action['ignore_failure']),
+							'description' => $txt['package_action_error'],
+							'failed' => true,
 						);
 				}
-			}
 
-			// Don't add anything else.
-			$thisAction = array();
+				// We need to loop again just to get the operations down correctly.
+				foreach ($mod_actions as $operation_key => $mod_action)
+				{
+					// Lets get the last section of the file name.
+					if (isset($mod_action['filename']) && substr($mod_action['filename'], -13) != '.template.php')
+						$actual_filename = strtolower(substr(strrchr($mod_action['filename'], '/'), 1) . '||' . $action['filename']);
+					elseif (isset($mod_action['filename']) && preg_match('~([\w]*)/([\w]*)\.template\.php$~', $mod_action['filename'], $matches))
+						$actual_filename = strtolower($matches[1] . '/' . $matches[2] . '.template.php' . '||' . $action['filename']);
+					else
+						$actual_filename = $key;
+
+					// We just need it for actual parse changes.
+					if (!in_array($mod_action['type'], array('error', 'result', 'opened', 'saved', 'end', 'missing', 'skipping', 'chmod')))
+					{
+						if (empty($mod_action['is_custom']))
+							$context['actions'][$actual_filename]['operations'][] = array(
+								'type' => $txt['execute_modification'],
+								'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
+								'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'],
+								'position' => $mod_action['position'],
+								'operation_key' => $operation_key,
+								'filename' => $action['filename'],
+								'is_boardmod' => $action['boardmod'],
+								'failed' => $mod_action['failed'],
+								'ignore_failure' => !empty($mod_action['ignore_failure']),
+							);
+
+						// Themes are under the saved type.
+						if (isset($mod_action['is_custom']) && isset($context['theme_actions'][$mod_action['is_custom']]))
+							$context['theme_actions'][$mod_action['is_custom']]['actions'][$actual_filename]['operations'][] = array(
+								'type' => $txt['execute_modification'],
+								'action' => $smcFunc['htmlspecialchars'](strtr($mod_action['filename'], array($boarddir => '.'))),
+								'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'],
+								'position' => $mod_action['position'],
+								'operation_key' => $operation_key,
+								'filename' => $action['filename'],
+								'is_boardmod' => $action['boardmod'],
+								'failed' => $mod_action['failed'],
+								'ignore_failure' => !empty($mod_action['ignore_failure']),
+							);
+					}
+				}
+			}
 		}
 		elseif ($action['type'] == 'code')
 		{
@@ -638,8 +639,20 @@ function PackageInstallTest()
 		if (empty($thisAction))
 			continue;
 
+		if (!file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']))
+		{
+			$context['has_failure'] = true;
+
+			$thisAction += array(
+				'description' => $txt['package_action_error'],
+				'failed' => true,
+			);
+		}
+
 		// @todo None given?
-		$thisAction['description'] = isset($action['description']) ? $action['description'] : '';
+		if (empty($thisAction['description']))
+			$thisAction['description'] = isset($action['description']) ? $action['description'] : '';
+
 		$context['actions'][] = $thisAction;
 	}
 
@@ -976,7 +989,8 @@ function PackageInstall()
 				global $txt, $boarddir, $sourcedir, $modSettings, $context, $settings, $forum_version, $smcFunc;
 
 				// Now include the file and be done with it ;).
-				require($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']);
+				if (file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']))
+					require($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']);
 			}
 			elseif ($action['type'] == 'credits')
 			{
@@ -1006,7 +1020,8 @@ function PackageInstall()
 				db_extend('packages');
 
 				// Let the file work its magic ;)
-				require($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']);
+				if (file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']))
+					require($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']);
 			}
 			// Handle a redirect...
 			elseif ($action['type'] == 'redirect' && !empty($action['redirect_url']))

+ 1 - 0
Sources/QueryString.php

@@ -572,6 +572,7 @@ function JavaScriptEscape($string)
 		'\'' => '\\\'',
 		'</' => '<\' + \'/',
 		'script' => 'scri\'+\'pt',
+		'<body>' => '<bo\'+\'dy>',
 		'<a href' => '<a hr\'+\'ef',
 		$scripturl => '\' + smf_scripturl + \'',
 	)) . '\'';

+ 25 - 5
Sources/Reports.php

@@ -120,7 +120,7 @@ function ReportsMain()
  */
 function BoardReport()
 {
-	global $context, $txt, $sourcedir, $smcFunc;
+	global $context, $txt, $sourcedir, $smcFunc, $modSettings;
 
 	// Load the permission profiles.
 	require_once($sourcedir . '/ManagePermissions.php');
@@ -165,13 +165,15 @@ function BoardReport()
 		'moderators' => $txt['board_moderators'],
 		'groups' => $txt['board_groups'],
 	);
+	if (!empty($modSettings['deny_boards_access']))
+		$boardSettings['disallowed_groups'] = $txt['board_disallowed_groups'];
 
 	// Do it in columns, it's just easier.
 	setKeys('cols');
 
 	// Go through each board!
 	$request = $smcFunc['db_query']('order_by_board_order', '
-		SELECT b.id_board, b.name, b.num_posts, b.num_topics, b.count_posts, b.member_groups, b.override_theme, b.id_profile,
+		SELECT b.id_board, b.name, b.num_posts, b.num_topics, b.count_posts, b.member_groups, b.override_theme, b.id_profile, b.deny_member_groups,
 			c.name AS cat_name, IFNULL(par.name, {string:text_none}) AS parent_name, IFNULL(th.value, {string:text_none}) AS theme_name
 		FROM {db_prefix}boards AS b
 			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
@@ -207,7 +209,7 @@ function BoardReport()
 			'moderators' => empty($moderators[$row['id_board']]) ? $txt['none'] : implode(', ', $moderators[$row['id_board']]),
 		);
 
-		// Work out the membergroups who can access it.
+		// Work out the membergroups who can and cannot access it (but only if enabled).
 		$allowedGroups = explode(',', $row['member_groups']);
 		foreach ($allowedGroups as $key => $group)
 		{
@@ -217,6 +219,18 @@ function BoardReport()
 				unset($allowedGroups[$key]);
 		}
 		$boardData['groups'] = implode(', ', $allowedGroups);
+		if (!empty($modSettings['deny_boards_access']))
+		{
+			$disallowedGroups = explode(',', $row['deny_member_groups']);
+			foreach ($disallowedGroups as $key => $group)
+			{
+				if (isset($groups[$group]))
+					$disallowedGroups[$key] = $groups[$group];
+				else
+					unset($disallowedGroups[$key]);
+			}
+			$boardData['disallowed_groups'] = implode(', ', $disallowedGroups);
+		}
 
 		// Next add the main data.
 		addData($boardData);
@@ -418,7 +432,7 @@ function MemberGroupsReport()
 
 	// Fetch all the board names.
 	$request = $smcFunc['db_query']('', '
-		SELECT id_board, name, member_groups, id_profile
+		SELECT id_board, name, member_groups, id_profile, deny_member_groups
 		FROM {db_prefix}boards',
 		array(
 		)
@@ -430,11 +444,17 @@ function MemberGroupsReport()
 		else
 			$groups = array_merge(array(1), explode(',', $row['member_groups']));
 
+		if (trim($row['deny_member_groups']) == '')
+			$denyGroups = array();
+		else
+			$denyGroups = explode(',', $row['deny_member_groups']);
+
 		$boards[$row['id_board']] = array(
 			'id' => $row['id_board'],
 			'name' => $row['name'],
 			'profile' => $row['id_profile'],
 			'groups' => $groups,
+			'deny_groups' => $denyGroups,
 		);
 	}
 	$smcFunc['db_free_result']($request);
@@ -515,7 +535,7 @@ function MemberGroupsReport()
 
 		// Board permissions.
 		foreach ($boards as $board)
-			$group['board_' . $board['id']] = in_array($row['id_group'], $board['groups']) ? '<span style="color: darkgreen;">' . $txt['board_perms_allow'] . '</span>' : 'x';
+			$group['board_' . $board['id']] = in_array($row['id_group'], $board['groups']) ? '<span class="success">' . $txt['board_perms_allow'] . '</span>' : (!empty($modSettings['deny_boards_access']) && in_array($row['id_group'], $board['deny_groups']) ? '<span class="alert">' . $txt['board_perms_deny'] . '</span>' : 'x');
 
 		addData($group);
 	}

+ 10 - 2
Sources/Subs.php

@@ -3113,12 +3113,16 @@ function template_header()
 			secureDirectory($path, true);
 			secureDirectory($cachedir);
 
-			if (!empty($securityFiles) || (!empty($modSettings['cache_enable']) && !is_writable($cachedir)))
+			// If agreement is enabled, at least the english version shall exists
+			if ($modSettings['requireAgreement'])
+				$agreement = !file_exists($boarddir . '/agreement.txt');
+
+			if (!empty($securityFiles) || (!empty($modSettings['cache_enable']) && !is_writable($cachedir)) || !empty($agreement))
 			{
 				echo '
 		<div class="errorbox">
 			<p class="alert">!!</p>
-			<h3>', empty($securityFiles) ? $txt['cache_writable_head'] : $txt['security_risk'], '</h3>
+			<h3>', empty($securityFiles) ? $txt['generic_warning'] : $txt['security_risk'], '</h3>
 			<p>';
 
 				foreach ($securityFiles as $securityFile)
@@ -3135,6 +3139,10 @@ function template_header()
 					echo '
 				<strong>', $txt['cache_writable'], '</strong><br />';
 
+				if (!empty($agreement))
+					echo '
+				<strong>', $txt['agreement_missing'], '</strong><br />';
+
 				echo '
 			</p>
 		</div>';

+ 2 - 29
Themes/default/ManageLanguages.template.php

@@ -477,36 +477,9 @@ function template_add_language()
 	if (!empty($context['smf_languages']))
 	{
 		echo '
-			<div class="information">', $txt['add_language_smf_found'], '</div>
-
-				<table class="table_grid" cellspacing="0" width="100%">
-					<thead>
-						<tr class="catbg">
-							<th class="first_th" scope="col">', $txt['name'], '</th>
-							<th scope="col">', $txt['add_language_smf_desc'], '</th>
-							<th scope="col">', $txt['add_language_smf_version'], '</th>
-							<th scope="col">', $txt['add_language_smf_utf8'], '</th>
-							<th class="last_th" scope="col">', $txt['add_language_smf_install'], '</th>
-						</tr>
-					</thead>
-					<tbody>';
-
-		foreach ($context['smf_languages'] as $language)
-		{
-			// Write each language information out.
-			echo '
-						<tr class="windowbg2">
-							<td align="left">', $language['name'], '</td>
-							<td align="left">', $language['description'], '</td>
-							<td align="left">', $language['version'], '</td>
-							<td align="center">', $language['utf8'] ? $txt['yes'] : $txt['no'], '</td>
-							<td align="left"><a href="', $language['link'], '">', $txt['add_language_smf_install'], '</a></td>
-						</tr>';
-		}
+			<div class="information">', $txt['add_language_smf_found'], '</div>';
 
-		echo '
-					</tbody>
-					</table>';
+		template_show_list('smf_languages');
 	}
 
 	echo '

+ 0 - 69
Themes/default/ManageNews.template.php

@@ -10,75 +10,6 @@
  * @version 2.1 Alpha 1
  */
 
-// Form for editing current news on the site.
-function template_edit_news()
-{
-	global $context, $settings, $options, $scripturl, $txt;
-
-	echo '
-	<div id="admincenter">
-		<form action="', $scripturl, '?action=admin;area=news;sa=editnews" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify">
-			<table class="table_grid" width="100%">
-				<thead>
-					<tr class="catbg">
-						<th class="first_th" width="50%">', $txt['admin_edit_news'], '</th>
-						<th align="left" width="45%">', $txt['preview'], '</th>
-						<th class="last_th" align="center" width="5%"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" /></th>
-					</tr>
-				</thead>
-				<tbody>';
-
-	// Loop through all the current news items so you can edit/remove them.
-	foreach ($context['admin_current_news'] as $admin_news)
-		echo '
-					<tr class="windowbg2">
-						<td align="center">
-
-							<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';">', $admin_news['unparsed'], '</textarea></div>
-						</td><td align="left" valign="top">
-							<div style="overflow: auto; width: 100%; height: 10ex;">', $admin_news['parsed'], '</div>
-						</td><td align="center">
-							<input type="checkbox" name="remove[]" value="', $admin_news['id'], '" class="input_check" />
-						</td>
-					</tr>';
-
-	// This provides an empty text box to add a news item to the site.
-	echo '
-					<tr id="moreNews" class="windowbg2" style="display: none;">
-						<td align="center">
-							<div id="moreNewsItems"></div>
-						</td>
-						<td align="center">
-						</td>
-						<td align="center">
-						</td>
-					</tr>
-				</tbody>
-			</table>
-			<div class="floatleft padding">
-				<div id="moreNewsItems_link" style="display: none;">
-					<a class="button_link" href="javascript:void(0);" onclick="addNewsItem(); return false;">', $txt['editnews_clickadd'], '</a></div>
-				<script type="text/javascript"><!-- // --><![CDATA[
-					document.getElementById("moreNewsItems_link").style.display = "";
-					function addNewsItem()
-					{
-						document.getElementById("moreNews").style.display = "";
-						setOuterHTML(document.getElementById("moreNewsItems"), \'<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';"><\' + \'/textarea><\' + \'/div><div id="moreNewsItems"><\' + \'/div>\');
-					}
-				// ]]></script>
-				<noscript>
-					<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 85%; min-width: 85%' : 'width: 85%') . ';" name="news[]"></textarea></div>
-				</noscript>
-			</div>
-			<div class="floatright padding">
-				<input type="submit" name="save_items" value="', $txt['save'], '" class="button_submit" /> <input type="submit" name="delete_selection" value="', $txt['editnews_remove_selected'], '" onclick="return confirm(\'', $txt['editnews_remove_confirm'], '\');" class="button_submit" />
-			</div>
-			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
-		</form>
-	</div>
-	<br class="clear" />';
-}
-
 function template_email_members()
 {
 	global $context, $settings, $options, $txt, $scripturl;

+ 0 - 43
Themes/default/ModerationCenter.template.php

@@ -532,49 +532,6 @@ function template_viewmodreport()
 
 	template_show_list('moderation_actions_list');
 
-	if (!empty($context['entries']))
-	{
-		echo '
-			<div class="cat_bar">
-				<h3 class="catbg">', $txt['mc_modreport_modactions'], '</h3>
-			</div>
-			<table width="100%" class="table_grid">
-				<thead>
-					<tr class="catbg">
-						<th>', $txt['modlog_action'], '</th>
-						<th>', $txt['modlog_date'], '</th>
-						<th>', $txt['modlog_member'], '</th>
-						<th>', $txt['modlog_position'], '</th>
-						<th>', $txt['modlog_ip'], '</th>
-					</tr>
-				</thead>
-				<tbody>';
-
-		foreach ($context['entries'] as $entry)
-		{
-			echo '
-					<tr class="', $alt ? 'windowbg2' : 'windowbg', '">
-						<td>', $entry['action'], '</td>
-						<td>', $entry['time'], '</td>
-						<td>', $entry['moderator']['link'], '</td>
-						<td>', $entry['position'], '</td>
-						<td>', $entry['ip'], '</td>
-					</tr>
-					<tr>
-						<td colspan="5" class="', $alt ? 'windowbg2' : 'windowbg', '">';
-
-			foreach ($entry['extra'] as $key => $value)
-				echo '
-							<em>', $key, '</em>: ', $value;
-			echo '
-						</td>
-					</tr>';
-		}
-		echo '
-				</tbody>
-			</table>';
-	}
-
 	echo '
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 		</form>

+ 1 - 1
Themes/default/css/index.css

@@ -1026,7 +1026,7 @@ span.lowerframe span {
 }
 /* Needed for new PM notifications. */
 .dropmenu li strong {
-	color: #fff;
+	color: #000;
 }
 .dropmenu li a {
 	padding: 0 4px 0 4px;

+ 2 - 1
Themes/default/index.template.php

@@ -187,7 +187,8 @@ function template_html_above()
 	// If RSS feeds are enabled, advertise the presence of one.
 	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
 		echo '
-	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss;action=.xml" />';
+	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml" />
+	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml" />';
 
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
 	if (!empty($context['current_topic']))

+ 1 - 0
Themes/default/languages/Reports.english.php

@@ -90,6 +90,7 @@ $txt['board_override_theme'] = 'Force Board Theme';
 $txt['board_profile'] = 'Permissions Profile';
 $txt['board_moderators'] = 'Moderators';
 $txt['board_groups'] = 'Groups with Access';
+$txt['board_disallowed_groups'] = 'Groups with Access Denied';
 
 // Group Permissions.
 $txt['group_perms_name_access_mod_center'] = 'Access Moderation Center';

+ 3 - 1
Themes/default/languages/index.english.php

@@ -447,8 +447,9 @@ $txt['search_advanced'] = 'Advanced search';
 $txt['security_risk'] = 'MAJOR SECURITY RISK:';
 $txt['not_removed'] = 'You have not removed ';
 $txt['not_removed_extra'] = '%1$s is a backup of %2$s that was not generated by SMF. It can be accessed directly and used to gain unauthorised access to your forum. You should delete it immediately.';
+$txt['generic_warning'] = 'Warning';
+$txt['agreement_missing'] = 'Even though you are requiring to accept the registration agreement, the file (agreement.txt) doesn\'t exists!';
 
-$txt['cache_writable_head'] = 'Performance Warning';
 $txt['cache_writable'] = 'The cache directory is not writable - this will adversely affect the performance of your forum.';
 
 $txt['page_created'] = 'Page created in ';
@@ -606,6 +607,7 @@ $txt['valid_html'] = 'Valid HTML 4.01!';
 $txt['valid_xhtml'] = 'Valid XHTML 1.0!';
 $txt['wap2'] = 'WAP2';
 $txt['rss'] = 'RSS';
+$txt['atom'] = 'Atom';
 $txt['xhtml'] = 'XHTML';
 $txt['html'] = 'HTML';
 

+ 6 - 4
Themes/default/scripts/fader.js

@@ -38,7 +38,6 @@ smf_NewsFader.prototype.init = function init()
 		for (var i = 0, n = oNewsItems.length; i < n; i ++)
 			this.aFaderItems[i] = oNewsItems[i].innerHTML;
 	}
-	$('#' + this.opt.sFaderControlId).fadeOut('fast');
 
 	// Start the fader!
 	this.fade();
@@ -65,9 +64,12 @@ smf_NewsFader.prototype.fade = function fade()
 			this.iFadeIndex = 0;
 	}
 
-	$('#' + this.opt.sFaderControlId).fadeOut('slow', function () {
-		setInnerHTML(this, currentText);
-	}).fadeIn('slow');
+	$('#' + this.opt.sFaderControlId).each(function() {
+		temp_elem = $(this).clone().css({height: 'auto'}).appendTo('body').html(currentText);
+		final_height = parseInt(temp_elem.height()) + parseInt($(this).css('padding-top').replace(/[^-\d\.]/g, '')) + parseInt($(this).css('padding-bottom').replace(/[^-\d\.]/g, ''));
+		temp_elem.remove();
+		$(this).height($(this).height());
+	}).html(currentText).animate({height: final_height}, 'slow');
 
 	// Keep going.
 	window.setTimeout(this.opt.sSelf + '.fade();', this.iFadeDelay);

BIN
Themes/penguin/images/selected_open.png


+ 2 - 1
Themes/penguin/index.template.php

@@ -183,7 +183,8 @@ function template_html_above()
 	// If RSS feeds are enabled, advertise the presence of one.
 	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
 		echo '
-	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss;action=.xml" />';
+	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss2;action=.xml" />
+	<link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?type=atom;action=.xml" />';
 
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
 	// Note: These have been modified to add additional functionality. Has already been tested live for two years.