aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
committermistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
commitae707279a1945e383c312cd648d288606a79e341 (patch)
tree917bdc6e0609ed0eefed5f3693de3a017685acc4
parent35ff1b7c1f933799397a0ce0a6723cf82f416ff3 (diff)
remove all array_push (50% slower than []) + some changes missing for feature:2978
git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/album_notification.php8
-rw-r--r--admin/batch_manager.php56
-rw-r--r--admin/batch_manager_global.php78
-rw-r--r--admin/batch_manager_unit.php6
-rw-r--r--admin/cat_list.php30
-rw-r--r--admin/cat_move.php5
-rw-r--r--admin/cat_perm.php21
-rw-r--r--admin/comments.php25
-rw-r--r--admin/configuration.php19
-rw-r--r--admin/element_set_ranks.php18
-rw-r--r--admin/extend_for_templates.php3
-rw-r--r--admin/group_list.php10
-rw-r--r--admin/group_perm.php15
-rw-r--r--admin/history.php2
-rw-r--r--admin/include/check_integrity.class.php28
-rw-r--r--admin/include/configuration_sizes_process.inc.php5
-rw-r--r--admin/include/configuration_watermark_process.inc.php5
-rw-r--r--admin/include/functions.php79
-rw-r--r--admin/include/functions_history.inc.php38
-rw-r--r--admin/include/functions_install.inc.php2
-rw-r--r--admin/include/functions_metadata.php11
-rw-r--r--admin/include/functions_notification_by_mail.inc.php65
-rw-r--r--admin/include/functions_plugins.inc.php2
-rw-r--r--admin/include/functions_upgrade.php20
-rw-r--r--admin/include/functions_upload.inc.php21
-rw-r--r--admin/include/languages.class.php12
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php20
-rw-r--r--admin/include/photos_add_direct_process.inc.php78
-rw-r--r--admin/include/plugins.class.php4
-rw-r--r--admin/include/themes.class.php33
-rw-r--r--admin/include/updates.class.php25
-rw-r--r--admin/include/uploadify/uploadify.php15
-rw-r--r--admin/intro.php31
-rw-r--r--admin/languages_installed.php2
-rw-r--r--admin/languages_new.php19
-rw-r--r--admin/menubar.php2
-rw-r--r--admin/notification_by_mail.php66
-rw-r--r--admin/permalinks.php8
-rw-r--r--admin/photos_add_direct.php9
-rw-r--r--admin/picture_modify.php6
-rw-r--r--admin/plugins_installed.php23
-rw-r--r--admin/plugins_new.php20
-rw-r--r--admin/rating.php2
-rw-r--r--admin/site_manager.php12
-rw-r--r--admin/site_reader_local.php13
-rw-r--r--admin/site_update.php121
-rw-r--r--admin/stats.php41
-rw-r--r--admin/tags.php117
-rw-r--r--admin/themes_installed.php4
-rw-r--r--admin/themes_new.php21
-rw-r--r--admin/updates_ext.php4
-rw-r--r--admin/updates_pwg.php2
-rw-r--r--admin/user_list.php73
-rw-r--r--admin/user_perm.php6
-rw-r--r--comments.php4
-rw-r--r--identification.php9
-rw-r--r--include/calendar_monthly.class.php2
-rw-r--r--include/calendar_weekly.class.php3
-rw-r--r--include/category_cats.inc.php2
-rw-r--r--include/dblayer/functions_mysql.inc.php16
-rw-r--r--include/dblayer/functions_mysqli.inc.php16
-rw-r--r--include/filter.inc.php5
-rw-r--r--include/functions.inc.php6
-rw-r--r--include/functions_calendar.inc.php2
-rw-r--r--include/functions_comment.inc.php12
-rw-r--r--include/functions_mail.inc.php4
-rw-r--r--include/functions_notification.inc.php16
-rw-r--r--include/functions_plugins.inc.php2
-rw-r--r--include/functions_search.inc.php49
-rw-r--r--include/functions_tag.inc.php2
-rw-r--r--include/functions_url.inc.php15
-rw-r--r--include/picture_comment.inc.php6
-rw-r--r--include/section_init.inc.php2
-rw-r--r--include/ws_functions.inc.php54
-rw-r--r--include/ws_protocols/rest_encoder.php2
-rw-r--r--install.php50
-rw-r--r--nbm.php5
-rw-r--r--password.php37
-rw-r--r--picture.php12
-rw-r--r--plugins/LocalFilesEditor/admin.php13
-rw-r--r--plugins/LocalFilesEditor/include/css.inc.php6
-rw-r--r--plugins/LocalFilesEditor/include/tpl.inc.php8
-rw-r--r--plugins/LocalFilesEditor/main.inc.php9
-rw-r--r--profile.php8
-rw-r--r--register.php4
-rw-r--r--search.php2
-rw-r--r--search_rules.php2
-rw-r--r--tags.php15
-rw-r--r--upgrade.php23
89 files changed, 700 insertions, 1084 deletions
diff --git a/admin/album_notification.php b/admin/album_notification.php
index 30c1d9bb7..d4070c2d7 100644
--- a/admin/album_notification.php
+++ b/admin/album_notification.php
@@ -113,13 +113,7 @@ SELECT
;';
list($group_name) = pwg_db_fetch_row(pwg_query($query));
- array_push(
- $page['infos'],
- l10n(
- 'An information email was sent to group "%s"',
- $group_name
- )
- );
+ $page['infos'][] = l10n('An information email was sent to group "%s"', $group_name);
}
// +-----------------------------------------------------------------------+
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index 75e20917f..302f8802f 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -177,10 +177,7 @@ SELECT element_id
FROM '.CADDIE_TABLE.'
WHERE user_id = '.$user['id'].'
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'element_id')
- );
+ $filter_sets[] = array_from_query($query, 'element_id');
break;
@@ -190,10 +187,7 @@ SELECT image_id
FROM '.FAVORITES_TABLE.'
WHERE user_id = '.$user['id'].'
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'image_id')
- );
+ $filter_sets[] = array_from_query($query, 'image_id');
break;
@@ -210,10 +204,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE date_available BETWEEN '.pwg_db_get_recent_period_expression(1, $row['date']).' AND \''.$row['date'].'\'
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'id')
- );
+ $filter_sets[] = array_from_query($query, 'id');
}
break;
@@ -242,10 +233,7 @@ SELECT id
$linked_to_virtual = array_from_query($query, 'image_id');
}
- array_push(
- $filter_sets,
- array_diff($all_elements, $linked_to_virtual)
- );
+ $filter_sets[] = array_diff($all_elements, $linked_to_virtual);
break;
@@ -257,10 +245,7 @@ SELECT
LEFT JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
WHERE category_id is null
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'id')
- );
+ $filter_sets[] = array_from_query($query, 'id');
break;
@@ -272,10 +257,7 @@ SELECT
LEFT JOIN '.IMAGE_TAG_TABLE.' ON id = image_id
WHERE tag_id is null
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'id')
- );
+ $filter_sets[] = array_from_query($query, 'id');
break;
@@ -297,11 +279,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE file IN (\''.implode("','", $duplicate_files).'\')
;';
-
- array_push(
- $filter_sets,
- array_from_query($query, 'id')
- );
+ $filter_sets[] = array_from_query($query, 'id');
break;
@@ -337,10 +315,7 @@ if (isset($_SESSION['bulk_manager_filter']['category']))
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id IN ('.implode(',', $categories).')
;';
- array_push(
- $filter_sets,
- array_from_query($query, 'image_id')
- );
+ $filter_sets[] = array_from_query($query, 'image_id');
}
if (isset($_SESSION['bulk_manager_filter']['level']))
@@ -362,15 +337,12 @@ SELECT id
if (!empty($_SESSION['bulk_manager_filter']['tags']))
{
- array_push(
- $filter_sets,
- get_image_ids_for_tags(
- $_SESSION['bulk_manager_filter']['tags'],
- $_SESSION['bulk_manager_filter']['tag_mode'],
- null,
- null,
- false // we don't apply permissions in administration screens
- )
+ $filter_sets[] = get_image_ids_for_tags(
+ $_SESSION['bulk_manager_filter']['tags'],
+ $_SESSION['bulk_manager_filter']['tag_mode'],
+ null,
+ null,
+ false // we don't apply permissions in administration screens
);
}
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index d3cb4774a..246616a74 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -82,7 +82,7 @@ if (isset($_POST['submit']))
// photo in the selection
if (count($collection) == 0)
{
- array_push($page['errors'], l10n('Select at least one photo'));
+ $page['errors'][] = l10n('Select at least one photo');
}
$action = $_POST['selectAction'];
@@ -105,7 +105,7 @@ DELETE
{
if (empty($_POST['add_tags']))
{
- array_push($page['errors'], l10n('Select at least one tag'));
+ $page['errors'][] = l10n('Select at least one tag');
}
else
{
@@ -133,7 +133,7 @@ DELETE
}
else
{
- array_push($page['errors'], l10n('Select at least one tag'));
+ $page['errors'][] = l10n('Select at least one tag');
}
}
@@ -241,12 +241,9 @@ DELETE
$datas = array();
foreach ($collection as $image_id)
{
- array_push(
- $datas,
- array(
- 'id' => $image_id,
- 'author' => $_POST['author']
- )
+ $datas[] = array(
+ 'id' => $image_id,
+ 'author' => $_POST['author']
);
}
@@ -268,12 +265,9 @@ DELETE
$datas = array();
foreach ($collection as $image_id)
{
- array_push(
- $datas,
- array(
- 'id' => $image_id,
- 'name' => $_POST['title']
- )
+ $datas[] = array(
+ 'id' => $image_id,
+ 'name' => $_POST['title']
);
}
@@ -302,12 +296,9 @@ DELETE
$datas = array();
foreach ($collection as $image_id)
{
- array_push(
- $datas,
- array(
- 'id' => $image_id,
- 'date_creation' => $date_creation
- )
+ $datas[] = array(
+ 'id' => $image_id,
+ 'date_creation' => $date_creation
);
}
@@ -324,12 +315,9 @@ DELETE
$datas = array();
foreach ($collection as $image_id)
{
- array_push(
- $datas,
- array(
- 'id' => $image_id,
- 'level' => $_POST['level']
- )
+ $datas[] = array(
+ 'id' => $image_id,
+ 'level' => $_POST['level']
);
}
@@ -362,15 +350,9 @@ DELETE
$deleted_count = delete_elements($collection, true);
if ($deleted_count > 0)
{
- $_SESSION['page_infos'] = array(
- sprintf(
- l10n_dec(
- '%d photo was deleted',
- '%d photos were deleted',
- $deleted_count
- ),
- $deleted_count
- )
+ $_SESSION['page_infos'][] = l10n_dec(
+ '%d photo was deleted', '%d photos were deleted',
+ $deleted_count
);
$redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
@@ -378,12 +360,12 @@ DELETE
}
else
{
- array_push($page['errors'], l10n('No photo can be deleted'));
+ $page['errors'][] = l10n('No photo can be deleted');
}
}
else
{
- array_push($page['errors'], l10n('You need to confirm deletion'));
+ $page['errors'][] = l10n('You need to confirm deletion');
}
}
@@ -391,11 +373,7 @@ DELETE
if ('metadata' == $action)
{
sync_metadata($collection);
-
- array_push(
- $page['infos'],
- l10n('Metadata synchronized from file')
- );
+ $page['infos'][] = l10n('Metadata synchronized from file');
}
if ('delete_derivatives' == $action)
@@ -415,11 +393,13 @@ DELETE
if ('generate_derivatives' == $action)
{
if ($_POST['regenerateSuccess'] != '0')
- array_push($page['infos'], l10n('%s photos have been regenerated', $_POST['regenerateSuccess']));
-
+ {
+ $page['infos'][] = l10n('%s photos have been regenerated', $_POST['regenerateSuccess']);
+ }
if ($_POST['regenerateError'] != '0')
- array_push($page['warnings'], l10n('%s photos can not be regenerated', $_POST['regenerateError']));
-
+ {
+ $page['warnings'][] = l10n('%s photos can not be regenerated', $_POST['regenerateError']);
+ }
}
trigger_action('element_set_global_action', $action, $collection);
@@ -444,9 +424,7 @@ $prefilters = array(
if ($conf['enable_synchronization'])
{
- array_push($prefilters,
- array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'))
- );
+ $prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'));
}
$prefilters = trigger_event('get_batch_manager_prefilters', $prefilters);
diff --git a/admin/batch_manager_unit.php b/admin/batch_manager_unit.php
index 41edd350d..9202f294d 100644
--- a/admin/batch_manager_unit.php
+++ b/admin/batch_manager_unit.php
@@ -103,7 +103,7 @@ SELECT id, date_creation
$data['date_creation'] = $row['date_creation'];
}
- array_push($datas, $data);
+ $datas[] = $data;
// tags management
$tag_ids = array();
@@ -123,7 +123,7 @@ SELECT id, date_creation
$datas
);
- array_push($page['infos'], l10n('Photo informations updated'));
+ $page['infos'][] = l10n('Photo informations updated');
}
// +-----------------------------------------------------------------------+
@@ -232,7 +232,7 @@ SELECT *
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($element_ids, $row['id']);
+ $element_ids[] = $row['id'];
$src_image = new SrcImage($row);
diff --git a/admin/cat_list.php b/admin/cat_list.php
index baba5e2c9..6caa393f4 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -78,7 +78,7 @@ function save_categories_order($categories)
$current_rank++;
}
- array_push($datas, array('id' => $id, 'rank' => $current_rank));
+ $datas[] = array('id' => $id, 'rank' => $current_rank);
}
$fields = array('primary' => array('id'), 'update' => array('rank'));
mass_updates(CATEGORIES_TABLE, $fields, $datas);
@@ -133,11 +133,11 @@ else if (isset($_POST['submitAdd']))
if (isset($output_create['error']))
{
- array_push($page['errors'], $output_create['error']);
+ $page['errors'][] = $output_create['error'];
}
else
{
- array_push($page['infos'], $output_create['info']);
+ $page['infos'][] = $output_create['info'];
}
}
// save manual category ordering
@@ -146,10 +146,7 @@ else if (isset($_POST['submitManualOrder']))
asort($_POST['catOrd'], SORT_NUMERIC);
save_categories_order(array_keys($_POST['catOrd']));
- array_push(
- $page['infos'],
- l10n('Album manual order was saved')
- );
+ $page['infos'][] = l10n('Album manual order was saved');
}
else if (isset($_POST['submitAutoOrder']))
{
@@ -178,17 +175,11 @@ SELECT id, name, id_uppercat
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push(
- $categories,
- array(
- 'id' => $row['id'],
- 'id_uppercat' => $row['id_uppercat'],
- )
- );
- array_push(
- $names,
- $row['name']
+ $categories[] = array(
+ 'id' => $row['id'],
+ 'id_uppercat' => $row['id_uppercat'],
);
+ $names[] = $row['name'];
}
array_multisort(
@@ -199,10 +190,7 @@ SELECT id, name, id_uppercat
);
save_categories_order($categories);
- array_push(
- $page['infos'],
- l10n('Albums automatically sorted')
- );
+ $page['infos'][] = l10n('Albums automatically sorted');
}
// +-----------------------------------------------------------------------+
diff --git a/admin/cat_move.php b/admin/cat_move.php
index 5ea86cdce..3866d7f5c 100644
--- a/admin/cat_move.php
+++ b/admin/cat_move.php
@@ -51,10 +51,7 @@ if (isset($_POST['submit']))
}
else
{
- array_push(
- $page['errors'],
- l10n('Select at least one album')
- );
+ $page['errors'][] = l10n('Select at least one album');
}
}
diff --git a/admin/cat_perm.php b/admin/cat_perm.php
index b7b32ac2e..1c3904016 100644
--- a/admin/cat_perm.php
+++ b/admin/cat_perm.php
@@ -125,7 +125,7 @@ SELECT
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($granteds[$row['cat_id']], $row['group_id']);
+ $granteds[ $row['cat_id'] ][] = $row['group_id'];
}
$inserts = array();
@@ -135,12 +135,9 @@ SELECT
$group_ids = array_diff($grant_groups, $granteds[$cat_id]);
foreach ($group_ids as $group_id)
{
- array_push(
- $inserts,
- array(
- 'group_id' => $group_id,
- 'cat_id' => $cat_id
- )
+ $inserts[] = array(
+ 'group_id' => $group_id,
+ 'cat_id' => $cat_id
);
}
}
@@ -190,7 +187,7 @@ DELETE
}
}
- array_push($page['infos'], l10n('Album updated successfully'));
+ $page['infos'][] = l10n('Album updated successfully');
}
// +-----------------------------------------------------------------------+
@@ -272,11 +269,11 @@ SELECT user_id, group_id
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- if (!isset($granted_groups[$row['group_id']]))
+ if (!isset($granted_groups[ $row['group_id'] ]))
{
- $granted_groups[$row['group_id']] = array();
+ $granted_groups[ $row['group_id'] ] = array();
}
- array_push($granted_groups[$row['group_id']], $row['user_id']);
+ $granted_groups[ $row['group_id'] ][] = $row['user_id'];
}
$user_granted_by_group_ids = array();
@@ -302,7 +299,7 @@ SELECT user_id, group_id
{
if (in_array($user_id, $user_granted_indirect_ids))
{
- array_push($group_usernames, $users[$user_id]);
+ $group_usernames[] = $users[$user_id];
}
}
diff --git a/admin/comments.php b/admin/comments.php
index 6d3fcc507..637790353 100644
--- a/admin/comments.php
+++ b/admin/comments.php
@@ -41,10 +41,7 @@ if (!empty($_POST))
{
if (empty($_POST['comments']))
{
- array_push(
- $page['errors'],
- l10n('Select at least one comment')
- );
+ $page['errors'][] = l10n('Select at least one comment');
}
else
{
@@ -55,12 +52,9 @@ if (!empty($_POST))
{
validate_user_comment($_POST['comments']);
- array_push(
- $page['infos'],
- l10n_dec(
- '%d user comment validated', '%d user comments validated',
- count($_POST['comments'])
- )
+ $page['infos'][] = l10n_dec(
+ '%d user comment validated', '%d user comments validated',
+ count($_POST['comments'])
);
}
@@ -68,12 +62,9 @@ if (!empty($_POST))
{
delete_user_comment($_POST['comments']);
- array_push(
- $page['infos'],
- l10n_dec(
- '%d user comment rejected', '%d user comments rejected',
- count($_POST['comments'])
- )
+ $page['infos'][] = l10n_dec(
+ '%d user comment rejected', '%d user comments rejected',
+ count($_POST['comments'])
);
}
}
@@ -148,7 +139,7 @@ while ($row = pwg_db_fetch_assoc($result))
)
);
- array_push($list, $row['id']);
+ $list[] = $row['id'];
}
$template->assign('LIST', implode(',', $list) );
diff --git a/admin/configuration.php b/admin/configuration.php
index 63bc29f3c..d30138b06 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -154,7 +154,7 @@ if (isset($_POST['submit']))
}
if ( !count($_POST['order_by']) )
{
- array_push($page['errors'], l10n('No order field selected'));
+ $page['errors'][] = l10n('No order field selected');
}
else
{
@@ -179,7 +179,7 @@ if (isset($_POST['submit']))
}
else
{
- array_push($page['errors'], l10n('No order field selected'));
+ $page['errors'][] = l10n('No order field selected');
}
}
@@ -207,7 +207,7 @@ if (isset($_POST['submit']))
or $_POST['nb_comment_page'] < 5
or $_POST['nb_comment_page'] > 50)
{
- array_push($page['errors'], l10n('The number of comments a page must be between 5 and 50 included.'));
+ $page['errors'][] = l10n('The number of comments a page must be between 5 and 50 included.');
}
foreach( $comments_checkboxes as $checkbox)
{
@@ -225,7 +225,7 @@ if (isset($_POST['submit']))
if (!preg_match($int_pattern, $_POST['nb_categories_page'])
or $_POST['nb_categories_page'] < 4)
{
- array_push($page['errors'], l10n('The number of albums a page must be above 4.'));
+ $page['errors'][] = l10n('The number of albums a page must be above 4.');
}
foreach( $display_checkboxes as $checkbox)
{
@@ -268,7 +268,7 @@ WHERE param = \''.$row['param'].'\'
pwg_query($query);
}
}
- array_push($page['infos'], l10n('Information data registered in database'));
+ $page['infos'][] = l10n('Information data registered in database');
}
//------------------------------------------------------ $conf reinitialization
@@ -282,10 +282,7 @@ if ('sizes' == $page['section'] and isset($_GET['action']) and 'restore_settings
pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = \'disabled_derivatives\'');
clear_derivative_cache();
- array_push(
- $page['infos'],
- l10n('Your configuration settings are saved')
- );
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
//----------------------------------------------------- template initialization
@@ -324,7 +321,7 @@ switch ($page['section'])
if (order_by_is_local())
{
- array_push($page['warnings'], l10n('You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !'));
+ $page['warnings'][] = l10n('You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !');
}
if ( isset($conf['order_by_custom']) or isset($conf['order_by_inside_category_custom']) )
@@ -400,7 +397,7 @@ switch ($page['section'])
{
// Reload user
$edit_user = build_user($conf['guest_id'], false);
- array_push($page['infos'], l10n('Information data registered in database'));
+ $page['infos'][] = l10n('Information data registered in database');
}
$page['errors'] = array_merge($page['errors'], $errors);
diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php
index 98f22a8cd..07afc7cba 100644
--- a/admin/element_set_ranks.php
+++ b/admin/element_set_ranks.php
@@ -64,13 +64,10 @@ function save_images_order($category_id, $images)
$datas = array();
foreach ($images as $id)
{
- array_push(
- $datas,
- array(
- 'category_id' => $category_id,
- 'image_id' => $id,
- 'rank' => ++$current_rank,
- )
+ $datas[] = array(
+ 'category_id' => $category_id,
+ 'image_id' => $id,
+ 'rank' => ++$current_rank,
);
}
$fields = array(
@@ -98,10 +95,7 @@ if (isset($_POST['submit']))
array_keys($_POST['rank_of_image'])
);
- array_push(
- $page['infos'],
- l10n('Images manual order was saved')
- );
+ $page['infos'][] = l10n('Images manual order was saved');
}
if (!empty($_POST['image_order_choice'])
@@ -143,7 +137,7 @@ UPDATE '.CATEGORIES_TABLE.'
pwg_query($query);
}
- array_push($page['infos'], l10n('Your configuration settings are saved'));
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
// +-----------------------------------------------------------------------+
diff --git a/admin/extend_for_templates.php b/admin/extend_for_templates.php
index 0faced402..bcee7e7a8 100644
--- a/admin/extend_for_templates.php
+++ b/admin/extend_for_templates.php
@@ -149,8 +149,7 @@ UPDATE '.CONFIG_TABLE.'
WHERE param = \'extents_for_templates\';';
if (pwg_query($query))
{
- array_push($page['infos'],
- l10n('Templates configuration has been recorded.'));
+ $page['infos'][] = l10n('Templates configuration has been recorded.');
}
}
diff --git a/admin/group_list.php b/admin/group_list.php
index 77049b9fa..6232c5b00 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -45,7 +45,7 @@ if (isset($_POST['submit_add']))
{
if (empty($_POST['groupname']))
{
- array_push($page['errors'], l10n('The name of a group must not contain " or \' or be empty.'));
+ $page['errors'][] = l10n('The name of a group must not contain " or \' or be empty.');
}
if (count($page['errors']) == 0)
{
@@ -58,7 +58,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0)
{
- array_push($page['errors'], l10n('This name is already used by another group.'));
+ $page['errors'][] = l10n('This name is already used by another group.');
}
}
if (count($page['errors']) == 0)
@@ -86,7 +86,7 @@ if (isset($_POST['submit']) and isset($_POST['selectAction']) and isset($_POST['
$groups = $_POST['group_selection'];
if (count($groups) == 0)
{
- array_push($page['errors'], l10n('Select at least one group'));
+ $page['errors'][] = l10n('Select at least one group');
}
$action = $_POST['selectAction'];
@@ -169,7 +169,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0)
{
- array_push($page['errors'], l10n('This name is already used by another group.'));
+ $page['errors'][] = l10n('This name is already used by another group.');
}
else
{
@@ -255,7 +255,7 @@ SELECT COUNT(*)
list($count) = pwg_db_fetch_row(pwg_query($query));
if ($count != 0)
{
- array_push($page['errors'], l10n('This name is already used by another group.'));
+ $page['errors'][] = l10n('This name is already used by another group.');
break;
}
// creating the group
diff --git a/admin/group_perm.php b/admin/group_perm.php
index d31102a4d..42c3309b2 100644
--- a/admin/group_perm.php
+++ b/admin/group_perm.php
@@ -81,7 +81,7 @@ SELECT id
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($private_uppercats, $row['id']);
+ $private_uppercats[] = $row['id'];
}
// retrying to authorize a category which is already authorized may cause
@@ -98,19 +98,16 @@ SELECT cat_id
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($authorized_ids, $row['cat_id']);
+ $authorized_ids[] = $row['cat_id'];
}
$inserts = array();
$to_autorize_ids = array_diff($private_uppercats, $authorized_ids);
foreach ($to_autorize_ids as $to_autorize_id)
{
- array_push(
- $inserts,
- array(
- 'group_id' => $page['group'],
- 'cat_id' => $to_autorize_id
- )
+ $inserts[] = array(
+ 'group_id' => $page['group'],
+ 'cat_id' => $to_autorize_id
);
}
@@ -158,7 +155,7 @@ $result = pwg_query($query_true);
$authorized_ids = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($authorized_ids, $row['id']);
+ $authorized_ids[] = $row['id'];
}
$query_false = '
diff --git a/admin/history.php b/admin/history.php
index b74f48399..b6ceb13a9 100644
--- a/admin/history.php
+++ b/admin/history.php
@@ -164,7 +164,7 @@ INSERT INTO '.SEARCH_TABLE.'
}
else
{
- array_push($page['errors'], l10n('Empty query. No criteria has been entered.'));
+ $page['errors'][] = l10n('Empty query. No criteria has been entered.');
}
}
diff --git a/admin/include/check_integrity.class.php b/admin/include/check_integrity.class.php
index 62372e214..3e8089a58 100644
--- a/admin/include/check_integrity.class.php
+++ b/admin/include/check_integrity.class.php
@@ -71,9 +71,10 @@ class check_integrity
// Information
if (count($this->retrieve_list) > 0)
{
- $header_notes[] =
- l10n_dec('%d anomaly has been detected.', '%d anomalies have been detected.',
- count($this->retrieve_list));
+ $header_notes[] = l10n_dec(
+ '%d anomaly has been detected.', '%d anomalies have been detected.',
+ count($this->retrieve_list)
+ );
}
// Treatments
@@ -116,15 +117,17 @@ class check_integrity
if ($corrected_count > 0)
{
- $page['infos'][] =
- l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
- $corrected_count);
+ $page['infos'][] = l10n_dec(
+ '%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
+ $corrected_count
+ );
}
if ($not_corrected_count > 0)
{
- $page['errors'][] =
- l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
- $not_corrected_count);
+ $page['errors'][] = l10n_dec(
+ '%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
+ $not_corrected_count
+ );
}
}
else
@@ -145,9 +148,10 @@ class check_integrity
if ($ignored_count > 0)
{
- $page['infos'][] =
- l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.',
- $ignored_count);
+ $page['infos'][] = l10n_dec(
+ '%d anomaly has been ignored.', '%d anomalies have been ignored.',
+ $ignored_count
+ );
}
}
}
diff --git a/admin/include/configuration_sizes_process.inc.php b/admin/include/configuration_sizes_process.inc.php
index e6fa870d6..dc8f2c5d5 100644
--- a/admin/include/configuration_sizes_process.inc.php
+++ b/admin/include/configuration_sizes_process.inc.php
@@ -254,10 +254,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types);
}
- array_push(
- $page['infos'],
- l10n('Your configuration settings are saved')
- );
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
else
{
diff --git a/admin/include/configuration_watermark_process.inc.php b/admin/include/configuration_watermark_process.inc.php
index 0d28e32a8..c8dfe991a 100644
--- a/admin/include/configuration_watermark_process.inc.php
+++ b/admin/include/configuration_watermark_process.inc.php
@@ -174,10 +174,7 @@ if (count($errors) == 0)
clear_derivative_cache($changed_types);
}
- array_push(
- $page['infos'],
- l10n('Your configuration settings are saved')
- );
+ $page['infos'][] = l10n('Your configuration settings are saved');
}
else
{
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 7972cb989..39d8f85ee 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -540,7 +540,7 @@ function get_fs_directories($path, $recursive = true)
and $node != 'pwg_representative'
and is_dir($path.'/'.$node))
{
- array_push($dirs, $path.'/'.$node);
+ $dirs[] = $path.'/'.$node;
if ($recursive)
{
$dirs = array_merge($dirs, get_fs_directories($path.'/'.$node));
@@ -747,12 +747,9 @@ SELECT image_id
;';
list($representative) = pwg_db_fetch_row(pwg_query($query));
- array_push(
- $datas,
- array(
- 'id' => $category_id,
- 'representative_picture_id' => $representative,
- )
+ $datas[] = array(
+ 'id' => $category_id,
+ 'representative_picture_id' => $representative,
);
}
@@ -862,26 +859,26 @@ function get_fs($path, $recursive = true)
{
if (basename($path) == 'thumbnail')
{
- array_push($fs['thumbnails'], $path.'/'.$node);
+ $fs['thumbnails'][] = $path.'/'.$node;
}
else if (basename($path) == 'pwg_representative')
{
- array_push($fs['representatives'], $path.'/'.$node);
+ $fs['representatives'][] = $path.'/'.$node;
}
else
{
- array_push($fs['elements'], $path.'/'.$node);
+ $fs['elements'][] = $path.'/'.$node;
}
}
// else if (in_array($extension, $conf['file_ext']))
else if (isset($conf['flip_file_ext'][$extension]))
{
- array_push($fs['elements'], $path.'/'.$node);
+ $fs['elements'][] = $path.'/'.$node;
}
}
else if (is_dir($path.'/'.$node) and $node != 'pwg_high' and $recursive)
{
- array_push($subdirs, $node);
+ $subdirs[] = $node;
}
}
}
@@ -995,19 +992,16 @@ SELECT id, id_uppercat, uppercats
$uppercat = $id;
while ($uppercat)
{
- array_push($upper_list, $uppercat);
+ $upper_list[] = $uppercat;
$uppercat = $cat_map[$uppercat]['id_uppercat'];
}
$new_uppercats = implode(',', array_reverse($upper_list));
if ($new_uppercats != $cat['uppercats'])
{
- array_push(
- $datas,
- array(
- 'id' => $id,
- 'uppercats' => $new_uppercats
- )
+ $datas[] = array(
+ 'id' => $id,
+ 'uppercats' => $new_uppercats
);
}
}
@@ -1095,10 +1089,7 @@ SELECT uppercats
// into a new parent category with uppercats 12,125,13,14,24
if (preg_match('/^'.$category['uppercats'].'(,|$)/', $new_parent_uppercats))
{
- array_push(
- $page['errors'],
- l10n('You cannot move an album in its own sub album')
- );
+ $page['errors'][] = l10n('You cannot move an album in its own sub album');
return;
}
}
@@ -1177,12 +1168,9 @@ DELETE FROM '.$table.'
}
}
- array_push(
- $page['infos'],
- l10n_dec(
- '%d album moved', '%d albums moved',
- count($categories)
- )
+ $page['infos'][] = l10n_dec(
+ '%d album moved', '%d albums moved',
+ count($categories)
);
}
@@ -1307,12 +1295,9 @@ SELECT id, uppercats, global_rank, visible, status
$inserts = array();
foreach ($granted_grps as $granted_grp)
{
- array_push(
- $inserts,
- array(
- 'group_id' => $granted_grp,
- 'cat_id' => $inserted_id
- )
+ $inserts[] = array(
+ 'group_id' => $granted_grp,
+ 'cat_id' => $inserted_id
);
}
mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts);
@@ -1586,13 +1571,10 @@ SELECT
{
$rank = ++$current_rank_of[$category_id];
- array_push(
- $inserts,
- array(
- 'image_id' => $image_id,
- 'category_id' => $category_id,
- 'rank' => $rank,
- )
+ $inserts[] = array(
+ 'image_id' => $image_id,
+ 'category_id' => $category_id,
+ 'rank' => $rank,
);
}
}
@@ -2315,7 +2297,7 @@ SELECT
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($granteds[$row['cat_id']], $row['user_id']);
+ $granteds[ $row['cat_id'] ][] = $row['user_id'];
}
$inserts = array();
@@ -2326,12 +2308,9 @@ SELECT
foreach ($grant_to_users as $user_id)
{
- array_push(
- $inserts,
- array(
- 'user_id' => $user_id,
- 'cat_id' => $cat_id
- )
+ $inserts[] = array(
+ 'user_id' => $user_id,
+ 'cat_id' => $cat_id
);
}
}
@@ -2513,7 +2492,7 @@ function get_dirs($directory)
and is_dir($directory.'/'.$file)
and $file != '.svn')
{
- array_push($sub_dirs, $file);
+ $sub_dirs[] = $file;
}
}
closedir($opendir);
diff --git a/admin/include/functions_history.inc.php b/admin/include/functions_history.inc.php
index 2b18547dc..fec287263 100644
--- a/admin/include/functions_history.inc.php
+++ b/admin/include/functions_history.inc.php
@@ -58,18 +58,12 @@ SELECT
if (isset($search['fields']['date-after']))
{
- array_push(
- $clauses,
- "date >= '".$search['fields']['date-after']."'"
- );
+ $clauses[] = "date >= '".$search['fields']['date-after']."'";
}
if (isset($search['fields']['date-before']))
{
- array_push(
- $clauses,
- "date <= '".$search['fields']['date-before']."'"
- );
+ $clauses[] = "date <= '".$search['fields']['date-before']."'";
}
if (isset($search['fields']['types']))
@@ -88,34 +82,25 @@ SELECT
$clause.= "= '".$type."'";
}
- array_push($local_clauses, $clause);
+ $local_clauses[] = $clause;
}
}
if (count($local_clauses) > 0)
{
- array_push(
- $clauses,
- implode(' OR ', $local_clauses)
- );
+ $clauses[] = implode(' OR ', $local_clauses);
}
}
if (isset($search['fields']['user'])
and $search['fields']['user'] != -1)
{
- array_push(
- $clauses,
- 'user_id = '.$search['fields']['user']
- );
+ $clauses[] = 'user_id = '.$search['fields']['user'];
}
if (isset($search['fields']['image_id']))
{
- array_push(
- $clauses,
- 'image_id = '.$search['fields']['image_id']
- );
+ $clauses[] = 'image_id = '.$search['fields']['image_id'];
}
if (isset($search['fields']['filename']))
@@ -123,14 +108,11 @@ SELECT
if (count($search['image_ids']) == 0)
{
// a clause that is always false
- array_push($clauses, '1 = 2 ');
+ $clauses[] = '1 = 2 ';
}
else
{
- array_push(
- $clauses,
- 'image_id IN ('.implode(', ', $search['image_ids']).')'
- );
+ $clauses[] = 'image_id IN ('.implode(', ', $search['image_ids']).')';
}
}
@@ -168,7 +150,7 @@ SELECT
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($data, $row);
+ $data[] = $row;
}
return $data;
@@ -177,4 +159,4 @@ SELECT
add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
trigger_action('functions_history_included');
-?>
+?> \ No newline at end of file
diff --git a/admin/include/functions_install.inc.php b/admin/include/functions_install.inc.php
index d9643e721..e4d447eef 100644
--- a/admin/include/functions_install.inc.php
+++ b/admin/include/functions_install.inc.php
@@ -96,7 +96,7 @@ function install_db_connect(&$infos, &$errors)
}
catch (Exception $e)
{
- array_push( $errors, l10n($e->getMessage()));
+ $errors[] = l10n($e->getMessage());
}
}
?> \ No newline at end of file
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php
index e3fc84d96..4591017bb 100644
--- a/admin/include/functions_metadata.php
+++ b/admin/include/functions_metadata.php
@@ -219,23 +219,20 @@ SELECT id, path, representative_ext
foreach (explode(',', $data[$key]) as $tag_name)
{
- array_push(
- $tags_of[$id],
- tag_id_from_tag_name($tag_name)
- );
+ $tags_of[$id][] = tag_id_from_tag_name($tag_name);
}
}
}
$data['date_metadata_update'] = CURRENT_DATE;
- array_push($datas, $data);
+ $datas[] = $data;
}
if (count($datas) > 0)
{
$update_fields = get_sync_metadata_attributes();
- array_push($update_fields, 'date_metadata_update');
+ $update_fields[] = 'date_metadata_update';
$update_fields = array_diff(
$update_fields,
@@ -297,7 +294,7 @@ SELECT id
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($cat_ids, $row['id']);
+ $cat_ids[] = $row['id'];
}
if (count($cat_ids) == 0)
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index e727e9e6f..9d5e7ecfc 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -169,7 +169,7 @@ order by';
{
while ($nbm_user = pwg_db_fetch_assoc($result))
{
- array_push($data_users, $nbm_user);
+ $data_users[] = $nbm_user;
}
}
}
@@ -285,7 +285,7 @@ function inc_mail_sent_success($nbm_user)
global $page, $env_nbm;
$env_nbm['sent_mail_count'] += 1;
- array_push($page['infos'], sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -298,7 +298,7 @@ function inc_mail_sent_failed($nbm_user)
global $page, $env_nbm;
$env_nbm['error_on_mail_count'] += 1;
- array_push($page['errors'], sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -312,16 +312,32 @@ function display_counter_info()
if ($env_nbm['error_on_mail_count'] != 0)
{
- array_push($page['errors'], l10n_dec('%d mail was not sent.', '%d mails were not sent.', $env_nbm['error_on_mail_count']));
+ $page['errors'][] = l10n_dec(
+ '%d mail was not sent.', '%d mails were not sent.',
+ $env_nbm['error_on_mail_count']
+ );
+
if ($env_nbm['sent_mail_count'] != 0)
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
else
{
if ($env_nbm['sent_mail_count'] == 0)
- array_push($page['infos'], l10n('No mail to send.'));
+ {
+ $page['infos'][] = l10n('No mail to send.');
+ }
else
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
}
@@ -394,12 +410,12 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if (check_sendmail_timeout())
{
// Stop fill list on 'send', if the quota is override
- array_push($page['errors'], $msg_break_timeout);
+ $page['errors'][] = $msg_break_timeout;
break;
}
// Fill return list
- array_push($check_key_treated, $nbm_user['check_key']);
+ $check_key_treated[] = $nbm_user['check_key'];
$do_update = true;
if ($nbm_user['mail_address'] != '')
@@ -453,22 +469,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if ($do_update)
{
- array_push
- (
- $updates,
- array
- (
- 'check_key' => $nbm_user['check_key'],
- 'enabled' => $enabled_value
- )
- );
+ $updates[] = array(
+ 'check_key' => $nbm_user['check_key'],
+ 'enabled' => $enabled_value
+ );
$updated_data_count += 1;
- array_push($page['infos'], sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
else
{
$error_on_updated_data_count += 1;
- array_push($page['errors'], sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
}
@@ -489,13 +500,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
}
- array_push($page['infos'], l10n_dec('%d user was updated.', '%d users were updated.', $updated_data_count));
+ $page['infos'][] = l10n_dec(
+ '%d user was updated.', '%d users were updated.',
+ $updated_data_count
+ );
+
if ($error_on_updated_data_count != 0)
{
- array_push($page['errors'],
- l10n_dec('%d user was not updated.',
- '%d users were not updated.',
- $error_on_updated_data_count));
+ $page['errors'][] = l10n_dec(
+ '%d user was not updated.', '%d users were not updated.',
+ $error_on_updated_data_count
+ );
}
unset_make_full_url();
diff --git a/admin/include/functions_plugins.inc.php b/admin/include/functions_plugins.inc.php
index 682e05d06..7e3774b73 100644
--- a/admin/include/functions_plugins.inc.php
+++ b/admin/include/functions_plugins.inc.php
@@ -39,7 +39,7 @@ function get_admin_plugin_menu_link($file)
}
else if (isset($page['errors']))
{
- array_push($page['errors'], 'PLUGIN ERROR: "'.$file.'" is not a valid file');
+ $page['errors'][] = 'PLUGIN ERROR: "'.$file.'" is not a valid file';
}
return $url;
}
diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php
index ed4b0f410..5ede711fe 100644
--- a/admin/include/functions_upgrade.php
+++ b/admin/include/functions_upgrade.php
@@ -93,7 +93,7 @@ AND id NOT IN (\'' . implode('\',\'', $standard_plugins) . '\')
$plugins = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($plugins, $row['id']);
+ $plugins[] = $row['id'];
}
if (!empty($plugins))
@@ -105,8 +105,8 @@ WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
;';
pwg_query($query);
- array_push($page['infos'],
- l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:').'<p><i>'.implode(', ', $plugins).'</i></p>');
+ $page['infos'][] = l10n('As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:')
+ .'<p><i>'.implode(', ', $plugins).'</i></p>';
}
}
@@ -135,8 +135,8 @@ SELECT
$theme_names = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($theme_ids, $row['id']);
- array_push($theme_names, $row['name']);
+ $theme_ids[] = $row['id'];
+ $theme_names[] = $row['name'];
}
if (!empty($theme_ids))
@@ -148,8 +148,8 @@ DELETE
;';
pwg_query($query);
- array_push($page['infos'],
- l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:').'<p><i>'.implode(', ', $theme_names).'</i></p>');
+ $page['infos'][] = l10n('As a precaution, following themes have been deactivated. You must check for themes upgrade before reactiving them:')
+ .'<p><i>'.implode(', ', $theme_names).'</i></p>';
// what is the default theme?
$query = '
@@ -249,11 +249,11 @@ WHERE '.$conf['user_fields']['username'].'=\''.$username.'\'
if (!$conf['password_verify']($password, $row['password']))
{
- array_push($page['errors'], l10n('Invalid password!'));
+ $page['errors'][] = l10n('Invalid password!');
}
elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster')
{
- array_push($page['errors'], l10n('You do not have access rights to run upgrade'));
+ $page['errors'][] = l10n('You do not have access rights to run upgrade');
}
else
{
@@ -279,7 +279,7 @@ function get_available_upgrade_ids()
if (is_file($upgrades_path.'/'.$node)
and preg_match('/^(.*?)-database\.php$/', $node, $match))
{
- array_push($available_upgrade_ids, $match[1]);
+ $available_upgrade_ids[] = $match[1];
}
}
}
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index a23977910..d136e8928 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -122,13 +122,9 @@ function save_upload_form_config($data, &$errors=array(), &$form_errors=array())
}
else
{
- array_push(
- $errors,
- sprintf(
- $upload_form_config[$field]['error_message'],
- $min,
- $max
- )
+ $errors[] = sprintf(
+ $upload_form_config[$field]['error_message'],
+ $min, $max
);
$form_errors[$field] = '['.$min.' .. '.$max.']';
@@ -494,16 +490,7 @@ function convert_shorthand_notation_to_bytes($value)
function add_upload_error($upload_id, $error_message)
{
- if (!isset($_SESSION['uploads_error']))
- {
- $_SESSION['uploads_error'] = array();
- }
- if (!isset($_SESSION['uploads_error'][$upload_id]))
- {
- $_SESSION['uploads_error'][$upload_id] = array();
- }
-
- array_push($_SESSION['uploads_error'][$upload_id], $error_message);
+ $_SESSION['uploads_error'][$upload_id][] = $error_message;
}
function ready_for_upload_message()
diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php
index c024d881b..450e39dad 100644
--- a/admin/include/languages.class.php
+++ b/admin/include/languages.class.php
@@ -57,7 +57,7 @@ class languages
case 'activate':
if (isset($crt_db_language))
{
- array_push($errors, 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED');
+ $errors[] = 'CANNOT ACTIVATE - LANGUAGE IS ALREADY ACTIVATED';
break;
}
@@ -74,13 +74,13 @@ INSERT INTO '.LANGUAGES_TABLE.'
case 'deactivate':
if (!isset($crt_db_language))
{
- array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED');
+ $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS ALREADY DEACTIVATED';
break;
}
if ($language_id == get_default_language())
{
- array_push($errors, 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE');
+ $errors[] = 'CANNOT DEACTIVATE - LANGUAGE IS DEFAULT LANGUAGE';
break;
}
@@ -95,12 +95,12 @@ DELETE
case 'delete':
if (!empty($crt_db_language))
{
- array_push($errors, 'CANNOT DELETE - LANGUAGE IS ACTIVATED');
+ $errors[] = 'CANNOT DELETE - LANGUAGE IS ACTIVATED';
break;
}
if (!isset($this->fs_languages[$language_id]))
{
- array_push($errors, 'CANNOT DELETE - LANGUAGE DOES NOT EXIST');
+ $errors[] = 'CANNOT DELETE - LANGUAGE DOES NOT EXIST';
break;
}
@@ -368,7 +368,7 @@ UPDATE '.USER_INFOS_TABLE.'
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php
index 4f5f61187..fb5331a47 100644
--- a/admin/include/photos_add_direct_prepare.inc.php
+++ b/admin/include/photos_add_direct_prepare.inc.php
@@ -209,12 +209,12 @@ $setup_errors = array();
$error_message = ready_for_upload_message();
if (!empty($error_message))
{
- array_push($setup_errors, $error_message);
+ $setup_errors[] = $error_message;
}
if (!function_exists('gd_info'))
{
- array_push($setup_errors, l10n('GD library is missing'));
+ $setup_errors[] = l10n('GD library is missing');
}
$template->assign(
@@ -235,21 +235,15 @@ if (!isset($_SESSION['upload_hide_warnings']))
if ($conf['use_exif'] and !function_exists('read_exif_data'))
{
- array_push(
- $setup_warnings,
- l10n('Exif extension not available, admin should disable exif use')
- );
+ $setup_warnings[] = l10n('Exif extension not available, admin should disable exif use');
}
if (get_ini_size('upload_max_filesize') > get_ini_size('post_max_size'))
{
- array_push(
- $setup_warnings,
- sprintf(
- l10n('In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting'),
- get_ini_size('upload_max_filesize', false),
- get_ini_size('post_max_size', false)
- )
+ $setup_warnings[] = l10n(
+ 'In your php.ini file, the upload_max_filesize (%sB) is bigger than post_max_size (%sB), you should change this setting',
+ get_ini_size('upload_max_filesize', false),
+ get_ini_size('post_max_size', false)
);
}
$template->assign(
diff --git a/admin/include/photos_add_direct_process.inc.php b/admin/include/photos_add_direct_process.inc.php
index eb5536342..9cb8e60ba 100644
--- a/admin/include/photos_add_direct_process.inc.php
+++ b/admin/include/photos_add_direct_process.inc.php
@@ -34,12 +34,9 @@ if (isset($_GET['processed']))
// exceeded the post_max_size (but not the upload_max_size)
if (!isset($_POST['submit_upload']))
{
- array_push(
- $page['errors'],
- sprintf(
- l10n('The uploaded files exceed the post_max_size directive in php.ini: %sB'),
- ini_get('post_max_size')
- )
+ $page['errors'][] = l10n(
+ 'The uploaded files exceed the post_max_size directive in php.ini: %sB',
+ ini_get('post_max_size')
);
}
else
@@ -51,7 +48,7 @@ if (isset($_GET['processed']))
{
foreach ($_POST['onUploadError'] as $error)
{
- array_push($page['errors'], $error);
+ $page['errors'][] = $error;
}
}
@@ -97,14 +94,11 @@ if (isset($_GET['processed']))
if (is_valid_image_extension(pathinfo($node['filename'], PATHINFO_EXTENSION)))
{
- array_push($indexes_to_extract, $node['index']);
+ $indexes_to_extract[] = $node['index'];
- array_push(
- $images_to_add,
- array(
- 'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
- 'original_filename' => basename($node['filename']),
- )
+ $images_to_add[] = array(
+ 'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
+ 'original_filename' => basename($node['filename']),
);
}
}
@@ -121,12 +115,9 @@ if (isset($_GET['processed']))
}
elseif (is_valid_image_extension($extension))
{
- array_push(
- $images_to_add,
- array(
- 'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
- 'original_filename' => $_FILES['image_upload']['name'][$idx],
- )
+ $images_to_add[] = array(
+ 'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
+ 'original_filename' => $_FILES['image_upload']['name'][$idx],
);
}
@@ -139,7 +130,7 @@ if (isset($_GET['processed']))
$_POST['level']
);
- array_push($image_ids, $image_id);
+ $image_ids[] = $image_id;
// TODO: if $image_id is not an integer, something went wrong
}
@@ -148,13 +139,10 @@ if (isset($_GET['processed']))
{
$error_message = file_upload_error_message($error);
- array_push(
- $page['errors'],
- sprintf(
- l10n('Error on file "%s" : %s'),
- $_FILES['image_upload']['name'][$idx],
- $error_message
- )
+ $page['errors'][] = l10n(
+ 'Error on file "%s" : %s',
+ $_FILES['image_upload']['name'][$idx],
+ $error_message
);
}
}
@@ -172,7 +160,7 @@ if (isset($_GET['processed']))
{
foreach ($_SESSION['uploads_error'][ $_POST['upload_id'] ] as $error)
{
- array_push($page['errors'], $error);
+ $page['errors'][] = $error;
}
}
@@ -216,29 +204,18 @@ SELECT
$thumbnail['link'] = get_root_url().'admin.php?page=photo-'.$image_id.'&amp;cat_id='.$category_id;
- array_push($page['thumbnails'], $thumbnail);
+ $page['thumbnails'][] = $thumbnail;
}
if (!empty($page['thumbnails']))
{
- array_push(
- $page['infos'],
- sprintf(
- l10n('%d photos uploaded'),
- count($page['thumbnails'])
- )
- );
+ $page['infos'][] = l10n('%d photos uploaded', count($page['thumbnails']));
if (0 != $_POST['level'])
{
- array_push(
- $page['infos'],
- sprintf(
- l10n('Privacy level set to "%s"'),
- l10n(
- sprintf('Level %d', $_POST['level'])
- )
- )
+ $page['infos'][] = l10n(
+ 'Privacy level set to "%s"',
+ l10n(sprintf('Level %d', $_POST['level']))
);
}
@@ -252,13 +229,10 @@ SELECT
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=album-');
// information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album "%s" now contains %d photos'),
- '<em>'.$category_name.'</em>',
- $count
- )
+ $page['infos'][] = l10n(
+ 'Album "%s" now contains %d photos',
+ '<em>'.$category_name.'</em>',
+ $count
);
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index ca4aa161c..45de49a01 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -399,7 +399,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
{
$server_plugins[$plugin['extension_id']] = array();
}
- array_push($server_plugins[$plugin['extension_id']], $plugin['revision_name']);
+ $server_plugins[$plugin['extension_id']][] = $plugin['revision_name'];
}
foreach ($this->fs_plugins as $plugin_id => $fs_plugin)
@@ -503,7 +503,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php
index dbc0d1c92..52e465446 100644
--- a/admin/include/themes.class.php
+++ b/admin/include/themes.class.php
@@ -77,12 +77,9 @@ class themes
$missing_parent = $this->missing_parent_theme($theme_id);
if (isset($missing_parent))
{
- array_push(
- $errors,
- sprintf(
- l10n('Impossible to activate this theme, the parent theme is missing: %s'),
- $missing_parent
- )
+ $errors[] = l10n(
+ 'Impossible to activate this theme, the parent theme is missing: %s',
+ $missing_parent
);
break;
@@ -93,7 +90,7 @@ class themes
and !empty($conf['mobile_theme'])
and $conf['mobile_theme'] != $theme_id)
{
- array_push($errors, l10n('You can activate only one mobile theme.'));
+ $errors[] = l10n('You can activate only one mobile theme.');
break;
}
@@ -134,10 +131,7 @@ INSERT INTO '.THEMES_TABLE.'
// you can't deactivate the last theme
if (count($this->db_themes_by_id) <= 1)
{
- array_push(
- $errors,
- l10n('Impossible to deactivate this theme, you need at least one theme.')
- );
+ $errors[] = l10n('Impossible to deactivate this theme, you need at least one theme.');
break;
}
@@ -190,7 +184,7 @@ DELETE
case 'delete':
if (!empty($crt_db_theme))
{
- array_push($errors, 'CANNOT DELETE - THEME IS INSTALLED');
+ $errors[] = 'CANNOT DELETE - THEME IS INSTALLED';
break;
}
if (!isset($this->fs_themes[$theme_id]))
@@ -202,12 +196,9 @@ DELETE
$children = $this->get_children_themes($theme_id);
if (count($children) > 0)
{
- array_push(
- $errors,
- sprintf(
- l10n('Impossible to delete this theme. Other themes depends on it: %s'),
- implode(', ', $children)
- )
+ $errors[] = l10n(
+ 'Impossible to delete this theme. Other themes depends on it: %s',
+ implode(', ', $children)
);
break;
}
@@ -262,7 +253,7 @@ DELETE
{
if (isset($test_child['parent']) and $test_child['parent'] == $theme_id)
{
- array_push($children, $test_child['name']);
+ $children[] = $test_child['name'];
}
}
@@ -322,7 +313,7 @@ SELECT
$themes = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($themes, $row);
+ $themes[] = $row;
}
return $themes;
}
@@ -628,7 +619,7 @@ SELECT
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, 'obsolete.list');
+ $old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;
diff --git a/admin/include/updates.class.php b/admin/include/updates.class.php
index d25a75af7..5a1f48c70 100644
--- a/admin/include/updates.class.php
+++ b/admin/include/updates.class.php
@@ -161,7 +161,7 @@ class updates
{
if (in_array($ext_id, $conf['updates_ignored'][$type]))
{
- array_push($ignore_list, $ext_id);
+ $ignore_list[] = $ext_id;
}
else
{
@@ -248,7 +248,7 @@ class updates
and $old_files = file(PHPWG_ROOT_PATH.$file, FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
- array_push($old_files, $file);
+ $old_files[] = $file;
foreach($old_files as $old_file)
{
$path = PHPWG_ROOT_PATH.$old_file;
@@ -314,7 +314,7 @@ class updates
}
else
{
- array_push($page['errors'], l10n('Unable to dump database.'));
+ $page['errors'][] = l10n('Unable to dump database.');
}
}
@@ -414,7 +414,8 @@ class updates
unset($_SESSION['need_update']);
if ($step == 2)
{
- array_push($page['infos'], l10n('Update Complete'), $upgrade_to);
+ $page['infos'][] = l10n('Update Complete');
+ $page['infos'][] = $upgrade_to;
$step = -1;
}
else
@@ -425,24 +426,22 @@ class updates
else
{
file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'update/log_error.txt', $error);
- array_push(
- $page['errors'],
- sprintf(
- l10n('An error has occured during extract. Please check files permissions of your piwigo installation.<br><a href="%s">Click here to show log error</a>.'),
- get_root_url().$conf['data_location'].'update/log_error.txt'
- )
- );
+
+ $page['errors'][] = l10n(
+ 'An error has occured during extract. Please check files permissions of your piwigo installation.<br><a href="%s">Click here to show log error</a>.',
+ get_root_url().$conf['data_location'].'update/log_error.txt'
+ );
}
}
else
{
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
- array_push($page['errors'], l10n('An error has occured during upgrade.'));
+ $page['errors'][] = l10n('An error has occured during upgrade.');
}
}
else
{
- array_push($page['errors'], l10n('Piwigo cannot retrieve upgrade file from server'));
+ $page['errors'][] = l10n('Piwigo cannot retrieve upgrade file from server');
}
}
}
diff --git a/admin/include/uploadify/uploadify.php b/admin/include/uploadify/uploadify.php
index 1e36f3268..9bd8f9eb5 100644
--- a/admin/include/uploadify/uploadify.php
+++ b/admin/include/uploadify/uploadify.php
@@ -47,20 +47,7 @@ $image_id = add_uploaded_file(
$_POST['level']
);
-if (!isset($_SESSION['uploads']))
-{
- $_SESSION['uploads'] = array();
-}
-
-if (!isset($_SESSION['uploads'][ $_POST['upload_id'] ]))
-{
- $_SESSION['uploads'][ $_POST['upload_id'] ] = array();
-}
-
-array_push(
- $_SESSION['uploads'][ $_POST['upload_id'] ],
- $image_id
- );
+$_SESSION['uploads'][ $_POST['upload_id'] ][] = $image_id;
$query = '
SELECT
diff --git a/admin/intro.php b/admin/intro.php
index b8d6c8dd4..53fe33c9f 100644
--- a/admin/intro.php
+++ b/admin/intro.php
@@ -45,7 +45,7 @@ if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
{
if (!fetchRemote(PHPWG_URL.'/download/latest_version', $result))
{
- array_push($page['errors'], l10n('Unable to check for upgrade.'));
+ $page['errors'][] = l10n('Unable to check for upgrade.');
}
else
{
@@ -73,33 +73,21 @@ if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
if ('' == $versions['latest'])
{
- array_push(
- $page['errors'],
- l10n('Check for upgrade failed for unknown reasons.')
- );
+ $page['errors'][] = l10n('Check for upgrade failed for unknown reasons.');
}
// concatenation needed to avoid automatic transformation by release
// script generator
else if ('%'.'PWGVERSION'.'%' == $versions['current'])
{
- array_push(
- $page['infos'],
- l10n('You are running on development sources, no check possible.')
- );
+ $page['infos'][] = l10n('You are running on development sources, no check possible.');
}
else if (version_compare($versions['current'], $versions['latest']) < 0)
{
- array_push(
- $page['infos'],
- l10n('A new version of Piwigo is available.')
- );
+ $page['infos'][] = l10n('A new version of Piwigo is available.');
}
else
{
- array_push(
- $page['infos'],
- l10n('You are running the latest version of Piwigo.')
- );
+ $page['infos'][] = l10n('You are running the latest version of Piwigo.');
}
}
}
@@ -201,12 +189,9 @@ $template->assign(
'DB_VERSION' => $db_version,
'DB_ELEMENTS' => l10n_dec('%d photo', '%d photos', $nb_elements),
'DB_CATEGORIES' =>
- l10n_dec('%d album including', '%d albums including',
- $nb_categories).
- l10n_dec('%d physical', '%d physicals',
- $nb_physical).
- l10n_dec(' and %d virtual', ' and %d virtuals',
- $nb_virtual),
+ l10n_dec('%d album including', '%d albums including', $nb_categories).
+ l10n_dec('%d physical', '%d physicals', $nb_physical).
+ l10n_dec(' and %d virtual', ' and %d virtuals', $nb_virtual),
'DB_IMAGE_CATEGORY' => l10n_dec('%d association', '%d associations', $nb_image_category),
'DB_TAGS' => l10n_dec('%d tag', '%d tags', $nb_tags),
'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag),
diff --git a/admin/languages_installed.php b/admin/languages_installed.php
index 93e719491..7989edd00 100644
--- a/admin/languages_installed.php
+++ b/admin/languages_installed.php
@@ -87,7 +87,7 @@ foreach($languages->fs_languages as $language_id => $language)
else
{
$language['is_default'] = false;
- array_push($tpl_languages, $language);
+ $tpl_languages[] = $language;
}
}
diff --git a/admin/languages_new.php b/admin/languages_new.php
index 1b05a257c..1ffaeb8d7 100644
--- a/admin/languages_new.php
+++ b/admin/languages_new.php
@@ -53,7 +53,7 @@ if (isset($_GET['revision']))
{
if (!is_webmaster())
{
- array_push($page['errors'], l10n('Webmaster status is required.'));
+ $page['errors'][] = l10n('Webmaster status is required.');
}
else
{
@@ -73,28 +73,23 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus'])
{
case 'ok':
- array_push($page['infos'],
- l10n('Language has been successfully installed')
- );
+ $page['infos'][] = l10n('Language has been successfully installed');
break;
case 'temp_path_error':
- array_push($page['errors'], l10n('Can\'t create temporary file.'));
+ $page['errors'][] = l10n('Can\'t create temporary file.');
break;
case 'dl_archive_error':
- array_push($page['errors'], l10n('Can\'t download archive.'));
+ $page['errors'][] = l10n('Can\'t download archive.');
break;
case 'archive_error':
- array_push($page['errors'], l10n('Can\'t read or extract archive.'));
+ $page['errors'][] = l10n('Can\'t read or extract archive.');
break;
default:
- array_push(
- $page['errors'],
- l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']))
- );
+ $page['errors'][] = l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']));
}
}
@@ -126,7 +121,7 @@ if ($languages->get_server_languages(true))
}
else
{
- array_push($page['errors'], l10n('Can\'t connect to server.'));
+ $page['errors'][] = l10n('Can\'t connect to server.');
}
$template->assign_var_from_handle('ADMIN_CONTENT', 'languages');
diff --git a/admin/menubar.php b/admin/menubar.php
index 9e254216f..0e0a12624 100644
--- a/admin/menubar.php
+++ b/admin/menubar.php
@@ -148,7 +148,7 @@ UPDATE '.CONFIG_TABLE.'
';
pwg_query($query);
- array_push($page['infos'], l10n('Order of menubar items has been updated successfully.'));
+ $page['infos'][] = l10n('Order of menubar items has been updated successfully.');
}
make_consecutive( $mb_conf );
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index b72a5c69b..cd3445f7c 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -80,10 +80,11 @@ function do_timeout_treatment($post_keyname, $check_key_treated = array())
$_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated);
$must_repost = true;
- array_push($page['errors'],
- l10n_dec('Execution time is out, treatment must be continue [Estimated time: %d second].',
- 'Execution time is out, treatment must be continue [Estimated time: %d seconds].',
- $time_refresh));
+ $page['errors'][] = l10n_dec(
+ 'Execution time is out, treatment must be continue [Estimated time: %d second].',
+ 'Execution time is out, treatment must be continue [Estimated time: %d seconds].',
+ $time_refresh
+ );
}
}
@@ -156,29 +157,20 @@ order by
$nbm_user['check_key'] = find_available_check_key();
// Save key
- array_push($check_key_list, $nbm_user['check_key']);
+ $check_key_list[] = $nbm_user['check_key'];
// Insert new nbm_users
- array_push
- (
- $inserts,
- array
- (
- 'user_id' => $nbm_user['user_id'],
- 'check_key' => $nbm_user['check_key'],
- 'enabled' => 'false' // By default if false, set to true with specific functions
- )
- );
-
- array_push
- (
- $page['infos'],
- l10n(
- 'User %s [%s] added.',
- stripslashes($nbm_user['username']),
- get_email_address_as_display_text($nbm_user['mail_address'])
- )
- );
+ $inserts[] = array(
+ 'user_id' => $nbm_user['user_id'],
+ 'check_key' => $nbm_user['check_key'],
+ 'enabled' => 'false' // By default if false, set to true with specific functions
+ );
+
+ $page['infos'][] = l10n(
+ 'User %s [%s] added.',
+ stripslashes($nbm_user['username']),
+ get_email_address_as_display_text($nbm_user['mail_address'])
+ );
}
// Insert new nbm_users
@@ -282,13 +274,13 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
if ((!$is_action_send) and check_sendmail_timeout())
{
// Stop fill list on 'list_to_send', if the quota is override
- array_push($page['infos'], $msg_break_timeout);
+ $page['infos'][] = $msg_break_timeout;
break;
}
if (($is_action_send) and check_sendmail_timeout())
{
// Stop fill list on 'send', if the quota is override
- array_push($page['errors'], $msg_break_timeout);
+ $page['errors'][] = $msg_break_timeout;
break;
}
@@ -299,7 +291,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
{
set_make_full_url();
// Fill return list of "treated" check_key for 'send'
- array_push($return_list, $nbm_user['check_key']);
+ $return_list[] = $nbm_user['check_key'];
if ($conf['nbm_send_detailed_content'])
{
@@ -402,9 +394,10 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
{
inc_mail_sent_success($nbm_user);
- $data = array('user_id' => $nbm_user['user_id'],
- 'last_send' => $dbnow);
- array_push($datas, $data);
+ $datas[] = array(
+ 'user_id' => $nbm_user['user_id'],
+ 'last_send' => $dbnow
+ );
}
else
{
@@ -419,7 +412,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
if (news_exists($nbm_user['last_send'], $dbnow))
{
// Fill return list of "selected" users for 'list_to_send'
- array_push($return_list, $nbm_user);
+ $return_list[] = $nbm_user;
}
}
@@ -448,7 +441,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
{
if ($is_action_send)
{
- array_push($page['errors'], l10n('No user to send notifications by mail.'));
+ $page['errors'][] = l10n('No user to send notifications by mail.');
}
}
}
@@ -529,9 +522,10 @@ where
}
}
- array_push($page['infos'],
- l10n_dec('%d parameter was updated.', '%d parameters were updated.',
- $updated_param_count));
+ $page['infos'][] = l10n_dec(
+ '%d parameter was updated.', '%d parameters were updated.',
+ $updated_param_count
+ );
// Reload conf with new values
load_conf_from_db('param like \'nbm\\_%\'');
diff --git a/admin/permalinks.php b/admin/permalinks.php
index f673e3659..65ee3d122 100644
--- a/admin/permalinks.php
+++ b/admin/permalinks.php
@@ -59,13 +59,13 @@ function parse_sort_variables(
}
elseif (isset($default_field) and !isset($_GET[$get_param]) )
{
- array_push($ret, $field);
+ $ret[] = $field;
$disp = '<em>'.$disp.'</em>';
}
}
else
{
- array_push($ret, $field);
+ $ret[] = $field;
$disp = '<em>'.$disp.'</em>';
}
if ( isset($template_var) )
@@ -100,7 +100,9 @@ DELETE FROM '.OLD_PERMALINKS_TABLE.'
LIMIT 1';
$result = pwg_query($query);
if (pwg_db_changes($result)==0)
- array_push($page['errors'], l10n('Cannot delete the old permalink !'));
+ {
+ $page['errors'][] = l10n('Cannot delete the old permalink !');
+ }
}
diff --git a/admin/photos_add_direct.php b/admin/photos_add_direct.php
index c9374d5b9..00dcd7f91 100644
--- a/admin/photos_add_direct.php
+++ b/admin/photos_add_direct.php
@@ -43,12 +43,9 @@ DELETE FROM '.CADDIE_TABLE.'
$inserts = array();
foreach (explode(',', $_GET['batch']) as $image_id)
{
- array_push(
- $inserts,
- array(
- 'user_id' => $user['id'],
- 'element_id' => $image_id,
- )
+ $inserts[] = array(
+ 'user_id' => $user['id'],
+ 'element_id' => $image_id,
);
}
mass_inserts(
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 68ebe7c7d..91e992407 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -104,7 +104,7 @@ SELECT category_id
if (isset($_GET['sync_metadata']))
{
sync_metadata(array( intval($_GET['image_id'])));
- array_push($page['infos'], l10n('Metadata synchronized from file'));
+ $page['infos'][] = l10n('Metadata synchronized from file');
}
//--------------------------------------------------------- update informations
@@ -120,7 +120,7 @@ if (isset($_POST['date_creation_action'])
$_POST['date_creation_year'])
)
{
- array_push($page['errors'], l10n('wrong date'));
+ $page['errors'][] = l10n('wrong date');
}
}
@@ -203,7 +203,7 @@ UPDATE '.CATEGORIES_TABLE.'
$represent_options_selected = $_POST['represent'];
- array_push($page['infos'], l10n('Photo informations updated'));
+ $page['infos'][] = l10n('Photo informations updated');
}
// tags
diff --git a/admin/plugins_installed.php b/admin/plugins_installed.php
index 53a2ea110..2c195380e 100644
--- a/admin/plugins_installed.php
+++ b/admin/plugins_installed.php
@@ -64,7 +64,7 @@ if (isset($_GET['action']) and isset($_GET['plugin']))
{
if (!is_webmaster())
{
- array_push($page['errors'], l10n('Webmaster status is required.'));
+ $page['errors'][] = l10n('Webmaster status is required.');
}
else
{
@@ -90,7 +90,7 @@ if (isset($_GET['incompatible_plugins']))
foreach ($plugins->get_incompatible_plugins() as $plugin => $version)
{
if ($plugin == '~~expire~~') continue;
- array_push($incompatible_plugins, $plugin);
+ $incompatible_plugins[] = $plugin;
}
echo json_encode($incompatible_plugins);
@@ -152,7 +152,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$active_plugins++;
}
- array_push($tpl_plugins, $tpl_plugin);
+ $tpl_plugins[] = $tpl_plugin;
}
$template->append('plugin_states', 'active');
@@ -170,17 +170,14 @@ $missing_plugin_ids = array_diff(
if (count($missing_plugin_ids) > 0)
{
- foreach($missing_plugin_ids as $plugin_id)
+ foreach ($missing_plugin_ids as $plugin_id)
{
- array_push(
- $tpl_plugins,
- array(
- 'NAME' => $plugin_id,
- 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
- 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
- 'U_ACTION' => sprintf($action_url, $plugin_id),
- 'STATE' => 'missing',
- )
+ $tpl_plugins[] = array(
+ 'NAME' => $plugin_id,
+ 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
+ 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
+ 'U_ACTION' => sprintf($action_url, $plugin_id),
+ 'STATE' => 'missing',
);
}
$template->append('plugin_states', 'missing');
diff --git a/admin/plugins_new.php b/admin/plugins_new.php
index e17c97729..9c868af05 100644
--- a/admin/plugins_new.php
+++ b/admin/plugins_new.php
@@ -39,7 +39,7 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{
if (!is_webmaster())
{
- array_push($page['errors'], l10n('Webmaster status is required.'));
+ $page['errors'][] = l10n('Webmaster status is required.');
}
else
{
@@ -57,27 +57,25 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus'])
{
case 'ok':
- array_push($page['infos'],
- l10n('Plugin has been successfully copied'),
- l10n('You might go to plugin list to install and activate it.'));
+ $page['infos'][] = l10n('Plugin has been successfully copied');
+ $page['infos'][] = l10n('You might go to plugin list to install and activate it.');
break;
case 'temp_path_error':
- array_push($page['errors'], l10n('Can\'t create temporary file.'));
+ $page['errors'][] = l10n('Can\'t create temporary file.');
break;
case 'dl_archive_error':
- array_push($page['errors'], l10n('Can\'t download archive.'));
+ $page['errors'][] = l10n('Can\'t download archive.');
break;
case 'archive_error':
- array_push($page['errors'], l10n('Can\'t read or extract archive.'));
+ $page['errors'][] = l10n('Can\'t read or extract archive.');
break;
default:
- array_push($page['errors'],
- l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus'])),
- l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).'));
+ $page['errors'][] = l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']));
+ $page['errors'][] = l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).');
}
}
@@ -135,7 +133,7 @@ if ($plugins->get_server_plugins(true))
}
else
{
- array_push($page['errors'], l10n('Can\'t connect to server.'));
+ $page['errors'][] = l10n('Can\'t connect to server.');
}
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
diff --git a/admin/rating.php b/admin/rating.php
index ec9fe9ec6..c205458a0 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -194,7 +194,7 @@ $images = array();
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($images, $row);
+ $images[] = $row;
}
$template->assign( 'images', array() );
diff --git a/admin/site_manager.php b/admin/site_manager.php
index da75a0e59..602887690 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -75,15 +75,13 @@ SELECT COUNT(id) AS count
$row = pwg_db_fetch_assoc(pwg_query($query));
if ($row['count'] > 0)
{
- array_push($page['errors'],
- l10n('This site already exists').' ['.$url.']');
+ $page['errors'][] = l10n('This site already exists').' ['.$url.']';
}
if (count($page['errors']) == 0)
{
if ( ! file_exists($url) )
{
- array_push($page['errors'],
- l10n('Directory does not exist').' ['.$url.']');
+ $page['errors'][] = l10n('Directory does not exist').' ['.$url.']';
}
}
@@ -96,8 +94,7 @@ INSERT INTO '.SITES_TABLE.'
(\''.$url.'\')
;';
pwg_query($query);
- array_push($page['infos'],
- $url.' '.l10n('created'));
+ $page['infos'][] = $url.' '.l10n('created');
}
}
@@ -121,8 +118,7 @@ SELECT galleries_url
case 'delete' :
{
delete_site($page['site']);
- array_push($page['infos'],
- $galleries_url.' '.l10n('deleted'));
+ $page['infos'][] = $galleries_url.' '.l10n('deleted');
break;
}
}
diff --git a/admin/site_reader_local.php b/admin/site_reader_local.php
index d6110d579..b4425f4f2 100644
--- a/admin/site_reader_local.php
+++ b/admin/site_reader_local.php
@@ -52,12 +52,9 @@ function open()
if (!is_dir($this->site_url))
{
- array_push(
- $errors,
- array(
- 'path' => $this->site_url,
- 'type' => 'PWG-ERROR-NO-FS'
- )
+ $errors[] = array(
+ 'path' => $this->site_url,
+ 'type' => 'PWG-ERROR-NO-FS'
);
return false;
@@ -108,12 +105,12 @@ function get_elements($path)
);
}
}
- elseif (is_dir($path.'/'.$node)
+ else if (is_dir($path.'/'.$node)
and $node != 'pwg_high'
and $node != 'pwg_representative'
and $node != 'thumbnail' )
{
- array_push($subdirs, $node);
+ $subdirs[] = $node;
}
} //end while readdir
closedir($contents);
diff --git a/admin/site_update.php b/admin/site_update.php
index 30cef3bc7..0168a31b2 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -199,7 +199,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
// category directory, we need to include it in our array
if (isset($_POST['cat']))
{
- array_push($fs_fulldirs, $basedir);
+ $fs_fulldirs[] = $basedir;
}
// If $_POST['subcats-included'] != 1 ("Search in sub-albums" is unchecked)
// $db_fulldirs doesn't include any subdirectories and $fs_fulldirs does
@@ -253,10 +253,8 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
$insert['global_rank'] = $insert['rank'];
}
- array_push($inserts, $insert);
- array_push(
- $infos,
- array(
+ $inserts[] = $insert;
+ $infos[] = array(
'path' => $fulldir,
'info' => l10n('added')
)
@@ -277,12 +275,9 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
}
else
{
- array_push(
- $errors,
- array(
- 'path' => $fulldir,
- 'type' => 'PWG-UPDATE-1'
- )
+ $errors[] = array(
+ 'path' => $fulldir,
+ 'type' => 'PWG-UPDATE-1'
);
}
}
@@ -326,6 +321,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
{
$granted_grps[$row['cat_id']]=array();
}
+ // TODO: explanaition
array_push(
$granted_grps,
array(
@@ -349,6 +345,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
{
$granted_users[$row['cat_id']]=array();
}
+ // TODO: explanaition
array_push(
$granted_users,
array(
@@ -372,37 +369,28 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
{
foreach ($granted_grps[$parent_id] as $granted_grp)
{
- array_push(
- $insert_granted_grps,
- array(
- 'group_id' => $granted_grp,
- 'cat_id' => $ids
- )
- );
+ $insert_granted_grps[] = array(
+ 'group_id' => $granted_grp,
+ 'cat_id' => $ids
+ );
}
}
if (isset($granted_users[$parent_id]))
{
foreach ($granted_users[$parent_id] as $granted_user)
{
- array_push(
- $insert_granted_users,
- array(
- 'user_id' => $granted_user,
- 'cat_id' => $ids
- )
- );
+ $insert_granted_users[] = array(
+ 'user_id' => $granted_user,
+ 'cat_id' => $ids
+ );
}
}
foreach (get_admins() as $granted_user)
{
- array_push(
- $insert_granted_users,
- array(
- 'user_id' => $granted_user,
- 'cat_id' => $ids
- )
- );
+ $insert_granted_users[] = array(
+ 'user_id' => $granted_user,
+ 'cat_id' => $ids
+ );
}
}
}
@@ -420,19 +408,26 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
}
// to delete categories
- $to_delete = array(); $to_delete_derivative_dirs = array();
+ $to_delete = array();
+ $to_delete_derivative_dirs = array();
+
foreach (array_diff(array_keys($db_fulldirs), $fs_fulldirs) as $fulldir)
{
- array_push($to_delete, $db_fulldirs[$fulldir]);
+ $to_delete[] = $db_fulldirs[$fulldir];
unset($db_fulldirs[$fulldir]);
- array_push($infos, array('path' => $fulldir,
- 'info' => l10n('deleted')));
+
+ $infos[] = array(
+ 'path' => $fulldir,
+ 'info' => l10n('deleted')
+ );
+
if (substr_compare($fulldir, '../', 0, 3)==0)
{
$fulldir = substr($fulldir, 3);
}
$to_delete_derivative_dirs[] = PHPWG_ROOT_PATH.PWG_DERIVATIVE_DIR.$fulldir;
}
+
if (count($to_delete) > 0)
{
if (!$simulate)
@@ -505,12 +500,9 @@ SELECT id, path
$filename = basename($path);
if (!preg_match($conf['sync_chars_regex'], $filename))
{
- array_push(
- $errors,
- array(
- 'path' => $path,
- 'type' => 'PWG-UPDATE-1'
- )
+ $errors[] = array(
+ 'path' => $path,
+ 'type' => 'PWG-UPDATE-1'
);
continue;
@@ -532,25 +524,16 @@ SELECT id, path
$insert['level'] = $_POST['privacy_level'];
}
- array_push(
- $inserts,
- $insert
- );
+ $inserts[] = $insert;
- array_push(
- $insert_links,
- array(
- 'image_id' => $insert['id'],
- 'category_id' => $insert['storage_category_id'],
- )
+ $insert_links[] = array(
+ 'image_id' => $insert['id'],
+ 'category_id' => $insert['storage_category_id'],
);
- array_push(
- $infos,
- array(
- 'path' => $insert['path'],
- 'info' => l10n('added')
- )
+ $infos[] = array(
+ 'path' => $insert['path'],
+ 'info' => l10n('added')
);
$caddiables[] = $insert['id'];
@@ -587,9 +570,11 @@ SELECT id, path
$to_delete_elements = array();
foreach (array_diff($db_elements, array_keys($fs)) as $path)
{
- array_push($to_delete_elements, array_search($path, $db_elements));
- array_push($infos, array('path' => $path,
- 'info' => l10n('deleted')));
+ $to_delete_elements[] = array_search($path, $db_elements);
+ $infos[] = array(
+ 'path' => $path,
+ 'info' => l10n('deleted')
+ );
}
if (count($to_delete_elements) > 0)
{
@@ -658,7 +643,7 @@ if (isset($_POST['submit'])
}
$data['id']=$id;
- array_push($datas, $data);
+ $datas[] = $data;
} // end foreach file
$counts['upd_elements'] = count($datas);
@@ -739,7 +724,7 @@ if (isset($_POST['submit']) and isset($_POST['sync_meta'])
{
$data['date_metadata_update'] = CURRENT_DATE;
$data['id']=$id;
- array_push($datas, $data);
+ $datas[] = $data;
foreach (array('keywords', 'tags') as $key)
{
@@ -752,17 +737,17 @@ if (isset($_POST['submit']) and isset($_POST['sync_meta'])
foreach (explode(',', $data[$key]) as $tag_name)
{
- array_push(
- $tags_of[$id],
- tag_id_from_tag_name($tag_name)
- );
+ $tags_of[$id][] = tag_id_from_tag_name($tag_name);
}
}
}
}
else
{
- array_push($errors, array('path' => $element_infos['path'], 'type' => 'PWG-ERROR-NO-FS'));
+ $errors[] = array(
+ 'path' => $element_infos['path'],
+ 'type' => 'PWG-ERROR-NO-FS'
+ );
}
}
diff --git a/admin/stats.php b/admin/stats.php
index d6fd0235a..658d158c2 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -97,7 +97,7 @@ SELECT
$output = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($output, $row);
+ $output[] = $row;
}
return $output;
@@ -226,7 +226,7 @@ SELECT *
if (isset($need_update[$key]))
{
$row['nb_pages'] += $need_update[$key];
- array_push($updates, $row);
+ $updates[] = $row;
unset($need_update[$key]);
}
}
@@ -236,16 +236,13 @@ foreach ($need_update as $time_key => $nb_pages)
{
$time_tokens = explode('-', $time_key);
- array_push(
- $inserts,
- array(
- 'year' => $time_tokens[0],
- 'month' => @$time_tokens[1],
- 'day' => @$time_tokens[2],
- 'hour' => @$time_tokens[3],
- 'nb_pages' => $nb_pages,
- )
- );
+ $inserts[] = array(
+ 'year' => $time_tokens[0],
+ 'month' => @$time_tokens[1],
+ 'day' => @$time_tokens[2],
+ 'hour' => @$time_tokens[3],
+ 'nb_pages' => $nb_pages,
+ );
}
if (count($updates) > 0)
@@ -323,10 +320,7 @@ $title_parts = array();
$url = PHPWG_ROOT_PATH.'admin.php?page=stats';
-array_push(
- $title_parts,
- '<a href="'.$url.'">'.l10n('Overall').'</a>'
- );
+$title_parts[] = '<a href="'.$url.'">'.l10n('Overall').'</a>';
$period_label = l10n('Year');
@@ -334,10 +328,7 @@ if (isset($page['year']))
{
$url.= '&amp;year='.$page['year'];
- array_push(
- $title_parts,
- '<a href="'.$url.'">'.$page['year'].'</a>'
- );
+ $title_parts[] = '<a href="'.$url.'">'.$page['year'].'</a>';
$period_label = l10n('Month');
}
@@ -346,10 +337,7 @@ if (isset($page['month']))
{
$url.= '&amp;month='.$page['month'];
- array_push(
- $title_parts,
- '<a href="'.$url.'">'.$lang['month'][$page['month']].'</a>'
- );
+ $title_parts[] = '<a href="'.$url.'">'.$lang['month'][$page['month']].'</a>';
$period_label = l10n('Day');
}
@@ -366,10 +354,7 @@ if (isset($page['day']))
$lang['day'][date('w', $time)]
);
- array_push(
- $title_parts,
- '<a href="'.$url.'">'.$day_title.'</a>'
- );
+ $title_parts[] = '<a href="'.$url.'">'.$day_title.'</a>';
$period_label = l10n('Hour');
}
diff --git a/admin/tags.php b/admin/tags.php
index 4927fc4f3..02ab03b1c 100644
--- a/admin/tags.php
+++ b/admin/tags.php
@@ -69,23 +69,14 @@ SELECT id, name
{
if (in_array($tag_name, $existing_names))
{
- array_push(
- $page['errors'],
- l10n(
- 'Tag "%s" already exists',
- $tag_name
- )
- );
+ $page['errors'][] = l10n('Tag "%s" already exists', $tag_name);
}
else if (!empty($tag_name))
{
- array_push(
- $updates,
- array(
- 'id' => $tag_id,
- 'name' => addslashes($tag_name),
- 'url_name' => trigger_event('render_tag_url', $tag_name),
- )
+ $updates[] = array(
+ 'id' => $tag_id,
+ 'name' => addslashes($tag_name),
+ 'url_name' => trigger_event('render_tag_url', $tag_name),
);
}
}
@@ -134,13 +125,7 @@ SELECT id, name
{
if (in_array($tag_name, $existing_names))
{
- array_push(
- $page['errors'],
- l10n(
- 'Tag "%s" already exists',
- $tag_name
- )
- );
+ $page['errors'][] = l10n('Tag "%s" already exists', $tag_name);
}
else if (!empty($tag_name))
{
@@ -171,12 +156,9 @@ SELECT id, name
$inserts = array();
foreach ($destination_tag_image_ids as $image_id)
{
- array_push(
- $inserts,
- array(
- 'tag_id' => $destination_tag_id,
- 'image_id' => $image_id
- )
+ $inserts[] = array(
+ 'tag_id' => $destination_tag_id,
+ 'image_id' => $image_id
);
}
@@ -188,13 +170,11 @@ SELECT id, name
$inserts
);
}
- array_push(
- $page['infos'],
- l10n(
- 'Tag "%s" is now a duplicate of "%s"',
- stripslashes($tag_name),
- $current_name_of[$tag_id]
- )
+
+ $page['infos'][] = l10n(
+ 'Tag "%s" is now a duplicate of "%s"',
+ stripslashes($tag_name),
+ $current_name_of[$tag_id]
);
}
}
@@ -217,10 +197,7 @@ if (isset($_POST['confirm_merge']))
{
if (!isset($_POST['destination_tag']))
{
- array_push(
- $page['errors'],
- l10n('No destination tag selected')
- );
+ $page['errors'][] = l10n('No destination tag selected');
}
else
{
@@ -274,12 +251,9 @@ SELECT
$inserts = array();
foreach ($image_ids_to_link as $image_id)
{
- array_push(
- $inserts,
- array(
- 'tag_id' => $destination_tag_id,
- 'image_id' => $image_id
- )
+ $inserts[] = array(
+ 'tag_id' => $destination_tag_id,
+ 'image_id' => $image_id
);
}
@@ -298,13 +272,10 @@ SELECT
$tags_deleted[] = $name_of_tag[$tag_id];
}
- array_push(
- $page['infos'],
- l10n(
- 'Tags <em>%s</em> merged into tag <em>%s</em>',
- implode(', ', $tags_deleted),
- $name_of_tag[$destination_tag_id]
- )
+ $page['infos'][] = l10n(
+ 'Tags <em>%s</em> merged into tag <em>%s</em>',
+ implode(', ', $tags_deleted),
+ $name_of_tag[$destination_tag_id]
);
}
}
@@ -326,14 +297,11 @@ SELECT name
delete_tags($_POST['tags']);
- array_push(
- $page['infos'],
- l10n_dec(
- 'The following tag was deleted',
- 'The %d following tags were deleted',
- count($tag_names)).' : '.
- implode(', ', $tag_names)
- );
+ $page['infos'][] = l10n_dec(
+ 'The following tag was deleted', 'The %d following tags were deleted',
+ count($tag_names)
+ )
+ .' : '.implode(', ', $tag_names);
}
// +-----------------------------------------------------------------------+
@@ -378,23 +346,11 @@ SELECT id
)
);
- array_push(
- $page['infos'],
- l10n(
- 'Tag "%s" was added',
- stripslashes($tag_name)
- )
- );
+ $page['infos'][] = l10n('Tag "%s" was added', stripslashes($tag_name));
}
else
{
- array_push(
- $page['errors'],
- l10n(
- 'Tag "%s" already exists',
- stripslashes($tag_name)
- )
- );
+ $page['errors'][] = l10n('Tag "%s" already exists', stripslashes($tag_name));
}
}
@@ -420,19 +376,16 @@ $orphan_tags = get_orphan_tags();
$orphan_tag_names = array();
foreach ($orphan_tags as $tag)
{
- array_push($orphan_tag_names, trigger_event('render_tag_name', $tag['name']));
+ $orphan_tag_names[] = trigger_event('render_tag_name', $tag['name']);
}
if (count($orphan_tag_names) > 0)
{
- array_push(
- $page['warnings'],
- sprintf(
- l10n('You have %d orphan tags: %s.').' <a href="%s">'.l10n('Delete orphan tags').'</a>',
- count($orphan_tag_names),
- implode(', ', $orphan_tag_names),
- get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token()
- )
+ $page['warnings'][] = sprintf(
+ l10n('You have %d orphan tags: %s.').' <a href="%s">'.l10n('Delete orphan tags').'</a>',
+ count($orphan_tag_names),
+ implode(', ', $orphan_tag_names),
+ get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token()
);
}
diff --git a/admin/themes_installed.php b/admin/themes_installed.php
index 07c9f3bf4..93569f242 100644
--- a/admin/themes_installed.php
+++ b/admin/themes_installed.php
@@ -62,7 +62,7 @@ $db_themes = $themes->get_db_themes();
$db_theme_ids = array();
foreach ($db_themes as $db_theme)
{
- array_push($db_theme_ids, $db_theme['id']);
+ $db_theme_ids[] = $db_theme['id'];
}
$tpl_themes = array();
@@ -143,7 +143,7 @@ foreach ($themes->fs_themes as $theme_id => $fs_theme)
}
}
- array_push($tpl_themes, $tpl_theme);
+ $tpl_themes[] = $tpl_theme;
}
// sort themes by state then by name
diff --git a/admin/themes_new.php b/admin/themes_new.php
index 13252f629..528b5ec93 100644
--- a/admin/themes_new.php
+++ b/admin/themes_new.php
@@ -50,7 +50,7 @@ if (isset($_GET['revision']) and isset($_GET['extension']))
{
if (!is_webmaster())
{
- array_push($page['errors'], l10n('Webmaster status is required.'));
+ $page['errors'][] = l10n('Webmaster status is required.');
}
else
{
@@ -75,28 +75,25 @@ if (isset($_GET['installstatus']))
switch ($_GET['installstatus'])
{
case 'ok':
- array_push(
- $page['infos'],
- l10n('Theme has been successfully installed')
- );
+ $page['infos'][] = l10n('Theme has been successfully installed');
break;
case 'temp_path_error':
- array_push($page['errors'], l10n('Can\'t create temporary file.'));
+ $page['errors'][] = l10n('Can\'t create temporary file.');
break;
case 'dl_archive_error':
- array_push($page['errors'], l10n('Can\'t download archive.'));
+ $page['errors'][] = l10n('Can\'t download archive.');
break;
case 'archive_error':
- array_push($page['errors'], l10n('Can\'t read or extract archive.'));
+ $page['errors'][] = l10n('Can\'t read or extract archive.');
break;
default:
- array_push(
- $page['errors'],
- l10n('An error occured during extraction (%s).', htmlspecialchars($_GET['installstatus']))
+ $page['errors'][] = l10n(
+ 'An error occured during extraction (%s).',
+ htmlspecialchars($_GET['installstatus'])
);
}
}
@@ -130,7 +127,7 @@ if ($themes->get_server_themes(true)) // only new themes
}
else
{
- array_push($page['errors'], l10n('Can\'t connect to server.'));
+ $page['errors'][] = l10n('Can\'t connect to server.');
}
$template->assign('default_screenshot',
diff --git a/admin/updates_ext.php b/admin/updates_ext.php
index fcbd729ca..485c94134 100644
--- a/admin/updates_ext.php
+++ b/admin/updates_ext.php
@@ -32,8 +32,8 @@ $autoupdate = new updates($page['page']);
$show_reset = false;
if (!$autoupdate->get_server_extensions())
{
- array_push($page['errors'], l10n('Can\'t connect to server.'));
- return;
+ $page['errors'][] = l10n('Can\'t connect to server.');
+ return; // TODO: remove this return and add a proper "page killer"
}
foreach ($autoupdate->types as $type)
diff --git a/admin/updates_pwg.php b/admin/updates_pwg.php
index 016deeecd..9caf49639 100644
--- a/admin/updates_pwg.php
+++ b/admin/updates_pwg.php
@@ -149,7 +149,7 @@ if ($step == 3 and is_webmaster())
if (!is_webmaster())
{
- array_push($page['errors'], l10n('Webmaster status is required.'));
+ $page['errors'][] = l10n('Webmaster status is required.');
}
$template->assign(array(
diff --git a/admin/user_list.php b/admin/user_list.php
index 0dcc1ba95..2062fad4f 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -119,7 +119,7 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
$user = $row;
$user['groups'] = array();
- array_push($users, $user);
+ $users[] = $user;
}
// add group lists
@@ -140,10 +140,7 @@ SELECT user_id, group_id
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push(
- $users[$user_nums[$row['user_id']]]['groups'],
- $row['group_id']
- );
+ $users[ $user_nums[ $row['user_id'] ] ]['groups'][] = $row['group_id'];
}
}
@@ -191,19 +188,19 @@ if ($conf['double_password_type_in_admin'] == true)
{
if(empty($_POST['password']))
{
- array_push($page['errors'], l10n('Password is missing. Please enter the password.'));
+ $page['errors'][] = l10n('Password is missing. Please enter the password.');
}
else if(empty($_POST['password_conf']))
{
- array_push($page['errors'], l10n('Password confirmation is missing. Please confirm the chosen password.'));
+ $page['errors'][] = l10n('Password confirmation is missing. Please confirm the chosen password.');
}
else if(empty($_POST['email']))
{
- array_push($page['errors'], l10n('Email address is missing. Please specify an email address.'));
+ $page['errors'][] = l10n('Email address is missing. Please specify an email address.');
}
else if ($_POST['password'] != $_POST['password_conf'])
{
- array_push($page['errors'], l10n('The passwords do not match'));
+ $page['errors'][] = l10n('The passwords do not match');
}
else
{
@@ -212,13 +209,7 @@ if ($conf['double_password_type_in_admin'] == true)
if (count($page['errors']) == 0)
{
- array_push(
- $page['infos'],
- l10n(
- 'user "%s" added',
- $_POST['login']
- )
- );
+ $page['infos'][] = l10n('user "%s" added', $_POST['login']);
}
}
}
@@ -232,13 +223,7 @@ else if ($conf['double_password_type_in_admin'] == false)
if (count($page['errors']) == 0)
{
- array_push(
- $page['infos'],
- l10n(
- 'user "%s" added',
- stripslashes($_POST['login'])
- )
- );
+ $page['infos'][] = l10n('user "%s" added', stripslashes($_POST['login']));
}
}
}
@@ -295,7 +280,7 @@ if (isset($_POST['delete']) or isset($_POST['pref_submit']))
{
foreach($page['filtered_users'] as $local_user)
{
- array_push($collection, $local_user['id']);
+ $collection[] = $local_user['id'];
}
break;
}
@@ -311,7 +296,7 @@ if (isset($_POST['delete']) or isset($_POST['pref_submit']))
if (count($collection) == 0)
{
- array_push($page['errors'], l10n('Select at least one user'));
+ $page['errors'][] = l10n('Select at least one user');
}
}
@@ -322,20 +307,20 @@ if (isset($_POST['delete']) and count($collection) > 0)
{
if (in_array($conf['guest_id'], $collection))
{
- array_push($page['errors'], l10n('Guest cannot be deleted'));
+ $page['errors'][] = l10n('Guest cannot be deleted');
}
if (($conf['guest_id'] != $conf['default_user_id']) and
in_array($conf['default_user_id'], $collection))
{
- array_push($page['errors'], l10n('Default user cannot be deleted'));
+ $page['errors'][] = l10n('Default user cannot be deleted');
}
if (in_array($conf['webmaster_id'], $collection))
{
- array_push($page['errors'], l10n('Webmaster cannot be deleted'));
+ $page['errors'][] = l10n('Webmaster cannot be deleted');
}
if (in_array($user['id'], $collection))
{
- array_push($page['errors'], l10n('You cannot delete your account'));
+ $page['errors'][] = l10n('You cannot delete your account');
}
if (count($page['errors']) == 0)
@@ -346,13 +331,12 @@ if (isset($_POST['delete']) and count($collection) > 0)
{
delete_user($user_id);
}
- array_push(
- $page['infos'],
- l10n_dec(
- '%d user deleted', '%d users deleted',
- count($collection)
- )
+
+ $page['infos'][] = l10n_dec(
+ '%d user deleted', '%d users deleted',
+ count($collection)
);
+
foreach ($page['filtered_users'] as $filter_key => $filter_user)
{
if (in_array($filter_user['id'], $collection))
@@ -363,7 +347,7 @@ if (isset($_POST['delete']) and count($collection) > 0)
}
else
{
- array_push($page['errors'], l10n('You need to confirm deletion'));
+ $page['errors'][] = l10n('You need to confirm deletion');
}
}
}
@@ -391,9 +375,10 @@ SELECT user_id
{
foreach ($associable as $item)
{
- array_push($datas,
- array('group_id'=>$_POST['associate'],
- 'user_id'=>$item));
+ $datas[] = array(
+ 'group_id' => $_POST['associate'],
+ 'user_id' => $item
+ );
}
mass_inserts(USER_GROUP_TABLE,
@@ -426,8 +411,8 @@ DELETE FROM '.USER_GROUP_TABLE.'
if ($conf['activate_comments'])
{
- array_push($formfields, 'show_nb_comments');
- array_push($true_false_fields, 'show_nb_comments');
+ $formfields[] = 'show_nb_comments';
+ $true_false_fields[] = 'show_nb_comments';
}
foreach ($formfields as $formfield)
@@ -444,7 +429,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
if ($_POST[$test] != 'leave')
{
- array_push($dbfields['update'], $formfield);
+ $dbfields['update'][] = $formfield;
}
}
@@ -480,7 +465,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
$data['level'] = 8;
if (!in_array('level', $dbfields['update']))
{
- array_push($dbfields['update'], 'level');
+ $dbfields['update'][] = 'level';
}
}
}
@@ -507,7 +492,7 @@ DELETE FROM '.USER_GROUP_TABLE.'
}
}
- array_push($datas, $data);
+ $datas[] = $data;
}
mass_updates(USER_INFOS_TABLE, $dbfields, $datas);
diff --git a/admin/user_perm.php b/admin/user_perm.php
index 7082bf34f..36ab8a825 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -119,8 +119,8 @@ if (pwg_db_num_rows($result) > 0)
$cats = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($cats, $row);
- array_push($group_authorized, $row['cat_id']);
+ $cats[] = $row;
+ $group_authorized[] = $row['cat_id'];
}
usort($cats, 'global_rank_compare');
@@ -152,7 +152,7 @@ $result = pwg_query($query_true);
$authorized_ids = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($authorized_ids, $row['id']);
+ $authorized_ids[] = $row['id'];
}
$query_false = '
diff --git a/comments.php b/comments.php
index 44fcaf936..906fca87a 100644
--- a/comments.php
+++ b/comments.php
@@ -446,8 +446,8 @@ $query.= '
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($comments, $row);
- array_push($element_ids, $row['image_id']);
+ $comments[] = $row;
+ $element_ids[] = $row['image_id'];
}
if (count($comments) > 0)
diff --git a/identification.php b/identification.php
index 9c3de083e..10dd10065 100644
--- a/identification.php
+++ b/identification.php
@@ -39,7 +39,7 @@ if ( !empty($_GET['redirect']) )
$redirect_to = urldecode($_GET['redirect']);
if ( is_a_guest() )
{
- array_push($page['errors'], l10n('You are not authorized to access the requested page'));
+ $page['errors'][] = l10n('You are not authorized to access the requested page');
}
}
@@ -47,10 +47,7 @@ if (isset($_POST['login']))
{
if (!isset($_COOKIE[session_name()]))
{
- array_push(
- $page['errors'],
- l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.')
- );
+ $page['errors'][] = l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.');
}
else
{
@@ -68,7 +65,7 @@ if (isset($_POST['login']))
}
else
{
- array_push($page['errors'], l10n('Invalid password!') );
+ $page['errors'][] = l10n('Invalid password!');
}
}
}
diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php
index f3eb2a909..091d78884 100644
--- a/include/calendar_monthly.class.php
+++ b/include/calendar_monthly.class.php
@@ -388,7 +388,7 @@ SELECT id, file,representative_ext,path,width,height,rotation, '.pwg_db_get_dayo
$first_day_dow -= 1;
}
- array_push( $wday_labels, array_shift($wday_labels) );
+ $wday_labels[] = array_shift($wday_labels);
}
list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size;
diff --git a/include/calendar_weekly.class.php b/include/calendar_weekly.class.php
index 5c2a346b1..0bd133284 100644
--- a/include/calendar_weekly.class.php
+++ b/include/calendar_weekly.class.php
@@ -68,8 +68,7 @@ class Calendar extends CalendarBase
{
$this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
$this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
- array_push( $this->calendar_levels[CDAY]['labels'],
- array_shift( $this->calendar_levels[CDAY]['labels'] ) );
+ $this->calendar_levels[CDAY]['labels'][] = array_shift($this->calendar_levels[CDAY]['labels']);
}
}
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 8d334f6a0..f579a6cdd 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -207,7 +207,7 @@ SELECT *
if (isset($image_id) and !in_array($image_id, $image_ids))
{
- array_push($new_image_ids, $image_id);
+ $new_image_ids[] = $image_id;
}
if ($conf['representative_cache_on_level'])
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php
index 9c73637ee..3992ed6c2 100644
--- a/include/dblayer/functions_mysql.inc.php
+++ b/include/dblayer/functions_mysql.inc.php
@@ -328,7 +328,7 @@ SHOW FULL COLUMNS FROM '.$tablename;
{
$column.= " collate '".$row['Collation']."'";
}
- array_push($columns, $column);
+ $columns[] = $column;
}
}
@@ -564,7 +564,7 @@ function do_maintenance_all_tables()
$result = pwg_query($query);
while ($row = pwg_db_fetch_row($result))
{
- array_push($all_tables, $row[0]);
+ $all_tables[] = $row[0];
}
// Repair all tables
@@ -582,7 +582,7 @@ function do_maintenance_all_tables()
{
if ($row['Key'] == 'PRI')
{
- array_push($all_primary_key, $row['Field']);
+ $all_primary_key[] = $row['Field'];
}
}
@@ -598,17 +598,11 @@ function do_maintenance_all_tables()
$mysql_rc = $mysql_rc && pwg_query($query);
if ($mysql_rc)
{
- array_push(
- $page['infos'],
- l10n('All optimizations have been successfully completed.')
- );
+ $page['infos'][] = l10n('All optimizations have been successfully completed.');
}
else
{
- array_push(
- $page['errors'],
- l10n('Optimizations have been completed with some errors.')
- );
+ $page['errors'][] = l10n('Optimizations have been completed with some errors.');
}
}
diff --git a/include/dblayer/functions_mysqli.inc.php b/include/dblayer/functions_mysqli.inc.php
index 8c1ffe5ae..8dc4e46ce 100644
--- a/include/dblayer/functions_mysqli.inc.php
+++ b/include/dblayer/functions_mysqli.inc.php
@@ -365,7 +365,7 @@ SHOW FULL COLUMNS FROM '.$tablename;
{
$column.= " collate '".$row['Collation']."'";
}
- array_push($columns, $column);
+ $columns[] = $column;
}
}
@@ -601,7 +601,7 @@ function do_maintenance_all_tables()
$result = pwg_query($query);
while ($row = pwg_db_fetch_row($result))
{
- array_push($all_tables, $row[0]);
+ $all_tables[] = $row[0];
}
// Repair all tables
@@ -619,7 +619,7 @@ function do_maintenance_all_tables()
{
if ($row['Key'] == 'PRI')
{
- array_push($all_primary_key, $row['Field']);
+ $all_primary_key[] = $row['Field'];
}
}
@@ -635,17 +635,11 @@ function do_maintenance_all_tables()
$mysqli_rc = $mysqli_rc && pwg_query($query);
if ($mysqli_rc)
{
- array_push(
- $page['infos'],
- l10n('All optimizations have been successfully completed.')
- );
+ $page['infos'][] = l10n('All optimizations have been successfully completed.');
}
else
{
- array_push(
- $page['errors'],
- l10n('Optimizations have been completed with some errors.')
- );
+ $page['errors'][] = l10n('Optimizations have been completed with some errors.');
}
}
diff --git a/include/filter.inc.php b/include/filter.inc.php
index 4b0f93bbf..45440d0fd 100644
--- a/include/filter.inc.php
+++ b/include/filter.inc.php
@@ -123,7 +123,10 @@ WHERE ';
unset($filter_key);
if (get_filter_page_value('add_notes'))
{
- $header_notes[] = l10n_dec('Photos posted within the last %d day.', 'Photos posted within the last %d days.', $filter['recent_period']);
+ $header_notes[] = l10n_dec(
+ 'Photos posted within the last %d day.', 'Photos posted within the last %d days.',
+ $filter['recent_period']
+ );
}
include_once(PHPWG_ROOT_PATH.'include/functions_filter.inc.php');
}
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 6f2df2880..5dc8ea255 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -878,8 +878,10 @@ SELECT element_id
foreach ($caddiables as $caddiable)
{
- array_push($datas, array('element_id' => $caddiable,
- 'user_id' => $user['id']));
+ $datas[] = array(
+ 'element_id' => $caddiable,
+ 'user_id' => $user['id'],
+ );
}
if (count($caddiables) > 0)
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php
index 59f2ee571..b8ad3d0fa 100644
--- a/include/functions_calendar.inc.php
+++ b/include/functions_calendar.inc.php
@@ -212,7 +212,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$chronology_date = array();
if ( isset($page['chronology_date'][0]) )
{
- array_push($chronology_date, $page['chronology_date'][0]);
+ $chronology_date[] = $page['chronology_date'][0];
}
}
else
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 42ceb5cc3..9ea597672 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -93,7 +93,7 @@ function insert_user_comment( &$comm, $key, &$infos )
{
if ($conf['comments_author_mandatory'])
{
- array_push($infos, l10n('Username is mandatory') );
+ $infos[] = l10n('Username is mandatory');
$comment_action='reject';
}
$comm['author'] = 'guest';
@@ -110,7 +110,7 @@ SELECT COUNT(*) AS user_exists
$row = pwg_db_fetch_assoc( pwg_query( $query ) );
if ( $row['user_exists'] == 1 )
{
- array_push($infos, l10n('This login is already used by another user') );
+ $infos[] = l10n('This login is already used by another user');
$comment_action='reject';
}
}
@@ -141,7 +141,7 @@ SELECT COUNT(*) AS user_exists
}
if (!url_check_format($comm['website_url']))
{
- array_push($infos, l10n('Your website URL is invalid'));
+ $infos[] = l10n('Your website URL is invalid');
$comment_action='reject';
}
}
@@ -155,13 +155,13 @@ SELECT COUNT(*) AS user_exists
}
else if ($conf['comments_email_mandatory'])
{
- array_push($infos, l10n('Email address is missing. Please specify an email address.') );
+ $infos[] = l10n('Email address is missing. Please specify an email address.');
$comment_action='reject';
}
}
else if (!email_check_format($comm['email']))
{
- array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));
+ $infos[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
$comment_action='reject';
}
@@ -192,7 +192,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
list($counter) = pwg_db_fetch_row(pwg_query($query));
if ( $counter > 0 )
{
- array_push( $infos, l10n('Anti-flood system : please wait for a moment before trying to post another comment') );
+ $infos[] = l10n('Anti-flood system : please wait for a moment before trying to post another comment');
$comment_action='reject';
}
}
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 51858cf33..b67f46d3c 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -293,7 +293,7 @@ SELECT
{
if (!empty($admin['mail_address']))
{
- array_push($admins, format_email($admin['username'], $admin['mail_address']));
+ $admins[] = format_email($admin['username'], $admin['mail_address']);
}
}
}
@@ -419,7 +419,7 @@ WHERE
{
if (!empty($row['mail_address']))
{
- array_push($Bcc, format_email(stripslashes($row['username']), $row['mail_address']));
+ $Bcc[] = format_email(stripslashes($row['username']), $row['mail_address']);
}
}
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php
index a687195d9..18378cbb4 100644
--- a/include/functions_notification.inc.php
+++ b/include/functions_notification.inc.php
@@ -206,7 +206,7 @@ function custom_notification_query($action, $type, $start, $end)
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($infos, $row);
+ $infos[] = $row;
}
return $infos;
@@ -369,7 +369,7 @@ function add_news_line(&$news, $count, $singular_fmt_key, $plural_fmt_key, $url=
{
$line = '<a href="'.$url.'">'.$line.'</a>';
}
- array_push($news, $line);
+ $news[] = $line;
}
}
@@ -450,7 +450,7 @@ SELECT date_available,
$dates = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($dates, $row);
+ $dates[] = $row;
}
for ($i=0; $i<count($dates); $i++)
@@ -469,7 +469,7 @@ SELECT DISTINCT i.*
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($dates[$i]['elements'], $row);
+ $dates[$i]['elements'][] = $row;
}
}
@@ -489,7 +489,7 @@ SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) AS img_count
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($dates[$i]['categories'], $row);
+ $dates[$i]['categories'][] = $row;
}
}
}
@@ -546,8 +546,7 @@ function get_html_description_recent_post_date($date_detail)
$description .=
'<li>'
- .l10n_dec('%d album updated', '%d albums updated',
- $date_detail['nb_cats'])
+ .l10n_dec('%d album updated', '%d albums updated', $date_detail['nb_cats'])
.'</li>';
$description .= '<ul>';
@@ -557,8 +556,7 @@ function get_html_description_recent_post_date($date_detail)
'<li>'
.get_cat_display_name_cache($cat['uppercats'])
.' ('.
- l10n_dec('%d new photo',
- '%d new photos', $cat['img_count']).')'
+ l10n_dec('%d new photo', '%d new photos', $cat['img_count']).')'
.'</li>';
}
$description .= '</ul>';
diff --git a/include/functions_plugins.inc.php b/include/functions_plugins.inc.php
index e11e35dc5..03dcbf851 100644
--- a/include/functions_plugins.inc.php
+++ b/include/functions_plugins.inc.php
@@ -220,7 +220,7 @@ SELECT * FROM '.PLUGINS_TABLE;
$plugins = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($plugins, $row);
+ $plugins[] = $row;
}
return $plugins;
}
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index 6494f0d61..6c57b9e90 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -68,18 +68,15 @@ function get_sql_search_clause($search)
$local_clauses = array();
foreach ($search['fields'][$textfield]['words'] as $word)
{
- array_push($local_clauses, $textfield." LIKE '%".$word."%'");
+ $local_clauses[] = $textfield." LIKE '%".$word."%'";
}
// adds brackets around where clauses
$local_clauses = prepend_append_array_items($local_clauses, '(', ')');
- array_push(
- $clauses,
- implode(
- ' '.$search['fields'][$textfield]['mode'].' ',
- $local_clauses
- )
+ $clauses[] = implode(
+ ' '.$search['fields'][$textfield]['mode'].' ',
+ $local_clauses
);
}
}
@@ -100,15 +97,12 @@ function get_sql_search_clause($search)
$field_clauses = array();
foreach ($fields as $field)
{
- array_push($field_clauses, $field." LIKE '%".$word."%'");
+ $field_clauses[] = $field." LIKE '%".$word."%'";
}
// adds brackets around where clauses
- array_push(
- $word_clauses,
- implode(
- "\n OR ",
- $field_clauses
- )
+ $word_clauses[] = implode(
+ "\n OR ",
+ $field_clauses
);
}
@@ -117,26 +111,18 @@ function get_sql_search_clause($search)
create_function('&$s','$s="(".$s.")";')
);
- array_push(
- $clauses,
- "\n ".
+ $clauses[] = "\n ".
implode(
- "\n ".
- $search['fields']['allwords']['mode'].
- "\n ",
+ "\n ". $search['fields']['allwords']['mode']. "\n ",
$word_clauses
- )
- );
+ );
}
foreach (array('date_available', 'date_creation') as $datefield)
{
if (isset($search['fields'][$datefield]))
{
- array_push(
- $clauses,
- $datefield." = '".$search['fields'][$datefield]['date']."'"
- );
+ $clauses[] = $datefield." = '".$search['fields'][$datefield]['date']."'"
}
foreach (array('after','before') as $suffix)
@@ -145,15 +131,10 @@ function get_sql_search_clause($search)
if (isset($search['fields'][$key]))
{
- array_push(
- $clauses,
-
- $datefield.
+ $clauses[] = $datefield.
($suffix == 'after' ? ' >' : ' <').
($search['fields'][$key]['inc'] ? '=' : '').
- " '".$search['fields'][$key]['date']."'"
-
- );
+ " '".$search['fields'][$key]['date']."'";
}
}
}
@@ -171,7 +152,7 @@ function get_sql_search_clause($search)
}
$local_clause = 'category_id IN ('.implode(',', $cat_ids).')';
- array_push($clauses, $local_clause);
+ $clauses[] = $local_clause;
}
// adds brackets around where clauses
diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php
index 17ae996ab..52f01ab88 100644
--- a/include/functions_tag.inc.php
+++ b/include/functions_tag.inc.php
@@ -332,7 +332,7 @@ SELECT *
$tags = array();
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($tags, $row);
+ $tags[] = $row;
}
return $tags;
}
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 2e56c67c9..02b938ecb 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -466,14 +466,13 @@ function parse_section_url( $tokens, &$next_token)
{
if (empty($maybe_permalinks))
{
- array_push($maybe_permalinks, $tokens[$current_token]);
+ $maybe_permalinks[] = $tokens[$current_token];
}
else
{
- array_push($maybe_permalinks,
+ $maybe_permalinks[] =
$maybe_permalinks[count($maybe_permalinks)-1]
- . '/' . $tokens[$current_token]
- );
+ . '/' . $tokens[$current_token];
}
$current_token++;
}
@@ -527,11 +526,11 @@ function parse_section_url( $tokens, &$next_token)
if ( $conf['tag_url_style'] != 'tag' and preg_match('/^(\d+)(?:-(.*)|)$/', $tokens[$i], $matches) )
{
- array_push($requested_tag_ids, $matches[1]);
+ $requested_tag_ids[] = $matches[1];
}
else
{
- array_push($requested_tag_url_names, $tokens[$i]);
+ $requested_tag_url_names[] = $tokens[$i];
}
$i++;
}
@@ -597,7 +596,7 @@ function parse_section_url( $tokens, &$next_token)
if (empty($tokens[$next_token]))
{
// Add dummy element list
- array_push($page['list'], -1);
+ $page['list'][] = -1;
}
// With pictures list
else
@@ -608,7 +607,7 @@ function parse_section_url( $tokens, &$next_token)
}
foreach (explode(',', $tokens[$next_token]) as $image_id)
{
- array_push($page['list'], $image_id);
+ $page['list'][] = $image_id;
}
}
$next_token++;
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index 9a4cef3dd..090c595bf 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -60,13 +60,13 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
switch ($comment_action)
{
case 'moderate':
- array_push($page['infos'], l10n('An administrator must authorize your comment before it is visible.') );
+ $page['infos'][] = l10n('An administrator must authorize your comment before it is visible.');
case 'validate':
- array_push($page['infos'], l10n('Your comment has been registered'));
+ $page['infos'][] = l10n('Your comment has been registered');
break;
case 'reject':
set_status_header(403);
- array_push($page['errors'], l10n('Your comment has NOT been registered because it did not pass the validation rules') );
+ $page['errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules');
break;
default:
trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index c71c44780..0b85c2c33 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -339,7 +339,7 @@ else
$page['tag_ids'] = array();
foreach ($page['tags'] as $tag)
{
- array_push($page['tag_ids'], $tag['id']);
+ $page['tag_ids'][] = $tag['id'];
}
$items = get_image_ids_for_tags($page['tag_ids']);
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index f5f136279..4d8a40af8 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -401,7 +401,7 @@ SELECT id
$datas = array();
foreach ( array_from_query($query, 'id') as $id )
{
- array_push($datas, array('element_id'=>$id, 'user_id'=>$user['id']) );
+ $datas[] = array('element_id'=>$id, 'user_id'=>$user['id']);
}
if (count($datas))
{
@@ -793,7 +793,7 @@ SELECT id, path, representative_ext, level
if (isset($image_id) and !in_array($image_id, $image_ids))
{
- array_push($new_image_ids, $image_id);
+ $new_image_ids[] = $image_id;
}
if ($conf['representative_cache_on_level'])
@@ -832,13 +832,10 @@ SELECT id, path, representative_ext
foreach ($user_representative_updates_for as $cat_id => $image_id)
{
- array_push(
- $updates,
- array(
- 'user_id' => $user['id'],
- 'cat_id' => $cat_id,
- 'user_representative_picture_id' => $image_id,
- )
+ $updates[] = array(
+ 'user_id' => $user['id'],
+ 'cat_id' => $cat_id,
+ 'user_representative_picture_id' => $image_id,
);
}
@@ -994,13 +991,13 @@ SELECT DISTINCT image_id
switch ($comment_action)
{
case 'reject':
- array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules') );
+ $infos[] = l10n('Your comment has NOT been registered because it did not pass the validation rules');
return new PwgError(403, implode("; ", $infos) );
case 'validate':
case 'moderate':
$ret = array(
- 'id' => $comm['id'],
- 'validation' => $comment_action=='validate',
+ 'id' => $comm['id'],
+ 'validation' => $comment_action=='validate',
);
return array( 'comment' => new PwgNamedStruct($ret) );
default:
@@ -1071,7 +1068,7 @@ SELECT id, name, permalink, uppercats, global_rank, commentable
)
);
$row['id']=(int)$row['id'];
- array_push($related_categories, $row);
+ $related_categories[] = $row;
}
usort($related_categories, 'global_rank_compare');
if ( empty($related_categories) )
@@ -1544,7 +1541,7 @@ function merge_chunks($output_filepath, $original_sum, $type)
if (preg_match($pattern, $file))
{
ws_logfile($file);
- array_push($chunks, $upload_dir.'/'.$file);
+ $chunks[] = $upload_dir.'/'.$file;
}
}
closedir($handle);
@@ -1601,7 +1598,7 @@ function remove_chunks($original_sum, $type)
{
if (preg_match($pattern, $file))
{
- array_push($chunks, $upload_dir.'/'.$file);
+ $chunks[] = $upload_dir.'/'.$file;
}
}
closedir($handle);
@@ -1958,8 +1955,7 @@ SELECT *
{
foreach ($params['tags'] as $tag_name)
{
- $tag_id = tag_id_from_tag_name($tag_name);
- array_push($tag_ids, $tag_id);
+ $tag_ids[] = tag_id_from_tag_name($tag_name);
}
}
else
@@ -1967,8 +1963,7 @@ SELECT *
$tag_names = preg_split('~(?<!\\\),~', $params['tags']);
foreach ($tag_names as $tag_name)
{
- $tag_id = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
- array_push($tag_ids, $tag_id);
+ $tag_ids[] = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
}
}
@@ -2662,7 +2657,7 @@ function ws_images_delete($params, $service)
{
if ($image_id > 0)
{
- array_push($image_ids, $image_id);
+ $image_ids[] = $image_id;
}
}
@@ -2694,7 +2689,7 @@ function ws_add_image_category_relations($image_id, $categories_string, $replace
continue;
}
- array_push($cat_ids, $cat_id);
+ $cat_ids[] = $cat_id;
if (!isset($rank))
{
@@ -2803,13 +2798,10 @@ SELECT
foreach ($new_cat_ids as $cat_id)
{
- array_push(
- $inserts,
- array(
- 'image_id' => $image_id,
- 'category_id' => $cat_id,
- 'rank' => $rank_on_category[$cat_id],
- )
+ $inserts[] = array(
+ 'image_id' => $image_id,
+ 'category_id' => $cat_id,
+ 'rank' => $rank_on_category[$cat_id],
);
}
@@ -2995,7 +2987,7 @@ function ws_categories_delete($params, $service)
{
if ($category_id > 0)
{
- array_push($category_ids, $category_id);
+ $category_ids[] = $category_id;
}
}
@@ -3053,7 +3045,7 @@ function ws_categories_move($params, $service)
{
if ($category_id > 0)
{
- array_push($category_ids, $category_id);
+ $category_ids[] = $category_id;
}
}
@@ -3420,7 +3412,7 @@ function ws_extensions_ignoreupdate($params, $service)
// Add or remove extension from ignore list
if (!in_array($params['id'], $conf['updates_ignored'][$params['type']]))
{
- array_push($conf['updates_ignored'][$params['type']], $params['id']);
+ $conf['updates_ignored'][ $params['type'] ][] = $params['id'];
}
conf_update_param('updates_ignored', pwg_db_real_escape_string(serialize($conf['updates_ignored'])));
unset($_SESSION['extensions_need_update']);
diff --git a/include/ws_protocols/rest_encoder.php b/include/ws_protocols/rest_encoder.php
index c02d18222..da493c14e 100644
--- a/include/ws_protocols/rest_encoder.php
+++ b/include/ws_protocols/rest_encoder.php
@@ -66,7 +66,7 @@ class PwgXmlWriter
}
$this->_output( '<'.$name );
$this->_lastTagOpen = true;
- array_push( $this->_elementStack, $name);
+ $this->_elementStack[] = $name;
}
function end_element($x)
diff --git a/install.php b/install.php
index d1a6f88ea..e41498cbb 100644
--- a/install.php
+++ b/install.php
@@ -252,25 +252,35 @@ include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php');
include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
-if ( isset( $_POST['install'] ))
+if (isset($_POST['install']))
{
install_db_connect($infos, $errors);
pwg_db_check_charset();
- $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name ));
- if ( empty($webmaster))
- array_push( $errors, l10n('enter a login for webmaster') );
- else if ( preg_match( '/[\'"]/', $webmaster ) )
- array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') );
- if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) )
- array_push( $errors, l10n('please enter your password again') );
- if ( empty($admin_mail))
- array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') );
+ $webmaster = trim(preg_replace('/\s{2,}/', ' ', $admin_name));
+ if (empty($webmaster))
+ {
+ $errors[] = l10n('enter a login for webmaster');
+ }
+ else if (preg_match( '/[\'"]/', $webmaster))
+ {
+ $errors[] = l10n('webmaster login can\'t contain characters \' or "');
+ }
+ if ($admin_pass1 != $admin_pass2 || empty($admin_pass1))
+ {
+ $errors[] = l10n('please enter your password again');
+ }
+ if (empty($admin_mail))
+ {
+ $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
+ }
else
{
$error_mail_address = validate_mail_address(null, $admin_mail);
if (!empty($error_mail_address))
- array_push( $errors, $error_mail_address );
+ {
+ $errors[] = $error_mail_address;
+ }
}
if ( count( $errors ) == 0 )
@@ -388,13 +398,10 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment)
$datas = array();
foreach (get_available_upgrade_ids() as $upgrade_id)
{
- array_push(
- $datas,
- array(
- 'id' => $upgrade_id,
- 'applied' => CURRENT_DATE,
- 'description' => 'upgrade included in installation',
- )
+ $datas[] = array(
+ 'id' => $upgrade_id,
+ 'applied' => CURRENT_DATE,
+ 'description' => 'upgrade included in installation',
);
}
mass_inserts(
@@ -449,14 +456,11 @@ if ($step == 1)
}
else
{
- array_push(
- $infos,
- l10n('Congratulations, Piwigo installation is completed')
- );
+ $infos[] = l10n('Congratulations, Piwigo installation is completed');
if (isset($error_copy))
{
- array_push($errors, $error_copy);
+ $errors[] = $error_copy;
}
else
{
diff --git a/nbm.php b/nbm.php
index a15da2dc3..ac1ba723c 100644
--- a/nbm.php
+++ b/nbm.php
@@ -45,15 +45,14 @@ if (isset($_GET['subscribe'])
{
subscribe_notification_by_mail(false, array($_GET['subscribe']));
}
-else
-if (isset($_GET['unsubscribe'])
+else if (isset($_GET['unsubscribe'])
and preg_match('/^[A-Za-z0-9]{16}$/', $_GET['unsubscribe']))
{
unsubscribe_notification_by_mail(false, array($_GET['unsubscribe']));
}
else
{
- array_push($page['errors'], l10n('Unknown identifier'));
+ $page['errors'][] = l10n('Unknown identifier');
}
// +-----------------------------------------------------------------------+
diff --git a/password.php b/password.php
index 6b0221fac..f1b446832 100644
--- a/password.php
+++ b/password.php
@@ -53,7 +53,7 @@ function process_password_request()
if (empty($_POST['username_or_email']))
{
- array_push($page['errors'], l10n('Invalid username or email'));
+ $page['errors'][] = l10n('Invalid username or email');
return false;
}
@@ -66,7 +66,7 @@ function process_password_request()
if (!is_numeric($user_id))
{
- array_push($page['errors'], l10n('Invalid username or email'));
+ $page['errors'][] = l10n('Invalid username or email');
return false;
}
@@ -76,18 +76,15 @@ function process_password_request()
$status = $userdata['status'];
if (is_a_guest($status) or is_generic($status))
{
- array_push($page['errors'], l10n('Password reset is not allowed for this user'));
+ $page['errors'][] = l10n('Password reset is not allowed for this user');
return false;
}
if (empty($userdata['email']))
{
- array_push(
- $page['errors'],
- l10n(
- 'User "%s" has no email address, password reset is not possible',
- $userdata['username']
- )
+ $page['errors'][] = l10n(
+ 'User "%s" has no email address, password reset is not possible',
+ $userdata['username']
);
return false;
}
@@ -130,12 +127,12 @@ function process_password_request()
if (pwg_mail($userdata['email'], $email_params))
{
- array_push($page['infos'], l10n('Check your email for the confirmation link'));
+ $page['infos'][] = l10n('Check your email for the confirmation link');
return true;
}
else
{
- array_push($page['errors'], l10n('Error sending email'));
+ $page['errors'][] = l10n('Error sending email');
return false;
}
}
@@ -152,7 +149,7 @@ function check_password_reset_key($key)
if (!preg_match('/^[a-z0-9]{20}$/i', $key))
{
- array_push($page['errors'], l10n('Invalid key'));
+ $page['errors'][] = l10n('Invalid key');
return false;
}
@@ -167,7 +164,7 @@ SELECT
if (pwg_db_num_rows($result) == 0)
{
- array_push($page['errors'], l10n('Invalid key'));
+ $page['errors'][] = l10n('Invalid key');
return false;
}
@@ -175,7 +172,7 @@ SELECT
if (is_a_guest($userdata['status']) or is_generic($userdata['status']))
{
- array_push($page['errors'], l10n('Password reset is not allowed for this user'));
+ $page['errors'][] = l10n('Password reset is not allowed for this user');
return false;
}
@@ -194,7 +191,7 @@ function reset_password()
if ($_POST['use_new_pwd'] != $_POST['passwordConf'])
{
- array_push($page['errors'], l10n('The passwords do not match'));
+ $page['errors'][] = l10n('The passwords do not match');
return false;
}
@@ -203,7 +200,7 @@ function reset_password()
$user_id = check_password_reset_key($_GET['key']);
if (!is_numeric($user_id))
{
- array_push($page['errors'], l10n('Invalid key'));
+ $page['errors'][] = l10n('Invalid key');
return false;
}
}
@@ -212,7 +209,7 @@ function reset_password()
// we check the currently logged in user
if (is_a_guest() or is_generic())
{
- array_push($page['errors'], l10n('Password reset is not allowed for this user'));
+ $page['errors'][] = l10n('Password reset is not allowed for this user');
return false;
}
@@ -225,15 +222,15 @@ function reset_password()
array($conf['user_fields']['id'] => $user_id)
);
- array_push($page['infos'], l10n('Your password has been reset'));
+ $page['infos'][] = l10n('Your password has been reset');
if (isset($_GET['key']))
{
- array_push($page['infos'], '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>');
+ $page['infos'][] = '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>';
}
else
{
- array_push($page['infos'], '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>');
+ $page['infos'][] = '<a href="'.get_gallery_home_url().'">'.l10n('Return to home page').'</a>';
}
return true;
diff --git a/picture.php b/picture.php
index dfe2bf965..13a02b863 100644
--- a/picture.php
+++ b/picture.php
@@ -102,8 +102,8 @@ SELECT id
{
if ('best_rated'==$page['section'])
{
- $page['rank_of'][$page['image_id']] = count($page['items']);
- array_push($page['items'], $page['image_id'] );
+ $page['rank_of'][ $page['image_id'] ] = count($page['items']);
+ $page['items'][] = $page['image_id'];
}
else
{
@@ -468,13 +468,13 @@ $picture = array();
$ids = array($page['image_id']);
if (isset($page['previous_item']))
{
- array_push($ids, $page['previous_item']);
- array_push($ids, $page['first_item']);
+ $ids[] = $page['previous_item'];
+ $ids[] = $page['first_item'];
}
if (isset($page['next_item']))
{
- array_push($ids, $page['next_item']);
- array_push($ids, $page['last_item']);
+ $ids[] = $page['next_item'];
+ $ids[] = $page['last_item'];
}
$query = '
diff --git a/plugins/LocalFilesEditor/admin.php b/plugins/LocalFilesEditor/admin.php
index 71d0e220f..29a5b6324 100644
--- a/plugins/LocalFilesEditor/admin.php
+++ b/plugins/LocalFilesEditor/admin.php
@@ -56,9 +56,8 @@ include_once(LOCALEDIT_PATH.'include/'.$page['tab'].'.inc.php');
if (isset($_POST['restore']))
{
$content_file = file_get_contents(get_bak_file($edited_file));
- array_push($page['infos'],
- l10n('locfiledit_bak_loaded1'),
- l10n('locfiledit_bak_loaded2'));
+ $page['infos'][] = l10n('locfiledit_bak_loaded1'),
+ $page['infos'][] = l10n('locfiledit_bak_loaded2');
}
// +-----------------------------------------------------------------------+
@@ -70,7 +69,7 @@ if (isset($_POST['submit']))
if (!is_webmaster())
{
- array_push($page['errors'], l10n('locfiledit_webmaster_only'));
+ $page['errors'][] = l10n('locfiledit_webmaster_only');
}
else
{
@@ -81,7 +80,7 @@ if (isset($_POST['submit']))
}
if ($content_file === false)
{
- array_push($page['errors'], l10n('locfiledit_syntax_error'));
+ $page['errors'][] = l10n('locfiledit_syntax_error');
}
else
{
@@ -92,7 +91,7 @@ if (isset($_POST['submit']))
if (file_exists($edited_file))
{
@copy($edited_file, get_bak_file($edited_file));
- array_push($page['infos'], l10n('locfiledit_saved_bak', substr(get_bak_file($edited_file), 2)));
+ $page['infos'][] = l10n('locfiledit_saved_bak', substr(get_bak_file($edited_file), 2));
}
if ($file = @fopen($edited_file , "w"))
@@ -104,7 +103,7 @@ if (isset($_POST['submit']))
}
else
{
- array_push($page['errors'], l10n('locfiledit_cant_save'));
+ $page['errors'][] = l10n('locfiledit_cant_save');
}
}
}
diff --git a/plugins/LocalFilesEditor/include/css.inc.php b/plugins/LocalFilesEditor/include/css.inc.php
index e1d70995a..17ea92766 100644
--- a/plugins/LocalFilesEditor/include/css.inc.php
+++ b/plugins/LocalFilesEditor/include/css.inc.php
@@ -64,7 +64,7 @@ $db_themes = $themes->get_db_themes();
$db_theme_ids = array();
foreach ($db_themes as $db_theme)
{
- array_push($db_theme_ids, $db_theme['id']);
+ $db_theme_ids[] = $db_theme['id'];
}
$active_themes = array();
@@ -85,12 +85,12 @@ foreach ($themes->fs_themes as $theme_id => $fs_theme)
}
else
{
- array_push($active_themes, $fs_theme);
+ $active_themes[] = $fs_theme;
}
}
else
{
- array_push($inactive_themes, $fs_theme);
+ $inactive_themes[] = $fs_theme;
}
}
diff --git a/plugins/LocalFilesEditor/include/tpl.inc.php b/plugins/LocalFilesEditor/include/tpl.inc.php
index 4e985ac92..c1079a8e7 100644
--- a/plugins/LocalFilesEditor/include/tpl.inc.php
+++ b/plugins/LocalFilesEditor/include/tpl.inc.php
@@ -39,7 +39,7 @@ if (isset($_POST['create_tpl']))
$filename = $_POST['tpl_name'];
if (empty($filename))
{
- array_push($page['errors'], l10n('locfiledit_empty_filename'));
+ $page['errors'][] = l10n('locfiledit_empty_filename');
}
if (get_extension($filename) != 'tpl')
{
@@ -47,15 +47,15 @@ if (isset($_POST['create_tpl']))
}
if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename))
{
- array_push($page['errors'], l10n('locfiledit_filename_error'));
+ $page['errors'][] = l10n('locfiledit_filename_error');
}
if (is_numeric($_POST['tpl_model']) and $_POST['tpl_model'] != '0')
{
- array_push($page['errors'], l10n('locfiledit_model_error'));
+ $page['errors'][] = l10n('locfiledit_model_error');
}
if (file_exists($_POST['tpl_parent'] . '/' . $filename))
{
- array_push($page['errors'], l10n('locfiledit_file_already_exists'));
+ $page['errors'][] = l10n('locfiledit_file_already_exists');
}
if (!empty($page['errors']))
{
diff --git a/plugins/LocalFilesEditor/main.inc.php b/plugins/LocalFilesEditor/main.inc.php
index e0a4eea75..cfe92c8b9 100644
--- a/plugins/LocalFilesEditor/main.inc.php
+++ b/plugins/LocalFilesEditor/main.inc.php
@@ -35,12 +35,9 @@ define('LOCALEDIT_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'
function localfiles_admin_menu($menu)
{
- array_push(
- $menu,
- array(
- 'NAME' => 'LocalFiles Editor',
- 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
- )
+ $menu[] = array(
+ 'NAME' => 'LocalFiles Editor',
+ 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
);
return $menu;
diff --git a/profile.php b/profile.php
index 741fcc40e..0bf6b3fe4 100644
--- a/profile.php
+++ b/profile.php
@@ -201,7 +201,7 @@ function save_profile_from_post($userdata, &$errors)
// password is updated only if filled
if (!empty($_POST['use_new_pwd']))
{
- array_push($fields, $conf['user_fields']['password']);
+ $fields[] = $conf['user_fields']['password'];
// password is hashed with function $conf['password_hash']
$data{$conf['user_fields']['password']} = $conf['password_hash']($_POST['use_new_pwd']);
}
@@ -211,12 +211,12 @@ function save_profile_from_post($userdata, &$errors)
{
if ($_POST['username'] != $userdata['username'] and get_userid($_POST['username']))
{
- array_push($page['errors'], l10n('this login is already used'));
+ $page['errors'][] = l10n('this login is already used');
unset($_POST['redirect']);
}
else
{
- array_push($fields, $conf['user_fields']['username']);
+ $fields[] = $conf['user_fields']['username'];
$data{$conf['user_fields']['username']} = $_POST['username'];
// send email to the user
@@ -262,7 +262,7 @@ function save_profile_from_post($userdata, &$errors)
if ($conf['activate_comments'])
{
- array_push($fields, 'show_nb_comments');
+ $fields[] = 'show_nb_comments';
}
$data = array();
diff --git a/register.php b/register.php
index dfc5ac487..02a1a1800 100644
--- a/register.php
+++ b/register.php
@@ -44,12 +44,12 @@ if (isset($_POST['submit']))
if (!verify_ephemeral_key(@$_POST['key']))
{
set_status_header(403);
- array_push($page['errors'], 'Invalid/expired form key');
+ $page['errors'][] = l10n('Invalid/expired form key');
}
if ($_POST['password'] != $_POST['password_conf'])
{
- array_push($page['errors'], l10n('please enter your password again'));
+ $page['errors'][] = l10n('please enter your password again');
}
$page['errors'] =
diff --git a/search.php b/search.php
index 6a57128f2..f33dd1509 100644
--- a/search.php
+++ b/search.php
@@ -149,7 +149,7 @@ INSERT INTO '.SEARCH_TABLE.'
}
else
{
- array_push($page['errors'], l10n('Empty query. No criteria has been entered.'));
+ $page['errors'][] = l10n('Empty query. No criteria has been entered.');
}
}
//----------------------------------------------------------------- redirection
diff --git a/search_rules.php b/search_rules.php
index 4217fe2e9..56664a148 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -138,7 +138,7 @@ SELECT id, uppercats, global_rank
{
while ($row = pwg_db_fetch_assoc($result))
{
- array_push($categories, $row);
+ $categories[] = $row;
}
}
usort($categories, 'global_rank_compare');
diff --git a/tags.php b/tags.php
index 2a7a0d83b..ada7be827 100644
--- a/tags.php
+++ b/tags.php
@@ -131,17 +131,10 @@ if ($page['display_mode'] == 'letters') {
);
}
- array_push(
- $letter['tags'],
- array_merge(
- $tag,
- array(
- 'URL' => make_index_url(
- array(
- 'tags' => array($tag),
- )
- ),
- )
+ $letter['tags'][] = array_merge(
+ $tag,
+ array(
+ 'URL' => make_index_url(array('tags' => array($tag))),
)
);
diff --git a/upgrade.php b/upgrade.php
index 446f1ee17..06014b3fc 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -73,7 +73,7 @@ SHOW TABLES
{
if (preg_match('/^'.PREFIX_TABLE.'/', $row[0]))
{
- array_push($tables, $row[0]);
+ $tables[] = $row[0];
}
}
@@ -100,7 +100,7 @@ DESC '.$table.'
while ($row = pwg_db_fetch_row($result))
{
- array_push($columns_of[$table], $row[0]);
+ $columns_of[$table][] = $row[0];
}
}
@@ -389,15 +389,12 @@ if ((isset($_POST['submit']) or isset($_GET['now']))
if (!@file_put_contents($config_file, $config_file_contents))
{
- array_push(
- $page['infos'],
- sprintf(
- l10n('In <i>%s</i>, before <b>?></b>, insert:'),
- PWG_LOCAL_DIR.'config/database.inc.php'
- )
- .'<p><textarea rows="4" cols="40">'
- .implode("\r\n" , $mysql_changes).'</textarea></p>'
- );
+ $page['infos'][] = l10n(
+ 'In <i>%s</i>, before <b>?></b>, insert:',
+ PWG_LOCAL_DIR.'config/database.inc.php'
+ )
+ .'<p><textarea rows="4" cols="40">'
+ .implode("\r\n" , $mysql_changes).'</textarea></p>';
}
}
@@ -430,9 +427,7 @@ if ((isset($_POST['submit']) or isset($_GET['now']))
)
);
- array_push($page['infos'],
- l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.')
- );
+ $page['infos'][] = l10n('Perform a maintenance check in [Administration>Tools>Maintenance] if you encounter any problem.');
// Save $page['infos'] in order to restore after maintenance actions
$page['infos_sav'] = $page['infos'];