Browse Source

! Moving drafts around a bit, getting it in the search function too.

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 10 years ago
parent
commit
6e8f5a4232

+ 3 - 8
Sources/Admin.php

@@ -200,15 +200,9 @@ function AdminMain()
 						'bbc' => array($txt['manageposts_bbc_settings']),
 						'censor' => array($txt['admin_censored_words']),
 						'topics' => array($txt['manageposts_topic_settings']),
+						'drafts' => array($txt['manage_drafts']),
 					),
 				),
-				'managedrafts' => array(
-					'label' => $txt['manage_drafts'],
-					'file' => 'Drafts.php',
-					'function' => 'ModifyDraftSettings',
-					'icon' => 'drafts.png',
-					'permission' => array('admin_forum'),
-				),
 				'managecalendar' => array(
 					'label' => $txt['manage_calendar'],
 					'file' => 'ManageCalendar.php',
@@ -683,7 +677,7 @@ function AdminSearchInternal()
 	// Load a lot of language files.
 	$language_files = array(
 		'Help', 'ManageMail', 'ManageSettings', 'ManageCalendar', 'ManageBoards', 'ManagePaid', 'ManagePermissions', 'Search',
-		'Login', 'ManageSmileys',
+		'Login', 'ManageSmileys', 'Drafts',
 	);
 
 	// All the files we need to include.
@@ -713,6 +707,7 @@ function AdminSearchInternal()
 		array('ModifyPostSettings', 'area=postsettings;sa=posts'),
 		array('ModifyBBCSettings', 'area=postsettings;sa=bbc'),
 		array('ModifyTopicSettings', 'area=postsettings;sa=topics'),
+		array('ModifyDraftSettings', 'area=postsettings;sa=drafts'),
 		array('EditSearchSettings', 'area=managesearch;sa=settings'),
 		array('EditSmileySettings', 'area=smileys;sa=settings'),
 		array('ModifyGeneralSettings', 'area=serversettings;sa=general'),

+ 0 - 86
Sources/Drafts.php

@@ -832,90 +832,4 @@ function showPMDrafts($memID = -1)
 	);
 }
 
-/**
- * Modify any setting related to drafts.
- * Requires the admin_forum permission.
- * Accessed from ?action=admin;area=managedrafts
- *
- * @param bool $return_config = false
- * @uses Admin template, edit_topic_settings sub-template.
- */
-function ModifyDraftSettings($return_config = false)
-{
-	global $context, $txt, $sourcedir, $scripturl, $smcFunc;
-
-	isAllowedTo('admin_forum');
-
-	// Here are all the draft settings, a bit lite for now, but we can add more :P
-	$config_vars = array(
-		// Draft settings ...
-		array('check', 'drafts_post_enabled'),
-		array('check', 'drafts_pm_enabled'),
-		array('check', 'drafts_show_saved_enabled', 'subtext' => $txt['drafts_show_saved_enabled_subnote']),
-		array('int', 'drafts_keep_days', 'postinput' => $txt['days_word'], 'subtext' => $txt['drafts_keep_days_subnote']),
-		'',
-		array('check', 'drafts_autosave_enabled', 'subtext' => $txt['drafts_autosave_enabled_subnote']),
-		array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']),
-	);
-
-	if ($return_config)
-		return $config_vars;
-
-	// Get the settings template ready.
-	require_once($sourcedir . '/ManageServer.php');
-
-	// Setup the template.
-	$context['page_title'] = $txt['managedrafts_settings'];
-	$context['sub_template'] = 'show_settings';
-	$context[$context['admin_menu_name']]['tab_data'] = array(
-		'title' => $txt['drafts'],
-		'help' => '',
-		'description' => $txt['managedrafts_settings_description'],
-	);
-
-	// Saving them ?
-	if (isset($_GET['save']))
-	{
-		checkSession();
-
-		// Protect them from themselves.
-		$_POST['drafts_autosave_frequency'] = !isset($_POST['drafts_autosave_frequency']) || $_POST['drafts_autosave_frequency'] < 30 ? 30 : $_POST['drafts_autosave_frequency'];
-
-		// Also disable the scheduled task if we're not using it.
-		$smcFunc['db_query']('', '
-			UPDATE {db_prefix}scheduled_tasks
-			SET disabled = {int:disabled}
-			WHERE task = {string:task}',
-			array(
-				'disabled' => !empty($_POST['drafts_keep_days']) ? 0 : 1,
-				'task' => 'remove_old_drafts',
-			)
-		);
-		require_once($sourcedir . '/ScheduledTasks.php');
-		CalculateNextTrigger();
-
-		// Save everything else and leave.
-		saveDBSettings($config_vars);
-		redirectexit('action=admin;area=managedrafts');
-	}
-
-	// some javascript to enable / disable the frequency input box
-	$context['settings_post_javascript'] = '
-		function toggle()
-		{
-			$("#drafts_autosave_frequency").prop("disabled", !($("#drafts_autosave_enabled").prop("checked")));
-		};
-		toggle();
-
-		$("#drafts_autosave_enabled").click(function() { toggle(); });
-	';
-
-	// Final settings...
-	$context['post_url'] = $scripturl . '?action=admin;area=managedrafts;save';
-	$context['settings_title'] = $txt['managedrafts_settings'];
-
-	// Prepare the settings...
-	prepareDBSettingContext($config_vars);
-}
-
 ?>

