Browse Source

Merge pull request #148 from Spuds/dev_fixes

! Several minor fixes for the recent build
emanuele45 12 years ago
parent
commit
51c97e7f6e

+ 4 - 15
Sources/Drafts.php

@@ -385,8 +385,7 @@ function DeleteDraft($id_draft, $check = true)
 	$smcFunc['db_query']('', '
 		DELETE FROM {db_prefix}user_drafts
 		WHERE id_draft IN ({array_int:id_draft})' . ($check ? '
-			AND  id_member = {int:id_member}' : '') . '
-		LIMIT 1',
+			AND  id_member = {int:id_member}' : ''),
 		array (
 			'id_draft' => $id_draft,
 			'id_member' => empty($user_info['id']) ? -1 : $user_info['id'],
@@ -848,24 +847,14 @@ function ModifyDraftSettings($return_config = false)
 		saveDBSettings($config_vars);
 		redirectexit('action=admin;area=managedrafts');
 	}
-
+	
 	// some javascript to enable / disable the frequency input box
 	$context['settings_post_javascript'] = '
 		var autosave = document.getElementById(\'drafts_autosave_enabled\');
-		mod_addEvent(autosave, \'change\', toggle);
+		createEventListener(autosave)
+		autosave.addEventListener(\'change\', toggle);
 		toggle();
 
-		function mod_addEvent(control, ev, fn)
-		{
-			if (control.addEventListener)
-			{
-				control.addEventListener(ev, fn, false);
-			}
-			else if (control.attachEvent)
-			{
-				control.attachEvent(\'on\'+ev, fn);
-			}
-		}
 		function toggle()
 		{
 			var select_elem = document.getElementById(\'drafts_autosave_frequency\');

+ 1 - 1
Sources/ManageAttachments.php

@@ -359,7 +359,7 @@ function BrowseFiles()
 	// Set the options for the list component.
 	$listOptions = array(
 		'id' => 'file_list',
-		'title' => $txt['attachment_manager_' . ($context['browse_type'] === 'avatars' ? 'avatars' : ( $context['browse_type'] === 'thumbs' ? 'thumbs' : 'attachments'))],
+		'title' => $txt['attachment_manager_' . ($context['browse_type'] === 'avatars' ? 'avatars' : ($context['browse_type'] === 'thumbs' ? 'thumbs' : 'attachments'))],
 		'items_per_page' => $modSettings['defaultMaxMessages'],
 		'base_href' => $scripturl . '?action=admin;area=manageattachments;sa=browse' . ($context['browse_type'] === 'avatars' ? ';avatars' : ($context['browse_type'] === 'thumbs' ? ';thumbs' : '')),
 		'default_sort_col' => 'name',

+ 5 - 5
Sources/Post.php

@@ -906,12 +906,12 @@ function Post($post_errors = array())
 				// Show any errors which might of occured.
 				if (!empty($attachment['errors']))
 				{
-					$txt['error_attach_errrors'] = empty($txt['error_attach_errrors']) ? '<br />' : '';
-					$txt['error_attach_errrors'] .= vsprintf($txt['attach_warning'], $attachment['name']) . '<div style="padding: 0 1em;">';
+					$txt['error_attach_errors'] = empty($txt['error_attach_errors']) ? '<br />' : '';
+					$txt['error_attach_errors'] .= vsprintf($txt['attach_warning'], $attachment['name']) . '<div style="padding: 0 1em;">';
 					foreach ($attachment['errors'] as $error)
-						$txt['error_attach_errrors'] .= (is_array($error) ? vsprintf($txt[$error[0]], $error[1]) : $txt[$error]) . '<br  />';
-					$txt['error_attach_errrors'] .= '</div>';
-					$post_errors[] = 'attach_errrors';
+						$txt['error_attach_errors'] .= (is_array($error) ? vsprintf($txt[$error[0]], $error[1]) : $txt[$error]) . '<br  />';
+					$txt['error_attach_errors'] .= '</div>';
+					$post_errors[] = 'attach_errors';
 
 					// Take out the trash.
 					unset($_SESSION['temp_attachments'][$attachID]);

+ 4 - 0
Sources/Profile-View.php

@@ -606,6 +606,10 @@ function showAttachments($memID)
 					'db' => 'posted',
 					'timeformat' => true,
 				),
+				'sort' => array(
+					'default' => 'm.poster_time',
+					'reverse' => 'm.poster_time DESC',
+				),
 			),
 		),
 	);

+ 1 - 1
Sources/Recent.php

@@ -1233,7 +1233,7 @@ function UnreadTopics()
 					'name' => $row['first_poster_name'],
 					'id' => $row['id_first_member'],
 					'href' => $scripturl . '?action=profile;u=' . $row['id_first_member'],
-					'link' => !empty($row['id_first_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_first_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_poster_name'] . '">' . $row['first_poster_name'] . '</a>' : $row['first_poster_name']
+					'link' => !empty($row['id_first_member']) ? '<a class="preview" href="' . $scripturl . '?action=profile;u=' . $row['id_first_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_poster_name'] . '">' . $row['first_poster_name'] . '</a>' : $row['first_poster_name']
 				),
 				'time' => timeformat($row['first_poster_time']),
 				'timestamp' => forum_time(true, $row['first_poster_time']),

+ 2 - 2
Sources/Search.php

@@ -1645,12 +1645,12 @@ function PlushSearch2()
 						SELECT
 							{int:id_search},
 							t.id_topic,
-							' . $relevance. ',
+							' . $relevance . ',
 							t.id_first_msg,
 							1
 						FROM {db_prefix}topics AS t
 							INNER JOIN {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics AS lst ON (lst.id_topic = t.id_topic)'
-						. ($createTemporary ? '' : 'WHERE lst.id_search = {int:id_search}')
+						. ($createTemporary ? '' : ' WHERE lst.id_search = {int:id_search}')
 						. (empty($modSettings['search_max_results']) ? '' : '
 						LIMIT ' . ($modSettings['search_max_results'] - $_SESSION['search_cache']['num_results'])),
 						array(

+ 1 - 1
Themes/default/GenericControls.template.php

@@ -21,7 +21,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 		<div>
 			<div>
 				<div>
-					<textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" rows="" cols="600" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="height: ', $editor_context['height'], '; ', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '">', $editor_context['value'], '</textarea>
+					<textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" rows="" cols="600" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="width: ', $editor_context['width'], ';height: ', $editor_context['height'], '; ', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '">', $editor_context['value'], '</textarea>
 				</div>
 				<div id="', $editor_id, '_resizer" class="richedit_resize"></div>
 			</div>

+ 1 - 1
Themes/default/ManageSmileys.template.php

@@ -143,7 +143,7 @@ function template_modifyset()
 		echo '
 					</dl>
 					<hr class="hrcolor" />
-					<input type="submit" value="', $txt['smiley_sets_save'], '" class="button_submit" />
+					<input type="submit" name="smiley_save" value="', $txt['smiley_sets_save'], '" class="button_submit" />
 					<br class="clear_right" />
 				</div>
 			</div>

+ 35 - 36
Themes/default/Profile.template.php

@@ -456,51 +456,50 @@ function template_showDrafts()
 	$edit_button = create_button('modify_inline.png', 'draft_edit', 'draft_edit', 'class="centericon"');
 	$remove_button = create_button('delete.png', 'draft_delete', 'draft_delete', 'class="centericon"');
 
-	// For every draft to be displayed, give it its own div, and show the important details of the draft.
-	foreach ($context['drafts'] as $draft)
-	{
+	// No drafts? Just show an informative message.
+	if (empty($context['drafts']))
 		echo '
-		<div class="topic">
-			<div class="', $draft['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
-				<span class="topslice"><span></span></span>
-				<div class="content">
-					<div class="counter">', $draft['counter'], '</div>
-					<div class="topic_details">
-						<h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
+		<div class="tborder windowbg2 padding centertext">
+			', $txt['draft_none'], '
+		</div>';
+	else
+	{
+		// For every draft to be displayed, give it its own div, and show the important details of the draft.
+		foreach ($context['drafts'] as $draft)
+		{
+			echo '
+			<div class="topic">
+				<div class="', $draft['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
+					<div class="content">
+						<div class="counter">', $draft['counter'], '</div>
+						<div class="topic_details">
+							<h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
 
-		if (!empty($draft['sticky']))
-			echo '<img src="', $settings['images_url'], '/icons/quick_sticky.png" alt="', $txt['sticky_topic'], '" title="', $txt['sticky_topic'], '" />';
+			if (!empty($draft['sticky']))
+				echo '<img src="', $settings['images_url'], '/icons/quick_sticky.png" alt="', $txt['sticky_topic'], '" title="', $txt['sticky_topic'], '" />';
 
-		if (!empty($draft['locked']))
-			echo '<img src="', $settings['images_url'], '/icons/quick_lock.png" alt="', $txt['locked_topic'], '" title="', $txt['locked_topic'], '" />';
+			if (!empty($draft['locked']))
+				echo '<img src="', $settings['images_url'], '/icons/quick_lock.png" alt="', $txt['locked_topic'], '" title="', $txt['locked_topic'], '" />';
 
-		echo '
-						</h5>
-						<span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $draft['time'], '&nbsp;&#187;</span>
+			echo '
+							</h5>
+							<span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $draft['time'], '&nbsp;&#187;</span>
+						</div>
+						<div class="list_posts">
+							', $draft['body'], '
+						</div>
 					</div>
-					<div class="list_posts">
-						', $draft['body'], '
+					<div class="floatright">
+						<ul class="reset smalltext quickbuttons">
+							<li><a href="', $scripturl, '?action=post;', (empty($draft['topic']['id']) ? 'board=' . $draft['board']['id'] : 'topic=' . $draft['topic']['id']), '.0;id_draft=', $draft['id_draft'], '" class="reply_button"><span>', $txt['draft_edit'], '</span></a></li>
+							<li><a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=showdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['draft_remove'], '?\');" class="remove_button"><span>', $txt['draft_delete'], '</span></a></li>
+						</ul>
 					</div>
 				</div>
-				<div class="floatright">
-					<ul class="reset smalltext quickbuttons">
-						<li><a href="', $scripturl, '?action=post;', (empty($draft['topic']['id']) ? 'board=' . $draft['board']['id'] : 'topic=' . $draft['topic']['id']), '.0;id_draft=', $draft['id_draft'], '" class="reply_button"><span>', $txt['draft_edit'], '</span></a></li>
-						<li><a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=showdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['draft_remove'], '?\');" class="remove_button"><span>', $txt['draft_delete'], '</span></a></li>
-					</ul>
-				</div>
-				<br class="clear" />
-				<span class="botslice"><span></span></span>
-			</div>
-		</div>';
+			</div>';
+		}
 	}
 
-	// No drafts? Just show an informative message.
-	if (empty($context['drafts']))
-		echo '
-		<div class="tborder windowbg2 padding centertext">
-			', $txt['draft_none'], '
-		</div>';
-
 	// Show page numbers.
 	echo '
 		<div class="pagesection" style="margin-bottom: 0;">

+ 1 - 1
Themes/default/languages/Admin.english.php

@@ -495,7 +495,7 @@ $txt['groups_send_mail'] = 'Groups allowed to send out forum newsletters';
 $txt['xmlnews_enable'] = 'Enable XML/RSS news';
 $txt['xmlnews_maxlen'] = 'Maximum message length';
 $txt['xmlnews_maxlen_note'] = '(0 to disable, bad idea.)';
-$txt['editnews_clickadd'] = 'Click here to add another item.';
+$txt['editnews_clickadd'] = 'Add another item';
 $txt['editnews_remove_selected'] = 'Remove selected';
 $txt['editnews_remove_confirm'] = 'Are you sure you want to delete the selected news items?';
 $txt['censor_clickadd'] = 'Add another word';

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

@@ -51,4 +51,6 @@ $editortxt['Insert current date'] = 'Insert current date';
 $editortxt['Insert current time'] = 'Insert current time';
 $editortxt['Print'] = 'Print';
 $editortxt['Preformatted Text'] = 'Preformatted Text';
-$editortxt['View source'] = 'View source';
+$editortxt['View source'] = 'View source';
+
+?>

+ 1 - 1
Themes/default/languages/Help.english.php

@@ -277,7 +277,7 @@ $helptxt['databaseSession_loose'] = 'Turning this on will decrease the bandwidth
 $helptxt['databaseSession_lifetime'] = 'This is the number of seconds for sessions to last after they haven\'t been accessed.  If a session is not accessed for too long, it is said to have &quot;timed out&quot;.  Anything higher than 2400 is recommended.';
 $helptxt['cache_enable'] = 'SMF performs caching at a variety of levels. The higher the level of caching enabled the more CPU time will be spent retrieving cached information. If caching is available on your machine it is recommended that you try caching at level 1 first.';
 $helptxt['cache_memcached'] = 'If you are using memcached you need to provide the server details. This should be entered as a comma separated list as shown in the example below:<br /><br/>	&quot;server1,server2,server3:port,server4&quot;<br /><br />Note that if no port is specified SMF will use port 11211. SMF will attempt to perform rough/random load balancing across the specified servers.';
-$helptxt['cache_cachedir'] = 'This setting This is only for the smf file based cache system. It specifies the path to the cache directory.  It is recommended that you place this in /tmp/ if you are going to use this, although it will work in any directory';
+$helptxt['cache_cachedir'] = 'This setting is only for the smf file based cache system. It specifies the path to the cache directory.  It is recommended that you place this in /tmp/ if you are going to use this, although it will work in any directory';
 $helptxt['enableErrorLogging'] = 'This will log any errors, like a failed login, so you can see what went wrong.';
 $helptxt['enableErrorQueryLogging'] = 'This will include the full query sent to the database in the error log.  Requires error logging to be turned on.<br /><br /><strong>Note:  This will affect the ability to filter the error log by the error message.</strong>';
 $helptxt['allow_disableAnnounce'] = 'This will allow users to opt out of notification of topics you announce by checking the &quot;announce topic&quot; checkbox when posting.';

+ 2 - 2
Themes/default/languages/ManageSettings.english.php

@@ -302,8 +302,8 @@ $txt['core_settings_item_dr'] = 'Drafts';
 $txt['core_settings_item_dr_desc'] = 'Enabling this feature will allow users to save drafts of their posts so they can return to them later to post them.';
 $txt['core_settings_item_cp'] = 'Advanced Profile Fields';
 $txt['core_settings_item_cp_desc'] = 'This enables you to hide standard profile fields, add profile fields to registration, and create new profile fields for your forum.';
-$txt['core_settings_item_ih'] = 'Integration Hooks Handling';
-$txt['core_settings_item_ih_desc'] = 'This feature allows you to enable or disable hooks. Since this could stop your forum to work properly use this function only if you know what you are doing';
+$txt['core_settings_item_ih'] = 'Integration Hooks Management';
+$txt['core_settings_item_ih_desc'] = 'This feature allows you to enable or disable any intergartion hooks added by modifications. Changing hooks can prevent your forum from working properly, so use this feature only if you know what you are doing.';
 $txt['core_settings_item_k'] = 'Karma';
 $txt['core_settings_item_k_desc'] = 'Karma is a feature that shows the popularity of a member. Members, if allowed, can \'applaud\' or \'smite\' other members, which is how their popularity is calculated.';
 $txt['core_settings_item_ml'] = 'Moderation, Administration and User Logs';