[task/code-sniffer] Replace spaces with tabs.

PHPBB3-11980
This commit is contained in:
Andreas Fischer 2013-10-30 13:37:29 +01:00
parent 7aa8f6461f
commit ef1f991837
17 changed files with 143 additions and 139 deletions

View file

@ -763,8 +763,8 @@ class acp_board
global $user, $config;
$act_ary = array(
'ACC_DISABLE' => USER_ACTIVATION_DISABLE,
'ACC_NONE' => USER_ACTIVATION_NONE,
'ACC_DISABLE' => USER_ACTIVATION_DISABLE,
'ACC_NONE' => USER_ACTIVATION_NONE,
);
if ($config['email_enable'])
{

View file

@ -480,7 +480,7 @@ class acp_icons
$icons_updated++;
}
}
}
}
$cache->destroy('_icons');

View file

@ -647,8 +647,8 @@ class acp_users
while ($row = $db->sql_fetchrow($result))
{
if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved']
&& $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved']
&& $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted'])
&& $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved']
&& $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted'])
{
$move_topic_ary[] = $row['topic_id'];
}

View file

@ -26,7 +26,6 @@ class captcha
var $width = 360;
var $height = 96;
/**
* Create the image containing $code with a seed of $seed
*/
@ -69,7 +68,6 @@ class captcha
$bounding_boxes[$i] = $box;
}
// Redistribute leftover x-space
$offset = array();
for ($i = 0; $i < $code_len; ++$i)
@ -99,12 +97,12 @@ class captcha
imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour);
}
}
if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid']))
{
$this->wave($img);
}
if ($config['captcha_gd_3d_noise'])
{
$xoffset = mt_rand(0,9);
@ -127,6 +125,7 @@ class captcha
$xoffset += $dimm[2];
}
}
$xoffset = 5;
for ($i = 0; $i < $code_len; ++$i)
{
@ -137,14 +136,17 @@ class captcha
$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
}
if ($config['captcha_gd_wave'])
{
$this->wave($img);
}
if ($config['captcha_gd_foreground_noise'])
{
$this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours);
}
// Send image
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
@ -233,7 +235,6 @@ class captcha
imagesetthickness($img, 1);
}
function captcha_noise_bg_bitmaps()
{
return array(

View file

@ -86,7 +86,7 @@ class captcha
$fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120));
$colors = array();
$colors = array();
$minr = mt_rand(20, 30);
$ming = mt_rand(20, 30);

View file

