Run php-cs-fixer on the code base

This commit is contained in:
Frederic Guillot 2016-04-17 19:44:45 -04:00
parent 427b41f892
commit aaaafb263b
36 changed files with 511 additions and 603 deletions

View File

@ -10,8 +10,7 @@ Router\before(function($action) {
if (! is_null(Request\value('database')) && ! Model\Database\select(Request\value('database'))) {
Model\User\logout();
Response\redirect('?action=login');
}
elseif (! empty($_SESSION['database'])) {
} elseif (! empty($_SESSION['database'])) {
if (! Model\Database\select($_SESSION['database'])) {
Model\User\logout();
Response\redirect('?action=login');
@ -26,8 +25,7 @@ Router\before(function($action) {
Model\User\logout();
Response\redirect('?action=login');
}
}
elseif (Model\RememberMe\has_cookie()) {
} elseif (Model\RememberMe\has_cookie()) {
Model\RememberMe\refresh();
}

View File

@ -27,11 +27,9 @@ Router\post_action('new-db', function() {
list($valid, $errors) = Model\Database\validate($values);
if ($valid) {
if (Model\Database\create(strtolower($values['name']).'.sqlite', $values['username'], $values['password'])) {
Session\flash(t('Database created successfully.'));
}
else {
} else {
Session\flash_error(t('Unable to create the new database.'));
}
@ -126,11 +124,9 @@ Router\post_action('config', function() {
list($valid, $errors) = Model\Config\validate_modification($values);
if ($valid) {
if (Model\Config\save($values)) {
Session\flash(t('Your preferences are updated.'));
}
else {
} else {
Session\flash_error(t('Unable to update your preferences.'));
}
@ -163,8 +159,7 @@ Router\post_action('get-config', function() {
if (empty($options)) {
$return = Model\Config\get_all();
}
else {
} else {
foreach ($options as $name) {
$return[$name] = Model\Config\get($name);
}
@ -234,8 +229,7 @@ Router\post_action('services', function() {
if (Model\Config\save($values)) {
Session\flash(t('Your preferences are updated.'));
}
else {
} else {
Session\flash_error(t('Unable to update your preferences.'));
}

View File

@ -46,8 +46,7 @@ Router\post_action('edit-feed', function() {
if (Model\Feed\update($values)) {
Session\flash(t('Your subscription has been updated.'));
Response\redirect('?action=feeds');
}
else {
} else {
Session\flash_error(t('Unable to edit your subscription.'));
}
}
@ -80,8 +79,7 @@ Router\get_action('remove-feed', function() {
if ($id && Model\Feed\remove($id)) {
Session\flash(t('This subscription has been removed successfully.'));
}
else {
} else {
Session\flash_error(t('Unable to remove this subscription.'));
}
@ -183,34 +181,25 @@ Router\action('subscribe', function() {
$values['feed_group_ids'],
$values['create_group']
);
}
catch (UnexpectedValueException $e) {
} catch (UnexpectedValueException $e) {
$error_message = t('This subscription already exists.');
}
catch (PicoFeed\Client\InvalidCertificateException $e) {
} catch (PicoFeed\Client\InvalidCertificateException $e) {
$error_message = t('Invalid SSL certificate.');
}
catch (PicoFeed\Client\InvalidUrlException $e) {
} catch (PicoFeed\Client\InvalidUrlException $e) {
// picoFeed uses this exception for multiple reasons, but doesn't
// provide an exception code to distinguish what exactly happend here
$error_message = $e->getMessage();
}
catch (PicoFeed\Client\MaxRedirectException $e) {
} catch (PicoFeed\Client\MaxRedirectException $e) {
$error_message = t('Maximum number of HTTP redirections exceeded.');
}
catch (PicoFeed\Client\MaxSizeException $e) {
} catch (PicoFeed\Client\MaxSizeException $e) {
$error_message = t('The content size exceeds to maximum allowed size.');
}
catch (PicoFeed\Client\TimeoutException $e) {
} catch (PicoFeed\Client\TimeoutException $e) {
$error_message = t('Connection timeout.');
}
catch (PicoFeed\Parser\MalformedXmlException $e) {
} catch (PicoFeed\Parser\MalformedXmlException $e) {
$error_message = t('Feed is malformed.');
}
catch (PicoFeed\Reader\SubscriptionNotFoundException $e) {
} catch (PicoFeed\Reader\SubscriptionNotFoundException $e) {
$error_message = t('Unable to find a subscription.');
}
catch (PicoFeed\Reader\UnsupportedFeedFormatException $e) {
} catch (PicoFeed\Reader\UnsupportedFeedFormatException $e) {
$error_message = t('Unable to detect the feed format.');
}
@ -219,8 +208,7 @@ Router\action('subscribe', function() {
if (isset($feed_id) && $feed_id !== false) {
Session\flash(t('Subscription added successfully.'));
Response\redirect('?action=feed-items&feed_id='.$feed_id);
}
else {
} else {
if (! isset($error_message)) {
$error_message = t('Error occured.');
}

View File

@ -162,8 +162,7 @@ Router\get_action('mark-all-read', function() {
if (!is_null($group_id)) {
Model\Item\mark_group_as_read($group_id);
}
else {
} else {
Model\Item\mark_all_as_read();
}

View File

@ -14,8 +14,7 @@ function route($name, Closure $callback = null)
if ($callback !== null) {
$routes[$name] = $callback;
}
else if (isset($routes[$name])) {
} elseif (isset($routes[$name])) {
$routes[$name]();
}
}
@ -59,7 +58,6 @@ route('groups', function() {
$response = auth();
if ($response['auth']) {
$response['groups'] = Group\get_all();
$response['feeds_groups'] = array();
$group_map = Group\get_map();
@ -81,7 +79,6 @@ route('feeds', function() {
$response = auth();
if ($response['auth']) {
$response['feeds'] = array();
$response['feeds_groups'] = array();
@ -117,7 +114,6 @@ route('favicons', function() {
$response = auth();
if ($response['auth']) {
$favicons = Database::getInstance('db')
->table('favicons')
->columns(
@ -145,7 +141,6 @@ route('items', function() {
$response = auth();
if ($response['auth']) {
$query = Database::getInstance('db')
->table('items')
->columns(
@ -163,11 +158,9 @@ route('items', function() {
->neq('status', 'removed');
if (isset($_GET['since_id']) && is_numeric($_GET['since_id'])) {
$items = $query->gt('rowid', $_GET['since_id'])
->asc('rowid');
}
else if (! empty($_GET['with_ids'])) {
} elseif (! empty($_GET['with_ids'])) {
$query->in('rowid', explode(',', $_GET['with_ids']));
}
@ -215,7 +208,6 @@ route('unread_item_ids', function() {
$response = auth();
if ($response['auth']) {
$item_ids = Database::getInstance('db')
->table('items')
->eq('status', 'unread')
@ -233,7 +225,6 @@ route('saved_item_ids', function() {
$response = auth();
if ($response['auth']) {
$item_ids = Database::getInstance('db')
->table('items')
->eq('bookmark', 1)
@ -251,7 +242,6 @@ route('write_items', function() {
$response = auth();
if ($response['auth']) {
$query = Database::getInstance('db')
->table('items')
->eq('rowid', $_POST['id']);
@ -266,14 +256,11 @@ route('write_items', function() {
->findOneColumn('id');
Service\push($item_id);
}
else if ($_POST['as'] === 'unsaved') {
} elseif ($_POST['as'] === 'unsaved') {
$query->update(array('bookmark' => 0));
}
else if ($_POST['as'] === 'read') {
} elseif ($_POST['as'] === 'read') {
$query->update(array('status' => 'read'));
}
else if ($_POST['as'] === 'unread') {
} elseif ($_POST['as'] === 'unread') {
$query->update(array('status' => 'unread'));
}
}
@ -287,7 +274,6 @@ route('write_feeds', function() {
$response = auth();
if ($response['auth']) {
Database::getInstance('db')
->table('items')
->eq('feed_id', $_POST['id'])
@ -323,15 +309,12 @@ foreach (array_keys($_GET) as $action) {
}
if (! empty($_POST['mark']) && ! empty($_POST['as'])
&& ! is_null(filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT, array('options' => array('default' => NULL,'min_range' => -1)))) ){
&& ! is_null(filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT, array('options' => array('default' => null, 'min_range' => -1))))) {
if ($_POST['mark'] === 'item') {
route('write_items');
}
else if ($_POST['mark'] === 'feed' && ! empty($_POST['before'])) {
} elseif ($_POST['mark'] === 'feed' && ! empty($_POST['before'])) {
route('write_feeds');
}
else if ($_POST['mark'] === 'group' && ! empty($_POST['before'])) {
} elseif ($_POST['mark'] === 'group' && ! empty($_POST['before'])) {
route('write_groups');
}
}

View File

@ -2,7 +2,6 @@
namespace Request;
function param($name, $default_value = null)
{
return isset($_GET[$name]) ? $_GET[$name] : $default_value;
@ -25,7 +24,6 @@ function value($name)
function values()
{
if (! empty($_POST)) {
return $_POST;
}

View File

@ -2,7 +2,6 @@
namespace Response;
function force_download($filename)
{
header('Content-Disposition: attachment; filename="'.$filename.'"');
@ -21,8 +20,7 @@ function status($status_code)
if (strpos($sapi_name, 'apache') !== false || $sapi_name === 'cli-server') {
header('HTTP/1.0 '.$status_code);
}
else {
} else {
header('Status: '.$status_code);
}
}
@ -116,20 +114,15 @@ function csp(array $policies = array())
$values = '';
foreach ($policies as $policy => $hosts) {
if (is_array($hosts)) {
$acl = '';
foreach ($hosts as &$host) {
if ($host === '*' || $host === "'self'" || strpos($host, 'http') === 0) {
$acl .= $host.' ';
}
}
}
else {
} else {
$acl = $hosts;
}

View File

@ -20,8 +20,7 @@ function before($value = null)
if (is_callable($value)) {
$before_callback = $value;
}
else if (is_callable($before_callback)) {
} elseif (is_callable($before_callback)) {
$before_callback($value);
}
}
@ -33,8 +32,7 @@ function before_action($name, $value = null)
if (is_callable($value)) {
$callbacks[$name] = $value;
}
else if (isset($callbacks[$name]) && is_callable($callbacks[$name])) {
} elseif (isset($callbacks[$name]) && is_callable($callbacks[$name])) {
$callbacks[$name]($value);
}
}
@ -103,18 +101,15 @@ function delete($url, \Closure $callback)
function find_route($method, $route, \Closure $callback)
{
if ($_SERVER['REQUEST_METHOD'] === $method) {
if (! empty($_SERVER['QUERY_STRING'])) {
$url = substr($_SERVER['REQUEST_URI'], 0, -(strlen($_SERVER['QUERY_STRING']) + 1));
}
else {
} else {
$url = $_SERVER['REQUEST_URI'];
}
$params = array();
if (url_match($route, $url, $params)) {
before($route);
\call_user_func_array($callback, $params);
exit;
@ -125,8 +120,12 @@ function find_route($method, $route, \Closure $callback)
// Parse url and find matches
function url_match($route_uri, $request_uri, array &$params)
{
if ($request_uri === $route_uri) return true;
if ($route_uri === '/' || $request_uri === '/') return false;
if ($request_uri === $route_uri) {
return true;
}
if ($route_uri === '/' || $request_uri === '/') {
return false;
}
$route_uri = trim($route_uri, '/');
$request_uri = trim($request_uri, '/');
@ -136,15 +135,10 @@ function url_match($route_uri, $request_uri, array &$params)
$nb_route_items = count($route_items);
if ($nb_route_items === count($request_items)) {
for ($i = 0; $i < $nb_route_items; ++$i) {
if ($route_items[$i][0] === ':') {
$params[substr($route_items[$i], 1)] = $request_items[$i];
}
else if ($route_items[$i] !== $request_items[$i]) {
} elseif ($route_items[$i] !== $request_items[$i]) {
$params = array();
return false;
}

View File

@ -7,7 +7,9 @@ const SESSION_LIFETIME = 2678400;
function open($base_path = '/', $save_path = '', $session_lifetime = SESSION_LIFETIME)
{
if ($save_path !== '') session_save_path($save_path);
if ($save_path !== '') {
session_save_path($save_path);
}
// HttpOnly and secure flags for session cookie
session_set_cookie_params(

View File

@ -16,7 +16,6 @@ function load()
}
if (func_num_args() === 2) {
if (! is_array(func_get_arg(1))) {
die('Template variables must be an array');
}

View File

@ -55,14 +55,12 @@ namespace Translator {
$str = '';
if ($position === 'before') {
$str .= $symbol;
}
$str .= number($amount);
if ($position === 'after') {
$str .= ' '.$symbol;
}
@ -89,8 +87,7 @@ namespace Translator {
if (isset($locales[$identifier])) {
if (is_array($locales[$identifier])) {
$translation = plural($identifier, $default, $values);
}
else {
} else {
$translation = $locales[$identifier];
}
}
@ -129,7 +126,6 @@ namespace Translator {
$locales = array();
if (is_dir($path)) {
$dir = new \DirectoryIterator($path);
foreach ($dir as $fileinfo) {
@ -157,23 +153,28 @@ namespace Translator {
namespace {
function tne() {
function tne()
{
return call_user_func_array('\Translator\translate_no_escaping', func_get_args());
}
function t() {
function t()
{
return call_user_func_array('\Translator\translate', func_get_args());
}
function c() {
function c()
{
return call_user_func_array('\Translator\currency', func_get_args());
}
function n() {
function n()
{
return call_user_func_array('\Translator\number', func_get_args());
}
function dt() {
function dt()
{
return call_user_func_array('\Translator\datetime', func_get_args());
}
}

View File

@ -68,7 +68,6 @@ function css()
$theme = \Model\Config\get('theme');
if ($theme !== 'original') {
$css_file = THEME_DIRECTORY.'/'.$theme.'/css/app.css';
if (file_exists($css_file)) {
@ -129,8 +128,7 @@ function summary($value, $min_length = 5, $max_length = 120, $end = '[...]')
$max = $max_length;
}
return substr($value, 0, $max).' '.$end;
}
else if ($length < $min_length) {
} elseif ($length < $min_length) {
return '';
}
@ -150,24 +148,38 @@ function relative_time($timestamp, $fallback_date_format = '%e %B %Y %k:%M')
{
$diff = time() - $timestamp;
if ($diff < 0) return \dt($fallback_date_format, $timestamp);
if ($diff < 0) {
return \dt($fallback_date_format, $timestamp);
}
if ($diff < 60) return \t('%d second ago', $diff);
if ($diff < 60) {
return \t('%d second ago', $diff);
}
$diff = floor($diff / 60);
if ($diff < 60) return \t('%d minute ago', $diff);
if ($diff < 60) {
return \t('%d minute ago', $diff);
}
$diff = floor($diff / 60);
if ($diff < 24) return \t('%d hour ago', $diff);
if ($diff < 24) {
return \t('%d hour ago', $diff);
}
$diff = floor($diff / 24);
if ($diff < 7) return \t('%d day ago', $diff);
if ($diff < 7) {
return \t('%d day ago', $diff);
}
$diff = floor($diff / 7);
if ($diff < 4) return \t('%d week ago', $diff);
if ($diff < 4) {
return \t('%d week ago', $diff);
}
$diff = floor($diff / 4);
if ($diff < 12) return \t('%d month ago', $diff);
if ($diff < 12) {
return \t('%d month ago', $diff);
}
return \dt($fallback_date_format, $timestamp);
}
@ -182,7 +194,6 @@ function error_list(array $errors, $name)
$html = '';
if (isset($errors[$name])) {
$html .= '<ul class="form-errors">';
foreach ($errors[$name] as $error) {
@ -220,11 +231,14 @@ function form_select($name, array $options, $values = array(), array $errors = a
$html = '<select name="'.$name.'" id="form-'.$name.'" class="'.$class.'">';
foreach ($options as $id => $value) {
$html .= '<option value="'.escape($id).'"';
if (isset($values->$name) && $id == $values->$name) $html .= ' selected="selected"';
if (isset($values[$name]) && $id == $values[$name]) $html .= ' selected="selected"';
if (isset($values->$name) && $id == $values->$name) {
$html .= ' selected="selected"';
}
if (isset($values[$name]) && $id == $values[$name]) {
$html .= ' selected="selected"';
}
$html .= '>'.escape($value).'</option>';
}

View File

@ -8,16 +8,12 @@
*/
if (!defined('PASSWORD_BCRYPT')) {
define('PASSWORD_BCRYPT', 1);
define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
define('PASSWORD_PREFIX', '$2a$');
}
else {
} else {
define('PASSWORD_PREFIX', '$2y$');
}
@ -30,7 +26,8 @@ if (!defined('PASSWORD_BCRYPT')) {
*
* @return string|false The hashed password, or false on error.
*/
function password_hash($password, $algo, array $options = array()) {
function password_hash($password, $algo, array $options = array())
{
if (!function_exists('crypt')) {
trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING);
return null;
@ -126,7 +123,6 @@ if (!defined('PASSWORD_BCRYPT')) {
}
}
$salt = str_replace('+', '.', base64_encode($buffer));
}
$salt = substr($salt, 0, $required_salt_len);
@ -157,7 +153,8 @@ if (!defined('PASSWORD_BCRYPT')) {
*
* @return array The array of information about the hash.
*/
function password_get_info($hash) {
function password_get_info($hash)
{
$return = array(
'algo' => 0,
'algoName' => 'unknown',
@ -183,7 +180,8 @@ if (!defined('PASSWORD_BCRYPT')) {
*
* @return boolean True if the password needs to be rehashed.
*/
function password_needs_rehash($hash, $algo, array $options = array()) {
function password_needs_rehash($hash, $algo, array $options = array())
{
$info = password_get_info($hash);
if ($info['algo'] != $algo) {
return true;
@ -207,7 +205,8 @@ if (!defined('PASSWORD_BCRYPT')) {
*
* @return boolean If the password matches the hash
*/
function password_verify($password, $hash) {
function password_verify($password, $hash)
{
if (!function_exists('crypt')) {
trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING);
return false;

View File

@ -23,7 +23,6 @@ function get_files_list($directory)
$files = array();
while ($it->valid()) {
if ($it->isFile() && ! is_excluded_path($it->getSubPathname(), $exclude_list)) {
$files[] = $it->getSubPathname();
}
@ -38,7 +37,6 @@ function get_files_list($directory)
function is_excluded_path($path, array $exclude_list)
{
foreach ($exclude_list as $excluded_path) {
if (strpos($path, $excluded_path) === 0) {
return true;
}
@ -59,9 +57,7 @@ function synchronize($source_directory, $destination_directory)
$remove_files = array_diff($dst_files, $src_files);
foreach ($remove_files as $file) {
if ($file !== '.htaccess') {
$destination_file = $destination_directory.DIRECTORY_SEPARATOR.$file;
Config\debug('[REMOVE] '.$destination_file);
@ -73,11 +69,9 @@ function synchronize($source_directory, $destination_directory)
// Overwrite all files
foreach ($src_files as $file) {
$directory = $destination_directory.DIRECTORY_SEPARATOR.dirname($file);
if (! is_dir($directory)) {
Config\debug('[MKDIR] '.$directory);
if (! @mkdir($directory, 0755, true)) {
@ -135,16 +129,13 @@ function cleanup_directory($directory)
$dir = new DirectoryIterator($directory);
foreach ($dir as $fileinfo) {
if (! $fileinfo->isDot()) {
$filename = $fileinfo->getRealPath();
if ($fileinfo->isFile()) {
\Model\Config\debug('[REMOVE] '.$filename);
@unlink($filename);
}
else {
} else {
cleanup_directory($filename);
@rmdir($filename);
}
@ -187,18 +178,36 @@ function find_archive_root($base_directory = AUTO_UPDATE_ARCHIVE_DIRECTORY)
// Check if everything is setup correctly
function check_setup()
{
if (! class_exists('ZipArchive')) die('To use this feature, your PHP installation must be able to uncompress zip files!');
if (! class_exists('ZipArchive')) {
die('To use this feature, your PHP installation must be able to uncompress zip files!');
}
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
if (AUTO_UPDATE_ARCHIVE_DIRECTORY === '') die('The constant AUTO_UPDATE_ARCHIVE_DIRECTORY is not set!');
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') {
die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
}
if (AUTO_UPDATE_ARCHIVE_DIRECTORY === '') {
die('The constant AUTO_UPDATE_ARCHIVE_DIRECTORY is not set!');
}
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') {
die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
}
if (! is_dir(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) @mkdir(AUTO_UPDATE_DOWNLOAD_DIRECTORY, 0755);
if (! is_dir(AUTO_UPDATE_ARCHIVE_DIRECTORY)) @mkdir(AUTO_UPDATE_ARCHIVE_DIRECTORY, 0755);
if (! is_dir(AUTO_UPDATE_BACKUP_DIRECTORY)) @mkdir(AUTO_UPDATE_BACKUP_DIRECTORY, 0755);
if (! is_dir(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) {
@mkdir(AUTO_UPDATE_DOWNLOAD_DIRECTORY, 0755);
}
if (! is_dir(AUTO_UPDATE_ARCHIVE_DIRECTORY)) {
@mkdir(AUTO_UPDATE_ARCHIVE_DIRECTORY, 0755);
}
if (! is_dir(AUTO_UPDATE_BACKUP_DIRECTORY)) {
@mkdir(AUTO_UPDATE_BACKUP_DIRECTORY, 0755);
}
if (! is_writable(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) die('Update directories must be writable by your web server user!');
if (! is_writable(__DIR__)) die('Source files must be writable by your web server user!');
if (! is_writable(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) {
die('Update directories must be writable by your web server user!');
}
if (! is_writable(__DIR__)) {
die('Source files must be writable by your web server user!');
}
}
// Update the source code
@ -208,7 +217,6 @@ function execute($url)
cleanup_directories();
if (uncompress_archive($url)) {
$update_directory = find_archive_root();
if ($update_directory) {
@ -220,8 +228,7 @@ function execute($url)
if (synchronize($update_directory, ROOT_DIRECTORY)) {
cleanup_directories();
return true;
}
else {
} else {
// If update failed, rollback
synchronize(AUTO_UPDATE_BACKUP_DIRECTORY, ROOT_DIRECTORY);
}

View File

@ -118,11 +118,9 @@ function get_themes()
);
if (file_exists(THEME_DIRECTORY)) {
$dir = new DirectoryIterator(THEME_DIRECTORY);
foreach ($dir as $fileinfo) {
if (! $fileinfo->isDot() && $fileinfo->isDir()) {
$themes[$dir->getFilename()] = ucfirst($dir->getFilename());
}
@ -227,9 +225,7 @@ function check_csrf_values(array &$values)
{
if (empty($values['csrf']) || ! isset($_SESSION['csrf'][$values['csrf']])) {
$values = array();
}
else {
} else {
unset($_SESSION['csrf'][$values['csrf']]);
unset($values['csrf']);
}
@ -251,11 +247,9 @@ function generate_token()
{
if (function_exists('random_bytes')) {
return bin2hex(random_bytes(30));
}
else if (function_exists('openssl_random_pseudo_bytes')) {
} elseif (function_exists('openssl_random_pseudo_bytes')) {
return bin2hex(openssl_random_pseudo_bytes(30));
}
else if (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
} elseif (ini_get('open_basedir') === '' && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
return hash('sha256', file_get_contents('/dev/urandom', false, null, 0, 30));
}
@ -280,9 +274,7 @@ function get($name)
{
if (! isset($_SESSION)) {
return current(Database::getInstance('db')->hashtable('settings')->get($name));
}
else {
} else {
if (! isset($_SESSION['config'][$name])) {
$_SESSION['config'] = get_all();
}
@ -392,11 +384,8 @@ function get_ip_address($only_public = false)
);
foreach ($keys as $key) {
if (isset($_SERVER[$key])) {
foreach (explode(',', $_SERVER[$key]) as $ip_address) {
$ip_address = trim($ip_address);
if ($only_public) {
@ -405,9 +394,7 @@ function get_ip_address($only_public = false)
if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
return $ip_address;
}
}
else {
} else {
return $ip_address;
}
}

View File

@ -14,7 +14,6 @@ function create($filename, $username, $password)
$filename = DATA_DIRECTORY.DIRECTORY_SEPARATOR.$filename;
if (ENABLE_MULTIPLE_DB && ! file_exists($filename)) {
$db = new \PicoDb\Database(array(
'driver' => 'sqlite',
'filename' => $filename,
@ -55,8 +54,7 @@ function select($filename = '')
$_SESSION['database'] = $filename;
$_SESSION['config'] = Config\get_all();
}
}
else {
} else {
return false;
}
}
@ -92,11 +90,9 @@ function get_list()
$listing = array();
foreach (get_all() as $filename) {
if ($filename === DB_FILENAME) {
$label = t('Default database');
}
else {
} else {
$label = ucfirst(substr($filename, 0, -7));
}

View File

@ -9,7 +9,8 @@ use PicoDb\Database;
use PicoFeed\Reader\Favicon;
// Create a favicons
function create_feed_favicon($feed_id, $site_url, $icon_link) {
function create_feed_favicon($feed_id, $site_url, $icon_link)
{
if (has_favicon($feed_id)) {
return true;
}
@ -81,7 +82,8 @@ function store($type, $icon)
return get_favicon_id($hash);
}
function get_favicon_id($hash) {
function get_favicon_id($hash)
{
return Database::getInstance('db')
->table('favicons')
->eq('hash', $hash)

View File

@ -181,7 +181,6 @@ function refresh_all($limit = LIMIT_ALL)
function refresh($feed_id)
{
try {
$feed = get($feed_id);
if (empty($feed)) {
@ -201,7 +200,6 @@ function refresh($feed_id)
// Feed modified
if ($resource->isModified()) {
$parser = $reader->getParser(
$resource->getUrl(),
$resource->getContent(),
@ -209,7 +207,6 @@ function refresh($feed_id)
);
if ($feed['download_content']) {
$parser->enableContentGrabber();
// Don't fetch previous items, only new one
@ -230,8 +227,7 @@ function refresh($feed_id)
Config\write_debug();
return true;
}
catch (PicoFeedException $e) {
} catch (PicoFeedException $e) {
}
update_parsing_error($feed_id, 1);
@ -305,7 +301,6 @@ function count_items($feed_id)
);
foreach ($counts as &$count) {
if ($count['status'] === 'unread') {
$result['items_unread'] = (int) $count['item_count'];
}

View File

@ -38,8 +38,7 @@ function get_map()
if (isset($map[$group_id])) {
$map[$group_id][] = $feed_id;
}
else {
} else {
$map[$group_id] = array($feed_id);
}
}

View File

@ -231,9 +231,13 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee
->neq('status', 'removed')
->orderBy('updated', Config\get('items_sorting_direction'));
if ($feed_id) $query->eq('feed_id', $feed_id);
if ($feed_id) {
$query->eq('feed_id', $feed_id);
}
if ($group_id) $query->in('feed_id', Group\get_feeds_by_group($group_id));
if ($group_id) {
$query->in('feed_id', Group\get_feeds_by_group($group_id));
}
$items = $query->findAll();
@ -241,15 +245,11 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee
$previous_item = null;
for ($i = 0, $ilen = count($items); $i < $ilen; $i++) {
if ($items[$i]['id'] == $item['id']) {
if ($i > 0) {
$j = $i - 1;
while ($j >= 0) {
if (in_array($items[$j]['status'], $status) && in_array($items[$j]['bookmark'], $bookmark)) {
$previous_item = $items[$j];
break;
@ -260,11 +260,9 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee
}
if ($i < ($ilen - 1)) {
$j = $i + 1;
while ($j < $ilen) {
if (in_array($items[$j]['status'], $status) && in_array($items[$j]['bookmark'], $bookmark)) {
$next_item = $items[$j];
break;
@ -314,7 +312,9 @@ function set_unread($id)
// Change item status to "read", "unread" or "removed"
function set_status($status, array $items)
{
if (! in_array($status, array('read', 'unread', 'removed'))) return false;
if (! in_array($status, array('read', 'unread', 'removed'))) {
return false;
}
return Database::getInstance('db')
->table('items')
@ -405,8 +405,7 @@ function autoflush_read()
->eq('status', 'read')
->lt('updated', strtotime('-'.$autoflush.'day'))
->save(array('status' => 'removed', 'content' => ''));
}
else if ($autoflush === -1) {
} elseif ($autoflush === -1) {
// Mark read items removed immediately
Database::getInstance('db')
@ -445,12 +444,10 @@ function update_all($feed_id, array $items)
$db->startTransaction();
foreach ($items as $item) {
Logger::setMessage('Item => '.$item->getId().' '.$item->getUrl());
// Item parsed correctly?
if ($item->getId() && $item->getUrl()) {
Logger::setMessage('Item parsed correctly');
// Get item record in database, if any
@ -462,7 +459,6 @@ function update_all($feed_id, array $items)
// Insert a new item
if ($itemrec === null) {
Logger::setMessage('Item added to the database');
$db->table('items')->save(array(
@ -478,9 +474,7 @@ function update_all($feed_id, array $items)
'enclosure_type' => $item->getEnclosureType(),
'language' => $item->getLanguage(),
));
}
else if (! $itemrec['enclosure'] && $item->getEnclosureUrl()) {
} elseif (! $itemrec['enclosure'] && $item->getEnclosureUrl()) {
Logger::setMessage('Update item enclosure');
$db->table('items')->eq('id', $item->getId())->save(array(
@ -488,8 +482,7 @@ function update_all($feed_id, array $items)
'enclosure' => $item->getEnclosureUrl(),
'enclosure_type' => $item->getEnclosureType(),
));
}
else {
} else {
Logger::setMessage('Item already in the database');
}
@ -509,7 +502,6 @@ function update_all($feed_id, array $items)
function cleanup($feed_id, array $items_in_feed)
{
if (! empty($items_in_feed)) {
$db = Database::getInstance('db');
$removed_items = $db
@ -524,11 +516,9 @@ function cleanup($feed_id, array $items_in_feed)
// Keep a buffer of 2 items
// It's workaround for buggy feeds (cache issue with some Wordpress plugins)
if (is_array($removed_items)) {
$items_to_remove = array_slice($removed_items, 2);
if (! empty($items_to_remove)) {
$nb_items = count($items_to_remove);
Logger::setMessage('There is '.$nb_items.' items to remove');
@ -539,7 +529,6 @@ function cleanup($feed_id, array $items_in_feed)
$chunks = array_chunk($items_to_remove, 500);
foreach ($chunks as $chunk) {
$db->table('items')
->in('id', $chunk)
->eq('status', 'removed')
@ -574,7 +563,6 @@ function download_content_id($item_id)
$content = download_content_url($item['url']);
if (! empty($content)) {
if (! Config\get('nocontent')) {
// Save content

View File

@ -35,8 +35,7 @@ function rewrite_html($html, $website, $proxy_images, $cloak_referrer)
// image proxy mode only: https links do not need to be proxied, since
// they do not trigger mixed content warnings.
$config->setFilterImageProxyProtocol('http');
}
elseif (! $proxy_images && $cloak_referrer && Helper\is_secure_connection()) {
} elseif (! $proxy_images && $cloak_referrer && Helper\is_secure_connection()) {
// cloaking mode only: if a request from a HTTPS connection to a HTTP
// connection is made, the referrer will be omitted by the browser.
// Only the referrer for HTTPS to HTTPs requests needs to be cloaked.
@ -60,8 +59,8 @@ function download($url)
$client->setUserAgent(Config\HTTP_USER_AGENT);
$client->enablePassthroughMode();
$client->execute($url);
} catch (ClientException $e) {
}
catch (ClientException $e) {}
Config\write_debug();
}

View File

@ -52,7 +52,6 @@ function authenticate()
$credentials = read_cookie();
if ($credentials !== false) {
$record = find($credentials['token'], $credentials['sequence']);
if ($record) {
@ -84,7 +83,6 @@ function refresh()
$credentials = read_cookie();
if ($credentials !== false) {
$record = find($credentials['token'], $credentials['sequence']);
if ($record) {
@ -109,7 +107,6 @@ function destroy()
$credentials = read_cookie();
if ($credentials !== false) {
Database::getInstance('db')
->table(TABLE)
->eq('token', $credentials['token'])

View File

@ -303,13 +303,9 @@ function version_11(PDO $pdo)
$items = $rq->fetchAll(PDO::FETCH_ASSOC);
foreach ($items as $item) {
if ($item['id'] !== $item['item_url']) {
$id = hash('crc32b', $item['id'].$item['site_url']);
}
else {
} else {
$id = hash('crc32b', $item['item_url'].$item['site_url']);
}

View File

@ -73,8 +73,7 @@ function api_call($url)
$client->setUserAgent(Config\HTTP_USER_AGENT);
$client->execute($url);
return $client;
}
catch (ClientException $e) {
} catch (ClientException $e) {
return false;
}
}

View File

@ -52,7 +52,6 @@ function validate_login(array $values)
$errors = $v->getErrors();
if ($result) {
$credentials = get_credentials();
if ($credentials && $credentials['username'] === $values['username'] && password_verify($values['password'], $credentials['password'])) {
@ -65,9 +64,7 @@ function validate_login(array $values)
$cookie = RememberMe\create(DatabaseModel\select(), $values['username'], Config\get_ip_address(), Config\get_user_agent());
RememberMe\write_cookie($cookie['token'], $cookie['sequence'], $cookie['expiration']);
}
}
else {
} else {
$result = false;
$errors['login'] = t('Bad username or password');
}

View File

@ -283,7 +283,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = $url;
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
/**
@ -298,7 +298,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = $this->getURLPageBookmarks();
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
/**
@ -313,7 +313,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = $this->getURLPageHistory();
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
/**
@ -328,7 +328,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = $this->getURLPageUnread();
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
/**
@ -342,7 +342,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds';
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
/**
@ -356,7 +356,6 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedPageUrl = $this->getURLPagePreferences();
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
}
?>

View File

@ -4,16 +4,16 @@ use PHPUnit_Extensions_Selenium2TestCase_Keys as Keys;
abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{
protected $basePageHeading = NULL;
protected $expectedPageUrl = NULL;
protected $expectedDataSet = NULL;
protected $expectedCounterPage = NULL;
protected $basePageHeading = null;
protected $expectedPageUrl = null;
protected $expectedDataSet = null;
protected $expectedCounterPage = null;
protected $expectedCounterUnread = '';
protected $ignorePageTitle = FALSE;
protected $ignorePageTitle = false;
protected static $databaseConnection = NULL;
protected static $databaseTester = NULL;
protected static $databaseConnection = null;
protected static $databaseTester = null;
private $waitTimeout = 5000;
@ -57,8 +57,8 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
public static function tearDownAfterClass()
{
static::$databaseConnection = NULL;
static::$databaseTester = NULL;
static::$databaseConnection = null;
static::$databaseTester = null;
}
protected function assertPostConditions()
@ -72,7 +72,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
// some tests switch to a page where no counter exists and the expected
// pagetitle doesn't match to definition.
if ($this->ignorePageTitle === FALSE) {
if ($this->ignorePageTitle === false) {
//remove LEFT-TO-RIGHT MARK char from string as the webdriver does it when using text() on the page <h[1|2|3]>
$pagetitle = preg_replace('/\x{200E}/u', '', $this->title());
$this->assertEquals($this->getExpectedPageTitle(), $pagetitle, 'page title differ from expectation');
@ -170,7 +170,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{
$displaySize = $element->size();
return ($element->displayed() === FALSE || $displaySize['height']=0 || $displaySize['width']=0);
return ($element->displayed() === false || $displaySize['height']=0 || $displaySize['width']=0);
}
private function waitForElementVisibility($element, $visible)
@ -186,25 +186,22 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
try {
if (($visible && $CI->isElementVisible($element))
|| (! $visible && $CI->isElementInvisible($element))) {
return TRUE;
return true;
}
}
catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
$noSuchElement = ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::NoSuchElement
|| $e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::StaleElementReference);
if (($visible === FALSE) && ($noSuchElement)) {
return TRUE;
if (($visible === false) && ($noSuchElement)) {
return true;
} else {
throw $e;
}
}
}, $this->waitTimeout);
}
catch(PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
if ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::Timeout) {
return FALSE;
return false;
} else {
throw $e;
}
@ -224,13 +221,12 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$elements = $CI->elements($CI->using('css selector')->value($cssSelector));
if (count($elements) === $elementCount) {
return TRUE;
return true;
}
}, $this->waitTimeout);
}
catch(PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
if ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::Timeout) {
return FALSE;
return false;
} else {
throw $e;
}
@ -252,10 +248,9 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
if (count($elements) === 1 && $elements[0]->text() == $text
|| count($elements) === 0 && is_null($text)) {
return TRUE;
return true;
}
}
catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
$noSuchElement = ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::NoSuchElement
|| $e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::StaleElementReference);
@ -266,10 +261,9 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
}
}
}, $this->waitTimeout);
}
catch(PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
if ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::Timeout) {
return FALSE;
return false;
} else {
throw $e;
}
@ -278,7 +272,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return $value;
}
private function waitForElementAttributeHasValue($element, $attribute, $attributeValue, $invertMatch = FALSE)
private function waitForElementAttributeHasValue($element, $attribute, $attributeValue, $invertMatch = false)
{
// return false in case of timeout
try {
@ -286,13 +280,12 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$attributeHasValue = ($element->attribute($attribute) === $attributeValue);
if (($attributeHasValue && !$invertMatch) || (!$attributeHasValue && $invertMatch)) {
return TRUE;
return true;
}
}, $this->waitTimeout);
}
catch(PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
if ($e->getCode() === PHPUnit_Extensions_Selenium2TestCase_WebDriverException::Timeout) {
return FALSE;
return false;
} else {
throw $e;
}
@ -331,8 +324,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
// Some PageHeadings have a counter included
$innerHeadingElements = $this->elements($this->using('css selector')->value('div.page-header > h2:first-child *'));
if (count($innerHeadingElements) > 0)
{
if (count($innerHeadingElements) > 0) {
$innerHeading = $innerHeadingElements[0]->text();
$pageHeading = substr($pageHeading, 0, (strlen($innerHeading) * -1));
}
@ -477,8 +469,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
if (func_num_args() === 0) {
$feed = $this;
}
else {
} else {
$feed = func_get_arg(0);
}
@ -594,37 +585,37 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
public function waitForArticleIsNotCurrentArticle($article)
{
$isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item', TRUE);
$isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item', true);
return $isCurrent;
}
public function waitForIconMarkReadVisible($article)
{
$visible = $this->waitForIconMarkRead($article, TRUE);
$visible = $this->waitForIconMarkRead($article, true);
return $visible;
}
public function waitForIconMarkReadInvisible($article)
{
$invisible = $this->waitForIconMarkRead($article, FALSE);
$invisible = $this->waitForIconMarkRead($article, false);
return $invisible;
}
public function waitForIconBookmarkVisible($article)
{
$visible = $this->waitForIconBookmark($article, TRUE);
$visible = $this->waitForIconBookmark($article, true);
return $visible;
}
public function waitForIconBookmarkInvisible($article)
{
$invisible = $this->waitForIconBookmark($article, FALSE);
$invisible = $this->waitForIconBookmark($article, false);
return $invisible;
}
public function waitForArticleInvisible($article)
{
$invisible = $this->waitForElementVisibility($article, FALSE);
$invisible = $this->waitForElementVisibility($article, false);
return $invisible;
}
@ -658,7 +649,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
));
if ($readyState === 'complete') {
return TRUE;
return true;
}
}, $this->waitTimeout);
}
@ -674,9 +665,8 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
));
$result = $this->waitForArticleIsCurrentArticle($article);
if ($result === FALSE) {
if ($result === false) {
throw new Exception('the article could not be set as current article.');
}
}
}
?>

View File

@ -128,7 +128,6 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
/**
@ -217,7 +216,7 @@ class pageBookmarksTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
@ -244,7 +243,7 @@ class pageBookmarksTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_OneUnreadArticle');
$this->getDatabaseTester($dataset)->onSetUp();
@ -279,11 +278,10 @@ class pageBookmarksTest extends minifluxTestCase
$visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
}
?>

View File

@ -34,7 +34,7 @@ class pageFirstFeedTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1_parsing_error', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -389,7 +389,7 @@ class pageFirstFeedTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1_extra_long', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -414,7 +414,7 @@ class pageFirstFeedTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1_extra_long', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -439,7 +439,7 @@ class pageFirstFeedTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
@ -466,7 +466,7 @@ class pageFirstFeedTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_OneUnreadArticle');
$this->getDatabaseTester($dataset)->onSetUp();
@ -502,11 +502,10 @@ class pageFirstFeedTest extends minifluxTestCase
$visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved', 'fixture_feed2');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
}
?>

View File

@ -8,7 +8,8 @@ class pageHistoryTest extends minifluxTestCase
public function setUpPage()
{
$url = $this->getURLPageHistory();
$this->doLoginIfRequired($url);;
$this->doLoginIfRequired($url);
;
$this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url;
@ -223,7 +224,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
public function testUnreadCounterFromNothingToValue()
@ -231,7 +232,7 @@ class pageHistoryTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
@ -266,11 +267,10 @@ class pageHistoryTest extends minifluxTestCase
$visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + static::DEFAULT_COUNTER_PAGE;
$this->expectedDataSet = $this->getDataSet('expected_NoReadArticles');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
}
?>

View File

@ -34,7 +34,7 @@ class pageSubscriptionTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -55,7 +55,7 @@ class pageSubscriptionTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -127,4 +127,3 @@ class pageSubscriptionTest extends minifluxTestCase
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
}
?>

View File

@ -216,7 +216,7 @@ class pageUnreadTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1_extra_long', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -231,12 +231,12 @@ class pageUnreadTest extends minifluxTestCase
$read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('expected_MarkAllRead');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
public function testMarkAllReadBottomLink()
@ -244,7 +244,7 @@ class pageUnreadTest extends minifluxTestCase
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
static::$databaseTester = null;
$dataset = $this->getDataSet('fixture_feed1_extra_long', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
@ -259,12 +259,12 @@ class pageUnreadTest extends minifluxTestCase
$read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('expected_MarkAllRead');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
public function testRedirectWithZeroArticles()
@ -282,12 +282,11 @@ class pageUnreadTest extends minifluxTestCase
$visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL;
$this->expectedCounterPage = null;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
$this->ignorePageTitle = TRUE;
$this->ignorePageTitle = true;
}
}
?>