Browse Source

Merge branch 'master' of https://github.com/SimpleMachines/SMF2.1

emanuele 12 years ago
parent
commit
690b0aa553

+ 1 - 1
Sources/Admin.php

@@ -30,7 +30,7 @@ function AdminMain()
 	// Load the language and templates....
 	loadLanguage('Admin');
 	loadTemplate('Admin', 'admin');
-	loadJavascriptFile('admin.js?alp21', array('default_theme' => true), 'admin.js');
+	loadJavascriptFile('admin.js', array('default_theme' => true), 'admin.js');
 
 	// No indexing evil stuff.
 	$context['robot_no_index'] = true;

+ 5 - 5
Sources/Drafts.php

@@ -384,11 +384,11 @@ function DeleteDraft($id_draft, $check = true)
 
 	$smcFunc['db_query']('', '
 		DELETE FROM {db_prefix}user_drafts
-		WHERE draft_id IN ({array_int:draft_id})', ($check ? '
-			AND  id_member = {int:id_member}' : ''), '
+		WHERE id_draft IN ({array_int:id_draft})' . ($check ? '
+			AND  id_member = {int:id_member}' : '') . '
 		LIMIT 1',
 		array (
-			'draft_id' => $id_draft,
+			'id_draft' => $id_draft,
 			'id_member' => empty($user_info['id']) ? -1 : $user_info['id'],
 		)
 	);
@@ -667,8 +667,8 @@ function showPMDrafts($memID = -1)
 	if (!empty($_REQUEST['id_draft']) && !empty($context['drafts_pm_save']) && $memID == $user_info['id'])
 	{
 		checkSession('get');
-		$draft_id = (int) $_REQUEST['id_draft'];
-		redirectexit('action=pm;sa=send;id_draft=' . $draft_id);
+		$id_draft = (int) $_REQUEST['id_draft'];
+		redirectexit('action=pm;sa=send;id_draft=' . $id_draft);
 	}
 
 	// Default to 10.

+ 28 - 28
Sources/Load.php

@@ -1714,17 +1714,17 @@ function loadTheme($id_theme = 0, $initialize = true)
 	if (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'cdn')
 		loadJavascriptFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), 'jquery');
 	elseif (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'local')
-		loadJavascriptFile('jquery-1.7.1.min.js', array('default_theme' => true), 'jquery');
+		loadJavascriptFile('jquery-1.7.1.min.js', array('default_theme' => true, 'seed' => false), 'jquery');
 	// Auto loading? template_javascript() will take care of the local half of this.
 	else
 		loadJavascriptFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), 'jquery');
 
 	// Queue our JQuery plugins!
-	loadJavascriptFile('smf_jquery_plugins.js?alp21', array('default_theme' => true), 'jquery_plugins');
+	loadJavascriptFile('smf_jquery_plugins.js', array('default_theme' => true));
 
 	// script.js and theme.js, always required, so always add them! Makes index.template.php cleaner and all.
-	loadJavascriptFile('script.js?alp21', array('default_theme' => true), 'smf_scripts');
-	loadJavascriptFile('theme.js?alp21', array(), 'theme_scripts');
+	loadJavascriptFile('script.js', array('default_theme' => true), 'smf_scripts');
+	loadJavascriptFile('theme.js', array(), 'theme_scripts');
 
 	// If we think we have mail to send, let's offer up some possibilities... robots get pain (Now with scheduled task support!)
 	if ((!empty($modSettings['mail_next_send']) && $modSettings['mail_next_send'] < time() && empty($modSettings['mail_queue_use_cron'])) || empty($modSettings['next_task_time']) || $modSettings['next_task_time'] < time())
@@ -1896,8 +1896,8 @@ function loadSubTemplate($sub_template_name, $fatal = false)
  * Add a CSS file for output later
  *
  * @param string $filename
- * @param array $options
- * Options are the following:
+ * @param array $params
+ * Keys are the following:
  * 	- ['local'] (true/false): define if the file is local
  * 	- ['default_theme'] (true/false): force use of default theme url
  * 	- ['force_current'] (true/false): if this is false, we will attempt to load the file from the default theme if not found in the current theme
@@ -1905,45 +1905,45 @@ function loadSubTemplate($sub_template_name, $fatal = false)
  *  - ['seed'] (true/false/string): if true or null, use cache stale, false do not, or used a supplied string
  * @param string $id
  */
