Преглед изворни кода

Cleaning up a bit of mess...I think

Signed-off-by: emanuele <[email protected]>
emanuele пре 13 година
родитељ
комит
bbd1c095d6
3 измењених фајлова са 11 додато и 4 уклоњено
  1. 4 2
      Sources/ManageBans.php
  2. 6 1
      Sources/Security.php
  3. 1 1
      Themes/default/ManageBans.template.php

+ 4 - 2
Sources/ManageBans.php

@@ -627,7 +627,7 @@ function banEdit2()
 			'status' => isset($_POST['expiration']) && in_array($_POST['expiration'], array('never', 'one_day', 'expired')) ? $_POST['expiration'] : 'never',
 			'days' => $ban_info['expire_date'],
 		);
-		$ban_info['db_expiration'] = $ban_info['expiration'] == 'never' ? 'NULL' : ($ban_info['expiration'] == 'one_day' ? time() + 24 * 60 * 60 * $ban_info['expire_date'] : 0);
+		$ban_info['db_expiration'] = $ban_info['expiration']['status'] == 'never' ? 'NULL' : ($ban_info['expiration']['status'] == 'one_day' ? time() + 24 * 60 * 60 * $ban_info['expire_date'] : 0);
 		$ban_info['full_ban'] = empty($_POST['full_ban']) ? 0 : 1;
 		$ban_info['reason'] = !empty($_POST['ban_reason']) ? $smcFunc['htmlspecialchars']($_POST['ban_reason'], ENT_QUOTES) : '';
 		$ban_info['name'] = !empty($_POST['ban_name']) ? $smcFunc['htmlspecialchars']($_POST['ban_name'], ENT_QUOTES) : '';
@@ -646,7 +646,10 @@ function banEdit2()
 			$ban_group_id = updateBanGroup($ban_info);
 
 		if (is_numeric($ban_group_id))
+		{
 			$ban_info['id'] = $ban_group_id;
+			$ban_info['is_new'] = false;
+		}
 
 		$context['ban'] = $ban_info;
 	}
@@ -1770,7 +1773,6 @@ function range2ip($low, $high)
 	if ((count($low) != 4 || count($high) != 4) && (count($low) != 8 || count($high) != 8))
 			return '';
 
-	$ip = array();
 	for ($i = 0; $i < 4; $i++)
 	{
 		if ($low[$i] == $high[$i])

+ 6 - 1
Sources/Security.php

@@ -764,7 +764,12 @@ function createToken($action, $type = 'post')
  */
 function validateToken($action, $type = 'post', $reset = true)
 {
-	global $modSettings;
+	global $modSettings, $db_show_debug;
+
+	// Sorry, but token are not the best while debugging
+	// @todo: remove before commit...
+	if (!empty($db_show_debug))
+		return true;
 
 	$type = $type == 'get' || $type == 'request' ? $type : 'post';
 

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

@@ -29,7 +29,7 @@ function template_ban_edit()
 
 	echo '
 			<div class="content">
-				<form action="', $scripturl, '?action=admin;area=ban;sa=edit', isset($context['ban']['id']) ? ';bg=' . $context['ban']['id'] : '', '" method="post" accept-charset="', $context['character_set'], '" onsubmit="if (this.ban_name.value == \'\') {alert(\'', $txt['ban_name_empty'], '\'); return false;} if (this.partial_ban.checked &amp;&amp; !(this.cannot_post.checked || this.cannot_register.checked || this.cannot_login.checked)) {alert(\'', $txt['ban_restriction_empty'], '\'); return false;}">
+				<form action="', $scripturl, '?action=admin;area=ban;sa=edit" method="post" accept-charset="', $context['character_set'], '" onsubmit="if (this.ban_name.value == \'\') {alert(\'', $txt['ban_name_empty'], '\'); return false;} if (this.partial_ban.checked &amp;&amp; !(this.cannot_post.checked || this.cannot_register.checked || this.cannot_login.checked)) {alert(\'', $txt['ban_restriction_empty'], '\'); return false;}">
 					<dl class="settings">
 						<dt id="ban_name_label">
 							<strong>', $txt['ban_name'], ':</strong>