+ 21 - 7
Sources/Karma.php

@@ -156,7 +156,7 @@ function ModifyKarma()
  */
 function BookOfUnknown()
 {
-	global $context;
+	global $context, $scripturl;
 
 	if (strpos($_GET['action'], 'mozilla') !== false && !isBrowser('gecko'))
 		redirectexit('http://www.getfirefox.com/');
@@ -177,21 +177,35 @@ function BookOfUnknown()
 	</head>
 	<body style="background-color: #444455; color: white; font-style: italic; font-family: serif;">
 		<div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">';
-	if (@$_GET['verse'] == '2:18')
+
+	if (!isset($_GET['verse']) || ($_GET['verse'] != '2:18' && $_GET['verse'] != '22:1-2'))
+		$_GET['verse'] = '4:16';
+
+	if ($_GET['verse'] == '2:18')
 		echo '
 			Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none.&nbsp;And it became to be in those days <em>something</em>.&nbsp; Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind.&nbsp; And thus what was to be known the <em>secret project</em> began into its existence.&nbsp; Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.';
-	else
+	elseif ($_GET['verse'] == '4:16')
 		echo '
 			And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together.&nbsp; Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.';
+	elseif ($_GET['verse'] == '22:1-2')
+		echo '
+			<p>Now <em>behold</em>, that which was once the secret project was <em id="unknown" name="[Unknown]">unknown</em> no longer.&nbsp; Alas, it needed more than <em>only one</em>, but yet even thought otherwise.&nbsp; It became that the opposition <em>rumored</em> and lied, but still to no avail.&nbsp; Their match, though not <em>perfect</em>, had them outdone.</p>
+			<p style="margin: 2ex 1ex 0 1ex; font-size: 1.05em; line-height: 1.5; text-align: center;">Let it continue.&nbsp; <em>The end</em>.</p>';
+
 	echo '
 		</div>
 		<div style="margin-top: 2ex; font-size: 2em; text-align: right;">';
-	if (@$_GET['verse'] == '2:18')
+
+	if ($_GET['verse'] == '2:18')
 		echo '
-			from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
-	else
+			from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=4:16" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
+	elseif ($_GET['verse'] == '4:16')
 		echo '
-			from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
+			from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=22:1-2" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
+	elseif ($_GET['verse'] == '22:1-2')
+		echo '
+			from <span style="font-family: Georgia, serif;"><strong>The Book of Unknown</strong>, 22:1-2</span>';
+
 	echo '
 		</div>
 	</body>

+ 84 - 0
Sources/ManagePosts.php

@@ -30,12 +30,14 @@ function ManagePostSettings()
 
 	// Make sure you can be here.
 	isAllowedTo('admin_forum');
+	loadLanguage('Drafts');
 
 	$subActions = array(
 		'posts' => 'ModifyPostSettings',
 		'bbc' => 'ModifyBBCSettings',
 		'censor' => 'SetCensor',
 		'topics' => 'ModifyTopicSettings',
+		'drafts' => 'ModifyDraftSettings',
 	);
 
 	call_integration_hook('integrate_manage_posts', array(&$subActions));
@@ -63,6 +65,9 @@ function ManagePostSettings()
 			'topics' => array(
 				'description' => $txt['manageposts_topic_settings_description'],
 			),
+			'drafts' => array(
+				'description' => $txt['drafts_show_desc'],
+			),
 		),
 	);
 