@ -823,7 +823,7 @@ function get_avatar_dim($src, $axis, $func = false, $arg1 = false, $arg2 = false
break;
case AVATAR_REMOTE:
// see notes on this functions usage and (hopefully) model $func to avoid this accordingly
// see notes on this functions usage and (hopefully) model $func to avoid this accordingly
return get_remote_avatar_dim($src, $axis);
break;
@ -1297,7 +1297,7 @@ function restore_config($schema)
$src_ary = $schema['array_name'];
$config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : '';
}
}
}
if ($config_value !== '')
{

View file

@ -269,7 +269,7 @@ function view_folder($id, $mode, $folder_id, $folder)
// There is the chance that all recipients of the message got deleted. To avoid creating
// exports without recipients, we add a bogus "undisclosed recipient".
if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) &&
!(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u'])))
!(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u'])))
{
$address[$message_id]['u'] = array();
$address[$message_id]['u']['to'] = array();

View file

@ -47,7 +47,7 @@ class class_loader
* @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface.
*/
public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null)
{
{
if ($namespace[0] !== '\\')
{
$namespace = '\\' . $namespace;

View file

@ -74,8 +74,8 @@ class datetime extends \DateTime
* finally check that relative dates are supported by the language pack
*/
if ($delta <= 3600 && $delta > -60 &&
($delta >= -5 || (($now_ts / 60) % 60) == (($timestamp / 60) % 60))
&& isset($this->user->lang['datetime']['AGO']))
($delta >= -5 || (($now_ts / 60) % 60) == (($timestamp / 60) % 60))
&& isset($this->user->lang['datetime']['AGO']))
{
return $this->user->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
}

View file

@ -13,50 +13,50 @@ use Symfony\Component\EventDispatcher\Event;
class data extends Event implements \ArrayAccess
{
private $data;
private $data;
public function __construct(array $data = array())
{
$this->set_data($data);
}
public function __construct(array $data = array())
{
$this->set_data($data);
}
public function set_data(array $data = array())
{
$this->data = $data;
}
public function set_data(array $data = array())
{
$this->data = $data;
}
public function get_data()
{
return $this->data;
}
public function get_data()
{
return $this->data;
}
/**
* Returns data filtered to only include specified keys.
*
* This effectively discards any keys added to data by hooks.
*/
public function get_data_filtered($keys)
{
return array_intersect_key($this->data, array_flip($keys));
}
/**
* Returns data filtered to only include specified keys.
*
* This effectively discards any keys added to data by hooks.
*/
public function get_data_filtered($keys)
{
return array_intersect_key($this->data, array_flip($keys));
}
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
}

View file

@ -139,7 +139,7 @@ class metadata_manager
if (!file_exists($this->metadata_file))
{
throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
}
}
@ -158,12 +158,12 @@ class metadata_manager
{
if (!($file_contents = file_get_contents($this->metadata_file)))
{
throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
}
if (($metadata = json_decode($file_contents, true)) === null)
{
throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
}
$this->metadata = $metadata;
@ -191,50 +191,50 @@ class metadata_manager
* @return Bool True if valid, throws an exception if invalid
*/
public function validate($name = 'display')
{
// Basic fields
$fields = array(
'name' => '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#',
'type' => '#^phpbb-extension$#',
'licence' => '#.+#',
'version' => '#.+#',
);
{
// Basic fields
$fields = array(
'name' => '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#',
'type' => '#^phpbb-extension$#',
'licence' => '#.+#',
'version' => '#.+#',
);
switch ($name)
{
case 'all':
$this->validate('display');
switch ($name)
{
case 'all':
$this->validate('display');
$this->validate_enable();
break;
break;
case 'display':
foreach ($fields as $field => $data)
case 'display':
foreach ($fields as $field => $data)
{
$this->validate($field);
}
$this->validate_authors();
break;
break;
default:
if (isset($fields[$name]))
{
if (!isset($this->metadata[$name]))
{
throw new \phpbb\extension\exception("Required meta field '$name' has not been set.");
default:
if (isset($fields[$name]))
{
if (!isset($this->metadata[$name]))
{
throw new \phpbb\extension\exception("Required meta field '$name' has not been set.");
}
if (!preg_match($fields[$name], $this->metadata[$name]))
{
throw new \phpbb\extension\exception("Meta field '$name' is invalid.");
throw new \phpbb\extension\exception("Meta field '$name' is invalid.");
}
}
break;
}
return true;
}
}
/**
* Validates the contents of the authors field
@ -245,14 +245,14 @@ class metadata_manager
{
if (empty($this->metadata['authors']))
{
throw new \phpbb\extension\exception("Required meta field 'authors' has not been set.");
throw new \phpbb\extension\exception("Required meta field 'authors' has not been set.");
}
foreach ($this->metadata['authors'] as $author)
{
if (!isset($author['name']))
{
throw new \phpbb\extension\exception("Required meta field 'author name' has not been set.");
throw new \phpbb\extension\exception("Required meta field 'author name' has not been set.");
}
}

View file

@ -254,8 +254,7 @@ class manager
SET notification_read = 1
WHERE notification_time <= " . (int) $time .
(($notification_type_name !== false) ? ' AND ' .
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name))
: '') .
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') .
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') .
(($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '');
$this->db->sql_query($sql);
@ -277,8 +276,7 @@ class manager
SET notification_read = 1
WHERE notification_time <= " . (int) $time .
(($notification_type_name !== false) ? ' AND ' .
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name))
: '') .
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') .
(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
$this->db->sql_query($sql);

View file

@ -1180,8 +1180,8 @@ class fulltext_native extends \phpbb\search\base
* we know that it will also be lower than CJK ranges
*/
if ((strncmp($word, UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, UTF8_HANGUL_LAST, 3) > 0)
&& (strncmp($word, UTF8_CJK_FIRST, 3) < 0 || strncmp($word, UTF8_CJK_LAST, 3) > 0)
&& (strncmp($word, UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, UTF8_CJK_B_LAST, 4) > 0))
&& (strncmp($word, UTF8_CJK_FIRST, 3) < 0 || strncmp($word, UTF8_CJK_LAST, 3) > 0)
&& (strncmp($word, UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, UTF8_CJK_B_LAST, 4) > 0))
{
$word = strtok(' ');
continue;
@ -1675,8 +1675,8 @@ class fulltext_native extends \phpbb\search\base
$pos += $utf_len;
if (($utf_char >= UTF8_HANGUL_FIRST && $utf_char <= UTF8_HANGUL_LAST)
|| ($utf_char >= UTF8_CJK_FIRST && $utf_char <= UTF8_CJK_LAST)
|| ($utf_char >= UTF8_CJK_B_FIRST && $utf_char <= UTF8_CJK_B_LAST))
|| ($utf_char >= UTF8_CJK_FIRST && $utf_char <= UTF8_CJK_LAST)
|| ($utf_char >= UTF8_CJK_B_FIRST && $utf_char <= UTF8_CJK_B_LAST))
{
/**
* All characters within these ranges are valid

View file

@ -40,11 +40,11 @@ class extension extends \Twig_Extension
return 'phpbb';
}
/**
* Returns the token parser instance to add to the existing list.
*
* @return array An array of Twig_TokenParser instances
*/
/**
* Returns the token parser instance to add to the existing list.
*
* @return array An array of Twig_TokenParser instances
*/
public function getTokenParsers()
{
return array(
@ -58,36 +58,36 @@ class extension extends \Twig_Extension
);
}
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
public function getFilters()
{
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
public function getFilters()
{
return array(
new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
new \Twig_SimpleFilter('addslashes', 'addslashes'),
);
}
}
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
*/
public function getFunctions()
{
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
*/
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('lang', array($this, 'lang')),
);
}
/**
* Returns a list of operators to add to the existing list.
*
* @return array An array of operators
*/
/**
* Returns a list of operators to add to the existing list.
*
* @return array An array of operators
*/
public function getOperators()
{
return array(
@ -118,19 +118,19 @@ class extension extends \Twig_Extension
'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
),
);
}
}
/**
* Grabs a subset of a loop
*
* @param Twig_Environment $env A Twig_Environment instance
* @param mixed $item A variable
* @param integer $start Start of the subset
* @param integer $end End of the subset
* @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array)
*
* @return mixed The sliced variable
*/
* Grabs a subset of a loop
*
* @param Twig_Environment $env A Twig_Environment instance
* @param mixed $item A variable
* @param integer $start Start of the subset
* @param integer $end End of the subset
* @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array)
*
* @return mixed The sliced variable
*/
function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
{
// We do almost the same thing as Twig's slice (array_slice), except when $end is positive

View file

@ -49,10 +49,10 @@ class event extends \Twig_Node
// templates on page load rather than at compile. This is
// slower, but makes developing extensions easier (no need to
// purge the cache when a new event template file is added)
$compiler
->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
->indent()
;
$compiler
->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
->indent()
;
}
if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
@ -71,7 +71,7 @@ class event extends \Twig_Node
{
$compiler
->outdent()
->write("}\n\n")
->write("}\n\n")
;
}
}

View file

@ -45,5 +45,5 @@ class php extends \Twig_TokenParser
public function getTag()
{
return 'PHP';
}
}
}

View file

@ -381,7 +381,7 @@ if ($mode == 'delete' || $mode == 'soft_delete')
if ($mode == 'bump')
{
if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])
&& check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))
&& check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))
{
$meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time);
meta_refresh(3, $meta_url);
@ -817,8 +817,13 @@ if ($submit || $preview || $refresh)
// We make sure nobody else made exactly the same change
// we're about to submit by also checking $message_md5 != $post_data['post_checksum']
if (($edit_post_message_checksum !== '' && $edit_post_message_checksum != $post_data['post_checksum'] && $message_md5 != $post_data['post_checksum'])
|| ($edit_post_subject_checksum !== '' && $edit_post_subject_checksum != $post_data['post_subject_md5'] && md5($post_data['post_subject']) != $post_data['post_subject_md5']))
if ($edit_post_message_checksum !== '' &&
$edit_post_message_checksum != $post_data['post_checksum'] &&
$message_md5 != $post_data['post_checksum']
||
$edit_post_subject_checksum !== '' &&
$edit_post_subject_checksum != $post_data['post_subject_md5'] &&
md5($post_data['post_subject']) != $post_data['post_subject_md5'])
{
if (topic_review($topic_id, $forum_id, 'post_review_edit', $post_id))
{