Merge pull request #1839 from bantu/task/code-sniffer

More PHP Code Sniffer rules
This commit is contained in:
Nils Adermann 2013-11-01 07:58:18 -07:00
commit e118b4f4c0
206 changed files with 192 additions and 1851 deletions

View file

@ -81,7 +81,7 @@
--standard=build/code_sniffer/ruleset-php-strict.xml --standard=build/code_sniffer/ruleset-php-strict.xml
--ignore=phpBB/phpbb/db/migration/data/v30x/* --ignore=phpBB/phpbb/db/migration/data/v30x/*
phpBB/phpbb" phpBB/phpbb"
dir="." checkreturn="true" passthru="true" /> dir="." returnProperty="retval-php-strict" passthru="true" />
<exec command="phpBB/vendor/bin/phpcs <exec command="phpBB/vendor/bin/phpcs
-s -s
--extensions=php --extensions=php
@ -92,10 +92,20 @@
--ignore=phpBB/includes/sphinxapi.php --ignore=phpBB/includes/sphinxapi.php
--ignore=phpBB/includes/utf/data/* --ignore=phpBB/includes/utf/data/*
--ignore=phpBB/install/data/* --ignore=phpBB/install/data/*
--ignore=phpBB/install/database_update.php
--ignore=phpBB/phpbb/* --ignore=phpBB/phpbb/*
--ignore=phpBB/vendor/* --ignore=phpBB/vendor/*
phpBB" phpBB"
dir="." checkreturn="true" passthru="true" /> dir="." returnProperty="retval-php-legacy" passthru="true" />
<if>
<or>
<not><equals arg1="${retval-php-strict}" arg2="0" /></not>
<not><equals arg1="${retval-php-legacy}" arg2="0" /></not>
</or>
<then>
<fail message="PHP Code Sniffer failed." />
</then>
</if>
</target> </target>
<target name="docs"> <target name="docs">

View file

@ -9,4 +9,7 @@
<!-- All code files MUST use the Unix LF (linefeed) line ending. --> <!-- All code files MUST use the Unix LF (linefeed) line ending. -->
<rule ref="Generic.Files.LineEndings" /> <rule ref="Generic.Files.LineEndings" />
<!-- Tabs MUST be used for indentation -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
</ruleset> </ruleset>

View file

@ -5,9 +5,21 @@
<rule ref="./ruleset-minimum.xml" /> <rule ref="./ruleset-minimum.xml" />
<!-- "for (; bar; )" should be "while (bar)" instead -->
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
<!-- A method MUST not only call its parent -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<!-- The body of each structure MUST be enclosed by braces. --> <!-- The body of each structure MUST be enclosed by braces. -->
<rule ref="Generic.ControlStructures.InlineControlStructure" /> <rule ref="Generic.ControlStructures.InlineControlStructure" />
<!-- There MUST not be more than one statement per line. -->
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
<!-- Call-time pass-by-reference MUST not be used. -->
<rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" />
<!-- Class constants MUST be declared in all upper case with underscore separators. --> <!-- Class constants MUST be declared in all upper case with underscore separators. -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName" /> <rule ref="Generic.NamingConventions.UpperCaseConstantName" />
@ -17,6 +29,15 @@
<!-- Method arguments with default values MUST go at the end of the argument list. --> <!-- Method arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue" /> <rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- In the argument list, there MUST NOT be a space before each comma,
and there MUST be one space after each comma. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" />
<!-- The ?> closing tag MUST be omitted from files containing only PHP. --> <!-- The ?> closing tag MUST be omitted from files containing only PHP. -->
<rule ref="Zend.Files.ClosingTag" /> <rule ref="Zend.Files.ClosingTag" />

View file

@ -34,6 +34,15 @@
<!-- Functions MUST NOT contain multiple empty lines in a row --> <!-- Functions MUST NOT contain multiple empty lines in a row -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" /> <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
<!-- Classes etc. MUST be namespaced -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<!-- A file MUST not contain more than one class/interface -->
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses" />
<!-- Files containing classes MUST not have any side-effects -->
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols" />
<!-- When present, all use declarations MUST go after the namespace declaration. <!-- When present, all use declarations MUST go after the namespace declaration.
There MUST be one use keyword per declaration. There MUST be one use keyword per declaration.
There MUST be one blank line after the use block. --> There MUST be one blank line after the use block. -->

View file

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

View file

@ -1117,7 +1117,7 @@ function words_unique(&$words)
* Adds a user to the specified group and optionally makes them a group leader * Adds a user to the specified group and optionally makes them a group leader
* This function does not create the group if it does not exist and so should only be called after the groups have been created * This function does not create the group if it does not exist and so should only be called after the groups have been created
*/ */
function add_user_group($group_id, $user_id, $group_leader=false) function add_user_group($group_id, $user_id, $group_leader = false)
{ {
global $convert, $phpbb_root_path, $config, $user, $db; global $convert, $phpbb_root_path, $config, $user, $db;

View file

@ -691,7 +691,7 @@ class module
/** /**
* Generate the relevant HTML for an input field and the associated label and explanatory text * Generate the relevant HTML for an input field and the associated label and explanatory text
*/ */
function input_field($name, $type, $value='', $options='') function input_field($name, $type, $value = '', $options = '')
{ {
global $lang; global $lang;
$tpl_type = explode(':', $type); $tpl_type = explode(':', $type);

View file

@ -9,14 +9,6 @@
namespace phpbb\auth; namespace phpbb\auth;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Permission/Auth class * Permission/Auth class
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider; namespace phpbb\auth\provider;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Apache authentication provider for phpBB3 * Apache authentication provider for phpBB3
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider; namespace phpbb\auth\provider;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Base authentication provider class that all other providers should implement * Base authentication provider class that all other providers should implement
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider; namespace phpbb\auth\provider;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Database authentication provider for phpBB3 * Database authentication provider for phpBB3
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider; namespace phpbb\auth\provider;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Database authentication provider for phpBB3 * Database authentication provider for phpBB3
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth; namespace phpbb\auth\provider\oauth;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use OAuth\Common\Consumer\Credentials; use OAuth\Common\Consumer\Credentials;
use OAuth\Common\Http\Uri\Uri; use OAuth\Common\Http\Uri\Uri;

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Base OAuth abstract class that all OAuth services should implement * Base OAuth abstract class that all OAuth services should implement
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Bitly OAuth service * Bitly OAuth service
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* OAuth service exception class * OAuth service exception class
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Facebook OAuth service * Facebook OAuth service
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Google OAuth service * Google OAuth service
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth\service; namespace phpbb\auth\provider\oauth\service;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* OAuth service interface * OAuth service interface
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider\oauth; namespace phpbb\auth\provider\oauth;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use OAuth\OAuth1\Token\StdOAuth1Token; use OAuth\OAuth1\Token\StdOAuth1Token;
use OAuth\Common\Token\TokenInterface; use OAuth\Common\Token\TokenInterface;

View file

@ -9,14 +9,6 @@
namespace phpbb\auth\provider; namespace phpbb\auth\provider;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The interface authentication provider classes have to implement. * The interface authentication provider classes have to implement.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Base class for avatar drivers * Base class for avatar drivers
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Interface for avatar drivers * Interface for avatar drivers
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Handles avatars hosted at gravatar.com * Handles avatars hosted at gravatar.com
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Handles avatars selected from the board gallery * Handles avatars selected from the board gallery
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Handles avatars hosted remotely * Handles avatars hosted remotely
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar\driver; namespace phpbb\avatar\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Handles avatars uploaded to the board * Handles avatars uploaded to the board
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\avatar; namespace phpbb\avatar;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* @package avatar * @package avatar
*/ */

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM for APC * ACM for APC
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* @package acm * @package acm
*/ */

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* An interface that all cache drivers must implement * An interface that all cache drivers must implement
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM for eAccelerator * ACM for eAccelerator
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM File Based Caching * ACM File Based Caching
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!defined('PHPBB_ACM_MEMCACHE_PORT')) if (!defined('PHPBB_ACM_MEMCACHE_PORT'))
{ {
define('PHPBB_ACM_MEMCACHE_PORT', 11211); define('PHPBB_ACM_MEMCACHE_PORT', 11211);

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM Abstract Memory Class * ACM Abstract Memory Class
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM Null Caching * ACM Null Caching
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!defined('PHPBB_ACM_REDIS_PORT')) if (!defined('PHPBB_ACM_REDIS_PORT'))
{ {
define('PHPBB_ACM_REDIS_PORT', 6379); define('PHPBB_ACM_REDIS_PORT', 6379);

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM for WinCache * ACM for WinCache
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache\driver; namespace phpbb\cache\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* ACM for XCache * ACM for XCache
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb\cache; namespace phpbb\cache;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Class for grabbing/handling cached entries * Class for grabbing/handling cached entries
* @package acm * @package acm

View file

@ -9,14 +9,6 @@
namespace phpbb; namespace phpbb;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The class loader resolves class names to file system paths and loads them if * The class loader resolves class names to file system paths and loads them if
* necessary. * necessary.

View file

@ -9,14 +9,6 @@
namespace phpbb\config; namespace phpbb\config;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Configuration container class * Configuration container class
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\config; namespace phpbb\config;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Configuration container class * Configuration container class
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\config; namespace phpbb\config;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Manages configuration options with an arbitrary length value stored in a TEXT * Manages configuration options with an arbitrary length value stored in a TEXT
* column. In constrast to class \phpbb\config\db, values are never cached and * column. In constrast to class \phpbb\config\db, values are never cached and

View file

@ -9,14 +9,6 @@
namespace phpbb; namespace phpbb;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* phpbb_visibility * phpbb_visibility
* Handle fetching and setting the visibility for topics and posts * Handle fetching and setting the visibility for topics and posts

View file

@ -9,14 +9,6 @@
namespace phpbb\controller; namespace phpbb\controller;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Controller exception class * Controller exception class
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\controller; namespace phpbb\controller;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
/** /**

View file

@ -9,14 +9,6 @@
namespace phpbb\controller; namespace phpbb\controller;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Routing\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;

View file

@ -9,14 +9,6 @@
namespace phpbb\controller; namespace phpbb\controller;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View file

@ -9,14 +9,6 @@
namespace phpbb\cron; namespace phpbb\cron;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Cron manager class. * Cron manager class.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task; namespace phpbb\cron\task;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Cron task base class. Provides sensible defaults for cron tasks * Cron task base class. Provides sensible defaults for cron tasks
* and partially implements cron task interface, making writing cron tasks easier. * and partially implements cron task interface, making writing cron tasks easier.

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Prune all forums cron task. * Prune all forums cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Prune one forum cron task. * Prune one forum cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Prune notifications cron task. * Prune notifications cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Queue cron task. Sends email and jabber messages queued by other scripts. * Queue cron task. Sends email and jabber messages queued by other scripts.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Tidy cache cron task. * Tidy cache cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Tidy database cron task. * Tidy database cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Cron task for cleaning plupload's temporary upload directory. * Cron task for cleaning plupload's temporary upload directory.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Tidy search cron task. * Tidy search cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Tidy sessions cron task. * Tidy sessions cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task\core; namespace phpbb\cron\task\core;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Tidy warnings cron task. * Tidy warnings cron task.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task; namespace phpbb\cron\task;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Parametrized cron task interface. * Parametrized cron task interface.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task; namespace phpbb\cron\task;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Cron task interface * Cron task interface
* @package phpBB3 * @package phpBB3

View file

@ -9,14 +9,6 @@
namespace phpbb\cron\task; namespace phpbb\cron\task;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Cron task wrapper class. * Cron task wrapper class.
* Enhances cron tasks with convenience methods that work identically for all tasks. * Enhances cron tasks with convenience methods that work identically for all tasks.

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Database Abstraction Layer * Database Abstraction Layer
* @package dbal * @package dbal

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Firebird/Interbase Database Abstraction Layer * Firebird/Interbase Database Abstraction Layer
* Minimum Requirement is Firebird 2.1 * Minimum Requirement is Firebird 2.1

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* MSSQL Database Abstraction Layer * MSSQL Database Abstraction Layer
* Minimum Requirement is MSSQL 2000+ * Minimum Requirement is MSSQL 2000+

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* MSSQL Database Base Abstraction Layer * MSSQL Database Base Abstraction Layer
* @package dbal * @package dbal

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Unified ODBC functions * Unified ODBC functions
* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere... * Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere...

View file

@ -13,183 +13,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Prior to version 1.1 the SQL Server Native PHP driver didn't support sqlsrv_num_rows, or cursor based seeking so we recall all rows into an array
* and maintain our own cursor index into that array.
*/
class result_mssqlnative
{
public function result_mssqlnative($queryresult = false)
{
$this->m_cursor = 0;
$this->m_rows = array();
$this->m_num_fields = sqlsrv_num_fields($queryresult);
$this->m_field_meta = sqlsrv_field_metadata($queryresult);
while ($row = sqlsrv_fetch_array($queryresult, SQLSRV_FETCH_ASSOC))
{
if ($row !== null)
{
foreach($row as $k => $v)
{
if (is_object($v) && method_exists($v, 'format'))
{
$row[$k] = $v->format("Y-m-d\TH:i:s\Z");
}
}
$this->m_rows[] = $row;//read results into memory, cursors are not supported
}
}
$this->m_row_count = sizeof($this->m_rows);
}
private function array_to_obj($array, &$obj)
{
foreach ($array as $key => $value)
{
if (is_array($value))
{
$obj->$key = new \stdClass();
array_to_obj($value, $obj->$key);
}
else
{
$obj->$key = $value;
}
}
return $obj;
}
public function fetch($mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass')
{
if ($this->m_cursor >= $this->m_row_count || $this->m_row_count == 0)
{
return false;
}
$ret = false;
$arr_num = array();
if ($mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH)
{
foreach($this->m_rows[$this->m_cursor] as $key => $value)
{
$arr_num[] = $value;
}
}
switch ($mode)
{
case SQLSRV_FETCH_ASSOC:
$ret = $this->m_rows[$this->m_cursor];
break;
case SQLSRV_FETCH_NUMERIC:
$ret = $arr_num;
break;
case 'OBJECT':
$ret = $this->array_to_obj($this->m_rows[$this->m_cursor], $o = new $object_class);
break;
case SQLSRV_FETCH_BOTH:
default:
$ret = $this->m_rows[$this->m_cursor] + $arr_num;
break;
}
$this->m_cursor++;
return $ret;
}
public function get($pos, $fld)
{
return $this->m_rows[$pos][$fld];
}
public function num_rows()
{
return $this->m_row_count;
}
public function seek($iRow)
{
$this->m_cursor = min($iRow, $this->m_row_count);
}
public function num_fields()
{
return $this->m_num_fields;
}
public function field_name($nr)
{
$arr_keys = array_keys($this->m_rows[0]);
return $arr_keys[$nr];
}
public function field_type($nr)
{
$i = 0;
$int_type = -1;
$str_type = '';
foreach ($this->m_field_meta as $meta)
{
if ($nr == $i)
{
$int_type = $meta['Type'];
break;
}
$i++;
}
//http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table
switch ($int_type)
{
case SQLSRV_SQLTYPE_BIGINT: $str_type = 'bigint'; break;
case SQLSRV_SQLTYPE_BINARY: $str_type = 'binary'; break;
case SQLSRV_SQLTYPE_BIT: $str_type = 'bit'; break;
case SQLSRV_SQLTYPE_CHAR: $str_type = 'char'; break;
case SQLSRV_SQLTYPE_DATETIME: $str_type = 'datetime'; break;
case SQLSRV_SQLTYPE_DECIMAL/*($precision, $scale)*/: $str_type = 'decimal'; break;
case SQLSRV_SQLTYPE_FLOAT: $str_type = 'float'; break;
case SQLSRV_SQLTYPE_IMAGE: $str_type = 'image'; break;
case SQLSRV_SQLTYPE_INT: $str_type = 'int'; break;
case SQLSRV_SQLTYPE_MONEY: $str_type = 'money'; break;
case SQLSRV_SQLTYPE_NCHAR/*($charCount)*/: $str_type = 'nchar'; break;
case SQLSRV_SQLTYPE_NUMERIC/*($precision, $scale)*/: $str_type = 'numeric'; break;
case SQLSRV_SQLTYPE_NVARCHAR/*($charCount)*/: $str_type = 'nvarchar'; break;
case SQLSRV_SQLTYPE_NTEXT: $str_type = 'ntext'; break;
case SQLSRV_SQLTYPE_REAL: $str_type = 'real'; break;
case SQLSRV_SQLTYPE_SMALLDATETIME: $str_type = 'smalldatetime'; break;
case SQLSRV_SQLTYPE_SMALLINT: $str_type = 'smallint'; break;
case SQLSRV_SQLTYPE_SMALLMONEY: $str_type = 'smallmoney'; break;
case SQLSRV_SQLTYPE_TEXT: $str_type = 'text'; break;
case SQLSRV_SQLTYPE_TIMESTAMP: $str_type = 'timestamp'; break;
case SQLSRV_SQLTYPE_TINYINT: $str_type = 'tinyint'; break;
case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER: $str_type = 'uniqueidentifier'; break;
case SQLSRV_SQLTYPE_UDT: $str_type = 'UDT'; break;
case SQLSRV_SQLTYPE_VARBINARY/*($byteCount)*/: $str_type = 'varbinary'; break;
case SQLSRV_SQLTYPE_VARCHAR/*($charCount)*/: $str_type = 'varchar'; break;
case SQLSRV_SQLTYPE_XML: $str_type = 'xml'; break;
default: $str_type = $int_type;
}
return $str_type;
}
public function free()
{
unset($this->m_rows);
return;
}
}
/** /**
* @package dbal * @package dbal
*/ */

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* MySQL4 Database Abstraction Layer * MySQL4 Database Abstraction Layer
* Compatible with: * Compatible with:

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Abstract MySQL Database Base Abstraction Layer * Abstract MySQL Database Base Abstraction Layer
* @package dbal * @package dbal

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* MySQLi Database Abstraction Layer * MySQLi Database Abstraction Layer
* mysqli-extension has to be compiled with: * mysqli-extension has to be compiled with:
@ -31,7 +23,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
/** /**
* Connect to server * Connect to server
*/ */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false) function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{ {
if (!function_exists('mysqli_connect')) if (!function_exists('mysqli_connect'))
{ {

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Oracle Database Abstraction Layer * Oracle Database Abstraction Layer
* @package dbal * @package dbal

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* PostgreSQL Database Abstraction Layer * PostgreSQL Database Abstraction Layer
* Minimum Requirement is Version 7.3+ * Minimum Requirement is Version 7.3+

View file

@ -9,14 +9,6 @@
namespace phpbb\db\driver; namespace phpbb\db\driver;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Sqlite Database Abstraction Layer * Sqlite Database Abstraction Layer
* Minimum Requirement: 2.8.2+ * Minimum Requirement: 2.8.2+

View file

@ -9,14 +9,6 @@
namespace phpbb\db\migration; namespace phpbb\db\migration;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The migrator is responsible for applying new migrations in the correct order. * The migrator is responsible for applying new migrations in the correct order.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\db\migration; namespace phpbb\db\migration;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Abstract base class for database migrations * Abstract base class for database migrations
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\db; namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The migrator is responsible for applying new migrations in the correct order. * The migrator is responsible for applying new migrations in the correct order.
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\db; namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Collects rows for insert into a database until the buffer size is reached. * Collects rows for insert into a database until the buffer size is reached.
* Then flushes the buffer to the database and starts over again. * Then flushes the buffer to the database and starts over again.

View file

@ -9,14 +9,6 @@
namespace phpbb\db; namespace phpbb\db;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Database Tools for handling cross-db actions such as altering columns, etc. * Database Tools for handling cross-db actions such as altering columns, etc.
* Currently not supported is returning SQL for creating tables. * Currently not supported is returning SQL for creating tables.

View file

@ -9,14 +9,6 @@
namespace phpbb\di\extension; namespace phpbb\di\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

View file

@ -9,14 +9,6 @@
namespace phpbb\di\extension; namespace phpbb\di\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

View file

@ -9,14 +9,6 @@
namespace phpbb\di\extension; namespace phpbb\di\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

View file

@ -9,14 +9,6 @@
namespace phpbb\di\pass; namespace phpbb\di\pass;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

View file

@ -9,14 +9,6 @@
namespace phpbb\di\pass; namespace phpbb\di\pass;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

View file

@ -9,14 +9,6 @@
namespace phpbb\di; namespace phpbb\di;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**

View file

@ -9,14 +9,6 @@
namespace phpbb; namespace phpbb;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class error_collector class error_collector
{ {
var $errors; var $errors;

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
class data extends Event implements \ArrayAccess class data extends Event implements \ArrayAccess

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
/** /**

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class extension_subscriber_loader class extension_subscriber_loader

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent;

View file

@ -9,14 +9,6 @@
namespace phpbb\event; namespace phpbb\event;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent;

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* Exception class for metadata * Exception class for metadata
*/ */

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The interface extension meta classes have to implement to run custom code * The interface extension meta classes have to implement to run custom code
* on enable/disable/purge. * on enable/disable/purge.

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The extension finder provides a simple way to locate files in active extensions * The extension finder provides a simple way to locate files in active extensions
* *

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**

View file

@ -9,14 +9,6 @@
namespace phpbb\extension; namespace phpbb\extension;
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/** /**
* The extension metadata manager validates and gets meta-data for extensions * The extension metadata manager validates and gets meta-data for extensions
* *

Some files were not shown because too many files have changed in this diff Show more