소스 검색

! JavaScript functions can't have default values (script.js)
! Minor bug with old login history maintenance (ScheduledTasks.php)
! Fixed a few minor bugs. (index.css, admin.css, ManageNews.template.php)[Bug 4751][Bug 4765][Bug 4779]
+ Added hook attributes to package installation (Subs-Package.php, Packages.php, Packages language)

Spuds 12 년 전
부모
커밋
be0d46cb3c

+ 19 - 0
Sources/Packages.php

@@ -507,6 +507,18 @@ function PackageInstallTest()
 				'type' => $txt['package_create'] . ' ' . ($action['type'] == 'create-dir' ? $txt['package_tree'] : $txt['package_file']),
 				'action' => $smcFunc['htmlspecialchars'](strtr($action['destination'], array($boarddir => '.')))
 			);
+		elseif (in_array($action['type'], array('hook')))
+		{
+			$action['description'] = !isset($action['hook'], $action['function']) ? $txt['package_action_failure'] : $txt['package_action_success'];
+
+			if (!isset($action['hook'], $action['function']))
+				$context['has_failure'] = true;
+
+			$thisAction = array(
+				'type' => $action['reverse'] ? $txt['execute_hook_remove'] : $txt['execute_hook_add'],
+				'action' => sprintf($txt['execute_hook_action'],  $smcFunc['htmlspecialchars']($action['hook'])),
+			);
+		}
 		elseif (in_array($action['type'], array('require-dir', 'require-file')))
 		{
 			// Do this one...
@@ -921,6 +933,13 @@ function PackageInstall()
 				// Now include the file and be done with it ;).
 				require($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']);
 			}
+			elseif ($action['type'] == 'hook' && isset($action['hook'], $action['name']))
+			{
+				if ($action['reverse'])
+					remove_integration_function($action['hook'], $action['function']);
+				else
+					add_integration_function($action['hook'], $action['function']);
+			}
 			// Only do the database changes on uninstall if requested.
 			elseif ($action['type'] == 'database' && !empty($action['filename']) && (!$context['uninstalling'] || !empty($_POST['do_db_changes'])))
 			{

+ 2 - 2
Sources/QueryString.php

@@ -319,10 +319,10 @@ function convertIPv6toInts($ip)
 		return $expanded[$ip];
 
 	// Expand the IP out.
-	$ip = explode(':', expandIPv6($ip));
+	$expanded_ip = explode(':', expandIPv6($ip));
 
 	$new_ip = array();
-	foreach ($ip as $int)
+	foreach ($expanded_ip as $int)
 		$new_ip[] = hexdec($int);
 
 	// Save this incase of repeated use.

+ 1 - 1
Sources/ScheduledTasks.php

@@ -494,7 +494,7 @@ function scheduled_daily_maintenance()
 	// Clean up some old login history information.
 	$smcFunc['db_query']('', '
 		DELETE FROM {db_prefix}member_logins
-		WHERE time > {int:oldLogns}',
+		WHERE time > {int:oldLogins}',
 		array(
 			'oldLogins' => !empty($modSettings['loginHistoryDays']) ? 60 * 60 * $modSettings['loginHistoryDays'] : 108000,
 	));

+ 12 - 1
Sources/Subs-Package.php

@@ -1116,7 +1116,7 @@ function parsePackageInfo(&$packageXML, $testing_only = true, $method = 'install
 	{
 		$actionType = $action->name();
 
-		if ($actionType == 'readme' || $actionType == 'code' || $actionType == 'database' || $actionType == 'modification' || $actionType == 'redirect')
+		if (in_array($actionType, array('readme', 'code', 'database', 'modification', 'redirect')))
 		{
 			// Allow for translated readme files.
 			if ($actionType == 'readme')
@@ -1178,6 +1178,17 @@ function parsePackageInfo(&$packageXML, $testing_only = true, $method = 'install
 
 			continue;
 		}
+		elseif ($actionType == 'hook')
+		{
+			$return[] = array(
+				'type' => $actionType,
+				'function' => $action->exists('@function') ? $action->fetch('@function') : '',
+				'hook' => $action->exists('@hook') ? $action->fetch('@hook') : $action->fetch('.'),
+				'reverse' => $action->exists('@reverse') && $action->fetch('@reverse') == 'true' ? true : false,
+				'description' => '',
+			);
+			continue;
+		}
 		elseif ($actionType == 'error')
 		{
 			$return[] = array(

+ 2 - 2
Themes/default/ManageNews.template.php

@@ -55,7 +55,7 @@ function template_edit_news()
 					</tr>
 				</tbody>
 			</table>
-			<div class="floatleftpadding">
+			<div class="floatleft padding">
 				<div id="moreNewsItems_link" style="display: none;"><a href="javascript:void(0);" onclick="addNewsItem(); return false;">', $txt['editnews_clickadd'], '</a></div>
 				<script type="text/javascript"><!-- // --><![CDATA[
 					document.getElementById("moreNewsItems_link").style.display = "";
@@ -69,7 +69,7 @@ function template_edit_news()
 					<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="floatrightpadding">
+			<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'], '" />

+ 4 - 4
Themes/default/css/admin.css

@@ -565,7 +565,7 @@ dl.themes_list dd
 
 .modbox
 {
-	height: 150px;
+	height: 14em;
 	overflow: auto;
 }
 /* Moderation Notes */
@@ -575,16 +575,16 @@ ul.moderation_notes
 	padding: 0;
 	list-style: none;
 	overflow: auto;
-	height: 8.5em;
+	height: 10.2em;
 }
 ul.moderation_notes li
 {
-	padding: 4px 0 4px 4px;
+	padding: 0.2em;
 	border-bottom: 1px solid #cccccc;
 }
 .notes
 {
-	margin: 0.5em 0;
+	margin-top: 0.4em;
 }
 .post_note
 {

+ 0 - 18
Themes/default/css/index.css

@@ -1702,24 +1702,6 @@ dl#ic_recentposts dd
 	font-size: 1.1em;
 	padding-top: 8px;
 }
-form#ic_login
-{
-	padding: 0.5em;
-	height: 2em;
-}
-form#ic_login ul li
-{
-	margin: 0;
-	padding: 0;
-	float: left;
-	width: 20%;
-	text-align: center;
-}
-form#ic_login ul li label
-{
-	display: block;
-}
-
 /* the small stats */
 #index_common_stats
 {

+ 3 - 0
Themes/default/languages/Packages.english.php

@@ -94,6 +94,9 @@ $txt['package_tree'] = 'Tree';
 $txt['execute_modification'] = 'Execute Modification';
 $txt['execute_code'] = 'Execute Code';
 $txt['execute_database_changes'] = 'Adapt Database';
+$txt['execute_hook_add'] = 'Add Hook';
+$txt['execute_hook_remove'] = 'Remove Hook';
+$txt['execute_hook_action'] = 'Adapting hook %1$s';
 
 $txt['package_install_actions'] = 'Installations actions for';
 $txt['package_will_fail_title'] = 'Error in Package Installation';

+ 4 - 1
Themes/default/scripts/script.js

@@ -1459,8 +1459,11 @@ function pollOptions()
 		document.forms.postmodify.poll_hide[2].disabled = false;
 }
 
-function generateDays(offset = 0)
+function generateDays(offset)
 {
+	// Work around JavaScript's lack of support for default values...
+	offset = typeof(offset) != 'undefined' ? offset : 0;
+
 	var days = 0, selected = 0;
 	var dayElement = document.getElementById("day" + offset), yearElement = document.getElementById("year" + offset), monthElement = document.getElementById("month" + offset);