@@ -386,4 +391,83 @@ function ModifyTopicSettings($return_config = false)
 	prepareDBSettingContext($config_vars);
 }
 
+/**
+ * Modify any setting related to drafts.
+ * Requires the admin_forum permission.
+ * Accessed from ?action=admin;area=postsettings;sa=drafts
+ *
+ * @param bool $return_config = false
+ * @uses Admin template, edit_topic_settings sub-template.
+ */
+function ModifyDraftSettings($return_config = false)
+{
+	global $context, $txt, $sourcedir, $scripturl, $smcFunc;
+
+	// Here are all the draft settings, a bit lite for now, but we can add more :P
+	$config_vars = array(
+		// Draft settings ...
+		array('check', 'drafts_post_enabled'),
+		array('check', 'drafts_pm_enabled'),
+		array('check', 'drafts_show_saved_enabled', 'subtext' => $txt['drafts_show_saved_enabled_subnote']),
+		array('int', 'drafts_keep_days', 'postinput' => $txt['days_word'], 'subtext' => $txt['drafts_keep_days_subnote']),
+		'',
+		array('check', 'drafts_autosave_enabled', 'subtext' => $txt['drafts_autosave_enabled_subnote']),
+		array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']),
+	);
+
+	if ($return_config)
+		return $config_vars;
+
+	// Get the settings template ready.
+	require_once($sourcedir . '/ManageServer.php');
+
+	// Setup the template.
+	$context['page_title'] = $txt['managedrafts_settings'];
+	$context['sub_template'] = 'show_settings';
+
+	// Saving them ?
+	if (isset($_GET['save']))
+	{
+		checkSession();
+
+		// Protect them from themselves.
+		$_POST['drafts_autosave_frequency'] = !isset($_POST['drafts_autosave_frequency']) || $_POST['drafts_autosave_frequency'] < 30 ? 30 : $_POST['drafts_autosave_frequency'];
+
+		// Also disable the scheduled task if we're not using it.
+		$smcFunc['db_query']('', '
+			UPDATE {db_prefix}scheduled_tasks
+			SET disabled = {int:disabled}
+			WHERE task = {string:task}',
+			array(
+				'disabled' => !empty($_POST['drafts_keep_days']) ? 0 : 1,
+				'task' => 'remove_old_drafts',
+			)
+		);
+		require_once($sourcedir . '/ScheduledTasks.php');
+		CalculateNextTrigger();
+
+		// Save everything else and leave.
+		saveDBSettings($config_vars);
+		redirectexit('action=admin;area=postsettings;sa=drafts');
+	}
+
+	// some javascript to enable / disable the frequency input box
+	$context['settings_post_javascript'] = '
+		function toggle()
+		{
+			$("#drafts_autosave_frequency").prop("disabled", !($("#drafts_autosave_enabled").prop("checked")));
+		};
+		toggle();
+
+		$("#drafts_autosave_enabled").click(function() { toggle(); });
+	';
+
+	// Final settings...
+	$context['post_url'] = $scripturl . '?action=admin;area=postsettings;sa=drafts;save';
+	$context['settings_title'] = $txt['managedrafts_settings'];
+
+	// Prepare the settings...
+	prepareDBSettingContext($config_vars);
+}
+
 ?>

BIN
Themes/default/images/admin/big/drafts.png


BIN
Themes/default/images/admin/drafts.png