-function loadCSSFile($filename, $options = array(), $id = '')
+function loadCSSFile($filename, $params = array(), $id = '')
 {
 	global $settings, $context;
 
-	$options['seed'] = (!isset($options['seed']) || $options['seed'] === true) ? '?alph21' : (is_string($options['seed']) ? ($options['seed'] = $options['seed'][0] === '?' ? $options['seed'] : '?' . $options['seed']) : '');
-	$options['force_current'] = !empty($options['force_current']) ? $options['force_current'] : false;
-	$theme = !empty($options['default_theme']) ? 'default_theme' : 'theme';
+	$params['seed'] = (!isset($params['seed']) || $params['seed'] === true) ? '?alph21' : (is_string($params['seed']) ? ($params['seed'] = $params['seed'][0] === '?' ? $params['seed'] : '?' . $params['seed']) : '');
+	$params['force_current'] = !empty($params['force_current']) ? $params['force_current'] : false;
+	$theme = !empty($params['default_theme']) ? 'default_theme' : 'theme';
 	
 	// account for shorthand like admin.css?alp21 filenames
 	$has_seed = strpos($filename, '.css?');
 	$id = empty($id) ? strtr(basename($filename), '?', '_') : $id;
 
 	// Is this a local file?
-	if (strpos($filename, 'http') === false || !empty($options['local']))
+	if (strpos($filename, 'http') === false || !empty($params['local']))
 	{
 		// Are we validating the the file exists?
-		if (!empty($options['validate']) && !file_exists($settings[$theme . '_dir'] . '/css/' . $filename))
+		if (!empty($params['validate']) && !file_exists($settings[$theme . '_dir'] . '/css/' . $filename))
 		{
 			// Maybe the default theme has it?
-			if ($theme === 'theme' && !$options['force_current'] && file_exists($settings['default_theme_dir'] . '/' . $filename))
-				$filename = $settings['default_theme_url'] . '/css/' . $filename . ($has_seed ? '' : $options['seed']);
+			if ($theme === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'] . '/' . $filename))
+				$filename = $settings['default_theme_url'] . '/css/' . $filename . ($has_seed ? '' : $params['seed']);
 			else
 				$filename = false;
 		}
 		else
-			$filename = $settings[$theme . '_url'] . '/css/' . $filename . ($has_seed ? '' : $options['seed']);
+			$filename = $settings[$theme . '_url'] . '/css/' . $filename . ($has_seed ? '' : $params['seed']);
 	}
 
 	// Add it to the array for use in the template
 	if (!empty($filename))
-		$context['css_files'][$id] = array('filename' => $filename, 'options' => $options);
+		$context['css_files'][$id] = array('filename' => $filename, 'options' => $params);
 }
 
 /**
  * Add a Javascript file for output later
  
  * @param string $filename
- * @param array $options
- * Options are the following:
+ * @param array $params
+ * Keys are the following:
  * 	- ['local'] (true/false): define if the file is local
  * 	- ['default_theme'] (true/false): force use of default theme url
  * 	- ['defer'] (true/false): define if the file should load in <head> or before the closing <html> tag
@@ -1955,37 +1955,37 @@ function loadCSSFile($filename, $options = array(), $id = '')
  *
  * @param string $id
  */
-function loadJavascriptFile($filename, $options = array(), $id = '')
+function loadJavascriptFile($filename, $params = array(), $id = '')
 {
 	global $settings, $context;
 
-	$options['seed'] = (!isset($options['seed']) || $options['seed'] === true) ? '?alph21' : (is_string($options['seed']) ? ($options['seed'] = $options['seed'][0] === '?' ? $options['seed'] : '?' . $options['seed']) : '');
-	$options['force_current'] = !empty($options['force_current']) ? $options['force_current'] : false;
-	$theme = !empty($options['default_theme']) ? 'default_theme' : 'theme';
+	$params['seed'] = (!isset($params['seed']) || $params['seed'] === true) ? '?alph21' : (is_string($params['seed']) ? ($params['seed'] = $params['seed'][0] === '?' ? $params['seed'] : '?' . $params['seed']) : '');
+	$params['force_current'] = !empty($params['force_current']) ? $params['force_current'] : false;
+	$theme = !empty($params['default_theme']) ? 'default_theme' : 'theme';
 	
 	// account for shorthand like admin.js?alp21 filenames
 	$has_seed = strpos($filename, '.js?');
 	$id = empty($id) ? strtr(basename($filename), '?', '_') : $id;
 
 	// Is this a local file?
-	if (strpos($filename, 'http') === false || !empty($options['local']))
+	if (strpos($filename, 'http') === false || !empty($params['local']))
 	{
 		// Are we validating it exists on disk?
-		if (!empty($options['validate']) && !file_exists($settings[$theme . '_dir'] . '/scripts/' . $filename))
+		if (!empty($params['validate']) && !file_exists($settings[$theme . '_dir'] . '/scripts/' . $filename))
 		{
 			// can't find it in this theme, how about the default?
-			if ($theme === 'theme' && !$options['force_current'] && file_exists($settings['default_theme_dir'] . '/' . $filename))
-				$filename = $settings['default_theme_url'] . '/scripts/' . $filename . ($has_seed ? '' : $options['seed']);
+			if ($theme === 'theme' && !$params['force_current'] && file_exists($settings['default_theme_dir'] . '/' . $filename))
+				$filename = $settings['default_theme_url'] . '/scripts/' . $filename . ($has_seed ? '' : $params['seed']);
 			else
 				$filename = false;
 		}
 		else
-			$filename = $settings[$theme . '_url'] . '/scripts/' . $filename . ($has_seed ? '' : $options['seed']);
+			$filename = $settings[$theme . '_url'] . '/scripts/' . $filename . ($has_seed ? '' : $params['seed']);
 	}
 
 	// Add it to the array for use in the template
 	if (!empty($filename))
-		$context['javascript_files'][$id] = array('filename' => $filename, 'options' => $options);
+		$context['javascript_files'][$id] = array('filename' => $filename, 'options' => $params);
 }
 
 /**

+ 2 - 2
Sources/ManageMaintenance.php

@@ -1904,10 +1904,10 @@ function MaintainRemoveOldDrafts()
 	);
 
 	while ($row = $smcFunc['db_fetch_row']($request))
-		$drafts[] = $row[0];
+		$drafts[] = (int) $row[0];
 	$smcFunc['db_free_result']($request);
 
-	// If we have old one, remove them
+	// If we have old drafts, remove them
 	if (count($drafts) > 0)
 	{
 		require_once($sourcedir . '/Drafts.php');

+ 1 - 1
Sources/ModerationCenter.php

@@ -213,7 +213,7 @@ function ModerationHome()
 	global $txt, $context, $scripturl, $modSettings, $user_info, $user_settings;
 
 	loadTemplate('ModerationCenter');
-	loadJavascriptFile('admin.js?alp21', array('default_theme' => true), 'admin.js');
+	loadJavascriptFile('admin.js', array('default_theme' => true), 'admin.js');
 
 	$context['page_title'] = $txt['moderation_center'];
 	$context['sub_template'] = 'moderation_center';

+ 1 - 1
Sources/Packages.php

@@ -645,7 +645,7 @@ function PackageInstallTest()
 		if (empty($thisAction))
 			continue;
 
-		if (!file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']))
+		if (isset($action['filename']) && !file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']))
 		{
 			$context['has_failure'] = true;
 

+ 1 - 1
Sources/ScheduledTasks.php

@@ -1747,7 +1747,7 @@ function scheduled_remove_old_drafts()
 	);
 
 	while ($row = $smcFunc['db_fetch_row']($request))
-		$drafts[] = $row[0];
+		$drafts[] = (int) $row[0];
 	$smcFunc['db_free_result']($request);
 
 	// If we have old one, remove them

+ 4 - 4
Sources/Subs-Editor.php

@@ -1472,9 +1472,9 @@ function create_control_richedit($editorOptions)
 		loadTemplate('GenericControls', 'jquery.sceditor');
 
 		// JS makes the editor go round
-		loadJavascriptFile($settings['default_theme_url'] . '/scripts/editor.js?alp21', array(), 'editor.js');
-		loadJavascriptFile($settings['default_theme_url'] . '/scripts/jquery.sceditor.js?alp21', array());
-		loadJavascriptFile($settings['default_theme_url'] . '/scripts/jquery.sceditor.bbcode.js?alp21', array());
+		loadJavascriptFile('editor.js', array('default_theme' => true), 'smf_editor');
+		loadJavascriptFile('jquery.sceditor.js', array('default_theme' => true));
+		loadJavascriptFile('jquery.sceditor.bbcode.js', array('default_theme' => true));
 		addInlineJavascript('
 		var smf_smileys_url = \'' . $settings['smileys_url'] . '\';
 		var bbc_quote_from = \'' . addcslashes($txt['quote_from'], "'") . '\';
@@ -1487,7 +1487,7 @@ function create_control_richedit($editorOptions)
 		$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
 		if ($context['show_spellchecking'])
 		{
-			loadJavascriptFile($settings['default_theme_url'] . '/scripts/spellcheck.js?alp21', array());
+			loadJavascriptFile('spellcheck.js', array('default_theme' => true));
 
 			// Some hidden information is needed in order to make the spell checking work.
 			if (!isset($_REQUEST['xml']))

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

@@ -34,7 +34,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 				$("#', $editor_id, '").sceditorBBCodePlugin({
 					style: "', $settings['default_theme_url'], '/css/jquery.sceditor.default.css",
 					emoticonsCompat: true,
-					supportedWysiwyg: (is_ie || is_ff || is_opera95up || is_safari || is_chrome),',
+					supportedWysiwyg: (is_ie || is_ff || is_opera || is_safari || is_chrome),',
 					!empty($editor_context['locale']) ? '
 					locale: \'' . $editor_context['locale'] . '\',' : '', '
 					colors: "black,red,yellow,pink,green,orange,purple,blue,beige,brown,teal,navy,maroon,limegreen,white"';
@@ -102,7 +102,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 				$(".sceditor-container").width("100%").height("100%");',
 				$editor_context['rich_active'] ? '' : '
 				$("#' . $editor_id . '").data("sceditor").setTextMode();', '
-				if (!(is_ie || is_ff || is_opera95up || is_safari || is_chrome))
+				if (!(is_ie || is_ff || is_opera || is_safari || is_chrome))
 				{
 					$("#' . $editor_id . '").data("sceditor").setTextMode();
 					$(".sceditor-button-source").hide();