aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
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
54 files changed, 517 insertions, 844 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 = '