plugins/SpecialAdmin.php
changeset 1249 81b03b3e88d0
parent 1247 30f023a13a71
child 1251 d543689ed2eb
equal deleted inserted replaced
1248:3914c9a95879 1249:81b03b3e88d0
  1168 			$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');');
  1168 			$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');');
  1169 			if ( !$q )
  1169 			if ( !$q )
  1170 				$db->_die();
  1170 				$db->_die();
  1171 			setConfig('file_history', '0');
  1171 			setConfig('file_history', '0');
  1172 		}
  1172 		}
  1173 		if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path'))
  1173 		$path = $_POST['imagemagick_path'];
  1174 		{
  1174 		$result = @file_exists($path) && @is_file($path) && @is_executable($path);
       
  1175 		if ( $path !== getConfig('imagemagick_path', '/usr/bin/convert') )
       
  1176 		{
       
  1177 			if ( !$result )
       
  1178 			{
       
  1179 				echo '<div class="error-box-mini">' . $lang->get('acpup_err_magick_not_found', array('magick_path' => $path)) . '</div>';
       
  1180 			}
       
  1181 				
  1175 			if ( defined('ENANO_DEMO_MODE') )
  1182 			if ( defined('ENANO_DEMO_MODE') )
  1176 				// Hackish but safe.
  1183 				// Hackish but safe.
  1177 				$_POST['imagemagick_path'] = '/usr/bin/convert';
  1184 				$path = '/usr/bin/convert';
  1178 			$old = getConfig('imagemagick_path');
  1185 			$old = getConfig('imagemagick_path', '/usr/bin/convert');
  1179 			$oldnew = "{$old}||{$_POST['imagemagick_path']}";
  1186 			$oldnew = "{$old}||{$path}";
  1180 			$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ',\'' . $db->escape($oldnew) . '\');');
  1187 			$q = $db->sql_query('INSERT INTO ' . table_prefix . 'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ',\'' . $db->escape($oldnew) . '\');');
  1181 			if ( !$q )
  1188 			if ( !$q )
  1182 				$db->_die();
  1189 				$db->_die();
  1183 			setConfig('imagemagick_path', $_POST['imagemagick_path']);
  1190 			setConfig('imagemagick_path', $path);
  1184 		}
       
  1185 		else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') )
       
  1186 		{
       
  1187 			echo '<span style="color: red">' . $lang->get('acpup_err_magick_not_found', array('magick_path' => htmlspecialchars($_POST['imagemagick_path']))) . '</span>';
       
  1188 		}
  1191 		}
  1189 		$max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']);
  1192 		$max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']);
  1190 		if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') )
  1193 		if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') )
  1191 		{
  1194 		{
  1192 			echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>';
  1195 			echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>';
  1207 		<label>
  1210 		<label>
  1208 			<input type="checkbox" name="enable_uploads" <?php if(getConfig('enable_uploads')=='1') echo 'checked="checked"'; ?> />
  1211 			<input type="checkbox" name="enable_uploads" <?php if(getConfig('enable_uploads')=='1') echo 'checked="checked"'; ?> />
  1209 			<b><?php echo $lang->get('acpup_field_enable'); ?></b>
  1212 			<b><?php echo $lang->get('acpup_field_enable'); ?></b>
  1210 		</label>
  1213 		</label>
  1211 	</p>
  1214 	</p>
       
  1215 	<div class="info-box-mini">
       
  1216 	<?php
       
  1217 	// Get the maximum sizes for post and uploaded files, and return the smaller of the two.
       
  1218 	// Ideally, any smart admin would always make upload_max_filesize less than post_max_size, but
       
  1219 	// in practice I've found this is not the case.
       
  1220 	$size = humanize_filesize(min(
       
  1221 					array(
       
  1222 						php_filesize_to_int(ini_get('upload_max_filesize')),
       
  1223 						php_filesize_to_int(ini_get('post_max_size')
       
  1224 					)
       
  1225 				)));
       
  1226 	echo $lang->get('acpup_info_max_server_size', array('size' => $size));
       
  1227 	?>
       
  1228 	</div>
  1212 	<p>
  1229 	<p>
  1213 		<?php echo $lang->get('acpup_field_max_size'); ?>
  1230 		<?php echo $lang->get('acpup_field_max_size'); ?>
  1214 		<input name="max_file_size" onkeyup="if(!this.value.match(/^([0-9\.]+)$/ig)) this.value = this.value.substr(0,this.value.length-1);" value="<?php echo getConfig('max_file_size', '256000'); ?>" />
  1231 		<input name="max_file_size" onkeyup="if(!this.value.match(/^([0-9\.]+)$/ig)) this.value = this.value.substr(0,this.value.length-1);" value="<?php echo getConfig('max_file_size', '256000'); ?>" />
  1215 		<select name="fs_units">
  1232 		<select name="fs_units">
  1216 			<option value="1" selected="selected"><?php echo $lang->get('etc_unit_bytes'); ?></option>
  1233 			<option value="1" selected="selected"><?php echo $lang->get('etc_unit_bytes'); ?></option>